Search in sources :

Example 16 with OrcidActivities

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

the class OrcidProfileManagerImpl method updateOrcidWorks.

/**
     * Updates the ORCID works only
     * 
     * @param updatedOrcidProfile
     * @return
     */
@Override
@Transactional
public OrcidProfile updateOrcidWorks(OrcidProfile updatedOrcidProfile) {
    OrcidProfile existingProfile = retrieveOrcidProfile(updatedOrcidProfile.getOrcidIdentifier().getPath());
    if (existingProfile == null) {
        return null;
    }
    OrcidActivities updatedActivities = updatedOrcidProfile.getOrcidActivities();
    if (updatedActivities == null) {
        return null;
    }
    OrcidWorks updatedOrcidWorks = updatedActivities.getOrcidWorks();
    if (updatedOrcidWorks == null) {
        return null;
    }
    OrcidActivities existingActivities = existingProfile.getOrcidActivities();
    if (existingActivities == null) {
        existingActivities = new OrcidActivities();
        existingProfile.setOrcidActivities(existingActivities);
    }
    OrcidWorks existingOrcidWorks = existingActivities.getOrcidWorks();
    if (existingOrcidWorks == null) {
        existingOrcidWorks = new OrcidWorks();
        existingActivities.setOrcidWorks(existingOrcidWorks);
    }
    checkUserCanHoldMoreElement(existingProfile.retrieveOrcidWorks(), updatedOrcidProfile.retrieveOrcidWorks());
    orcidJaxbCopyManager.copyUpdatedWorksPreservingVisbility(existingProfile.retrieveOrcidWorks(), updatedOrcidProfile.retrieveOrcidWorks());
    OrcidProfile profileToReturn = updateOrcidProfile(existingProfile);
    notificationManager.sendAmendEmail(profileToReturn, AmendedSection.WORK);
    return profileToReturn;
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) OrcidActivities(org.orcid.jaxb.model.message.OrcidActivities) OrcidWorks(org.orcid.jaxb.model.message.OrcidWorks) Transactional(org.springframework.transaction.annotation.Transactional)

Example 17 with OrcidActivities

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

the class OrcidProfileManagerImpl method setFundingPrivacy.

private void setFundingPrivacy(OrcidProfile updatedOrcidProfile, Visibility defaultFundingVisibility) {
    OrcidHistory orcidHistory = updatedOrcidProfile.getOrcidHistory();
    boolean isClaimed = orcidHistory != null ? orcidHistory.getClaimed().isValue() : false;
    OrcidActivities incomingActivities = updatedOrcidProfile.getOrcidActivities();
    if (incomingActivities != null) {
        FundingList incomingFundingList = incomingActivities.getFundings();
        if (incomingFundingList != null) {
            setFundingPrivacy(incomingFundingList, defaultFundingVisibility, isClaimed);
        }
    }
}
Also used : FundingList(org.orcid.jaxb.model.message.FundingList) OrcidHistory(org.orcid.jaxb.model.message.OrcidHistory) OrcidActivities(org.orcid.jaxb.model.message.OrcidActivities)

Example 18 with OrcidActivities

use of org.orcid.jaxb.model.message.OrcidActivities 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 19 with OrcidActivities

use of org.orcid.jaxb.model.message.OrcidActivities 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 20 with OrcidActivities

use of org.orcid.jaxb.model.message.OrcidActivities 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)

Aggregations

OrcidActivities (org.orcid.jaxb.model.message.OrcidActivities)37 OrcidProfile (org.orcid.jaxb.model.message.OrcidProfile)28 OrcidMessage (org.orcid.jaxb.model.message.OrcidMessage)20 Affiliations (org.orcid.jaxb.model.message.Affiliations)18 Test (org.junit.Test)16 OrcidIdentifier (org.orcid.jaxb.model.message.OrcidIdentifier)14 OrcidWorks (org.orcid.jaxb.model.message.OrcidWorks)14 DBUnitTest (org.orcid.test.DBUnitTest)13 Affiliation (org.orcid.jaxb.model.message.Affiliation)11 FundingTitle (org.orcid.jaxb.model.message.FundingTitle)11 OrcidWork (org.orcid.jaxb.model.message.OrcidWork)11 Organization (org.orcid.jaxb.model.message.Organization)11 OrganizationAddress (org.orcid.jaxb.model.message.OrganizationAddress)11 Title (org.orcid.jaxb.model.message.Title)11 Transactional (org.springframework.transaction.annotation.Transactional)11 FundingList (org.orcid.jaxb.model.message.FundingList)9 Response (javax.ws.rs.core.Response)8 OrcidBio (org.orcid.jaxb.model.message.OrcidBio)8 WorkExternalIdentifier (org.orcid.jaxb.model.message.WorkExternalIdentifier)8 WorkTitle (org.orcid.jaxb.model.message.WorkTitle)8