From 81354906d3fd258135f4daca23ecb1aac8d49623 Mon Sep 17 00:00:00 2001 From: Leonid Andreev Date: Tue, 19 Jul 2022 18:28:53 -0400 Subject: [PATCH] got rid of the seemingly unnecessary method updateLastExportTimeStamp() in the dataset service bean. (#8484) --- .../java/edu/harvard/iq/dataverse/DatasetServiceBean.java | 5 ----- .../iq/dataverse/harvest/server/OAIRecordServiceBean.java | 4 ++-- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/main/java/edu/harvard/iq/dataverse/DatasetServiceBean.java b/src/main/java/edu/harvard/iq/dataverse/DatasetServiceBean.java index b9b54fb6216..ce8420b91e5 100644 --- a/src/main/java/edu/harvard/iq/dataverse/DatasetServiceBean.java +++ b/src/main/java/edu/harvard/iq/dataverse/DatasetServiceBean.java @@ -842,11 +842,6 @@ public String getReminderString(Dataset dataset, boolean canPublishDataset, bool } } - public void updateLastExportTimeStamp(Long datasetId) { - Date now = new Date(); - em.createNativeQuery("UPDATE Dataset SET lastExportTime='"+now.toString()+"' WHERE id="+datasetId).executeUpdate(); - } - public Dataset setNonDatasetFileAsThumbnail(Dataset dataset, InputStream inputStream) { if (dataset == null) { logger.fine("In setNonDatasetFileAsThumbnail but dataset is null! Returning null."); diff --git a/src/main/java/edu/harvard/iq/dataverse/harvest/server/OAIRecordServiceBean.java b/src/main/java/edu/harvard/iq/dataverse/harvest/server/OAIRecordServiceBean.java index 02e7675a776..057903d506a 100644 --- a/src/main/java/edu/harvard/iq/dataverse/harvest/server/OAIRecordServiceBean.java +++ b/src/main/java/edu/harvard/iq/dataverse/harvest/server/OAIRecordServiceBean.java @@ -232,7 +232,7 @@ public void exportAllFormats(Dataset dataset) { ExportService exportServiceInstance = ExportService.getInstance(); logger.log(Level.FINE, "Attempting to run export on dataset {0}", dataset.getGlobalId()); exportServiceInstance.exportAllFormats(dataset); - datasetService.updateLastExportTimeStamp(dataset.getId()); + dataset = datasetService.merge(dataset); } catch (ExportException ee) {logger.fine("Caught export exception while trying to export. (ignoring)");} catch (Exception e) {logger.fine("Caught unknown exception while trying to export (ignoring)");} } @@ -242,7 +242,7 @@ public void exportAllFormatsInNewTransaction(Dataset dataset) throws ExportExcep try { ExportService exportServiceInstance = ExportService.getInstance(); exportServiceInstance.exportAllFormats(dataset); - datasetService.updateLastExportTimeStamp(dataset.getId()); + dataset = datasetService.merge(dataset); } catch (Exception e) { logger.fine("Caught unknown exception while trying to export"); throw new ExportException(e.getMessage());