use of org.openforis.collect.concurrency.CollectJobManager in project collect by openforis.
the class CollectMobileBackupConvertTask method execute.
@Override
protected void execute() throws Throwable {
// import survey into db file
CollectJobManager jobManager = (CollectJobManager) ctx.getBean("jobManager");
SurveyRestoreJob restoreJob = ctx.getBean(SurveyRestoreJob.class);
restoreJob.setFile(collectBackupFile);
restoreJob.setSurveyName(surveyName);
restoreJob.setUserGroup(userGroupManager.getDefaultPublicUserGroup());
restoreJob.setRestoreIntoPublishedSurvey(true);
restoreJob.setValidateSurvey(false);
jobManager.start(restoreJob, false);
incrementProcessedItems();
if (restoreJob.isCompleted()) {
createOutpuFile();
incrementProcessedItems();
} else {
changeStatus(Status.FAILED);
setErrorMessage(restoreJob.getErrorMessage());
setLastException(restoreJob.getLastException());
}
}
Aggregations