Search in sources :

Example 41 with OtherNames

use of org.orcid.jaxb.model.record_rc4.OtherNames in project ORCID-Source by ORCID.

the class SourceUtils method setSourceName.

public void setSourceName(PersonalDetails personalDetails) {
    if (personalDetails == null) {
        return;
    }
    if (personalDetails.getOtherNames() != null) {
        OtherNames otherNames = personalDetails.getOtherNames();
        setSourceName(otherNames);
    }
}
Also used : OtherNames(org.orcid.jaxb.model.record_v2.OtherNames)

Example 42 with OtherNames

use of org.orcid.jaxb.model.record_rc4.OtherNames in project ORCID-Source by ORCID.

the class SourceUtils method setSourceName.

public void setSourceName(Person person) {
    if (person == null) {
        return;
    }
    if (person.getAddresses() != null) {
        Addresses addresses = person.getAddresses();
        setSourceName(addresses);
    }
    if (person.getEmails() != null) {
        Emails emails = person.getEmails();
        setSourceName(emails);
    }
    if (person.getExternalIdentifiers() != null) {
        PersonExternalIdentifiers extIds = person.getExternalIdentifiers();
        setSourceName(extIds);
    }
    if (person.getKeywords() != null) {
        Keywords keywords = person.getKeywords();
        setSourceName(keywords);
    }
    if (person.getOtherNames() != null) {
        OtherNames otherNames = person.getOtherNames();
        setSourceName(otherNames);
    }
    if (person.getResearcherUrls() != null) {
        ResearcherUrls researcherUrls = person.getResearcherUrls();
        setSourceName(researcherUrls);
    }
}
Also used : Addresses(org.orcid.jaxb.model.record_v2.Addresses) Keywords(org.orcid.jaxb.model.record_v2.Keywords) PersonExternalIdentifiers(org.orcid.jaxb.model.record_v2.PersonExternalIdentifiers) OtherNames(org.orcid.jaxb.model.record_v2.OtherNames) ResearcherUrls(org.orcid.jaxb.model.record_v2.ResearcherUrls) Emails(org.orcid.jaxb.model.record_v2.Emails)

Example 43 with OtherNames

use of org.orcid.jaxb.model.record_rc4.OtherNames in project ORCID-Source by ORCID.

the class OrcidSecurityManager_generalTest method testPersonalDetails_When_SomePrivate_ReadPublicToken.

@Test
public void testPersonalDetails_When_SomePrivate_ReadPublicToken() {
    SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.READ_PUBLIC);
    Name name = createName(Visibility.PUBLIC);
    Biography bio = createBiography(Visibility.PRIVATE);
    OtherName o1 = createOtherName(Visibility.PRIVATE, CLIENT_2);
    OtherName o2 = createOtherName(Visibility.PRIVATE, CLIENT_2);
    OtherName o3 = createOtherName(Visibility.PUBLIC, CLIENT_2);
    OtherNames otherNames = new OtherNames();
    otherNames.setOtherNames(new ArrayList<OtherName>(Arrays.asList(o1, o2, o3)));
    PersonalDetails p = new PersonalDetails();
    p.setBiography(bio);
    p.setName(name);
    p.setOtherNames(otherNames);
    orcidSecurityManager.checkAndFilter(ORCID_1, p);
    assertNotNull(p);
    assertEquals(name, p.getName());
    assertNull(p.getBiography());
    assertNotNull(p.getOtherNames());
    assertNotNull(p.getOtherNames().getOtherNames());
    assertEquals(1, p.getOtherNames().getOtherNames().size());
    assertFalse(p.getOtherNames().getOtherNames().contains(o1));
    assertFalse(p.getOtherNames().getOtherNames().contains(o2));
    assertTrue(p.getOtherNames().getOtherNames().contains(o3));
}
Also used : OtherNames(org.orcid.jaxb.model.record_v2.OtherNames) Biography(org.orcid.jaxb.model.record_v2.Biography) OtherName(org.orcid.jaxb.model.record_v2.OtherName) PersonalDetails(org.orcid.jaxb.model.record_v2.PersonalDetails) OtherName(org.orcid.jaxb.model.record_v2.OtherName) Name(org.orcid.jaxb.model.record_v2.Name) Test(org.junit.Test)

Example 44 with OtherNames

use of org.orcid.jaxb.model.record_rc4.OtherNames in project ORCID-Source by ORCID.

