Search in sources :

Example 6 with JobView

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);
}
Also used : JobView(org.openforis.collect.web.controller.CollectJobController.JobView) DataReport(org.openforis.collect.datacleansing.DataReport) CollectSurvey(org.openforis.collect.model.CollectSurvey)

Example 7 with JobView

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);
}
Also used : JobView(org.openforis.collect.web.controller.CollectJobController.JobView) DataRestoreSummaryJob(org.openforis.collect.io.data.DataRestoreSummaryJob) CollectSurvey(org.openforis.collect.model.CollectSurvey) File(java.io.File) MultipartFile(org.springframework.web.multipart.MultipartFile) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

JobView (org.openforis.collect.web.controller.CollectJobController.JobView)7 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)6 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)6 CollectSurvey (org.openforis.collect.model.CollectSurvey)5 File (java.io.File)2 MultipartFile (org.springframework.web.multipart.MultipartFile)2 DataReport (org.openforis.collect.datacleansing.DataReport)1 SurveyBackupJob (org.openforis.collect.io.SurveyBackupJob)1 CSVDataExportJob (org.openforis.collect.io.data.CSVDataExportJob)1 CSVDataImportJob (org.openforis.collect.io.data.CSVDataImportJob)1 CSVDataImportInput (org.openforis.collect.io.data.CSVDataImportJob.CSVDataImportInput)1 DataRestoreJob (org.openforis.collect.io.data.DataRestoreJob)1 DataRestoreSummaryJob (org.openforis.collect.io.data.DataRestoreSummaryJob)1 RecordProvider (org.openforis.collect.io.data.RecordProvider)1 RecordProviderConfiguration (org.openforis.collect.io.data.RecordProviderConfiguration)1 TransactionalCSVDataImportJob (org.openforis.collect.io.data.TransactionalCSVDataImportJob)1 TransactionalDataRestoreJob (org.openforis.collect.io.data.TransactionalDataRestoreJob)1 CSVDataExportParameters (org.openforis.collect.io.data.csv.CSVDataExportParameters)1 CSVDataImportSettings (org.openforis.collect.io.data.csv.CSVDataImportSettings)1 CollectEarthSurveyExportJob (org.openforis.collect.manager.CollectEarthSurveyExportJob)1