Search in sources :

Example 21 with ExternalIdentifier

use of org.orcid.jaxb.model.message.ExternalIdentifier 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)

Example 22 with ExternalIdentifier

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

the class OrcidProfileManagerImplTest method testUpdateProfileDefaultVisibilityForItemsAndUpdate.

@Test
@Transactional
@Rollback(true)
public void testUpdateProfileDefaultVisibilityForItemsAndUpdate() {
    OrcidProfile profile = createBasicProfile();
    Keyword k = new Keyword("word", null);
    Keywords kk = new Keywords();
    kk.getKeyword().add(k);
    ResearcherUrl r = new ResearcherUrl(new Url("http://whatever.com"), null);
    ResearcherUrls rr = new ResearcherUrls();
    rr.getResearcherUrl().add(r);
    ExternalIdentifier i = new ExternalIdentifier(null);
    i.setExternalIdReference(new ExternalIdReference("ref"));
    i.setExternalIdCommonName(new ExternalIdCommonName("cn"));
    ExternalIdentifiers ii = new ExternalIdentifiers();
    ii.getExternalIdentifier().add(i);
    OtherNames oo = new OtherNames();
    oo.addOtherName("other", null);
    profile.getOrcidBio().setKeywords(kk);
    profile.getOrcidBio().setResearcherUrls(rr);
    profile.getOrcidBio().setExternalIdentifiers(ii);
    profile.getOrcidBio().getPersonalDetails().setOtherNames(oo);
    profile = orcidProfileManager.createOrcidProfile(profile, true, false);
    assertEquals("word", profile.getOrcidBio().getKeywords().getKeyword().iterator().next().getContent());
    assertEquals(Visibility.PRIVATE, profile.getOrcidBio().getKeywords().getKeyword().iterator().next().getVisibility());
    assertEquals(new Url("http://whatever.com"), profile.getOrcidBio().getResearcherUrls().getResearcherUrl().iterator().next().getUrl());
    assertEquals(Visibility.PRIVATE, profile.getOrcidBio().getResearcherUrls().getResearcherUrl().iterator().next().getVisibility());
    assertEquals("cn", profile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().iterator().next().getExternalIdCommonName().getContent());
    assertEquals(Visibility.PRIVATE, profile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().iterator().next().getVisibility());
    assertEquals("other", profile.getOrcidBio().getPersonalDetails().getOtherNames().getOtherName().iterator().next().getContent());
    assertEquals(Visibility.PRIVATE, profile.getOrcidBio().getPersonalDetails().getOtherNames().getOtherName().iterator().next().getVisibility());
    profile.getOrcidBio().getKeywords().setVisibility(Visibility.PUBLIC);
    profile.getOrcidBio().getKeywords().getKeyword().get(0).setContent("kk - updated");
    profile.getOrcidBio().getResearcherUrls().setVisibility(Visibility.PUBLIC);
    profile.getOrcidBio().getResearcherUrls().getResearcherUrl().get(0).getUrl().setValue("http://whatever.com/updated");
    profile.getOrcidBio().getExternalIdentifiers().setVisibility(Visibility.PUBLIC);
    profile.getOrcidBio().getPersonalDetails().getOtherNames().setVisibility(Visibility.PUBLIC);
    profile = orcidProfileManager.updateOrcidProfile(profile);
    assertEquals("kk - updated", profile.getOrcidBio().getKeywords().getKeyword().iterator().next().getContent());
    assertEquals(Visibility.PUBLIC, profile.getOrcidBio().getKeywords().getKeyword().iterator().next().getVisibility());
    assertEquals(new Url("http://whatever.com/updated"), profile.getOrcidBio().getResearcherUrls().getResearcherUrl().iterator().next().getUrl());
    assertEquals(Visibility.PUBLIC, profile.getOrcidBio().getResearcherUrls().getResearcherUrl().iterator().next().getVisibility());
    assertEquals("cn", profile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().iterator().next().getExternalIdCommonName().getContent());
    assertEquals(Visibility.PUBLIC, profile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().iterator().next().getVisibility());
    assertEquals("other", profile.getOrcidBio().getPersonalDetails().getOtherNames().getOtherName().iterator().next().getContent());
    assertEquals(Visibility.PUBLIC, profile.getOrcidBio().getPersonalDetails().getOtherNames().getOtherName().iterator().next().getVisibility());
    OrcidProfile resultProfile = orcidProfileManager.retrieveOrcidProfile(TEST_ORCID);
    assertEquals(new Url("http://whatever.com/updated"), resultProfile.getOrcidBio().getResearcherUrls().getResearcherUrl().iterator().next().getUrl());
    assertEquals(Visibility.PUBLIC, resultProfile.getOrcidBio().getResearcherUrls().getResearcherUrl().iterator().next().getVisibility());
    assertEquals("cn", resultProfile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().iterator().next().getExternalIdCommonName().getContent());
    assertEquals(Visibility.PUBLIC, resultProfile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().iterator().next().getVisibility());
    assertEquals("other", resultProfile.getOrcidBio().getPersonalDetails().getOtherNames().getOtherName().iterator().next().getContent());
    assertEquals(Visibility.PUBLIC, resultProfile.getOrcidBio().getPersonalDetails().getOtherNames().getOtherName().iterator().next().getVisibility());
    Keyword kw = resultProfile.getOrcidBio().getKeywords().getKeyword().iterator().next();
    assertEquals("kk - updated", kw.getContent());
    assertEquals(Visibility.PUBLIC, kw.getVisibility());
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) Keywords(org.orcid.jaxb.model.message.Keywords) ExternalIdCommonName(org.orcid.jaxb.model.message.ExternalIdCommonName) Keyword(org.orcid.jaxb.model.message.Keyword) ExternalIdReference(org.orcid.jaxb.model.message.ExternalIdReference) ExternalIdentifier(org.orcid.jaxb.model.message.ExternalIdentifier) WorkExternalIdentifier(org.orcid.jaxb.model.message.WorkExternalIdentifier) FundingExternalIdentifier(org.orcid.jaxb.model.message.FundingExternalIdentifier) OtherNames(org.orcid.jaxb.model.message.OtherNames) ResearcherUrls(org.orcid.jaxb.model.message.ResearcherUrls) ResearcherUrl(org.orcid.jaxb.model.message.ResearcherUrl) WorkExternalIdentifiers(org.orcid.jaxb.model.message.WorkExternalIdentifiers) FundingExternalIdentifiers(org.orcid.jaxb.model.message.FundingExternalIdentifiers) ExternalIdentifiers(org.orcid.jaxb.model.message.ExternalIdentifiers) Url(org.orcid.jaxb.model.message.Url) ResearcherUrl(org.orcid.jaxb.model.message.ResearcherUrl) ExternalIdUrl(org.orcid.jaxb.model.message.ExternalIdUrl) Test(org.junit.Test) Rollback(org.springframework.test.annotation.Rollback) Transactional(org.springframework.transaction.annotation.Transactional)

