Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package com.avaje.ebeaninternal.util;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.avaje.ebean.Expression;
import com.avaje.ebean.ExpressionFactory;
import com.avaje.ebean.ExpressionList;
import com.avaje.ebean.FutureIds;
import com.avaje.ebean.FutureList;
import com.avaje.ebean.FutureRowCount;
import com.avaje.ebean.Junction;
import com.avaje.ebean.OrderBy;
import com.avaje.ebean.PagingList;
import com.avaje.ebean.Query;
import com.avaje.ebean.QueryIterator;
import com.avaje.ebean.QueryListener;
import com.avaje.ebean.QueryResultVisitor;
import com.avaje.ebean.event.BeanQueryRequest;
import com.avaje.ebeaninternal.api.ManyWhereJoins;
import com.avaje.ebeaninternal.api.SpiExpression;
import com.avaje.ebeaninternal.api.SpiExpressionList;
import com.avaje.ebeaninternal.api.SpiExpressionRequest;
import com.avaje.ebeaninternal.api.SpiLuceneExpr;
import com.avaje.ebeaninternal.server.deploy.BeanDescriptor;
import com.avaje.ebeaninternal.server.query.LuceneResolvableRequest;
/**
* Default implementation of ExpressionList.
*/
public class DefaultExpressionList implements SpiExpressionList {
private static final long serialVersionUID = -6992345500247035947L;
private final ArrayList list = new ArrayList();
private final Query query;
private final ExpressionList parentExprList;
private transient ExpressionFactory expr;
private final String exprLang;
private final String listAndStart;
private final String listAndEnd;
private final String listAndJoin;
public DefaultExpressionList(Query query, ExpressionList parentExprList) {
this(query, query.getExpressionFactory(), parentExprList);
}
public DefaultExpressionList(Query query, ExpressionFactory expr, ExpressionList parentExprList) {
this.query = query;
this.expr = expr;
this.exprLang = expr.getLang();
this.parentExprList = parentExprList;
if ("ldap".equals(exprLang)){
// Language is LDAP
listAndStart = "(&";
listAndEnd = ")";
listAndJoin = "";
} else {
listAndStart = "";
listAndEnd = "";
listAndJoin = " and ";
}
}
public void trimPath(int prefixTrim) {
throw new RuntimeException("Only allowed on FilterExpressionList");
}
public List internalList() {
return list;
}
public boolean isLuceneResolvable(LuceneResolvableRequest req) {
for (int i = 0; i < list.size(); i++) {
if (!list.get(i).isLuceneResolvable(req)) {
return false;
}
}
return true;
}
public SpiLuceneExpr createLuceneExpr(SpiExpressionRequest request, SpiLuceneExpr.ExprOccur occur) {
LuceneQueryList queryList = new LuceneQueryList(occur);
for (int i = 0; i < list.size(); i++) {
SpiLuceneExpr query = list.get(i).createLuceneExpr(request);
queryList.add(query);
}
return queryList;
}
/**
* Set the ExpressionFactory.
*
* After deserialisation so that it can be further modified.
*
*/
public void setExpressionFactory(ExpressionFactory expr) {
this.expr = expr;
}
/**
* Return a copy of the expression list.
*
* Each of the expressions are expected to be immutable and safe to
* reference.
*
*/
public DefaultExpressionList copy(Query query) {
DefaultExpressionList copy = new DefaultExpressionList(query, expr, null);
copy.list.addAll(list);
return copy;
}
/**
* Return true if one of the expressions is related to a Many property.
*/
public void containsMany(BeanDescriptor> desc, ManyWhereJoins whereManyJoins) {
for (int i = 0; i < list.size(); i++) {
list.get(i).containsMany(desc, whereManyJoins);
}
}
public ExpressionList endJunction() {
return parentExprList == null ? this : parentExprList;
}
public Query query() {
return query;
}
public ExpressionList where() {
return query.where();
}
public OrderBy order() {
return query.order();
}
public OrderBy orderBy() {
return query.order();
}
public Query order(String orderByClause) {
return query.order(orderByClause);
}
public Query orderBy(String orderBy) {
return query.order(orderBy);
}
public Query setOrderBy(String orderBy) {
return query.order(orderBy);
}
public FutureIds findFutureIds() {
return query.findFutureIds();
}
public FutureRowCount findFutureRowCount() {
return query.findFutureRowCount();
}
public FutureList findFutureList() {
return query.findFutureList();
}
public PagingList findPagingList(int pageSize) {
return query.findPagingList(pageSize);
}
public int findRowCount() {
return query.findRowCount();
}
public List