use of org.orcid.jaxb.model.record_rc4.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;
}
use of org.orcid.jaxb.model.record_rc4.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;
}
use of org.orcid.jaxb.model.record_rc4.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);
}
}
use of org.orcid.jaxb.model.record_rc4.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;
}
use of org.orcid.jaxb.model.record_rc4.PersonExternalIdentifier in project ORCID-Source by ORCID.
the class ExternalIdentifierManagerTest method testAddExternalIdentifierToUnclaimedRecordPreserveExternalIdentifierVisibility.
@Test
public void testAddExternalIdentifierToUnclaimedRecordPreserveExternalIdentifierVisibility() {
when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
PersonExternalIdentifier extId = getExternalIdentifier();
extId = externalIdentifierManager.createExternalIdentifier(unclaimedOrcid, extId, true);
extId = externalIdentifierManager.getExternalIdentifier(unclaimedOrcid, extId.getPutCode());
assertNotNull(extId);
assertEquals(Visibility.PUBLIC, extId.getVisibility());
}
Aggregations