use of org.orcid.jaxb.model.record_rc2.Biography in project ORCID-Source by ORCID.
the class OrcidSecurityManager_generalTest method testBio_CantRead_When_ReadPublicToken_IsPrivate.
@Test(expected = OrcidAccessControlException.class)
public void testBio_CantRead_When_ReadPublicToken_IsPrivate() {
SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.READ_PUBLIC);
Biography bio = createBiography(Visibility.PRIVATE);
orcidSecurityManager.checkAndFilter(ORCID_1, bio, ScopePathType.ORCID_BIO_READ_LIMITED);
fail();
}
use of org.orcid.jaxb.model.record_rc2.Biography in project ORCID-Source by ORCID.
the class ValidateV2RC2SamplesTest method testUnmarshallPersonalDetails.
@Test
public void testUnmarshallPersonalDetails() throws SAXException, URISyntaxException {
PersonalDetails personalDetails = (PersonalDetails) unmarshallFromPath("/record_2.0_rc2/samples/personal-details-2.0_rc2.xml", PersonalDetails.class, "/record_2.0_rc2/personal-details-2.0_rc2.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_rc2.Biography in project ORCID-Source by ORCID.
the class ValidateV2RC2SamplesTest method testUnmarshallBiography.
@Test
public void testUnmarshallBiography() throws SAXException, URISyntaxException {
Biography bio = (Biography) unmarshallFromPath("/record_2.0_rc2/samples/biography-2.0_rc2.xml", Biography.class, "/record_2.0_rc2/personal-details-2.0_rc2.xsd");
assertNotNull(bio);
assertEquals("biography V2.0_rc2", bio.getContent());
assertEquals(Visibility.PUBLIC.value(), bio.getVisibility().value());
}
use of org.orcid.jaxb.model.record_rc2.Biography in project ORCID-Source by ORCID.
the class ValidateV2_1SamplesTest method testUnmarshallBiography.
@Test
public void testUnmarshallBiography() throws SAXException, URISyntaxException {
Biography bio = (Biography) unmarshallFromPath("/record_2.1/samples/read_samples/biography-2.1.xml", Biography.class, "/record_2.1/personal-details-2.1.xsd");
assertNotNull(bio);
assertEquals("biography V2.1", bio.getContent());
assertEquals(Visibility.PUBLIC.value(), bio.getVisibility().value());
}
use of org.orcid.jaxb.model.record_rc2.Biography in project ORCID-Source by ORCID.
the class PersonDetailsManagerReadOnlyImpl method getPublicPersonDetails.
@Override
public Person getPublicPersonDetails(String orcid) {
long lastModifiedTime = getLastModified(orcid);
Person person = new Person();
Name name = recordNameManager.getRecordName(orcid, lastModifiedTime);
if (Visibility.PUBLIC.equals(name.getVisibility())) {
person.setName(name);
}
Biography bio = biographyManager.getPublicBiography(orcid, lastModifiedTime);
if (bio != null) {
person.setBiography(bio);
}
Addresses addresses = addressManager.getPublicAddresses(orcid, lastModifiedTime);
if (addresses.getAddress() != null) {
Addresses filteredAddresses = new Addresses();
filteredAddresses.setAddress(new ArrayList<Address>(addresses.getAddress()));
person.setAddresses(filteredAddresses);
}
PersonExternalIdentifiers extIds = externalIdentifierManager.getPublicExternalIdentifiers(orcid, lastModifiedTime);
if (extIds.getExternalIdentifiers() != null) {
PersonExternalIdentifiers filteredExtIds = new PersonExternalIdentifiers();
filteredExtIds.setExternalIdentifiers(new ArrayList<PersonExternalIdentifier>(extIds.getExternalIdentifiers()));
person.setExternalIdentifiers(filteredExtIds);
}
Keywords keywords = profileKeywordManager.getPublicKeywords(orcid, lastModifiedTime);
if (keywords.getKeywords() != null) {
Keywords filteredKeywords = new Keywords();
filteredKeywords.setKeywords(new ArrayList<Keyword>(keywords.getKeywords()));
person.setKeywords(filteredKeywords);
}
OtherNames otherNames = otherNameManager.getPublicOtherNames(orcid, lastModifiedTime);
if (otherNames.getOtherNames() != null) {
OtherNames filteredOtherNames = new OtherNames();
filteredOtherNames.setOtherNames(new ArrayList<OtherName>(otherNames.getOtherNames()));
person.setOtherNames(filteredOtherNames);
}
ResearcherUrls rUrls = researcherUrlManager.getPublicResearcherUrls(orcid, lastModifiedTime);
if (rUrls.getResearcherUrls() != null) {
ResearcherUrls filteredRUrls = new ResearcherUrls();
filteredRUrls.setResearcherUrls(new ArrayList<ResearcherUrl>(rUrls.getResearcherUrls()));
person.setResearcherUrls(filteredRUrls);
}
Emails emails = emailManager.getPublicEmails(orcid, lastModifiedTime);
if (emails.getEmails() != null) {
Emails filteredEmails = new Emails();
filteredEmails.setEmails(new ArrayList<Email>(emails.getEmails()));
person.setEmails(filteredEmails);
}
return person;
}
Aggregations