use of org.orcid.jaxb.model.record_rc3.PersonExternalIdentifiers in project ORCID-Source by ORCID.
the class ValidateV2RC3SamplesTest method testUnmarshallExternalIdentifiers.
@Test
public void testUnmarshallExternalIdentifiers() throws SAXException, URISyntaxException {
PersonExternalIdentifiers externalIdentifiers = (PersonExternalIdentifiers) unmarshallFromPath("/record_2.0_rc3/samples/external-identifiers-2.0_rc3.xml", PersonExternalIdentifiers.class, "/record_2.0_rc3/person-external-identifier-2.0_rc3.xsd");
assertNotNull(externalIdentifiers);
assertNotNull(externalIdentifiers.getExternalIdentifiers());
assertEquals(2, externalIdentifiers.getExternalIdentifiers().size());
for (PersonExternalIdentifier extId : externalIdentifiers.getExternalIdentifiers()) {
assertThat(extId.getPutCode(), anyOf(is(1L), is(2L)));
assertThat(extId.getType(), anyOf(is("common-name-1"), is("common-name-2")));
assertThat(extId.getValue(), anyOf(is("id-reference-1"), is("id-reference-2")));
assertNotNull(extId.getUrl());
assertThat(extId.getUrl().getValue(), anyOf(is("http://url/1"), is("http://url/2")));
assertNotNull(extId.getCreatedDate());
assertNotNull(extId.getLastModifiedDate());
assertNotNull(extId.getSource());
assertEquals("8888-8888-8888-8880", extId.getSource().retrieveSourcePath());
}
PersonExternalIdentifier extId = (PersonExternalIdentifier) unmarshallFromPath("/record_2.0_rc3/samples/external-identifier-2.0_rc3.xml", PersonExternalIdentifier.class);
assertNotNull(extId);
assertEquals("A-0003", extId.getType());
assertEquals(Long.valueOf(1), extId.getPutCode());
assertEquals("A-0003", extId.getValue());
assertNotNull(extId.getUrl());
assertEquals("http://ext-id/A-0003", extId.getUrl().getValue());
assertEquals(Visibility.PUBLIC.value(), extId.getVisibility().value());
assertNotNull(extId.getCreatedDate());
assertNotNull(extId.getLastModifiedDate());
assertNotNull(extId.getSource());
assertEquals("8888-8888-8888-8880", extId.getSource().retrieveSourcePath());
}
use of org.orcid.jaxb.model.record_rc3.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_rc3.PersonExternalIdentifiers in project ORCID-Source by ORCID.
the class ValidateV2RC3SamplesTest method unmarshallFromPath.
private Object unmarshallFromPath(String path, Class<?> type, String schemaPath) throws SAXException, URISyntaxException {
try (Reader reader = new InputStreamReader(getClass().getResourceAsStream(path))) {
Object obj = unmarshall(reader, type, schemaPath);
Object result = null;
if (ResearcherUrls.class.equals(type)) {
result = (ResearcherUrls) obj;
} else if (ResearcherUrl.class.equals(type)) {
result = (ResearcherUrl) obj;
} else if (PersonalDetails.class.equals(type)) {
result = (PersonalDetails) obj;
} else if (PersonExternalIdentifier.class.equals(type)) {
result = (PersonExternalIdentifier) obj;
} else if (PersonExternalIdentifiers.class.equals(type)) {
result = (PersonExternalIdentifiers) obj;
} else if (Biography.class.equals(type)) {
result = (Biography) obj;
} else if (Name.class.equals(type)) {
result = (Name) obj;
} else if (CreditName.class.equals(type)) {
result = (CreditName) obj;
} else if (OtherName.class.equals(type)) {
result = (OtherName) obj;
} else if (OtherNames.class.equals(type)) {
result = (OtherNames) obj;
} else if (Keywords.class.equals(type)) {
result = (Keywords) obj;
} else if (Keyword.class.equals(type)) {
result = (Keyword) obj;
} else if (Addresses.class.equals(type)) {
result = (Addresses) obj;
} else if (Address.class.equals(type)) {
result = (Address) obj;
} else if (Emails.class.equals(type)) {
result = (Emails) obj;
} else if (Email.class.equals(type)) {
result = (Email) obj;
} else if (Person.class.equals(type)) {
result = (Person) obj;
} else if (Deprecated.class.equals(type)) {
result = (Deprecated) obj;
} else if (Preferences.class.equals(type)) {
result = (Preferences) obj;
} else if (History.class.equals(type)) {
result = (History) obj;
} else if (Record.class.equals(type)) {
result = (Record) obj;
} else if (ActivitiesSummary.class.equals(type)) {
result = (ActivitiesSummary) obj;
}
return result;
} catch (IOException e) {
throw new RuntimeException("Error reading notification from classpath", e);
}
}
use of org.orcid.jaxb.model.record_rc3.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_rc3.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;
}
Aggregations