本文整理了Java中pl.edu.icm.synat.logic.model.utils.YModelPropertyExtractor
类的一些代码示例,展示了YModelPropertyExtractor
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YModelPropertyExtractor
类的具体详情如下:
包路径:pl.edu.icm.synat.logic.model.utils.YModelPropertyExtractor
类名称:YModelPropertyExtractor
暂无
代码示例来源:origin: pl.edu.icm.synat/synat-business-services-api
@Override
public boolean hasContent(YElement element) {
return yModelPropertyExtractor.isContentAvailable(element);
}
代码示例来源:origin: pl.edu.icm.synat/synat-business-services-api
@Override
public List<String> extractContentLocation(@SuppressWarnings("rawtypes") List<YContentEntry> contentList, String mainLevel) {
List<String> result = new ArrayList<String>();
for (YContentEntry<?> content : contentList) {
if (content instanceof YContentFile) {
YContentFile file = (YContentFile) content;
if (yModelPropertyExtractor.isFileAccepted(file, mainLevel)) {
result.add(yModelPropertyExtractor.prepareLocation(file.getLocations()));
}
} else if (content instanceof YContentDirectory) {
YContentDirectory dir = (YContentDirectory) content;
result.addAll(extractContentLocation(dir.getEntries(), mainLevel));
}
}
return result;
}
代码示例来源:origin: pl.edu.icm.synat/synat-business-services-api
/**
* Creates obcect using YElement
*
* @param yElement
* metadata element used to create object
*/
public PublicationData createPublicationData(YElement yElement) {
PublicationData pd = new PublicationData();
populateCommonProperties(yElement, pd);
boolean available = yModelPropertyExtractor.isContentAvailable(yElement);
pd.setContentAvailaibility(available ? ContentAvaiability.AVAILABLE : ContentAvaiability.NOT_AVAILABLE);
pd.setObjectType(ElementType.resolveTypeFromStructure(yElement.getStructures()));
pd.setThumbnailPath(yModelPropertyExtractor.extractThumbnailPath(yElement));
return pd;
}
代码示例来源:origin: pl.edu.icm.synat/synat-portal-core
result.setThumbnailPath(yModelPropertyExtractor.extractThumbnailPath(yElement));
代码示例来源: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.synat/synat-business-services-api
private boolean findIfContentExists(List<YContentEntry> chapterEntries, String mainLevel) {
for (YContentEntry<?> content : chapterEntries) {
if (content instanceof YContentFile && yModelPropertyExtractor.isFileAccepted((YContentFile) content, mainLevel)) {
return true;
} else if (content instanceof YContentDirectory) {
if (findIfContentExists(((YContentDirectory) content).getEntries(), mainLevel)) {
return true;
}
}
}
return false;
}
代码示例来源:origin: pl.edu.icm.synat/synat-portal-core
private ElementContent getThumbnailFetchingWholeElement(String elementId) {
ElementContent result = null;
ElementMetadata elementData = repositoryFacade.fetchElementMetadata(elementId);
if (elementData.getContent() instanceof YElement) {
YElement yElement = (YElement) elementData.getContent();
ThumbnailRef thumbnailRef = yModelPropertyExtractor.extractThumbnailRef(yElement);
if (thumbnailRef == null) {
throw new ThumbnailNotFoundException("Thumbnail not found for: " + elementId);
} else if (thumbnailRef.isUrlReference()) {
logger.warn("Tries to find thumbnail in local data, but it is external. Check if element [{}] is up to date.", elementId);
throw new ExternalThumbnailException(thumbnailRef.getUrl());
} else {
result = repositoryFacade.fetchContent(thumbnailRef.getElementId(), thumbnailRef.getPartId());
}
} else {
throw new ThumbnailNotFoundException("Thumbnail not found for: " + elementId);
}
return result;
}
@Required
代码示例来源: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-business-services-api
@Override
public boolean isContentAvailable(YElement element){
return yModelPropertyExtractor.isContentAvailable(element);
}
代码示例来源:origin: pl.edu.icm.synat/synat-business-services-api
private List<ContentFileData> findChapterPages(List<YContentEntry> chapterEntries, Locale locale, String mainLevel) {
List<ContentFileData> result = new ArrayList<ContentFileData>();
for (YContentEntry<?> content : chapterEntries) {
if (content instanceof YContentFile) {
YContentFile file = (YContentFile) content;
if (yModelPropertyExtractor.isFileAccepted(file, mainLevel)) {
result.add(new ContentFileData(file.getId(), YModelUtils.getDefaultName(file), fetchName(file.getFormat(), locale), yModelPropertyExtractor.prepareLocation(file.getLocations())));
}
} else if (content instanceof YContentDirectory) {
YContentDirectory dir = (YContentDirectory) content;
if (ContentTypes.CONTENT_MULTI_TYPE.equals(dir.getType())) {
result.addAll(findChapterPages(dir.getEntries(), locale, mainLevel));
}
}
}
return result;
}
代码示例来源:origin: pl.edu.icm.synat/synat-portal-core
@Override
public ContentAvaiability getContentAvailability(ElementMetadata metadata) {
YElement element = (YElement) metadata.getContent();
if(!YMODEL_PROPERTYE_XTRACTOR.isContentAvailable(element)){
return ContentAvaiability.NOT_AVAILABLE;
}
ElementLicenseResponse response = licenseResolver.fetchContentLicense(metadata);
return response.getAvailability();
}
代码示例来源:origin: pl.edu.icm.synat/synat-business-services-api
private List<ContentEntryData> translateContent(List<YContentEntry> contentList, Locale locale, String mainLevel) {
List<ContentEntryData> result = new ArrayList<ContentEntryData>();
for (YContentEntry<?> content : contentList) {
if (content instanceof YContentFile) {
YContentFile file = (YContentFile) content;
if (yModelPropertyExtractor.isFileAccepted(file, mainLevel)) {
result.add(new ContentFileData(file.getId(), YModelUtils.getDefaultName(file), fetchName(file.getFormat(), locale), yModelPropertyExtractor.prepareLocation(file.getLocations())));
}
} else if (content instanceof YContentDirectory) {
YContentDirectory dir = (YContentDirectory) content;
if (ContentTypes.CONTENT_PAGED.equals(dir.getType()) && findIfContentExists(dir.getEntries(), mainLevel)) {
result.add(new ContentDirectoryData(dir.getId(), getDirectoryName(dir), dir.getType(), fetchName(dir.getType(), locale)));
} else if(findIfContentExists(dir.getEntries(), mainLevel)) {
result.add(new ContentDirectoryData(dir.getId(), getDirectoryName(dir), dir.getType(), fetchName(dir.getType(), locale), translateContent(dir.getEntries(), locale, mainLevel)));
}
}
}
return result;
}
内容来源于网络,如有侵权,请联系作者删除!