/** * @since 4.0 * @see ExpressionFactory#likeIgnoreCaseExp(String, Object) */ static Expression likeIgnoreCaseExp(Expression exp, Object value) { return likeIgnoreCaseExp(exp, value, (char) 0); }
/** * @since 4.0 * @see ExpressionFactory#startsWithIgnoreCaseExp(String, String) */ static Expression startsWithIgnoreCaseExp(Expression exp, String value) { ASTLikeIgnoreCase like = likeIgnoreCaseExp(exp, value, (char) 0); LikeExpressionHelper.toStartsWith(like); return like; }
/** * @since 4.0 * @see ExpressionFactory#endsWithIgnoreCaseExp(String, String) */ static Expression endsWithIgnoreCaseExp(Expression exp, String value) { ASTLikeIgnoreCase like = likeIgnoreCaseExp(exp, value, (char) 0); LikeExpressionHelper.toEndsWith(like); return like; }
/** * @since 4.0 * @see ExpressionFactory#containsIgnoreCaseExp(String, String) */ static Expression containsIgnoreCaseExp(Expression exp, String value) { ASTLikeIgnoreCase like = likeIgnoreCaseExp(exp, value, (char) 0); LikeExpressionHelper.toContains(like); return like; }
/** * @return An expression for a case insensitive "LIKE" query. */ public Expression likeIgnoreCase(String pattern) { return ExpressionFactory.likeIgnoreCaseExp(getExpression(), pattern); }
static ASTLikeIgnoreCase likeIgnoreCaseExpInternal(String pathSpec, Object value, char escapeChar) { return likeIgnoreCaseExp(new ASTObjPath(pathSpec), value, escapeChar); }
public Optional<Expression> filter(SelectContext<?> context, String queryProperty, String value) { if (value == null || value.length() == 0 || queryProperty == null) { return Optional.empty(); } AgEntity<?> entity = context.getEntity().getAgEntity(); validateAttribute(entity, queryProperty); value = FilterUtil.escapeValueForLike(value) + "%"; return Optional.of(ExpressionFactory.likeIgnoreCaseExp(queryProperty, value)); }
Expression like(Filter filter) { if (filter.getValue() == null || filter.isExactMatch() || filter.getValue() instanceof Boolean) { return eq(filter); } String string = filter.getValue().toString(); checkValueLength(string); string = FilterUtil.escapeValueForLike(string) + "%"; return likeIgnoreCaseExp(filter.getProperty(), string); }
public void addLike(String fieldName, Object value, boolean caseSensetive) { ObjEntityViewField field = queryTarget.getField(fieldName); String path = null; if (field.getCalcType().getValue() == CalcTypeEnum.NO_CALC_TYPE_VALUE) { path = field.getObjAttribute().getName(); } else if (field.isLookup()) { path = field.getObjRelationship().getName(); } Object rawValue = field.toRawValue(value); String pattern = (rawValue != null ? rawValue.toString() : ""); Expression expr = (caseSensetive ? ExpressionFactory.likeExp(path, pattern) : ExpressionFactory.likeIgnoreCaseExp(path, pattern)); conditions.add(expr); }
newExpression = ExpressionFactory.likeIgnoreCaseExp(key, val); } else if (filter.getAnyMatch()) { newExpression = ExpressionFactory.likeIgnoreCaseExp(key, "%" + val + "%"); } else { newExpression = ExpressionFactory.likeIgnoreCaseExp(key, val + "%");