use of org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier in project ORCID-Source by ORCID.
the class ExternalIdentifierManagerTest method testAddEqualsExternalIdentifiersFromSameSource.
@Test(expected = OrcidDuplicatedElementException.class)
public void testAddEqualsExternalIdentifiersFromSameSource() {
PersonExternalIdentifier extId = getExternalIdentifier();
extId.setType(extId.getType() + System.currentTimeMillis());
// Create from client # 1
when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
PersonExternalIdentifier extId1 = externalIdentifierManager.createExternalIdentifier(claimedOrcid, extId, true);
assertNotNull(extId1);
assertNotNull(extId1.getPutCode());
// Remove the put code and the source
extId1.setPutCode(null);
extId1.setSource(null);
externalIdentifierManager.createExternalIdentifier(claimedOrcid, extId, true);
fail();
}
use of org.orcid.jaxb.model.v3.dev1.record.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.v3.dev1.record.PersonExternalIdentifier in project ORCID-Source by ORCID.
the class PersonValidatorTest method validateExternalIdentifier_invalidRelationship1_flagOffTest.
@Test
public void validateExternalIdentifier_invalidRelationship1_flagOffTest() {
PersonExternalIdentifier extId = getPersonExternalIdentifier();
extId.setRelationship(null);
PersonValidator.validateExternalIdentifier(extId, getSourceEntity(), true, true, Visibility.PUBLIC, false);
}
use of org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegatorImpl method updateExternalIdentifier.
@Override
public Response updateExternalIdentifier(String orcid, Long putCode, PersonExternalIdentifier externalIdentifier) {
orcidSecurityManager.checkClientAccessAndScopes(orcid, ScopePathType.ORCID_BIO_EXTERNAL_IDENTIFIERS_CREATE);
if (!putCode.equals(externalIdentifier.getPutCode())) {
Map<String, String> params = new HashMap<String, String>();
params.put("urlPutCode", String.valueOf(putCode));
params.put("bodyPutCode", String.valueOf(externalIdentifier.getPutCode()));
throw new MismatchedPutCodeException(params);
}
clearSource(externalIdentifier);
PersonExternalIdentifier extId = externalIdentifierManager.updateExternalIdentifier(orcid, externalIdentifier, true);
ElementUtils.setPathToExternalIdentifier(extId, orcid);
sourceUtils.setSourceName(extId);
return Response.ok(extId).build();
}
use of org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegatorImpl method viewExternalIdentifier.
@Override
public Response viewExternalIdentifier(String orcid, Long putCode) {
PersonExternalIdentifier extId = externalIdentifierManagerReadOnly.getExternalIdentifier(orcid, putCode);
orcidSecurityManager.checkAndFilter(orcid, extId, ScopePathType.ORCID_BIO_READ_LIMITED);
ElementUtils.setPathToExternalIdentifier(extId, orcid);
sourceUtils.setSourceName(extId);
return Response.ok(extId).build();
}
Aggregations