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;
}
Aggregations