Search in sources :

Example 26 with OrcidActivities

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

the class OrcidProfileManagerImpl method dedupeAffiliations.

private void dedupeAffiliations(OrcidProfile orcidProfile) {
    OrcidActivities orcidActivities = orcidProfile.getOrcidActivities();
    if (orcidActivities != null) {
        Affiliations affiliations = orcidActivities.getAffiliations();
        if (affiliations != null) {
            Affiliations dedupedAffiliations = dedupeAffiliations(affiliations);
            orcidActivities.setAffiliations(dedupedAffiliations);
        }
    }
}
Also used : Affiliations(org.orcid.jaxb.model.message.Affiliations) OrcidActivities(org.orcid.jaxb.model.message.OrcidActivities)

Example 27 with OrcidActivities

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

the class OrcidProfileManagerImpl method dedupeFundings.

private void dedupeFundings(OrcidProfile orcidProfile) {
    OrcidActivities orcidActivities = orcidProfile.getOrcidActivities();
    if (orcidActivities != null) {
        FundingList fungins = orcidActivities.getFundings();
        if (fungins != null) {
            FundingList dedupedFundings = dedupeFundings(fungins);
            orcidActivities.setFundings(dedupedFundings);
        }
    }
}
Also used : FundingList(org.orcid.jaxb.model.message.FundingList) OrcidActivities(org.orcid.jaxb.model.message.OrcidActivities)

Example 28 with OrcidActivities

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

the class OrcidProfileManagerImpl method updateFundings.

@Override
@Transactional
public OrcidProfile updateFundings(OrcidProfile updatedOrcidProfile) {
    OrcidProfile existingProfile = retrieveOrcidProfile(updatedOrcidProfile.getOrcidIdentifier().getPath());
    if (existingProfile == null) {
        return null;
    }
    FundingList updatedFundingList = updatedOrcidProfile.retrieveFundings();
    if (updatedFundingList == null) {
        return null;
    } else {
        // Parse the amount in the new funding
        setFundingAmountsWithTheCorrectFormat(updatedOrcidProfile);
        // Update the funding list with the new values
        updatedFundingList = updatedOrcidProfile.retrieveFundings();
    }
    OrcidActivities existingActivities = existingProfile.getOrcidActivities();
    if (existingActivities == null) {
        existingActivities = new OrcidActivities();
        existingProfile.setOrcidActivities(existingActivities);
    }
    FundingList existingFundingList = existingActivities.getFundings();
    if (existingFundingList == null) {
        existingFundingList = new FundingList();
        existingActivities.setFundings(existingFundingList);
    }
    orcidJaxbCopyManager.copyFundingListToExistingPreservingVisibility(existingFundingList, updatedFundingList);
    OrcidProfile profileToReturn = updateOrcidProfile(existingProfile, UpdateOptions.FUNDINGS_ONLY);
    notificationManager.sendAmendEmail(profileToReturn, AmendedSection.FUNDING);
    return profileToReturn;
}
Also used : OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) FundingList(org.orcid.jaxb.model.message.FundingList) OrcidActivities(org.orcid.jaxb.model.message.OrcidActivities) Transactional(org.springframework.transaction.annotation.Transactional)

Example 29 with OrcidActivities

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

the class OrcidProfileManagerImpl method dedupeWorks.

private void dedupeWorks(OrcidProfile orcidProfile) {
    OrcidActivities orcidActivities = orcidProfile.getOrcidActivities();
    if (orcidActivities != null) {
        OrcidWorks orcidWorks = orcidActivities.getOrcidWorks();
        if (orcidWorks != null) {
            OrcidWorks dedupedOrcidWorks = dedupeWorks(orcidWorks);
            orcidActivities.setOrcidWorks(dedupedOrcidWorks);
        }
    }
}
Also used : OrcidActivities(org.orcid.jaxb.model.message.OrcidActivities) OrcidWorks(org.orcid.jaxb.model.message.OrcidWorks)

Example 30 with OrcidActivities

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

