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(),