Search in sources :

Example 6 with Affiliations

use of org.orcid.jaxb.model.message.Affiliations in project ORCID-Source by ORCID.

the class OrcidProfileManagerImpl method updateAffiliations.

@Override
@Transactional
public OrcidProfile updateAffiliations(OrcidProfile updatedOrcidProfile) {
    OrcidProfile existingProfile = retrieveOrcidProfile(updatedOrcidProfile.getOrcidIdentifier().getPath());
    if (existingProfile == null) {
        return null;
    }
    OrcidActivities updatedActivities = updatedOrcidProfile.getOrcidActivities();
    if (updatedActivities == null) {
        return null;
    }
    Affiliations updatedAffiliations = updatedActivities.getAffiliations();
    if (updatedAffiliations == null) {
        return null;
    }
    OrcidActivities existingActivities = existingProfile.getOrcidActivities();
    if (existingActivities == null) {
        existingActivities = new OrcidActivities();
        existingProfile.setOrcidActivities(existingActivities);
    }
    Affiliations existingAffiliations = existingActivities.getAffiliations();
    if (existingAffiliations == null) {
        existingAffiliations = new Affiliations();
        existingActivities.setAffiliations(existingAffiliations);
    }
    orcidJaxbCopyManager.copyAffiliationsToExistingPreservingVisibility(existingAffiliations, updatedAffiliations);
    OrcidProfile profileToReturn = updateOrcidProfile(existingProfile, UpdateOptions.AFFILIATIONS_ONLY);
    notificationManager.sendAmendEmail(profileToReturn, AmendedSection.AFFILIATION);
    return profileToReturn;
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) Affiliations(org.orcid.jaxb.model.message.Affiliations) OrcidActivities(org.orcid.jaxb.model.message.OrcidActivities) Transactional(org.springframework.transaction.annotation.Transactional)

Example 7 with Affiliations

use of org.orcid.jaxb.model.message.Affiliations in project ORCID-Source by ORCID.

the class OrcidProfileManagerImpl method setAffiliationPrivacy.

private void setAffiliationPrivacy(OrcidProfile updatedOrcidProfile, Visibility defaultAffiliationVisibility) {
    OrcidHistory orcidHistory = updatedOrcidProfile.getOrcidHistory();
    boolean isClaimed = orcidHistory != null ? orcidHistory.getClaimed().isValue() : false;
    OrcidActivities incomingActivities = updatedOrcidProfile.getOrcidActivities();
    if (incomingActivities != null) {
        Affiliations incomingWorks = incomingActivities.getAffiliations();
        if (incomingWorks != null) {
            setAffiliationPrivacy(incomingWorks, defaultAffiliationVisibility, isClaimed);
        }
    }
}
Also used : Affiliations(org.orcid.jaxb.model.message.Affiliations) OrcidHistory(org.orcid.jaxb.model.message.OrcidHistory) OrcidActivities(org.orcid.jaxb.model.message.OrcidActivities)

Example 8 with Affiliations

use of org.orcid.jaxb.model.message.Affiliations in project ORCID-Source by ORCID.

the class OrcidIndexManagerImplTest method getOrcidProfileMandatoryOnly.

/**
     * According to the validation rules on the web front end, these fields are
     * mandatory. Ultimately they may or may not make it into SOLR due to
     * visibility restrictions
     * 
     * @return OrcidProfile with only mandatory fields populated.
     */
private OrcidProfile getOrcidProfileMandatoryOnly() {
    OrcidProfile orcidProfile = new OrcidProfile();
    orcidProfile.setOrcidIdentifier("5678");
    OrcidBio orcidBio = new OrcidBio();
    orcidProfile.setOrcidBio(orcidBio);
    ContactDetails contactDetails = new ContactDetails();
    contactDetails.addOrReplacePrimaryEmail(new Email("stan@test.com"));
    orcidBio.setContactDetails(contactDetails);
    PersonalDetails personalDetails = new PersonalDetails();
    FamilyName familyName = new FamilyName("Logan");
    familyName.setVisibility(Visibility.PUBLIC);
    personalDetails.setFamilyName(familyName);
    GivenNames givenNames = new GivenNames("Donald Edward");
    givenNames.setVisibility(Visibility.PUBLIC);
    personalDetails.setGivenNames(givenNames);
    orcidBio.setPersonalDetails(personalDetails);
    OrcidActivities orcidActivities = new OrcidActivities();
    orcidProfile.setOrcidActivities(orcidActivities);
    Affiliations affiliations = new Affiliations();
    orcidActivities.setAffiliations(affiliations);
    return orcidProfile;
}
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) Affiliations(org.orcid.jaxb.model.message.Affiliations) GivenNames(org.orcid.jaxb.model.message.GivenNames) PersonalDetails(org.orcid.jaxb.model.message.PersonalDetails) OrcidActivities(org.orcid.jaxb.model.message.OrcidActivities)

