Temporary removed async gets for datasets (TODO: make them async again)
This commit is contained in:
parent
9000da0ee4
commit
a60151560b
|
@ -220,7 +220,7 @@ public class DashBoardManager {
|
||||||
datasetList = datasetRepository.getWithCriteria(datasetCriteria);
|
datasetList = datasetRepository.getWithCriteria(datasetCriteria);
|
||||||
}
|
}
|
||||||
|
|
||||||
CompletableFuture future = CompletableFuture.runAsync(() -> {
|
/*CompletableFuture future = CompletableFuture.runAsync(() -> */{
|
||||||
recentActivityModels.addAll(dmpList
|
recentActivityModels.addAll(dmpList
|
||||||
.withHint(HintedModelFactory.getHint(RecentDmpModel.class))
|
.withHint(HintedModelFactory.getHint(RecentDmpModel.class))
|
||||||
.orderBy((builder, root) -> builder.desc(root.get(tableRequest.getCriteria().getOrder())))
|
.orderBy((builder, root) -> builder.desc(root.get(tableRequest.getCriteria().getOrder())))
|
||||||
|
@ -238,10 +238,10 @@ public class DashBoardManager {
|
||||||
.select(item -> {
|
.select(item -> {
|
||||||
return new RecentDatasetModel().fromEntity(item);
|
return new RecentDatasetModel().fromEntity(item);
|
||||||
}));
|
}));
|
||||||
});
|
}/*);*/
|
||||||
|
|
||||||
|
|
||||||
CompletableFuture.allOf(future).join();
|
//CompletableFuture.allOf(future).join();
|
||||||
// CompletableFuture.allOf(dmps, datasets).join();
|
// CompletableFuture.allOf(dmps, datasets).join();
|
||||||
|
|
||||||
return recentActivityModels.stream().sorted(this.comparators.get(tableRequest.getCriteria().getOrder())).limit(tableRequest.getLength()).collect(Collectors.toList());
|
return recentActivityModels.stream().sorted(this.comparators.get(tableRequest.getCriteria().getOrder())).limit(tableRequest.getLength()).collect(Collectors.toList());
|
||||||
|
|
|
@ -41,7 +41,6 @@ import eu.eudat.models.data.datasetwizard.DatasetWizardModel;
|
||||||
import eu.eudat.models.data.dmp.AssociatedProfile;
|
import eu.eudat.models.data.dmp.AssociatedProfile;
|
||||||
import eu.eudat.models.data.dmp.DataManagementPlan;
|
import eu.eudat.models.data.dmp.DataManagementPlan;
|
||||||
import eu.eudat.models.data.helpers.common.DataTableData;
|
import eu.eudat.models.data.helpers.common.DataTableData;
|
||||||
import eu.eudat.models.data.listingmodels.DataManagementPlanOverviewModel;
|
|
||||||
import eu.eudat.models.data.listingmodels.DatasetListingModel;
|
import eu.eudat.models.data.listingmodels.DatasetListingModel;
|
||||||
import eu.eudat.models.data.security.Principal;
|
import eu.eudat.models.data.security.Principal;
|
||||||
import eu.eudat.models.data.user.composite.PagedDatasetProfile;
|
import eu.eudat.models.data.user.composite.PagedDatasetProfile;
|
||||||
|
@ -70,6 +69,7 @@ import org.w3c.dom.NodeList;
|
||||||
import javax.activation.MimetypesFileTypeMap;
|
import javax.activation.MimetypesFileTypeMap;
|
||||||
import javax.persistence.criteria.Join;
|
import javax.persistence.criteria.Join;
|
||||||
import javax.persistence.criteria.JoinType;
|
import javax.persistence.criteria.JoinType;
|
||||||
|
import javax.transaction.Transactional;
|
||||||
import javax.xml.bind.JAXBContext;
|
import javax.xml.bind.JAXBContext;
|
||||||
import javax.xml.bind.JAXBException;
|
import javax.xml.bind.JAXBException;
|
||||||
import javax.xml.bind.Unmarshaller;
|
import javax.xml.bind.Unmarshaller;
|
||||||
|
@ -188,16 +188,11 @@ public class DatasetManager {
|
||||||
DataTableData<DatasetListingModel> dataTable = new DataTableData<>();
|
DataTableData<DatasetListingModel> dataTable = new DataTableData<>();
|
||||||
|
|
||||||
|
|
||||||
CompletableFuture<List<DatasetListingModel>> itemsFuture = pagedItems.
|
dataTable.setData(pagedItems.select(this::mapModel));
|
||||||
selectAsync(this::mapModel).whenComplete((resultList, throwable) -> {
|
|
||||||
dataTable.setData(resultList);
|
|
||||||
});
|
|
||||||
|
|
||||||
CompletableFuture countFuture = authItems.countAsync().whenComplete((count, throwable) -> {
|
dataTable.setTotalCount(authItems.count());
|
||||||
dataTable.setTotalCount(count);
|
|
||||||
});
|
|
||||||
|
|
||||||
CompletableFuture.allOf(itemsFuture, countFuture).join();
|
//CompletableFuture.allOf(itemsFuture, countFuture).join();
|
||||||
return dataTable;
|
return dataTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,7 +255,7 @@ public class DatasetManager {
|
||||||
eu.eudat.data.entities.Dataset datasetEntity = databaseRepository.getDatasetDao().find(UUID.fromString(id), HintedModelFactory.getHint(DatasetWizardModel.class));
|
eu.eudat.data.entities.Dataset datasetEntity = databaseRepository.getDatasetDao().find(UUID.fromString(id), HintedModelFactory.getHint(DatasetWizardModel.class));
|
||||||
if (datasetEntity.getDmp().getUsers()
|
if (datasetEntity.getDmp().getUsers()
|
||||||
.stream().filter(userInfo -> userInfo.getUser().getId() == principal.getId())
|
.stream().filter(userInfo -> userInfo.getUser().getId() == principal.getId())
|
||||||
.collect(Collectors.toList()).size() == 0)
|
.collect(Collectors.toList()).size() == 0 && !datasetEntity.getDmp().isPublic())
|
||||||
throw new UnauthorisedException();
|
throw new UnauthorisedException();
|
||||||
eu.eudat.elastic.entities.Dataset datasetElastic;
|
eu.eudat.elastic.entities.Dataset datasetElastic;
|
||||||
try {
|
try {
|
||||||
|
@ -1052,6 +1047,7 @@ public class DatasetManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
private DatasetListingModel mapModel(Dataset item) {
|
private DatasetListingModel mapModel(Dataset item) {
|
||||||
DatasetListingModel listingModel = new DatasetListingModel().fromDataModel(item);
|
DatasetListingModel listingModel = new DatasetListingModel().fromDataModel(item);
|
||||||
DatasetProfileCriteria criteria = new DatasetProfileCriteria();
|
DatasetProfileCriteria criteria = new DatasetProfileCriteria();
|
||||||
|
|
Loading…
Reference in New Issue