use of org.orcid.jaxb.model.message.PersonalDetails in project ORCID-Source by ORCID.
the class OrcidSearchManagerImplTest method getOrcidProfile5678MandatoryOnly.
private OrcidProfile getOrcidProfile5678MandatoryOnly() {
OrcidProfile orcidProfile = new OrcidProfile();
orcidProfile.setOrcidIdentifier("5678");
OrcidBio orcidBio = new OrcidBio();
PersonalDetails personalDetails = new PersonalDetails();
personalDetails.setFamilyName(new FamilyName("Logan"));
personalDetails.setGivenNames(new GivenNames("Donald Edward"));
new Affiliation();
orcidBio.setPersonalDetails(personalDetails);
orcidProfile.setOrcidBio(orcidBio);
return orcidProfile;
}
use of org.orcid.jaxb.model.message.PersonalDetails in project ORCID-Source by ORCID.
the class OrcidJaxbCopyManagerTest method getBio.
private OrcidBio getBio(String sufix, Visibility visibility, int max) {
OrcidBio orcidBio = new OrcidBio();
Biography bio = new Biography(sufix + "My Biography", visibility);
orcidBio.setBiography(bio);
ContactDetails contactDetails = new ContactDetails();
Address address = new Address();
Country country = new Country(visibility.equals(Visibility.PRIVATE) ? Iso3166Country.US : Iso3166Country.CR);
country.setVisibility(visibility);
address.setCountry(country);
contactDetails.setAddress(address);
List<Email> emails = new ArrayList<Email>();
for (int i = 0; i < max; i++) {
Email email = new Email();
email.setValue(sufix + "Email" + i);
if (i == 0) {
email.setPrimary(true);
}
email.setVisibility(visibility);
emails.add(email);
}
contactDetails.setEmail(emails);
orcidBio.setContactDetails(contactDetails);
ExternalIdentifiers extIds = new ExternalIdentifiers();
extIds.setVisibility(visibility);
for (int i = 0; i < max; i++) {
ExternalIdentifier extId = new ExternalIdentifier();
extId.setExternalIdCommonName(new ExternalIdCommonName(sufix + "CommonName" + i));
extId.setExternalIdReference(new ExternalIdReference(sufix + "Reference" + i));
extIds.getExternalIdentifier().add(extId);
}
orcidBio.setExternalIdentifiers(extIds);
Keywords keywords = new Keywords();
keywords.setVisibility(visibility);
for (int i = 0; i < max; i++) {
Keyword k = new Keyword();
k.setContent(sufix + "Keyword" + i);
keywords.getKeyword().add(k);
}
orcidBio.setKeywords(keywords);
PersonalDetails personalDetails = new PersonalDetails();
CreditName creditName = new CreditName(sufix + "Credit name");
creditName.setVisibility(visibility);
personalDetails.setCreditName(creditName);
FamilyName familyName = new FamilyName(sufix + "Family");
personalDetails.setFamilyName(familyName);
GivenNames givenNames = new GivenNames();
givenNames.setContent(sufix + "Given");
personalDetails.setGivenNames(givenNames);
OtherNames other = new OtherNames();
other.setVisibility(visibility);
for (int i = 0; i < max; i++) {
other.addOtherName(sufix + "Other" + i, null);
}
personalDetails.setOtherNames(other);
orcidBio.setPersonalDetails(personalDetails);
ResearcherUrls researcherUrls = new ResearcherUrls();
researcherUrls.setVisibility(visibility);
for (int i = 0; i < max; i++) {
ResearcherUrl rUrl = new ResearcherUrl();
rUrl.setUrl(new Url("http://www.rurl.com/" + sufix + "/" + i));
rUrl.setUrlName(new UrlName(sufix + "Url" + i));
researcherUrls.getResearcherUrl().add(rUrl);
}
orcidBio.setResearcherUrls(researcherUrls);
return orcidBio;
}
use of org.orcid.jaxb.model.message.PersonalDetails in project ORCID-Source by ORCID.
the class OrcidProfileManagerImplTest method testAffiliations.
@Test
@Transactional
@Rollback(true)
public void testAffiliations() throws DatatypeConfigurationException {
OrcidProfile profile1 = createBasicProfile();
orcidProfileManager.createOrcidProfile(profile1, false, false);
OrcidProfile profile2 = new OrcidProfile();
profile2.setOrcidIdentifier(TEST_ORCID);
OrcidBio orcidBio = new OrcidBio();
orcidBio.setPersonalDetails(new PersonalDetails());
OrcidActivities orcidActivities = new OrcidActivities();
profile2.setOrcidActivities(orcidActivities);
Affiliations affiliations = new Affiliations();
orcidActivities.setAffiliations(affiliations);
Affiliation affiliation1 = getAffiliation();
Affiliation affiliation2 = getAffiliation();
affiliation2.setType(AffiliationType.EDUCATION);
affiliation2.getOrganization().setName("Past Institution 2");
affiliations.getAffiliation().add(affiliation1);
affiliations.getAffiliation().add(affiliation2);
profile2.setOrcidBio(orcidBio);
orcidProfileManager.addAffiliations(profile2);
OrcidProfile retrievedProfile = orcidProfileManager.retrieveOrcidProfile(TEST_ORCID);
assertNotNull(retrievedProfile);
assertEquals(2, retrievedProfile.getOrcidActivities().getAffiliations().getAffiliation().size());
for (Affiliation affiliation : retrievedProfile.getOrcidActivities().getAffiliations().getAffiliation()) {
assertNotNull(affiliation.getPutCode());
}
// Remove an affiliation
profile2 = createFullOrcidProfile();
affiliations.getAffiliation().clear();
affiliations.getAffiliation().add(affiliation1);
profile2.setOrcidActivities(orcidActivities);
orcidProfileManager.updateOrcidProfile(profile2);
OrcidProfile profile3 = orcidProfileManager.retrieveOrcidProfile(TEST_ORCID);
assertEquals(1, profile3.getOrcidActivities().getAffiliations().getAffiliation().size());
assertEquals(IndexingStatus.PENDING, profileDao.find(TEST_ORCID).getIndexingStatus());
}
use of org.orcid.jaxb.model.message.PersonalDetails in project ORCID-Source by ORCID.
the class OrcidProfileManagerBaseTest method createBasicProfile.
protected OrcidProfile createBasicProfile() {
OrcidProfile profile = new OrcidProfile();
profile.setPassword("password");
profile.setVerificationCode("1234");
profile.setSecurityQuestionAnswer("random answer");
profile.setOrcidIdentifier(TEST_ORCID);
OrcidBio bio = new OrcidBio();
ContactDetails contactDetails = new ContactDetails();
contactDetails.addOrReplacePrimaryEmail(new Email("will@semantico.com"));
bio.setContactDetails(contactDetails);
profile.setOrcidBio(bio);
PersonalDetails personalDetails = new PersonalDetails();
bio.setPersonalDetails(personalDetails);
personalDetails.setGivenNames(new GivenNames("Will"));
personalDetails.setFamilyName(new FamilyName("Simpson"));
bio.setBiography(new Biography("Will is a software developer"));
ResearcherUrls researcherUrls = new ResearcherUrls();
bio.setResearcherUrls(researcherUrls);
researcherUrls.getResearcherUrl().add(new ResearcherUrl(new Url("http://www.wjrs.co.uk"), null));
OrcidWorks orcidWorks = new OrcidWorks();
profile.setOrcidWorks(orcidWorks);
OrcidWork orcidWork = createWork1();
// TODO JB - needs test
// orcidWork.setAddedToProfileDate(new
// AddedToProfileDate(DateUtils.convertToXMLGregorianCalendar("2010-03-04")));
// orcidWork.setAddedToProfileDate(new
// AddedToProfileDate(DateUtils.convertToXMLGregorianCalendar("2010-03-04")));
orcidWorks.getOrcidWork().add(orcidWork);
OrcidInternal orcidInternal = new OrcidInternal();
profile.setOrcidInternal(orcidInternal);
SecurityDetails securityDetails = new SecurityDetails();
securityDetails.setSecurityQuestionId(new SecurityQuestionId(3));
orcidInternal.setSecurityDetails(securityDetails);
Preferences preferences = new Preferences();
orcidInternal.setPreferences(preferences);
return profile;
}
use of org.orcid.jaxb.model.message.PersonalDetails in project ORCID-Source by ORCID.
the class OrcidProfileManagerBaseTest method createFullOrcidProfile.
protected OrcidProfile createFullOrcidProfile() {
OrcidProfile profile2 = new OrcidProfile();
profile2.setPassword("password");
profile2.setVerificationCode("1234");
profile2.setOrcidIdentifier(TEST_ORCID);
OrcidBio bio = new OrcidBio();
ContactDetails contactDetails = new ContactDetails();
contactDetails.addOrReplacePrimaryEmail(new Email("will@orcid.org"));
bio.setContactDetails(contactDetails);
profile2.setOrcidBio(bio);
PersonalDetails personalDetails = new PersonalDetails();
personalDetails.setGivenNames(new GivenNames("William"));
personalDetails.setFamilyName(new FamilyName("Simpson"));
personalDetails.setCreditName(new CreditName("W. J. R. Simpson"));
bio.setPersonalDetails(personalDetails);
ResearcherUrls researcherUrls = new ResearcherUrls();
researcherUrls.getResearcherUrl().add(new ResearcherUrl(new Url("http://www.wjrs.co.uk"), null));
bio.setResearcherUrls(researcherUrls);
Keywords keywords = new Keywords();
bio.setKeywords(keywords);
keywords.getKeyword().add(new Keyword("Java", null));
bio.setBiography(new Biography("Will is a software developer at Semantico"));
return profile2;
}
Aggregations