the class OrcidMessageUtil method setSourceName.

public void setSourceName(OrcidProfile orcidProfile) {
    if (orcidProfile != null) {
        if (orcidProfile.getOrcidActivities() != null) {
            OrcidActivities orcidActivities = orcidProfile.getOrcidActivities();
            if (orcidActivities.getAffiliations() != null) {
                Affiliations affs = orcidActivities.getAffiliations();
                List<Affiliation> affList = affs.getAffiliation();
                if (affList != null) {
                    for (Affiliation aff : affList) {
                        setSourceName(aff);
                    }
                }
            }
            if (orcidActivities.getFundings() != null) {
                FundingList fundingList = orcidActivities.getFundings();
                List<Funding> fundings = fundingList.getFundings();
                if (fundings != null) {
                    for (Funding funding : fundings) {
                        setSourceName(funding);
                    }
                }
            }
            if (orcidActivities.getOrcidWorks() != null) {
                OrcidWorks orcidWorks = orcidActivities.getOrcidWorks();
                List<OrcidWork> works = orcidWorks.getOrcidWork();
                if (works != null) {
                    for (OrcidWork work : works) {
                        setSourceName(work);
                    }
                }
            }
        }
        if (orcidProfile.getOrcidBio() != null) {
            OrcidBio orcidBio = orcidProfile.getOrcidBio();
            if (orcidBio.getContactDetails() != null) {
                Address address = orcidBio.getContactDetails().getAddress();
                if (address != null) {
                    setSourceName(address);
                }
            }
            if (orcidBio.getExternalIdentifiers() != null) {
                ExternalIdentifiers extIds = orcidBio.getExternalIdentifiers();
                List<ExternalIdentifier> extIdsList = extIds.getExternalIdentifier();
                if (extIdsList != null) {
                    for (ExternalIdentifier extId : extIdsList) {
                        setSourceName(extId);
                    }
                }
            }
            if (orcidBio.getKeywords() != null) {
                Keywords keywords = orcidBio.getKeywords();
                List<Keyword> keywordList = keywords.getKeyword();
                if (keywordList != null) {
                    for (Keyword keyword : keywordList) {
                        setSourceName(keyword);
                    }
                }
            }
            if (orcidBio.getPersonalDetails() != null) {
                OtherNames otherNames = orcidBio.getPersonalDetails().getOtherNames();
                if (otherNames != null) {
                    List<OtherName> otherNameList = otherNames.getOtherName();
                    if (otherNameList != null) {
                        for (OtherName otherName : otherNameList) {
                            setSourceName(otherName);
                        }
                    }
                }
            }
            if (orcidBio.getResearcherUrls() != null) {
                ResearcherUrls rUrls = orcidBio.getResearcherUrls();
                List<ResearcherUrl> rUrlList = rUrls.getResearcherUrl();
                if (rUrlList != null) {
                    for (ResearcherUrl rUrl : rUrlList) {
                        setSourceName(rUrl);
                    }
                }
            }
        }
    }
}
Also used : Keywords(org.orcid.jaxb.model.message.Keywords) OrcidBio(org.orcid.jaxb.model.message.OrcidBio) Address(org.orcid.jaxb.model.message.Address) Keyword(org.orcid.jaxb.model.message.Keyword) Funding(org.orcid.jaxb.model.message.Funding) ExternalIdentifier(org.orcid.jaxb.model.message.ExternalIdentifier) OtherNames(org.orcid.jaxb.model.message.OtherNames) OrcidWork(org.orcid.jaxb.model.message.OrcidWork) OtherName(org.orcid.jaxb.model.message.OtherName) 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) ResearcherUrls(org.orcid.jaxb.model.message.ResearcherUrls) ResearcherUrl(org.orcid.jaxb.model.message.ResearcherUrl) ExternalIdentifiers(org.orcid.jaxb.model.message.ExternalIdentifiers) Affiliation(org.orcid.jaxb.model.message.Affiliation)

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