use of org.hisp.dhis.scheduling.TaskCategory in project dhis2-core by dhis2.
the class SystemController method getTaskSummaryJson.
@RequestMapping(value = "/taskSummaries/{category}", method = RequestMethod.GET, produces = { "*/*", "application/json" })
public void getTaskSummaryJson(HttpServletResponse response, @PathVariable("category") String category) throws IOException {
if (category != null) {
TaskCategory taskCategory = TaskCategory.valueOf(category.toUpperCase());
TaskId taskId = new TaskId(taskCategory, currentUserService.getCurrentUser());
Object summary = notifier.getTaskSummary(taskId);
if (//TODO improve this
summary != null && summary.getClass().isAssignableFrom(ImportSummary.class)) {
ImportSummary importSummary = (ImportSummary) summary;
renderService.toJson(response.getOutputStream(), importSummary);
return;
} else {
renderService.toJson(response.getOutputStream(), summary);
return;
}
}
renderService.toJson(response.getOutputStream(), new ImportSummary());
}
use of org.hisp.dhis.scheduling.TaskCategory in project dhis2-core by dhis2.
the class SystemController method getTaskJson.
@RequestMapping(value = "/tasks/{category}", method = RequestMethod.GET, produces = { "*/*", "application/json" })
public void getTaskJson(@PathVariable("category") String category, @RequestParam(required = false) String lastId, HttpServletResponse response) throws IOException {
List<Notification> notifications = new ArrayList<>();
if (category != null) {
TaskCategory taskCategory = TaskCategory.valueOf(category.toUpperCase());
TaskId taskId = new TaskId(taskCategory, currentUserService.getCurrentUser());
notifications = notifier.getNotifications(taskId, lastId);
}
renderService.toJson(response.getOutputStream(), notifications);
}
Aggregations