use of org.openforis.collect.web.controller.CollectJobController.JobView in project collect by openforis.
the class DataReportController method startExport.
private JobView startExport(int reportId, Class<? extends CSVWriterDataReportItemProcessor> itemProcessorType) throws Exception {
CollectSurvey survey = sessionManager.getActiveSurvey();
DataReport report = itemManager.loadById(survey, reportId);
exportJob = new ReportExportJob();
exportJob.setSurvey(survey);
exportJob.setReport(report);
exportJob.setItemProcessorType(itemProcessorType);
exportJob.setReportManager(itemManager);
collectJobManager.start(exportJob);
return new JobView(exportJob);
}
use of org.openforis.collect.web.controller.CollectJobController.JobView in project collect by openforis.
the class RecordController method startRecordImportSummaryJob.
@RequestMapping(value = "survey/{surveyId}/data/import/records/summary", method = POST, consumes = MULTIPART_FORM_DATA_VALUE)
@ResponseBody
public JobView startRecordImportSummaryJob(@PathVariable("surveyId") int surveyId, @RequestParam("file") MultipartFile multipartFile, @RequestParam String rootEntityName) throws IOException {
File file = File.createTempFile("ofc_data_restore", ".collect-data");
FileUtils.copyInputStreamToFile(multipartFile.getInputStream(), file);
CollectSurvey survey = surveyManager.getById(surveyId);
DataRestoreSummaryJob job = jobManager.createJob(DataRestoreSummaryJob.class);
job.setUser(sessionManager.getLoggedUser());
job.setFullSummary(true);
job.setFile(file);
job.setPublishedSurvey(survey);
job.setCloseRecordProviderOnComplete(false);
jobManager.start(job);
this.dataRestoreSummaryJob = job;
return new JobView(job);
}
Aggregations