use of org.openforis.collect.io.data.DescendantNodeFilter in project collect by openforis.
the class DataQueryController method startExport.
@RequestMapping(value = "start-export.json", method = RequestMethod.POST)
@ResponseBody
public Response startExport(@Validated DataQueryForm form, @RequestParam Step recordStep) throws Exception {
CollectSurvey survey = sessionManager.getActiveSurvey();
DataQuery query = new DataQuery(survey);
form.copyTo(query);
exportJob = collectJobManager.createJob(CSVDataExportJob.class);
exportJob.setOutputFile(File.createTempFile("data-query-export", ".csv"));
CSVDataExportParameters parameters = new CSVDataExportParameters();
RecordFilter recordFilter = new RecordFilter(survey);
recordFilter.setStepGreaterOrEqual(recordStep);
parameters.setRecordFilter(recordFilter);
parameters.setEntityId(query.getEntityDefinitionId());
parameters.setAlwaysGenerateZipFile(false);
parameters.setNodeFilter(new DescendantNodeFilter(query.getAttributeDefinition(), query.getConditions()));
exportJob.setParameters(parameters);
collectJobManager.start(exportJob);
/*
csvExportItemProcessor = new CSVWriterDataQueryResultItemProcessor(query);
csvExportItemProcessor.init();
exportJob = collectJobManager.createJob(DataQueryExecutorJob.class);
exportJob.setInput(new DataQueryExecutorJobInput(query, recordStep, csvExportItemProcessor));
collectJobManager.start(exportJob);
*/
Response response = new Response();
return response;
}
Aggregations