/** * Filter buckets. * * @param buckets * the buckets * @param query * the query * @return the terms */ private Terms filterBuckets(Terms buckets, KunderaQuery query) { Expression havingClause = query.getSelectStatement().getHavingClause(); if (!(havingClause instanceof NullExpression) && havingClause != null) { Expression conditionalExpression = ((HavingClause) havingClause).getConditionalExpression(); for (Iterator<Bucket> bucketIterator = buckets.getBuckets().iterator(); bucketIterator.hasNext();) { InternalAggregations internalAgg = (InternalAggregations) bucketIterator.next().getAggregations(); if (!isValidBucket(internalAgg, query, conditionalExpression)) { bucketIterator.remove(); } } } return buckets; }
/** * {@inheritDoc} */ public JPQLQueryBNF getQueryBNF() { return getQueryBNF(HavingClauseBNF.ID); } }
/** * {@inheritDoc} */ @Override public void visit(HavingClause expression) { if (expression.hasConditionalExpression()) { conditionalExpression = true; expression.getConditionalExpression().accept(this); conditionalExpression = false; } }
/** * {@inheritDoc} */ @Override protected AbstractExpression buildExpression(AbstractExpression parent, WordParser wordParser, String word, JPQLQueryBNF queryBNF, AbstractExpression expression, boolean tolerant) { expression = new HavingClause(parent); expression.parse(wordParser, tolerant); return expression; } }
/** * {@inheritDoc} */ @Override public void visit(HavingClauseStateObject stateObject) { if (stateObject.isDecorated()) { toText(stateObject); } else { HavingClause expression = stateObject.getExpression(); // 'HAVING' appendIdentifier((expression != null) ? expression.getActualIdentifier() : HAVING, HAVING); if (exactMatch && (expression != null) && expression.hasSpaceAfterIdentifier() || stateObject.hasConditional()) { writer.append(SPACE); } // Conditional expression if (stateObject.hasConditional()) { stateObject.getConditional().accept(this); } } }
/** * {@inheritDoc} */ @Override public void visit(HavingClause expression) { if (!isLocked(expression)) { super.visit(expression); visitCollectionExpression(expression, expression.getIdentifier(), getConditionalClauseCollectionHelper()); } }
/** * {@inheritDoc} */ @Override protected AbstractExpression buildExpression(AbstractExpression parent, WordParser wordParser, String word, JPQLQueryBNF queryBNF, AbstractExpression expression, boolean tolerant) { expression = new HavingClause(parent); expression.parse(wordParser, tolerant); return expression; } }
/** * {@inheritDoc} */ @Override public void visit(HavingClause expression) { expression.getConditionalExpression().accept(this); }
havingClause = new HavingClause(this); havingClause.parse(wordParser, tolerant);
/** * {@inheritDoc} */ public JPQLQueryBNF getQueryBNF() { return getQueryBNF(HavingClauseBNF.ID); } }
/** * {@inheritDoc} */ @Override public void visit(HavingClause expression) { clause = HAVING; expression.getConditionalExpression().accept(this); clause = null; }
havingClause = new HavingClause(this); havingClause.parse(wordParser, tolerant);
/** * {@inheritDoc} */ @Override public void visit(HavingClause expression) { expression.getConditionalExpression().accept(this); }
/** * {@inheritDoc} */ @Override public void visit(HavingClause expression) { expression.getConditionalExpression().accept(this); }
addHavingClause(((HavingClause) selectStatement.getHavingClause()).getConditionalExpression(), termsBuilder, entityMetadata);
/** * Filter buckets. * * @param buckets * the buckets * @param query * the query * @return the terms */ private Terms filterBuckets(Terms buckets, KunderaQuery query) { Expression havingClause = query.getSelectStatement().getHavingClause(); if (!(havingClause instanceof NullExpression) && havingClause != null) { Expression conditionalExpression = ((HavingClause) havingClause).getConditionalExpression(); for (Iterator<Bucket> bucketIterator = buckets.getBuckets().iterator(); bucketIterator.hasNext();) { InternalAggregations internalAgg = (InternalAggregations) bucketIterator.next().getAggregations(); if (!isValidBucket(internalAgg, query, conditionalExpression)) { bucketIterator.remove(); } } } return buckets; }
addHavingClause(((HavingClause) selectStatement.getHavingClause()).getConditionalExpression(), termsBuilder, entityMetadata);