Search in sources :

Example 11 with MultipleSubqueryInitiatorImpl

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

the class WhereOrBuilderImpl method whereSubqueries.

@Override
public MultipleSubqueryInitiator<RestrictionBuilder<WhereOrBuilder<T>>> whereSubqueries(String expression) {
    Expression expr = expressionFactory.createSimpleExpression(expression, true);
    RestrictionBuilderImpl<WhereOrBuilder<T>> restrictionBuilder = startBuilder(new RestrictionBuilderImpl<WhereOrBuilder<T>>(this, this, subqueryInitFactory, expressionFactory, parameterManager, ClauseType.WHERE));
    // 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<WhereOrBuilder<T>>> initiator = new MultipleSubqueryInitiatorImpl<RestrictionBuilder<WhereOrBuilder<T>>>(restrictionBuilder, expr, new RestrictionBuilderExpressionBuilderListener(restrictionBuilder), subqueryInitFactory, ClauseType.WHERE);
    return initiator;
}
Also used : WhereOrBuilder(com.blazebit.persistence.WhereOrBuilder) 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 12 with MultipleSubqueryInitiatorImpl

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

the class WhereOrBuilderImpl method whereExpressionSubqueries.

@Override
public MultipleSubqueryInitiator<WhereOrBuilder<T>> whereExpressionSubqueries(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<WhereOrBuilder<T>> initiator = new MultipleSubqueryInitiatorImpl<WhereOrBuilder<T>>(this, predicate, new ExpressionBuilderEndedListener() {

        @Override
        public void onBuilderEnded(ExpressionBuilder builder) {
            WhereOrBuilderImpl.this.predicate.getChildren().add((Predicate) builder.getExpression());
            currentMultipleSubqueryInitiator = null;
        }
    }, subqueryInitFactory, ClauseType.WHERE);
    currentMultipleSubqueryInitiator = initiator;
    return initiator;
}
Also used : ExpressionBuilderEndedListener(com.blazebit.persistence.impl.builder.expression.ExpressionBuilderEndedListener) WhereOrBuilder(com.blazebit.persistence.WhereOrBuilder) 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 13 with MultipleSubqueryInitiatorImpl

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

the class RestrictionBuilderImpl method inSubqueries.

private MultipleSubqueryInitiator<T> inSubqueries(String expression, boolean negated) {
    verifyBuilderEnded();
    Expression expr = expressionFactory.createSimpleExpression(expression, true);
    this.predicate = new InPredicate(negated, leftExpression);
    return new MultipleSubqueryInitiatorImpl<T>(result, expr, new ExpressionBuilderEndedListener() {

        @Override
        public void onBuilderEnded(ExpressionBuilder builder) {
            onSubqueryBuilderEnded(builder.getExpression());
            listener.onBuilderEnded(RestrictionBuilderImpl.this);
        }
    }, subqueryInitFactory, clause);
}
Also used : ExpressionBuilderEndedListener(com.blazebit.persistence.impl.builder.expression.ExpressionBuilderEndedListener) Expression(com.blazebit.persistence.parser.expression.Expression) ParameterExpression(com.blazebit.persistence.parser.expression.ParameterExpression) PathExpression(com.blazebit.persistence.parser.expression.PathExpression) SubqueryExpression(com.blazebit.persistence.parser.expression.SubqueryExpression) MultipleSubqueryInitiatorImpl(com.blazebit.persistence.impl.MultipleSubqueryInitiatorImpl) InPredicate(com.blazebit.persistence.parser.predicate.InPredicate) ExpressionBuilder(com.blazebit.persistence.impl.builder.expression.ExpressionBuilder)

Example 14 with MultipleSubqueryInitiatorImpl

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

the class WhereAndBuilderImpl method whereSubqueries.

@Override
public MultipleSubqueryInitiator<RestrictionBuilder<WhereAndBuilder<T>>> whereSubqueries(String expression) {
    Expression expr = expressionFactory.createSimpleExpression(expression, true);
    RestrictionBuilderImpl<WhereAndBuilder<T>> restrictionBuilder = startBuilder(new RestrictionBuilderImpl<WhereAndBuilder<T>>(this, this, subqueryInitFactory, expressionFactory, parameterManager, ClauseType.WHERE));
    // 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<WhereAndBuilder<T>>> initiator = new MultipleSubqueryInitiatorImpl<RestrictionBuilder<WhereAndBuilder<T>>>(restrictionBuilder, expr, new RestrictionBuilderExpressionBuilderListener(restrictionBuilder), subqueryInitFactory, ClauseType.WHERE);
    return initiator;
}
Also used : Expression(com.blazebit.persistence.parser.expression.Expression) MultipleSubqueryInitiatorImpl(com.blazebit.persistence.impl.MultipleSubqueryInitiatorImpl) WhereAndBuilder(com.blazebit.persistence.WhereAndBuilder) RestrictionBuilderExpressionBuilderListener(com.blazebit.persistence.impl.RestrictionBuilderExpressionBuilderListener) RestrictionBuilder(com.blazebit.persistence.RestrictionBuilder)

Example 15 with MultipleSubqueryInitiatorImpl

use of com.blazebit.persistence.impl.MultipleSubqueryInitiatorImpl 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)

Aggregations

MultipleSubqueryInitiatorImpl (com.blazebit.persistence.impl.MultipleSubqueryInitiatorImpl)19 ExpressionBuilder (com.blazebit.persistence.impl.builder.expression.ExpressionBuilder)11 ExpressionBuilderEndedListener (com.blazebit.persistence.impl.builder.expression.ExpressionBuilderEndedListener)11 Expression (com.blazebit.persistence.parser.expression.Expression)9 CompoundPredicate (com.blazebit.persistence.parser.predicate.CompoundPredicate)8 ExistsPredicate (com.blazebit.persistence.parser.predicate.ExistsPredicate)8 Predicate (com.blazebit.persistence.parser.predicate.Predicate)8 RestrictionBuilder (com.blazebit.persistence.RestrictionBuilder)7 RestrictionBuilderExpressionBuilderListener (com.blazebit.persistence.impl.RestrictionBuilderExpressionBuilderListener)7 HavingAndBuilder (com.blazebit.persistence.HavingAndBuilder)2 HavingOrBuilder (com.blazebit.persistence.HavingOrBuilder)2 JoinOnAndBuilder (com.blazebit.persistence.JoinOnAndBuilder)2 JoinOnBuilder (com.blazebit.persistence.JoinOnBuilder)2 JoinOnOrBuilder (com.blazebit.persistence.JoinOnOrBuilder)2 WhereAndBuilder (com.blazebit.persistence.WhereAndBuilder)2 WhereOrBuilder (com.blazebit.persistence.WhereOrBuilder)2 ParameterExpression (com.blazebit.persistence.parser.expression.ParameterExpression)1 PathExpression (com.blazebit.persistence.parser.expression.PathExpression)1 SubqueryExpression (com.blazebit.persistence.parser.expression.SubqueryExpression)1 BetweenPredicate (com.blazebit.persistence.parser.predicate.BetweenPredicate)1