use of org.hisp.dhis.webapi.webdomain.user.Dashboard in project dhis2-core by dhis2.
the class MeController method getDashboard.
@RequestMapping(value = "/dashboard")
@ResponseBody
public Dashboard getDashboard(HttpServletResponse response) throws Exception {
User currentUser = currentUserService.getCurrentUser();
if (currentUser == null) {
throw new NotAuthenticatedException();
}
Dashboard dashboard = new Dashboard();
dashboard.setUnreadMessageConversations(messageService.getUnreadMessageConversationCount());
dashboard.setUnreadInterpretations(interpretationService.getNewInterpretationCount());
return dashboard;
}
use of org.hisp.dhis.webapi.webdomain.user.Dashboard in project dhis2-core by dhis2.
the class CurrentUserController method getDashboard.
@RequestMapping(value = "/dashboard", produces = { "application/json", "text/*" })
public void getDashboard(HttpServletResponse response) throws Exception {
User currentUser = currentUserService.getCurrentUser();
if (currentUser == null) {
throw new NotAuthenticatedException();
}
Dashboard dashboard = new Dashboard();
dashboard.setUnreadMessageConversations(messageService.getUnreadMessageConversationCount());
dashboard.setUnreadInterpretations(interpretationService.getNewInterpretationCount());
response.setContentType(MediaType.APPLICATION_JSON_VALUE);
renderService.toJson(response.getOutputStream(), dashboard);
}
use of org.hisp.dhis.webapi.webdomain.user.Dashboard in project dhis2-core by dhis2.
the class CurrentUserController method getDashboards.
@RequestMapping(value = "/dashboards", produces = { "application/json", "text/*" })
public void getDashboards(HttpServletResponse response) throws NotAuthenticatedException, IOException {
User user = currentUserService.getCurrentUser();
if (user == null) {
throw new NotAuthenticatedException();
}
List<org.hisp.dhis.dashboard.Dashboard> dashboards = Lists.newArrayList(manager.getAll(org.hisp.dhis.dashboard.Dashboard.class));
for (org.hisp.dhis.dashboard.Dashboard dashboard : dashboards) {
dashboard.setAccess(aclService.getAccess(dashboard, user));
for (DashboardItem dashboardItem : dashboard.getItems()) {
dashboardItem.setAccess(aclService.getAccess(dashboardItem, user));
}
}
response.setContentType(MediaType.APPLICATION_JSON_VALUE);
renderService.toJson(response.getOutputStream(), dashboards);
}
Aggregations