Search in sources :

Example 1 with ValidationReportJob

use of org.openforis.collect.manager.ValidationReportJob in project collect by openforis.

the class RecordController method startValidationResportJob.

@RequestMapping(value = "survey/{surveyId}/data/records/validationreport", method = POST)
@ResponseBody
public JobProxy startValidationResportJob(@PathVariable("surveyId") int surveyId) {
    User user = sessionManager.getLoggedUser();
    Locale locale = sessionManager.getSessionState().getLocale();
    CollectSurvey survey = surveyManager.getById(surveyId);
    EntityDefinition rootEntityDef = survey.getSchema().getFirstRootEntityDefinition();
    ValidationReportJob job = jobManager.createJob(ValidationReportJob.class);
    Input input = new Input();
    input.setLocale(locale);
    input.setReportType(ReportType.CSV);
    RecordFilter recordFilter = createRecordFilter(survey, user, userGroupManager, rootEntityDef.getId(), false);
    input.setRecordFilter(recordFilter);
    job.setInput(input);
    this.validationReportJob = job;
    jobManager.start(job);
    return new JobProxy(job);
}
Also used : Locale(java.util.Locale) EntityDefinition(org.openforis.idm.metamodel.EntityDefinition) Input(org.openforis.collect.manager.ValidationReportJob.Input) CSVDataImportInput(org.openforis.collect.io.data.CSVDataImportJob.CSVDataImportInput) User(org.openforis.collect.model.User) JobProxy(org.openforis.concurrency.proxy.JobProxy) ValidationReportJob(org.openforis.collect.manager.ValidationReportJob) CollectSurvey(org.openforis.collect.model.CollectSurvey) RecordFilter(org.openforis.collect.model.RecordFilter) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

Locale (java.util.Locale)1 CSVDataImportInput (org.openforis.collect.io.data.CSVDataImportJob.CSVDataImportInput)1 ValidationReportJob (org.openforis.collect.manager.ValidationReportJob)1 Input (org.openforis.collect.manager.ValidationReportJob.Input)1 CollectSurvey (org.openforis.collect.model.CollectSurvey)1 RecordFilter (org.openforis.collect.model.RecordFilter)1 User (org.openforis.collect.model.User)1 JobProxy (org.openforis.concurrency.proxy.JobProxy)1 EntityDefinition (org.openforis.idm.metamodel.EntityDefinition)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1