Fixes bug on DMP finalize when no Datasets where to be Canceled.

This commit is contained in:
gkolokythas 2019-06-24 17:59:51 +03:00
parent 46042b7403
commit f07384ed42
1 changed files with 16 additions and 12 deletions

View File

@ -437,9 +437,10 @@ public class DataManagementPlanManager {
datasetsToBeCanceled.add(dataset.getId()); datasetsToBeCanceled.add(dataset.getId());
} }
} }
apiContext.getOperationsContext().getDatabaseRepository().getDatasetDao() if (!datasetsToBeCanceled.isEmpty())
.asQueryable().where((builder, root) -> root.get("id").in(datasetsToBeCanceled)) apiContext.getOperationsContext().getDatabaseRepository().getDatasetDao()
.update(root -> root.<Integer>get("status"), Dataset.Status.CANCELED.getValue()); .asQueryable().where((builder, root) -> root.get("id").in(datasetsToBeCanceled))
.update(root -> root.<Integer>get("status"), Dataset.Status.CANCELED.getValue());
} else { } else {
List<UUID> datasetsToBeCanceled = new LinkedList<>(); List<UUID> datasetsToBeCanceled = new LinkedList<>();
for (Dataset dataset : dmp.getDataset()) { for (Dataset dataset : dmp.getDataset()) {
@ -447,9 +448,10 @@ public class DataManagementPlanManager {
datasetsToBeCanceled.add(dataset.getId()); datasetsToBeCanceled.add(dataset.getId());
} }
} }
apiContext.getOperationsContext().getDatabaseRepository().getDatasetDao() if (!datasetsToBeCanceled.isEmpty())
.asQueryable().where((builder, root) -> root.get("id").in(datasetsToBeCanceled)) apiContext.getOperationsContext().getDatabaseRepository().getDatasetDao()
.update(root -> root.<Integer>get("status"), Dataset.Status.CANCELED.getValue()); .asQueryable().where((builder, root) -> root.get("id").in(datasetsToBeCanceled))
.update(root -> root.<Integer>get("status"), Dataset.Status.CANCELED.getValue());
} }
} }
} catch (Exception e) { } catch (Exception e) {
@ -468,9 +470,10 @@ public class DataManagementPlanManager {
datasetsToBeCanceled.add(UUID.fromString(dataset.getId())); datasetsToBeCanceled.add(UUID.fromString(dataset.getId()));
} }
} }
apiContext.getOperationsContext().getDatabaseRepository().getDatasetDao() if (!datasetsToBeCanceled.isEmpty())
.asQueryable().where((builder, root) -> root.get("id").in(datasetsToBeCanceled)) apiContext.getOperationsContext().getDatabaseRepository().getDatasetDao()
.update(root -> root.<Integer>get("status"), Dataset.Status.CANCELED.getValue()); .asQueryable().where((builder, root) -> root.get("id").in(datasetsToBeCanceled))
.update(root -> root.<Integer>get("status"), Dataset.Status.CANCELED.getValue());
} else { } else {
List<UUID> datasetsToBeCanceled = new LinkedList<>(); List<UUID> datasetsToBeCanceled = new LinkedList<>();
for (DatasetListingModel dataset : dataManagementPlan.getDatasets()) { for (DatasetListingModel dataset : dataManagementPlan.getDatasets()) {
@ -478,9 +481,10 @@ public class DataManagementPlanManager {
datasetsToBeCanceled.add(UUID.fromString(dataset.getId())); datasetsToBeCanceled.add(UUID.fromString(dataset.getId()));
} }
} }
apiContext.getOperationsContext().getDatabaseRepository().getDatasetDao() if (!datasetsToBeCanceled.isEmpty())
.asQueryable().where((builder, root) -> root.get("id").in(datasetsToBeCanceled)) apiContext.getOperationsContext().getDatabaseRepository().getDatasetDao()
.update(root -> root.<Integer>get("status"), Dataset.Status.CANCELED.getValue()); .asQueryable().where((builder, root) -> root.get("id").in(datasetsToBeCanceled))
.update(root -> root.<Integer>get("status"), Dataset.Status.CANCELED.getValue());
} }
} }
} }