Example 9 with Affiliations

use of org.orcid.jaxb.model.message.Affiliations in project ORCID-Source by ORCID.

the class OrcidIndexManagerImplTest method getStandardOrcid.

private OrcidProfile getStandardOrcid() {
    OrcidProfile orcidProfile = new OrcidProfile();
    orcidProfile.setOrcidIdentifier("1234");
    OrcidBio orcidBio = new OrcidBio();
    ContactDetails contactDetails = new ContactDetails();
    Email email = new Email("email");
    email.setVisibility(Visibility.PUBLIC);
    contactDetails.addOrReplacePrimaryEmail(email);
    orcidBio.setContactDetails(contactDetails);
    Keywords bioKeywords = new Keywords();
    bioKeywords.getKeyword().add(new Keyword("Pavement Studies", Visibility.PUBLIC));
    bioKeywords.getKeyword().add(new Keyword("Advanced Tea Making", Visibility.PUBLIC));
    bioKeywords.setVisibility(Visibility.PUBLIC);
    orcidBio.setKeywords(bioKeywords);
    PersonalDetails personalDetails = new PersonalDetails();
    CreditName creditName = new CreditName("credit name");
    creditName.setVisibility(Visibility.PUBLIC);
    personalDetails.setCreditName(creditName);
    FamilyName familyName = new FamilyName("familyName");
    familyName.setVisibility(Visibility.PUBLIC);
    personalDetails.setFamilyName(familyName);
    OtherNames otherNames = new OtherNames();
    otherNames.setVisibility(Visibility.PUBLIC);
    otherNames.getOtherName().add(new OtherName("Other 1", Visibility.PUBLIC));
    otherNames.getOtherName().add(new OtherName("Other 2", Visibility.PUBLIC));
    personalDetails.setOtherNames(otherNames);
    GivenNames givenNames = new GivenNames("givenNames");
    givenNames.setVisibility(Visibility.PUBLIC);
    personalDetails.setGivenNames(givenNames);
    orcidBio.setPersonalDetails(personalDetails);
    ExternalIdentifiers externalIdentifiers = new ExternalIdentifiers();
    externalIdentifiers.setVisibility(Visibility.PUBLIC);
    orcidBio.setExternalIdentifiers(externalIdentifiers);
    ExternalIdentifier externalIdentifier1 = createExternalIdentifier("45678", "defghi");
    externalIdentifiers.getExternalIdentifier().add(externalIdentifier1);
    ExternalIdentifier externalIdentifier2 = createExternalIdentifier("54321", "abc123");
    externalIdentifiers.getExternalIdentifier().add(externalIdentifier2);
    OrcidActivities orcidActivities = new OrcidActivities();
    orcidProfile.setOrcidActivities(orcidActivities);
    Affiliations affiliations = new Affiliations();
    orcidActivities.setAffiliations(affiliations);
    FundingList fundings = new FundingList();
    orcidActivities.setFundings(fundings);
    OrcidWorks orcidWorks = new OrcidWorks();
    OrcidWork orcidWork1 = new OrcidWork();
    orcidWork1.setVisibility(Visibility.PUBLIC);
    OrcidWork orcidWork2 = new OrcidWork();
    orcidWork2.setVisibility(Visibility.PUBLIC);
    OrcidWork orcidWork3 = new OrcidWork();
    orcidWork3.setVisibility(Visibility.LIMITED);
    WorkTitle workTitle1 = new WorkTitle();
    Title title1 = new Title("Work title 1");
    workTitle1.setTitle(title1);
    workTitle1.setSubtitle(null);
    orcidWork1.setWorkTitle(workTitle1);
    WorkExternalIdentifier wei = new WorkExternalIdentifier();
    wei.setWorkExternalIdentifierId(new WorkExternalIdentifierId("work1-pmid"));
    wei.setWorkExternalIdentifierType(WorkExternalIdentifierType.PMID);
    orcidWork1.setWorkExternalIdentifiers(new WorkExternalIdentifiers(Arrays.asList(wei)));
    WorkTitle workTitle2 = new WorkTitle();
    Title title2 = new Title("Work title 2");
    workTitle2.setSubtitle(null);
    workTitle2.setTitle(title2);
    orcidWork2.setWorkTitle(workTitle2);
    WorkTitle workTitle3 = new WorkTitle();
    Title title3 = new Title("Work Title 3");
    workTitle3.setSubtitle(null);
    workTitle3.setTitle(title3);
    orcidWork3.setWorkTitle(workTitle3);
    orcidWorks.setOrcidWork(new ArrayList<OrcidWork>(Arrays.asList(new OrcidWork[] { orcidWork1, orcidWork2, orcidWork3 })));
    orcidProfile.setOrcidWorks(orcidWorks);
    orcidProfile.setOrcidBio(orcidBio);
    return orcidProfile;
}
Also used : Email(org.orcid.jaxb.model.message.Email) Keywords(org.orcid.jaxb.model.message.Keywords) OrcidBio(org.orcid.jaxb.model.message.OrcidBio) FamilyName(org.orcid.jaxb.model.message.FamilyName) OtherNames(org.orcid.jaxb.model.message.OtherNames) OrcidWork(org.orcid.jaxb.model.message.OrcidWork) OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) WorkExternalIdentifiers(org.orcid.jaxb.model.message.WorkExternalIdentifiers) ContactDetails(org.orcid.jaxb.model.message.ContactDetails) GivenNames(org.orcid.jaxb.model.message.GivenNames) WorkExternalIdentifiers(org.orcid.jaxb.model.message.WorkExternalIdentifiers) ExternalIdentifiers(org.orcid.jaxb.model.message.ExternalIdentifiers) Keyword(org.orcid.jaxb.model.message.Keyword) WorkExternalIdentifier(org.orcid.jaxb.model.message.WorkExternalIdentifier) ExternalIdentifier(org.orcid.jaxb.model.message.ExternalIdentifier) CreditName(org.orcid.jaxb.model.message.CreditName) OtherName(org.orcid.jaxb.model.message.OtherName) WorkExternalIdentifierId(org.orcid.jaxb.model.message.WorkExternalIdentifierId) Title(org.orcid.jaxb.model.message.Title) WorkTitle(org.orcid.jaxb.model.message.WorkTitle) FundingTitle(org.orcid.jaxb.model.message.FundingTitle) PersonalDetails(org.orcid.jaxb.model.message.PersonalDetails) OrcidActivities(org.orcid.jaxb.model.message.OrcidActivities) OrcidWorks(org.orcid.jaxb.model.message.OrcidWorks) FundingList(org.orcid.jaxb.model.message.FundingList) Affiliations(org.orcid.jaxb.model.message.Affiliations) WorkTitle(org.orcid.jaxb.model.message.WorkTitle) WorkExternalIdentifier(org.orcid.jaxb.model.message.WorkExternalIdentifier)

