@Override public DefaultOrmQuery<T> where(Expression expression) { where().add(expression); return this; }
/** {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public void apply(Expression expr) { if (expr instanceof HavingExpression) { ExpressionList having = expressionList.query().having(); ((HavingExpression) expr).getExpressionList().forEach(having::add); return; } else if (expr instanceof TextExpression) { TextExpression expression = (TextExpression) expr; ExpressionList et = expressionList.query().text(); expression.getExpressionList().forEach(et::add); return; } else if (expr instanceof DistinctExpression) { expressionList.setDistinct(((DistinctExpression) expr).distinct); return; } else if (expr instanceof AbstractTextExpression) { expressionList.setUseDocStore(true); } else if (expr instanceof FilterExpression) { FilterExpression filter = (FilterExpression) expr; Query query = expressionList.query(); query.filterMany(filter.getPath()).addAll(filter); return; } expressionList.add(expr); } }
@Override public DefaultOrmQuery<T> having(Expression expression) { having().add(expression); return this; }
private void addLike(boolean caseInsensitive, LikeType likeType, String path, Object bindValue) { peekExprList().add(owner.like(caseInsensitive, likeType, path, bindValue)); }
/** * Define the select and joins for this query. */ @SuppressWarnings("unchecked") public void configureBeanQuery(SpiQuery<?> query) { if (trimmedProperties != null && !trimmedProperties.isEmpty()) { query.select(trimmedProperties); } if (filterMany != null) { SpiExpressionList<?> trimPath = filterMany.trimPath(path.length() + 1); List<SpiExpression> underlyingList = trimPath.getUnderlyingList(); for (SpiExpression spiExpression : underlyingList) { query.where().add(spiExpression); } } if (secondaryChildren != null) { int trimPath = path.length() + 1; for (OrmQueryProperties p : secondaryChildren) { String path = p.getPath(); path = path.substring(trimPath); query.fetch(path, p.getProperties(), p.getFetchConfig()); query.setFilterMany(path, p.getFilterManyTrimPath(trimPath)); } } if (orderBy != null) { query.setOrder(orderBy.copyWithTrim(path)); } }
@Override public DefaultOrmQuery<T> having(Expression expression) { having().add(expression); return this; }
/** * Finalizes the given {@link ExpressionList} and applies the given sort. */ @Override protected final Query complete(Expression expression, Sort sort) { return root.add(expression).query(); }
@Override public DefaultOrmQuery<T> where(Expression expression) { where().add(expression); return this; }
/** * Finalizes the given {@link ExpressionList} and applies the given sort. */ @Override protected final Query complete(Expression expression, Sort sort) { return root.add(expression).query(); }
private void addLike(boolean caseInsensitive, LikeType likeType, String path, Object bindValue) { peekExprList().add(owner.like(caseInsensitive, likeType, path, bindValue)); }
case EQ: if (isString && ignoreCase) { expressionList.add(Expr.ieq(param, (String) value)); } else { expressionList.add(Expr.eq(param, value)); expressionList.add(Expr.ne(param, value)); break; case GE: expressionList.add(Expr.ge(param, value)); break; case GT: expressionList.add(Expr.gt(param, value)); break; case LE: expressionList.add(Expr.le(param, value)); break; case LT: expressionList.add(Expr.lt(param, value)); break; case LIKE: if (isString) { if (ignoreCase) { expressionList.add(Expr.ilike(param, (String) value)); } else { expressionList.add(Expr.like(param, (String) value)); if (isString) { if (ignoreCase) {
case EQ: if (isString && ignoreCase) { expressionList.add(Expr.ieq(param, (String) value)); } else { expressionList.add(Expr.eq(param, value)); expressionList.add(Expr.ne(param, value)); break; case GE: expressionList.add(Expr.ge(param, value)); break; case GT: expressionList.add(Expr.gt(param, value)); break; case LE: expressionList.add(Expr.le(param, value)); break; case LT: expressionList.add(Expr.lt(param, value)); break; case LIKE: if (isString) { if (ignoreCase) { expressionList.add(Expr.ilike(param, (String) value)); } else { expressionList.add(Expr.like(param, (String) value)); if (isString) { if (ignoreCase) {
/** * <p>fillArgs.</p> * * @param operator a {@link java.lang.String} object. * @param args an array of {@link ameba.db.dsl.QueryExprMeta.Val} objects. * @param et a {@link io.ebean.ExpressionList} object. */ public static void fillArgs(String operator, Val<Expression>[] args, ExpressionList<?> et) { for (Val<Expression> val : args) { if (val.object() instanceof Expression) { et.add(val.expr()); } else { throw new QuerySyntaxException(Messages.get("dsl.arguments.error3", operator)); } } }
/** * Define the select and joins for this query. */ @SuppressWarnings("unchecked") public void configureBeanQuery(SpiQuery<?> query) { if (trimmedProperties != null && !trimmedProperties.isEmpty()) { query.select(trimmedProperties); } if (filterMany != null) { SpiExpressionList<?> trimPath = filterMany.trimPath(path.length() + 1); List<SpiExpression> underlyingList = trimPath.getUnderlyingList(); for (SpiExpression spiExpression : underlyingList) { query.where().add(spiExpression); } } if (secondaryChildren != null) { int trimPath = path.length() + 1; for (OrmQueryProperties p : secondaryChildren) { String path = p.getPath(); path = path.substring(trimPath); query.fetch(path, p.getProperties(), p.getFetchConfig()); query.setFilterMany(path, p.getFilterManyTrimPath(trimPath)); } } if (orderBy != null) { query.setOrder(orderBy.copyWithTrim(path)); } }
et.setDistinct(((DistinctExpression) o).distinct); } else if (o instanceof Expression) { et.add(args[i].expr()); } else { throw new QuerySyntaxException(Messages.get("dsl.arguments.error3", operator));