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