Example 23 with ExternalIdentifier

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

the class T2OrcidApiServiceDelegatorTest method testDefaultPrivacyOnBio.

@Test
public void testDefaultPrivacyOnBio() {
    SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4499", ScopePathType.ORCID_BIO_UPDATE);
    OrcidMessage orcidMessage = new OrcidMessage();
    orcidMessage.setMessageVersion("1.2_rc6");
    OrcidProfile orcidProfile = new OrcidProfile();
    orcidProfile.setOrcidIdentifier(new OrcidIdentifier("4444-4444-4444-4499"));
    orcidMessage.setOrcidProfile(orcidProfile);
    OrcidBio orcidBio = new OrcidBio();
    orcidProfile.setOrcidBio(orcidBio);
    PersonalDetails personalDetails = new PersonalDetails();
    orcidBio.setPersonalDetails(personalDetails);
    GivenNames givenNames = new GivenNames("Test given names");
    personalDetails.setGivenNames(givenNames);
    CreditName creditName = new CreditName("Credit Name");
    personalDetails.setCreditName(creditName);
    ExternalIdentifier id = new ExternalIdentifier();
    id.setExternalIdCommonName(new ExternalIdCommonName("cn1"));
    id.setExternalIdReference(new ExternalIdReference("value1"));
    orcidBio.setExternalIdentifiers(new ExternalIdentifiers());
    orcidBio.getExternalIdentifiers().getExternalIdentifier().add(id);
    personalDetails.setOtherNames(new OtherNames());
    personalDetails.getOtherNames().addOtherName("on1", null);
    orcidBio.setKeywords(new Keywords());
    orcidBio.getKeywords().getKeyword().add(new Keyword("kw1", null));
    orcidBio.setResearcherUrls(new ResearcherUrls());
    orcidBio.getResearcherUrls().getResearcherUrl().add(new ResearcherUrl(new Url("http://rurl2.com"), null));
    t2OrcidApiServiceDelegator.updateBioDetails(mockedUriInfo, "4444-4444-4444-4499", orcidMessage);
    OrcidProfile p = orcidProfileManager.retrieveOrcidProfile("4444-4444-4444-4499");
    assertEquals("cn1", p.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().get(0).getExternalIdCommonName().getContent());
    assertEquals(Visibility.PUBLIC, p.getOrcidBio().getExternalIdentifiers().getVisibility());
    assertEquals("on1", p.getOrcidBio().getPersonalDetails().getOtherNames().getOtherName().get(0).getContent());
    assertEquals(Visibility.PUBLIC, p.getOrcidBio().getPersonalDetails().getOtherNames().getVisibility());
    assertEquals("kw1", p.getOrcidBio().getKeywords().getKeyword().get(0).getContent());
    assertEquals(Visibility.PUBLIC, p.getOrcidBio().getKeywords().getVisibility());
    assertEquals(new Url("http://rurl2.com"), p.getOrcidBio().getResearcherUrls().getResearcherUrl().get(0).getUrl());
    assertEquals(Visibility.PUBLIC, p.getOrcidBio().getResearcherUrls().getVisibility());
//now test what happens if we add a new one.
}
Also used : Keywords(org.orcid.jaxb.model.message.Keywords) OrcidBio(org.orcid.jaxb.model.message.OrcidBio) ExternalIdReference(org.orcid.jaxb.model.message.ExternalIdReference) Keyword(org.orcid.jaxb.model.message.Keyword) WorkExternalIdentifier(org.orcid.jaxb.model.message.WorkExternalIdentifier) ExternalIdentifier(org.orcid.jaxb.model.message.ExternalIdentifier) FundingExternalIdentifier(org.orcid.jaxb.model.message.FundingExternalIdentifier) OtherNames(org.orcid.jaxb.model.message.OtherNames) CreditName(org.orcid.jaxb.model.message.CreditName) PersonalDetails(org.orcid.jaxb.model.message.PersonalDetails) ExternalIdUrl(org.orcid.jaxb.model.message.ExternalIdUrl) Url(org.orcid.jaxb.model.message.Url) ResearcherUrl(org.orcid.jaxb.model.message.ResearcherUrl) OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) ExternalIdCommonName(org.orcid.jaxb.model.message.ExternalIdCommonName) OrcidIdentifier(org.orcid.jaxb.model.message.OrcidIdentifier) GivenNames(org.orcid.jaxb.model.message.GivenNames) OrcidMessage(org.orcid.jaxb.model.message.OrcidMessage) ResearcherUrls(org.orcid.jaxb.model.message.ResearcherUrls) ResearcherUrl(org.orcid.jaxb.model.message.ResearcherUrl) WorkExternalIdentifiers(org.orcid.jaxb.model.message.WorkExternalIdentifiers) FundingExternalIdentifiers(org.orcid.jaxb.model.message.FundingExternalIdentifiers) ExternalIdentifiers(org.orcid.jaxb.model.message.ExternalIdentifiers) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 24 with ExternalIdentifier

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

