Enhanced the behaviour of finalising DMP's with Dataset withdrawal
This commit is contained in:
parent
b660176534
commit
099a839e80
|
@ -44,7 +44,7 @@ public class Dataset implements DataEntity<Dataset, UUID> {
|
|||
private static final Set<String> hints = new HashSet<>(Arrays.asList("datasetListingModel"));
|
||||
|
||||
public enum Status {
|
||||
SAVED((short) 0), FINALISED((short) 1), DELETED((short) 99);
|
||||
SAVED((short) 0), FINALISED((short) 1), WITHDRAWN((short) 2), DELETED((short) 99);
|
||||
|
||||
private short value;
|
||||
|
||||
|
@ -62,8 +62,12 @@ public class Dataset implements DataEntity<Dataset, UUID> {
|
|||
return SAVED;
|
||||
case 1:
|
||||
return FINALISED;
|
||||
case 2:
|
||||
return WITHDRAWN;
|
||||
case 99:
|
||||
return DELETED;
|
||||
default:
|
||||
throw new RuntimeException("Unsupported Project Status");
|
||||
throw new RuntimeException("Unsupported Dataset Status");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -172,6 +172,12 @@ public class DataManagementPlanManager {
|
|||
.asQueryable().where((builder, root) -> root.get("id").in(dataManagementPlan.getDatasets()
|
||||
.stream().map(x -> UUID.fromString(x.getId())).collect(Collectors.toList())))
|
||||
.update(root -> root.<Integer>get("status"), Dataset.Status.FINALISED.getValue());
|
||||
apiContext.getOperationsContext().getDatabaseRepository().getDatasetDao()
|
||||
.asQueryable().where((builder, root) -> builder.and(
|
||||
builder.equal(root.get("dmp").get("id"), dataManagementPlan.getId()),
|
||||
builder.not(root.get("id").in(dataManagementPlan.getDatasets().stream().map(x -> UUID.fromString(x.getId())).collect(Collectors.toList()))),
|
||||
builder.equal(root.get("status"), Dataset.Status.SAVED.getValue())))
|
||||
.update(root -> root.<Integer>get("status"), Dataset.Status.WITHDRAWN.getValue());
|
||||
}
|
||||
if (dataManagementPlan.getAssociatedUsers().stream().filter(item -> item.getId() == principal.getId()).collect(Collectors.toList()).size() == 0)
|
||||
assignUser(newDmp, user, apiContext);
|
||||
|
|
|
@ -16,7 +16,9 @@ import { TagModel } from '../tags/TagModel';
|
|||
|
||||
export enum DatasetStatus {
|
||||
Draft = 0,
|
||||
Finalised = 1
|
||||
Finalised = 1,
|
||||
WithDrawn = 2,
|
||||
Deleted = 99
|
||||
}
|
||||
|
||||
export class DatasetWizardModel implements Serializable<DatasetWizardModel> {
|
||||
|
|
|
@ -39,6 +39,7 @@ export class Utilities {
|
|||
switch (status) {
|
||||
case DatasetStatus.Draft: return this.language.instant('TYPES.DATASET-STATUS.DRAFT');
|
||||
case DatasetStatus.Finalised: return this.language.instant('TYPES.DATASET-STATUS.FINALISED');
|
||||
case DatasetStatus.WithDrawn: return this.language.instant('TYPES.DATASET-STATUS.WITHDRAWN');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -285,7 +285,8 @@
|
|||
},
|
||||
"DATASET-STATUS": {
|
||||
"DRAFT": "Draft",
|
||||
"FINALISED": "Finalised"
|
||||
"FINALISED": "Finalised",
|
||||
"WITHDRAWN": "Withdrawn"
|
||||
},
|
||||
"EXTERNAL-DATASET-TYPE": {
|
||||
"SOURCE": "Source",
|
||||
|
|
Loading…
Reference in New Issue