Search in sources :

Example 11 with DataQuery

use of org.openforis.collect.datacleansing.DataQuery in project collect by openforis.

the class DataQueryGroupValidator method validateQueryUniqueness.

private boolean validateQueryUniqueness(DataQueryGroupForm target, Errors errors) {
    CollectSurvey survey = getActiveSurvey();
    List<DataQueryGroup> items = dataQueryGroupManager.loadBySurvey(survey);
    for (DataQueryGroup item : items) {
        if (!item.getId().equals(target.getId())) {
            List<DataQuery> queries = item.getQueries();
            List<Integer> queryIds = CollectionUtils.project(queries, "id");
            if (queryIds.equals(target.getQueryIds())) {
                rejectDuplicateValue(errors, QUERY_IDS_FIELD);
                return false;
            }
        }
    }
    return true;
}
Also used : DataQuery(org.openforis.collect.datacleansing.DataQuery) CollectSurvey(org.openforis.collect.model.CollectSurvey) DataQueryGroup(org.openforis.collect.datacleansing.DataQueryGroup)

Aggregations

DataQuery (org.openforis.collect.datacleansing.DataQuery)11 CollectSurvey (org.openforis.collect.model.CollectSurvey)7 AttributeDefinition (org.openforis.idm.metamodel.AttributeDefinition)3 ArrayList (java.util.ArrayList)2 HttpServletResponse (javax.servlet.http.HttpServletResponse)2 DataQueryGroup (org.openforis.collect.datacleansing.DataQueryGroup)2 Response (org.openforis.commons.web.Response)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)2 DataCleansingChain (org.openforis.collect.datacleansing.DataCleansingChain)1 DataCleansingMetadata (org.openforis.collect.datacleansing.DataCleansingMetadata)1 DataCleansingStep (org.openforis.collect.datacleansing.DataCleansingStep)1 DataCleansingStepValue (org.openforis.collect.datacleansing.DataCleansingStepValue)1 DataQueryExecutorJob (org.openforis.collect.datacleansing.DataQueryExecutorJob)1 DataQueryExecutorJobInput (org.openforis.collect.datacleansing.DataQueryExecutorJob.DataQueryExecutorJobInput)1 DataQueryType (org.openforis.collect.datacleansing.DataQueryType)1 CSVDataExportJob (org.openforis.collect.io.data.CSVDataExportJob)1 DescendantNodeFilter (org.openforis.collect.io.data.DescendantNodeFilter)1 CSVDataExportParameters (org.openforis.collect.io.data.csv.CSVDataExportParameters)1 RecordFilter (org.openforis.collect.model.RecordFilter)1