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(); }
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() }, "_"); }
@Override @Deprecated //now going via orcid-message-listener public void persistProfileInformationForIndexingIfNecessary(OrcidProfile orcidProfile) { String orcid = orcidProfile.getOrcidIdentifier().getPath(); Date lastModifiedFromSolr = solrDao.retrieveLastModified(orcid); Date lastModifiedFromDb = orcidProfile.getOrcidHistory().getLastModifiedDate().getValue().toGregorianCalendar().getTime(); if (lastModifiedFromDb.equals(lastModifiedFromSolr)) { // Check if re-indexing IndexingStatus indexingStatus = profileDao.retrieveIndexingStatus(orcid); if (!IndexingStatus.REINDEX.equals(indexingStatus)) { // If not re-indexing then skip LOG.info("Index is already up to date for orcid: {}", orcid); return; } } persistProfileInformationForIndexing(orcidProfile); }
@Override protected void doInTransactionWithoutResult(TransactionStatus status) { OrcidProfile orcidProfile = orcidProfileManager.retrieveOrcidProfile(orcid); Date originalLastModified = orcidProfile.getOrcidHistory().getLastModifiedDate().getValue().toGregorianCalendar().getTime(); IndexingStatus originalIndexingStatus = profileDao.find(orcid).getIndexingStatus(); // Save it straight back - it will be saved back in the // new DB table automatically orcidProfileManager.updateOrcidProfile(orcidProfile); if (!updateLastModified) { profileDao.updateLastModifiedDateAndIndexingStatusWithoutResult(orcid, originalLastModified, originalIndexingStatus); } } });
@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());