Search in sources :

Example 6 with Keyword

use of org.orcid.jaxb.model.message.Keyword in project ORCID-Source by ORCID.

the class OrcidBatchLoad method assignPersistenceFields.

private void assignPersistenceFields(OrcidProfile profile) {
    // set the transient fields that the encrypters need
    profile.setPassword("password");
    // profile.setOrcidIdentifier();
    profile.setSecurityQuestionAnswer("securityQuestionAnswer");
    profile.setVerificationCode("1111");
    // randomise any fields that are uniquely constrained so that we can
    // re-use the test data
    profile.getOrcidBio().getContactDetails().addOrReplacePrimaryEmail(new Email(RandomStringUtils.randomAlphabetic(150)));
    Keywords keywords = new Keywords();
    keywords.getKeyword().add(new Keyword(RandomStringUtils.randomAlphabetic(255), Visibility.PUBLIC));
    profile.getOrcidBio().setKeywords(keywords);
    profile.retrieveOrcidWorks().getOrcidWork();
}
Also used : Email(org.orcid.jaxb.model.message.Email) Keywords(org.orcid.jaxb.model.message.Keywords) Keyword(org.orcid.jaxb.model.message.Keyword)

Example 7 with Keyword

use of org.orcid.jaxb.model.message.Keyword in project ORCID-Source by ORCID.

the class Text method toKeyword.

public Keyword toKeyword() {
    Keyword k = new Keyword();
    k.setContent(this.value);
    return k;
}
Also used : Keyword(org.orcid.jaxb.model.message.Keyword)

Example 8 with Keyword

use of org.orcid.jaxb.model.message.Keyword in project ORCID-Source by ORCID.

the class OrcidProfileManagerImpl method addDefaultVisibilityToBioItems.

private void addDefaultVisibilityToBioItems(OrcidProfile orcidProfile, Visibility defaultActivityVis, Boolean isClaimed) {
    if (defaultActivityVis == null) {
        defaultActivityVis = Visibility.PRIVATE;
    }
    if (isClaimed == null) {
        isClaimed = false;
    }
    if (orcidProfile.getOrcidBio() != null) {
        if (orcidProfile.getOrcidBio().getBiography() != null) {
            if (isClaimed) {
                orcidProfile.getOrcidBio().getBiography().setVisibility(defaultActivityVis);
            } else {
                Visibility visibility = orcidProfile.getOrcidBio().getBiography().getVisibility();
                orcidProfile.getOrcidBio().getBiography().setVisibility(visibility != null ? visibility : Visibility.PRIVATE);
            }
        }
        if (orcidProfile.getOrcidBio().getExternalIdentifiers() != null) {
            Visibility listVisibility = orcidProfile.getOrcidBio().getExternalIdentifiers().getVisibility();
            for (ExternalIdentifier x : orcidProfile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier()) {
                if (isClaimed) {
                    x.setVisibility(defaultActivityVis);
                } else {
                    x.setVisibility(listVisibility != null ? listVisibility : Visibility.PRIVATE);
                }
            }
        }
        if (orcidProfile.getOrcidBio().getKeywords() != null) {
            Visibility listVisibility = orcidProfile.getOrcidBio().getKeywords().getVisibility();
            for (Keyword x : orcidProfile.getOrcidBio().getKeywords().getKeyword()) {
                if (isClaimed) {
                    x.setVisibility(defaultActivityVis);
                } else {
                    x.setVisibility(listVisibility != null ? listVisibility : Visibility.PRIVATE);
                }
            }
        }
        if (orcidProfile.getOrcidBio().getResearcherUrls() != null) {
            Visibility listVisibility = orcidProfile.getOrcidBio().getResearcherUrls().getVisibility();
            for (ResearcherUrl x : orcidProfile.getOrcidBio().getResearcherUrls().getResearcherUrl()) {
                if (isClaimed) {
                    x.setVisibility(defaultActivityVis);
                } else {
                    x.setVisibility(listVisibility != null ? listVisibility : Visibility.PRIVATE);
                }
            }
        }
        if (orcidProfile.getOrcidBio().getPersonalDetails() != null && orcidProfile.getOrcidBio().getPersonalDetails().getOtherNames() != null) {
            Visibility listVisibility = orcidProfile.getOrcidBio().getPersonalDetails().getOtherNames().getVisibility();
            for (OtherName x : orcidProfile.getOrcidBio().getPersonalDetails().getOtherNames().getOtherName()) {
                if (isClaimed) {
                    x.setVisibility(defaultActivityVis);
                } else {
                    x.setVisibility(listVisibility != null ? listVisibility : Visibility.PRIVATE);
                }
            }
        }
        if (orcidProfile.getOrcidBio().getContactDetails() != null && orcidProfile.getOrcidBio().getContactDetails().getAddress() != null && orcidProfile.getOrcidBio().getContactDetails().getAddress().getCountry() != null) {
            Country country = orcidProfile.getOrcidBio().getContactDetails().getAddress().getCountry();
            if (isClaimed) {
                country.setVisibility(defaultActivityVis);
            } else {
                country.setVisibility(country.getVisibility() != null ? country.getVisibility() : Visibility.PRIVATE);
            }
        }
    }
}
Also used : Keyword(org.orcid.jaxb.model.message.Keyword) ExternalIdentifier(org.orcid.jaxb.model.message.ExternalIdentifier) WorkExternalIdentifier(org.orcid.jaxb.model.message.WorkExternalIdentifier) OtherName(org.orcid.jaxb.model.message.OtherName) Country(org.orcid.jaxb.model.message.Country) Visibility(org.orcid.jaxb.model.message.Visibility) ResearcherUrl(org.orcid.jaxb.model.message.ResearcherUrl)

