use of org.hisp.dhis.sqlview.SqlView in project dhis2-core by dhis2.
the class SqlViewController method getViewPdf.
@GetMapping("/{uid}/data.pdf")
public void getViewPdf(@PathVariable("uid") String uid, @RequestParam(required = false) Set<String> criteria, @RequestParam(required = false) Set<String> var, HttpServletResponse response) throws Exception {
SqlView sqlView = validateView(uid);
List<String> filters = Lists.newArrayList(contextService.getParameterValues("filter"));
List<String> fields = Lists.newArrayList(contextService.getParameterValues("fields"));
Grid grid = sqlViewService.getSqlViewGrid(sqlView, SqlView.getCriteria(criteria), SqlView.getCriteria(var), filters, fields);
contextUtils.configureResponse(response, ContextUtils.CONTENT_TYPE_PDF, sqlView.getCacheStrategy());
GridUtils.toPdf(grid, response.getOutputStream());
}
Aggregations