use of org.orcid.jaxb.model.record_rc2.PersonExternalIdentifier in project ORCID-Source by ORCID.
the class Api2_0_rc3_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_rc2.PersonExternalIdentifier in project ORCID-Source by ORCID.
the class JpaJaxbExternalIdentifierAdapterTest method fromExternalIdentifierEntityToExternalIdentifier.
@Test
public void fromExternalIdentifierEntityToExternalIdentifier() {
ExternalIdentifierEntity entity = getExternalIdentifierEntity();
PersonExternalIdentifier extId = jpaJaxbExternalIdentifierAdapter.toExternalIdentifier(entity);
assertNotNull(extId);
assertNotNull(extId.getCreatedDate());
assertNotNull(extId.getCreatedDate().getValue());
assertNotNull(extId.getLastModifiedDate());
assertNotNull(extId.getLastModifiedDate().getValue());
assertEquals("common-name", extId.getType());
assertEquals("id-reference", extId.getValue());
assertNotNull(extId.getUrl());
assertEquals("http://myurl.com", extId.getUrl().getValue());
assertEquals(Long.valueOf(123), extId.getPutCode());
assertNotNull(extId.getSource());
assertEquals("APP-0000000000000000", extId.getSource().retrieveSourcePath());
assertEquals(Visibility.LIMITED.value(), extId.getVisibility().value());
assertNotNull(extId.getCreatedDate());
assertNotNull(extId.getLastModifiedDate());
}
use of org.orcid.jaxb.model.record_rc2.PersonExternalIdentifier in project ORCID-Source by ORCID.
the class JpaJaxbExternalIdentifierAdapterImpl method toExternalIdentifierList.
@Override
public PersonExternalIdentifiers toExternalIdentifierList(Collection<ExternalIdentifierEntity> entities) {
if (entities == null) {
return null;
}
List<PersonExternalIdentifier> externalIdentifier = mapperFacade.mapAsList(entities, PersonExternalIdentifier.class);
for (PersonExternalIdentifier e : externalIdentifier) {
e.setRelationship(Relationship.SELF);
}
PersonExternalIdentifiers externalIdentifiers = new PersonExternalIdentifiers();
externalIdentifiers.setExternalIdentifiers(externalIdentifier);
return externalIdentifiers;
}
use of org.orcid.jaxb.model.record_rc2.PersonExternalIdentifier in project ORCID-Source by ORCID.
the class PersonValidatorTest method getPersonExternalIdentifier.
private PersonExternalIdentifier getPersonExternalIdentifier() {
PersonExternalIdentifier extId = new PersonExternalIdentifier();
extId.setRelationship(Relationship.SELF);
extId.setType("doi");
extId.setUrl(new Url("http://test.orcid.org"));
extId.setValue("extId1");
extId.setVisibility(Visibility.PUBLIC);
return extId;
}
use of org.orcid.jaxb.model.record_rc2.PersonExternalIdentifier in project ORCID-Source by ORCID.
the class PersonValidatorTest method validateExternalIdentifier_invalidPutCodeOnUpdateTest.
@Test(expected = PutCodeRequiredException.class)
public void validateExternalIdentifier_invalidPutCodeOnUpdateTest() {
PersonExternalIdentifier extId = getPersonExternalIdentifier();
extId.setPutCode(null);
PersonValidator.validateExternalIdentifier(extId, getSourceEntity(), false, true, Visibility.PUBLIC, true);
fail();
}
Aggregations