Example 10 with Affiliations

use of org.orcid.jaxb.model.message.Affiliations in project ORCID-Source by ORCID.

the class OrcidSearchManagerImplTest method getOrcidProfileAllIndexFieldsPopulated.

private OrcidProfile getOrcidProfileAllIndexFieldsPopulated() {
    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"));
    personalDetails.setCreditName(new CreditName("Stanley Higgins"));
    OtherNames otherNames = new OtherNames();
    otherNames.getOtherName().add(new OtherName("Edward Bass", null));
    otherNames.getOtherName().add(new OtherName("Gareth Dove", null));
    personalDetails.setOtherNames(otherNames);
    orcidBio.setPersonalDetails(personalDetails);
    orcidProfile.setOrcidBio(orcidBio);
    OrcidActivities orcidActivities = new OrcidActivities();
    orcidProfile.setOrcidActivities(orcidActivities);
    Affiliations affiliations = new Affiliations();
    orcidActivities.setAffiliations(affiliations);
    OrcidWorks orcidWorks = new OrcidWorks();
    orcidProfile.setOrcidWorks(orcidWorks);
    OrcidWork orcidWork1 = new OrcidWork();
    OrcidWork orcidWork2 = new OrcidWork();
    assignWorkIdentifers(orcidWork1, orcidWork2);
    orcidWorks.getOrcidWork().add(orcidWork1);
    orcidWorks.getOrcidWork().add(orcidWork2);
    orcidProfile.setOrcidWorks(orcidWorks);
    FundingList orcidFundings = new FundingList();
    orcidProfile.setFundings(orcidFundings);
    Funding funding1 = new Funding();
    funding1.setVisibility(Visibility.PUBLIC);
    FundingTitle title = new FundingTitle();
    title.setTitle(new Title("grant1"));
    funding1.setTitle(title);
    funding1.setDescription("Grant 1 - a short description");
    funding1.setPutCode("grant 1 - put-code");
    Funding funding2 = new Funding();
    funding2.setVisibility(Visibility.PUBLIC);
    FundingTitle title2 = new FundingTitle();
    title2.setTitle(new Title("grant2"));
    funding2.setTitle(title2);
    funding2.setDescription("Grant 2 - a short description");
    funding2.setPutCode("grant 2 - put-code");
    orcidFundings.getFundings().add(funding1);
    orcidFundings.getFundings().add(funding2);
    return orcidProfile;
}
Also used : OrcidBio(org.orcid.jaxb.model.message.OrcidBio) FamilyName(org.orcid.jaxb.model.message.FamilyName) OtherNames(org.orcid.jaxb.model.message.OtherNames) Funding(org.orcid.jaxb.model.message.Funding) CreditName(org.orcid.jaxb.model.message.CreditName) OtherName(org.orcid.jaxb.model.message.OtherName) OrcidWork(org.orcid.jaxb.model.message.OrcidWork) Title(org.orcid.jaxb.model.message.Title) FundingTitle(org.orcid.jaxb.model.message.FundingTitle) PersonalDetails(org.orcid.jaxb.model.message.PersonalDetails) OrcidActivities(org.orcid.jaxb.model.message.OrcidActivities) OrcidWorks(org.orcid.jaxb.model.message.OrcidWorks) OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) FundingList(org.orcid.jaxb.model.message.FundingList) Affiliations(org.orcid.jaxb.model.message.Affiliations) GivenNames(org.orcid.jaxb.model.message.GivenNames) FundingTitle(org.orcid.jaxb.model.message.FundingTitle)

