Adds the Organisations statistics on public Dashboard.
This commit is contained in:
parent
252b261d3f
commit
d5c1469a98
|
@ -39,10 +39,13 @@ public class DashBoardManager {
|
||||||
|
|
||||||
public DashBoardStatistics getStatistics() {
|
public DashBoardStatistics getStatistics() {
|
||||||
DashBoardStatistics statistics = new DashBoardStatistics();
|
DashBoardStatistics statistics = new DashBoardStatistics();
|
||||||
|
|
||||||
DatasetCriteria datasetCriteria = new DatasetCriteria();
|
DatasetCriteria datasetCriteria = new DatasetCriteria();
|
||||||
datasetCriteria.setAllVersions(false);
|
|
||||||
DataManagementPlanCriteria dataManagementPlanCriteria = new DataManagementPlanCriteria();
|
DataManagementPlanCriteria dataManagementPlanCriteria = new DataManagementPlanCriteria();
|
||||||
|
OrganisationCriteria organisationCriteria = new OrganisationCriteria();
|
||||||
|
datasetCriteria.setAllVersions(false);
|
||||||
dataManagementPlanCriteria.setAllVersions(false);
|
dataManagementPlanCriteria.setAllVersions(false);
|
||||||
|
organisationCriteria.setPublic(false);
|
||||||
|
|
||||||
CompletableFuture dmpFuture = databaseRepository.getDmpDao().getWithCriteria(dataManagementPlanCriteria).countAsync()
|
CompletableFuture dmpFuture = databaseRepository.getDmpDao().getWithCriteria(dataManagementPlanCriteria).countAsync()
|
||||||
.whenComplete((dmpsStats, throwable) -> statistics.setTotalDataManagementPlanCount(dmpsStats));
|
.whenComplete((dmpsStats, throwable) -> statistics.setTotalDataManagementPlanCount(dmpsStats));
|
||||||
|
@ -50,8 +53,10 @@ public class DashBoardManager {
|
||||||
.whenComplete((datasetsStats, throwable) -> statistics.setTotalDataSetCount(datasetsStats));
|
.whenComplete((datasetsStats, throwable) -> statistics.setTotalDataSetCount(datasetsStats));
|
||||||
CompletableFuture projectFuture = databaseRepository.getProjectDao().asQueryable().countAsync()
|
CompletableFuture projectFuture = databaseRepository.getProjectDao().asQueryable().countAsync()
|
||||||
.whenComplete((projectsStats, throwable) -> statistics.setTotalProjectCount(projectsStats));
|
.whenComplete((projectsStats, throwable) -> statistics.setTotalProjectCount(projectsStats));
|
||||||
|
CompletableFuture organisationFuture = databaseRepository.getOrganisationDao().getWithCriteria(organisationCriteria).countAsync()
|
||||||
|
.whenComplete((organisationStats, throwable) -> statistics.setTotalOrganisationCount(organisationStats));
|
||||||
|
|
||||||
CompletableFuture.allOf(dmpFuture, datasetFuture, projectFuture).join();
|
CompletableFuture.allOf(dmpFuture, datasetFuture, projectFuture, organisationFuture).join();
|
||||||
return statistics;
|
return statistics;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue