Commit 88f0d80b authored by George Kalampokis's avatar George Kalampokis
Browse files

Removed Unnecessary time counters

parent 4c02fc4c
Loading
Loading
Loading
Loading
+4 −17
Original line number Diff line number Diff line
@@ -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;
    }