use of org.orcid.jaxb.model.record_v2.PersonalDetails in project ORCID-Source by ORCID.
the class ValidateV2RC4SamplesTest method testUnmarshallPersonalDetails.
@Test
public void testUnmarshallPersonalDetails() throws SAXException, URISyntaxException {
PersonalDetails personalDetails = (PersonalDetails) unmarshallFromPath("/record_2.0_rc4/samples/personal-details-2.0_rc4.xml", PersonalDetails.class, "/record_2.0_rc4/personal-details-2.0_rc4.xsd");
assertNotNull(personalDetails);
// Check bio
assertNotNull(personalDetails.getBiography());
assertEquals("Biography", personalDetails.getBiography().getContent());
assertEquals(Visibility.PUBLIC.value(), personalDetails.getBiography().getVisibility().value());
// Check names
assertNotNull(personalDetails.getName());
assertNotNull(personalDetails.getName().getCreditName());
assertEquals("Credit Name", personalDetails.getName().getCreditName().getContent());
assertNotNull(personalDetails.getName().getGivenNames());
assertEquals("Give Names", personalDetails.getName().getGivenNames().getContent());
assertNotNull(personalDetails.getName().getFamilyName());
assertEquals("Family Name", personalDetails.getName().getFamilyName().getContent());
assertEquals(Visibility.PUBLIC.value(), personalDetails.getName().getVisibility().value());
// Check other names
assertNotNull(personalDetails.getOtherNames());
assertNotNull(personalDetails.getOtherNames().getOtherNames());
assertEquals(2, personalDetails.getOtherNames().getOtherNames().size());
assertEquals("Other Name #1", personalDetails.getOtherNames().getOtherNames().get(0).getContent());
assertEquals("Other Name #2", personalDetails.getOtherNames().getOtherNames().get(1).getContent());
assertEquals(Visibility.PUBLIC, personalDetails.getOtherNames().getOtherNames().get(0).getVisibility());
assertEquals(Visibility.LIMITED, personalDetails.getOtherNames().getOtherNames().get(1).getVisibility());
}
use of org.orcid.jaxb.model.record_v2.PersonalDetails in project ORCID-Source by ORCID.
the class ValidateV2SamplesTest method testUnmarshallPersonalDetails.
@Test
public void testUnmarshallPersonalDetails() throws SAXException, URISyntaxException {
PersonalDetails personalDetails = (PersonalDetails) unmarshallFromPath("/record_2.0/samples/read_samples/personal-details-2.0.xml", PersonalDetails.class, "/record_2.0/personal-details-2.0.xsd");
assertNotNull(personalDetails);
// Check bio
assertNotNull(personalDetails.getBiography());
assertEquals("Biography", personalDetails.getBiography().getContent());
assertEquals(Visibility.PUBLIC.value(), personalDetails.getBiography().getVisibility().value());
// Check names
assertNotNull(personalDetails.getName());
assertNotNull(personalDetails.getName().getCreditName());
assertEquals("Credit Name", personalDetails.getName().getCreditName().getContent());
assertNotNull(personalDetails.getName().getGivenNames());
assertEquals("Give Names", personalDetails.getName().getGivenNames().getContent());
assertNotNull(personalDetails.getName().getFamilyName());
assertEquals("Family Name", personalDetails.getName().getFamilyName().getContent());
assertEquals(Visibility.PUBLIC.value(), personalDetails.getName().getVisibility().value());
// Check other names
assertNotNull(personalDetails.getOtherNames());
assertNotNull(personalDetails.getOtherNames().getOtherNames());
assertEquals(2, personalDetails.getOtherNames().getOtherNames().size());
assertEquals("Other Name #1", personalDetails.getOtherNames().getOtherNames().get(0).getContent());
assertEquals("Other Name #2", personalDetails.getOtherNames().getOtherNames().get(1).getContent());
assertEquals(Visibility.PUBLIC, personalDetails.getOtherNames().getOtherNames().get(0).getVisibility());
assertEquals(Visibility.LIMITED, personalDetails.getOtherNames().getOtherNames().get(1).getVisibility());
}
use of org.orcid.jaxb.model.record_v2.PersonalDetails in project ORCID-Source by ORCID.
the class PublicAPISecurityManagerV2Test method getPersonalDetailsElement.
private PersonalDetails getPersonalDetailsElement(Visibility nameVisibility, Visibility bioVisiblity, Visibility otherNamesVisibility) {
PersonalDetails p = new PersonalDetails();
Name name = new Name();
name.setVisibility(nameVisibility);
p.setName(name);
Biography bio = new Biography();
bio.setVisibility(bioVisiblity);
bio.setContent("Bio test");
p.setBiography(bio);
p.setOtherNames(getOtherNamesElement(otherNamesVisibility));
return p;
}
use of org.orcid.jaxb.model.record_v2.PersonalDetails in project ORCID-Source by ORCID.
the class PublicV2ApiServiceDelegatorImpl method viewPersonalDetails.
@Override
public Response viewPersonalDetails(String orcid) {
PersonalDetails personalDetails = personalDetailsManagerReadOnly.getPublicPersonalDetails(orcid);
publicAPISecurityManagerV2.filter(personalDetails);
ElementUtils.setPathToPersonalDetails(personalDetails, orcid);
Api2_0_LastModifiedDatesHelper.calculateLastModified(personalDetails);
sourceUtilsReadOnly.setSourceName(personalDetails);
return Response.ok(personalDetails).build();
}
use of org.orcid.jaxb.model.record_v2.PersonalDetails in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegator_PersonalDetailsTest method testViewPersonalDetailsReadPublic.
@Test
public void testViewPersonalDetailsReadPublic() {
SecurityContextTestUtils.setUpSecurityContextForClientOnly("APP-5555555555555555", ScopePathType.READ_PUBLIC);
Response r = serviceDelegator.viewPersonalDetails(ORCID);
PersonalDetails element = (PersonalDetails) r.getEntity();
assertNotNull(element);
assertEquals("/0000-0000-0000-0003/personal-details", element.getPath());
Utils.assertIsPublicOrSource(element, "APP-5555555555555555");
}
Aggregations