Search in sources :

Example 1 with HavingOrBuilder

use of com.blazebit.persistence.HavingOrBuilder in project blaze-persistence by Blazebit.

the class HavingOrBuilderImpl method havingSubquery.

@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
public SubqueryInitiator<RestrictionBuilder<HavingOrBuilder<T>>> havingSubquery(String subqueryAlias, String expression) {
    Expression expr = expressionFactory.createSimpleExpression(expression, true);
    superExprLeftSubqueryPredicateBuilderListener = new SuperExpressionLeftHandsideSubqueryPredicateBuilder(subqueryAlias, expr);
    RestrictionBuilder<HavingOrBuilder<T>> restrictionBuilder = startBuilder(new RestrictionBuilderImpl<HavingOrBuilder<T>>(this, this, subqueryInitFactory, expressionFactory, parameterManager, ClauseType.HAVING));
    return subqueryInitFactory.createSubqueryInitiator(restrictionBuilder, superExprLeftSubqueryPredicateBuilderListener, false, ClauseType.HAVING);
}
Also used : HavingOrBuilder(com.blazebit.persistence.HavingOrBuilder) Expression(com.blazebit.persistence.parser.expression.Expression)

Example 2 with HavingOrBuilder

use of com.blazebit.persistence.HavingOrBuilder in project blaze-persistence by Blazebit.

the class HavingOrBuilderImpl method havingSubqueries.

@Override
public MultipleSubqueryInitiator<RestrictionBuilder<HavingOrBuilder<T>>> havingSubqueries(String expression) {
    Expression expr = expressionFactory.createSimpleExpression(expression, true);
    RestrictionBuilderImpl<HavingOrBuilder<T>> restrictionBuilder = startBuilder(new RestrictionBuilderImpl<HavingOrBuilder<T>>(this, this, subqueryInitFactory, expressionFactory, parameterManager, ClauseType.HAVING));
    // We don't need a listener or marker here, because the resulting restriction builder can only be ended, when the initiator is ended
    MultipleSubqueryInitiator<RestrictionBuilder<HavingOrBuilder<T>>> initiator = new MultipleSubqueryInitiatorImpl<RestrictionBuilder<HavingOrBuilder<T>>>(restrictionBuilder, expr, new RestrictionBuilderExpressionBuilderListener(restrictionBuilder), subqueryInitFactory, ClauseType.HAVING);
    return initiator;
}
Also used : HavingOrBuilder(com.blazebit.persistence.HavingOrBuilder) Expression(com.blazebit.persistence.parser.expression.Expression) MultipleSubqueryInitiatorImpl(com.blazebit.persistence.impl.MultipleSubqueryInitiatorImpl) RestrictionBuilderExpressionBuilderListener(com.blazebit.persistence.impl.RestrictionBuilderExpressionBuilderListener) RestrictionBuilder(com.blazebit.persistence.RestrictionBuilder)

Example 3 with HavingOrBuilder

use of com.blazebit.persistence.HavingOrBuilder in project blaze-persistence by Blazebit.

the class HavingOrBuilderImpl method havingExpressionSubqueries.

@Override
public MultipleSubqueryInitiator<HavingOrBuilder<T>> havingExpressionSubqueries(String expression) {
    Predicate predicate = expressionFactory.createBooleanExpression(expression, true);
    // We don't need a listener or marker here, because the resulting restriction builder can only be ended, when the initiator is ended
    MultipleSubqueryInitiator<HavingOrBuilder<T>> initiator = new MultipleSubqueryInitiatorImpl<HavingOrBuilder<T>>(this, predicate, new ExpressionBuilderEndedListener() {

        @Override
        public void onBuilderEnded(ExpressionBuilder builder) {
            HavingOrBuilderImpl.this.predicate.getChildren().add((Predicate) builder.getExpression());
            currentMultipleSubqueryInitiator = null;
        }
    }, subqueryInitFactory, ClauseType.HAVING);
    currentMultipleSubqueryInitiator = initiator;
    return initiator;
}
Also used : HavingOrBuilder(com.blazebit.persistence.HavingOrBuilder) ExpressionBuilderEndedListener(com.blazebit.persistence.impl.builder.expression.ExpressionBuilderEndedListener) MultipleSubqueryInitiatorImpl(com.blazebit.persistence.impl.MultipleSubqueryInitiatorImpl) ExpressionBuilder(com.blazebit.persistence.impl.builder.expression.ExpressionBuilder) Predicate(com.blazebit.persistence.parser.predicate.Predicate) CompoundPredicate(com.blazebit.persistence.parser.predicate.CompoundPredicate) ExistsPredicate(com.blazebit.persistence.parser.predicate.ExistsPredicate)

Example 4 with HavingOrBuilder

use of com.blazebit.persistence.HavingOrBuilder in project blaze-persistence by Blazebit.

the class HavingOrBuilderImpl method havingSubquery.

@Override
public SubqueryBuilder<RestrictionBuilder<HavingOrBuilder<T>>> havingSubquery(String subqueryAlias, String expression, FullQueryBuilder<?, ?> criteriaBuilder) {
    Expression expr = expressionFactory.createSimpleExpression(expression, true);
    superExprLeftSubqueryPredicateBuilderListener = new SuperExpressionLeftHandsideSubqueryPredicateBuilder(subqueryAlias, expr);
    RestrictionBuilder<HavingOrBuilder<T>> restrictionBuilder = startBuilder(new RestrictionBuilderImpl<HavingOrBuilder<T>>(this, this, subqueryInitFactory, expressionFactory, parameterManager, ClauseType.HAVING));
    return subqueryInitFactory.createSubqueryBuilder(restrictionBuilder, superExprLeftSubqueryPredicateBuilderListener, false, criteriaBuilder, ClauseType.HAVING);
}
Also used : HavingOrBuilder(com.blazebit.persistence.HavingOrBuilder) Expression(com.blazebit.persistence.parser.expression.Expression)

Aggregations

HavingOrBuilder (com.blazebit.persistence.HavingOrBuilder)4 Expression (com.blazebit.persistence.parser.expression.Expression)3 MultipleSubqueryInitiatorImpl (com.blazebit.persistence.impl.MultipleSubqueryInitiatorImpl)2 RestrictionBuilder (com.blazebit.persistence.RestrictionBuilder)1 RestrictionBuilderExpressionBuilderListener (com.blazebit.persistence.impl.RestrictionBuilderExpressionBuilderListener)1 ExpressionBuilder (com.blazebit.persistence.impl.builder.expression.ExpressionBuilder)1 ExpressionBuilderEndedListener (com.blazebit.persistence.impl.builder.expression.ExpressionBuilderEndedListener)1 CompoundPredicate (com.blazebit.persistence.parser.predicate.CompoundPredicate)1 ExistsPredicate (com.blazebit.persistence.parser.predicate.ExistsPredicate)1 Predicate (com.blazebit.persistence.parser.predicate.Predicate)1