Search in sources :

Example 96 with CollectSurvey

use of org.openforis.collect.model.CollectSurvey in project collect by openforis.

the class SurveySelectVM method loadSelectedSurveyForEdit.

protected CollectSurvey loadSelectedSurveyForEdit() {
    String uri = selectedSurvey.getUri();
    CollectSurvey temporarySurvey;
    if (selectedSurvey.isTemporary()) {
        temporarySurvey = surveyManager.loadSurvey(selectedSurvey.getId());
    } else if (selectedSurvey.isPublished()) {
        temporarySurvey = surveyManager.createTemporarySurveyFromPublished(uri, getLoggedUser());
    } else {
        throw new IllegalStateException("Trying to load an invalid survey: " + uri);
    }
    return temporarySurvey;
}
Also used : CollectSurvey(org.openforis.collect.model.CollectSurvey)

Example 97 with CollectSurvey

use of org.openforis.collect.model.CollectSurvey in project collect by openforis.

the class SurveySelectVM method editSelectedSurvey.

@Command
public void editSelectedSurvey() throws IOException {
    CollectSurvey temporarySurvey = loadSelectedSurveyForEdit();
    SurveyEditVM.redirectToSurveyEditPage(temporarySurvey.getId());
}
Also used : CollectSurvey(org.openforis.collect.model.CollectSurvey) Command(org.zkoss.bind.annotation.Command) GlobalCommand(org.zkoss.bind.annotation.GlobalCommand)

Example 98 with CollectSurvey

use of org.openforis.collect.model.CollectSurvey in project collect by openforis.

the class SurveyBaseVM method getCodeLists.

public List<CodeList> getCodeLists() {
    CollectSurvey survey = getSurvey();
    boolean includeSamplingDesignList = survey.getTarget() != SurveyTarget.COLLECT_EARTH;
    List<CodeList> result = new ArrayList<CodeList>(survey.getCodeLists(includeSamplingDesignList));
    result = sort(result);
    return new BindingListModelList<CodeList>(result, false);
}
Also used : CodeList(org.openforis.idm.metamodel.CodeList) ArrayList(java.util.ArrayList) CollectSurvey(org.openforis.collect.model.CollectSurvey) BindingListModelList(org.zkoss.zkplus.databind.BindingListModelList)

Example 99 with CollectSurvey

use of org.openforis.collect.model.CollectSurvey in project collect by openforis.

the class SurveyBaseVM method getVersionLabel.

public String getVersionLabel(int id) {
    if (id > 0) {
        CollectSurvey survey = getSurvey();
        ModelVersion version = survey.getVersionById(id);
        String result = null;
        if (version != null) {
            result = version.getLabel(currentLanguageCode);
            if (result == null) {
                result = version.getName();
            }
        }
        return result;
    } else {
        return Labels.getLabel(EMPTY_OPTION);
    }
}
Also used : ModelVersion(org.openforis.idm.metamodel.ModelVersion) CollectSurvey(org.openforis.collect.model.CollectSurvey)

Example 100 with CollectSurvey

use of org.openforis.collect.model.CollectSurvey in project collect by openforis.

the class SurveyBaseVM method getRootEntities.

public List<EntityDefinition> getRootEntities() {
    CollectSurvey survey = getSurvey();
    if (survey == null) {
        // TODO session expired...?
        return Collections.emptyList();
    } else {
        Schema schema = survey.getSchema();
        List<EntityDefinition> result = schema.getRootEntityDefinitions();
        return result;
    }
}
Also used : EntityDefinition(org.openforis.idm.metamodel.EntityDefinition) Schema(org.openforis.idm.metamodel.Schema) CollectSurvey(org.openforis.collect.model.CollectSurvey)

Aggregations

CollectSurvey (org.openforis.collect.model.CollectSurvey)329 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)53 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)40 UIOptions (org.openforis.collect.metamodel.ui.UIOptions)38 CollectRecord (org.openforis.collect.model.CollectRecord)30 RecordFilter (org.openforis.collect.model.RecordFilter)27 Transactional (org.springframework.transaction.annotation.Transactional)26 EntityDefinition (org.openforis.idm.metamodel.EntityDefinition)25 ArrayList (java.util.ArrayList)23 File (java.io.File)21 CollectAnnotations (org.openforis.collect.metamodel.CollectAnnotations)21 Secured (org.springframework.security.access.annotation.Secured)20 User (org.openforis.collect.model.User)19 NodeDefinition (org.openforis.idm.metamodel.NodeDefinition)19 SessionState (org.openforis.collect.web.session.SessionState)18 AttributeDefinition (org.openforis.idm.metamodel.AttributeDefinition)17 Test (org.junit.Test)16 CollectRecordSummary (org.openforis.collect.model.CollectRecordSummary)15 CodeList (org.openforis.idm.metamodel.CodeList)15 Schema (org.openforis.idm.metamodel.Schema)15