Search in sources :

Example 1 with ContactDetails

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;
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) OrcidBio(org.orcid.jaxb.model.message.OrcidBio) ContactDetails(org.orcid.jaxb.model.message.ContactDetails) GivenNames(org.orcid.jaxb.model.message.GivenNames) OrcidMessage(org.orcid.jaxb.model.message.OrcidMessage) CreditName(org.orcid.jaxb.model.message.CreditName) PersonalDetails(org.orcid.jaxb.model.message.PersonalDetails)

Example 2 with ContactDetails

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);
}
Also used : Email(org.orcid.jaxb.model.message.Email) ContactDetails(org.orcid.jaxb.model.message.ContactDetails) OrcidMessage(org.orcid.jaxb.model.message.OrcidMessage) ArrayList(java.util.ArrayList) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 3 with ContactDetails

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);
            }
        }
    }
}
Also used : Email(org.orcid.jaxb.model.message.Email) OrcidBio(org.orcid.jaxb.model.message.OrcidBio) ContactDetails(org.orcid.jaxb.model.message.ContactDetails) ExternalIdentifier(org.orcid.jaxb.model.message.ExternalIdentifier) OrcidWork(org.orcid.jaxb.model.message.OrcidWork) ExternalIdentifiers(org.orcid.jaxb.model.message.ExternalIdentifiers)

Example 4 with ContactDetails

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;
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) Email(org.orcid.jaxb.model.message.Email) OrcidBio(org.orcid.jaxb.model.message.OrcidBio) ContactDetails(org.orcid.jaxb.model.message.ContactDetails) FamilyName(org.orcid.jaxb.model.message.FamilyName) GivenNames(org.orcid.jaxb.model.message.GivenNames) Biography(org.orcid.jaxb.model.message.Biography) ResearcherUrls(org.orcid.jaxb.model.message.ResearcherUrls) ResearcherUrl(org.orcid.jaxb.model.message.ResearcherUrl) PersonalDetails(org.orcid.jaxb.model.message.PersonalDetails) Url(org.orcid.jaxb.model.message.Url) ResearcherUrl(org.orcid.jaxb.model.message.ResearcherUrl) OrcidWorks(org.orcid.jaxb.model.message.OrcidWorks)

Example 5 with ContactDetails

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);
}
Also used : SendOrcidNews(org.orcid.jaxb.model.message.SendOrcidNews) OrcidBio(org.orcid.jaxb.model.message.OrcidBio) FamilyName(org.orcid.jaxb.model.message.FamilyName) OrcidInternal(org.orcid.jaxb.model.message.OrcidInternal) PersonalDetails(org.orcid.jaxb.model.message.PersonalDetails) SubmissionDate(org.orcid.jaxb.model.message.SubmissionDate) Claimed(org.orcid.jaxb.model.message.Claimed) Date(java.util.Date) SubmissionDate(org.orcid.jaxb.model.message.SubmissionDate) OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) ContactDetails(org.orcid.jaxb.model.message.ContactDetails) GivenNames(org.orcid.jaxb.model.message.GivenNames) OrcidHistory(org.orcid.jaxb.model.message.OrcidHistory) ActivitiesVisibilityDefault(org.orcid.jaxb.model.message.ActivitiesVisibilityDefault) Preferences(org.orcid.jaxb.model.message.Preferences) SendChangeNotifications(org.orcid.jaxb.model.message.SendChangeNotifications)

Aggregations

ContactDetails (org.orcid.jaxb.model.message.ContactDetails)26 OrcidBio (org.orcid.jaxb.model.message.OrcidBio)23 Email (org.orcid.jaxb.model.message.Email)22 OrcidProfile (org.orcid.jaxb.model.message.OrcidProfile)18 PersonalDetails (org.orcid.jaxb.model.message.PersonalDetails)17 GivenNames (org.orcid.jaxb.model.message.GivenNames)13 FamilyName (org.orcid.jaxb.model.message.FamilyName)12 CreditName (org.orcid.jaxb.model.message.CreditName)8 OrcidMessage (org.orcid.jaxb.model.message.OrcidMessage)8 ArrayList (java.util.ArrayList)7 Biography (org.orcid.jaxb.model.message.Biography)7 ExternalIdentifiers (org.orcid.jaxb.model.message.ExternalIdentifiers)7 OrcidHistory (org.orcid.jaxb.model.message.OrcidHistory)7 ExternalIdentifier (org.orcid.jaxb.model.message.ExternalIdentifier)6 OrcidActivities (org.orcid.jaxb.model.message.OrcidActivities)6 SubmissionDate (org.orcid.jaxb.model.message.SubmissionDate)6 Date (java.util.Date)5 Keyword (org.orcid.jaxb.model.message.Keyword)5 OrcidWork (org.orcid.jaxb.model.message.OrcidWork)5 OtherName (org.orcid.jaxb.model.message.OtherName)5