Search in sources :

Example 91 with PersonExternalIdentifier

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();
}
Also used : ClientDetailsEntity(org.orcid.persistence.jpa.entities.ClientDetailsEntity) SourceEntity(org.orcid.persistence.jpa.entities.SourceEntity) PersonExternalIdentifier(org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 92 with PersonExternalIdentifier

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;
}
Also used : PersonExternalIdentifier(org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier) Url(org.orcid.jaxb.model.v3.dev1.common.Url)

Example 93 with PersonExternalIdentifier

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);
}
Also used : PersonExternalIdentifier(org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier) Test(org.junit.Test)

Example 94 with PersonExternalIdentifier

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();
}
Also used : HashMap(java.util.HashMap) PersonExternalIdentifier(org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier) MismatchedPutCodeException(org.orcid.core.exception.MismatchedPutCodeException)

Example 95 with PersonExternalIdentifier

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();
}
Also used : PersonExternalIdentifier(org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier)

Aggregations

PersonExternalIdentifier (org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier)93 Test (org.junit.Test)68 ResearcherUrl (org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl)42 PersonExternalIdentifiers (org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifiers)40 Address (org.orcid.jaxb.model.v3.dev1.record.Address)39 OtherName (org.orcid.jaxb.model.v3.dev1.record.OtherName)39 Keyword (org.orcid.jaxb.model.v3.dev1.record.Keyword)38 Email (org.orcid.jaxb.model.v3.dev1.record.Email)36 Biography (org.orcid.jaxb.model.v3.dev1.record.Biography)31 OtherNames (org.orcid.jaxb.model.v3.dev1.record.OtherNames)31 Addresses (org.orcid.jaxb.model.v3.dev1.record.Addresses)30 Emails (org.orcid.jaxb.model.v3.dev1.record.Emails)30 Keywords (org.orcid.jaxb.model.v3.dev1.record.Keywords)30 ResearcherUrls (org.orcid.jaxb.model.v3.dev1.record.ResearcherUrls)30 Person (org.orcid.jaxb.model.v3.dev1.record.Person)28 Name (org.orcid.jaxb.model.v3.dev1.record.Name)27 DBUnitTest (org.orcid.test.DBUnitTest)21 Response (javax.ws.rs.core.Response)19 Record (org.orcid.jaxb.model.v3.dev1.record.Record)15 EducationSummary (org.orcid.jaxb.model.v3.dev1.record.summary.EducationSummary)15