Search in sources :

Example 11 with RestrictionBuilder

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

the class PredicateManager method restrict.

@SuppressWarnings({ "rawtypes", "unchecked" })
SubqueryInitiator<RestrictionBuilder<T>> restrict(T builder, String subqueryAlias, String expression) {
    Expression expr = expressionFactory.createSimpleExpression(expression, true);
    superExprLeftSubqueryPredicateBuilderListener = new SuperExpressionLeftHandsideSubqueryPredicateBuilder(subqueryAlias, expr);
    RestrictionBuilder<T> restrictionBuilder = (RestrictionBuilder<T>) rootPredicate.startBuilder(new RestrictionBuilderImpl<T>(builder, rootPredicate, subqueryInitFactory, expressionFactory, parameterManager, getClauseType()));
    return subqueryInitFactory.createSubqueryInitiator(restrictionBuilder, superExprLeftSubqueryPredicateBuilderListener, false, getClauseType());
}
Also used : Expression(com.blazebit.persistence.parser.expression.Expression) SuperExpressionLeftHandsideSubqueryPredicateBuilder(com.blazebit.persistence.impl.builder.predicate.SuperExpressionLeftHandsideSubqueryPredicateBuilder) RestrictionBuilderImpl(com.blazebit.persistence.impl.builder.predicate.RestrictionBuilderImpl) RestrictionBuilder(com.blazebit.persistence.RestrictionBuilder)

Example 12 with RestrictionBuilder

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

the class PredicateManager method restrictSubqueries.

MultipleSubqueryInitiator<RestrictionBuilder<T>> restrictSubqueries(T builder, String expression) {
    Expression expr = expressionFactory.createSimpleExpression(expression, true);
    @SuppressWarnings("unchecked") RestrictionBuilderImpl<T> restrictionBuilder = rootPredicate.startBuilder(new RestrictionBuilderImpl<T>(builder, rootPredicate, subqueryInitFactory, expressionFactory, parameterManager, getClauseType()));
    // 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<T>> initiator = new MultipleSubqueryInitiatorImpl<RestrictionBuilder<T>>(restrictionBuilder, expr, new RestrictionBuilderExpressionBuilderListener(restrictionBuilder), subqueryInitFactory, getClauseType());
    return initiator;
}
Also used : Expression(com.blazebit.persistence.parser.expression.Expression) RestrictionBuilder(com.blazebit.persistence.RestrictionBuilder)

Example 13 with RestrictionBuilder

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

the class PredicateManager method restrict.

@SuppressWarnings({ "rawtypes", "unchecked" })
SubqueryBuilder<RestrictionBuilder<T>> restrict(T builder, String subqueryAlias, String expression, FullQueryBuilder<?, ?> criteriaBuilder) {
    Expression expr = expressionFactory.createSimpleExpression(expression, true);
    superExprLeftSubqueryPredicateBuilderListener = new SuperExpressionLeftHandsideSubqueryPredicateBuilder(subqueryAlias, expr);
    RestrictionBuilder<T> restrictionBuilder = (RestrictionBuilder<T>) rootPredicate.startBuilder(new RestrictionBuilderImpl<T>(builder, rootPredicate, subqueryInitFactory, expressionFactory, parameterManager, getClauseType()));
    return subqueryInitFactory.createSubqueryBuilder(restrictionBuilder, superExprLeftSubqueryPredicateBuilderListener, false, criteriaBuilder, getClauseType());
}
Also used : Expression(com.blazebit.persistence.parser.expression.Expression) SuperExpressionLeftHandsideSubqueryPredicateBuilder(com.blazebit.persistence.impl.builder.predicate.SuperExpressionLeftHandsideSubqueryPredicateBuilder) RestrictionBuilderImpl(com.blazebit.persistence.impl.builder.predicate.RestrictionBuilderImpl) RestrictionBuilder(com.blazebit.persistence.RestrictionBuilder)

Aggregations

RestrictionBuilder (com.blazebit.persistence.RestrictionBuilder)13 Expression (com.blazebit.persistence.parser.expression.Expression)10 MultipleSubqueryInitiatorImpl (com.blazebit.persistence.impl.MultipleSubqueryInitiatorImpl)7 RestrictionBuilderExpressionBuilderListener (com.blazebit.persistence.impl.RestrictionBuilderExpressionBuilderListener)7 RestrictionBuilderImpl (com.blazebit.persistence.impl.builder.predicate.RestrictionBuilderImpl)4 CaseExpressionBuilderListener (com.blazebit.persistence.impl.builder.predicate.CaseExpressionBuilderListener)2 SuperExpressionLeftHandsideSubqueryPredicateBuilder (com.blazebit.persistence.impl.builder.predicate.SuperExpressionLeftHandsideSubqueryPredicateBuilder)2 EscapeBuilder (com.blazebit.persistence.EscapeBuilder)1 HavingAndBuilder (com.blazebit.persistence.HavingAndBuilder)1 HavingOrBuilder (com.blazebit.persistence.HavingOrBuilder)1 JoinOnAndBuilder (com.blazebit.persistence.JoinOnAndBuilder)1 JoinOnBuilder (com.blazebit.persistence.JoinOnBuilder)1 JoinOnOrBuilder (com.blazebit.persistence.JoinOnOrBuilder)1 LikeBuilder (com.blazebit.persistence.LikeBuilder)1 WhereAndBuilder (com.blazebit.persistence.WhereAndBuilder)1 WhereBuilder (com.blazebit.persistence.WhereBuilder)1 WhereOrBuilder (com.blazebit.persistence.WhereOrBuilder)1