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