public ArticleBuilder setAuthors(Map<Integer, PersonInfoViewObject> personsMap) { List<YContributor> contributors = new ArrayList<>(); for (Map.Entry<Integer, PersonInfoViewObject> entry : personsMap.entrySet()) { PersonInfoViewObject personViewObject = entry.getValue(); YContributor author = new YContributor(YConstants.CR_AUTHOR, false); author.setNames(extractPersonYNames(personViewObject)); final List<String> affiliationNames = personViewObject.getAffiliations(); Boolean isCorrespondingAuthor = personViewObject.getCorrespondingAuthor(); boolean addCorrespondenceAff = isCorrespondingAuthor != null ? isCorrespondingAuthor : false; if (CollectionUtils.isNotEmpty(affiliationNames)) { for (String affiliationName : affiliationNames) { if (StringUtils.isNotBlank(affiliationName)) { final String affiliationId = UUID.randomUUID().toString(); YAffiliation affiliation = new YAffiliation(affiliationId, affiliationName); author.addAffiliationRef(affiliationId); article.addAffiliation(affiliation); if (addCorrespondenceAff) { author.addAttribute(CommonAttributeTypes.AT_CORRESPONDENCE, affiliationName); addCorrespondenceAff = false; } } } } author.addAttribute(extractEmailAttributes(personViewObject)); contributors.add(author); } article.setContributors(contributors); return this; }
contributor.addAttribute(CommonAttributeTypes.AT_CONTACT_EMAIL, newEmail); modify = true;
if (fingerprint.length() > 1) { // e.g. "-" is filtered YAttribute attribute = new YAttribute(YConstants.AT_ZBL_AUTHOR_FINGERPRINT, fingerprint); ycontributor.addAttribute(attribute); updated = true;
@Override public void parseMetadata(YElement element, PublicationMeta pm, YLanguage defaultLanguage, List<YElement> ancestors) { PublisherInfo pi = pm.getPublisherInfo(); if (pi != null) { String nam = pi.getPublisherName() != null ? pi.getPublisherName().getvalue() : null; if (StringUtils.isNotBlank(nam)) { YContributor cont = new YContributor(ContributorRoles.CR_PUBLISHER, true); cont.addName(new YName(nam)); PublisherLoc location = pi.getPublisherLoc(); if (location != null) { if (StringUtils.isNotBlank(location.getvalue())) { cont.addAttribute(CommonAttributeTypes.AT_ADDRESS_STREET, location.getvalue()); } } element.addContributor(cont); } } } }
public void convertContributors(BibEntry source, YElement yElement) { List<YContributor> yContributors = new ArrayList(); //authors List<YContributor> yAuthors = parseBibEntryPersons(source.getAllFieldValues(BibEntry.FIELD_AUTHOR), YConstants.CR_AUTHOR); //editors List<YContributor> yEditors = parseBibEntryPersons(source.getAllFieldValues(BibEntry.FIELD_EDITOR), YConstants.CR_EDITOR); yContributors.addAll(yAuthors); yContributors.addAll(yEditors); //publisher if (source.getFirstFieldValue(BibEntry.FIELD_ADDRESS) != null && source.getFirstFieldValue(BibEntry.FIELD_PUBLISHER) != null) { String publisher = source.getFirstFieldValue(BibEntry.FIELD_PUBLISHER); String address = source.getFirstFieldValue(BibEntry.FIELD_ADDRESS); YContributor yPublisher = new YContributor(); yPublisher.setRole(YConstants.CR_PUBLISHER); yPublisher.addName(new YName().setType(YConstants.NM_CANONICAL).setText(publisher)); yPublisher.addAttribute(YConstants.AT_ADDRESS_CITY, address); yContributors.add(yPublisher); } yElement.setContributors(yContributors); }
public void updateElementPublisher(org.jdom.Element jmeta, YElement journal) { YName pname = y.canonicalName(YLanguage.Undetermined, JDOMHelper.getTextTrim(JDOMHelper.optDescendant(jmeta, "publisher", "publisher-name"))); String loc = JDOMHelper.getTextTrim(JDOMHelper.optDescendant(jmeta, "publisher", "publisher-loc")); journal.addContributor(new YContributor(ContributorRoles.CR_PUBLISHER, true).addName(pname).addAttribute(NlmToYConstants.AT_PUBLISHER_LOCATION, loc)); }
.addName(y.name(YLanguage.NoLinguisticContent, surname, NameTypes.NM_SURNAME)) .addName(y.name(YLanguage.NoLinguisticContent, forenames, NameTypes.NM_FORENAMES)) .addAttribute(CommonAttributeTypes.AT_CONTACT_EMAIL, JDOMHelper.toNull(JDOMHelper.getTextTrim(JDOMHelper.optDescendant(c, "email")))) .addAffiliationRef(aref); for (String a:aRefs){ .addName(y.name(YLanguage.NoLinguisticContent, surname, NameTypes.NM_SURNAME)) .addName(y.name(YLanguage.NoLinguisticContent, forenames, NameTypes.NM_FORENAMES)) .addAttribute(CommonAttributeTypes.AT_CONTACT_EMAIL, JDOMHelper.toNull(JDOMHelper.getTextTrim(JDOMHelper.optDescendant(c, "email")))) .addAffiliationRef(aref); for (String a:aRefs){
cont.addAttribute(CommonAttributeTypes.AT_CONTACT_EMAIL, toNull(getTextTrim(optDescendant(c, "email")))).addAffiliationRef(aref)).addAffiliation(y.affiliation(aref, address)); } else { YContributor cont= new YContributor(ContributorRoles.CR_OTHER, false).addName(y.canonicalName(YLanguage.NoLinguisticContent, (defName).trim())); cont.addAttribute(CommonAttributeTypes.AT_CONTACT_EMAIL, toNull(getTextTrim(optDescendant(c, "email")))).addAffiliationRef(aref)).addAffiliation(y.affiliation(aref, address));
&& sname.equals(zblc.getOneName("surname").getText())) { for (YAttribute a : zblc.getAttributes(YConstants.AT_ZBL_AUTHOR_FINGERPRINT)) { nc.addAttribute(a);
if (contributorRoles.contains(ctValue)) { article.addContributor( new YContributor(ctValue, false).addName(y.canonicalName(YLanguage.NoLinguisticContent, canonicalName)).addName(y.name(YLanguage.NoLinguisticContent, surname, NM_SURNAME)).addName(y.name(YLanguage.NoLinguisticContent, forenames, NM_FORENAMES)).addAttribute(AT_CONTACT_EMAIL, toNull(getTextTrim(optDescendant(c, "email")))).addAffiliationRef(aref)).addAffiliation(y.affiliation(aref, address)); } else { article.addContributor( new YContributor(YConstants.CR_OTHER, false).addName(y.canonicalName(YLanguage.NoLinguisticContent, canonicalName)).addName(y.name(YLanguage.NoLinguisticContent, surname, NM_SURNAME)).addName(y.name(YLanguage.NoLinguisticContent, forenames, NM_FORENAMES)).addAttribute(AT_CONTACT_EMAIL, toNull(getTextTrim(optDescendant(c, "email")))).addAffiliationRef(aref)).addAffiliation(y.affiliation(aref, address));
private static void buildPersonContributor(YContributor cont, Object name) { PersonName pn = (PersonName) name; for (Object o : pn.getGivenNamesOrFamilyNamePrefixOrFamilyName()) { if (o instanceof GivenNames) { YName nam = new YName(); nam.setType(NameTypes.NM_FORENAMES); nam.setText(((GivenNames) o).getvalue()); cont.addName(nam); } else if (o instanceof FamilyName) { YName nam = new YName(); nam.setType(NameTypes.NM_SURNAME); nam.setText(((FamilyName) o).getvalue()); cont.addName(nam); } else if (o instanceof FamilyNamePrefix) { cont.addAttribute(WileyComponentConstants.WILEY_ATT_FAMILY_NAME_PREFIX, ((FamilyNamePrefix) o).getvalue().trim()); } } if (pn.getNameSuffix() != null) { YName nam = new YName(); nam.setType(NameTypes.NM_SUFFIX); nam.setText(pn.getNameSuffix().getvalue()); cont.addName(nam); } cont.setInstitution(false); }