private void downgradeProfile(OrcidProfile orcidProfile) { if (orcidProfile != null) { if (orcidProfile.getOrcidInternal() != null) { // earlier versions of the XSD don;t have GroupOrcidIdentifier if (orcidProfile.getOrcidInternal().getGroupOrcidIdentifier() != null) { orcidProfile.getOrcidInternal().setGroupOrcidIdentifier(null); } } } }
private void upgradeProfile(OrcidProfile orcidProfile) { if (orcidProfile != null) { if (orcidProfile.getOrcidInternal() != null) { if (orcidProfile.getOrcidInternal().getPreferences() != null) { Preferences prefs = orcidProfile.getOrcidInternal().getPreferences(); if (prefs.getWorkVisibilityDefault() != null && prefs.getWorkVisibilityDefault().getValue() != null) { prefs.setActivitiesVisibilityDefault(new ActivitiesVisibilityDefault(prefs.getWorkVisibilityDefault().getValue())); prefs.setWorkVisibilityDefault(null); } if(prefs.getDeveloperToolsEnabled() == null) { DeveloperToolsEnabled dtn = new DeveloperToolsEnabled(false); prefs.setDeveloperToolsEnabled(dtn); } } } } }
private SecurityDetails initSecurityDetails(OrcidProfile cachedProfile) { OrcidInternal internal = cachedProfile.getOrcidInternal(); if (internal == null) { internal = new OrcidInternal(); cachedProfile.setOrcidInternal(internal); } SecurityDetails securityDetails = internal.getSecurityDetails(); if (securityDetails == null) { securityDetails = new SecurityDetails(); internal.setSecurityDetails(securityDetails); } return securityDetails; }
private void upgradeProfile(OrcidProfile orcidProfile) { if (orcidProfile != null) { if (orcidProfile.getOrcidBio() != null) if (orcidProfile.getOrcidBio().getExternalIdentifiers() != null) for (ExternalIdentifier externalIdentifier: orcidProfile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier()) { externalIdentifier.setExternalIdSource(externalIdentifier.getExternalIdOrcid()); externalIdentifier.setExternalIdOrcid(null); } if(orcidProfile.getOrcidInternal() != null) orcidProfile.getOrcidInternal().setSalesforceId(new SalesforceId()); } }
if (orcidProfile.getOrcidInternal() != null) { if (orcidProfile.getOrcidInternal().getReferredBy() != null) { orcidProfile.getOrcidInternal().setReferredBy(null); if(orcidProfile.getOrcidInternal().getPreferences() != null && orcidProfile.getOrcidInternal().getPreferences().getDeveloperToolsEnabled() != null) { orcidProfile.getOrcidInternal().getPreferences().setDeveloperToolsEnabled(null); if (orcidProfile.getOrcidInternal() != null) { if (orcidProfile.getOrcidInternal().getPreferences() != null) { Preferences prefs = orcidProfile.getOrcidInternal().getPreferences(); if (prefs.getActivitiesVisibilityDefault() != null && prefs.getActivitiesVisibilityDefault().getValue() != null) { prefs.setWorkVisibilityDefault(new WorkVisibilityDefault(prefs.getActivitiesVisibilityDefault().getValue()));
if (orcidProfile.getOrcidInternal() != null && orcidProfile.getOrcidInternal().getPreferences() != null && orcidProfile.getOrcidInternal().getPreferences().getActivitiesVisibilityDefault() != null) { defaultVisibility = orcidProfile.getOrcidInternal().getPreferences().getActivitiesVisibilityDefault().getValue();
if (orcidProfile.getOrcidInternal() != null && orcidProfile.getOrcidInternal().getPreferences() != null && orcidProfile.getOrcidInternal().getPreferences().getActivitiesVisibilityDefault() != null) { defaultVisibility = orcidProfile.getOrcidInternal().getPreferences().getActivitiesVisibilityDefault().getValue();
@Override public void updateSecurityQuestionInformation(OrcidProfile updatedOrcidProfile) { String orcid = updatedOrcidProfile.getOrcidIdentifier().getPath(); SecurityQuestionId securityQuestionId = updatedOrcidProfile.getOrcidInternal().getSecurityDetails().getSecurityQuestionId(); Integer questionId = null; if (securityQuestionId != null) { questionId = new Long(securityQuestionId.getValue()).intValue(); } String unencryptedAnswer = updatedOrcidProfile.getSecurityQuestionAnswer(); String encryptedAnswer = encrypt(unencryptedAnswer); profileDao.updateSecurityQuestion(orcid, questionId, questionId != null ? encryptedAnswer : null); OrcidProfile cachedProfile = orcidProfileCacheManager.retrieve(orcid); if (cachedProfile != null) { profileDao.flush(); SecurityDetails securityDetails = initSecurityDetails(cachedProfile); securityDetails.setSecurityQuestionId(questionId != null ? new SecurityQuestionId(questionId) : null); securityDetails.setEncryptedSecurityAnswer(encryptedAnswer != null ? new EncryptedSecurityAnswer(encryptedAnswer) : null); cachedProfile.setSecurityQuestionAnswer(encryptedAnswer != null ? unencryptedAnswer : null); orcidProfileCacheManager.put(cachedProfile); } }
Visibility workVisibilityDefault = existingProfile.getOrcidInternal().getPreferences().getActivitiesVisibilityDefault().getValue(); Boolean claimed = existingProfile.getOrcidHistory().isClaimed(); setFundingPrivacy(updatedFundingList, workVisibilityDefault, claimed == null ? false : claimed); persistAddedFundings(orcid, updatedList); profileDao.flush(); boolean notificationsEnabled = existingProfile.getOrcidInternal().getPreferences().getNotificationsEnabled(); if (notificationsEnabled) { notificationManager.sendAmendEmail(orcid, AmendedSection.FUNDING, null);
Visibility workVisibilityDefault = existingProfile.getOrcidInternal().getPreferences().getActivitiesVisibilityDefault().getValue(); Boolean claimed = existingProfile.getOrcidHistory().isClaimed(); setAffiliationPrivacy(updatedAffiliations, workVisibilityDefault, claimed == null ? false : claimed); persistAddedAffiliations(orcid, updatedAffiliationsList); profileDao.flush(); boolean notificationsEnabled = existingProfile.getOrcidInternal().getPreferences().getNotificationsEnabled(); if (notificationsEnabled) { notificationManager.sendAmendEmail(orcid, AmendedSection.AFFILIATION, null);
Visibility workVisibilityDefault = existingProfile.getOrcidInternal().getPreferences().getActivitiesVisibilityDefault().getValue(); Boolean claimed = existingProfile.getOrcidHistory().isClaimed(); setWorkPrivacy(updatedOrcidWorks, workVisibilityDefault, claimed == null ? false : claimed); boolean notificationsEnabled = existingProfile.getOrcidInternal().getPreferences().getNotificationsEnabled(); if (notificationsEnabled && updatedOrcidWorksList != null) { List<Item> activities = new ArrayList<>();
private void downgradeProfile(OrcidProfile orcidProfile) { if (orcidProfile != null) { if (orcidProfile.getOrcidBio() != null) if (orcidProfile.getOrcidBio().getExternalIdentifiers() != null) for (ExternalIdentifier externalIdentifier : orcidProfile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier()) { externalIdentifier.setExternalIdOrcid(externalIdentifier.getExternalIdSource()); externalIdentifier.setExternalIdSource(null); } if (orcidProfile.getOrcidActivities() != null) { if (orcidProfile.getOrcidActivities().getAffiliations() != null) for (Activity act : orcidProfile.getOrcidActivities().getAffiliations().getAffiliation()) downGradeActivity(act); if (orcidProfile.getOrcidActivities().getFundings() != null) for (Activity act : orcidProfile.getOrcidActivities().getFundings().getFundings()) downGradeActivity(act); if (orcidProfile.getOrcidActivities().getOrcidWorks() != null) for (Activity act : orcidProfile.getOrcidActivities().getOrcidWorks().getOrcidWork()) downGradeActivity(act); } if(orcidProfile.getOrcidInternal() != null) { orcidProfile.getOrcidInternal().setSalesforceId(null); } } }
@Override public ProfileEntity toProfileEntity(OrcidProfile profile, ProfileEntity existingProfileEntity, UpdateOptions updateOptions) { Assert.notNull(profile, "Cannot convert a null OrcidProfile"); ProfileEntity profileEntity = existingProfileEntity == null ? new ProfileEntity() : existingProfileEntity; // if orcid-id exist us it String orcidString = profile.getOrcidIdentifier().getPath(); if (profile.retrieveOrcidUriAsString() != null && !profile.retrieveOrcidUriAsString().isEmpty()) { orcidString = OrcidStringUtils.getOrcidNumber(profile.retrieveOrcidUriAsString()); } profileEntity.setId(orcidString); profileEntity.setOrcidType(profile.getType().name()); profileEntity.setGroupType(profile.getGroupType() != null ? profile.getGroupType().name() : null); setBioDetails(profileEntity, profile.getOrcidBio()); setHistoryDetails(profileEntity, profile.getOrcidHistory()); setActivityDetails(profileEntity, profile.getOrcidActivities(), updateOptions); setInternalDetails(profileEntity, profile.getOrcidInternal()); setPreferencesDetails(profileEntity, profile.getOrcidPreferences()); profileEntity.setUserLastIp(profile.getUserLastIp()); profileEntity.setReviewed(profile.isReviewed()); if(profileEntity.getUsedRecaptchaOnRegistration() == null) { profileEntity.setUsedRecaptchaOnRegistration(false); } return profileEntity; }
OrcidInternal orcidInternal = orcidProfile.getOrcidInternal(); if (orcidInternal != null) { Preferences prefs = orcidInternal.getPreferences();