Search in sources :

Example 66 with PersonExternalIdentifiers

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

the class ValidateV2RC4SamplesTest method testMarshallExternalIdentifiers.

@Test
public void testMarshallExternalIdentifiers() throws JAXBException, SAXException, URISyntaxException {
    PersonExternalIdentifiers object = (PersonExternalIdentifiers) unmarshallFromPath("/record_2.0_rc4/samples/external-identifiers-2.0_rc4.xml", PersonExternalIdentifiers.class);
    marshall(object, "/record_2.0_rc4/person-external-identifier-2.0_rc4.xsd");
}
Also used : PersonExternalIdentifiers(org.orcid.jaxb.model.record_rc4.PersonExternalIdentifiers) Test(org.junit.Test)

Example 67 with PersonExternalIdentifiers

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

the class ValidateV2RC3SamplesTest method testMarshallExternalIdentifiers.

@Test
public void testMarshallExternalIdentifiers() throws JAXBException, SAXException, URISyntaxException {
    PersonExternalIdentifiers object = (PersonExternalIdentifiers) unmarshallFromPath("/record_2.0_rc3/samples/external-identifiers-2.0_rc3.xml", PersonExternalIdentifiers.class);
    marshall(object, "/record_2.0_rc3/person-external-identifier-2.0_rc3.xsd");
}
Also used : PersonExternalIdentifiers(org.orcid.jaxb.model.record_rc3.PersonExternalIdentifiers) Test(org.junit.Test)

Example 68 with PersonExternalIdentifiers

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

the class WorkspaceController method updateExternalIdentifierJson.

/**
     * Update the visibility of the given external identifeirs
     * */
@RequestMapping(value = "/my-orcid/externalIdentifiers.json", method = RequestMethod.POST)
@ResponseBody
public ExternalIdentifiersForm updateExternalIdentifierJson(HttpServletRequest request, @RequestBody ExternalIdentifiersForm externalIdentifiersForm) {
    PersonExternalIdentifiers externalIdentifiers = externalIdentifiersForm.toPersonExternalIdentifiers();
    externalIdentifiers = externalIdentifierManager.updateExternalIdentifiers(getCurrentUserOrcid(), externalIdentifiers);
    return externalIdentifiersForm;
}
Also used : PersonExternalIdentifiers(org.orcid.jaxb.model.record_v2.PersonExternalIdentifiers) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 69 with PersonExternalIdentifiers

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

the class MemberV2ApiServiceDelegator_ExternalIdentifiersTest method testReadPublicScope_ExternalIdentifiers.

@Test
public void testReadPublicScope_ExternalIdentifiers() {
    SecurityContextTestUtils.setUpSecurityContext(ORCID, ScopePathType.READ_PUBLIC);
    // Public works
    Response r = serviceDelegator.viewExternalIdentifiers(ORCID);
    assertNotNull(r);
    assertEquals(PersonExternalIdentifiers.class.getName(), r.getEntity().getClass().getName());
    PersonExternalIdentifiers p = (PersonExternalIdentifiers) r.getEntity();
    assertNotNull(p);
    assertEquals("/0000-0000-0000-0003/external-identifiers", p.getPath());
    Utils.verifyLastModified(p.getLastModifiedDate());
    assertEquals(3, p.getExternalIdentifiers().size());
    boolean found13 = false, found14 = false, found15 = false;
    for (PersonExternalIdentifier element : p.getExternalIdentifiers()) {
        if (element.getPutCode() == 13) {
            found13 = true;
        } else if (element.getPutCode() == 14) {
            found14 = true;
        } else if (element.getPutCode() == 15) {
            found15 = true;
        } else {
            fail("Invalid put code " + element.getPutCode());
        }
    }
    assertTrue(found13);
    assertTrue(found14);
    assertTrue(found15);
    r = serviceDelegator.viewExternalIdentifier(ORCID, 13L);
    assertNotNull(r);
    assertEquals(PersonExternalIdentifier.class.getName(), r.getEntity().getClass().getName());
    // Limited am the source of should work
    serviceDelegator.viewExternalIdentifier(ORCID, 14L);
    // Limited fail
    try {
        serviceDelegator.viewExternalIdentifier(ORCID, 16L);
        fail();
    } catch (OrcidAccessControlException e) {
    } catch (Exception e) {
        fail();
    }
    // Private am the source of should work
    serviceDelegator.viewExternalIdentifier(ORCID, 15L);
    // Private fail
    try {
        serviceDelegator.viewExternalIdentifier(ORCID, 17L);
        fail();
    } catch (OrcidAccessControlException e) {
    } catch (Exception e) {
        fail();
    }
}
Also used : Response(javax.ws.rs.core.Response) PersonExternalIdentifiers(org.orcid.jaxb.model.record_v2.PersonExternalIdentifiers) PersonExternalIdentifier(org.orcid.jaxb.model.record_v2.PersonExternalIdentifier) OrcidAccessControlException(org.orcid.core.exception.OrcidAccessControlException) NoResultException(javax.persistence.NoResultException) OrcidAccessControlException(org.orcid.core.exception.OrcidAccessControlException) VisibilityMismatchException(org.orcid.core.exception.VisibilityMismatchException) OrcidVisibilityException(org.orcid.core.exception.OrcidVisibilityException) OrcidUnauthorizedException(org.orcid.core.exception.OrcidUnauthorizedException) WrongSourceException(org.orcid.core.exception.WrongSourceException) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 70 with PersonExternalIdentifiers

use of org.orcid.jaxb.model.record_v2.PersonExternalIdentifiers 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;
}
Also used : PersonExternalIdentifiers(org.orcid.jaxb.model.record_v2.PersonExternalIdentifiers) PersonExternalIdentifier(org.orcid.jaxb.model.record_v2.PersonExternalIdentifier)

Aggregations

PersonExternalIdentifiers (org.orcid.jaxb.model.record_v2.PersonExternalIdentifiers)54 Test (org.junit.Test)52 PersonExternalIdentifier (org.orcid.jaxb.model.record_v2.PersonExternalIdentifier)47 OtherNames (org.orcid.jaxb.model.record_v2.OtherNames)37 Addresses (org.orcid.jaxb.model.record_v2.Addresses)35 Biography (org.orcid.jaxb.model.record_v2.Biography)35 Keywords (org.orcid.jaxb.model.record_v2.Keywords)35 ResearcherUrls (org.orcid.jaxb.model.record_v2.ResearcherUrls)35 Address (org.orcid.jaxb.model.record_v2.Address)34 Email (org.orcid.jaxb.model.record_v2.Email)33 Emails (org.orcid.jaxb.model.record_v2.Emails)33 Keyword (org.orcid.jaxb.model.record_v2.Keyword)33 ResearcherUrl (org.orcid.jaxb.model.record_v2.ResearcherUrl)33 OtherName (org.orcid.jaxb.model.record_v2.OtherName)32 Name (org.orcid.jaxb.model.record_v2.Name)28 Person (org.orcid.jaxb.model.record_v2.Person)25 EducationSummary (org.orcid.jaxb.model.record.summary_v2.EducationSummary)15 EmploymentSummary (org.orcid.jaxb.model.record.summary_v2.EmploymentSummary)15 FundingSummary (org.orcid.jaxb.model.record.summary_v2.FundingSummary)15 PeerReviewSummary (org.orcid.jaxb.model.record.summary_v2.PeerReviewSummary)15