Search in sources :

Example 31 with PersonExternalIdentifiers

use of org.orcid.jaxb.model.record_rc3.PersonExternalIdentifiers in project ORCID-Source by ORCID.

the class PublicAPISecurityManagerV2Test method getPersonExternalIdentifiersElement.

private PersonExternalIdentifiers getPersonExternalIdentifiersElement(Visibility... vs) {
    PersonExternalIdentifiers elements = new PersonExternalIdentifiers();
    for (Visibility v : vs) {
        PersonExternalIdentifier element = new PersonExternalIdentifier();
        element.setVisibility(v);
        if (elements.getExternalIdentifiers() == null) {
            elements.setExternalIdentifiers(new ArrayList<PersonExternalIdentifier>());
        }
        elements.getExternalIdentifiers().add(element);
    }
    return elements;
}
Also used : PersonExternalIdentifiers(org.orcid.jaxb.model.record_v2.PersonExternalIdentifiers) Visibility(org.orcid.jaxb.model.common_v2.Visibility) PersonExternalIdentifier(org.orcid.jaxb.model.record_v2.PersonExternalIdentifier)

Example 32 with PersonExternalIdentifiers

use of org.orcid.jaxb.model.record_rc3.PersonExternalIdentifiers in project ORCID-Source by ORCID.

the class MemberV2ApiServiceDelegator_ExternalIdentifiersTest method testViewExternalIdentifiers.

@Test
public void testViewExternalIdentifiers() {
    SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4442", ScopePathType.PERSON_READ_LIMITED);
    Response response = serviceDelegator.viewExternalIdentifiers("4444-4444-4444-4442");
    assertNotNull(response);
    PersonExternalIdentifiers extIds = (PersonExternalIdentifiers) response.getEntity();
    assertNotNull(extIds);
    assertEquals("/4444-4444-4444-4442/external-identifiers", extIds.getPath());
    Utils.verifyLastModified(extIds.getLastModifiedDate());
    List<PersonExternalIdentifier> extIdsList = extIds.getExternalIdentifiers();
    assertNotNull(extIdsList);
    assertEquals(3, extIdsList.size());
    for (PersonExternalIdentifier extId : extIdsList) {
        Utils.verifyLastModified(extId.getLastModifiedDate());
        assertThat(extId.getPutCode(), anyOf(is(2L), is(3L), is(5L)));
        assertThat(extId.getValue(), anyOf(is("abc123"), is("abc456"), is("abc012")));
        assertNotNull(extId.getUrl());
        assertThat(extId.getUrl().getValue(), anyOf(is("http://www.facebook.com/abc123"), is("http://www.facebook.com/abc456"), is("http://www.facebook.com/abc012")));
        assertEquals("Facebook", extId.getType());
        assertNotNull(extId.getSource());
        if (extId.getPutCode().equals(2L)) {
            assertEquals(Visibility.PUBLIC, extId.getVisibility());
            assertEquals("APP-5555555555555555", extId.getSource().retrieveSourcePath());
        } else if (extId.getPutCode().equals(3L)) {
            assertEquals(Visibility.LIMITED, extId.getVisibility());
            assertEquals("4444-4444-4444-4442", extId.getSource().retrieveSourcePath());
        } else {
            assertEquals(Visibility.PRIVATE, extId.getVisibility());
            assertEquals("APP-5555555555555555", extId.getSource().retrieveSourcePath());
        }
    }
}
Also used : Response(javax.ws.rs.core.Response) PersonExternalIdentifiers(org.orcid.jaxb.model.record_v2.PersonExternalIdentifiers) PersonExternalIdentifier(org.orcid.jaxb.model.record_v2.PersonExternalIdentifier) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 33 with PersonExternalIdentifiers

use of org.orcid.jaxb.model.record_rc3.PersonExternalIdentifiers in project ORCID-Source by ORCID.

the class MemberV2ApiServiceDelegator_ExternalIdentifiersTest method testViewExternalIdentifiersReadPublic.

@Test
public void testViewExternalIdentifiersReadPublic() {
    SecurityContextTestUtils.setUpSecurityContextForClientOnly("APP-5555555555555555", ScopePathType.READ_PUBLIC);
    Response r = serviceDelegator.viewExternalIdentifiers(ORCID);
    PersonExternalIdentifiers element = (PersonExternalIdentifiers) r.getEntity();
    assertNotNull(element);
    assertEquals("/0000-0000-0000-0003/external-identifiers", element.getPath());
    Utils.assertIsPublicOrSource(element, "APP-5555555555555555");
}
Also used : Response(javax.ws.rs.core.Response) PersonExternalIdentifiers(org.orcid.jaxb.model.record_v2.PersonExternalIdentifiers) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 34 with PersonExternalIdentifiers

use of org.orcid.jaxb.model.record_rc3.PersonExternalIdentifiers 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 35 with PersonExternalIdentifiers

use of org.orcid.jaxb.model.record_rc3.PersonExternalIdentifiers in project ORCID-Source by ORCID.

the class ExternalIdentifierManagerTest method getPublicTest.

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

Aggregations

PersonExternalIdentifiers (org.orcid.jaxb.model.record_v2.PersonExternalIdentifiers)54 Test (org.junit.Test)52 PersonExternalIdentifier (org.orcid.jaxb.model.record_v2.PersonExternalIdentifier)42 Addresses (org.orcid.jaxb.model.record_v2.Addresses)35 Keywords (org.orcid.jaxb.model.record_v2.Keywords)35 OtherNames (org.orcid.jaxb.model.record_v2.OtherNames)35 ResearcherUrls (org.orcid.jaxb.model.record_v2.ResearcherUrls)35 Biography (org.orcid.jaxb.model.record_v2.Biography)33 Emails (org.orcid.jaxb.model.record_v2.Emails)33 Address (org.orcid.jaxb.model.record_v2.Address)32 OtherName (org.orcid.jaxb.model.record_v2.OtherName)32 Email (org.orcid.jaxb.model.record_v2.Email)31 Keyword (org.orcid.jaxb.model.record_v2.Keyword)31 ResearcherUrl (org.orcid.jaxb.model.record_v2.ResearcherUrl)31 Name (org.orcid.jaxb.model.record_v2.Name)28 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