private List<Field> getAggregatedFieldsFromRoot() { List<Field> result = new ArrayList<Field>(); result.addAll(aggregateBy); for (Field field : action.getSelectFields()) { if (field.owner() == action.getRootQuery() || field.owner() == action.getQuery()) { if (field.getAggregation() != Aggregation.None) result.add(field); } } return result; }
private List<Field> getSelectFields() { List<Field> fields = new ArrayList<Field>(); Collection<Field> groupFields = getGroupFields(); boolean grouped = isGrouped(); for (Field field : action.getSelectFields()) { if (checkField(field)) { if (grouped) { if (groupFields.contains(field) || field.isAggregated()) fields.add(field); } else if (isAggregated) { if (field.isAggregated()) fields.add(field); } else fields.add(field); } } return fields; }