Search in sources :

Example 1 with DataReportItemForm

use of org.openforis.collect.datacleansing.form.DataReportItemForm 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);
}
Also used : DataReportItem(org.openforis.collect.datacleansing.DataReportItem) PaginatedResponse(org.openforis.collect.web.controller.PaginatedResponse) DataReportItemForm(org.openforis.collect.datacleansing.form.DataReportItemForm) DataReport(org.openforis.collect.datacleansing.DataReport) ArrayList(java.util.ArrayList) CollectSurvey(org.openforis.collect.model.CollectSurvey) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

ArrayList (java.util.ArrayList)1 DataReport (org.openforis.collect.datacleansing.DataReport)1 DataReportItem (org.openforis.collect.datacleansing.DataReportItem)1 DataReportItemForm (org.openforis.collect.datacleansing.form.DataReportItemForm)1 CollectSurvey (org.openforis.collect.model.CollectSurvey)1 PaginatedResponse (org.openforis.collect.web.controller.PaginatedResponse)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1