Add dataset filter like in getPaged on DataManagementPlanManager
This commit is contained in:
parent
8d7d9c5a8b
commit
14df3a4bbe
|
@ -209,6 +209,7 @@ public class DashBoardManager {
|
||||||
QueryableList<Dataset> datasetList;
|
QueryableList<Dataset> datasetList;
|
||||||
|
|
||||||
if (principal.getId() != null) {
|
if (principal.getId() != null) {
|
||||||
|
datasetCriteria.setIsPublic(false);
|
||||||
List<Integer> roles = new LinkedList<>();
|
List<Integer> roles = new LinkedList<>();
|
||||||
dmpList = dataManagementPlanRepository.getAuthenticated(dataManagementPlanRepository.getWithCriteria(dataManagementPlanCriteria), principal.getId(), roles);
|
dmpList = dataManagementPlanRepository.getAuthenticated(dataManagementPlanRepository.getWithCriteria(dataManagementPlanCriteria), principal.getId(), roles);
|
||||||
datasetList = datasetRepository.getAuthenticated(datasetRepository.getWithCriteria(datasetCriteria), user, roles);
|
datasetList = datasetRepository.getAuthenticated(datasetRepository.getWithCriteria(datasetCriteria), user, roles);
|
||||||
|
@ -227,6 +228,13 @@ public class DashBoardManager {
|
||||||
.skip(tableRequest.getDmpOffset())
|
.skip(tableRequest.getDmpOffset())
|
||||||
.take(tableRequest.getLength())
|
.take(tableRequest.getLength())
|
||||||
.select(item -> {
|
.select(item -> {
|
||||||
|
item.setDataset(
|
||||||
|
item.getDataset().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(x -> x.getUser().getId().equals(principal.getId()))
|
||||||
|
.collect(Collectors.toList()).size() > 0)
|
||||||
|
.collect(Collectors.toSet()));
|
||||||
return new RecentDmpModel().fromEntity(item);
|
return new RecentDmpModel().fromEntity(item);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue