本文整理了Java中pl.edu.icm.model.bwmeta.y.YElement.getContents()
方法的一些代码示例,展示了YElement.getContents()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YElement.getContents()
方法的具体详情如下:
包路径:pl.edu.icm.model.bwmeta.y.YElement
类名称:YElement
方法名:getContents
暂无
代码示例来源:origin: pl.edu.icm.synat/synat-business-services-api
@Override
public boolean hasChapteredContent(YElement element) {
if (element.getContents() != null) {
return hasChapteredContent(element.getContents());
}
return false;
}
代码示例来源:origin: pl.edu.icm.synat/synat-business-services-api
@Override
public boolean isContentAvailable(YElement yElement) {
String mainLevel = fetchCurrentStructureLevel(yElement);
if (yElement.getContents() != null && !yElement.getContents().isEmpty()) {
return checkContentAvailable(yElement.getContents(), mainLevel);
}
return false;
}
代码示例来源:origin: pl.edu.icm.yadda/bwmeta-import
public void convertContentLocations(YExportable entity) {
if (!(entity instanceof YElement)) {
return;
}
YElement element = (YElement) entity;
for (YContentEntry<?> entry : element.getContents()) {
convertContentLocations(entry);
}
}
代码示例来源:origin: pl.edu.icm.synat/synat-portal-core
private boolean checkIfContentPresent(final YElement yElement, final String fileId) {
for (YContentEntry<?> content : yElement.getContents()) {
if (content instanceof YContentFile) {
if (StringUtils.equals(((YContentFile) content).getId(), fileId)) {
return true;
}
}
}
return false;
}
代码示例来源:origin: pl.edu.icm.synat/synat-process-common
private void prepareCover(YElement element, String location, String mimeType, String fileId) {
List<String> locations = new ArrayList<String>();
locations.add(fileId);
locations.add(location);
YContentFile newCover = new YContentFile(fileId, FileTypes.FT_COVER, mimeType, locations);
element.getContents().add(newCover);
}
代码示例来源:origin: pl.edu.icm.synat/synat-process-common
public static void processYContents(YElement element, Predicate<YContentEntry<?>> shouldDeletePredicate) {
if (element == null) {
return;
}
processYContents(element.getContents(), shouldDeletePredicate);
}
代码示例来源:origin: pl.edu.icm.synat/synat-business-services-api
@Override
public List<ContentEntryData> translateContentList(YElement element, Locale locale) {
final String mainLevel = yModelPropertyExtractor.fetchCurrentStructureLevel(element);
if (element.getContents() != null) {
return translateContent(element.getContents(), locale, mainLevel);
} else {
return new ArrayList<ContentEntryData>();
}
}
代码示例来源:origin: pl.edu.icm.yadda/bwmeta-import
public void convertContentLocations(YExportable entity) {
if (!(entity instanceof YElement)) {
return;
}
YElement element = (YElement) entity;
for (YContentEntry<?> entry : element.getContents()) {
convertContentLocations(entry);
}
}
代码示例来源:origin: pl.edu.icm.synat/synat-portal-core
private Map<String, YContentFile> scanForFulltextFiles(YElement yElement, String... fileFormats) {
Set<String> formats = Sets.newHashSet(fileFormats);
return scanForFulltextFiles(yElement.getContents(), formats);
}
代码示例来源:origin: pl.edu.icm.synat/synat-business-services-api
@Override
public List<ContentChapterData> translateContentChapters(YElement element, Locale locale) {
final String mainLevel = yModelPropertyExtractor.fetchCurrentStructureLevel(element);
if (element.getContents() != null) {
return transformChaptersContent(findChapters(element.getContents(), locale), locale, mainLevel);
} else {
return new ArrayList<ContentChapterData>();
}
}
代码示例来源:origin: pl.edu.icm.synat/synat-portal-core
/**
* For Pionier video stream we must put stream url instead of video id in youtube case.
* @param model, {@code COMP_VIDEO_PLAYER} and {@code COMP_VIDEO_FORMAT} will be put.
* @param yElement, {@code YElement.getContents()} is used for model fill up.
*/
public void prepareVideoAttributes(Model model, YElement yElement) {
final String videoId = prepareVideoId(yElement.getContents());
final String videoFormat = prepareVideoFormat(yElement.getContents());
if ("pionierFormat".equals(videoFormat)) {
model.addAttribute(COMP_VIDEO_PLAYER, preparePionierStreamUrl(videoId));
} else {
model.addAttribute(COMP_VIDEO_PLAYER, videoId);
}
model.addAttribute(COMP_VIDEO_FORMAT, videoFormat);
}
代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers
protected void fillFormats(YElement yElement, List<YExportable> referedElements, Map<String, List<StringWithAttributes>> ret) {
// format element
for (YContentEntry<?> yContentEntry : yElement.getContents()) {
if (yContentEntry.isFile()) {
if (!ret.containsKey(E_FORMAT)) {
ret.put(E_FORMAT, new ArrayList<StringWithAttributes>());
}
ret.get(E_FORMAT).add(new StringWithAttributes(((YContentFile) yContentEntry).getFormat()));
}
}
}
代码示例来源:origin: pl.edu.icm.yadda/yaddaweb-lite-core
protected String resolveCoverUrl(YElement element) {
for (YContentEntry e : element.getContents()) {
if (e.isFile()) {
YContentFile cFile = (YContentFile) e;
String location = cFile.getLocations().get(0);
if (location != null && ((cFile.getType() != null &&
cFile.getType().equals("cover") || anyContentAsCover))) {
return "download/" + location.replace("yar://", "");
}
}
}
return null;
}
代码示例来源:origin: pl.edu.icm.synat/synat-portal-core
private boolean isLicensedContent(ElementMetadata elementMetadata, String contentPath) {
YElement yElement = (YElement) elementMetadata.getContent();
for (YContentEntry<?> entry : yElement.getContents()) {
if (entry.isFile()) {
YContentFile contentFile = (YContentFile) entry;
if (contentFile.getLocations().contains(contentPath) && notLicensedContentTypes != null
&& notLicensedContentTypes.contains(contentFile.getType())) {
return false;
}
}
}
return true;
}
代码示例来源:origin: pl.edu.icm.yadda/bwmeta-import
@Override
public String constructFieldValue(List<YElement> yelements) {
List<YElement> articles = YElementsParsingToolbox.filterYElementsOfStructureLevel(yelements,
YConstants.EXT_LEVEL_JOURNAL_ARTICLE);
if (articles.size() == 0) {
return null;
}
if (articles.size() > 1) {
log.error("More than one article found in package of yelements!");
}
YElement article = articles.get(0);
List<YContentEntry> contents = article.getContents();
String fullTextLocation = findLocationOfContentLink(contents, YConstants.FT_FULL_TEXT);
if (fullTextLocation != null && fullTextLocation.length() > 0) {
return YElementsParsingToolbox.removeEmptyValues(fullTextLocation);
}
return YElementsParsingToolbox.removeEmptyValues(findLocationOfContentLink(contents, YConstants.FT_PLAIN_TEXT));
}
代码示例来源:origin: pl.edu.icm.synat/synat-portal-core
public static List<FilteredContentEntry<?>> fetchPlainTextContentEntries(YElement element) {
ContentBrowser contentBrowser = new ContentBrowser();
HasFilesContentFilter filter = new PlainTextContentFilter();
return contentBrowser.filter(element.getContents(), filter);
}
代码示例来源:origin: pl.edu.icm.synat/synat-portal-core
protected void fillFormats(HtmlMetaHeaders metadata, YElement yElement) {
for (YContentEntry<?> yContentEntry : yElement.getContents()) {
if (yContentEntry.isFile()) {
YContentFile yContentFile = (YContentFile) yContentEntry;
metadata.addMetadataName(DC_NAMESPACE + SEPARATOR + DublinCoreStrings.E_FORMAT, yContentFile.getFormat());
}
}
}
代码示例来源:origin: pl.edu.icm.synat/synat-portal-core
public static boolean hasPlainTextContentEntries(YElement element) {
ContentBrowser contentBrowser = new ContentBrowser();
HasFilesContentFilter filter = new PlainTextContentFilter();
contentBrowser.filter(element.getContents(), filter);
return filter.hasFiles();
}
代码示例来源:origin: pl.edu.icm.synat/synat-importer-direct
@Override
public void parseMetadata(YElement element, PublicationMeta pm, YLanguage defaultLanguage, List<YElement> ancestors) {
if (pm.getLinkGroup() != null) {
pm.getXmlLang();
for (Link link : pm.getLinkGroup().getLink()) {
switch (link.getType()) {
case "toTypesetVersion":
element.getContents().add(getContentFile(link));
continue;
default:
LOGGER.info("Unknown link type: " + link.getType());
}
}
}
}
代码示例来源:origin: pl.edu.icm.synat/synat-business-services-impl
@SuppressWarnings("rawtypes")
public Mets transform(YElement yElement) {
List<YContentEntry> contents = yElement.getContents();
Mets mets = new Mets();
FileSec fileSec = new FileSec();
mets.setFileSec(fileSec);
FileGrp mainFileGroup = new FileGrp();
mainFileGroup.setID("main");
extractContents(yElement.getId(), contents, mainFileGroup);
fileSec.getFileGrps().add(mainFileGroup);
mets.setID(yElement.getId());
String label = prepareLabel(yElement);
mets.setLABEL(label);
addDCMetadata(mets.getDmdSecs(), yElement);
addBwmeta(mets.getDmdSecs(), yElement);
return mets;
}
内容来源于网络,如有侵权,请联系作者删除!