Example 9 with Keyword

use of org.orcid.jaxb.model.message.Keyword in project ORCID-Source by ORCID.

the class OrcidMessageUtil method setSourceName.

public void setSourceName(OrcidProfile orcidProfile) {
    if (orcidProfile != null) {
        if (orcidProfile.getOrcidActivities() != null) {
            OrcidActivities orcidActivities = orcidProfile.getOrcidActivities();
            if (orcidActivities.getAffiliations() != null) {
                Affiliations affs = orcidActivities.getAffiliations();
                List<Affiliation> affList = affs.getAffiliation();
                if (affList != null) {
                    for (Affiliation aff : affList) {
                        setSourceName(aff);
                    }
                }
            }
            if (orcidActivities.getFundings() != null) {
                FundingList fundingList = orcidActivities.getFundings();
                List<Funding> fundings = fundingList.getFundings();
                if (fundings != null) {
                    for (Funding funding : fundings) {
                        setSourceName(funding);
                    }
                }
            }
            if (orcidActivities.getOrcidWorks() != null) {
                OrcidWorks orcidWorks = orcidActivities.getOrcidWorks();
                List<OrcidWork> works = orcidWorks.getOrcidWork();
                if (works != null) {
                    for (OrcidWork work : works) {
                        setSourceName(work);
                    }
                }
            }
        }
        if (orcidProfile.getOrcidBio() != null) {
            OrcidBio orcidBio = orcidProfile.getOrcidBio();
            if (orcidBio.getContactDetails() != null) {
                Address address = orcidBio.getContactDetails().getAddress();
                if (address != null) {
                    setSourceName(address);
                }
            }
            if (orcidBio.getExternalIdentifiers() != null) {
                ExternalIdentifiers extIds = orcidBio.getExternalIdentifiers();
                List<ExternalIdentifier> extIdsList = extIds.getExternalIdentifier();
                if (extIdsList != null) {
                    for (ExternalIdentifier extId : extIdsList) {
                        setSourceName(extId);
                    }
                }
            }
            if (orcidBio.getKeywords() != null) {
                Keywords keywords = orcidBio.getKeywords();
                List<Keyword> keywordList = keywords.getKeyword();
                if (keywordList != null) {
                    for (Keyword keyword : keywordList) {
                        setSourceName(keyword);
                    }
                }
            }
            if (orcidBio.getPersonalDetails() != null) {
                OtherNames otherNames = orcidBio.getPersonalDetails().getOtherNames();
                if (otherNames != null) {
                    List<OtherName> otherNameList = otherNames.getOtherName();
                    if (otherNameList != null) {
                        for (OtherName otherName : otherNameList) {
                            setSourceName(otherName);
                        }
                    }
                }
            }
            if (orcidBio.getResearcherUrls() != null) {
                ResearcherUrls rUrls = orcidBio.getResearcherUrls();
                List<ResearcherUrl> rUrlList = rUrls.getResearcherUrl();
                if (rUrlList != null) {
                    for (ResearcherUrl rUrl : rUrlList) {
                        setSourceName(rUrl);
                    }
                }
            }
        }
    }
}
Also used : Keywords(org.orcid.jaxb.model.message.Keywords) OrcidBio(org.orcid.jaxb.model.message.OrcidBio) Address(org.orcid.jaxb.model.message.Address) Keyword(org.orcid.jaxb.model.message.Keyword) Funding(org.orcid.jaxb.model.message.Funding) ExternalIdentifier(org.orcid.jaxb.model.message.ExternalIdentifier) OtherNames(org.orcid.jaxb.model.message.OtherNames) OrcidWork(org.orcid.jaxb.model.message.OrcidWork) OtherName(org.orcid.jaxb.model.message.OtherName) OrcidActivities(org.orcid.jaxb.model.message.OrcidActivities) OrcidWorks(org.orcid.jaxb.model.message.OrcidWorks) FundingList(org.orcid.jaxb.model.message.FundingList) Affiliations(org.orcid.jaxb.model.message.Affiliations) ResearcherUrls(org.orcid.jaxb.model.message.ResearcherUrls) ResearcherUrl(org.orcid.jaxb.model.message.ResearcherUrl) ExternalIdentifiers(org.orcid.jaxb.model.message.ExternalIdentifiers) Affiliation(org.orcid.jaxb.model.message.Affiliation)

