本文整理了Java中pl.edu.icm.synat.logic.model.utils.YModelUtils.getDefaultName()
方法的一些代码示例,展示了YModelUtils.getDefaultName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YModelUtils.getDefaultName()
方法的具体详情如下:
包路径:pl.edu.icm.synat.logic.model.utils.YModelUtils
类名称:YModelUtils
方法名:getDefaultName
暂无
代码示例来源:origin: pl.edu.icm.synat/synat-business-services-impl
private String prepareLabel(YElement yElement) {
return YModelUtils.getDefaultName(yElement);
}
代码示例来源:origin: pl.edu.icm.synat/synat-business-services-api
private String getDirectoryName(YContentDirectory dir){
return YModelUtils.getDefaultName(dir);
}
代码示例来源:origin: pl.edu.icm.synat/synat-portal-core
@SuppressWarnings("deprecation")
private CharSequence preparePlainName(YElement yElement, YLanguage language) {
YName yName = YModelUtils.getDefaultName(yElement, language);
if (yName != null) {
String name = yName.getText();
return new FilteredString(name.replaceAll("[${}^]", "").replaceAll("\\<.*?\\>", ""));
}
return "";
}
代码示例来源:origin: pl.edu.icm.synat/synat-importer-direct
@Override
public String generate(YElement element) {
String name = YModelUtils.getDefaultName(element);
String normalized = Normalizer.normalize(name, Form.NFC);
String trimmed = normalized.replaceAll("[^a-zA-Z0-9]", "");
代码示例来源:origin: pl.edu.icm.synat/synat-business-services-api
/**
* Creates BriefElementData using YModel (YElement)
*
* @param yElement
* bwmeta YModel
*/
@Deprecated
public BriefElementData(YElement yElement) {
this(yElement.getId(), YModelUtils.getDefaultName(yElement));
String text = YModelUtils.getDefaultDescription(yElement);
this.description = new HighlightedString(text, -1);
}
代码示例来源:origin: pl.edu.icm.synat/synat-business-services-api
/**
* Utility function retrieving name of YContributor
*
* @param contributor
* @return concatenation of NM_SURNAME and NM_FORENAMES names separated with
* ", "
*/
public static String getDefaultContributor(YContributor contributor) {
String name = fetchNames(contributor);
final String surname = fetchSurname(contributor);
if (StringUtils.isNotEmpty(surname) && StringUtils.isNotEmpty(name)) {
return UserProfileUtils.createFullName(name, surname);
}
return getDefaultName(contributor);
}
代码示例来源:origin: pl.edu.icm.synat/synat-sdk-sample-services
line.add(doi);
String name = YModelUtils.getDefaultName(element);
line.add(name);
代码示例来源:origin: pl.edu.icm.synat/synat-portal-core
@SuppressWarnings("deprecation")
private CharSequence prepareName(YElement yElement, YLanguage language) {
YName yName = YModelUtils.getDefaultName(yElement, language);
if (yName != null) {
return new FilteredString(YModelUtils.yRichTextToString(yName.getRichText()));
}
return "";
}
代码示例来源:origin: pl.edu.icm.synat/synat-portal-core
protected void fillTitle(HtmlMetaHeaders metadata, YElement yElement) {
String title = YModelUtils.getDefaultName(yElement);
if (StringUtils.isNotEmpty(title)) {
metadata.addMetadataName(WP_TITLE, title);
}
YLanguage language = YModelUtils.getDefaultLanguage(yElement);
if (language != null && language.getName() != null) {
metadata.addMetadataName(WP_LANGUAGE, language.getName());
}
}
代码示例来源:origin: pl.edu.icm.synat/synat-business-services-api
private void populateBaseProperties(AbstractNDA<?> e, BriefElementData d) {
d.setName(YModelUtils.getDefaultName(e));
String text = YModelUtils.getDefaultDescription(e);
d.setRenderableDescription(new HighlightedString(text, -1));
}
代码示例来源: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
public StructureData preparePublisher(YElement yElement) {
for (YStructure structure : yElement.getStructures()) {
YAncestor ancestor = structure.getAncestor(YaddaIdConstants.ID_LEVEL_JOURNAL_PUBLISHER);
if (ancestor != null) {
return new StructureData(ancestor.getIdentity(), YModelUtils.getDefaultName(ancestor));
}
}
return new StructureData("", "");
}
代码示例来源:origin: pl.edu.icm.synat/synat-portal-core
value.append(FacetsController.SEPARATOR + IndexUtils.encodeNameValue(YModelUtils.getDefaultName(yElement)));
代码示例来源:origin: pl.edu.icm.synat/synat-portal-core
@Override
@Cacheable("datasetTranslationResult")
public String getTranslation(String dataSetId, Locale locale, DictionaryDataTypes type) {
try {
YElement element = dataSetDictionary.getYElement(dataSetId);
for (YName name : element.getNames()) {
if (name.getLanguage() != null && name.getLanguage().equals(YLanguage.byCode(locale.getISO3Language()))) {
return name.getText();
}
}
final String name = YModelUtils.getDefaultName(element);
if (StringUtils.isNotEmpty(name)) {
return name;
}
} catch (NotFoundException e) {
return dataSetId;
}
return dataSetId;
}
代码示例来源:origin: pl.edu.icm.synat/synat-portal-core
private List<StructureData> prepareStructure(YElement yElement, String hierarchy, String[] levels, String... topLevelIds) {
List<String> topLevels = Arrays.asList(topLevelIds);
String topId = null;
String topLevelId = null;
List<StructureData> ancestors = new ArrayList<StructureData>();
final YStructure structure = yElement.getStructure(hierarchy);
if (structure != null) {
ListMultimap<String, YAncestor> mappedAncestors = getMappedAncestors(structure.getAncestors());
for (String level : levels) {
final YAncestor ancestor = getAncestor(mappedAncestors, level);
if (ancestor != null && ArrayUtils.contains(StructureData.LEVELS_ALLOWED, ancestor.getLevel())) {
if (topLevels.contains(ancestor.getLevel())) {
topId = ancestor.getIdentity();
topLevelId = ancestor.getLevel();
ancestors.add(new StructureData(ancestor.getIdentity(), YModelUtils.getDefaultName(ancestor), ancestor.getLevel(), topId, topLevelId));
} else {
ancestors.add(new StructureData(ancestor.getIdentity(), IndexUtils.encodeNameValue(YModelUtils.getDefaultName(ancestor)),
ancestor.getLevel(), topId, topLevelId));
}
}
}
if (StringUtils.isNotBlank(structure.getCurrent().getPosition())
&& ArrayUtils.contains(StructureData.ALLOWED_LEVELS_OF_CURRENT_POSITION, structure.getCurrent().getLevel())) {
ancestors.add(new StructureData(null, structure.getCurrent().getPosition()));
}
}
return ancestors;
}
代码示例来源:origin: pl.edu.icm.synat/synat-portal-core
final String name = YModelUtils.getDefaultName(contributor);
final String surname = YModelUtils.getNameByType(contributor, NameTypes.NM_SURNAME);
final String canonicalName = YModelUtils.getNameByType(contributor, NameTypes.NM_CANONICAL);
代码示例来源:origin: pl.edu.icm.synat/synat-portal-core
public ResourceContributor transformYContributorToResourceContributor(final String documentId, YContributor contributor) {
String forenames = YModelUtils.fetchNames(contributor);
String surname = YModelUtils.fetchSurname(contributor);
Integer contributorId = BwmetaContributorUtils.getContributorId(contributor);
final boolean hasSuggestion = fetchHasSuggestions(documentId, contributorId);
String identity = BwmetaContributorUtils.getContributorIdentity(contributor);
ResourceContributor resourceContributor = new ResourceContributor(contributorId, identity, hasSuggestion).setAffiliationIds(contributor
.getAffiliationRefs());
if (StringUtils.isNotBlank(identity)) {
resourceContributor.setThumbnailPath(thumbnailService.resolveUserAvatar(identity));
resourceContributor.setCurrentId(identity);
}
final String canonicalName = YModelUtils.getCanonicalName(contributor);
if (StringUtils.isNotBlank(forenames) && StringUtils.isNotBlank(surname)) {
resourceContributor.setForenames(forenames).setSurname(surname);
if (StringUtils.isBlank(canonicalName)) {
resourceContributor.setCanonicalName(UserProfileUtils.createFullName(forenames, surname));
}
} else if (StringUtils.isBlank(canonicalName)) {
resourceContributor.setCanonicalName(YModelUtils.getDefaultName(contributor));
}
if (StringUtils.isNotBlank(canonicalName)) {
resourceContributor.setCanonicalName(canonicalName);
}
return resourceContributor;
}
代码示例来源:origin: pl.edu.icm.synat/synat-portal-core
private Document generateDocument(Authorship authorship, Map<String, String> userNames) {
List<Contribution> contributions = new ArrayList<Contribution>();
ElementMetadata metadata = repositoryFacade.fetchElementMetadata(authorship.getDocumentId());
YElement element = (YElement) metadata.getContent();
for (YContributor contributor : element.getContributors()) {
Contribution contribution = new Contribution();
contribution.setContributorId(BwmetaContributorUtils.getContributorId(contributor));
String name = YModelUtils.getDefaultContributor(contributor);
if (StringUtils.isBlank(name)) {
continue;
}
contribution.setName(name);
String contributorIdentity = BwmetaContributorUtils.getContributorIdentity(contributor);
addUsername(userNames, contributorIdentity);
contribution.setUserId(contributorIdentity);
contributions.add(contribution);
}
Document document = new Document();
document.setContributions(contributions);
document.setName(YModelUtils.getDefaultName(element));
return document;
}
代码示例来源: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;
}
代码示例来源:origin: pl.edu.icm.synat/synat-portal-core
return item;
String documentName = YModelUtils.getDefaultName(metadata);
UserProfile requesterProfile = userBusinessService.getUserProfileById(authorship.getUserId());
String requestorName = UserProfileUtils.createFullName(requesterProfile);
内容来源于网络,如有侵权,请联系作者删除!