Fixed issue if dataset has no profile

This commit is contained in:
George Kalampokis 2020-07-29 17:52:51 +03:00
parent dc83a3a09c
commit 4b30d56d91
1 changed files with 4 additions and 2 deletions

View File

@ -188,7 +188,7 @@ public class DatasetManager {
DataTableData<DatasetListingModel> dataTable = new DataTableData<>(); DataTableData<DatasetListingModel> dataTable = new DataTableData<>();
dataTable.setData(pagedItems.select(this::mapModel)); dataTable.setData(pagedItems.select(this::mapModel).stream().filter(Objects::nonNull).collect(Collectors.toList()));
dataTable.setTotalCount(authItems.count()); dataTable.setTotalCount(authItems.count());
@ -239,7 +239,7 @@ public class DatasetManager {
CompletableFuture<List<DatasetListingModel>> itemsFuture = pagedItems. CompletableFuture<List<DatasetListingModel>> itemsFuture = pagedItems.
selectAsync(this::mapModel).whenComplete((resultList, throwable) -> { selectAsync(this::mapModel).whenComplete((resultList, throwable) -> {
dataTable.setData(resultList); dataTable.setData(resultList.stream().filter(Objects::nonNull).collect(Collectors.toList()));
}); });
CompletableFuture countFuture = pagedItems.countAsync().whenComplete((count, throwable) -> { CompletableFuture countFuture = pagedItems.countAsync().whenComplete((count, throwable) -> {
@ -1049,6 +1049,8 @@ public class DatasetManager {
@Transactional @Transactional
private DatasetListingModel mapModel(Dataset item) { private DatasetListingModel mapModel(Dataset item) {
if (item.getProfile() == null)
return null;
DatasetListingModel listingModel = new DatasetListingModel().fromDataModel(item); DatasetListingModel listingModel = new DatasetListingModel().fromDataModel(item);
DatasetProfileCriteria criteria = new DatasetProfileCriteria(); DatasetProfileCriteria criteria = new DatasetProfileCriteria();
criteria.setGroupIds(Collections.singletonList(item.getProfile().getGroupId())); criteria.setGroupIds(Collections.singletonList(item.getProfile().getGroupId()));