Search in sources :

Example 16 with MultipleSubqueryInitiatorImpl

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

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

the class JoinOnAndBuilderImpl method onSubqueries.

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

Example 18 with MultipleSubqueryInitiatorImpl

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

the class JoinOnBuilderImpl method setOnExpressionSubqueries.

@Override
public MultipleSubqueryInitiator<T> setOnExpressionSubqueries(String expression) {
    rootPredicate.verifyBuilderEnded();
    Predicate predicate = expressionFactory.createBooleanExpression(expression, false);
    parameterManager.collectParameterRegistrations(predicate, ClauseType.JOIN, subqueryInitFactory.getQueryBuilder());
    MultipleSubqueryInitiator<T> initiator = new MultipleSubqueryInitiatorImpl<T>(result, predicate, new ExpressionBuilderEndedListener() {

        @Override
        public void onBuilderEnded(ExpressionBuilder builder) {
            List<Predicate> children = rootPredicate.getPredicate().getChildren();
            children.clear();
            children.add((Predicate) builder.getExpression());
            currentMultipleSubqueryInitiator = null;
            listener.onBuilderEnded(JoinOnBuilderImpl.this);
        }
    }, subqueryInitFactory, ClauseType.JOIN);
    currentMultipleSubqueryInitiator = initiator;
    return initiator;
}
Also used : ExpressionBuilderEndedListener(com.blazebit.persistence.impl.builder.expression.ExpressionBuilderEndedListener) MultipleSubqueryInitiatorImpl(com.blazebit.persistence.impl.MultipleSubqueryInitiatorImpl) List(java.util.List) 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 19 with MultipleSubqueryInitiatorImpl

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

the class JoinOnOrBuilderImpl method onSubqueries.

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