use of com.blazebit.persistence.RestrictionBuilder 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;
}
use of com.blazebit.persistence.RestrictionBuilder in project blaze-persistence by Blazebit.
the class FilterTest method verifyLikeFilter.
@SuppressWarnings({ "rawtypes", "unchecked" })
public RestrictionBuilder<?> verifyLikeFilter(AttributeFilterProvider<?> filter, String expression) {
WhereBuilder whereBuilder = Mockito.mock(WhereBuilder.class);
RestrictionBuilder rb = Mockito.mock(RestrictionBuilder.class, Mockito.RETURNS_DEEP_STUBS);
EscapeBuilder eb = Mockito.mock(EscapeBuilder.class);
LikeBuilder lb = Mockito.mock(LikeBuilder.class);
Mockito.when(whereBuilder.where(expression)).thenReturn(rb);
Mockito.when(rb.like()).thenReturn(lb);
Mockito.when(rb.like(false)).thenReturn(lb);
Mockito.when(lb.value("%" + value)).thenReturn(eb);
Mockito.when(lb.value(value + "%")).thenReturn(eb);
Mockito.when(lb.value("%" + value + "%")).thenReturn(eb);
Mockito.when(eb.noEscape()).thenReturn(whereBuilder);
filter.apply(whereBuilder, expression);
return rb;
}
use of com.blazebit.persistence.RestrictionBuilder 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;
}
use of com.blazebit.persistence.RestrictionBuilder 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;
}
use of com.blazebit.persistence.RestrictionBuilder 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;
}
Aggregations