use of com.blazebit.persistence.parser.predicate.InPredicate in project blaze-persistence by Blazebit.
the class GeneralParserTest method testInParameterNoParenthesis.
@Test
public void testInParameterNoParenthesis() {
GeneralCaseExpression result = (GeneralCaseExpression) parse("CASE WHEN a.x IN :abc THEN 0 ELSE 1 END");
GeneralCaseExpression expected = new GeneralCaseExpression(Arrays.asList(new WhenClauseExpression(new InPredicate(path("a", "x"), new ParameterExpression("abc", null, true)), _int("0"))), _int("1"));
assertEquals(expected, result);
}
use of com.blazebit.persistence.parser.predicate.InPredicate in project blaze-persistence by Blazebit.
the class GeneralParserTest method testInNumericLiterals.
@Test
public void testInNumericLiterals() {
GeneralCaseExpression result = (GeneralCaseExpression) parse("CASE WHEN a.x IN (1, 2, 3, 4) THEN 0 ELSE 1 END");
GeneralCaseExpression expected = new GeneralCaseExpression(Arrays.asList(new WhenClauseExpression(new InPredicate(path("a", "x"), _int("1"), _int("2"), _int("3"), _int("4")), _int("0"))), _int("1"));
assertEquals(expected, result);
}
use of com.blazebit.persistence.parser.predicate.InPredicate in project blaze-persistence by Blazebit.
the class GeneralParserTest method testInCharacterLiterals.
@Test
public void testInCharacterLiterals() {
GeneralCaseExpression result = (GeneralCaseExpression) parse("CASE WHEN a.x IN ('1', '2', '3', '4') THEN 0 ELSE 1 END");
GeneralCaseExpression expected = new GeneralCaseExpression(Arrays.asList(new WhenClauseExpression(new InPredicate(path("a", "x"), _string("1"), _string("2"), _string("3"), _string("4")), _int("0"))), _int("1"));
assertEquals(expected, result);
}
use of com.blazebit.persistence.parser.predicate.InPredicate in project blaze-persistence by Blazebit.
the class RestrictionBuilderImpl method notInCollectionExpression.
@Override
public T notInCollectionExpression(String collectionParameterExpression) {
if (collectionParameterExpression == null) {
throw new NullPointerException("collectionParameterExpression");
}
ParameterExpression collectionParameter = (ParameterExpression) expressionFactory.createInItemExpression(collectionParameterExpression);
collectionParameter.setCollectionValued(true);
return chain(new InPredicate(true, leftExpression, collectionParameter));
}
use of com.blazebit.persistence.parser.predicate.InPredicate in project blaze-persistence by Blazebit.
the class RestrictionBuilderImpl method in.
private SubqueryBuilder<T> in(String subqueryAlias, String expression, boolean negated, FullQueryBuilder<?, ?> criteriaBuilder) {
verifyBuilderEnded();
this.predicate = new InPredicate(negated, leftExpression);
Expression superExpression = expressionFactory.createSimpleExpression(expression);
rightSuperExprSubqueryBuilderListener = new SuperExpressionSubqueryBuilderListener<T>(subqueryAlias, superExpression) {
@Override
public void onBuilderEnded(SubqueryInternalBuilder<T> builder) {
super.onBuilderEnded(builder);
onSubqueryBuilderEnded(superExpression);
listener.onBuilderEnded(RestrictionBuilderImpl.this);
}
};
return subqueryInitFactory.createSubqueryBuilder(result, rightSuperExprSubqueryBuilderListener, false, criteriaBuilder, clause);
}
Aggregations