Search in sources :

Example 1 with SamplingDesignExportProcess

use of org.openforis.collect.manager.dataexport.samplingdesign.SamplingDesignExportProcess in project collect by openforis.

the class SamplingPointsController method exportWorkSamplingDesign.

@RequestMapping(value = "api/survey/{surveyId}/sampling_point_data.csv", method = GET)
@ResponseBody
public String exportWorkSamplingDesign(HttpServletResponse response, @PathVariable("surveyId") Integer surveyId) throws IOException {
    SamplingDesignExportProcess process = new SamplingDesignExportProcess(samplingDesignManager);
    ServletOutputStream out = response.getOutputStream();
    CollectSurvey survey = surveyManager.loadSurvey(surveyId);
    Controllers.setOutputContent(response, SAMPLING_DESIGN_CSV_FILE_NAME, CSV_CONTENT_TYPE);
    process.exportToCSV(out, survey);
    return "ok";
}
Also used : ServletOutputStream(javax.servlet.ServletOutputStream) CollectSurvey(org.openforis.collect.model.CollectSurvey) SamplingDesignExportProcess(org.openforis.collect.manager.dataexport.samplingdesign.SamplingDesignExportProcess) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

ServletOutputStream (javax.servlet.ServletOutputStream)1 SamplingDesignExportProcess (org.openforis.collect.manager.dataexport.samplingdesign.SamplingDesignExportProcess)1 CollectSurvey (org.openforis.collect.model.CollectSurvey)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1