Adds "Canceled" Status on Datasets and fixes bug with Dataset isPublic leftovers.

This commit is contained in:
gkolokythas 2019-06-19 17:16:05 +03:00
parent 47262a9a99
commit f9292ee839
3 changed files with 4 additions and 4 deletions

View File

@ -47,7 +47,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), CANCELED((short) 2), DELETED((short) 99),;
private short value;
@ -65,6 +65,8 @@ public class Dataset implements DataEntity<Dataset, UUID> {
return SAVED;
case 1:
return FINALISED;
case 2:
return CANCELED;
case 99:
return DELETED;
default:

View File

@ -100,9 +100,8 @@ public class DataManagementPlanManager {
.selectAsync(item -> {
item.setDataset(
item.getDataset().stream()
.filter(ds -> !ds.getStatus().equals(Dataset.Status.DELETED.getValue())).collect(Collectors.toList()).stream()
.filter(dataset -> !dataset.getStatus().equals(Dataset.Status.DELETED.getValue()) && !dataset.getStatus().equals(Dataset.Status.CANCELED.getValue())).collect(Collectors.toList()).stream()
.filter(dataset -> dataset.getDmp().getUsers().stream().filter(userDMP -> userDMP.getRole().equals(UserDMP.UserDMPRoles.OWNER.getValue())).findFirst().get().getUser().getId().equals(principalID)
|| dataset.isPublic()
|| dataset.getDmp().getUsers().stream()
.filter(x -> x.getUser().getId().equals(principalID))
.collect(Collectors.toList()).size() > 0)

View File

@ -501,7 +501,6 @@ public class DatasetManager {
dmp.setId(UUID.fromString(dmpId));
entity.setDmp(dmp);
entity.setStatus((short) 0);
entity.setPublic(false);
entity.setCreated(new Date());
entity.setModified(new Date());
DatasetProfile profile = new DatasetProfile();