the class T2OrcidApiServiceDelegatorTest method testAddDuplicatedExtIdsDontModifyProfile.

@Test
public void testAddDuplicatedExtIdsDontModifyProfile() {
    String userOrcid = "0000-0000-0000-0005";
    OrcidMessage message = new OrcidMessage();
    message.setMessageVersion("1.2_rc6");
    message.setOrcidProfile(new OrcidProfile());
    message.getOrcidProfile().setOrcidBio(new OrcidBio());
    ExternalIdentifiers extIds = new ExternalIdentifiers();
    ExternalIdentifier extId1 = new ExternalIdentifier();
    String commonName = "common-name-1-" + System.currentTimeMillis();
    extId1.setExternalIdCommonName(new ExternalIdCommonName(commonName));
    extId1.setExternalIdReference(new ExternalIdReference("ext-id-reference-1"));
    extId1.setExternalIdUrl(new ExternalIdUrl("http://test.orcid.org/" + System.currentTimeMillis()));
    extIds.getExternalIdentifier().add(extId1);
    message.getOrcidProfile().getOrcidBio().setExternalIdentifiers(extIds);
    // Add for client 1
    SecurityContextTestUtils.setUpSecurityContext(userOrcid, "APP-5555555555555555", ScopePathType.PERSON_UPDATE, ScopePathType.PERSON_READ_LIMITED);
    Response r = t2OrcidApiServiceDelegator.addExternalIdentifiers(null, userOrcid, message);
    assertNotNull(r);
    OrcidMessage newMessage1 = (OrcidMessage) r.getEntity();
    assertNotNull(newMessage1);
    assertNotNull(newMessage1.getOrcidProfile());
    assertNotNull(newMessage1.getOrcidProfile().getOrcidBio());
    assertNotNull(newMessage1.getOrcidProfile().getOrcidBio().getExternalIdentifiers());
    assertNotNull(newMessage1.getOrcidProfile().getOrcidBio().getExternalIdentifiers().getExternalIdentifier());
    assertEquals(1, newMessage1.getOrcidProfile().getOrcidBio().getExternalIdentifiers().getExternalIdentifier().size());
    assertEquals(commonName, newMessage1.getOrcidProfile().getOrcidBio().getExternalIdentifiers().getExternalIdentifier().get(0).getExternalIdCommonName().getContent());
    assertEquals("APP-5555555555555555", newMessage1.getOrcidProfile().getOrcidBio().getExternalIdentifiers().getExternalIdentifier().get(0).getSource().retrieveSourcePath());
    // Reset message to add it again
    message = new OrcidMessage();
    message.setMessageVersion("1.2_rc6");
    message.setOrcidProfile(new OrcidProfile());
    message.getOrcidProfile().setOrcidBio(new OrcidBio());
    extId1.setSource(null);
    message.getOrcidProfile().getOrcidBio().setExternalIdentifiers(extIds);
    r = t2OrcidApiServiceDelegator.addExternalIdentifiers(null, userOrcid, message);
    // If we add it again, no error, but it is not duplicated
    assertNotNull(r);
    OrcidMessage newMessage2 = (OrcidMessage) r.getEntity();
    assertNotNull(newMessage2);
    assertNotNull(newMessage2.getOrcidProfile());
    assertNotNull(newMessage2.getOrcidProfile().getOrcidBio());
    assertNotNull(newMessage2.getOrcidProfile().getOrcidBio().getExternalIdentifiers());
    assertNotNull(newMessage2.getOrcidProfile().getOrcidBio().getExternalIdentifiers().getExternalIdentifier());
    assertEquals(1, newMessage2.getOrcidProfile().getOrcidBio().getExternalIdentifiers().getExternalIdentifier().size());
    assertEquals(commonName, newMessage2.getOrcidProfile().getOrcidBio().getExternalIdentifiers().getExternalIdentifier().get(0).getExternalIdCommonName().getContent());
    assertEquals("APP-5555555555555555", newMessage2.getOrcidProfile().getOrcidBio().getExternalIdentifiers().getExternalIdentifier().get(0).getSource().retrieveSourcePath());
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) Response(javax.ws.rs.core.Response) ExternalIdCommonName(org.orcid.jaxb.model.message.ExternalIdCommonName) OrcidBio(org.orcid.jaxb.model.message.OrcidBio) ExternalIdReference(org.orcid.jaxb.model.message.ExternalIdReference) WorkExternalIdentifier(org.orcid.jaxb.model.message.WorkExternalIdentifier) ExternalIdentifier(org.orcid.jaxb.model.message.ExternalIdentifier) FundingExternalIdentifier(org.orcid.jaxb.model.message.FundingExternalIdentifier) OrcidMessage(org.orcid.jaxb.model.message.OrcidMessage) WorkExternalIdentifiers(org.orcid.jaxb.model.message.WorkExternalIdentifiers) FundingExternalIdentifiers(org.orcid.jaxb.model.message.FundingExternalIdentifiers) ExternalIdentifiers(org.orcid.jaxb.model.message.ExternalIdentifiers) ExternalIdUrl(org.orcid.jaxb.model.message.ExternalIdUrl) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 25 with ExternalIdentifier

