use of org.orcid.jaxb.model.message.PersonalDetails in project ORCID-Source by ORCID.
the class T2OrcidApiServiceDelegatorTest method createStubOrcidMessage.
private OrcidMessage createStubOrcidMessage() {
OrcidMessage orcidMessage = new OrcidMessage();
orcidMessage.setMessageVersion("1.2_rc6");
OrcidProfile orcidProfile = new OrcidProfile();
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("Test credit name");
personalDetails.setCreditName(creditName);
creditName.setVisibility(Visibility.LIMITED);
ContactDetails contactDetails = new ContactDetails();
orcidBio.setContactDetails(contactDetails);
return orcidMessage;
}
use of org.orcid.jaxb.model.message.PersonalDetails in project ORCID-Source by ORCID.
the class OrcidIndexManagerTypeMatcherTestFactory method orcidBasicProfileCreate.
public static ArgumentMatcher<OrcidProfile> orcidBasicProfileCreate() {
return new ArgumentMatcher<OrcidProfile>() {
@Override
public boolean matches(OrcidProfile orcidProfile) {
if (!"4444-4444-4444-0001".equals(orcidProfile.getOrcidIdentifier().getPath())) {
return false;
}
PersonalDetails personDetails = orcidProfile.getOrcidBio().getPersonalDetails();
if (personDetails.getCreditName() != null || personDetails.getFamilyName() != null) {
return false;
}
boolean matchesGivenNameCorrectly = "Reserved For Claim".equals(personDetails.getGivenNames().getContent());
return matchesGivenNameCorrectly;
}
};
}
use of org.orcid.jaxb.model.message.PersonalDetails in project ORCID-Source by ORCID.
the class OrcidJaxbCopyManagerTest method testUpdateOtherNamePreservingVisibility.
@Test
public void testUpdateOtherNamePreservingVisibility() throws Exception {
OrcidBio existingOrcidBioProtected = protectedOrcidMessage.getOrcidProfile().getOrcidBio();
OrcidBio updatedOrcidBioPublic = publicOrcidMessage.getOrcidProfile().getOrcidBio();
PersonalDetails existingOrcidPersonalDetails = protectedOrcidMessage.getOrcidProfile().getOrcidBio().getPersonalDetails();
PersonalDetails updatedOrcidPersonalDetails = publicOrcidMessage.getOrcidProfile().getOrcidBio().getPersonalDetails();
OtherNames existingOtherNames = existingOrcidPersonalDetails.getOtherNames();
assertEquals(Visibility.LIMITED, existingOtherNames.getVisibility());
assertTrue(existingOtherNames.getOtherName().size() == 2);
assertEquals("Josiah S Carberry", existingOtherNames.getOtherName().get(0).getContent());
assertEquals("Josiah Carberry", existingOtherNames.getOtherName().get(1).getContent());
// check content and visibility update updates the content
OtherNames updatedOtherNames = new OtherNames();
updatedOtherNames.getOtherName().clear();
updatedOtherNames.addOtherName("Another 1", null);
updatedOtherNames.addOtherName("Another 2", null);
updatedOtherNames.setVisibility(Visibility.PRIVATE);
updatedOrcidPersonalDetails.setOtherNames(updatedOtherNames);
Address existingContactDetailsAddress = existingOrcidBioProtected.getContactDetails().getAddress();
assertEquals(Iso3166Country.US, existingContactDetailsAddress.getCountry().getValue());
existingContactDetailsAddress.getCountry().setVisibility(Visibility.LIMITED);
Address nullVisibilityContactAddress = new Address();
nullVisibilityContactAddress.setCountry(new Country(Iso3166Country.BM));
nullVisibilityContactAddress.getCountry().setVisibility(null);
updatedOrcidBioPublic.getContactDetails().setAddress(nullVisibilityContactAddress);
orcidJaxbCopyManager.copyUpdatedBioToExistingWithVisibility(existingOrcidBioProtected, updatedOrcidBioPublic);
existingOtherNames = existingOrcidPersonalDetails.getOtherNames();
assertTrue(existingOtherNames.getOtherName().size() == 2);
assertEquals("Another 1", existingOtherNames.getOtherName().get(0).getContent());
assertEquals("Another 2", existingOtherNames.getOtherName().get(1).getContent());
assertEquals(Visibility.PRIVATE, existingOtherNames.getVisibility());
// check content and visibility update of null
updatedOtherNames = new OtherNames();
updatedOtherNames.getOtherName().clear();
updatedOtherNames.addOtherName("Yet Another 1", null);
updatedOtherNames.addOtherName("Yet Another 2", null);
updatedOtherNames.setVisibility(null);
updatedOrcidPersonalDetails.setOtherNames(updatedOtherNames);
orcidJaxbCopyManager.copyUpdatedBioToExistingWithVisibility(existingOrcidBioProtected, updatedOrcidBioPublic);
assertEquals(2, existingOrcidBioProtected.getPersonalDetails().getOtherNames().getOtherName().size());
assertEquals("Yet Another 1", existingOrcidBioProtected.getPersonalDetails().getOtherNames().getOtherName().get(0).getContent());
assertEquals("Yet Another 2", existingOrcidBioProtected.getPersonalDetails().getOtherNames().getOtherName().get(1).getContent());
assertEquals(Visibility.PRIVATE, existingOrcidBioProtected.getPersonalDetails().getOtherNames().getVisibility());
existingContactDetailsAddress = existingOrcidBioProtected.getContactDetails().getAddress();
assertEquals(Visibility.LIMITED, existingContactDetailsAddress.getCountry().getVisibility());
assertEquals(Iso3166Country.BM, existingContactDetailsAddress.getCountry().getValue());
}
use of org.orcid.jaxb.model.message.PersonalDetails in project ORCID-Source by ORCID.
the class RegistrationControllerTest method createBasicProfile.
protected OrcidProfile createBasicProfile() {
OrcidProfile profile = new OrcidProfile();
profile.setPassword("password");
profile.setVerificationCode("1234");
profile.setSecurityQuestionAnswer("random answer");
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);
return profile;
}
use of org.orcid.jaxb.model.message.PersonalDetails in project ORCID-Source by ORCID.
the class SourceInActivitiesTest method getMinimalOrcidProfile.
private OrcidProfile getMinimalOrcidProfile() {
OrcidProfile profile = new OrcidProfile();
OrcidBio bio = new OrcidBio();
ContactDetails contactDetails = new ContactDetails();
contactDetails.addOrReplacePrimaryEmail(new org.orcid.jaxb.model.message.Email(System.currentTimeMillis() + "@user.com"));
Preferences preferences = new Preferences();
preferences.setSendChangeNotifications(new SendChangeNotifications(true));
preferences.setSendOrcidNews(new SendOrcidNews(true));
preferences.setSendMemberUpdateRequests(true);
preferences.setSendEmailFrequencyDays("1");
preferences.setActivitiesVisibilityDefault(new ActivitiesVisibilityDefault(Visibility.fromValue("public")));
PersonalDetails personalDetails = new PersonalDetails();
personalDetails.setFamilyName(new FamilyName("First"));
personalDetails.setGivenNames(new GivenNames("Last"));
bio.setContactDetails(contactDetails);
bio.setPersonalDetails(personalDetails);
OrcidInternal internal = new OrcidInternal();
internal.setPreferences(preferences);
profile.setOrcidBio(bio);
profile.setOrcidInternal(internal);
OrcidHistory orcidHistory = new OrcidHistory();
orcidHistory.setClaimed(new Claimed(true));
orcidHistory.setCreationMethod(CreationMethod.fromValue("integration-test"));
profile.setOrcidHistory(orcidHistory);
orcidHistory.setSubmissionDate(new SubmissionDate(DateUtils.convertToXMLGregorianCalendar(new Date())));
profile.setPassword("password1");
return orcidProfileManager.createOrcidProfile(profile, false, false);
}
Aggregations