Search in sources :

Example 1 with PersonalDetails

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;
}
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 PersonalDetails

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;
        }
    };
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) ArgumentMatcher(org.mockito.ArgumentMatcher) PersonalDetails(org.orcid.jaxb.model.message.PersonalDetails)

Example 3 with PersonalDetails

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());
}
Also used : OrcidBio(org.orcid.jaxb.model.message.OrcidBio) Address(org.orcid.jaxb.model.message.Address) OtherNames(org.orcid.jaxb.model.message.OtherNames) Country(org.orcid.jaxb.model.message.Country) Iso3166Country(org.orcid.jaxb.model.message.Iso3166Country) PersonalDetails(org.orcid.jaxb.model.message.PersonalDetails) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 4 with PersonalDetails

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;
}
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 PersonalDetails

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);
}
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

PersonalDetails (org.orcid.jaxb.model.message.PersonalDetails)34 OrcidBio (org.orcid.jaxb.model.message.OrcidBio)31 OrcidProfile (org.orcid.jaxb.model.message.OrcidProfile)26 GivenNames (org.orcid.jaxb.model.message.GivenNames)22 FamilyName (org.orcid.jaxb.model.message.FamilyName)18 ContactDetails (org.orcid.jaxb.model.message.ContactDetails)17 CreditName (org.orcid.jaxb.model.message.CreditName)15 Email (org.orcid.jaxb.model.message.Email)14 OrcidActivities (org.orcid.jaxb.model.message.OrcidActivities)9 ExternalIdentifiers (org.orcid.jaxb.model.message.ExternalIdentifiers)8 OrcidHistory (org.orcid.jaxb.model.message.OrcidHistory)8 OtherNames (org.orcid.jaxb.model.message.OtherNames)8 Affiliations (org.orcid.jaxb.model.message.Affiliations)7 OrcidMessage (org.orcid.jaxb.model.message.OrcidMessage)7 OtherName (org.orcid.jaxb.model.message.OtherName)7 ResearcherUrls (org.orcid.jaxb.model.message.ResearcherUrls)7 Test (org.junit.Test)6 Biography (org.orcid.jaxb.model.message.Biography)6 ExternalIdentifier (org.orcid.jaxb.model.message.ExternalIdentifier)6 Keyword (org.orcid.jaxb.model.message.Keyword)6