Search in sources :

Example 21 with PersonalDetails

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

Example 22 with PersonalDetails

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;
}
Also used : Email(org.orcid.jaxb.model.message.Email) Keywords(org.orcid.jaxb.model.message.Keywords) OrcidBio(org.orcid.jaxb.model.message.OrcidBio) Address(org.orcid.jaxb.model.message.Address) ExternalIdReference(org.orcid.jaxb.model.message.ExternalIdReference) Keyword(org.orcid.jaxb.model.message.Keyword) ExternalIdentifier(org.orcid.jaxb.model.message.ExternalIdentifier) FamilyName(org.orcid.jaxb.model.message.FamilyName) OtherNames(org.orcid.jaxb.model.message.OtherNames) ArrayList(java.util.ArrayList) CreditName(org.orcid.jaxb.model.message.CreditName) UrlName(org.orcid.jaxb.model.message.UrlName) PersonalDetails(org.orcid.jaxb.model.message.PersonalDetails) Url(org.orcid.jaxb.model.message.Url) ResearcherUrl(org.orcid.jaxb.model.message.ResearcherUrl) ExternalIdCommonName(org.orcid.jaxb.model.message.ExternalIdCommonName) ContactDetails(org.orcid.jaxb.model.message.ContactDetails) GivenNames(org.orcid.pojo.GivenNames) Biography(org.orcid.jaxb.model.message.Biography) Country(org.orcid.jaxb.model.message.Country) Iso3166Country(org.orcid.jaxb.model.message.Iso3166Country) ResearcherUrls(org.orcid.jaxb.model.message.ResearcherUrls) ResearcherUrl(org.orcid.jaxb.model.message.ResearcherUrl) ExternalIdentifiers(org.orcid.jaxb.model.message.ExternalIdentifiers)

Example 23 with PersonalDetails

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());
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) OrcidBio(org.orcid.jaxb.model.message.OrcidBio) Affiliations(org.orcid.jaxb.model.message.Affiliations) PersonalDetails(org.orcid.jaxb.model.message.PersonalDetails) OrcidActivities(org.orcid.jaxb.model.message.OrcidActivities) Affiliation(org.orcid.jaxb.model.message.Affiliation) Test(org.junit.Test) Rollback(org.springframework.test.annotation.Rollback) Transactional(org.springframework.transaction.annotation.Transactional)

Example 24 with PersonalDetails

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;
}
Also used : Email(org.orcid.jaxb.model.message.Email) OrcidBio(org.orcid.jaxb.model.message.OrcidBio) FamilyName(org.orcid.jaxb.model.message.FamilyName) OrcidWork(org.orcid.jaxb.model.message.OrcidWork) OrcidInternal(org.orcid.jaxb.model.message.OrcidInternal) 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) SecurityQuestionId(org.orcid.jaxb.model.message.SecurityQuestionId) OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) ContactDetails(org.orcid.jaxb.model.message.ContactDetails) 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) SecurityDetails(org.orcid.jaxb.model.message.SecurityDetails) Preferences(org.orcid.jaxb.model.message.Preferences)

Example 25 with PersonalDetails

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

Aggregations

PersonalDetails (org.orcid.jaxb.model.message.PersonalDetails)31 OrcidBio (org.orcid.jaxb.model.message.OrcidBio)28 OrcidProfile (org.orcid.jaxb.model.message.OrcidProfile)23 GivenNames (org.orcid.jaxb.model.message.GivenNames)20 ContactDetails (org.orcid.jaxb.model.message.ContactDetails)17 FamilyName (org.orcid.jaxb.model.message.FamilyName)16 CreditName (org.orcid.jaxb.model.message.CreditName)14 Email (org.orcid.jaxb.model.message.Email)14 ExternalIdentifiers (org.orcid.jaxb.model.message.ExternalIdentifiers)8 OrcidHistory (org.orcid.jaxb.model.message.OrcidHistory)8 OrcidMessage (org.orcid.jaxb.model.message.OrcidMessage)8 OtherNames (org.orcid.jaxb.model.message.OtherNames)8 ResearcherUrls (org.orcid.jaxb.model.message.ResearcherUrls)8 OrcidActivities (org.orcid.jaxb.model.message.OrcidActivities)7 ResearcherUrl (org.orcid.jaxb.model.message.ResearcherUrl)7 Url (org.orcid.jaxb.model.message.Url)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