Search in sources :

Example 36 with PersonExternalIdentifier

use of org.orcid.jaxb.model.record_v2.PersonExternalIdentifier in project ORCID-Source by ORCID.

the class MemberV2ApiServiceDelegator_ExternalIdentifiersTest method testViewPublicExternalIdentifier.

@Test
public void testViewPublicExternalIdentifier() {
    SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4442", ScopePathType.PERSON_READ_LIMITED);
    Response response = serviceDelegator.viewExternalIdentifier("4444-4444-4444-4442", 2L);
    assertNotNull(response);
    PersonExternalIdentifier extId = (PersonExternalIdentifier) response.getEntity();
    assertNotNull(extId);
    assertEquals("/4444-4444-4444-4442/external-identifiers/2", extId.getPath());
    Utils.verifyLastModified(extId.getLastModifiedDate());
    assertEquals("Facebook", extId.getType());
    assertEquals(Long.valueOf(2), extId.getPutCode());
    assertEquals("abc123", extId.getValue());
    assertNotNull(extId.getUrl());
    assertEquals("http://www.facebook.com/abc123", extId.getUrl().getValue());
    assertEquals(Visibility.PUBLIC, extId.getVisibility());
    assertNotNull(extId.getSource());
    assertEquals("APP-5555555555555555", extId.getSource().retrieveSourcePath());
    assertNotNull(extId.getCreatedDate());
    Utils.verifyLastModified(extId.getLastModifiedDate());
}
Also used : Response(javax.ws.rs.core.Response) PersonExternalIdentifier(org.orcid.jaxb.model.record_v2.PersonExternalIdentifier) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 37 with PersonExternalIdentifier

use of org.orcid.jaxb.model.record_v2.PersonExternalIdentifier in project ORCID-Source by ORCID.

the class JpaJaxbExternalIdentifierAdapterImpl method toExternalIdentifier.

@Override
public PersonExternalIdentifier toExternalIdentifier(ExternalIdentifierEntity entity) {
    if (entity == null) {
        return null;
    }
    PersonExternalIdentifier result = mapperFacade.map(entity, PersonExternalIdentifier.class);
    result.setRelationship(Relationship.SELF);
    return result;
}
Also used : PersonExternalIdentifier(org.orcid.jaxb.model.record_v2.PersonExternalIdentifier)

Example 38 with PersonExternalIdentifier

use of org.orcid.jaxb.model.record_v2.PersonExternalIdentifier in project ORCID-Source by ORCID.

the class Api2_0_rc2_LastModifiedDatesHelper method calculateLatest.

public static Date calculateLatest(PersonExternalIdentifiers extIds) {
    Date latestAct = null;
    if (extIds != null && extIds.getExternalIdentifiers() != null && !extIds.getExternalIdentifiers().isEmpty()) {
        XMLGregorianCalendar latest = extIds.getExternalIdentifiers().get(0).getLastModifiedDate().getValue();
        for (PersonExternalIdentifier extId : extIds.getExternalIdentifiers()) {
            if (latest.compare(extId.getLastModifiedDate().getValue()) == -1) {
                latest = extId.getLastModifiedDate().getValue();
            }
        }
        latestAct = latest.toGregorianCalendar().getTime();
        extIds.setLastModifiedDate(new LastModifiedDate(latest));
    }
    return latestAct;
}
Also used : XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) LastModifiedDate(org.orcid.jaxb.model.common_rc2.LastModifiedDate) PersonExternalIdentifier(org.orcid.jaxb.model.record_rc2.PersonExternalIdentifier) LastModifiedDate(org.orcid.jaxb.model.common_rc2.LastModifiedDate) Date(java.util.Date)

Example 39 with PersonExternalIdentifier

use of org.orcid.jaxb.model.record_v2.PersonExternalIdentifier in project ORCID-Source by ORCID.

the class Api2_0_LastModifiedDatesHelper method calculateLastModified.

public static void calculateLastModified(PersonExternalIdentifiers extIds) {
    if (extIds != null && extIds.getExternalIdentifiers() != null && !extIds.getExternalIdentifiers().isEmpty()) {
        LastModifiedDate latest = null;
        for (PersonExternalIdentifier extId : extIds.getExternalIdentifiers()) {
            if (extId.getLastModifiedDate() != null && extId.getLastModifiedDate().after(latest)) {
                latest = extId.getLastModifiedDate();
            }
        }
        extIds.setLastModifiedDate(latest);
    }
}
Also used : LastModifiedDate(org.orcid.jaxb.model.common_v2.LastModifiedDate) PersonExternalIdentifier(org.orcid.jaxb.model.record_v2.PersonExternalIdentifier)

Example 40 with PersonExternalIdentifier

use of org.orcid.jaxb.model.record_v2.PersonExternalIdentifier in project ORCID-Source by ORCID.

the class ExternalIdentifierManagerTest method getExternalIdentifier.

private PersonExternalIdentifier getExternalIdentifier() {
    PersonExternalIdentifier extId = new PersonExternalIdentifier();
    extId.setRelationship(Relationship.SELF);
    extId.setType("person-ext-id-type");
    extId.setValue("person-ext-id-value");
    extId.setUrl(new Url("http://orcid.org"));
    extId.setVisibility(Visibility.PUBLIC);
    return extId;
}
Also used : PersonExternalIdentifier(org.orcid.jaxb.model.record_v2.PersonExternalIdentifier) Url(org.orcid.jaxb.model.common_v2.Url)

Aggregations

PersonExternalIdentifier (org.orcid.jaxb.model.record_v2.PersonExternalIdentifier)104 Test (org.junit.Test)93 ResearcherUrl (org.orcid.jaxb.model.record_v2.ResearcherUrl)52 OtherName (org.orcid.jaxb.model.record_v2.OtherName)46 Address (org.orcid.jaxb.model.record_v2.Address)45 Keyword (org.orcid.jaxb.model.record_v2.Keyword)44 PersonExternalIdentifiers (org.orcid.jaxb.model.record_v2.PersonExternalIdentifiers)43 Email (org.orcid.jaxb.model.record_v2.Email)41 Biography (org.orcid.jaxb.model.record_v2.Biography)34 OtherNames (org.orcid.jaxb.model.record_v2.OtherNames)34 Addresses (org.orcid.jaxb.model.record_v2.Addresses)32 Emails (org.orcid.jaxb.model.record_v2.Emails)32 Keywords (org.orcid.jaxb.model.record_v2.Keywords)32 Person (org.orcid.jaxb.model.record_v2.Person)32 ResearcherUrls (org.orcid.jaxb.model.record_v2.ResearcherUrls)32 Name (org.orcid.jaxb.model.record_v2.Name)30 DBUnitTest (org.orcid.test.DBUnitTest)21 Response (javax.ws.rs.core.Response)19 EducationSummary (org.orcid.jaxb.model.record.summary_v2.EducationSummary)19 EmploymentSummary (org.orcid.jaxb.model.record.summary_v2.EmploymentSummary)19