Example 10 with Keyword

use of org.orcid.jaxb.model.message.Keyword in project ORCID-Source by ORCID.

the class OrcidJaxbCopyManagerTest method getBio.

private OrcidBio getBio(String sufix, Visibility visibility, int max) {
    OrcidBio orcidBio = new OrcidBio();
    Biography bio = new Biography(sufix + "My Biography", visibility);
    orcidBio.setBiography(bio);
    ContactDetails contactDetails = new ContactDetails();
    Address address = new Address();
    Country country = new Country(visibility.equals(Visibility.PRIVATE) ? Iso3166Country.US : Iso3166Country.CR);
    country.setVisibility(visibility);
    address.setCountry(country);
    contactDetails.setAddress(address);
    List<Email> emails = new ArrayList<Email>();
    for (int i = 0; i < max; i++) {
        Email email = new Email();
        email.setValue(sufix + "Email" + i);
        if (i == 0) {
            email.setPrimary(true);
        }
        email.setVisibility(visibility);
        emails.add(email);
    }
    contactDetails.setEmail(emails);
    orcidBio.setContactDetails(contactDetails);
    ExternalIdentifiers extIds = new ExternalIdentifiers();
    extIds.setVisibility(visibility);
    for (int i = 0; i < max; i++) {
        ExternalIdentifier extId = new ExternalIdentifier();
        extId.setExternalIdCommonName(new ExternalIdCommonName(sufix + "CommonName" + i));
        extId.setExternalIdReference(new ExternalIdReference(sufix + "Reference" + i));
        extIds.getExternalIdentifier().add(extId);
    }
    orcidBio.setExternalIdentifiers(extIds);
    Keywords keywords = new Keywords();
    keywords.setVisibility(visibility);
    for (int i = 0; i < max; i++) {
        Keyword k = new Keyword();
        k.setContent(sufix + "Keyword" + i);
        keywords.getKeyword().add(k);
    }
    orcidBio.setKeywords(keywords);
    PersonalDetails personalDetails = new PersonalDetails();
    CreditName creditName = new CreditName(sufix + "Credit name");
    creditName.setVisibility(visibility);
    personalDetails.setCreditName(creditName);
    FamilyName familyName = new FamilyName(sufix + "Family");
    personalDetails.setFamilyName(familyName);
    GivenNames givenNames = new GivenNames();
    givenNames.setContent(sufix + "Given");
    personalDetails.setGivenNames(givenNames);
    OtherNames other = new OtherNames();
    other.setVisibility(visibility);
    for (int i = 0; i < max; i++) {
        other.addOtherName(sufix + "Other" + i, null);
    }
    personalDetails.setOtherNames(other);
    orcidBio.setPersonalDetails(personalDetails);
    ResearcherUrls researcherUrls = new ResearcherUrls();
    researcherUrls.setVisibility(visibility);
    for (int i = 0; i < max; i++) {
        ResearcherUrl rUrl = new ResearcherUrl();
        rUrl.setUrl(new Url("http://www.rurl.com/" + sufix + "/" + i));
        rUrl.setUrlName(new UrlName(sufix + "Url" + i));
        researcherUrls.getResearcherUrl().add(rUrl);
    }
    orcidBio.setResearcherUrls(researcherUrls);
    return orcidBio;
}
Also used : Email(org.orcid.jaxb.model.message.Email) Keywords(org.orcid.jaxb.model.message.Keywords) OrcidBio(org.orcid.jaxb.model.message.OrcidBio) Address(org.orcid.jaxb.model.message.Address) ExternalIdReference(org.orcid.jaxb.model.message.ExternalIdReference) Keyword(org.orcid.jaxb.model.message.Keyword) ExternalIdentifier(org.orcid.jaxb.model.message.ExternalIdentifier) FamilyName(org.orcid.jaxb.model.message.FamilyName) OtherNames(org.orcid.jaxb.model.message.OtherNames) ArrayList(java.util.ArrayList) CreditName(org.orcid.jaxb.model.message.CreditName) UrlName(org.orcid.jaxb.model.message.UrlName) PersonalDetails(org.orcid.jaxb.model.message.PersonalDetails) Url(org.orcid.jaxb.model.message.Url) ResearcherUrl(org.orcid.jaxb.model.message.ResearcherUrl) ExternalIdCommonName(org.orcid.jaxb.model.message.ExternalIdCommonName) ContactDetails(org.orcid.jaxb.model.message.ContactDetails) GivenNames(org.orcid.pojo.GivenNames) Biography(org.orcid.jaxb.model.message.Biography) Country(org.orcid.jaxb.model.message.Country) Iso3166Country(org.orcid.jaxb.model.message.Iso3166Country) ResearcherUrls(org.orcid.jaxb.model.message.ResearcherUrls) ResearcherUrl(org.orcid.jaxb.model.message.ResearcherUrl) ExternalIdentifiers(org.orcid.jaxb.model.message.ExternalIdentifiers)

