Search in sources :

Example 1 with SurveyManager

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

the class SurveyFileFormValidator method loadSurveyFilesDifferentFromThis.

private List<SurveyFile> loadSurveyFilesDifferentFromThis(ValidationContext ctx) {
    List<SurveyFile> result = new ArrayList<SurveyFile>();
    SurveyFileVM vm = getVM(ctx);
    CollectSurvey survey = vm.getSurvey();
    SurveyManager surveyManager = getSurveyManager(ctx);
    List<SurveyFile> surveyFiles = surveyManager.loadSurveyFileSummaries(survey);
    SurveyFile editedSurveyFile = vm.getEditedItem();
    for (SurveyFile surveyFile : surveyFiles) {
        if (!surveyFile.getId().equals(editedSurveyFile.getId())) {
            result.add(surveyFile);
        }
    }
    return result;
}
Also used : ArrayList(java.util.ArrayList) SurveyFile(org.openforis.collect.model.SurveyFile) SurveyFileVM(org.openforis.collect.designer.viewmodel.SurveyFileVM) CollectSurvey(org.openforis.collect.model.CollectSurvey) SurveyManager(org.openforis.collect.manager.SurveyManager)

Aggregations

ArrayList (java.util.ArrayList)1 SurveyFileVM (org.openforis.collect.designer.viewmodel.SurveyFileVM)1 SurveyManager (org.openforis.collect.manager.SurveyManager)1 CollectSurvey (org.openforis.collect.model.CollectSurvey)1 SurveyFile (org.openforis.collect.model.SurveyFile)1