use of org.openforis.concurrency.proxy.JobProxy 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);
}
use of org.openforis.concurrency.proxy.JobProxy in project collect by openforis.
the class SaikuController method generateRepository.
@RequestMapping(value = "datasources/{surveyName}/generate", method = POST)
@ResponseBody
public JobProxy generateRepository(@PathVariable String surveyName, @RequestParam String language) throws CollectRdbException, SQLException {
CollectSurvey survey = surveyManager.get(surveyName);
ReportingRepositoriesGeneratorJob job = jobManager.createJob(ReportingRepositoriesGeneratorJob.class);
job.setInput(new Input(language));
job.setSurvey(survey);
jobManager.startSurveyJob(job);
return new JobProxy(job);
}
use of org.openforis.concurrency.proxy.JobProxy in project collect by openforis.
the class RecordController method moveRecords.
@RequestMapping(value = "survey/{surveyId}/data/move/records", method = POST, produces = APPLICATION_JSON_VALUE)
@ResponseBody
public JobProxy moveRecords(@PathVariable("surveyId") int surveyId, @RequestParam String fromStep, @RequestParam boolean promote) {
BulkRecordMoveJob job = jobManager.createJob(BulkRecordMoveJob.class);
SessionState sessionState = sessionManager.getSessionState();
User loggedUser = sessionState.getUser();
CollectSurvey survey = surveyManager.getById(surveyId);
EntityDefinition rootEntityDef = survey.getSchema().getFirstRootEntityDefinition();
job.setSurvey(survey);
job.setRootEntity(rootEntityDef.getName());
job.setPromote(promote);
job.setFromStep(Step.valueOf(fromStep));
job.setUser(loggedUser);
job.setRecordMovedCallback(new BulkRecordMoveJob.Callback() {
@Override
public void recordMoved(CollectRecord record) {
if (promote) {
publishRecordPromotedEvents(record, loggedUser.getUsername());
} else {
publishRecordDeletedEvent(record, RecordStep.valueOf(fromStep), loggedUser.getUsername());
}
}
});
jobManager.startSurveyJob(job);
return new JobProxy(job);
}
use of org.openforis.concurrency.proxy.JobProxy in project collect by openforis.
the class SaikuService method generateRdb.
@Secured(USER)
public JobProxy generateRdb(final String surveyName, final String preferredLanguage) {
CollectSurvey survey = surveyManager.get(surveyName);
ReportingRepositoriesGeneratorJob job = jobManager.createJob(ReportingRepositoriesGeneratorJob.class);
job.setInput(new Input(preferredLanguage));
job.setSurvey(survey);
jobManager.startSurveyJob(job);
return new JobProxy(job);
}
Aggregations