Search in sources :

Example 1 with WhereOrBuilder

use of com.blazebit.persistence.WhereOrBuilder 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 2 with WhereOrBuilder

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

Aggregations

WhereOrBuilder (com.blazebit.persistence.WhereOrBuilder)2 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 Expression (com.blazebit.persistence.parser.expression.Expression)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