Search in sources :

Example 1 with DataBackupError

use of org.openforis.collect.io.data.DataBackupError in project collect by openforis.

the class SurveyExportParametersVM method jobCompleted.

@GlobalCommand
public void jobCompleted(@BindingParam("job") Job job) {
    boolean jobStartedByThis = isJobStartedByThis(job);
    if (job == surveyBackupJob) {
        File file = surveyBackupJob.getOutputFile();
        downloadFile(file, surveyBackupJob.getOutputFormat().getOutputFileExtension(), MediaType.APPLICATION_OCTET_STREAM_VALUE, surveyBackupJob.getSurvey(), surveyBackupJob.getOutputSurveyDefaultLanguage());
        final List<DataBackupError> dataBackupErrors = surveyBackupJob.getDataBackupErrors();
        if (!dataBackupErrors.isEmpty()) {
            DataExportErrorsPopUpVM.showPopUp(dataBackupErrors);
        }
    } else if (job == rdbExportJob) {
        File file = rdbExportJob.getOutputFile();
        CollectSurvey survey = rdbExportJob.getSurvey();
        String extension = "sql";
        downloadFile(file, extension, MediaType.TEXT_PLAIN_VALUE, survey, survey.getDefaultLanguage());
    }
    if (jobStartedByThis) {
        onJobEnd(job);
    }
}
Also used : DataBackupError(org.openforis.collect.io.data.DataBackupError) CollectSurvey(org.openforis.collect.model.CollectSurvey) File(java.io.File) GlobalCommand(org.zkoss.bind.annotation.GlobalCommand)

Aggregations

File (java.io.File)1 DataBackupError (org.openforis.collect.io.data.DataBackupError)1 CollectSurvey (org.openforis.collect.model.CollectSurvey)1 GlobalCommand (org.zkoss.bind.annotation.GlobalCommand)1