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

View File

@ -100,9 +100,8 @@ public class DataManagementPlanManager {
.selectAsync(item -> { .selectAsync(item -> {
item.setDataset( item.setDataset(
item.getDataset().stream() 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) .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() || dataset.getDmp().getUsers().stream()
.filter(x -> x.getUser().getId().equals(principalID)) .filter(x -> x.getUser().getId().equals(principalID))
.collect(Collectors.toList()).size() > 0) .collect(Collectors.toList()).size() > 0)

View File

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