protected YName convert(List<Serializable> content) { YRichText text = convertText(content); YName name = new YName(text); return name; }
/** * Creates a name with type "canonical" given its language and text. * If the text is empty or null uses the value of <code>canonicalNameDefault</code> * property. * * @param lang language of the name * @param text text of the name, may be null * @return created name */ public YName canonicalName(YLanguage lang, String text) { if (empty(text)) text = canonicalNameDefault; return new YName(lang, text, NM_CANONICAL); }
/** * Creates a name given its language, text and type. * If the text is empty or null, does not create a name but returns null. * * @param lang language of the name * @param text text of the name, may be null * @param type type of the name * @return created name, or null if text was empty or null */ public YName name(YLanguage lang, String text, String type) { if (empty(text)) return null; return new YName(lang, text, type); }
/** * Creates a name given its language, text and type. * If the text is empty or null, does not create a name but returns null. * * @param lang language of the name * @param text text of the name, may be null * @param type type of the name * @return created name, or null if text was empty or null */ public YName name(YLanguage lang, YRichText text, String type) { if (empty(text)) return null; return new YName(lang, text, type); }
@Override protected boolean enhanceMetadata(BxZone zone, YElement metadata) { metadata.addName(new YName(zone.toText().replaceAll("\n", " "))); return true; }
private void appendAncestorDataToYAncestor(List<YAncestor> result, String type, AncestorData data) { if (StringUtils.isNotBlank(data.getId()) || StringUtils.isNotBlank(data.getName())) { result.add(new YAncestor(ResourceDataConstants.MAP_ANCESTOR_TYPE_TO_LEVEL.get(type), data.getId(), new YName(data.getName()))); } }
private YName createYName(String language, String text, String type) { YLanguage ylanguage = YLanguage.byCode(language, YLanguage.English); YRichText yTitleText = yRichTextExtractor.extractFrom(text); return new YName(ylanguage, yTitleText, type); }
YContentFile buildYContentFile() { YContentFile yContentFile = new YContentFile(String.valueOf(id), FileTypes.FT_FULL_TEXT, format, Lists.newArrayList(location)); YName yName = new YName(name); yName.setType(NameTypes.NM_FILE_NAME); yContentFile.addName(yName); return yContentFile; }
public static void addPublisher(YElement element, String publisher) { YStructure structure = Enhancers.getOrCreateJournalStructure(element); YAncestor ancestor = new YAncestor(YConstants.EXT_LEVEL_JOURNAL_PUBLISHER); ancestor.addName(new YName(publisher)); structure.addAncestor(ancestor); }
public static void addJournal(YElement element, String journal) { YStructure structure = Enhancers.getOrCreateJournalStructure(element); YAncestor ancestor = new YAncestor(YConstants.EXT_LEVEL_JOURNAL_JOURNAL); ancestor.addName(new YName(journal)); structure.addAncestor(ancestor); }
public static void addVolume(YElement element, String volume) { YStructure structure = getOrCreateJournalStructure(element); YAncestor ancestor = new YAncestor(YConstants.EXT_LEVEL_JOURNAL_VOLUME); ancestor.addName(new YName(volume)); structure.addAncestor(ancestor); }
public static void addIssue(YElement element, String issue) { YStructure structure = getOrCreateJournalStructure(element); YAncestor ancestor = new YAncestor(YConstants.EXT_LEVEL_JOURNAL_ISSUE); ancestor.addName(new YName(issue)); structure.addAncestor(ancestor); } }
@Override public void parseMetadata(YElement element, PublicationMeta pm, YLanguage defaultLanguage, List<YElement> ancestors) { Numbering volumeNumbering = WileyUtils.getNumbering(pm.getNumberingGroup(), WileyComponentConstants.NUMBERING_VOLUME); String volNum = volumeNumbering.getNumber(); String volume = volumeNumbering.getvalue(); volNum = StringUtils.isNotBlank(volNum) ? volNum : volume; String id = ancestors.get(ancestors.size() - 1).getId() + "-v-" + volNum; id = WileyUtils.processId(id); element.setId(id); YName nam = new YName(volume); nam.setSortKey(volNum); element.addName(nam); }
@Deprecated public static YPerson resolveYPerson(PersonData personData) { YPerson person = new YPerson(); person.setId(personData.getId()); person.addName(new YName(personData.getName()).setType(NameTypes.NM_CANONICAL)); return person; }
private void updateIssue(ZentralBlattSoFieldParser.SoFieldData soData) { if (soData.issue != null && soData.issue.length() > 0) { YAncestor ancestor = new YAncestor(YConstants.EXT_LEVEL_JOURNAL_ISSUE); // TODO // UID? YName issueName = new YName(soData.issue); yIssue.addName(issueName); ancestor.setIdentity(yIssue.getId()); ancestor.addName(issueName); yArticle.getStructure(YConstants.EXT_HIERARCHY_JOURNAL).addAncestor(ancestor); } }
private static void putEditor(YElement element, String editor) { YName name = new YName().setType(YConstants.NM_CANONICAL).setText(editor); YContributor contributor = new YContributor().setRole(YConstants.CR_EDITOR).addName(name); element.addContributor(contributor); }
private YCategory buildCategory(String code, String name, String id, String classification, String parentCode) { YCategory res = new YCategory(); res.setCode(code); res.setId(id); res.setClassification(classification); res.setParent(parentCode); res.addName(new YName(name)); return res; }
private void appendContents(ResourceData resource, YElement yElement) { for (ResourceData.ResourceFileData content : resource.getContents()) { if (!content.isToBeDeleted()) { final String fileId = content.getId(); final String fileName = content.getName(); if (!checkIfContentPresent(yElement, fileId)) { String mime = ExtendedMimeTypeHelper.resolveTypeForFile(fileName != null ? new File(fileName) : null); List<String> locations = Collections.singletonList(content.getLocation()); yElement.addContent(new YContentFile(fileId, content.getType(), mime, locations).addName(new YName(fileName))); } } } }
private void updateVolume(ZentralBlattSoFieldParser.SoFieldData soData) { if (soData.volume != null && soData.volume.length() > 0) { YAncestor ancestor = new YAncestor(YConstants.EXT_LEVEL_JOURNAL_VOLUME); // TODO // UID? YName volumeName = new YName(soData.volume); yVolume.addName(volumeName); ancestor.setIdentity(yVolume.getId()); ancestor.addName(volumeName); yIssue.getStructure(YConstants.EXT_HIERARCHY_JOURNAL).addAncestor(ancestor); yArticle.getStructure(YConstants.EXT_HIERARCHY_JOURNAL).addAncestor(ancestor); } }
private YElement buildVolumeElementFromSeries(ProceedingsSeriesMetadata proceedingsSeriesMetadata, YElement parent, CrossrefIdGenerator generator) { YElement bookVolumeElement = new YElement(); bookVolumeElement.addStructure(buildStructureFromParent(parent, HierarchyWithLevelIds.EXT_HIERARCHY_BOOK, HierarchyWithLevelIds.EXT_LEVEL_BOOK_VOLUME)); bookVolumeElement.addName(new YName(proceedingsSeriesMetadata.getVolume())); String id = generator.generateBookVolumeId(parent.getId(), proceedingsSeriesMetadata.getVolume()); bookVolumeElement.setId(id); return bookVolumeElement; }