/** * Create an instance of {@link OrcidHistory } * */ public OrcidHistory createOrcidHistory() { return new OrcidHistory(); }
public boolean isDeactivated() { return orcidHistory != null && orcidHistory.getDeactivationDate() != null && orcidHistory.getDeactivationDate().getValue() != null; }
public Date extractLastModifiedDate() { OrcidHistory orcidHistory = this.getOrcidHistory(); if (orcidHistory == null) return null; LastModifiedDate lastModifiedDate = orcidHistory.getLastModifiedDate(); if (lastModifiedDate == null) return null; return lastModifiedDate.getValue().toGregorianCalendar().getTime(); }
@Override public void copyRelevantUpdatedHistoryElements(OrcidHistory existing, OrcidHistory updated) { Assert.notNull(updated, "The updated history is null"); Assert.notNull(existing, "The existing history is null"); if (updated.isClaimed() && !existing.isClaimed()) { existing.setClaimed(new Claimed(true)); } if (existing.getCompletionDate() == null && updated.getCompletionDate() != null) { existing.setCompletionDate(updated.getCompletionDate()); } // TODO: There may be some others that need to be added to this. }
private void downgradeProfile(OrcidProfile orcidProfile) { if (orcidProfile != null) { if(orcidProfile.getOrcidHistory() !=null && orcidProfile.getOrcidHistory().getCreationMethod() != null) { CreationMethod c = orcidProfile.getOrcidHistory().getCreationMethod(); if (c.equals(CreationMethod.MEMBER_REFERRED) || c.equals(CreationMethod.DIRECT)) orcidProfile.getOrcidHistory().setCreationMethod(CreationMethod.WEBSITE); } orcidProfile.setFundings(null); } }
private OrcidHistory getOrcidHistory(ProfileEntity profileEntity) { OrcidHistory history = new OrcidHistory(); history.setCompletionDate(new CompletionDate(toXMLGregorianCalendar(profileEntity.getCompletedDate()))); history.setClaimed(new Claimed(confirmed)); String creationMethod = profileEntity.getCreationMethod(); history.setCreationMethod(CreationMethod.isValid(creationMethod) ? CreationMethod.fromValue(creationMethod) : CreationMethod.WEBSITE); history.setSource(getSponsor(profileEntity)); history.setSubmissionDate(new SubmissionDate(toXMLGregorianCalendar(profileEntity.getSubmissionDate()))); history.setDeactivationDate(new DeactivationDate(toXMLGregorianCalendar(profileEntity.getDeactivationDate()))); history.setLastModifiedDate(new LastModifiedDate(toXMLGregorianCalendar(profileEntity.getLastModified()))); history.setVerifiedEmail(new VerifiedEmail(verfiedEmail)); history.setVerifiedPrimaryEmail(new VerifiedPrimaryEmail(verfiedPrimaryEmail));
private void setHistoryDetails(ProfileEntity profileEntity, OrcidHistory orcidHistory) { if (orcidHistory != null) { CompletionDate completionDate = orcidHistory.getCompletionDate(); profileEntity.setCompletedDate(completionDate == null ? null : toDate(completionDate.getValue())); SubmissionDate submissionDate = orcidHistory.getSubmissionDate(); profileEntity.setSubmissionDate(submissionDate == null ? null : toDate(submissionDate.getValue())); DeactivationDate deactivationDate = orcidHistory.getDeactivationDate(); profileEntity.setDeactivationDate(deactivationDate == null ? null : toDate(deactivationDate.getValue())); profileEntity.setClaimed(orcidHistory.isClaimed()); CreationMethod creationMethod = orcidHistory.getCreationMethod(); profileEntity.setCreationMethod(creationMethod != null ? creationMethod.value() : null); Source source = orcidHistory.getSource(); if (source != null) { SourceEntity sourceEntity = new SourceEntity(); ClientDetailsEntity clientDetailsEntity = new ClientDetailsEntity(); clientDetailsEntity.setId(source.retrieveSourcePath()); sourceEntity.setSourceClient(clientDetailsEntity); profileEntity.setSource(sourceEntity); } } }
OrcidProfile orcidProfile = new OrcidProfile(); orcidProfile.setOrcidIdentifier(new OrcidIdentifier(jpaJaxbAdapter.getOrcidIdBase(orcid))); OrcidHistory history = new OrcidHistory(); Date recordLastModified = profileDaoReadOnly.retrieveLastModifiedDate(orcid); history.setLastModifiedDate(new LastModifiedDate(DateUtils.convertToXMLGregorianCalendar(recordLastModified))); orcidProfile.setOrcidHistory(history); orcidSearchResult.setOrcidProfile(orcidProfile);
protected OrcidProfile createReservedForClaimOrcidProfile(String orcid, OrcidDeprecated deprecatedInfo, LastModifiedDate lastModifiedDate) { OrcidProfile op = new OrcidProfile(); if (jpaJaxbAdapter != null) { op.setOrcidIdentifier(new OrcidIdentifier(jpaJaxbAdapter.getOrcidIdBase(orcid))); } else { op.setOrcidIdentifier(orcid); } if (deprecatedInfo != null) op.setOrcidDeprecated(deprecatedInfo); OrcidHistory oh = new OrcidHistory(); oh.setClaimed(new Claimed(false)); oh.setLastModifiedDate(lastModifiedDate); op.setOrcidHistory(oh); GivenNames gn = new GivenNames(); PersonalDetails pd = new PersonalDetails(); gn.setContent(localeManager.resolveMessage("orcid.reserved_for_claim")); gn.setVisibility(OrcidVisibilityDefaults.NAMES_DEFAULT.getVisibility()); pd.setGivenNames(gn); OrcidBio ob = new OrcidBio(); ob.setPersonalDetails(pd); op.setOrcidBio(ob); return op; }
private void downgradeProfile(OrcidProfile orcidProfile) { if (orcidProfile != null) { if (orcidProfile.getOrcidHistory() != null) { if (orcidProfile.getOrcidHistory().getVerifiedEmail() != null) { orcidProfile.getOrcidHistory().setVerifiedEmail(null); if (orcidProfile.getOrcidHistory().getVerifiedPrimaryEmail() != null) { orcidProfile.getOrcidHistory().setVerifiedPrimaryEmail(null);
@Override public OrcidProfile retrieveClaimedOrcidProfile(String orcid, LoadOptions loadOptions) { OrcidProfile orcidProfile = retrieveOrcidProfile(orcid, loadOptions); if (orcidProfile != null) { if (Boolean.TRUE.equals(orcidProfile.getOrcidHistory().getClaimed().isValue()) || orcidProfile.isDeactivated() || isBeingAccessedByCreator(orcidProfile) || haveSystemRole() || isOldEnough(orcidProfile)) { return orcidProfile; } else { if (orcidProfile.getOrcidDeprecated() != null && orcidProfile.getOrcidDeprecated().getPrimaryRecord() != null) return createReservedForClaimOrcidProfile(orcid, orcidProfile.getOrcidDeprecated(), orcidProfile.getOrcidHistory().getLastModifiedDate()); else return createReservedForClaimOrcidProfile(orcid, orcidProfile.getOrcidHistory().getLastModifiedDate()); } } return null; }
OrcidHistory orcidHistory = filteredProfile.getOrcidHistory(); if (orcidHistory != null) { LastModifiedDate lastModifiedDate = orcidHistory.getLastModifiedDate(); if (lastModifiedDate != null) { profileIndexDocument.setProfileLastModifiedDate(lastModifiedDate.getValue().toGregorianCalendar().getTime()); SubmissionDate submissionDate = orcidHistory.getSubmissionDate(); if (submissionDate != null) { profileIndexDocument.setProfileSubmissionDate(submissionDate.getValue().toGregorianCalendar().getTime());
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); } } }
protected boolean isBeingAccessedByCreator(OrcidProfile orcidProfile) { String amenderOrcid = sourceManager.retrieveSourceOrcid(); Source source = orcidProfile.getOrcidHistory().getSource(); if (NullUtils.noneNull(amenderOrcid, source)) { return amenderOrcid.equals(source.retrieveSourcePath()); } return false; }
@Deprecated protected boolean isOldEnough(OrcidProfile orcidProfile) { return DateUtils.olderThan(orcidProfile.getOrcidHistory().getSubmissionDate().getValue().toGregorianCalendar().getTime(), claimWaitPeriodDays); }
if (other.orcidHistory != null) return false; } else if (!orcidHistory.equals(other.orcidHistory)) return false; if (orcidInternal == null) {
OrcidProfile orcidProfile = new OrcidProfile(); orcidProfile.setOrcidIdentifier(new OrcidIdentifier(jpaJaxbAdapter.getOrcidIdBase(orcid))); OrcidHistory history = new OrcidHistory(); Date recordLastModified = profileDaoReadOnly.retrieveLastModifiedDate(orcid); history.setLastModifiedDate(new LastModifiedDate(DateUtils.convertToXMLGregorianCalendar(recordLastModified))); orcidProfile.setOrcidHistory(history); orcidSearchResult.setOrcidProfile(orcidProfile);
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); } } }
private String getSponsorOrcid(OrcidMessage orcidMessage) { if (orcidMessage != null && orcidMessage.getOrcidProfile() != null && orcidMessage.getOrcidProfile().getOrcidHistory() != null && orcidMessage.getOrcidProfile().getOrcidHistory().getSource() != null) { return orcidMessage.getOrcidProfile().getOrcidHistory().getSource().retrieveSourcePath(); } else { return null; } }
public static String createCacheKey(OrcidProfile profile) { OrcidHistory orcidHistory = profile.getOrcidHistory(); OrcidIdentifier orcidIdentifier = profile.getOrcidIdentifier(); String xmlFormatLastModifiedDate = (orcidHistory != null && orcidHistory.getLastModifiedDate() != null) ? orcidHistory.getLastModifiedDate().getValue() .toXMLFormat() : "no-last-modified"; String path = orcidIdentifier != null ? orcidIdentifier.getPath() : "no-orcid-identifier"; return StringUtils.join(new String[] {path, xmlFormatLastModifiedDate, profile.getReleaseName() }, "_"); }