Search in sources :

Example 1 with SuccessHandler

use of org.openforis.collect.designer.util.SuccessHandler in project collect by openforis.

the class SurveyExportParametersVM method export.

@Command
public void export() {
    rdbExportJob = null;
    surveyBackupJob = null;
    String uri = surveySummary.getUri();
    final CollectSurvey loadedSurvey;
    if (surveySummary.isTemporary() && SurveyType.valueOf(formObject.getType()) == TEMPORARY) {
        loadedSurvey = surveyManager.loadSurvey(surveySummary.getId());
    } else {
        loadedSurvey = surveyManager.getByUri(uri);
    }
    switch(formObject.getOutputFormatEnum()) {
        case EARTH:
            validateSurvey(loadedSurvey, collectEarthSurveyValidator, new SuccessHandler() {

                public void onSuccess() {
                    exportCollectEarthSurvey(loadedSurvey, formObject);
                }
            }, true);
            return;
        case RDB:
            startRDBSurveyExportJob(loadedSurvey, formObject);
            break;
        case MOBILE:
            validateSurvey(loadedSurvey, surveyValidator, new SuccessHandler() {

                public void onSuccess() {
                    startCollectSurveyExportJob(loadedSurvey, formObject);
                }
            }, true);
            break;
        default:
            startCollectSurveyExportJob(loadedSurvey, formObject);
            break;
    }
}
Also used : SuccessHandler(org.openforis.collect.designer.util.SuccessHandler) CollectSurvey(org.openforis.collect.model.CollectSurvey) GlobalCommand(org.zkoss.bind.annotation.GlobalCommand) Command(org.zkoss.bind.annotation.Command)

Aggregations

SuccessHandler (org.openforis.collect.designer.util.SuccessHandler)1 CollectSurvey (org.openforis.collect.model.CollectSurvey)1 Command (org.zkoss.bind.annotation.Command)1 GlobalCommand (org.zkoss.bind.annotation.GlobalCommand)1