no effective change - format only

This commit is contained in:
Rob Bygrave
2016-11-17 19:11:28 +13:00
parent 15973c8992
commit 983306ed86
35 changed files with 110 additions and 94 deletions
@@ -496,7 +496,7 @@ class CQueryBuilder {
String idSql = desc.getIdBinderIdSql();
if (idSql.isEmpty()) {
throw new IllegalStateException("Executing FindById query on entity bean " + desc.getName()
+ " that doesn't have an @Id property??");
+ " that doesn't have an @Id property??");
}
if (stripAlias) {
// strip the table alias for use in update statement
@@ -18,7 +18,7 @@ class CQueryDraftSupport {
/**
* Return the draft table associated to the base table.
*
* <p>
* This returns null for entities that are not draftable and in that case
* the usual base table is used.
*/
@@ -1,5 +1,6 @@
package com.avaje.ebeaninternal.server.query;
import com.avaje.ebean.QueryIterator;
import com.avaje.ebean.ValuePair;
import com.avaje.ebean.Version;
import com.avaje.ebean.bean.BeanCollection;
@@ -10,7 +11,6 @@ import com.avaje.ebean.config.dbplatform.DatabasePlatform;
import com.avaje.ebeaninternal.api.SpiQuery;
import com.avaje.ebeaninternal.server.core.DiffHelp;
import com.avaje.ebeaninternal.server.core.OrmQueryRequest;
import com.avaje.ebean.QueryIterator;
import com.avaje.ebeaninternal.server.deploy.BeanDescriptor;
import com.avaje.ebeaninternal.server.lib.util.Str;
import com.avaje.ebeaninternal.server.persist.Binder;
@@ -99,7 +99,7 @@ public class CQueryEngine {
@SuppressWarnings("unchecked")
private <A> List<A> findAttributeList(OrmQueryRequest<?> request, CQueryFetchSingleAttribute rcQuery) {
try {
List<A> list = (List<A>)rcQuery.findList();
List<A> list = (List<A>) rcQuery.findList();
if (request.isLogSql()) {
logGeneratedSql(request, rcQuery.getGeneratedSql(), rcQuery.getBindLog());
}
@@ -76,10 +76,10 @@ class CQueryFetchSingleAttribute {
protected String getSummary() {
StringBuilder sb = new StringBuilder(80);
sb.append("FindAttr exeMicros[").append(executionTimeMicros)
.append("] rows[").append(rowCount)
.append("] type[").append(desc.getName())
.append("] predicates[").append(predicates.getLogWhereSql())
.append("] bind[").append(bindLog).append("]");
.append("] rows[").append(rowCount)
.append("] type[").append(desc.getName())
.append("] predicates[").append(predicates.getLogWhereSql())
.append("] bind[").append(bindLog).append("]");
return sb.toString();
}
@@ -60,7 +60,7 @@ class CQueryHistorySupport {
/**
* Return the predicate appended to the end of the query.
*
* <p>
* Note used for Oracle total recall etc with the more standard approach.
*/
String getAsOfPredicate(String tableAlias) {
@@ -1,12 +1,11 @@
package com.avaje.ebeaninternal.server.query;
import java.sql.SQLException;
import javax.persistence.PersistenceException;
import com.avaje.ebean.QueryIterator;
import com.avaje.ebeaninternal.server.core.OrmQueryRequest;
import javax.persistence.PersistenceException;
import java.sql.SQLException;
/**
* QueryIterator that does not require a buffer for secondary queries.
*/
@@ -44,4 +43,4 @@ class CQueryIteratorSimple<T> implements QueryIterator<T> {
public void remove() {
throw new PersistenceException("Remove not allowed");
}
}
}
@@ -1,13 +1,12 @@
package com.avaje.ebeaninternal.server.query;
import java.sql.SQLException;
import java.util.ArrayList;
import javax.persistence.PersistenceException;
import com.avaje.ebean.QueryIterator;
import com.avaje.ebeaninternal.server.core.OrmQueryRequest;
import javax.persistence.PersistenceException;
import java.sql.SQLException;
import java.util.ArrayList;
/**
* A QueryIterator that uses a buffer to execute secondary queries periodically.
*/
@@ -64,4 +63,4 @@ class CQueryIteratorWithBuffer<T> implements QueryIterator<T> {
public void remove() {
throw new PersistenceException("Remove not allowed");
}
}
}
@@ -1,7 +1,5 @@
package com.avaje.ebeaninternal.server.query;
import java.util.List;
import com.avaje.ebean.OrderBy;
import com.avaje.ebean.OrderBy.Property;
import com.avaje.ebeaninternal.api.SpiQuery;
@@ -11,6 +9,8 @@ import com.avaje.ebeaninternal.server.deploy.BeanPropertyAssoc;
import com.avaje.ebeaninternal.server.deploy.id.IdBinder;
import com.avaje.ebeaninternal.server.el.ElPropertyValue;
import java.util.List;
/**
* Creates the order by expression clause.
*/
@@ -5,11 +5,11 @@ import com.avaje.ebean.config.dbplatform.SqlLimitResponse;
import com.avaje.ebeaninternal.api.CQueryPlanKey;
import com.avaje.ebeaninternal.api.SpiEbeanServer;
import com.avaje.ebeaninternal.server.core.OrmQueryRequest;
import com.avaje.ebeaninternal.server.core.timezone.DataTimeZone;
import com.avaje.ebeaninternal.server.deploy.BeanProperty;
import com.avaje.ebeaninternal.server.query.CQueryPlanStats.Snapshot;
import com.avaje.ebeaninternal.server.type.DataBind;
import com.avaje.ebeaninternal.server.type.DataReader;
import com.avaje.ebeaninternal.server.core.timezone.DataTimeZone;
import com.avaje.ebeaninternal.server.type.RsetDataReader;
import com.avaje.ebeaninternal.server.util.Md5;
import org.slf4j.Logger;
@@ -101,7 +101,7 @@ public class CQueryPlan {
* Create a query plan for a raw sql query.
*/
CQueryPlan(OrmQueryRequest<?> request, String sql, SqlTree sqlTree,
boolean rawSql, boolean rowNumberIncluded, String logWhereSql) {
boolean rawSql, boolean rowNumberIncluded, String logWhereSql) {
this.server = request.getServer();
this.dataTimeZone = server.getDataTimeZone();
@@ -173,7 +173,7 @@ public final class CQueryPlanStats {
private final List<MetaQueryPlanOriginCount> origins;
Snapshot(CQueryPlan queryPlan, long count, long totalTime, long totalBeans, long maxTime, long startTime, long lastQueryTime,
List<MetaQueryPlanOriginCount> origins) {
List<MetaQueryPlanOriginCount> origins) {
this.queryPlan = queryPlan;
this.count = count;
@@ -187,7 +187,7 @@ public final class CQueryPlanStats {
public String toString() {
return queryPlan + " count:" + count + " time:" + totalTime + " maxTime:" + maxTime + " beans:" + totalBeans
+ " start:" + startTime + " lastQuery:" + lastQueryTime + " origins:" + origins;
+ " start:" + startTime + " lastQuery:" + lastQueryTime + " origins:" + origins;
}
@Override
@@ -257,4 +257,4 @@ public final class CQueryPlanStats {
}
}
}
@@ -114,7 +114,7 @@ public class CQueryPredicates {
this.idValue = query.getId();
}
public String bind(PreparedStatement stmt, Connection connection) throws SQLException {
public String bind(PreparedStatement stmt, Connection connection) throws SQLException {
return bind(binder.dataBind(stmt, connection));
}
@@ -70,10 +70,10 @@ class CQueryRowCount {
//noinspection StringBufferReplaceableByString
StringBuilder sb = new StringBuilder(80);
sb.append("FindRowCount exeMicros[").append(executionTimeMicros)
.append("] rows[").append(rowCount)
.append("] type[").append(desc.getFullName())
.append("] predicates[").append(predicates.getLogWhereSql())
.append("] bind[").append(bindLog).append("]");
.append("] rows[").append(rowCount)
.append("] type[").append(desc.getFullName())
.append("] predicates[").append(predicates.getLogWhereSql())
.append("] bind[").append(bindLog).append("]");
return sb.toString();
}
@@ -62,10 +62,10 @@ class CQueryUpdate {
public String getSummary() {
StringBuilder sb = new StringBuilder(80);
sb.append(type).append(" exeMicros[").append(executionTimeMicros)
.append("] rows[").append(rowCount)
.append("] type[").append(desc.getName())
.append("] predicates[").append(predicates.getLogWhereSql())
.append("] bind[").append(bindLog).append("]");
.append("] rows[").append(rowCount)
.append("] type[").append(desc.getName())
.append("] predicates[").append(predicates.getLogWhereSql())
.append("] bind[").append(bindLog).append("]");
return sb.toString();
}
@@ -1,12 +1,12 @@
package com.avaje.ebeaninternal.server.query;
import java.util.List;
import java.util.concurrent.Callable;
import com.avaje.ebean.Transaction;
import com.avaje.ebeaninternal.api.SpiEbeanServer;
import com.avaje.ebeaninternal.api.SpiQuery;
import java.util.List;
import java.util.concurrent.Callable;
/**
* Represent the fetch Id's query as a Callable.
*
@@ -1,12 +1,12 @@
package com.avaje.ebeaninternal.server.query;
import java.util.List;
import java.util.concurrent.Callable;
import com.avaje.ebean.Transaction;
import com.avaje.ebeaninternal.api.SpiEbeanServer;
import com.avaje.ebeaninternal.api.SpiQuery;
import java.util.List;
import java.util.concurrent.Callable;
/**
* Represent the findList query as a Callable.
*
@@ -1,11 +1,11 @@
package com.avaje.ebeaninternal.server.query;
import java.util.concurrent.Callable;
import com.avaje.ebean.Transaction;
import com.avaje.ebeaninternal.api.SpiEbeanServer;
import com.avaje.ebeaninternal.api.SpiQuery;
import java.util.concurrent.Callable;
/**
* Represent the findRowCount query as a Callable.
*
@@ -55,7 +55,7 @@ class DefaultDbSqlContext implements DbSqlContext {
* Construct for SELECT clause (with column alias settings).
*/
DefaultDbSqlContext(SqlTreeAlias alias, String tableAliasPlaceHolder,
String columnAliasPrefix, boolean alwaysUseColumnAlias, CQueryHistorySupport historySupport, CQueryDraftSupport draftSupport) {
String columnAliasPrefix, boolean alwaysUseColumnAlias, CQueryHistorySupport historySupport, CQueryDraftSupport draftSupport) {
this.alias = alias;
this.tableAliasPlaceHolder = tableAliasPlaceHolder;
@@ -136,15 +136,15 @@ class DefaultDbSqlContext implements DbSqlContext {
if (i > 0) {
sb.append(" and ");
}
if (pair.getForeignSqlFormula() != null) {
sb.append(StringHelper.replaceString(pair.getForeignSqlFormula(), tableAliasPlaceHolder, a2));
} else {
sb.append(a2).append(".").append(pair.getForeignDbColumn());
}
sb.append(" = ");
if (pair.getLocalSqlFormula() != null) {
sb.append(StringHelper.replaceString(pair.getLocalSqlFormula(), tableAliasPlaceHolder, a1));
} else {
@@ -251,11 +251,11 @@ class DefaultDbSqlContext implements DbSqlContext {
String tableAlias = tableAliasStack.peek();
String converted = StringHelper.replaceString(sqlFormulaSelect, tableAliasPlaceHolder,
tableAlias);
tableAlias);
sb.append(COMMA);
sb.append(converted);
appendColumnAlias();
}
@@ -1,5 +1,9 @@
package com.avaje.ebeaninternal.server.query;
import com.avaje.ebean.SqlQuery;
import com.avaje.ebean.SqlRow;
import com.avaje.ebeaninternal.server.core.BasicTypeConverter;
import java.math.BigDecimal;
import java.sql.Date;
import java.sql.Timestamp;
@@ -10,10 +14,6 @@ import java.util.Map;
import java.util.Set;
import java.util.UUID;
import com.avaje.ebean.SqlQuery;
import com.avaje.ebean.SqlRow;
import com.avaje.ebeaninternal.server.core.BasicTypeConverter;
/**
* Used to return raw SQL query results.
* <p>
@@ -1,15 +1,14 @@
package com.avaje.ebeaninternal.server.query;
import java.util.List;
import java.util.concurrent.Future;
import javax.persistence.PersistenceException;
import com.avaje.ebean.EbeanServer;
import com.avaje.ebean.PagedList;
import com.avaje.ebeaninternal.api.Monitor;
import com.avaje.ebeaninternal.api.SpiQuery;
import javax.persistence.PersistenceException;
import java.util.List;
import java.util.concurrent.Future;
/**
* PagedList implementation based on limit offset types of queries.
*
@@ -1,16 +1,15 @@
package com.avaje.ebeaninternal.server.query;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import com.avaje.ebean.FutureList;
import com.avaje.ebean.Query;
import com.avaje.ebean.Transaction;
import javax.persistence.PersistenceException;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
/**
* Default implementation for FutureList.
@@ -1,11 +1,11 @@
package com.avaje.ebeaninternal.server.query;
import java.util.concurrent.FutureTask;
import com.avaje.ebean.FutureRowCount;
import com.avaje.ebean.Query;
import com.avaje.ebean.Transaction;
import java.util.concurrent.FutureTask;
/**
* Future implementation for the row count query.
*/
@@ -58,8 +58,8 @@ public class SqlBeanLoad {
}
if ((bean == null)
|| (lazyLoading && ebi.isLoadedProperty(prop.getPropertyIndex()))
|| (type != null && !prop.isAssignableFrom(type))) {
|| (lazyLoading && ebi.isLoadedProperty(prop.getPropertyIndex()))
|| (type != null && !prop.isAssignableFrom(type))) {
// ignore this property
// ... null: bean already in persistence context
@@ -49,7 +49,7 @@ class SqlTree {
* Create the SqlSelectClause.
*/
SqlTree(String summary, SqlTreeNode rootNode, String selectSql, String fromSql, String groupBy, String inheritanceWhereSql,
BeanProperty[] encryptedProps, BeanPropertyAssocMany<?> manyProperty, Set<String> includes, boolean includeJoins) {
BeanProperty[] encryptedProps, BeanPropertyAssocMany<?> manyProperty, Set<String> includes, boolean includeJoins) {
this.summary = summary;
this.rootNode = rootNode;
@@ -142,7 +142,7 @@ public class SqlTreeBuilder {
boolean includeJoins = alias != null && alias.isIncludeJoins();
return new SqlTree(summary.toString(), rootNode, selectSql, fromSql, groupBy, inheritanceWhereSql, encryptedProps,
manyProperty, queryDetail.getFetchPaths(), includeJoins);
manyProperty, queryDetail.getFetchPaths(), includeJoins);
}
private String buildSelectClause() {
@@ -89,7 +89,7 @@ class SqlTreeNodeBean implements SqlTreeNode {
* Construct for leaf node.
*/
SqlTreeNodeBean(String prefix, BeanPropertyAssoc<?> beanProp, SqlTreeProperties props,
List<SqlTreeNode> myChildren, boolean disableLazyLoad) {
List<SqlTreeNode> myChildren, boolean disableLazyLoad) {
this(prefix, beanProp, beanProp.getTargetDescriptor(), props, myChildren, true, null, SpiQuery.TemporalMode.CURRENT, disableLazyLoad);
}
@@ -98,7 +98,7 @@ class SqlTreeNodeBean implements SqlTreeNode {
* Construct for root node.
*/
SqlTreeNodeBean(BeanDescriptor<?> desc, SqlTreeProperties props, List<SqlTreeNode> myList, boolean withId,
BeanPropertyAssocMany<?> many, SpiQuery.TemporalMode temporalMode, boolean disableLazyLoad) {
BeanPropertyAssocMany<?> many, SpiQuery.TemporalMode temporalMode, boolean disableLazyLoad) {
this(null, null, desc, props, myList, withId, many, temporalMode, disableLazyLoad);
}
@@ -19,7 +19,7 @@ final class SqlTreeNodeRoot extends SqlTreeNodeBean {
* Specify for SqlSelect to include an Id property or not.
*/
SqlTreeNodeRoot(BeanDescriptor<?> desc, SqlTreeProperties props, List<SqlTreeNode> myList, boolean withId,
TableJoin includeJoin, BeanPropertyAssocMany<?> many, SpiQuery.TemporalMode temporalMode, boolean disableLazyLoad) {
TableJoin includeJoin, BeanPropertyAssocMany<?> many, SpiQuery.TemporalMode temporalMode, boolean disableLazyLoad) {
super(desc, props, myList, withId, many, temporalMode, disableLazyLoad);
this.includeJoin = includeJoin;
@@ -82,7 +82,7 @@ public class SqlTreeProperties {
aggregation = true;
manyWhereJoins.addAggregationJoin(joinProperty);
return false;
} else{
} else {
return manyWhereJoins.requireSqlDistinct();
}
}
@@ -1,7 +1,24 @@
package com.avaje.ebeaninternal.server.querydefn;
import com.avaje.ebean.*;
import com.avaje.ebean.EbeanServer;
import com.avaje.ebean.Expression;
import com.avaje.ebean.ExpressionFactory;
import com.avaje.ebean.ExpressionList;
import com.avaje.ebean.FetchConfig;
import com.avaje.ebean.FetchPath;
import com.avaje.ebean.FutureIds;
import com.avaje.ebean.FutureList;
import com.avaje.ebean.FutureRowCount;
import com.avaje.ebean.OrderBy;
import com.avaje.ebean.OrderBy.Property;
import com.avaje.ebean.PagedList;
import com.avaje.ebean.PersistenceContextScope;
import com.avaje.ebean.Query;
import com.avaje.ebean.QueryEachConsumer;
import com.avaje.ebean.QueryEachWhileConsumer;
import com.avaje.ebean.QueryIterator;
import com.avaje.ebean.RawSql;
import com.avaje.ebean.Version;
import com.avaje.ebean.bean.CallStack;
import com.avaje.ebean.bean.ObjectGraphNode;
import com.avaje.ebean.bean.ObjectGraphOrigin;
@@ -135,7 +152,7 @@ public class DefaultOrmQuery<T> implements SpiQuery<T> {
*/
private Object id;
private Map<String,ONamedParam> namedParams;
private Map<String, ONamedParam> namedParams;
/**
* Bind parameters when using the query language.
@@ -874,9 +891,9 @@ public class DefaultOrmQuery<T> implements SpiQuery<T> {
CQueryPlanKey createQueryPlanKey() {
queryPlanKey = new OrmQueryPlanKey(m2mIncludeJoin, type, detail, maxRows, firstRow,
disableLazyLoading, orderBy,
distinct, sqlDistinct, mapKey, id, bindParams, whereExpressions, havingExpressions,
temporalMode, forUpdate, rootTableAlias, rawSql, updateProperties);
disableLazyLoading, orderBy,
distinct, sqlDistinct, mapKey, id, bindParams, whereExpressions, havingExpressions,
temporalMode, forUpdate, rootTableAlias, rawSql, updateProperties);
return queryPlanKey;
}
@@ -985,7 +1002,7 @@ public class DefaultOrmQuery<T> implements SpiQuery<T> {
public boolean isExcludeBeanCache() {
// not using L2 cache for asDraft() query
return excludeBeanCache || isAsDraft() ;
return excludeBeanCache || isAsDraft();
}
@Override
@@ -1152,7 +1169,7 @@ public class DefaultOrmQuery<T> implements SpiQuery<T> {
@Override
@SuppressWarnings("unchecked")
public <A> List<A> findSingleAttributeList() {
return (List<A>)server.findSingleAttributeList(this, null);
return (List<A>) server.findSingleAttributeList(this, null);
}
@Override
@@ -1,11 +1,11 @@
package com.avaje.ebeaninternal.server.querydefn;
import java.io.Serializable;
import com.avaje.ebean.EbeanServer;
import com.avaje.ebeaninternal.api.BindParams;
import com.avaje.ebeaninternal.api.SpiUpdate;
import java.io.Serializable;
/**
* Default implementation of OrmUpdate.
*/
@@ -39,7 +39,7 @@ class ONamedParam implements SpiNamedParam {
*/
void checkValueSet() {
if (value == null) {
throw new PersistenceException("Named parameter ["+name+"] has not had it's value set.");
throw new PersistenceException("Named parameter [" + name + "] has not had it's value set.");
}
}
}
@@ -379,8 +379,8 @@ public class OrmQueryDetail implements Serializable {
*/
private boolean isQueryJoinCandidate(String lazyLoadManyPath, OrmQueryProperties chunk) {
return chunk.isFetchJoin()
&& !isLazyLoadManyRoot(lazyLoadManyPath, chunk)
&& !hasParentSecJoin(lazyLoadManyPath, chunk);
&& !isLazyLoadManyRoot(lazyLoadManyPath, chunk)
&& !hasParentSecJoin(lazyLoadManyPath, chunk);
}
/**
@@ -51,7 +51,7 @@ public class OrmQueryDetailParser {
detail.fetch(readFindFetch());
} else {
throw new PersistenceException("Query expected 'fetch', 'where','order by' or 'limit' keyword but got ["
+ parser.getWord() + "] \r " + parser.getOql());
+ parser.getWord() + "] \r " + parser.getOql());
}
}
@@ -118,11 +118,14 @@ class OrmQueryPlanKey implements CQueryPlanKey {
if (hasIdValue != that.hasIdValue) return false;
if (type != that.type) return false;
if (temporalMode != that.temporalMode) return false;
if (m2mIncludeTable != null ? !m2mIncludeTable.equals(that.m2mIncludeTable) : that.m2mIncludeTable != null) return false;
if (orderByAsSting != null ? !orderByAsSting.equals(that.orderByAsSting) : that.orderByAsSting != null) return false;
if (m2mIncludeTable != null ? !m2mIncludeTable.equals(that.m2mIncludeTable) : that.m2mIncludeTable != null)
return false;
if (orderByAsSting != null ? !orderByAsSting.equals(that.orderByAsSting) : that.orderByAsSting != null)
return false;
if (where != null ? !where.isSameByPlan(that.where) : that.where != null) return false;
if (having != null ? !having.isSameByPlan(that.having) : that.having != null) return false;
if (updateProperties != null ? !updateProperties.isSameByPlan(that.updateProperties) : that.updateProperties != null) return false;
if (updateProperties != null ? !updateProperties.isSameByPlan(that.updateProperties) : that.updateProperties != null)
return false;
if (rawSqlKey != null ? !rawSqlKey.equals(that.rawSqlKey) : that.rawSqlKey != null) return false;
if (mapKey != null ? !mapKey.equals(that.mapKey) : that.mapKey != null) return false;
return rootTableAlias != null ? rootTableAlias.equals(that.rootTableAlias) : that.rootTableAlias == null;
@@ -61,7 +61,7 @@ class OrmQueryPropertiesParser {
private int queryFetchBatch = -1;
private int lazyFetchBatch = -1;
private OrmQueryPropertiesParser(String inputProperties) {
private OrmQueryPropertiesParser(String inputProperties) {
this.inputProperties = inputProperties;
}
@@ -148,7 +148,7 @@ class OrmQueryPropertiesParser {
return propertySet;
}
private int parseBatchHint( int pos, String option) {
private int parseBatchHint(int pos, String option) {
int startPos = pos + option.length();
int endPos = findEndPos(startPos, inputProperties);
@@ -151,7 +151,7 @@ public class OrmUpdateProperties {
*/
public boolean isSameByPlan(OrmUpdateProperties that) {
return that.values.size() == values.size()
&& logicalSetClause().equals(that.logicalSetClause());
&& logicalSetClause().equals(that.logicalSetClause());
}
/**