use of org.hisp.dhis.dashboard.DashboardSearchResult in project dhis2-core by dhis2.
the class DefaultDashboardService method search.
@Override
public DashboardSearchResult search(String query, Set<DashboardItemType> maxTypes) {
Set<String> words = Sets.newHashSet(query.split(TextUtils.SPACE));
List<App> dashboardApps = appManager.getAppsByType(AppType.DASHBOARD_WIDGET, new HashSet<>(appManager.getApps(null)));
DashboardSearchResult result = new DashboardSearchResult();
result.setUsers(userService.getAllUsersBetweenByName(query, 0, getMax(DashboardItemType.USERS, maxTypes)));
result.setCharts(objectManager.getBetweenLikeName(Chart.class, words, 0, getMax(DashboardItemType.CHART, maxTypes)));
result.setEventCharts(objectManager.getBetweenLikeName(EventChart.class, words, 0, getMax(DashboardItemType.EVENT_CHART, maxTypes)));
result.setMaps(objectManager.getBetweenLikeName(Map.class, words, 0, getMax(DashboardItemType.MAP, maxTypes)));
result.setReportTables(objectManager.getBetweenLikeName(ReportTable.class, words, 0, getMax(DashboardItemType.REPORT_TABLE, maxTypes)));
result.setEventReports(objectManager.getBetweenLikeName(EventReport.class, words, 0, getMax(DashboardItemType.EVENT_REPORT, maxTypes)));
result.setReports(objectManager.getBetweenLikeName(Report.class, words, 0, getMax(DashboardItemType.REPORTS, maxTypes)));
result.setResources(objectManager.getBetweenLikeName(Document.class, words, 0, getMax(DashboardItemType.RESOURCES, maxTypes)));
result.setApps(appManager.getAppsByName(query, dashboardApps, "ilike"));
return result;
}
Aggregations