the class OrcidSecurityManager_generalTest method testPersonalDetails_When_SomeLimited_NoSource_ReadLimitedToken.

@Test
public void testPersonalDetails_When_SomeLimited_NoSource_ReadLimitedToken() {
    SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.ORCID_BIO_READ_LIMITED);
    Name name = createName(Visibility.LIMITED);
    Biography bio = createBiography(Visibility.LIMITED);
    OtherName o1 = createOtherName(Visibility.PUBLIC, CLIENT_2);
    OtherName o2 = createOtherName(Visibility.LIMITED, CLIENT_2);
    OtherName o3 = createOtherName(Visibility.LIMITED, CLIENT_2);
    OtherNames otherNames = new OtherNames();
    otherNames.setOtherNames(new ArrayList<OtherName>(Arrays.asList(o1, o2, o3)));
    PersonalDetails p = new PersonalDetails();
    p.setBiography(bio);
    p.setName(name);
    p.setOtherNames(otherNames);
    orcidSecurityManager.checkAndFilter(ORCID_1, p);
    assertNotNull(p);
    assertEquals(name, p.getName());
    assertEquals(bio, p.getBiography());
    assertNotNull(p.getOtherNames());
    assertNotNull(p.getOtherNames().getOtherNames());
    assertEquals(3, p.getOtherNames().getOtherNames().size());
    assertTrue(p.getOtherNames().getOtherNames().contains(o1));
    assertTrue(p.getOtherNames().getOtherNames().contains(o2));
    assertTrue(p.getOtherNames().getOtherNames().contains(o3));
}
Also used : OtherNames(org.orcid.jaxb.model.record_v2.OtherNames) Biography(org.orcid.jaxb.model.record_v2.Biography) OtherName(org.orcid.jaxb.model.record_v2.OtherName) PersonalDetails(org.orcid.jaxb.model.record_v2.PersonalDetails) OtherName(org.orcid.jaxb.model.record_v2.OtherName) Name(org.orcid.jaxb.model.record_v2.Name) Test(org.junit.Test)

Example 45 with OtherNames

use of org.orcid.jaxb.model.record_rc4.OtherNames in project ORCID-Source by ORCID.

the class OtherNameManagerTest method getPublicTest.

@Test
public void getPublicTest() {
    String orcid = "0000-0000-0000-0003";
    OtherNames elements = otherNameManager.getPublicOtherNames(orcid, System.currentTimeMillis());
    assertNotNull(elements);
    assertNotNull(elements.getOtherNames());
    assertEquals(1, elements.getOtherNames().size());
    assertEquals(Long.valueOf(13), elements.getOtherNames().get(0).getPutCode());
}
Also used : OtherNames(org.orcid.jaxb.model.record_v2.OtherNames) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Aggregations

OtherNames (org.orcid.jaxb.model.record_v2.OtherNames)70 Test (org.junit.Test)61 OtherName (org.orcid.jaxb.model.record_v2.OtherName)55 Biography (org.orcid.jaxb.model.record_v2.Biography)47 Name (org.orcid.jaxb.model.record_v2.Name)40 Addresses (org.orcid.jaxb.model.record_v2.Addresses)35 Keywords (org.orcid.jaxb.model.record_v2.Keywords)35 PersonExternalIdentifiers (org.orcid.jaxb.model.record_v2.PersonExternalIdentifiers)35 ResearcherUrls (org.orcid.jaxb.model.record_v2.ResearcherUrls)35 Address (org.orcid.jaxb.model.record_v2.Address)34 Email (org.orcid.jaxb.model.record_v2.Email)33 Emails (org.orcid.jaxb.model.record_v2.Emails)33 Keyword (org.orcid.jaxb.model.record_v2.Keyword)33 PersonExternalIdentifier (org.orcid.jaxb.model.record_v2.PersonExternalIdentifier)33 ResearcherUrl (org.orcid.jaxb.model.record_v2.ResearcherUrl)33 Person (org.orcid.jaxb.model.record_v2.Person)25 EducationSummary (org.orcid.jaxb.model.record.summary_v2.EducationSummary)15 EmploymentSummary (org.orcid.jaxb.model.record.summary_v2.EmploymentSummary)15 FundingSummary (org.orcid.jaxb.model.record.summary_v2.FundingSummary)15 PeerReviewSummary (org.orcid.jaxb.model.record.summary_v2.PeerReviewSummary)15