use of org.openforis.collect.web.controller.PaginatedResponse in project collect by openforis.
the class DataReportController method loadItems.
@RequestMapping(value = "{reportId}/items.json", method = GET)
@ResponseBody
public PaginatedResponse loadItems(@PathVariable int reportId, @RequestParam int offset, @RequestParam int limit) {
CollectSurvey survey = sessionManager.getActiveSurvey();
DataReport report = itemManager.loadById(survey, reportId);
int total = itemManager.countItems(report);
List<DataReportItem> items = itemManager.loadItems(report, offset, limit);
List<DataReportItemForm> rows = new ArrayList<DataReportItemForm>(items.size());
for (DataReportItem item : items) {
rows.add(new DataReportItemForm(item));
}
return new PaginatedResponse(total, rows);
}
Aggregations