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");
}
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");
}
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;
}
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();
}
}
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;
}
Aggregations