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