use of org.orcid.jaxb.model.message.OtherNames in project ORCID-Source by ORCID.
the class OrcidProfileManagerImplTest method setBio.
private void setBio(OrcidProfile profile, Visibility defaultVisibility) {
OrcidBio bio = new OrcidBio();
Biography biography = new Biography("This is my biography");
if (defaultVisibility != null) {
biography.setVisibility(defaultVisibility);
}
bio.setBiography(biography);
ContactDetails contactDetails = new ContactDetails();
Address address = new Address();
address.setCountry(new Country(Iso3166Country.US));
if (defaultVisibility != null) {
address.getCountry().setVisibility(defaultVisibility);
}
contactDetails.setAddress(address);
List<Email> emails = new ArrayList<Email>();
Email email = new Email();
email.setPrimary(true);
email.setValue(System.currentTimeMillis() + "@test.orcid.org");
emails.add(email);
contactDetails.setEmail(emails);
bio.setContactDetails(contactDetails);
ExternalIdentifiers extIds = new ExternalIdentifiers();
ExternalIdentifier extId = new ExternalIdentifier();
extId.setExternalIdCommonName(new ExternalIdCommonName("common-name"));
extId.setExternalIdReference(new ExternalIdReference("ext-id-reference"));
extId.setExternalIdUrl(new ExternalIdUrl("http://orcid.org/ext-id"));
extIds.getExternalIdentifier().add(extId);
if (defaultVisibility != null) {
extIds.setVisibility(defaultVisibility);
}
bio.setExternalIdentifiers(extIds);
Keywords keywords = new Keywords();
Keyword keyword = new Keyword();
keyword.setContent("k1");
keywords.getKeyword().add(keyword);
if (defaultVisibility != null) {
keywords.setVisibility(defaultVisibility);
}
bio.setKeywords(keywords);
PersonalDetails personalDetails = new PersonalDetails();
personalDetails.setCreditName(new CreditName("credit-name"));
personalDetails.setGivenNames(new GivenNames("given-names"));
personalDetails.setFamilyName(new FamilyName("family-name"));
OtherNames otherNames = new OtherNames();
OtherName otherName = new OtherName();
otherName.setContent("o1");
otherNames.getOtherName().add(otherName);
if (defaultVisibility != null) {
otherNames.setVisibility(defaultVisibility);
}
personalDetails.setOtherNames(otherNames);
bio.setPersonalDetails(personalDetails);
ResearcherUrls researcherUrls = new ResearcherUrls();
ResearcherUrl researcherUrl = new ResearcherUrl();
researcherUrl.setUrl(new Url("http://orcid.org/researcher-url-1"));
researcherUrl.setUrlName(new UrlName("url-name-1"));
researcherUrls.getResearcherUrl().add(researcherUrl);
if (defaultVisibility != null) {
researcherUrls.setVisibility(defaultVisibility);
}
bio.setResearcherUrls(researcherUrls);
profile.setOrcidBio(bio);
}
use of org.orcid.jaxb.model.message.OtherNames in project ORCID-Source by ORCID.
the class OrcidIndexManagerImplTest method getStandardOrcid.
private OrcidProfile getStandardOrcid() {
OrcidProfile orcidProfile = new OrcidProfile();
orcidProfile.setOrcidIdentifier("1234");
OrcidBio orcidBio = new OrcidBio();
ContactDetails contactDetails = new ContactDetails();
Email email = new Email("email");
email.setVisibility(Visibility.PUBLIC);
contactDetails.addOrReplacePrimaryEmail(email);
orcidBio.setContactDetails(contactDetails);
Keywords bioKeywords = new Keywords();
bioKeywords.getKeyword().add(new Keyword("Pavement Studies", Visibility.PUBLIC));
bioKeywords.getKeyword().add(new Keyword("Advanced Tea Making", Visibility.PUBLIC));
bioKeywords.setVisibility(Visibility.PUBLIC);
orcidBio.setKeywords(bioKeywords);
PersonalDetails personalDetails = new PersonalDetails();
CreditName creditName = new CreditName("credit name");
creditName.setVisibility(Visibility.PUBLIC);
personalDetails.setCreditName(creditName);
FamilyName familyName = new FamilyName("familyName");
familyName.setVisibility(Visibility.PUBLIC);
personalDetails.setFamilyName(familyName);
OtherNames otherNames = new OtherNames();
otherNames.setVisibility(Visibility.PUBLIC);
otherNames.getOtherName().add(new OtherName("Other 1", Visibility.PUBLIC));
otherNames.getOtherName().add(new OtherName("Other 2", Visibility.PUBLIC));
personalDetails.setOtherNames(otherNames);
GivenNames givenNames = new GivenNames("givenNames");
givenNames.setVisibility(Visibility.PUBLIC);
personalDetails.setGivenNames(givenNames);
orcidBio.setPersonalDetails(personalDetails);
ExternalIdentifiers externalIdentifiers = new ExternalIdentifiers();
externalIdentifiers.setVisibility(Visibility.PUBLIC);
orcidBio.setExternalIdentifiers(externalIdentifiers);
ExternalIdentifier externalIdentifier1 = createExternalIdentifier("45678", "defghi");
externalIdentifiers.getExternalIdentifier().add(externalIdentifier1);
ExternalIdentifier externalIdentifier2 = createExternalIdentifier("54321", "abc123");
externalIdentifiers.getExternalIdentifier().add(externalIdentifier2);
OrcidActivities orcidActivities = new OrcidActivities();
orcidProfile.setOrcidActivities(orcidActivities);
Affiliations affiliations = new Affiliations();
orcidActivities.setAffiliations(affiliations);
FundingList fundings = new FundingList();
orcidActivities.setFundings(fundings);
OrcidWorks orcidWorks = new OrcidWorks();
OrcidWork orcidWork1 = new OrcidWork();
orcidWork1.setVisibility(Visibility.PUBLIC);
OrcidWork orcidWork2 = new OrcidWork();
orcidWork2.setVisibility(Visibility.PUBLIC);
OrcidWork orcidWork3 = new OrcidWork();
orcidWork3.setVisibility(Visibility.LIMITED);
WorkTitle workTitle1 = new WorkTitle();
Title title1 = new Title("Work title 1");
workTitle1.setTitle(title1);
workTitle1.setSubtitle(null);
orcidWork1.setWorkTitle(workTitle1);
WorkExternalIdentifier wei = new WorkExternalIdentifier();
wei.setWorkExternalIdentifierId(new WorkExternalIdentifierId("work1-pmid"));
wei.setWorkExternalIdentifierType(WorkExternalIdentifierType.PMID);
orcidWork1.setWorkExternalIdentifiers(new WorkExternalIdentifiers(Arrays.asList(wei)));
WorkTitle workTitle2 = new WorkTitle();
Title title2 = new Title("Work title 2");
workTitle2.setSubtitle(null);
workTitle2.setTitle(title2);
orcidWork2.setWorkTitle(workTitle2);
WorkTitle workTitle3 = new WorkTitle();
Title title3 = new Title("Work Title 3");
workTitle3.setSubtitle(null);
workTitle3.setTitle(title3);
orcidWork3.setWorkTitle(workTitle3);
orcidWorks.setOrcidWork(new ArrayList<OrcidWork>(Arrays.asList(new OrcidWork[] { orcidWork1, orcidWork2, orcidWork3 })));
orcidProfile.setOrcidWorks(orcidWorks);
orcidProfile.setOrcidBio(orcidBio);
return orcidProfile;
}
use of org.orcid.jaxb.model.message.OtherNames in project ORCID-Source by ORCID.
the class T2OrcidApiServiceDelegatorTest method testDefaultPrivacyOnBio.
@Test
public void testDefaultPrivacyOnBio() {
SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4499", ScopePathType.ORCID_BIO_UPDATE);
OrcidMessage orcidMessage = new OrcidMessage();
orcidMessage.setMessageVersion("1.2_rc6");
OrcidProfile orcidProfile = new OrcidProfile();
orcidProfile.setOrcidIdentifier(new OrcidIdentifier("4444-4444-4444-4499"));
orcidMessage.setOrcidProfile(orcidProfile);
OrcidBio orcidBio = new OrcidBio();
orcidProfile.setOrcidBio(orcidBio);
PersonalDetails personalDetails = new PersonalDetails();
orcidBio.setPersonalDetails(personalDetails);
GivenNames givenNames = new GivenNames("Test given names");
personalDetails.setGivenNames(givenNames);
CreditName creditName = new CreditName("Credit Name");
personalDetails.setCreditName(creditName);
ExternalIdentifier id = new ExternalIdentifier();
id.setExternalIdCommonName(new ExternalIdCommonName("cn1"));
id.setExternalIdReference(new ExternalIdReference("value1"));
orcidBio.setExternalIdentifiers(new ExternalIdentifiers());
orcidBio.getExternalIdentifiers().getExternalIdentifier().add(id);
personalDetails.setOtherNames(new OtherNames());
personalDetails.getOtherNames().addOtherName("on1", null);
orcidBio.setKeywords(new Keywords());
orcidBio.getKeywords().getKeyword().add(new Keyword("kw1", null));
orcidBio.setResearcherUrls(new ResearcherUrls());
orcidBio.getResearcherUrls().getResearcherUrl().add(new ResearcherUrl(new Url("http://rurl2.com"), null));
t2OrcidApiServiceDelegator.updateBioDetails(mockedUriInfo, "4444-4444-4444-4499", orcidMessage);
OrcidProfile p = orcidProfileManager.retrieveOrcidProfile("4444-4444-4444-4499");
assertEquals("cn1", p.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().get(0).getExternalIdCommonName().getContent());
assertEquals(Visibility.PUBLIC, p.getOrcidBio().getExternalIdentifiers().getVisibility());
assertEquals("on1", p.getOrcidBio().getPersonalDetails().getOtherNames().getOtherName().get(0).getContent());
assertEquals(Visibility.PUBLIC, p.getOrcidBio().getPersonalDetails().getOtherNames().getVisibility());
assertEquals("kw1", p.getOrcidBio().getKeywords().getKeyword().get(0).getContent());
assertEquals(Visibility.PUBLIC, p.getOrcidBio().getKeywords().getVisibility());
assertEquals(new Url("http://rurl2.com"), p.getOrcidBio().getResearcherUrls().getResearcherUrl().get(0).getUrl());
assertEquals(Visibility.PUBLIC, p.getOrcidBio().getResearcherUrls().getVisibility());
//now test what happens if we add a new one.
}
use of org.orcid.jaxb.model.message.OtherNames in project ORCID-Source by ORCID.
the class OrcidMessageUtil method setSourceName.
public void setSourceName(OrcidProfile orcidProfile) {
if (orcidProfile != null) {
if (orcidProfile.getOrcidActivities() != null) {
OrcidActivities orcidActivities = orcidProfile.getOrcidActivities();
if (orcidActivities.getAffiliations() != null) {
Affiliations affs = orcidActivities.getAffiliations();
List<Affiliation> affList = affs.getAffiliation();
if (affList != null) {
for (Affiliation aff : affList) {
setSourceName(aff);
}
}
}
if (orcidActivities.getFundings() != null) {
FundingList fundingList = orcidActivities.getFundings();
List<Funding> fundings = fundingList.getFundings();
if (fundings != null) {
for (Funding funding : fundings) {
setSourceName(funding);
}
}
}
if (orcidActivities.getOrcidWorks() != null) {
OrcidWorks orcidWorks = orcidActivities.getOrcidWorks();
List<OrcidWork> works = orcidWorks.getOrcidWork();
if (works != null) {
for (OrcidWork work : works) {
setSourceName(work);
}
}
}
}
if (orcidProfile.getOrcidBio() != null) {
OrcidBio orcidBio = orcidProfile.getOrcidBio();
if (orcidBio.getContactDetails() != null) {
Address address = orcidBio.getContactDetails().getAddress();
if (address != null) {
setSourceName(address);
}
}
if (orcidBio.getExternalIdentifiers() != null) {
ExternalIdentifiers extIds = orcidBio.getExternalIdentifiers();
List<ExternalIdentifier> extIdsList = extIds.getExternalIdentifier();
if (extIdsList != null) {
for (ExternalIdentifier extId : extIdsList) {
setSourceName(extId);
}
}
}
if (orcidBio.getKeywords() != null) {
Keywords keywords = orcidBio.getKeywords();
List<Keyword> keywordList = keywords.getKeyword();
if (keywordList != null) {
for (Keyword keyword : keywordList) {
setSourceName(keyword);
}
}
}
if (orcidBio.getPersonalDetails() != null) {
OtherNames otherNames = orcidBio.getPersonalDetails().getOtherNames();
if (otherNames != null) {
List<OtherName> otherNameList = otherNames.getOtherName();
if (otherNameList != null) {
for (OtherName otherName : otherNameList) {
setSourceName(otherName);
}
}
}
}
if (orcidBio.getResearcherUrls() != null) {
ResearcherUrls rUrls = orcidBio.getResearcherUrls();
List<ResearcherUrl> rUrlList = rUrls.getResearcherUrl();
if (rUrlList != null) {
for (ResearcherUrl rUrl : rUrlList) {
setSourceName(rUrl);
}
}
}
}
}
}
use of org.orcid.jaxb.model.message.OtherNames in project ORCID-Source by ORCID.
the class RDFWriterTest method fakeBio.
private OrcidMessage fakeBio() throws DatatypeConfigurationException {
OrcidMessage orcidMessage = new OrcidMessage();
OrcidProfile orcidProfile1 = new OrcidProfile();
OrcidIdentifier orcidIdentifier = new OrcidIdentifier();
orcidProfile1.setOrcidIdentifier(orcidIdentifier);
orcidIdentifier.setUri("http://orcid.example.com/000-1337");
orcidIdentifier.setPath("000-1337");
OrcidBio bio = new OrcidBio();
orcidProfile1.setOrcidBio(bio);
OrcidHistory history = new OrcidHistory();
XMLGregorianCalendar value = dataTypeFactory.newXMLGregorianCalendar(1980, 12, 31, 23, 29, 29, 999, 0);
history.setCreationMethod(CreationMethod.WEBSITE);
history.setLastModifiedDate(new LastModifiedDate(value));
orcidProfile1.setOrcidHistory(history);
PersonalDetails personal = new PersonalDetails();
bio.setPersonalDetails(personal);
personal.setFamilyName(new FamilyName("Doe"));
personal.setCreditName(new CreditName("John F Doe"));
personal.setGivenNames(new GivenNames("John"));
personal.setOtherNames(new OtherNames());
personal.getOtherNames().addOtherName("Johnny", Visibility.PUBLIC);
personal.getOtherNames().addOtherName("Mr Doe", Visibility.PUBLIC);
ResearcherUrls urls = new ResearcherUrls();
bio.setResearcherUrls(urls);
ResearcherUrl anonymous = new ResearcherUrl(new Url("http://example.com/anon"), Visibility.PUBLIC);
urls.getResearcherUrl().add(anonymous);
// "home page" - with strange casing
ResearcherUrl homePage = new ResearcherUrl(new Url("http://example.com/myPage"), new UrlName("homePage"), Visibility.PUBLIC);
urls.getResearcherUrl().add(homePage);
ResearcherUrl foaf = new ResearcherUrl(new Url("http://example.com/foaf#me"), new UrlName("FOAF"), Visibility.PUBLIC);
urls.getResearcherUrl().add(foaf);
ResearcherUrl webId = new ResearcherUrl(new Url("http://example.com/webId"), new UrlName("webID"), Visibility.PUBLIC);
urls.getResearcherUrl().add(webId);
ResearcherUrl other = new ResearcherUrl(new Url("http://example.com/other"), new UrlName("other"), Visibility.PUBLIC);
urls.getResearcherUrl().add(other);
bio.setContactDetails(new ContactDetails());
bio.getContactDetails().setEmail(Arrays.asList(new Email("john@example.org"), new Email("doe@example.com")));
bio.getContactDetails().setAddress(new Address());
bio.getContactDetails().getAddress().setCountry(new Country(Iso3166Country.GB));
orcidMessage.setOrcidProfile(orcidProfile1);
return orcidMessage;
}
Aggregations