use of org.orcid.jaxb.model.message.ExternalIdentifier 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)

Aggregations

ExternalIdentifier (org.orcid.jaxb.model.message.ExternalIdentifier)27 ExternalIdentifiers (org.orcid.jaxb.model.message.ExternalIdentifiers)19 WorkExternalIdentifier (org.orcid.jaxb.model.message.WorkExternalIdentifier)17 ExternalIdReference (org.orcid.jaxb.model.message.ExternalIdReference)15 OrcidBio (org.orcid.jaxb.model.message.OrcidBio)15 OrcidProfile (org.orcid.jaxb.model.message.OrcidProfile)15 ExternalIdCommonName (org.orcid.jaxb.model.message.ExternalIdCommonName)12 Test (org.junit.Test)11 FundingExternalIdentifier (org.orcid.jaxb.model.message.FundingExternalIdentifier)10 Keyword (org.orcid.jaxb.model.message.Keyword)10 WorkExternalIdentifiers (org.orcid.jaxb.model.message.WorkExternalIdentifiers)10 ExternalIdUrl (org.orcid.jaxb.model.message.ExternalIdUrl)9 FundingExternalIdentifiers (org.orcid.jaxb.model.message.FundingExternalIdentifiers)9 OrcidMessage (org.orcid.jaxb.model.message.OrcidMessage)8 OtherNames (org.orcid.jaxb.model.message.OtherNames)8 ResearcherUrl (org.orcid.jaxb.model.message.ResearcherUrl)8 Keywords (org.orcid.jaxb.model.message.Keywords)7 OrcidWork (org.orcid.jaxb.model.message.OrcidWork)7 OtherName (org.orcid.jaxb.model.message.OtherName)7 ContactDetails (org.orcid.jaxb.model.message.ContactDetails)6