Removed Unnecessary time counters

This commit is contained in:
George Kalampokis 2020-01-21 12:48:19 +02:00
parent 4c02fc4c97
commit 88f0d80b1e
1 changed files with 4 additions and 17 deletions

View File

@ -96,7 +96,6 @@ public class DataManagementPlanManager {
}
public DataTableData<DataManagementPlanListingModel> getPaged(DataManagementPlanTableRequest dataManagementPlanTableRequest, Principal principal, String fieldsGroup) throws Exception {
long startTime = System.currentTimeMillis();
UUID principalID = principal.getId();
QueryableList<DMP> items = apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().getWithCriteria(dataManagementPlanTableRequest.getCriteria());
List<Integer> roles = new LinkedList<>();
@ -120,30 +119,18 @@ public class DataManagementPlanManager {
.collect(Collectors.toSet()));
return new DataManagementPlanListingModel().fromDataModelDatasets(item);
})
.whenComplete((resultList, throwable) -> {
logger.info("Select query took " + (System.currentTimeMillis() - startTime) + " millis");
dataTable.setData(resultList);
});
.whenComplete((resultList, throwable) -> dataTable.setData(resultList));
} else if (fieldsGroup.equals("autocomplete")) {
itemsFuture = pagedItems
.selectAsync(item -> new DataManagementPlanListingModel().fromDataModelAutoComplete(item))
.whenComplete((resultList, throwable) -> {
logger.info("Select query took " + (System.currentTimeMillis() - startTime) + " millis");
dataTable.setData(resultList);
});
.whenComplete((resultList, throwable) -> dataTable.setData(resultList));
} else {
itemsFuture = pagedItems
.selectAsync(item -> new DataManagementPlanListingModel().fromDataModelAssociatedProfiles(item))
.whenComplete((resultList, throwable) -> {
logger.info("Select query took " + (System.currentTimeMillis() - startTime) + " millis");
dataTable.setData(resultList);
});
.whenComplete((resultList, throwable) -> dataTable.setData(resultList));
}
CompletableFuture countFuture = authItems.countAsync().whenComplete((count, throwable) -> {
logger.info("Count query took " + (System.currentTimeMillis() - startTime) + " millis");
dataTable.setTotalCount(count);
});
CompletableFuture countFuture = authItems.countAsync().whenComplete((count, throwable) -> dataTable.setTotalCount(count));
CompletableFuture.allOf(itemsFuture, countFuture).join();
return dataTable;
}