use of org.openforis.collect.io.data.RecordProvider in project collect by openforis.
the class RecordController method startRecordImport.
@RequestMapping(value = "survey/{surveyId}/data/import/records", method = POST)
@ResponseBody
public JobView startRecordImport(@PathVariable("surveyId") int surveyId, @RequestParam List<Integer> entryIdsToImport, @RequestParam(defaultValue = "true") boolean validateRecords) throws IOException {
RecordProvider recordProvider = dataRestoreSummaryJob.getRecordProvider();
recordProvider.setConfiguration(new RecordProviderConfiguration(true));
DataRestoreJob job = jobManager.createJob(TransactionalDataRestoreJob.class);
job.setFile(dataRestoreSummaryJob.getFile());
job.setUser(sessionManager.getLoggedUser());
job.setValidateRecords(validateRecords);
job.setRecordProvider(recordProvider);
job.setPackagedSurvey(dataRestoreSummaryJob.getPackagedSurvey());
job.setPublishedSurvey(dataRestoreSummaryJob.getPublishedSurvey());
job.setEntryIdsToImport(entryIdsToImport);
job.setRecordFilesToBeDeleted(dataRestoreSummaryJob.getSummary().getConflictingRecordFiles(entryIdsToImport));
job.setRestoreUploadedFiles(true);
job.setValidateRecords(validateRecords);
jobManager.start(job);
return new JobView(job);
}
Aggregations