use of org.orcid.jaxb.model.message.ContactDetails 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.ContactDetails in project ORCID-Source by ORCID.
the class T2OrcidApiServiceVersionedDelegatorTest method testCreateBioWithMultiplePrimaryEmails.
@Test(expected = OrcidValidationException.class)
public void testCreateBioWithMultiplePrimaryEmails() {
setUpSecurityContextForClientOnly();
OrcidMessage orcidMessage = createStubOrcidMessage();
ContactDetails contactDetails = orcidMessage.getOrcidProfile().getOrcidBio().getContactDetails();
List<Email> emailList = new ArrayList<>();
String[] emailStrings = new String[] { "madeupemail@semantico.com", "madeupemail2@semantico.com" };
for (String emailString : emailStrings) {
Email email = new Email(emailString);
email.setPrimary(true);
emailList.add(email);
}
contactDetails.getEmail().addAll(emailList);
t2OrcidApiServiceDelegatorLatest.createProfile(mockedUriInfo, orcidMessage);
}
use of org.orcid.jaxb.model.message.ContactDetails in project ORCID-Source by ORCID.
the class OrcidMessageVersionConverterImplV1_1ToV1_2_rc1 method downgradeProfile.
private void downgradeProfile(OrcidProfile orcidProfile) {
if (orcidProfile != null) {
orcidProfile.setAffiliations(null);
OrcidBio orcidBio = orcidProfile.getOrcidBio();
if (orcidBio != null) {
ContactDetails contactDetails = orcidBio.getContactDetails();
if (contactDetails != null) {
for (Email email : contactDetails.getEmail()) {
email.setSourceClientId(null);
}
}
ExternalIdentifiers extIds = orcidBio.getExternalIdentifiers();
if (extIds != null) {
for (ExternalIdentifier extId : extIds.getExternalIdentifier()) {
extId.setSource(null);
}
}
}
if (orcidProfile.getOrcidActivities() != null) {
if (orcidProfile.getOrcidActivities().getOrcidWorks() != null) {
for (OrcidWork act : orcidProfile.getOrcidActivities().getOrcidWorks().getOrcidWork()) downGradeActivity(act);
}
}
}
}
use of org.orcid.jaxb.model.message.ContactDetails 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.ContactDetails 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