Aggregations

Keyword (org.orcid.jaxb.model.message.Keyword)14 ExternalIdentifier (org.orcid.jaxb.model.message.ExternalIdentifier)10 Keywords (org.orcid.jaxb.model.message.Keywords)9 ResearcherUrl (org.orcid.jaxb.model.message.ResearcherUrl)9 ExternalIdentifiers (org.orcid.jaxb.model.message.ExternalIdentifiers)8 OrcidBio (org.orcid.jaxb.model.message.OrcidBio)8 WorkExternalIdentifier (org.orcid.jaxb.model.message.WorkExternalIdentifier)8 ExternalIdReference (org.orcid.jaxb.model.message.ExternalIdReference)7 OtherNames (org.orcid.jaxb.model.message.OtherNames)7 ResearcherUrls (org.orcid.jaxb.model.message.ResearcherUrls)7 Url (org.orcid.jaxb.model.message.Url)7 Email (org.orcid.jaxb.model.message.Email)6 ExternalIdCommonName (org.orcid.jaxb.model.message.ExternalIdCommonName)6 OrcidProfile (org.orcid.jaxb.model.message.OrcidProfile)6 OtherName (org.orcid.jaxb.model.message.OtherName)6 PersonalDetails (org.orcid.jaxb.model.message.PersonalDetails)6 ContactDetails (org.orcid.jaxb.model.message.ContactDetails)5 CreditName (org.orcid.jaxb.model.message.CreditName)5 ExternalIdUrl (org.orcid.jaxb.model.message.ExternalIdUrl)5 FundingExternalIdentifier (org.orcid.jaxb.model.message.FundingExternalIdentifier)5