Aggregations

Affiliations (org.orcid.jaxb.model.message.Affiliations)24 OrcidProfile (org.orcid.jaxb.model.message.OrcidProfile)19 OrcidActivities (org.orcid.jaxb.model.message.OrcidActivities)18 Affiliation (org.orcid.jaxb.model.message.Affiliation)16 Test (org.junit.Test)11 Organization (org.orcid.jaxb.model.message.Organization)10 OrcidMessage (org.orcid.jaxb.model.message.OrcidMessage)9 OrganizationAddress (org.orcid.jaxb.model.message.OrganizationAddress)9 DBUnitTest (org.orcid.test.DBUnitTest)8 Transactional (org.springframework.transaction.annotation.Transactional)8 OrcidIdentifier (org.orcid.jaxb.model.message.OrcidIdentifier)7 OrcidBio (org.orcid.jaxb.model.message.OrcidBio)6 Response (javax.ws.rs.core.Response)5 FundingList (org.orcid.jaxb.model.message.FundingList)5 OrcidWorks (org.orcid.jaxb.model.message.OrcidWorks)5 PersonalDetails (org.orcid.jaxb.model.message.PersonalDetails)5 Email (org.orcid.jaxb.model.message.Email)4 FamilyName (org.orcid.jaxb.model.message.FamilyName)4 GivenNames (org.orcid.jaxb.model.message.GivenNames)4 OrcidWork (org.orcid.jaxb.model.message.OrcidWork)4