use of org.orcid.jaxb.model.record_rc4.Biography in project ORCID-Source by ORCID.
the class PublicAPISecurityManagerV2Test method getPersonElement.
private Person getPersonElement() {
Visibility[] vs = { Visibility.PUBLIC, Visibility.PUBLIC, Visibility.PUBLIC };
Person p = new Person();
p.setAddresses(getAddressesElement(vs));
p.setEmails(getEmailsElement(vs));
p.setExternalIdentifiers(getPersonExternalIdentifiersElement(vs));
p.setKeywords(getKeywordsElement(vs));
p.setOtherNames(getOtherNamesElement(vs));
p.setResearcherUrls(getResearcherUrlsElement(vs));
Name name = new Name();
name.setVisibility(Visibility.PUBLIC);
p.setName(name);
Biography b = new Biography();
b.setVisibility(Visibility.PUBLIC);
b.setContent("Biography test");
p.setBiography(b);
return p;
}
use of org.orcid.jaxb.model.record_rc4.Biography in project ORCID-Source by ORCID.
the class PublicAPISecurityManagerV2Test method checkIsPublicBiographyTest.
@Test
public void checkIsPublicBiographyTest() {
Biography b = new Biography();
b.setVisibility(Visibility.PUBLIC);
b.setContent("Bio test");
publicAPISecurityManagerV2.checkIsPublic(b);
try {
b.setVisibility(Visibility.LIMITED);
publicAPISecurityManagerV2.checkIsPublic(b);
fail();
} catch (OrcidNonPublicElementException e) {
}
try {
b.setVisibility(Visibility.PRIVATE);
publicAPISecurityManagerV2.checkIsPublic(b);
fail();
} catch (OrcidNonPublicElementException e) {
}
}
use of org.orcid.jaxb.model.record_rc4.Biography 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_rc4.Biography in project ORCID-Source by ORCID.
the class BiographyManagerTest method testCreateBiography.
@Test
public void testCreateBiography() {
String orcid = "0000-0000-0000-0004";
Biography bio = new Biography();
bio.setContent("This is my biography");
bio.setVisibility(Visibility.LIMITED);
biographyManager.createBiography(orcid, bio);
Biography newBio = biographyManager.getBiography(orcid);
assertNotNull(newBio);
assertEquals("This is my biography", newBio.getContent());
assertEquals(Visibility.LIMITED, newBio.getVisibility());
}
use of org.orcid.jaxb.model.record_rc4.Biography in project ORCID-Source by ORCID.
the class PersonDetailsManagerReadOnlyImpl method getPublicPersonDetails.
@Override
public Person getPublicPersonDetails(String orcid) {
Person person = new Person();
Name name = recordNameManager.getRecordName(orcid);
if (Visibility.PUBLIC.equals(name.getVisibility())) {
person.setName(name);
}
Biography bio = biographyManager.getPublicBiography(orcid);
if (bio != null) {
person.setBiography(bio);
}
Addresses addresses = addressManager.getPublicAddresses(orcid);
if (addresses.getAddress() != null) {
Addresses filteredAddresses = new Addresses();
filteredAddresses.setAddress(new ArrayList<Address>(addresses.getAddress()));
person.setAddresses(filteredAddresses);
}
PersonExternalIdentifiers extIds = externalIdentifierManager.getPublicExternalIdentifiers(orcid);
if (extIds.getExternalIdentifiers() != null) {
PersonExternalIdentifiers filteredExtIds = new PersonExternalIdentifiers();
filteredExtIds.setExternalIdentifiers(new ArrayList<PersonExternalIdentifier>(extIds.getExternalIdentifiers()));
person.setExternalIdentifiers(filteredExtIds);
}
Keywords keywords = profileKeywordManager.getPublicKeywords(orcid);
if (keywords.getKeywords() != null) {
Keywords filteredKeywords = new Keywords();
filteredKeywords.setKeywords(new ArrayList<Keyword>(keywords.getKeywords()));
person.setKeywords(filteredKeywords);
}
OtherNames otherNames = otherNameManager.getPublicOtherNames(orcid);
if (otherNames.getOtherNames() != null) {
OtherNames filteredOtherNames = new OtherNames();
filteredOtherNames.setOtherNames(new ArrayList<OtherName>(otherNames.getOtherNames()));
person.setOtherNames(filteredOtherNames);
}
ResearcherUrls rUrls = researcherUrlManager.getPublicResearcherUrls(orcid);
if (rUrls.getResearcherUrls() != null) {
ResearcherUrls filteredRUrls = new ResearcherUrls();
filteredRUrls.setResearcherUrls(new ArrayList<ResearcherUrl>(rUrls.getResearcherUrls()));
person.setResearcherUrls(filteredRUrls);
}
Emails emails = emailManager.getPublicEmails(orcid);
if (emails.getEmails() != null) {
Emails filteredEmails = new Emails();
filteredEmails.setEmails(new ArrayList<Email>(emails.getEmails()));
person.setEmails(filteredEmails);
}
return person;
}
Aggregations