Enhanced the behaviour of finalising DMP's with Dataset withdrawal
This commit is contained in:
parent
b660176534
commit
099a839e80
|
@ -18,7 +18,7 @@ import java.util.stream.Collectors;
|
||||||
attributeNodes = {@NamedAttributeNode("services"), @NamedAttributeNode(value = "datasetDataRepositories", subgraph = "datasetDataRepositories"), @NamedAttributeNode("datasetExternalDatasets"), @NamedAttributeNode("registries"),
|
attributeNodes = {@NamedAttributeNode("services"), @NamedAttributeNode(value = "datasetDataRepositories", subgraph = "datasetDataRepositories"), @NamedAttributeNode("datasetExternalDatasets"), @NamedAttributeNode("registries"),
|
||||||
@NamedAttributeNode(value = "dmp", subgraph = "dmp"), @NamedAttributeNode("profile"), @NamedAttributeNode("creator")},
|
@NamedAttributeNode(value = "dmp", subgraph = "dmp"), @NamedAttributeNode("profile"), @NamedAttributeNode("creator")},
|
||||||
subgraphs = {
|
subgraphs = {
|
||||||
@NamedSubgraph(name = "dmp", attributeNodes = {@NamedAttributeNode("creator"), @NamedAttributeNode("users"), @NamedAttributeNode("project"),@NamedAttributeNode("organisations")}),
|
@NamedSubgraph(name = "dmp", attributeNodes = {@NamedAttributeNode("creator"), @NamedAttributeNode("users"), @NamedAttributeNode("project"), @NamedAttributeNode("organisations")}),
|
||||||
@NamedSubgraph(name = "datasetDataRepositories", attributeNodes = {@NamedAttributeNode("dataRepository")})
|
@NamedSubgraph(name = "datasetDataRepositories", attributeNodes = {@NamedAttributeNode("dataRepository")})
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ public class Dataset implements DataEntity<Dataset, UUID> {
|
||||||
private static final Set<String> hints = new HashSet<>(Arrays.asList("datasetListingModel"));
|
private static final Set<String> hints = new HashSet<>(Arrays.asList("datasetListingModel"));
|
||||||
|
|
||||||
public enum Status {
|
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;
|
private short value;
|
||||||
|
|
||||||
|
@ -62,8 +62,12 @@ public class Dataset implements DataEntity<Dataset, UUID> {
|
||||||
return SAVED;
|
return SAVED;
|
||||||
case 1:
|
case 1:
|
||||||
return FINALISED;
|
return FINALISED;
|
||||||
|
case 2:
|
||||||
|
return WITHDRAWN;
|
||||||
|
case 99:
|
||||||
|
return DELETED;
|
||||||
default:
|
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()
|
.asQueryable().where((builder, root) -> root.get("id").in(dataManagementPlan.getDatasets()
|
||||||
.stream().map(x -> UUID.fromString(x.getId())).collect(Collectors.toList())))
|
.stream().map(x -> UUID.fromString(x.getId())).collect(Collectors.toList())))
|
||||||
.update(root -> root.<Integer>get("status"), Dataset.Status.FINALISED.getValue());
|
.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)
|
if (dataManagementPlan.getAssociatedUsers().stream().filter(item -> item.getId() == principal.getId()).collect(Collectors.toList()).size() == 0)
|
||||||
assignUser(newDmp, user, apiContext);
|
assignUser(newDmp, user, apiContext);
|
||||||
|
|
|
@ -16,7 +16,9 @@ import { TagModel } from '../tags/TagModel';
|
||||||
|
|
||||||
export enum DatasetStatus {
|
export enum DatasetStatus {
|
||||||
Draft = 0,
|
Draft = 0,
|
||||||
Finalised = 1
|
Finalised = 1,
|
||||||
|
WithDrawn = 2,
|
||||||
|
Deleted = 99
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DatasetWizardModel implements Serializable<DatasetWizardModel> {
|
export class DatasetWizardModel implements Serializable<DatasetWizardModel> {
|
||||||
|
|
|
@ -39,6 +39,7 @@ export class Utilities {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case DatasetStatus.Draft: return this.language.instant('TYPES.DATASET-STATUS.DRAFT');
|
case DatasetStatus.Draft: return this.language.instant('TYPES.DATASET-STATUS.DRAFT');
|
||||||
case DatasetStatus.Finalised: return this.language.instant('TYPES.DATASET-STATUS.FINALISED');
|
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": {
|
"DATASET-STATUS": {
|
||||||
"DRAFT": "Draft",
|
"DRAFT": "Draft",
|
||||||
"FINALISED": "Finalised"
|
"FINALISED": "Finalised",
|
||||||
|
"WITHDRAWN": "Withdrawn"
|
||||||
},
|
},
|
||||||
"EXTERNAL-DATASET-TYPE": {
|
"EXTERNAL-DATASET-TYPE": {
|
||||||
"SOURCE": "Source",
|
"SOURCE": "Source",
|
||||||
|
|
Loading…
Reference in New Issue