Search in sources :

Example 1 with RecordProviderConfiguration

use of org.openforis.collect.io.data.RecordProviderConfiguration 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);
}
Also used : RecordProvider(org.openforis.collect.io.data.RecordProvider) JobView(org.openforis.collect.web.controller.CollectJobController.JobView) RecordProviderConfiguration(org.openforis.collect.io.data.RecordProviderConfiguration) DataRestoreJob(org.openforis.collect.io.data.DataRestoreJob) TransactionalDataRestoreJob(org.openforis.collect.io.data.TransactionalDataRestoreJob) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

DataRestoreJob (org.openforis.collect.io.data.DataRestoreJob)1 RecordProvider (org.openforis.collect.io.data.RecordProvider)1 RecordProviderConfiguration (org.openforis.collect.io.data.RecordProviderConfiguration)1 TransactionalDataRestoreJob (org.openforis.collect.io.data.TransactionalDataRestoreJob)1 JobView (org.openforis.collect.web.controller.CollectJobController.JobView)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1