private boolean checkField(Field field) { if (aggregateBy.isEmpty() || groupedSelectFields.contains(field) || field instanceof Expression) return true; for (Link link : aggregateBy) { if (!link.owner().getPath(field).isEmpty()) return true; } return false; }
private Collection<Query> filterUsedQueries(Collection<Query> queries) { if (aggregateBy.isEmpty()) return queries; Collection<Query> result = new HashSet<Query>(); for (Link link : aggregateBy) { Query linkQuery = link.getQuery(); for (Query query : queries) { if (linkQuery == query || !linkQuery.getPath(query).isEmpty()) result.add(query); } } return result; }