From 4af61d51d6eb2a5f8e6c806499ba9b8eb46ca06c Mon Sep 17 00:00:00 2001 From: Steve Jones Date: Wed, 20 Nov 2024 12:00:58 +0100 Subject: [PATCH] (#3014) Improve setting of dataset status --- .../src/uk/ac/exeter/QuinCe/jobs/JobManager.java | 15 +++++++++++++-- .../InternalCalibrationBean.java | 2 +- .../ManualQC/ManualQualityControlBean.java | 2 +- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/WebApp/src/uk/ac/exeter/QuinCe/jobs/JobManager.java b/WebApp/src/uk/ac/exeter/QuinCe/jobs/JobManager.java index 7bcdc74e3..3bb0878db 100644 --- a/WebApp/src/uk/ac/exeter/QuinCe/jobs/JobManager.java +++ b/WebApp/src/uk/ac/exeter/QuinCe/jobs/JobManager.java @@ -22,7 +22,11 @@ import uk.ac.exeter.QuinCe.User.NoSuchUserException; import uk.ac.exeter.QuinCe.User.User; import uk.ac.exeter.QuinCe.User.UserDB; +import uk.ac.exeter.QuinCe.data.Dataset.DataSet; +import uk.ac.exeter.QuinCe.data.Dataset.DataSetDB; +import uk.ac.exeter.QuinCe.data.Dataset.InvalidDataSetStatusException; import uk.ac.exeter.QuinCe.data.Files.DataFileDB; +import uk.ac.exeter.QuinCe.jobs.files.DataSetJob; import uk.ac.exeter.QuinCe.jobs.files.FileJob; import uk.ac.exeter.QuinCe.utils.DatabaseException; import uk.ac.exeter.QuinCe.utils.DatabaseUtils; @@ -194,11 +198,13 @@ public class JobManager { * If the specified job class does not have the correct constructor * @throws JobException * If an unknown problem is found with the specified job class + * @throws InvalidDataSetStatusException */ public static long addJob(DataSource dataSource, User owner, String jobClass, Properties properties) throws DatabaseException, MissingParamException, - NoSuchUserException, JobClassNotFoundException, - InvalidJobClassTypeException, InvalidJobConstructorException, JobException { + RecordNotFoundException, NoSuchUserException, JobClassNotFoundException, + InvalidJobClassTypeException, InvalidJobConstructorException, JobException, + InvalidDataSetStatusException { long result = -1; Connection conn = null; @@ -206,6 +212,11 @@ public static long addJob(DataSource dataSource, User owner, String jobClass, try { conn = dataSource.getConnection(); result = addJob(conn, owner, jobClass, properties); + + if (properties.contains(DataSetJob.ID_PARAM)) { + DataSetDB.setDatasetStatus(conn, + (long) properties.get(DataSetJob.ID_PARAM), DataSet.STATUS_WAITING); + } } catch (SQLException e) { throw new DatabaseException("An error occurred while adding the job", e); } catch (DatabaseException | MissingParamException | NoSuchUserException diff --git a/WebApp/src/uk/ac/exeter/QuinCe/web/datasets/plotPage/InternalCalibration/InternalCalibrationBean.java b/WebApp/src/uk/ac/exeter/QuinCe/web/datasets/plotPage/InternalCalibration/InternalCalibrationBean.java index c9941cc67..74d9356d7 100644 --- a/WebApp/src/uk/ac/exeter/QuinCe/web/datasets/plotPage/InternalCalibration/InternalCalibrationBean.java +++ b/WebApp/src/uk/ac/exeter/QuinCe/web/datasets/plotPage/InternalCalibration/InternalCalibrationBean.java @@ -43,7 +43,7 @@ public PlotPageData getData() { protected void processDirtyData() { try { DataSetDB.setDatasetStatus(getDataSource(), datasetId, - DataSet.STATUS_SENSOR_QC); + DataSet.STATUS_WAITING); Properties jobProperties = new Properties(); jobProperties.setProperty(DataReductionJob.ID_PARAM, String.valueOf(datasetId)); diff --git a/WebApp/src/uk/ac/exeter/QuinCe/web/datasets/plotPage/ManualQC/ManualQualityControlBean.java b/WebApp/src/uk/ac/exeter/QuinCe/web/datasets/plotPage/ManualQC/ManualQualityControlBean.java index 6439b2775..ea7624d4f 100644 --- a/WebApp/src/uk/ac/exeter/QuinCe/web/datasets/plotPage/ManualQC/ManualQualityControlBean.java +++ b/WebApp/src/uk/ac/exeter/QuinCe/web/datasets/plotPage/ManualQC/ManualQualityControlBean.java @@ -51,7 +51,7 @@ public PlotPageData getData() { protected void processDirtyData() { try { DataSetDB.setDatasetStatus(getDataSource(), datasetId, - DataSet.STATUS_SENSOR_QC); + DataSet.STATUS_WAITING); Properties jobProperties = new Properties(); jobProperties.put(DataReductionJob.ID_PARAM, String.valueOf(datasetId)); JobManager.addJob(getDataSource(), getUser(),