mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Replace "for" with "foreach"
This commit is contained in:
@@ -48,9 +48,9 @@ final class DRawSqlColumnsParser {
|
||||
String[] split = colInfo.split("\\s(?=[^\\)]*(?:\\(|$))");
|
||||
if (split.length > 1) {
|
||||
ArrayList<String> tmp = new ArrayList<>(split.length);
|
||||
for (int i = 0; i < split.length; i++) {
|
||||
if (!split[i].trim().isEmpty()) {
|
||||
tmp.add(split[i].trim());
|
||||
for (String aSplit : split) {
|
||||
if (!aSplit.trim().isEmpty()) {
|
||||
tmp.add(aSplit.trim());
|
||||
}
|
||||
}
|
||||
split = tmp.toArray(new String[tmp.size()]);
|
||||
@@ -66,8 +66,8 @@ final class DRawSqlColumnsParser {
|
||||
if (split.length == 2) {
|
||||
return new ColumnMapping.Column(indexPos++, split[0], split[1]);
|
||||
}
|
||||
// Ok, we now expect/require the AS keyword and it should be the
|
||||
// second to last word in the colInfo content
|
||||
// Ok, we now expect/require the AS keyword and it should be the
|
||||
// second to last word in the colInfo content
|
||||
if (!split[split.length - 2].equalsIgnoreCase("as")) {
|
||||
throw new PersistenceException("Expecting AS keyword as second to last word when parsing column " + colInfo);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public final class OrderBy<T> implements Serializable {
|
||||
public OrderBy() {
|
||||
this.list = new ArrayList<>(3);
|
||||
}
|
||||
|
||||
|
||||
private OrderBy(List<Property> list) {
|
||||
this.list = list;
|
||||
}
|
||||
@@ -60,8 +60,8 @@ public final class OrderBy<T> implements Serializable {
|
||||
* Reverse the ascending/descending order on all the properties.
|
||||
*/
|
||||
public void reverse() {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
list.get(i).reverse();
|
||||
for (Property aList : list) {
|
||||
aList.reverse();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,8 +88,8 @@ public final class OrderBy<T> implements Serializable {
|
||||
*/
|
||||
public boolean containsProperty(String propertyName) {
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if (propertyName.equals(list.get(i).getProperty())) {
|
||||
for (Property aList : list) {
|
||||
if (propertyName.equals(aList.getProperty())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -101,12 +101,12 @@ public final class OrderBy<T> implements Serializable {
|
||||
*/
|
||||
public OrderBy<T> copyWithTrim(String path) {
|
||||
List<Property> newList = new ArrayList<>(list.size());
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
newList.add(list.get(i).copyWithTrim(path));
|
||||
for (Property aList : list) {
|
||||
newList.add(aList.copyWithTrim(path));
|
||||
}
|
||||
return new OrderBy<>(newList);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the properties for this OrderBy.
|
||||
*/
|
||||
@@ -142,8 +142,8 @@ public final class OrderBy<T> implements Serializable {
|
||||
public OrderBy<T> copy() {
|
||||
|
||||
OrderBy<T> copy = new OrderBy<>();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
copy.add(list.get(i).copy());
|
||||
for (Property aList : list) {
|
||||
copy.add(aList.copy());
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
@@ -192,7 +192,7 @@ public final class OrderBy<T> implements Serializable {
|
||||
if (!(obj instanceof OrderBy<?>)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
OrderBy<?> e = (OrderBy<?>) obj;
|
||||
return e.list.equals(list);
|
||||
}
|
||||
@@ -356,8 +356,8 @@ public final class OrderBy<T> implements Serializable {
|
||||
}
|
||||
|
||||
String[] chunks = orderByClause.split(",");
|
||||
for (int i = 0; i < chunks.length; i++) {
|
||||
String[] pairs = chunks[i].split(" ");
|
||||
for (String chunk : chunks) {
|
||||
String[] pairs = chunk.split(" ");
|
||||
Property p = parseProperty(pairs);
|
||||
if (p != null) {
|
||||
list.add(p);
|
||||
@@ -371,9 +371,9 @@ public final class OrderBy<T> implements Serializable {
|
||||
}
|
||||
|
||||
ArrayList<String> wordList = new ArrayList<>(pairs.length);
|
||||
for (int i = 0; i < pairs.length; i++) {
|
||||
if (!isEmptyString(pairs[i])) {
|
||||
wordList.add(pairs[i]);
|
||||
for (String pair : pairs) {
|
||||
if (!isEmptyString(pair)) {
|
||||
wordList.add(pair);
|
||||
}
|
||||
}
|
||||
if (wordList.isEmpty()) {
|
||||
|
||||
@@ -53,37 +53,37 @@ import com.avaje.ebean.util.CamelCaseHelper;
|
||||
* </p>
|
||||
*
|
||||
* <h3>Example OrderAggregate</h3>
|
||||
*
|
||||
*
|
||||
* <pre>{@code
|
||||
* ...
|
||||
* // @Sql indicates to that this bean
|
||||
* // is based on RawSql rather than a table
|
||||
*
|
||||
*
|
||||
* @Entity
|
||||
* @Sql
|
||||
* public class OrderAggregate {
|
||||
*
|
||||
*
|
||||
* @OneToOne
|
||||
* Order order;
|
||||
*
|
||||
*
|
||||
* Double totalAmount;
|
||||
*
|
||||
*
|
||||
* Double totalItems;
|
||||
*
|
||||
*
|
||||
* // getters and setters
|
||||
* ...
|
||||
*
|
||||
* }</pre>
|
||||
*
|
||||
* <h3>Example 1:</h3>
|
||||
*
|
||||
*
|
||||
* <pre>{@code
|
||||
*
|
||||
* String sql = " select order_id, o.status, c.id, c.name, sum(d.order_qty*d.unit_price) as totalAmount"
|
||||
* + " from o_order o"
|
||||
* + " join o_customer c on c.id = o.kcustomer_id "
|
||||
* + " join o_order_detail d on d.order_id = o.id " + " group by order_id, o.status ";
|
||||
*
|
||||
*
|
||||
* RawSql rawSql = RawSqlBuilder.parse(sql)
|
||||
* // map the sql result columns to bean properties
|
||||
* .columnMapping("order_id", "order.id")
|
||||
@@ -93,35 +93,35 @@ import com.avaje.ebean.util.CamelCaseHelper;
|
||||
* // we don't need to map this one due to the sql column alias
|
||||
* // .columnMapping("sum(d.order_qty*d.unit_price)", "totalAmount")
|
||||
* .create();
|
||||
*
|
||||
*
|
||||
* List<OrderAggregate> list = Ebean.find(OrderAggregate.class)
|
||||
* .setRawSql(rawSql)
|
||||
* .where().gt("order.id", 0)
|
||||
* .having().gt("totalAmount", 20)
|
||||
* .findList();
|
||||
*
|
||||
*
|
||||
*
|
||||
* }</pre>
|
||||
*
|
||||
*
|
||||
* <h3>Example 2:</h3>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* The following example uses a FetchConfig().query() so that after the initial
|
||||
* RawSql query is executed Ebean executes a secondary query to fetch the
|
||||
* associated order status, orderDate along with the customer name.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* <pre>{@code
|
||||
*
|
||||
* String sql = " select order_id, 'ignoreMe', sum(d.order_qty*d.unit_price) as totalAmount "
|
||||
* + " from o_order_detail d"
|
||||
* + " group by order_id ";
|
||||
*
|
||||
*
|
||||
* RawSql rawSql = RawSqlBuilder.parse(sql)
|
||||
* .columnMapping("order_id", "order.id")
|
||||
* .columnMappingIgnore("'ignoreMe'")
|
||||
* .create();
|
||||
*
|
||||
*
|
||||
* List<OrderAggregate> orders = Ebean.find(OrderAggregate.class)
|
||||
* .setRawSql(rawSql)
|
||||
* .fetch("order", "status,orderDate", new FetchConfig().query())
|
||||
@@ -131,7 +131,7 @@ import com.avaje.ebean.util.CamelCaseHelper;
|
||||
* .order().desc("totalAmount")
|
||||
* .setMaxRows(10)
|
||||
* .findList();
|
||||
*
|
||||
*
|
||||
* }</pre>
|
||||
*
|
||||
*
|
||||
@@ -167,14 +167,14 @@ import com.avaje.ebean.util.CamelCaseHelper;
|
||||
* <p>
|
||||
* Note that lazy loading also works with object graphs built with RawSql.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
*/
|
||||
public final class RawSql implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final ResultSet resultSet;
|
||||
|
||||
|
||||
private final Sql sql;
|
||||
|
||||
private final ColumnMapping columnMapping;
|
||||
@@ -192,7 +192,7 @@ public final class RawSql implements Serializable {
|
||||
this.sql = null;
|
||||
this.columnMapping = new ColumnMapping(propertyNames);
|
||||
}
|
||||
|
||||
|
||||
protected RawSql(ResultSet resultSet, Sql sql, ColumnMapping columnMapping) {
|
||||
this.resultSet = resultSet;
|
||||
this.sql = sql;
|
||||
@@ -214,7 +214,7 @@ public final class RawSql implements Serializable {
|
||||
String unParsedSql = (sql == null) ? "" : sql.unparsedSql;
|
||||
return new Key(parsed, unParsedSql, columnMapping);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the resultSet if this is a ResultSet based RawSql.
|
||||
*/
|
||||
@@ -386,7 +386,7 @@ public final class RawSql implements Serializable {
|
||||
private final LinkedHashMap<String, Column> dbColumnMap;
|
||||
|
||||
private final Map<String, String> propertyMap;
|
||||
|
||||
|
||||
private final Map<String, Column> propertyColumnMap;
|
||||
|
||||
private final boolean parsed;
|
||||
@@ -402,8 +402,7 @@ public final class RawSql implements Serializable {
|
||||
this.propertyMap = null;
|
||||
this.propertyColumnMap = null;
|
||||
this.dbColumnMap = new LinkedHashMap<>();
|
||||
for (int i = 0; i < columns.size(); i++) {
|
||||
Column c = columns.get(i);
|
||||
for (Column c : columns) {
|
||||
dbColumnMap.put(c.getDbColumnKey(), c);
|
||||
}
|
||||
}
|
||||
@@ -418,7 +417,7 @@ public final class RawSql implements Serializable {
|
||||
this.propertyColumnMap = null;
|
||||
this.dbColumnMap = new LinkedHashMap<>();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Construct for ResultSet use.
|
||||
*/
|
||||
@@ -476,7 +475,7 @@ public final class RawSql implements Serializable {
|
||||
|
||||
/**
|
||||
* Creates an immutable copy of this ColumnMapping.
|
||||
*
|
||||
*
|
||||
* @throws IllegalStateException
|
||||
* when a propertyName has not been defined for a column.
|
||||
*/
|
||||
|
||||
@@ -296,8 +296,8 @@ public final class TxScope {
|
||||
if (rollbackFor == null) {
|
||||
rollbackFor = new ArrayList<>(rollbackThrowables.length);
|
||||
}
|
||||
for (int i = 0; i < rollbackThrowables.length; i++) {
|
||||
rollbackFor.add((Class<? extends Throwable>) rollbackThrowables[i]);
|
||||
for (Class<?> rollbackThrowable : rollbackThrowables) {
|
||||
rollbackFor.add((Class<? extends Throwable>) rollbackThrowable);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
@@ -330,8 +330,8 @@ public final class TxScope {
|
||||
if (noRollbackFor == null) {
|
||||
noRollbackFor = new ArrayList<>(noRollbacks.length);
|
||||
}
|
||||
for (int i = 0; i < noRollbacks.length; i++) {
|
||||
noRollbackFor.add((Class<? extends Throwable>) noRollbacks[i]);
|
||||
for (Class<?> noRollback : noRollbacks) {
|
||||
noRollbackFor.add((Class<? extends Throwable>) noRollback);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -34,12 +34,12 @@ public final class CallStack implements Serializable {
|
||||
|
||||
public int hashCode() {
|
||||
int hc = 0;
|
||||
for (int i = 0; i < callStack.length; i++) {
|
||||
hc = 31 * hc + callStack[i].hashCode();
|
||||
for (StackTraceElement aCallStack : callStack) {
|
||||
hc = 31 * hc + aCallStack.hashCode();
|
||||
}
|
||||
return hc;
|
||||
}
|
||||
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
@@ -88,8 +88,8 @@ public final class CallStack implements Serializable {
|
||||
*/
|
||||
public String description(String newLine) {
|
||||
StringBuilder sb = new StringBuilder(400);
|
||||
for (int i = 0; i < callStack.length; i++) {
|
||||
sb.append(callStack[i].toString()).append(newLine);
|
||||
for (StackTraceElement aCallStack : callStack) {
|
||||
sb.append(aCallStack.toString()).append(newLine);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public final class EntityBeanIntercept implements Serializable {
|
||||
private static final int STATE_NEW = 0;
|
||||
private static final int STATE_REFERENCE = 1;
|
||||
private static final int STATE_LOADED = 2;
|
||||
|
||||
|
||||
private transient NodeUsageCollector nodeUsageCollector;
|
||||
|
||||
private transient PropertyChangeSupport pcs;
|
||||
@@ -55,11 +55,11 @@ public final class EntityBeanIntercept implements Serializable {
|
||||
* One of NEW, REF, UPD.
|
||||
*/
|
||||
private int state;
|
||||
|
||||
|
||||
private boolean readOnly;
|
||||
|
||||
|
||||
private boolean dirty;
|
||||
|
||||
|
||||
/**
|
||||
* Flag set to disable lazy loading - typically for SQL "report" type entity beans.
|
||||
*/
|
||||
@@ -74,14 +74,14 @@ public final class EntityBeanIntercept implements Serializable {
|
||||
* Used when a bean is partially filled.
|
||||
*/
|
||||
private final boolean[] loadedProps;
|
||||
|
||||
|
||||
private boolean fullyLoadedBean;
|
||||
|
||||
/**
|
||||
* Set of changed properties.
|
||||
*/
|
||||
private boolean[] changedProps;
|
||||
|
||||
|
||||
/**
|
||||
* Flags indicating if a property is a dirty embedded bean. Used to distingush
|
||||
* between an embedded bean being completely overwritten and one of its
|
||||
@@ -180,7 +180,7 @@ public final class EntityBeanIntercept implements Serializable {
|
||||
public Object getEmbeddedOwner() {
|
||||
return embeddedOwner;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the property index (for the parent) of this embedded bean.
|
||||
*/
|
||||
@@ -240,8 +240,8 @@ public final class EntityBeanIntercept implements Serializable {
|
||||
* Check each property to see if the bean is partially loaded.
|
||||
*/
|
||||
public boolean isPartial() {
|
||||
for (int i = 0; i < loadedProps.length; i++) {
|
||||
if (!loadedProps[i]) {
|
||||
for (boolean loadedProp : loadedProps) {
|
||||
if (!loadedProp) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -263,7 +263,7 @@ public final class EntityBeanIntercept implements Serializable {
|
||||
this.dirty = true;
|
||||
setEmbeddedPropertyDirty(embeddedProperty);
|
||||
}
|
||||
|
||||
|
||||
public void setDirty(boolean dirty) {
|
||||
this.dirty = dirty;
|
||||
}
|
||||
@@ -290,12 +290,12 @@ public final class EntityBeanIntercept implements Serializable {
|
||||
if (i == idIndex) {
|
||||
if (!loadedProps[i]) return false;
|
||||
} else if (loadedProps[i]) {
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return true if the entity is a reference.
|
||||
*/
|
||||
@@ -312,7 +312,7 @@ public final class EntityBeanIntercept implements Serializable {
|
||||
// For cases where properties are set on constructor
|
||||
// set every non Id property to unloaded (for lazy loading)
|
||||
for (int i=0; i< loadedProps.length; i++) {
|
||||
if (i != idPos) {
|
||||
if (i != idPos) {
|
||||
loadedProps[i] = false;
|
||||
}
|
||||
}
|
||||
@@ -448,7 +448,7 @@ public final class EntityBeanIntercept implements Serializable {
|
||||
}
|
||||
return origValues[propertyIndex];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Finds the index position of a given property. Returns -1 if the property
|
||||
* can not be found.
|
||||
@@ -462,7 +462,7 @@ public final class EntityBeanIntercept implements Serializable {
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the property name for the given property.
|
||||
*/
|
||||
@@ -472,7 +472,7 @@ public final class EntityBeanIntercept implements Serializable {
|
||||
}
|
||||
return owner._ebean_getPropertyName(propertyIndex);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the number of properties.s
|
||||
*/
|
||||
@@ -498,7 +498,7 @@ public final class EntityBeanIntercept implements Serializable {
|
||||
public void setPropertyUnloaded(int propertyIndex) {
|
||||
loadedProps[propertyIndex] = false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the property to be loaded.
|
||||
*/
|
||||
@@ -525,7 +525,7 @@ public final class EntityBeanIntercept implements Serializable {
|
||||
* embedded properties is dirty.
|
||||
*/
|
||||
public boolean isDirtyProperty(int propertyIndex) {
|
||||
return (changedProps != null && changedProps[propertyIndex]
|
||||
return (changedProps != null && changedProps[propertyIndex]
|
||||
|| embeddedDirty != null && embeddedDirty[propertyIndex]);
|
||||
}
|
||||
|
||||
@@ -536,7 +536,7 @@ public final class EntityBeanIntercept implements Serializable {
|
||||
setChangedProperty(propertyIndex);
|
||||
setDirty(true);
|
||||
}
|
||||
|
||||
|
||||
public void setChangedProperty(int propertyIndex) {
|
||||
if (changedProps == null) {
|
||||
changedProps = new boolean[owner._ebean_getPropertyNames().length];
|
||||
@@ -553,7 +553,7 @@ public final class EntityBeanIntercept implements Serializable {
|
||||
}
|
||||
embeddedDirty[propertyIndex] = true;
|
||||
}
|
||||
|
||||
|
||||
private void setOriginalValue(int propertyIndex, Object value) {
|
||||
if (origValues == null) {
|
||||
origValues = new Object[owner._ebean_getPropertyNames().length];
|
||||
@@ -567,19 +567,19 @@ public final class EntityBeanIntercept implements Serializable {
|
||||
* For forced update on a 'New' bean set all the loaded properties to changed.
|
||||
*/
|
||||
public void setNewBeanForUpdate() {
|
||||
|
||||
|
||||
if (changedProps == null) {
|
||||
changedProps = new boolean[owner._ebean_getPropertyNames().length];
|
||||
}
|
||||
|
||||
|
||||
for (int i=0; i< loadedProps.length; i++) {
|
||||
if (loadedProps[i]) {
|
||||
changedProps[i] = true;
|
||||
changedProps[i] = true;
|
||||
}
|
||||
}
|
||||
setDirty(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the set of property names for a partially loaded bean.
|
||||
*/
|
||||
@@ -621,7 +621,7 @@ public final class EntityBeanIntercept implements Serializable {
|
||||
addDirtyPropertyNames(props, null);
|
||||
return props;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Recursively add dirty properties.
|
||||
*/
|
||||
@@ -670,7 +670,7 @@ public final class EntityBeanIntercept implements Serializable {
|
||||
addDirtyPropertyValues(dirtyValues, null);
|
||||
return dirtyValues;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Recursively add dirty properties.
|
||||
*/
|
||||
@@ -684,7 +684,7 @@ public final class EntityBeanIntercept implements Serializable {
|
||||
Object oldVal = getOrigValue(i);
|
||||
|
||||
dirtyValues.put(propName, new ValuePair(newVal, oldVal));
|
||||
|
||||
|
||||
} else if (embeddedDirty != null && embeddedDirty[i]) {
|
||||
// an embedded property has been changed - recurse
|
||||
EntityBean embeddedBean = (EntityBean)owner._ebean_getField(i);
|
||||
@@ -692,14 +692,14 @@ public final class EntityBeanIntercept implements Serializable {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return a dirty property hash taking into account embedded beans.
|
||||
*/
|
||||
public int getDirtyPropertyHash() {
|
||||
return addDirtyPropertyHash(37);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add and return a dirty property hash recursing into embedded beans.
|
||||
*/
|
||||
@@ -749,7 +749,7 @@ public final class EntityBeanIntercept implements Serializable {
|
||||
public int getLazyLoadPropertyIndex() {
|
||||
return lazyLoadProperty;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the property that triggered the lazy load.
|
||||
*/
|
||||
@@ -849,7 +849,7 @@ public final class EntityBeanIntercept implements Serializable {
|
||||
}
|
||||
return obj1.equals(obj2);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called when a BeanCollection is initialised automatically.
|
||||
*/
|
||||
@@ -920,7 +920,7 @@ public final class EntityBeanIntercept implements Serializable {
|
||||
if (readOnly) {
|
||||
throw new IllegalStateException("This bean is readOnly");
|
||||
}
|
||||
|
||||
|
||||
setLoadedProperty(propertyIndex);
|
||||
|
||||
// Bean itself not considered dirty when many changed
|
||||
@@ -930,7 +930,7 @@ public final class EntityBeanIntercept implements Serializable {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void setChangedPropertyValue(int propertyIndex, boolean setDirtyState, Object origValue) {
|
||||
|
||||
if (readOnly) {
|
||||
@@ -941,7 +941,7 @@ public final class EntityBeanIntercept implements Serializable {
|
||||
if (setDirtyState) {
|
||||
setOriginalValue(propertyIndex, origValue);
|
||||
if (!dirty) {
|
||||
dirty = true;
|
||||
dirty = true;
|
||||
if (embeddedOwner != null) {
|
||||
// Cascade dirty state from Embedded bean to parent bean
|
||||
embeddedOwner._ebean_getIntercept().setEmbeddedDirty(embeddedOwnerIndex);
|
||||
@@ -952,7 +952,7 @@ public final class EntityBeanIntercept implements Serializable {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check to see if the values are not equal. If they are not equal then create
|
||||
* the old values for use with ConcurrencyMode.ALL.
|
||||
@@ -962,15 +962,15 @@ public final class EntityBeanIntercept implements Serializable {
|
||||
if (state == STATE_NEW) {
|
||||
setLoadedProperty(propertyIndex);
|
||||
} else if (!areEqual(oldValue, newValue)) {
|
||||
setChangedPropertyValue(propertyIndex, intercept, oldValue);
|
||||
setChangedPropertyValue(propertyIndex, intercept, oldValue);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (pcs == null) ? null : new PropertyChangeEvent(owner, getProperty(propertyIndex), oldValue, newValue);
|
||||
|
||||
return (pcs == null) ? null : new PropertyChangeEvent(owner, getProperty(propertyIndex), oldValue, newValue);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Check for primitive boolean.
|
||||
*/
|
||||
@@ -1007,13 +1007,13 @@ public final class EntityBeanIntercept implements Serializable {
|
||||
public PropertyChangeEvent preSetter(boolean intercept, int propertyIndex, long oldValue, long newValue) {
|
||||
|
||||
if (state == STATE_NEW) {
|
||||
setLoadedProperty(propertyIndex);
|
||||
setLoadedProperty(propertyIndex);
|
||||
} else if (oldValue != newValue) {
|
||||
setChangedPropertyValue(propertyIndex, intercept, oldValue);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
return (pcs == null) ? null : new PropertyChangeEvent(owner, getProperty(propertyIndex), oldValue, newValue);
|
||||
}
|
||||
|
||||
@@ -1025,7 +1025,7 @@ public final class EntityBeanIntercept implements Serializable {
|
||||
if (state == STATE_NEW) {
|
||||
setLoadedProperty(propertyIndex);
|
||||
} else if (oldValue != newValue) {
|
||||
setChangedPropertyValue(propertyIndex, intercept, oldValue);
|
||||
setChangedPropertyValue(propertyIndex, intercept, oldValue);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -261,8 +261,8 @@ public final class BeanList<E> extends AbstractBeanCollection<E> implements List
|
||||
// and fetch just the Id's
|
||||
initClear();
|
||||
if (modifyRemoveListening) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
getModifyHolder().modifyRemoval(list.get(i));
|
||||
for (E aList : list) {
|
||||
getModifyHolder().modifyRemoval(aList);
|
||||
}
|
||||
}
|
||||
list.clear();
|
||||
|
||||
@@ -78,8 +78,8 @@ public class DbConstraintNormalise {
|
||||
public boolean notQuoted(String tableName) {
|
||||
|
||||
// remove quoted identifier characters
|
||||
for (int i = 0; i < quotedIdentifiers.length; i++) {
|
||||
if (tableName.contains(quotedIdentifiers[i])) {
|
||||
for (String quotedIdentifier : quotedIdentifiers) {
|
||||
if (tableName.contains(quotedIdentifier)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -95,8 +95,8 @@ public class DbConstraintNormalise {
|
||||
return "";
|
||||
}
|
||||
// remove quoted identifier characters
|
||||
for (int i = 0; i < quotedIdentifiers.length; i++) {
|
||||
tableName = tableName.replace(quotedIdentifiers[i], "");
|
||||
for (String quotedIdentifier : quotedIdentifiers) {
|
||||
tableName = tableName.replace(quotedIdentifier, "");
|
||||
}
|
||||
return tableName;
|
||||
}
|
||||
|
||||
@@ -2117,7 +2117,7 @@ public class ServerConfig {
|
||||
*/
|
||||
public void add(BeanPostConstructListener listener) {
|
||||
postConstructListeners.add(listener);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Return the list of BeanFindController instances.
|
||||
*/
|
||||
@@ -2524,8 +2524,8 @@ public class ServerConfig {
|
||||
List<Class<?>> classes = new ArrayList<>();
|
||||
|
||||
String[] split = classNames.split("[ ,;]");
|
||||
for (int i = 0; i < split.length; i++) {
|
||||
String cn = split[i].trim();
|
||||
for (String aSplit : split) {
|
||||
String cn = aSplit.trim();
|
||||
if (!cn.isEmpty() && !"class".equalsIgnoreCase(cn)) {
|
||||
try {
|
||||
classes.add(Class.forName(cn));
|
||||
@@ -2545,8 +2545,8 @@ public class ServerConfig {
|
||||
if (searchPackages != null) {
|
||||
|
||||
String[] entries = searchPackages.split("[ ,;]");
|
||||
for (int i = 0; i < entries.length; i++) {
|
||||
hitList.add(entries[i].trim());
|
||||
for (String entry : entries) {
|
||||
hitList.add(entry.trim());
|
||||
}
|
||||
}
|
||||
return hitList;
|
||||
|
||||
@@ -159,8 +159,8 @@ public abstract class SequenceIdGenerator implements PlatformIdGenerator {
|
||||
}
|
||||
|
||||
synchronized (monitor) {
|
||||
for (int i = 0; i < newIds.size(); i++) {
|
||||
idList.add(newIds.get(i));
|
||||
for (Long newId : newIds) {
|
||||
idList.add(newId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -47,8 +47,8 @@ public class MsSqlServerDdl extends PlatformDdl {
|
||||
sb.append(columns[i]);
|
||||
}
|
||||
sb.append(") where");
|
||||
for (int i = 0; i < columns.length; i++) {
|
||||
sb.append(" ").append(columns[i]).append(" is not null");
|
||||
for (String column : columns) {
|
||||
sb.append(" ").append(column).append(" is not null");
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@@ -36,8 +36,8 @@ public class IndexSet {
|
||||
*/
|
||||
public boolean add(String[] columns) {
|
||||
IndexColumns newIndex = new IndexColumns(columns);
|
||||
for (int i = 0; i < indexes.size(); i++) {
|
||||
if (indexes.get(i).isMatch(newIndex)) {
|
||||
for (IndexColumns indexe : indexes) {
|
||||
if (indexe.isMatch(newIndex)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
+11
-11
@@ -60,7 +60,7 @@ public class ModelBuildIntersectionTable {
|
||||
intersectionTable.checkDuplicateForeignKeys();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void buildFkConstraints(BeanDescriptor<?> desc, TableJoinColumn[] columns, boolean direction) {
|
||||
|
||||
String tableName = intersectionTableJoin.getTable();
|
||||
@@ -71,11 +71,11 @@ public class ModelBuildIntersectionTable {
|
||||
MCompoundForeignKey foreignKey = new MCompoundForeignKey(fkName, desc.getBaseTable(), fkIndex);
|
||||
intersectionTable.addForeignKey(foreignKey);
|
||||
|
||||
for (int i = 0; i < columns.length; i++) {
|
||||
String localCol = direction ? columns[i].getForeignDbColumn() : columns[i].getLocalDbColumn();
|
||||
String refCol = !direction ? columns[i].getForeignDbColumn() : columns[i].getLocalDbColumn();
|
||||
for (TableJoinColumn column : columns) {
|
||||
String localCol = direction ? column.getForeignDbColumn() : column.getLocalDbColumn();
|
||||
String refCol = !direction ? column.getForeignDbColumn() : column.getLocalDbColumn();
|
||||
foreignKey.addColumnPair(localCol, refCol);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private MTable createTable() {
|
||||
@@ -93,14 +93,14 @@ public class ModelBuildIntersectionTable {
|
||||
table.setPkName(ctx.primaryKeyName(tableName));
|
||||
|
||||
TableJoinColumn[] columns = intersectionTableJoin.columns();
|
||||
for (int i = 0; i < columns.length; i++) {
|
||||
addColumn(table, localDesc, columns[i].getForeignDbColumn(), columns[i].getLocalDbColumn());
|
||||
}
|
||||
for (TableJoinColumn column : columns) {
|
||||
addColumn(table, localDesc, column.getForeignDbColumn(), column.getLocalDbColumn());
|
||||
}
|
||||
|
||||
TableJoinColumn[] otherColumns = tableJoin.columns();
|
||||
for (int i = 0; i < otherColumns.length; i++) {
|
||||
addColumn(table, targetDesc, otherColumns[i].getLocalDbColumn(), otherColumns[i].getForeignDbColumn());
|
||||
}
|
||||
for (TableJoinColumn otherColumn : otherColumns) {
|
||||
addColumn(table, targetDesc, otherColumn.getLocalDbColumn(), otherColumn.getForeignDbColumn());
|
||||
}
|
||||
|
||||
return table;
|
||||
}
|
||||
|
||||
+4
-5
@@ -54,8 +54,7 @@ public class ModelBuildPropertyVisitor extends BaseTablePropertyVisitor {
|
||||
private void addIndexes(IndexDefinition[] indexes) {
|
||||
|
||||
if (indexes != null) {
|
||||
for (int i = 0; i < indexes.length; i++) {
|
||||
IndexDefinition index = indexes[i];
|
||||
for (IndexDefinition index : indexes) {
|
||||
String[] columns = index.getColumns();
|
||||
indexSet.add(columns);
|
||||
|
||||
@@ -178,9 +177,9 @@ public class ModelBuildPropertyVisitor extends BaseTablePropertyVisitor {
|
||||
table.addForeignKey(compoundKey);
|
||||
}
|
||||
|
||||
for (int i = 0; i < columns.length; i++) {
|
||||
for (TableJoinColumn column : columns) {
|
||||
|
||||
String dbCol = columns[i].getLocalDbColumn();
|
||||
String dbCol = column.getLocalDbColumn();
|
||||
BeanProperty importedProperty = importedId.findMatchImport(dbCol);
|
||||
if (importedProperty == null) {
|
||||
throw new RuntimeException("Imported BeanProperty not found?");
|
||||
@@ -369,4 +368,4 @@ public class ModelBuildPropertyVisitor extends BaseTablePropertyVisitor {
|
||||
return val != null && !val.isEmpty();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,8 +64,7 @@ public class VisitAllUsing {
|
||||
}
|
||||
|
||||
BeanProperty[] propertiesNonTransient = desc.propertiesNonTransient();
|
||||
for (int i = 0; i < propertiesNonTransient.length; i++) {
|
||||
BeanProperty p = propertiesNonTransient[i];
|
||||
for (BeanProperty p : propertiesNonTransient) {
|
||||
if (p.isDDLColumn()) {
|
||||
visit(propertyVisitor, p);
|
||||
}
|
||||
@@ -91,8 +90,8 @@ public class VisitAllUsing {
|
||||
// Embedded bean
|
||||
pv.visitEmbedded(assocOne);
|
||||
BeanProperty[] embProps = assocOne.getProperties();
|
||||
for (int i = 0; i < embProps.length; i++) {
|
||||
pv.visitEmbeddedScalar(embProps[i], assocOne);
|
||||
for (BeanProperty embProp : embProps) {
|
||||
pv.visitEmbeddedScalar(embProp, assocOne);
|
||||
}
|
||||
|
||||
} else if (assocOne.isOneToOneExported()) {
|
||||
@@ -110,8 +109,8 @@ public class VisitAllUsing {
|
||||
pv.visitCompound(compound);
|
||||
|
||||
BeanProperty[] properties = compound.getScalarProperties();
|
||||
for (int i = 0; i < properties.length; i++) {
|
||||
pv.visitCompoundScalar(compound, properties[i]);
|
||||
for (BeanProperty property : properties) {
|
||||
pv.visitCompoundScalar(compound, property);
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -151,8 +150,8 @@ public class VisitAllUsing {
|
||||
|
||||
public void visit(InheritInfo inheritInfo) {
|
||||
BeanProperty[] propertiesLocal = inheritInfo.desc().propertiesLocal();
|
||||
for (int i = 0; i < propertiesLocal.length; i++) {
|
||||
owner.visit(pv, propertiesLocal[i]);
|
||||
for (BeanProperty aPropertiesLocal : propertiesLocal) {
|
||||
owner.visit(pv, aPropertiesLocal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ public class StringHelper {
|
||||
* Parses out a list of Name Value pairs that are delimited together. Will
|
||||
* always return a StringMap. If allNameValuePairs is null, or no name values
|
||||
* can be parsed out an empty StringMap is returned.
|
||||
*
|
||||
*
|
||||
* @param allNameValuePairs
|
||||
* the entire string to be parsed.
|
||||
* @param listDelimiter
|
||||
@@ -133,7 +133,7 @@ public class StringHelper {
|
||||
|
||||
/**
|
||||
* Trims off recurring strings from the front of a string.
|
||||
*
|
||||
*
|
||||
* @param source
|
||||
* the source string
|
||||
* @param trim
|
||||
@@ -219,7 +219,7 @@ public class StringHelper {
|
||||
* Convert a string that has delimited values (say comma delimited) in a
|
||||
* String[]. You must explicitly choose whether or not to include empty values
|
||||
* (say two commas that a right beside each other.
|
||||
*
|
||||
*
|
||||
* <P>
|
||||
* e.g. "alpha,beta,,theta"<br>
|
||||
* With keepEmpties true, this results in a String[] of size 4 with the third
|
||||
@@ -272,7 +272,7 @@ public class StringHelper {
|
||||
* This returns the FIRST string in str that is bounded on the left by
|
||||
* leftBound, and bounded on the right by rightBound. This will return null if
|
||||
* the leftBound is not found within str.
|
||||
*
|
||||
*
|
||||
* <P>
|
||||
* If leftBound can't be found this returns null.
|
||||
* </P>
|
||||
@@ -280,7 +280,7 @@ public class StringHelper {
|
||||
* This rightBound can't be found then this throws a
|
||||
* StringIndexOutOfBoundsException.
|
||||
* </P>
|
||||
*
|
||||
*
|
||||
* @param str
|
||||
* the base string that we will search for the bounded string.
|
||||
* @param leftBound
|
||||
@@ -364,7 +364,7 @@ public class StringHelper {
|
||||
/**
|
||||
* This method takes a String and will replace all occurrences of the match
|
||||
* String with that of the replace String.
|
||||
*
|
||||
*
|
||||
* @param source
|
||||
* the source string
|
||||
* @param match
|
||||
@@ -462,7 +462,7 @@ public class StringHelper {
|
||||
* <p>
|
||||
* Useful when converting CRNL CR and NL all to a BR tag for example.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* <pre>
|
||||
* <code>
|
||||
* String[] multi = { "\r\n", "\r", "\n" };
|
||||
@@ -580,8 +580,8 @@ public class StringHelper {
|
||||
}
|
||||
|
||||
private static boolean charMatch(int iChr, char[] chr) {
|
||||
for (int i = 0; i < chr.length; i++) {
|
||||
if (iChr == chr[i]) {
|
||||
for (char aChr : chr) {
|
||||
if (iChr == aChr) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public class BindParams implements Serializable {
|
||||
private final List<Param> positionedParameters = new ArrayList<>();
|
||||
|
||||
private final Map<String, Param> namedParameters = new LinkedHashMap<>();
|
||||
|
||||
|
||||
/**
|
||||
* This is the sql. For named parameters this is the sql after the named
|
||||
* parameters have been replaced with question mark place holders and the
|
||||
@@ -37,14 +37,14 @@ public class BindParams implements Serializable {
|
||||
*/
|
||||
private int[] bindHash;
|
||||
|
||||
public BindParams() {
|
||||
public BindParams() {
|
||||
}
|
||||
|
||||
|
||||
public int queryBindHash() {
|
||||
int hc = namedParameters.hashCode();
|
||||
for (int i = 0; i < positionedParameters.size(); i++) {
|
||||
hc = hc * 31 + positionedParameters.get(i).hashCode();
|
||||
}
|
||||
for (Param positionedParameter : positionedParameters) {
|
||||
hc = hc * 31 + positionedParameter.hashCode();
|
||||
}
|
||||
return hc;
|
||||
}
|
||||
|
||||
@@ -97,14 +97,14 @@ public class BindParams implements Serializable {
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return true if there are no bind parameters.
|
||||
*/
|
||||
public boolean isEmpty() {
|
||||
return positionedParameters.isEmpty() && namedParameters.isEmpty();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return a Natural Key bind param if supported.
|
||||
*/
|
||||
@@ -209,7 +209,7 @@ public class BindParams implements Serializable {
|
||||
* Set a named In parameter that is not null.
|
||||
*/
|
||||
public Param setParameter(String name, Object value) {
|
||||
|
||||
|
||||
Param p = getParam(name);
|
||||
p.setInValue(value);
|
||||
return p;
|
||||
@@ -302,62 +302,62 @@ public class BindParams implements Serializable {
|
||||
* </p>
|
||||
*/
|
||||
public static final class OrderedList {
|
||||
|
||||
|
||||
private final List<Param> paramList;
|
||||
|
||||
|
||||
private final StringBuilder preparedSql;
|
||||
|
||||
public OrderedList() {
|
||||
this(new ArrayList<>());
|
||||
}
|
||||
|
||||
|
||||
public OrderedList(List<Param> paramList) {
|
||||
this.paramList = paramList;
|
||||
this.preparedSql = new StringBuilder();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a parameter in the correct binding order.
|
||||
*/
|
||||
public void add(Param param) {
|
||||
paramList.add(param);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the number of bind parameters in this list.
|
||||
*/
|
||||
public int size() {
|
||||
return paramList.size();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the ordered list of bind parameters.
|
||||
*/
|
||||
public List<Param> list() {
|
||||
return paramList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Append parsedSql that has named parameters converted into ?.
|
||||
*/
|
||||
public void appendSql(String parsedSql) {
|
||||
preparedSql.append(parsedSql);
|
||||
}
|
||||
|
||||
|
||||
public String getPreparedSql() {
|
||||
return preparedSql.toString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A In Out capable parameter for the CallableStatement.
|
||||
*/
|
||||
public static final class Param implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
private boolean encryptionKey;
|
||||
|
||||
|
||||
private boolean isInParam;
|
||||
|
||||
private boolean isOutParam;
|
||||
@@ -381,9 +381,9 @@ public class BindParams implements Serializable {
|
||||
if (inValue instanceof Collection<?>){
|
||||
return ((Collection<?>)inValue).size();
|
||||
}
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a deep copy of the Param.
|
||||
*/
|
||||
@@ -396,20 +396,20 @@ public class BindParams implements Serializable {
|
||||
copy.outValue = outValue;
|
||||
return copy;
|
||||
}
|
||||
|
||||
|
||||
public int hashCode() {
|
||||
int hc = getClass().hashCode();
|
||||
hc = hc * 31 + (isInParam ? 0 : 1);
|
||||
hc = hc * 31 + (isOutParam ? 0 : 1);
|
||||
hc = hc * 31 + (type);
|
||||
hc = hc * 31 + (inValue == null ? 0 : inValue.hashCode());
|
||||
hc = hc * 31 + (inValue == null ? 0 : inValue.hashCode());
|
||||
return hc;
|
||||
}
|
||||
|
||||
public boolean equals(Object o) {
|
||||
return o != null && (o == this || (o instanceof Param) && hashCode() == o.hashCode());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return true if this is an In parameter that needs to be bound before
|
||||
* execution.
|
||||
@@ -458,7 +458,7 @@ public class BindParams implements Serializable {
|
||||
this.isInParam = true;
|
||||
this.encryptionKey = true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Specify that the In parameter is NULL and the specific type that it
|
||||
* is.
|
||||
|
||||
@@ -98,8 +98,7 @@ public class LoadBeanRequest extends LoadRequest {
|
||||
List<Object> idList = new ArrayList<>(batchSize);
|
||||
|
||||
BeanDescriptor<?> desc = loadBuffer.getBeanDescriptor();
|
||||
for (int i = 0; i < batch.size(); i++) {
|
||||
EntityBeanIntercept ebi = batch.get(i);
|
||||
for (EntityBeanIntercept ebi : batch) {
|
||||
EntityBean bean = ebi.getOwner();
|
||||
idList.add(desc.getId(bean));
|
||||
}
|
||||
@@ -154,8 +153,8 @@ public class LoadBeanRequest extends LoadRequest {
|
||||
|
||||
BeanDescriptor<?> desc = loadBuffer.getBeanDescriptor();
|
||||
// collect Ids and maybe load bean cache
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
EntityBean loadedBean = (EntityBean) list.get(i);
|
||||
for (Object aList : list) {
|
||||
EntityBean loadedBean = (EntityBean) aList;
|
||||
loadedIds.add(desc.getId(loadedBean));
|
||||
if (isLoadCache()) {
|
||||
desc.cacheBeanPut(loadedBean);
|
||||
@@ -163,10 +162,9 @@ public class LoadBeanRequest extends LoadRequest {
|
||||
}
|
||||
|
||||
if (lazyLoadProperty != null) {
|
||||
for (int i = 0; i < batch.size(); i++) {
|
||||
for (EntityBeanIntercept ebi : batch) {
|
||||
// check if the underlying row in DB was deleted. Mark the bean as 'failed' if
|
||||
// necessary but allow processing to continue until it is accessed by client code
|
||||
EntityBeanIntercept ebi = batch.get(i);
|
||||
Object id = desc.getId(ebi.getOwner());
|
||||
if (!loadedIds.contains(id)) {
|
||||
if (desc.isSoftDelete()) {
|
||||
|
||||
@@ -104,8 +104,7 @@ public class LoadManyRequest extends LoadRequest {
|
||||
ArrayList<Object> idList = new ArrayList<>(batchSize);
|
||||
|
||||
BeanPropertyAssocMany<?> many = getMany();
|
||||
for (int i = 0; i < batch.size(); i++) {
|
||||
BeanCollection<?> bc = batch.get(i);
|
||||
for (BeanCollection<?> bc : batch) {
|
||||
idList.add(many.getParentId(bc.getOwnerBean()));
|
||||
}
|
||||
int extraIds = batchSize - batch.size();
|
||||
@@ -177,8 +176,7 @@ public class LoadManyRequest extends LoadRequest {
|
||||
|
||||
// check for BeanCollection's that where never processed
|
||||
// in the +query or +lazy load due to no rows (predicates)
|
||||
for (int i = 0; i < batch.size(); i++) {
|
||||
BeanCollection<?> bc = batch.get(i);
|
||||
for (BeanCollection<?> bc : batch) {
|
||||
if (bc.checkEmptyLazyLoad()) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
EntityBean ownerBean = bc.getOwnerBean();
|
||||
|
||||
@@ -221,8 +221,8 @@ public class ScopeTrans implements Thread.UncaughtExceptionHandler {
|
||||
}
|
||||
|
||||
if (noRollbackFor != null) {
|
||||
for (int i = 0; i < noRollbackFor.size(); i++) {
|
||||
if (noRollbackFor.get(i).equals(e.getClass())) {
|
||||
for (Class<? extends Throwable> aNoRollbackFor : noRollbackFor) {
|
||||
if (aNoRollbackFor.equals(e.getClass())) {
|
||||
|
||||
// explicit no rollback for this one
|
||||
return false;
|
||||
@@ -231,8 +231,8 @@ public class ScopeTrans implements Thread.UncaughtExceptionHandler {
|
||||
}
|
||||
|
||||
if (rollbackFor != null) {
|
||||
for (int i = 0; i < rollbackFor.size(); i++) {
|
||||
if (rollbackFor.get(i).equals(e.getClass())) {
|
||||
for (Class<? extends Throwable> aRollbackFor : rollbackFor) {
|
||||
if (aRollbackFor.equals(e.getClass())) {
|
||||
// explicit rollback for this one
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -126,8 +126,8 @@ public class TransactionEvent implements Serializable {
|
||||
|
||||
List<PersistRequestBean<?>> persistRequestBeans = getPersistRequestBeans();
|
||||
if (persistRequestBeans != null) {
|
||||
for (int i=0; i< persistRequestBeans.size(); i++) {
|
||||
persistRequestBeans.get(i).addDocStoreUpdates(docStoreUpdates);
|
||||
for (PersistRequestBean<?> persistRequestBean : persistRequestBeans) {
|
||||
persistRequestBean.addDocStoreUpdates(docStoreUpdates);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,9 +36,9 @@ public class TransactionEventBeans {
|
||||
* Collect the cache changes.
|
||||
*/
|
||||
public void notifyCache(CacheChangeSet changeSet) {
|
||||
for (int i = 0; i < requests.size(); i++) {
|
||||
requests.get(i).notifyCache(changeSet);
|
||||
}
|
||||
for (PersistRequestBean<?> request : requests) {
|
||||
request.notifyCache(changeSet);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+5
-6
@@ -27,8 +27,7 @@ public class CachedBeanDataFromBean {
|
||||
BeanProperty[] props = desc.propertiesNonMany();
|
||||
|
||||
// extract all the non-many properties
|
||||
for (int i = 0; i < props.length; i++) {
|
||||
BeanProperty prop = props[i];
|
||||
for (BeanProperty prop : props) {
|
||||
if (ebi.isLoadedProperty(prop.getPropertyIndex())) {
|
||||
data.put(prop.getName(), prop.getCacheDataValue(bean));
|
||||
}
|
||||
@@ -56,9 +55,9 @@ public class CachedBeanDataFromBean {
|
||||
idProp.setValue(sharableBean, v);
|
||||
}
|
||||
BeanProperty[] propertiesNonTransient = desc.propertiesNonTransient();
|
||||
for (int i = 0; i < propertiesNonTransient.length; i++) {
|
||||
Object v = propertiesNonTransient[i].getValue(bean);
|
||||
propertiesNonTransient[i].setValue(sharableBean, v);
|
||||
for (BeanProperty aPropertiesNonTransient : propertiesNonTransient) {
|
||||
Object v = aPropertiesNonTransient.getValue(bean);
|
||||
aPropertiesNonTransient.setValue(sharableBean, v);
|
||||
}
|
||||
EntityBeanIntercept intercept = sharableBean._ebean_intercept();
|
||||
intercept.setReadOnly(true);
|
||||
@@ -67,4 +66,4 @@ public class CachedBeanDataFromBean {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -22,13 +22,13 @@ public class CachedBeanDataToBean {
|
||||
|
||||
// load the non-many properties
|
||||
BeanProperty[] props = desc.propertiesNonMany();
|
||||
for (int i = 0; i < props.length; i++) {
|
||||
loadProperty(bean, cacheBeanData, ebi, props[i], context);
|
||||
for (BeanProperty prop : props) {
|
||||
loadProperty(bean, cacheBeanData, ebi, prop, context);
|
||||
}
|
||||
|
||||
BeanPropertyAssocMany<?>[] many = desc.propertiesMany();
|
||||
for (int i = 0; i < many.length; i++) {
|
||||
many[i].createReferenceIfNull(bean);
|
||||
for (BeanPropertyAssocMany<?> aMany : many) {
|
||||
aMany.createReferenceIfNull(bean);
|
||||
}
|
||||
|
||||
ebi.setLoadedLazy();
|
||||
@@ -44,4 +44,4 @@ public class CachedBeanDataToBean {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,13 +87,13 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
private static final Logger logger = LoggerFactory.getLogger(DefaultServer.class);
|
||||
|
||||
private static final int IGNORE_LEADING_ELEMENTS = 5;
|
||||
|
||||
|
||||
private static final String COM_AVAJE_EBEAN = "com.avaje.ebean";
|
||||
|
||||
private static final String ORG_AVAJE_EBEAN = "org.avaje.ebean";
|
||||
|
||||
private final ServerConfig serverConfig;
|
||||
|
||||
|
||||
private final String serverName;
|
||||
|
||||
private final DatabasePlatform databasePlatform;
|
||||
@@ -113,7 +113,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
* false;
|
||||
*/
|
||||
private final boolean rollbackOnChecked;
|
||||
|
||||
|
||||
/**
|
||||
* Handles the save, delete, updateSql CallableSql.
|
||||
*/
|
||||
@@ -152,7 +152,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
private final DocumentStore documentStore;
|
||||
|
||||
private final MetaInfoManager metaInfoManager;
|
||||
|
||||
|
||||
/**
|
||||
* The default PersistenceContextScope used if it is not explicitly set on a query.
|
||||
*/
|
||||
@@ -162,21 +162,21 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
* Flag set when the server has shutdown.
|
||||
*/
|
||||
private boolean shutdown;
|
||||
|
||||
|
||||
/**
|
||||
* The default batch size for lazy loading beans or collections.
|
||||
*/
|
||||
private final int lazyLoadBatchSize;
|
||||
|
||||
/**
|
||||
* The query batch size
|
||||
/**
|
||||
* The query batch size
|
||||
*/
|
||||
private final int queryBatchSize;
|
||||
|
||||
private final boolean updateAllPropertiesInBatch;
|
||||
|
||||
private final boolean collectQueryOrigins;
|
||||
|
||||
|
||||
private final boolean collectQueryStatsByNode;
|
||||
|
||||
/**
|
||||
@@ -235,7 +235,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
this.ddlGenerator = new DdlGenerator(this, serverConfig);
|
||||
|
||||
configureServerPlugins();
|
||||
|
||||
|
||||
// Register with the JVM Shutdown hook
|
||||
ShutdownManager.registerEbeanServer(this);
|
||||
}
|
||||
@@ -273,7 +273,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
public int getLazyLoadBatchSize() {
|
||||
return lazyLoadBatchSize;
|
||||
}
|
||||
|
||||
|
||||
public int getQueryBatchSize() {
|
||||
return queryBatchSize;
|
||||
}
|
||||
@@ -798,23 +798,23 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
* </p>
|
||||
* <p>
|
||||
* Code example:<br />
|
||||
*
|
||||
*
|
||||
* <pre>
|
||||
* <code>
|
||||
* Ebean.startTransaction();
|
||||
* try {
|
||||
* // do some fetching and or persisting
|
||||
*
|
||||
*
|
||||
* // commit at the end
|
||||
* Ebean.commitTransaction();
|
||||
*
|
||||
*
|
||||
* } finally {
|
||||
* // if commit didn't occur then rollback the transaction
|
||||
* Ebean.endTransaction();
|
||||
* }
|
||||
* </code>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* </p>
|
||||
*/
|
||||
public void endTransaction() {
|
||||
@@ -1205,7 +1205,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
try {
|
||||
request.initTransIfRequired();
|
||||
return request.findIds();
|
||||
|
||||
|
||||
} finally {
|
||||
request.endTransIfRequired();
|
||||
}
|
||||
@@ -1374,7 +1374,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
try {
|
||||
request.initTransIfRequired();
|
||||
return request.findList();
|
||||
|
||||
|
||||
} finally {
|
||||
request.endTransIfRequired();
|
||||
}
|
||||
@@ -1445,18 +1445,18 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
throw new IllegalArgumentException("This bean is not an EntityBean?");
|
||||
}
|
||||
// mark the bean as dirty (so that an update will not get skipped)
|
||||
((EntityBean)bean)._ebean_getIntercept().setDirty(true);
|
||||
((EntityBean)bean)._ebean_getIntercept().setDirty(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the bean using the default 'updatesDeleteMissingChildren' setting.
|
||||
* Update the bean using the default 'updatesDeleteMissingChildren' setting.
|
||||
*/
|
||||
public void update(Object bean) {
|
||||
update(bean, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the bean using the default 'updatesDeleteMissingChildren' setting.
|
||||
* Update the bean using the default 'updatesDeleteMissingChildren' setting.
|
||||
*/
|
||||
public void update(Object bean, Transaction t) {
|
||||
persister.update(checkEntityBean(bean), t);
|
||||
@@ -1483,7 +1483,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
// Nothing to update?
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
TransWrapper wrap = initTransIfRequired(t);
|
||||
try {
|
||||
SpiTransaction trans = wrap.transaction;
|
||||
@@ -1491,13 +1491,13 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
update(checkEntityBean(bean), trans);
|
||||
}
|
||||
wrap.commitIfCreated();
|
||||
|
||||
|
||||
} catch (RuntimeException e) {
|
||||
wrap.rollbackIfCreated();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Insert the bean.
|
||||
*/
|
||||
@@ -1528,7 +1528,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
// Nothing to insert?
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
TransWrapper wrap = initTransIfRequired(t);
|
||||
try {
|
||||
SpiTransaction trans = wrap.transaction;
|
||||
@@ -1536,7 +1536,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
persister.insert(checkEntityBean(bean), trans);
|
||||
}
|
||||
wrap.commitIfCreated();
|
||||
|
||||
|
||||
} catch (RuntimeException e) {
|
||||
wrap.rollbackIfCreated();
|
||||
throw e;
|
||||
@@ -1621,7 +1621,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
}
|
||||
return (EntityBean)bean;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int saveAll(Collection<?> beans, Transaction transaction) throws OptimisticLockException {
|
||||
return saveAllInternal(beans.iterator(), transaction);
|
||||
@@ -1853,15 +1853,15 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
|
||||
public void register(BeanPersistController c) {
|
||||
List<BeanDescriptor<?>> list = beanDescriptorManager.getBeanDescriptorList();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
list.get(i).register(c);
|
||||
for (BeanDescriptor<?> aList : list) {
|
||||
aList.register(c);
|
||||
}
|
||||
}
|
||||
|
||||
public void deregister(BeanPersistController c) {
|
||||
List<BeanDescriptor<?>> list = beanDescriptorManager.getBeanDescriptorList();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
list.get(i).deregister(c);
|
||||
for (BeanDescriptor<?> aList : list) {
|
||||
aList.deregister(c);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2041,14 +2041,14 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
// immutable thread safe so return shared instance
|
||||
return jsonContext;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void collectQueryStats(ObjectGraphNode node, long loadedBeanCount, long timeMicros) {
|
||||
|
||||
|
||||
if (collectQueryStatsByNode) {
|
||||
CObjectGraphNodeStatistics nodeStatistics = objectGraphStats.get(node);
|
||||
if (nodeStatistics == null) {
|
||||
// race condition here but I actually don't care too much if we miss a
|
||||
// race condition here but I actually don't care too much if we miss a
|
||||
// few early statistics - especially when the server is warming up etc
|
||||
nodeStatistics = new CObjectGraphNodeStatistics(node);
|
||||
objectGraphStats.put(node, nodeStatistics);
|
||||
@@ -2056,5 +2056,5 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
nodeStatistics.add(loadedBeanCount, timeMicros);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -303,8 +303,8 @@ public final class PersistRequestBean<T> extends PersistRequest implements BeanP
|
||||
*/
|
||||
public boolean hasDirtyProperty(int[] propertyPositions) {
|
||||
|
||||
for (int i = 0; i < propertyPositions.length; i++) {
|
||||
if (dirtyProperties[propertyPositions[i]]) {
|
||||
for (int propertyPosition : propertyPositions) {
|
||||
if (dirtyProperties[propertyPosition]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,12 +33,12 @@ public final class PersistRequestCallableSql extends PersistRequest {
|
||||
*/
|
||||
public PersistRequestCallableSql(SpiEbeanServer server,
|
||||
CallableSql cs, SpiTransaction t, PersistExecute persistExecute) {
|
||||
|
||||
|
||||
super(server, t, persistExecute);
|
||||
this.type = PersistRequest.Type.CALLABLESQL;
|
||||
this.callableSql = (SpiCallableSql)cs;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int executeOrQueue() {
|
||||
return executeStatement();
|
||||
@@ -88,7 +88,7 @@ public final class PersistRequestCallableSql extends PersistRequest {
|
||||
|
||||
// register table modifications with the transaction event
|
||||
TransactionEventTable tableEvents = callableSql.getTransactionEventTable();
|
||||
|
||||
|
||||
if (tableEvents != null && !tableEvents.isEmpty()) {
|
||||
transaction.getEvent().add(tableEvents);
|
||||
} else {
|
||||
@@ -134,14 +134,14 @@ public final class PersistRequestCallableSql extends PersistRequest {
|
||||
List<Param> list = bindParam.positionedParameters();
|
||||
int pos = 0;
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
pos++;
|
||||
BindParams.Param param = list.get(i);
|
||||
if (param.isOutParam()) {
|
||||
Object outValue = cstmt.getObject(pos);
|
||||
param.setOutValue(outValue);
|
||||
}
|
||||
}
|
||||
for (Param aList : list) {
|
||||
pos++;
|
||||
Param param = aList;
|
||||
if (param.isOutParam()) {
|
||||
Object outValue = cstmt.getObject(pos);
|
||||
param.setOutValue(outValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -191,10 +191,10 @@ public final class RelationalQueryRequest {
|
||||
SqlRow sqlRow = new DefaultSqlRow(estimateCapacity, 0.75f, dbTrueValue);
|
||||
|
||||
int index = 0;
|
||||
for (int i = 0; i < propertyNames.length; i++) {
|
||||
for (String propertyName : propertyNames) {
|
||||
index++;
|
||||
Object value = resultSet.getObject(index);
|
||||
sqlRow.set(propertyNames[i], value);
|
||||
sqlRow.set(propertyName, value);
|
||||
}
|
||||
return sqlRow;
|
||||
}
|
||||
|
||||
@@ -38,8 +38,8 @@ class DistillPackages {
|
||||
*/
|
||||
private static boolean notAlreadyContained(List<String> distilled, String pack) {
|
||||
|
||||
for (int i = 0; i < distilled.size(); i++) {
|
||||
if (pack.startsWith(distilled.get(i))) {
|
||||
for (String aDistilled : distilled) {
|
||||
if (pack.startsWith(aDistilled)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,8 +74,8 @@ class ManifestReader {
|
||||
*/
|
||||
private void add(String packages) {
|
||||
String[] split = packages.split(",|;| ");
|
||||
for (int i = 0; i <split.length; i++) {
|
||||
String pkg = split[i].trim();
|
||||
for (String aSplit : split) {
|
||||
String pkg = aSplit.trim();
|
||||
if (!pkg.isEmpty()) {
|
||||
packageSet.add(pkg);
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@ public class BeanCascadeInfo {
|
||||
private boolean refresh;
|
||||
|
||||
public void setTypes(CascadeType[] types) {
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
setType(types[i]);
|
||||
for (CascadeType type : types) {
|
||||
setType(type);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -500,8 +500,8 @@ public class BeanDescriptor<T> implements MetaBeanInfo, BeanType<T> {
|
||||
this.docStoreQueueId = docStoreAdapter.getQueueId();
|
||||
|
||||
// Check if there are no cascade save associated beans ( subject to change
|
||||
// in initialiseOther()). Note that if we are in an inheritance hierarchy
|
||||
// then we also need to check every BeanDescriptors in the InheritInfo as
|
||||
// in initialiseOther()). Note that if we are in an inheritance hierarchy
|
||||
// then we also need to check every BeanDescriptors in the InheritInfo as
|
||||
// well. We do that later in initialiseOther().
|
||||
|
||||
saveRecurseSkippable = (0 == (propertiesOneExportedSave.length + propertiesOneImportedSave.length + propertiesManySave.length));
|
||||
@@ -588,9 +588,9 @@ public class BeanDescriptor<T> implements MetaBeanInfo, BeanType<T> {
|
||||
*/
|
||||
public void setEbeanServer(SpiEbeanServer ebeanServer) {
|
||||
this.ebeanServer = ebeanServer;
|
||||
for (int i = 0; i < propertiesMany.length; i++) {
|
||||
for (BeanPropertyAssocMany<?> aPropertiesMany : propertiesMany) {
|
||||
// used for creating lazy loading lists etc
|
||||
propertiesMany[i].setLoader(ebeanServer);
|
||||
aPropertiesMany.setLoader(ebeanServer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -661,18 +661,18 @@ public class BeanDescriptor<T> implements MetaBeanInfo, BeanType<T> {
|
||||
*/
|
||||
public void initialiseOther(Map<String, String> asOfTableMap, String asOfViewSuffix, Map<String, String> draftTableMap) {
|
||||
|
||||
for (int i = 0; i < propertiesManyToMany.length; i++) {
|
||||
for (BeanPropertyAssocMany<?> aPropertiesManyToMany1 : propertiesManyToMany) {
|
||||
// register associated draft table for M2M intersection
|
||||
propertiesManyToMany[i].registerDraftIntersectionTable(draftTableMap);
|
||||
aPropertiesManyToMany1.registerDraftIntersectionTable(draftTableMap);
|
||||
}
|
||||
|
||||
if (historySupport) {
|
||||
// history support on this bean so check all associated intersection tables
|
||||
// and if they are not excluded register the associated 'with history' table
|
||||
for (int i = 0; i < propertiesManyToMany.length; i++) {
|
||||
for (BeanPropertyAssocMany<?> aPropertiesManyToMany : propertiesManyToMany) {
|
||||
// register associated history table for M2M intersection
|
||||
if (!propertiesManyToMany[i].isExcludedFromHistory()) {
|
||||
TableJoin intersectionTableJoin = propertiesManyToMany[i].getIntersectionTableJoin();
|
||||
if (!aPropertiesManyToMany.isExcludedFromHistory()) {
|
||||
TableJoin intersectionTableJoin = aPropertiesManyToMany.getIntersectionTableJoin();
|
||||
String intersectionTableName = intersectionTableJoin.getTable();
|
||||
asOfTableMap.put(intersectionTableName, intersectionTableName + asOfViewSuffix);
|
||||
}
|
||||
@@ -716,8 +716,8 @@ public class BeanDescriptor<T> implements MetaBeanInfo, BeanType<T> {
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void initialiseDocMapping() {
|
||||
for (int i = 0; i < propertiesMany.length; i++) {
|
||||
propertiesMany[i].initialisePostTarget();
|
||||
for (BeanPropertyAssocMany<?> aPropertiesMany : propertiesMany) {
|
||||
aPropertiesMany.initialisePostTarget();
|
||||
}
|
||||
if (inheritInfo != null && !inheritInfo.isRoot()) {
|
||||
docStoreAdapter = (DocStoreBeanAdapter<T>) inheritInfo.getRoot().desc().docStoreAdapter();
|
||||
@@ -835,8 +835,8 @@ public class BeanDescriptor<T> implements MetaBeanInfo, BeanType<T> {
|
||||
sb.append(inClause);
|
||||
|
||||
DefaultSqlUpdate delete = new DefaultSqlUpdate(sb.toString());
|
||||
for (int i = 0; i < idList.size(); i++) {
|
||||
idBinder.bindId(delete, idList.get(i));
|
||||
for (Object anIdList : idList) {
|
||||
idBinder.bindId(delete, anIdList);
|
||||
}
|
||||
return delete;
|
||||
}
|
||||
@@ -851,8 +851,8 @@ public class BeanDescriptor<T> implements MetaBeanInfo, BeanType<T> {
|
||||
DefaultSqlUpdate sqlDelete = new DefaultSqlUpdate(baseSql);
|
||||
|
||||
Object[] bindValues = idBinder.getBindValues(id);
|
||||
for (int i = 0; i < bindValues.length; i++) {
|
||||
sqlDelete.addParameter(bindValues[i]);
|
||||
for (Object bindValue : bindValues) {
|
||||
sqlDelete.addParameter(bindValue);
|
||||
}
|
||||
|
||||
return sqlDelete;
|
||||
@@ -867,8 +867,8 @@ public class BeanDescriptor<T> implements MetaBeanInfo, BeanType<T> {
|
||||
}
|
||||
|
||||
public void initialiseFkeys() {
|
||||
for (int i = 0; i < propertiesOneImported.length; i++) {
|
||||
propertiesOneImported[i].addFkey();
|
||||
for (BeanPropertyAssocOne<?> aPropertiesOneImported : propertiesOneImported) {
|
||||
aPropertiesOneImported.addFkey();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1469,9 +1469,9 @@ public class BeanDescriptor<T> implements MetaBeanInfo, BeanType<T> {
|
||||
*/
|
||||
private BeanProperty findWhenCreatedProperty() {
|
||||
|
||||
for (int i = 0; i < propertiesBaseScalar.length; i++) {
|
||||
if (propertiesBaseScalar[i].isGeneratedWhenCreated()) {
|
||||
return propertiesBaseScalar[i];
|
||||
for (BeanProperty aPropertiesBaseScalar : propertiesBaseScalar) {
|
||||
if (aPropertiesBaseScalar.isGeneratedWhenCreated()) {
|
||||
return aPropertiesBaseScalar;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@@ -1482,9 +1482,9 @@ public class BeanDescriptor<T> implements MetaBeanInfo, BeanType<T> {
|
||||
*/
|
||||
private BeanProperty findWhenModifiedProperty() {
|
||||
|
||||
for (int i = 0; i < propertiesBaseScalar.length; i++) {
|
||||
if (propertiesBaseScalar[i].isGeneratedWhenModified()) {
|
||||
return propertiesBaseScalar[i];
|
||||
for (BeanProperty aPropertiesBaseScalar : propertiesBaseScalar) {
|
||||
if (aPropertiesBaseScalar.isGeneratedWhenModified()) {
|
||||
return aPropertiesBaseScalar;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@@ -1496,9 +1496,9 @@ public class BeanDescriptor<T> implements MetaBeanInfo, BeanType<T> {
|
||||
public BeanPropertyAssocMany<?> getManyProperty(SpiQuery<?> query) {
|
||||
|
||||
OrmQueryDetail detail = query.getDetail();
|
||||
for (int i = 0; i < propertiesMany.length; i++) {
|
||||
if (detail.includesPath(propertiesMany[i].getName())) {
|
||||
return propertiesMany[i];
|
||||
for (BeanPropertyAssocMany<?> aPropertiesMany : propertiesMany) {
|
||||
if (detail.includesPath(aPropertiesMany.getName())) {
|
||||
return aPropertiesMany;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1565,8 +1565,8 @@ public class BeanDescriptor<T> implements MetaBeanInfo, BeanType<T> {
|
||||
* Creates a new EntityBean.
|
||||
* The parameter <code>isNew</code> controls either this is a new bean (then
|
||||
* {@link BeanPostConstructListener#postCreate(Object)} will be invoked) or
|
||||
* a reference (then {@link BeanPostLoad#postLoad(Object)} will be invoked
|
||||
* on first access (lazy load) or immediately (eager load)
|
||||
* a reference (then {@link BeanPostLoad#postLoad(Object)} will be invoked
|
||||
* on first access (lazy load) or immediately (eager load)
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public EntityBean createEntityBean(boolean isNew) {
|
||||
@@ -1577,12 +1577,12 @@ public class BeanDescriptor<T> implements MetaBeanInfo, BeanType<T> {
|
||||
beanPostConstructListener.autowire(bean); // calls all registered listeners
|
||||
beanPostConstructListener.postConstruct(bean); // calls first the @PostConstruct method and then the listeners
|
||||
}
|
||||
|
||||
|
||||
if (unloadProperties.length > 0) {
|
||||
// 'unload' any properties initialised in the default constructor
|
||||
EntityBeanIntercept ebi = bean._ebean_getIntercept();
|
||||
for (int i = 0; i < unloadProperties.length; i++) {
|
||||
ebi.setPropertyUnloaded(unloadProperties[i]);
|
||||
for (int unloadProperty : unloadProperties) {
|
||||
ebi.setPropertyUnloaded(unloadProperty);
|
||||
}
|
||||
}
|
||||
if (beanPostConstructListener != null && isNew) {
|
||||
@@ -1595,7 +1595,7 @@ public class BeanDescriptor<T> implements MetaBeanInfo, BeanType<T> {
|
||||
throw new PersistenceException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new entitybean without invoking {@link BeanPostConstructListener#postCreate(Object)}
|
||||
*/
|
||||
@@ -1938,11 +1938,11 @@ public class BeanDescriptor<T> implements MetaBeanInfo, BeanType<T> {
|
||||
|
||||
// load the List/Set/Map proxy objects (deferred fetching of lists)
|
||||
BeanPropertyAssocMany<?>[] manys = propertiesMany();
|
||||
for (int i = 0; i < manys.length; i++) {
|
||||
if (!ebi.isLoadedProperty(manys[i].getPropertyIndex())) {
|
||||
BeanCollection<?> ref = manys[i].createReferenceIfNull(bean);
|
||||
for (BeanPropertyAssocMany<?> many : manys) {
|
||||
if (!ebi.isLoadedProperty(many.getPropertyIndex())) {
|
||||
BeanCollection<?> ref = many.createReferenceIfNull(bean);
|
||||
if (ref != null && !ref.isRegisteredWithLoadContext()) {
|
||||
String path = SplitName.add(prefix, manys[i].getName());
|
||||
String path = SplitName.add(prefix, many.getName());
|
||||
loadContext.register(path, ref);
|
||||
}
|
||||
}
|
||||
@@ -2147,9 +2147,9 @@ public class BeanDescriptor<T> implements MetaBeanInfo, BeanType<T> {
|
||||
public void resetManyProperties(Object dbBean) {
|
||||
|
||||
EntityBean bean = (EntityBean) dbBean;
|
||||
for (int i = 0; i < propertiesMany.length; i++) {
|
||||
if (propertiesMany[i].isCascadeRefresh()) {
|
||||
propertiesMany[i].resetMany(bean);
|
||||
for (BeanPropertyAssocMany<?> aPropertiesMany : propertiesMany) {
|
||||
if (aPropertiesMany.isCascadeRefresh()) {
|
||||
aPropertiesMany.resetMany(bean);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2600,8 +2600,8 @@ public class BeanDescriptor<T> implements MetaBeanInfo, BeanType<T> {
|
||||
* Set the embedded owner on any embedded bean properties.
|
||||
*/
|
||||
public void setEmbeddedOwner(EntityBean bean) {
|
||||
for (int i = 0; i < propertiesEmbedded.length; i++) {
|
||||
propertiesEmbedded[i].setEmbeddedOwner(bean);
|
||||
for (BeanPropertyAssocOne<?> aPropertiesEmbedded : propertiesEmbedded) {
|
||||
aPropertiesEmbedded.setEmbeddedOwner(bean);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2624,7 +2624,7 @@ public class BeanDescriptor<T> implements MetaBeanInfo, BeanType<T> {
|
||||
}
|
||||
|
||||
if (idProperty.isEmbedded()) {
|
||||
// not using Id generator so just base on isLoaded()
|
||||
// not using Id generator so just base on isLoaded()
|
||||
return !ebi.isLoaded();
|
||||
}
|
||||
if (!hasIdValue(ebi.getOwner())) {
|
||||
@@ -2674,8 +2674,7 @@ public class BeanDescriptor<T> implements MetaBeanInfo, BeanType<T> {
|
||||
* Check for mutable scalar types and mark as dirty if necessary.
|
||||
*/
|
||||
public void checkMutableProperties(EntityBeanIntercept ebi) {
|
||||
for (int i = 0; i < propertiesMutable.length; i++) {
|
||||
BeanProperty beanProperty = propertiesMutable[i];
|
||||
for (BeanProperty beanProperty : propertiesMutable) {
|
||||
int propertyIndex = beanProperty.getPropertyIndex();
|
||||
if (!ebi.isDirtyProperty(propertyIndex) && ebi.isLoadedProperty(propertyIndex)) {
|
||||
Object value = beanProperty.getValue(ebi.getOwner());
|
||||
@@ -2725,14 +2724,14 @@ public class BeanDescriptor<T> implements MetaBeanInfo, BeanType<T> {
|
||||
* Populate the diff for inserts with flattened non-null property values.
|
||||
*/
|
||||
public void diffForInsert(String prefix, Map<String, ValuePair> map, EntityBean newBean) {
|
||||
for (int i = 0; i < propertiesBaseScalar.length; i++) {
|
||||
propertiesBaseScalar[i].diffForInsert(prefix, map, newBean);
|
||||
for (BeanProperty aPropertiesBaseScalar : propertiesBaseScalar) {
|
||||
aPropertiesBaseScalar.diffForInsert(prefix, map, newBean);
|
||||
}
|
||||
for (int i = 0; i < propertiesOne.length; i++) {
|
||||
propertiesOne[i].diffForInsert(prefix, map, newBean);
|
||||
for (BeanPropertyAssocOne<?> aPropertiesOne : propertiesOne) {
|
||||
aPropertiesOne.diffForInsert(prefix, map, newBean);
|
||||
}
|
||||
for (int i = 0; i < propertiesEmbedded.length; i++) {
|
||||
propertiesEmbedded[i].diffForInsert(prefix, map, newBean);
|
||||
for (BeanPropertyAssocOne<?> aPropertiesEmbedded : propertiesEmbedded) {
|
||||
aPropertiesEmbedded.diffForInsert(prefix, map, newBean);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2750,14 +2749,14 @@ public class BeanDescriptor<T> implements MetaBeanInfo, BeanType<T> {
|
||||
*/
|
||||
public void diff(String prefix, Map<String, ValuePair> map, EntityBean newBean, EntityBean oldBean) {
|
||||
|
||||
for (int i = 0; i < propertiesBaseScalar.length; i++) {
|
||||
propertiesBaseScalar[i].diff(prefix, map, newBean, oldBean);
|
||||
for (BeanProperty aPropertiesBaseScalar : propertiesBaseScalar) {
|
||||
aPropertiesBaseScalar.diff(prefix, map, newBean, oldBean);
|
||||
}
|
||||
for (int i = 0; i < propertiesOne.length; i++) {
|
||||
propertiesOne[i].diff(prefix, map, newBean, oldBean);
|
||||
for (BeanPropertyAssocOne<?> aPropertiesOne : propertiesOne) {
|
||||
aPropertiesOne.diff(prefix, map, newBean, oldBean);
|
||||
}
|
||||
for (int i = 0; i < propertiesEmbedded.length; i++) {
|
||||
propertiesEmbedded[i].diff(prefix, map, newBean, oldBean);
|
||||
for (BeanPropertyAssocOne<?> aPropertiesEmbedded : propertiesEmbedded) {
|
||||
aPropertiesEmbedded.diff(prefix, map, newBean, oldBean);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -125,8 +125,8 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
* that does have bean caching enabled.
|
||||
*/
|
||||
private boolean isNotifyOnDeletes() {
|
||||
for (int i = 0; i < propertiesOneImported.length; i++) {
|
||||
if (propertiesOneImported[i].isCacheNotify()) {
|
||||
for (BeanPropertyAssocOne<?> aPropertiesOneImported : propertiesOneImported) {
|
||||
if (aPropertiesOneImported.isCacheNotify()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -264,8 +264,7 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
|
||||
List<Object> idList = entry.getIdList();
|
||||
bc.checkEmptyLazyLoad();
|
||||
for (int i = 0; i < idList.size(); i++) {
|
||||
Object id = idList.get(i);
|
||||
for (Object id : idList) {
|
||||
Object refBean = targetDescriptor.createReference(readOnly, false, id, persistenceContext);
|
||||
many.add(bc, (EntityBean) refBean);
|
||||
}
|
||||
@@ -320,7 +319,7 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
// check if it is a find by unique id (using the natural key)
|
||||
NaturalKeyBindParam keyBindParam = query.getNaturalKeyBindParam();
|
||||
if (keyBindParam == null || !isNaturalKey(keyBindParam.getName())) {
|
||||
// query is not appropriate
|
||||
// query is not appropriate
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -545,8 +544,8 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
}
|
||||
beanCache.remove(id);
|
||||
}
|
||||
for (int i = 0; i < propertiesOneImported.length; i++) {
|
||||
propertiesOneImported[i].cacheClear();
|
||||
for (BeanPropertyAssocOne<?> aPropertiesOneImported : propertiesOneImported) {
|
||||
aPropertiesOneImported.cacheClear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -608,8 +607,8 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
}
|
||||
|
||||
private void cacheDeleteImported(boolean clear, EntityBean entityBean, CacheChangeSet changeSet) {
|
||||
for (int i = 0; i < propertiesOneImported.length; i++) {
|
||||
propertiesOneImported[i].cacheDelete(clear, entityBean, changeSet);
|
||||
for (BeanPropertyAssocOne<?> aPropertiesOneImported : propertiesOneImported) {
|
||||
aPropertiesOneImported.cacheDelete(clear, entityBean, changeSet);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -627,8 +626,7 @@ final class BeanDescriptorCacheHelp<T> {
|
||||
|
||||
List<BeanPropertyAssocMany<?>> manyCollections = updateRequest.getUpdatedManyCollections();
|
||||
if (manyCollections != null) {
|
||||
for (int i = 0; i < manyCollections.size(); i++) {
|
||||
BeanPropertyAssocMany<?> many = manyCollections.get(i);
|
||||
for (BeanPropertyAssocMany<?> many : manyCollections) {
|
||||
Object details = many.getValue(updateRequest.getEntityBean());
|
||||
CachedManyIds entry = createManyIds(many, details);
|
||||
if (entry != null) {
|
||||
|
||||
@@ -85,14 +85,14 @@ public final class BeanDescriptorDraftHelp<T> {
|
||||
}
|
||||
|
||||
BeanProperty[] props = desc.propertiesNonMany();
|
||||
for (int i = 0; i < props.length; i++) {
|
||||
props[i].publish(draft, live);
|
||||
for (BeanProperty prop : props) {
|
||||
prop.publish(draft, live);
|
||||
}
|
||||
|
||||
BeanPropertyAssocMany<?>[] many = desc.propertiesMany();
|
||||
for (int i = 0; i < many.length; i++) {
|
||||
if (many[i].getTargetDescriptor().isDraftable()) {
|
||||
many[i].publishMany(draft, live);
|
||||
for (BeanPropertyAssocMany<?> aMany : many) {
|
||||
if (aMany.getTargetDescriptor().isDraftable()) {
|
||||
aMany.publishMany(draft, live);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,16 +105,16 @@ public final class BeanDescriptorDraftHelp<T> {
|
||||
public void draftQueryOptimise(Query<T> query) {
|
||||
|
||||
BeanPropertyAssocOne<?>[] one = desc.propertiesOne();
|
||||
for (int i = 0; i < one.length; i++) {
|
||||
if (one[i].getTargetDescriptor().isDraftableElement()) {
|
||||
query.fetch(one[i].getName());
|
||||
for (BeanPropertyAssocOne<?> anOne : one) {
|
||||
if (anOne.getTargetDescriptor().isDraftableElement()) {
|
||||
query.fetch(anOne.getName());
|
||||
}
|
||||
}
|
||||
|
||||
BeanPropertyAssocMany<?>[] many = desc.propertiesMany();
|
||||
for (int i = 0; i < many.length; i++) {
|
||||
if (many[i].getTargetDescriptor().isDraftableElement()) {
|
||||
query.fetch(many[i].getName());
|
||||
for (BeanPropertyAssocMany<?> aMany : many) {
|
||||
if (aMany.getTargetDescriptor().isDraftableElement()) {
|
||||
query.fetch(aMany.getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -63,9 +63,9 @@ public class BeanDescriptorJsonHelp<T> {
|
||||
writeJson.writeStartObject(null);
|
||||
// render the dirty properties
|
||||
BeanProperty[] props = desc.propertiesNonTransient();
|
||||
for (int j = 0; j < props.length; j++) {
|
||||
if (dirtyProps[props[j].getPropertyIndex()]) {
|
||||
props[j].jsonWrite(writeJson, bean);
|
||||
for (BeanProperty prop : props) {
|
||||
if (dirtyProps[prop.getPropertyIndex()]) {
|
||||
prop.jsonWrite(writeJson, bean);
|
||||
}
|
||||
}
|
||||
writeJson.writeEndObject();
|
||||
@@ -103,7 +103,7 @@ public class BeanDescriptorJsonHelp<T> {
|
||||
|
||||
String propName = parser.getCurrentName();
|
||||
if (!propName.equalsIgnoreCase(discColumn)) {
|
||||
// just try to assume this is the correct bean type in the inheritance
|
||||
// just try to assume this is the correct bean type in the inheritance
|
||||
BeanProperty property = desc.getBeanProperty(propName);
|
||||
if (property != null) {
|
||||
EntityBean bean = desc.createEntityBean();
|
||||
|
||||
@@ -423,15 +423,15 @@ public class BeanDescriptorManager implements BeanDescriptorMap {
|
||||
List<BeanDescriptor<?>> normalBeanTypes = tableToDescMap.get(tableName);
|
||||
if (normalBeanTypes != null) {
|
||||
// 'normal' entity beans based on a "base table"
|
||||
for (int i = 0; i < normalBeanTypes.size(); i++) {
|
||||
normalBeanTypes.get(i).cacheHandleBulkUpdate(tableIUD);
|
||||
for (BeanDescriptor<?> normalBeanType : normalBeanTypes) {
|
||||
normalBeanType.cacheHandleBulkUpdate(tableIUD);
|
||||
}
|
||||
}
|
||||
List<BeanDescriptor<?>> viewBeans = tableToViewDescMap.get(tableName);
|
||||
if (viewBeans != null) {
|
||||
// entity beans based on a "view"
|
||||
for (int i = 0; i < viewBeans.size(); i++) {
|
||||
viewBeans.get(i).cacheHandleBulkUpdate(tableIUD);
|
||||
for (BeanDescriptor<?> viewBean : viewBeans) {
|
||||
viewBean.cacheHandleBulkUpdate(tableIUD);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -458,8 +458,8 @@ public class BeanDescriptorManager implements BeanDescriptorMap {
|
||||
for (String depTable : viewInvalidation) {
|
||||
List<BeanDescriptor<?>> list = tableToViewDescMap.get(depTable.toLowerCase());
|
||||
if (list != null) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
list.get(i).queryCacheClear();
|
||||
for (BeanDescriptor<?> aList : list) {
|
||||
aList.queryCacheClear();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -663,8 +663,8 @@ public class BeanDescriptorManager implements BeanDescriptorMap {
|
||||
private void readEmbeddedDeployment() {
|
||||
|
||||
List<Class<?>> embeddedClasses = bootupClasses.getEmbeddables();
|
||||
for (int i = 0; i < embeddedClasses.size(); i++) {
|
||||
registerBeanDescriptor(createEmbedded(embeddedClasses.get(i)));
|
||||
for (Class<?> embeddedClass : embeddedClasses) {
|
||||
registerBeanDescriptor(createEmbedded(embeddedClass));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1395,8 +1395,8 @@ public class BeanDescriptorManager implements BeanDescriptorMap {
|
||||
boolean hasVersionProperty = false;
|
||||
|
||||
List<DeployBeanProperty> props = desc.propertiesBase();
|
||||
for (int i = 0; i < props.size(); i++) {
|
||||
if (props.get(i).isVersionColumn()) {
|
||||
for (DeployBeanProperty prop : props) {
|
||||
if (prop.isVersionColumn()) {
|
||||
hasVersionProperty = true;
|
||||
}
|
||||
}
|
||||
@@ -1407,8 +1407,8 @@ public class BeanDescriptorManager implements BeanDescriptorMap {
|
||||
private boolean hasEntityBeanInterface(Class<?> beanClass) {
|
||||
|
||||
Class<?>[] interfaces = beanClass.getInterfaces();
|
||||
for (int i = 0; i < interfaces.length; i++) {
|
||||
if (interfaces[i].equals(EntityBean.class)) {
|
||||
for (Class<?> anInterface : interfaces) {
|
||||
if (anInterface.equals(EntityBean.class)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,8 +30,7 @@ public class BeanFinderManager {
|
||||
*/
|
||||
public void addFindControllers(DeployBeanDescriptor<?> deployDesc) {
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
BeanFindController c = list.get(i);
|
||||
for (BeanFindController c : list) {
|
||||
if (c.isRegisterFor(deployDesc.getBeanType())) {
|
||||
logger.debug("BeanFindController on[" + deployDesc.getFullName() + "] " + c.getClass().getName());
|
||||
deployDesc.setBeanFinder(c);
|
||||
|
||||
+8
-8
@@ -176,8 +176,8 @@ public class BeanLifecycleAdapterFactory {
|
||||
}
|
||||
|
||||
private void invoke(Method[] methods, BeanPersistRequest<?> request) {
|
||||
for (int i = 0; i < methods.length; i++) {
|
||||
invoke(methods[i], request.getBean());
|
||||
for (Method method : methods) {
|
||||
invoke(method, request.getBean());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,12 +242,12 @@ public class BeanLifecycleAdapterFactory {
|
||||
|
||||
@Override
|
||||
public void postLoad(Object bean) {
|
||||
for (int i = 0; i < postLoadMethods.length; i++) {
|
||||
invoke(postLoadMethods[i], bean);
|
||||
for (Method postLoadMethod : postLoadMethods) {
|
||||
invoke(postLoadMethod, bean);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* PostConstructAdapter using reflection to invoke lifecycle methods.
|
||||
*/
|
||||
@@ -275,8 +275,8 @@ public class BeanLifecycleAdapterFactory {
|
||||
|
||||
@Override
|
||||
public void postConstruct(Object bean) {
|
||||
for (int i = 0; i < postConstructMethods.length; i++) {
|
||||
invoke(postConstructMethods[i], bean);
|
||||
for (Method postConstructMethod : postConstructMethods) {
|
||||
invoke(postConstructMethod, bean);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -284,7 +284,7 @@ public class BeanLifecycleAdapterFactory {
|
||||
public void autowire(Object bean) {
|
||||
// autowire is done by global PostConstructListener only
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void postCreate(Object bean) {
|
||||
// postCreate is done by global PostConstructListener only
|
||||
|
||||
@@ -146,8 +146,8 @@ public final class BeanListHelp<T> implements BeanCollectionHelp<T> {
|
||||
|
||||
if (!list.isEmpty() || ctx.isIncludeEmpty()) {
|
||||
ctx.beginAssocMany(name);
|
||||
for (int j = 0; j < list.size(); j++) {
|
||||
targetDescriptor.jsonWrite(ctx, (EntityBean) list.get(j));
|
||||
for (Object aList : list) {
|
||||
targetDescriptor.jsonWrite(ctx, (EntityBean) aList);
|
||||
}
|
||||
ctx.endAssocMany();
|
||||
}
|
||||
|
||||
@@ -362,8 +362,8 @@ public abstract class BeanPropertyAssoc<T> extends BeanProperty {
|
||||
|
||||
ArrayList<ImportedIdSimple> list = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < cols.length; i++) {
|
||||
list.add(createImportedScalar(owner, cols[i], props, others));
|
||||
for (TableJoinColumn col : cols) {
|
||||
list.add(createImportedScalar(owner, col, props, others));
|
||||
}
|
||||
|
||||
return ImportedIdSimple.sort(list);
|
||||
@@ -399,8 +399,8 @@ public abstract class BeanPropertyAssoc<T> extends BeanProperty {
|
||||
|
||||
} else {
|
||||
EntityBean parent = (EntityBean) parentId;
|
||||
for (int i = 0; i < exportedProperties.length; i++) {
|
||||
Object embVal = exportedProperties[i].getValue(parent);
|
||||
for (ExportedProperty exportedProperty : exportedProperties) {
|
||||
Object embVal = exportedProperty.getValue(parent);
|
||||
bindValues.add(embVal);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -376,8 +376,8 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> {
|
||||
String expr = rawWhere + inClause;
|
||||
|
||||
List<Object> bindValues = new ArrayList<>();
|
||||
for (int i = 0; i < parentIdList.size(); i++) {
|
||||
bindWhereParentId(bindValues, parentIdList.get(i));
|
||||
for (Object aParentIdList : parentIdList) {
|
||||
bindWhereParentId(bindValues, aParentIdList);
|
||||
}
|
||||
|
||||
EbeanServer server = getBeanDescriptor().getEbeanServer();
|
||||
@@ -403,8 +403,8 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> {
|
||||
sb.append(inClause);
|
||||
|
||||
DefaultSqlUpdate delete = new DefaultSqlUpdate(sb.toString());
|
||||
for (int i = 0; i < parentIdist.size(); i++) {
|
||||
bindWhereParendId(delete, parentIdist.get(i));
|
||||
for (Object aParentIdist : parentIdist) {
|
||||
bindWhereParendId(delete, aParentIdist);
|
||||
}
|
||||
|
||||
return delete;
|
||||
@@ -668,10 +668,10 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> {
|
||||
return parentIds;
|
||||
}
|
||||
List<Object> expandedList = new ArrayList<>(parentIds.size() * exportedProperties.length);
|
||||
for (int i = 0; i < parentIds.size(); i++) {
|
||||
for (int y = 0; y < exportedProperties.length; y++) {
|
||||
Object compId = parentIds.get(i);
|
||||
expandedList.add(exportedProperties[y].getValue((EntityBean) compId));
|
||||
for (Object parentId : parentIds) {
|
||||
for (ExportedProperty exportedProperty : exportedProperties) {
|
||||
Object compId = parentId;
|
||||
expandedList.add(exportedProperty.getValue((EntityBean) compId));
|
||||
}
|
||||
}
|
||||
return expandedList;
|
||||
@@ -684,8 +684,8 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> {
|
||||
return;
|
||||
}
|
||||
EntityBean parent = (EntityBean) parentId;
|
||||
for (int i = 0; i < exportedProperties.length; i++) {
|
||||
Object embVal = exportedProperties[i].getValue(parent);
|
||||
for (ExportedProperty exportedProperty : exportedProperties) {
|
||||
Object embVal = exportedProperty.getValue(parent);
|
||||
sqlUpd.addParameter(embVal);
|
||||
}
|
||||
}
|
||||
@@ -696,8 +696,8 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> {
|
||||
if (alias == null) {
|
||||
alias = "t0";
|
||||
}
|
||||
for (int i = 0; i < exportedProperties.length; i++) {
|
||||
ctx.appendColumn(alias, exportedProperties[i].getForeignDbColumn());
|
||||
for (ExportedProperty exportedProperty : exportedProperties) {
|
||||
ctx.appendColumn(alias, exportedProperty.getForeignDbColumn());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -779,8 +779,8 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> {
|
||||
BeanDescriptor<?> targetDesc = one.getTargetDescriptor();
|
||||
BeanProperty[] emIds = targetDesc.propertiesBaseScalar();
|
||||
try {
|
||||
for (int i = 0; i < emIds.length; i++) {
|
||||
ExportedProperty expProp = findMatch(true, emIds[i]);
|
||||
for (BeanProperty emId : emIds) {
|
||||
ExportedProperty expProp = findMatch(true, emId);
|
||||
list.add(expProp);
|
||||
}
|
||||
} catch (PersistenceException e) {
|
||||
@@ -816,11 +816,11 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> {
|
||||
columns = tableJoin.columns();
|
||||
searchTable = tableJoin.getTable();
|
||||
}
|
||||
for (int i = 0; i < columns.length; i++) {
|
||||
String matchTo = columns[i].getLocalDbColumn();
|
||||
for (TableJoinColumn column : columns) {
|
||||
String matchTo = column.getLocalDbColumn();
|
||||
|
||||
if (matchColumn.equalsIgnoreCase(matchTo)) {
|
||||
String foreignCol = columns[i].getForeignDbColumn();
|
||||
String foreignCol = column.getForeignDbColumn();
|
||||
return new ExportedProperty(embedded, foreignCol, prop);
|
||||
}
|
||||
}
|
||||
@@ -849,8 +849,7 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> {
|
||||
BeanDescriptor<?> targetDesc = getTargetDescriptor();
|
||||
|
||||
BeanPropertyAssocOne<?>[] ones = targetDesc.propertiesOne();
|
||||
for (int i = 0; i < ones.length; i++) {
|
||||
BeanPropertyAssocOne<?> prop = ones[i];
|
||||
for (BeanPropertyAssocOne<?> prop : ones) {
|
||||
if (mappedBy != null) {
|
||||
// match using mappedBy as property name
|
||||
if (mappedBy.equalsIgnoreCase(prop.getName())) {
|
||||
@@ -935,9 +934,9 @@ public class BeanPropertyAssocMany<T> extends BeanPropertyAssoc<T> {
|
||||
BeanProperty idProp = descriptor.getIdProperty();
|
||||
parentBean = (EntityBean) idProp.getValue(parentBean);
|
||||
}
|
||||
for (int i = 0; i < exportedProperties.length; i++) {
|
||||
Object val = exportedProperties[i].getValue(parentBean);
|
||||
String fkColumn = exportedProperties[i].getForeignDbColumn();
|
||||
for (ExportedProperty exportedProperty : exportedProperties) {
|
||||
Object val = exportedProperty.getValue(parentBean);
|
||||
String fkColumn = exportedProperty.getForeignDbColumn();
|
||||
|
||||
row.put(fkColumn, val);
|
||||
}
|
||||
|
||||
@@ -79,8 +79,8 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> {
|
||||
BeanEmbeddedMeta overrideMeta = BeanEmbeddedMetaFactory.create(owner, deploy);
|
||||
embeddedProps = overrideMeta.getProperties();
|
||||
embeddedPropsMap = new HashMap<>();
|
||||
for (int i = 0; i < embeddedProps.length; i++) {
|
||||
embeddedPropsMap.put(embeddedProps[i].getName(), embeddedProps[i]);
|
||||
for (BeanProperty embeddedProp : embeddedProps) {
|
||||
embeddedPropsMap.put(embeddedProp.getName(), embeddedProp);
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -208,8 +208,8 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> {
|
||||
sb.append(inClause);
|
||||
|
||||
DefaultSqlUpdate delete = new DefaultSqlUpdate(sb.toString());
|
||||
for (int i = 0; i < parentIdist.size(); i++) {
|
||||
targetIdBinder.bindId(delete, parentIdist.get(i));
|
||||
for (Object aParentIdist : parentIdist) {
|
||||
targetIdBinder.bindId(delete, aParentIdist);
|
||||
}
|
||||
|
||||
return delete;
|
||||
@@ -258,8 +258,8 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> {
|
||||
String expr = rawWhere + inClause;
|
||||
|
||||
List<Object> bindValues = new ArrayList<>();
|
||||
for (int i = 0; i < parentIdList.size(); i++) {
|
||||
bindWhereParentId(bindValues, parentIdList.get(i));
|
||||
for (Object aParentIdList : parentIdList) {
|
||||
bindWhereParentId(bindValues, aParentIdList);
|
||||
}
|
||||
|
||||
EbeanServer server = getBeanDescriptor().getEbeanServer();
|
||||
@@ -301,8 +301,8 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> {
|
||||
targetIdBinder.buildRawSqlSelectChain(prefix, selectChain);
|
||||
|
||||
} else {
|
||||
for (int i = 0; i < embeddedProps.length; i++) {
|
||||
embeddedProps[i].buildRawSqlSelectChain(prefix, selectChain);
|
||||
for (BeanProperty embeddedProp : embeddedProps) {
|
||||
embeddedProp.buildRawSqlSelectChain(prefix, selectChain);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -514,8 +514,8 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> {
|
||||
BeanDescriptor<?> targetDesc = one.getTargetDescriptor();
|
||||
BeanProperty[] emIds = targetDesc.propertiesBaseScalar();
|
||||
try {
|
||||
for (int i = 0; i < emIds.length; i++) {
|
||||
ExportedProperty expProp = findMatch(true, emIds[i]);
|
||||
for (BeanProperty emId : emIds) {
|
||||
ExportedProperty expProp = findMatch(true, emId);
|
||||
list.add(expProp);
|
||||
}
|
||||
} catch (PersistenceException e) {
|
||||
@@ -543,11 +543,11 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> {
|
||||
String searchTable = tableJoin.getTable();
|
||||
TableJoinColumn[] columns = tableJoin.columns();
|
||||
|
||||
for (int i = 0; i < columns.length; i++) {
|
||||
String matchTo = columns[i].getLocalDbColumn();
|
||||
for (TableJoinColumn column : columns) {
|
||||
String matchTo = column.getLocalDbColumn();
|
||||
|
||||
if (matchColumn.equalsIgnoreCase(matchTo)) {
|
||||
String foreignCol = columns[i].getForeignDbColumn();
|
||||
String foreignCol = column.getForeignDbColumn();
|
||||
return new ExportedProperty(embeddedProp, foreignCol, prop);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,14 +46,13 @@ public class BeanPropertyCompound extends BeanProperty {
|
||||
BeanPropertyCompoundRoot root = deploy.getFlatProperties();
|
||||
this.scalarProperties = root.getScalarProperties();
|
||||
|
||||
for (int i = 0; i < scalarProperties.length; i++) {
|
||||
propertyMap.put(scalarProperties[i].getName(), scalarProperties[i]);
|
||||
for (BeanProperty scalarProperty : scalarProperties) {
|
||||
propertyMap.put(scalarProperty.getName(), scalarProperty);
|
||||
}
|
||||
|
||||
List<CtCompoundProperty> nonScalarPropsList = root.getNonScalarProperties();
|
||||
|
||||
for (int i = 0; i < nonScalarPropsList.size(); i++) {
|
||||
CtCompoundProperty ctProp = nonScalarPropsList.get(i);
|
||||
for (CtCompoundProperty ctProp : nonScalarPropsList) {
|
||||
CtCompoundPropertyElAdapter adapter = new CtCompoundPropertyElAdapter(ctProp);
|
||||
nonScalarMap.put(ctProp.getRelativeName(), adapter);
|
||||
}
|
||||
@@ -102,8 +101,8 @@ public class BeanPropertyCompound extends BeanProperty {
|
||||
@Override
|
||||
public void appendSelect(DbSqlContext ctx, boolean subQuery) {
|
||||
if (!isTransient) {
|
||||
for (int i = 0; i < scalarProperties.length; i++) {
|
||||
scalarProperties[i].appendSelect(ctx, subQuery);
|
||||
for (BeanProperty scalarProperty : scalarProperties) {
|
||||
scalarProperty.appendSelect(ctx, subQuery);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,8 +31,7 @@ public class BeanQueryAdapterManager {
|
||||
*/
|
||||
public void addQueryAdapter(DeployBeanDescriptor<?> deployDesc) {
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
BeanQueryAdapter c = list.get(i);
|
||||
for (BeanQueryAdapter c : list) {
|
||||
if (c.isRegisterFor(deployDesc.getBeanType())) {
|
||||
logger.debug("BeanQueryAdapter on[" + deployDesc.getFullName() + "] " + c.getClass().getName());
|
||||
deployDesc.addQueryAdapter(c);
|
||||
|
||||
@@ -20,7 +20,7 @@ import org.slf4j.LoggerFactory;
|
||||
public class BeanTable {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(BeanTable.class);
|
||||
|
||||
|
||||
private final Class<?> beanType;
|
||||
|
||||
/**
|
||||
@@ -29,7 +29,7 @@ public class BeanTable {
|
||||
private final String baseTable;
|
||||
|
||||
private final BeanProperty[] idProperties;
|
||||
|
||||
|
||||
/**
|
||||
* Create the BeanTable.
|
||||
*/
|
||||
@@ -38,11 +38,11 @@ public class BeanTable {
|
||||
this.baseTable = InternString.intern(mutable.getBaseTable());
|
||||
this.idProperties = mutable.createIdProperties(owner);
|
||||
}
|
||||
|
||||
|
||||
public String toString(){
|
||||
return baseTable;
|
||||
return baseTable;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the base table for this BeanTable.
|
||||
* This is used to determine the join information
|
||||
@@ -51,17 +51,17 @@ public class BeanTable {
|
||||
public String getBaseTable() {
|
||||
return baseTable;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the unqualified base table.
|
||||
*
|
||||
*
|
||||
* @return the unqualified base table
|
||||
*/
|
||||
public String getUnqualifiedBaseTable(){
|
||||
final String[] chunks = baseTable.split("\\.");
|
||||
return chunks.length == 2 ? chunks[1] :chunks[0];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the Id properties.
|
||||
*/
|
||||
@@ -75,12 +75,12 @@ public class BeanTable {
|
||||
public Class<?> getBeanType() {
|
||||
return beanType;
|
||||
}
|
||||
|
||||
|
||||
public void createJoinColumn(String foreignKeyPrefix, DeployTableJoin join, boolean reverse) {
|
||||
|
||||
|
||||
boolean complexKey = false;
|
||||
BeanProperty[] props = idProperties;
|
||||
|
||||
|
||||
if (idProperties.length == 1){
|
||||
if (idProperties[0] instanceof BeanPropertyAssocOne<?>) {
|
||||
BeanPropertyAssocOne<?> assocOne = (BeanPropertyAssocOne<?>)idProperties[0];
|
||||
@@ -88,30 +88,30 @@ public class BeanTable {
|
||||
complexKey = true;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < props.length; i++) {
|
||||
|
||||
String lc = props[i].getDbColumn();
|
||||
String fk = lc;
|
||||
if (foreignKeyPrefix != null){
|
||||
fk = foreignKeyPrefix+"_"+fk;
|
||||
}
|
||||
|
||||
if (complexKey){
|
||||
// just to copy the column name rather than prefix with the foreignKeyPrefix.
|
||||
// I think that with complex keys this is the more common approach.
|
||||
String msg = "On table["+baseTable+"] foreign key column ["+lc+"]";
|
||||
logger.debug(msg);
|
||||
fk = lc;
|
||||
}
|
||||
|
||||
DeployTableJoinColumn joinCol = new DeployTableJoinColumn(lc, fk);
|
||||
if (reverse){
|
||||
joinCol = joinCol.reverse();
|
||||
}
|
||||
join.addJoinColumn(joinCol);
|
||||
}
|
||||
|
||||
|
||||
for (BeanProperty prop : props) {
|
||||
|
||||
String lc = prop.getDbColumn();
|
||||
String fk = lc;
|
||||
if (foreignKeyPrefix != null) {
|
||||
fk = foreignKeyPrefix + "_" + fk;
|
||||
}
|
||||
|
||||
if (complexKey) {
|
||||
// just to copy the column name rather than prefix with the foreignKeyPrefix.
|
||||
// I think that with complex keys this is the more common approach.
|
||||
String msg = "On table[" + baseTable + "] foreign key column [" + lc + "]";
|
||||
logger.debug(msg);
|
||||
fk = lc;
|
||||
}
|
||||
|
||||
DeployTableJoinColumn joinCol = new DeployTableJoinColumn(lc, fk);
|
||||
if (reverse) {
|
||||
joinCol = joinCol.reverse();
|
||||
}
|
||||
join.addJoinColumn(joinCol);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+42
-42
@@ -16,18 +16,18 @@ import java.util.List;
|
||||
public class ChainedBeanPersistController implements BeanPersistController {
|
||||
|
||||
private static final Sorter SORTER = new Sorter();
|
||||
|
||||
|
||||
private final List<BeanPersistController> list;
|
||||
|
||||
private final BeanPersistController[] chain;
|
||||
|
||||
|
||||
/**
|
||||
* Construct adding 2 BeanPersistController's.
|
||||
*/
|
||||
public ChainedBeanPersistController(BeanPersistController c1, BeanPersistController c2) {
|
||||
this(addList(c1, c2));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Helper method used to create a list from 2 BeanPersistController's.
|
||||
*/
|
||||
@@ -37,7 +37,7 @@ public class ChainedBeanPersistController implements BeanPersistController {
|
||||
addList.add(c2);
|
||||
return addList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Construct given the list of BeanPersistController's.
|
||||
*/
|
||||
@@ -65,11 +65,11 @@ public class ChainedBeanPersistController implements BeanPersistController {
|
||||
ArrayList<BeanPersistController> newList = new ArrayList<>();
|
||||
newList.addAll(list);
|
||||
newList.add(c);
|
||||
|
||||
|
||||
return new ChainedBeanPersistController(newList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* De-register a BeanPersistController and return the resulting chain.
|
||||
*/
|
||||
@@ -80,11 +80,11 @@ public class ChainedBeanPersistController implements BeanPersistController {
|
||||
ArrayList<BeanPersistController> newList = new ArrayList<>();
|
||||
newList.addAll(list);
|
||||
newList.remove(c);
|
||||
|
||||
|
||||
return new ChainedBeanPersistController(newList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Always returns 0 (not used for this object).
|
||||
*/
|
||||
@@ -103,69 +103,69 @@ public class ChainedBeanPersistController implements BeanPersistController {
|
||||
|
||||
@Override
|
||||
public void postDelete(BeanPersistRequest<?> request) {
|
||||
for (int i = 0; i < chain.length; i++) {
|
||||
chain[i].postDelete(request);
|
||||
}
|
||||
for (BeanPersistController aChain : chain) {
|
||||
aChain.postDelete(request);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInsert(BeanPersistRequest<?> request) {
|
||||
for (int i = 0; i < chain.length; i++) {
|
||||
chain[i].postInsert(request);
|
||||
}
|
||||
for (BeanPersistController aChain : chain) {
|
||||
aChain.postInsert(request);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postUpdate(BeanPersistRequest<?> request) {
|
||||
for (int i = 0; i < chain.length; i++) {
|
||||
chain[i].postUpdate(request);
|
||||
}
|
||||
for (BeanPersistController aChain : chain) {
|
||||
aChain.postUpdate(request);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postSoftDelete(BeanPersistRequest<?> request) {
|
||||
for (int i = 0; i < chain.length; i++) {
|
||||
chain[i].postSoftDelete(request);
|
||||
}
|
||||
for (BeanPersistController aChain : chain) {
|
||||
aChain.postSoftDelete(request);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean preDelete(BeanPersistRequest<?> request) {
|
||||
for (int i = 0; i < chain.length; i++) {
|
||||
if (!chain[i].preDelete(request)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (BeanPersistController aChain : chain) {
|
||||
if (!aChain.preDelete(request)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean preSoftDelete(BeanPersistRequest<?> request) {
|
||||
for (int i = 0; i < chain.length; i++) {
|
||||
if (!chain[i].preSoftDelete(request)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (BeanPersistController aChain : chain) {
|
||||
if (!aChain.preSoftDelete(request)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean preInsert(BeanPersistRequest<?> request) {
|
||||
for (int i = 0; i < chain.length; i++) {
|
||||
if (!chain[i].preInsert(request)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (BeanPersistController aChain : chain) {
|
||||
if (!aChain.preInsert(request)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean preUpdate(BeanPersistRequest<?> request) {
|
||||
for (int i = 0; i < chain.length; i++) {
|
||||
if (!chain[i].preUpdate(request)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (BeanPersistController aChain : chain) {
|
||||
if (!aChain.preUpdate(request)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -175,11 +175,11 @@ public class ChainedBeanPersistController implements BeanPersistController {
|
||||
private static class Sorter implements Comparator<BeanPersistController> {
|
||||
|
||||
public int compare(BeanPersistController o1, BeanPersistController o2) {
|
||||
|
||||
|
||||
int i1 = o1.getExecutionOrder() ;
|
||||
int i2 = o2.getExecutionOrder() ;
|
||||
return (i1<i2 ? -1 : (i1==i2 ? 0 : 1));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+19
-19
@@ -12,9 +12,9 @@ import com.avaje.ebean.event.BeanPersistListener;
|
||||
public class ChainedBeanPersistListener implements BeanPersistListener {
|
||||
|
||||
private final List<BeanPersistListener> list;
|
||||
|
||||
|
||||
private final BeanPersistListener[] chain;
|
||||
|
||||
|
||||
/**
|
||||
* Construct adding 2 BeanPersistListener's.
|
||||
*/
|
||||
@@ -44,7 +44,7 @@ public class ChainedBeanPersistListener implements BeanPersistListener {
|
||||
addList.add(c2);
|
||||
return addList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Construct given the list of BeanPersistListener's.
|
||||
*/
|
||||
@@ -52,7 +52,7 @@ public class ChainedBeanPersistListener implements BeanPersistListener {
|
||||
this.list = list;
|
||||
this.chain = list.toArray(new BeanPersistListener[list.size()]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Register a new BeanPersistListener and return the resulting chain.
|
||||
*/
|
||||
@@ -63,11 +63,11 @@ public class ChainedBeanPersistListener implements BeanPersistListener {
|
||||
List<BeanPersistListener> newList = new ArrayList<>();
|
||||
newList.addAll(list);
|
||||
newList.add(c);
|
||||
|
||||
|
||||
return new ChainedBeanPersistListener(newList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* De-register a BeanPersistListener and return the resulting chain.
|
||||
*/
|
||||
@@ -78,32 +78,32 @@ public class ChainedBeanPersistListener implements BeanPersistListener {
|
||||
ArrayList<BeanPersistListener> newList = new ArrayList<>();
|
||||
newList.addAll(list);
|
||||
newList.remove(c);
|
||||
|
||||
|
||||
return new ChainedBeanPersistListener(newList);
|
||||
}
|
||||
}
|
||||
|
||||
public void deleted(Object bean) {
|
||||
for (int i = 0; i < chain.length; i++) {
|
||||
chain[i].deleted(bean);
|
||||
}
|
||||
for (BeanPersistListener aChain : chain) {
|
||||
aChain.deleted(bean);
|
||||
}
|
||||
}
|
||||
|
||||
public void softDeleted(Object bean) {
|
||||
for (int i = 0; i < chain.length; i++) {
|
||||
chain[i].softDeleted(bean);
|
||||
}
|
||||
for (BeanPersistListener aChain : chain) {
|
||||
aChain.softDeleted(bean);
|
||||
}
|
||||
}
|
||||
|
||||
public void inserted(Object bean) {
|
||||
for (int i = 0; i < chain.length; i++) {
|
||||
chain[i].inserted(bean);
|
||||
}
|
||||
for (BeanPersistListener aChain : chain) {
|
||||
aChain.inserted(bean);
|
||||
}
|
||||
}
|
||||
|
||||
public void updated(Object bean, Set<String> updatedProperties) {
|
||||
for (int i = 0; i < chain.length; i++) {
|
||||
chain[i].updated(bean, updatedProperties);
|
||||
}
|
||||
for (BeanPersistListener aChain : chain) {
|
||||
aChain.updated(bean, updatedProperties);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+6
-6
@@ -70,22 +70,22 @@ public class ChainedBeanPostConstructListener implements BeanPostConstructListen
|
||||
*/
|
||||
@Override
|
||||
public void postConstruct(Object bean) {
|
||||
for (int i = 0; i < chain.length; i++) {
|
||||
chain[i].postConstruct(bean);
|
||||
for (BeanPostConstructListener aChain : chain) {
|
||||
aChain.postConstruct(bean);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void autowire(Object bean) {
|
||||
for (int i = 0; i < chain.length; i++) {
|
||||
chain[i].autowire(bean);
|
||||
for (BeanPostConstructListener aChain : chain) {
|
||||
aChain.autowire(bean);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postCreate(Object bean) {
|
||||
for (int i = 0; i < chain.length; i++) {
|
||||
chain[i].postCreate(bean);
|
||||
for (BeanPostConstructListener aChain : chain) {
|
||||
aChain.postCreate(bean);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ public class ChainedBeanPostLoad implements BeanPostLoad {
|
||||
this.list = list;
|
||||
this.chain = list.toArray(new BeanPostLoad[list.size()]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Register a new BeanPostLoad and return the resulting chain.
|
||||
*/
|
||||
@@ -32,11 +32,11 @@ public class ChainedBeanPostLoad implements BeanPostLoad {
|
||||
List<BeanPostLoad> newList = new ArrayList<>();
|
||||
newList.addAll(list);
|
||||
newList.add(c);
|
||||
|
||||
|
||||
return new ChainedBeanPostLoad(newList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* De-register a BeanPostLoad and return the resulting chain.
|
||||
*/
|
||||
@@ -47,7 +47,7 @@ public class ChainedBeanPostLoad implements BeanPostLoad {
|
||||
ArrayList<BeanPostLoad> newList = new ArrayList<>();
|
||||
newList.addAll(list);
|
||||
newList.remove(c);
|
||||
|
||||
|
||||
return new ChainedBeanPostLoad(newList);
|
||||
}
|
||||
}
|
||||
@@ -70,8 +70,8 @@ public class ChainedBeanPostLoad implements BeanPostLoad {
|
||||
*/
|
||||
@Override
|
||||
public void postLoad(Object bean) {
|
||||
for (int i = 0; i < chain.length; i++) {
|
||||
chain[i].postLoad(bean);
|
||||
}
|
||||
for (BeanPostLoad aChain : chain) {
|
||||
aChain.postLoad(bean);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import com.avaje.ebean.event.BeanQueryRequest;
|
||||
public class ChainedBeanQueryAdapter implements BeanQueryAdapter {
|
||||
|
||||
private static final Sorter SORTER = new Sorter();
|
||||
|
||||
|
||||
private final List<BeanQueryAdapter> list;
|
||||
|
||||
private final BeanQueryAdapter[] chain;
|
||||
@@ -28,7 +28,7 @@ public class ChainedBeanQueryAdapter implements BeanQueryAdapter {
|
||||
Arrays.sort(c, SORTER);
|
||||
this.chain = c;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Register a new BeanQueryAdapter and return the resulting chain.
|
||||
*/
|
||||
@@ -39,11 +39,11 @@ public class ChainedBeanQueryAdapter implements BeanQueryAdapter {
|
||||
List<BeanQueryAdapter> newList = new ArrayList<>();
|
||||
newList.addAll(list);
|
||||
newList.add(c);
|
||||
|
||||
|
||||
return new ChainedBeanQueryAdapter(newList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* De-register a BeanQueryAdapter and return the resulting chain.
|
||||
*/
|
||||
@@ -54,12 +54,12 @@ public class ChainedBeanQueryAdapter implements BeanQueryAdapter {
|
||||
ArrayList<BeanQueryAdapter> newList = new ArrayList<>();
|
||||
newList.addAll(list);
|
||||
newList.remove(c);
|
||||
|
||||
|
||||
return new ChainedBeanQueryAdapter(newList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return 0 as not used by this Chained adapter.
|
||||
*/
|
||||
@@ -75,10 +75,10 @@ public class ChainedBeanQueryAdapter implements BeanQueryAdapter {
|
||||
}
|
||||
|
||||
public void preQuery(BeanQueryRequest<?> request) {
|
||||
|
||||
for (int i = 0; i < chain.length; i++) {
|
||||
chain[i].preQuery(request);
|
||||
}
|
||||
|
||||
for (BeanQueryAdapter aChain : chain) {
|
||||
aChain.preQuery(request);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Helper to order the BeanQueryAdapter's in a chain.
|
||||
@@ -86,11 +86,11 @@ public class ChainedBeanQueryAdapter implements BeanQueryAdapter {
|
||||
private static class Sorter implements Comparator<BeanQueryAdapter> {
|
||||
|
||||
public int compare(BeanQueryAdapter o1, BeanQueryAdapter o2) {
|
||||
|
||||
|
||||
int i1 = o1.getExecutionOrder() ;
|
||||
int i2 = o2.getExecutionOrder() ;
|
||||
return (i1<i2 ? -1 : (i1==i2 ? 0 : 1));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,8 +82,7 @@ public class InheritInfo {
|
||||
*/
|
||||
public void visitChildren(InheritInfoVisitor visitor) {
|
||||
|
||||
for (int i = 0; i < children.size(); i++) {
|
||||
InheritInfo child = children.get(i);
|
||||
for (InheritInfo child : children) {
|
||||
visitor.visit(child);
|
||||
child.visitChildren(visitor);
|
||||
}
|
||||
@@ -117,8 +116,7 @@ public class InheritInfo {
|
||||
if (!descriptor.isSaveRecurseSkippable()) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < children.size(); i++) {
|
||||
InheritInfo child = children.get(i);
|
||||
for (InheritInfo child : children) {
|
||||
if (!child.isNodeSaveRecurseSkippable()) {
|
||||
return false;
|
||||
}
|
||||
@@ -138,8 +136,7 @@ public class InheritInfo {
|
||||
if (!descriptor.isDeleteRecurseSkippable()) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < children.size(); i++) {
|
||||
InheritInfo child = children.get(i);
|
||||
for (InheritInfo child : children) {
|
||||
if (!child.isNodeDeleteRecurseSkippable()) {
|
||||
return false;
|
||||
}
|
||||
@@ -176,8 +173,7 @@ public class InheritInfo {
|
||||
|
||||
BeanProperty prop;
|
||||
|
||||
for (int i = 0, x = children.size(); i < x; i++) {
|
||||
InheritInfo childInfo = children.get(i);
|
||||
for (InheritInfo childInfo : children) {
|
||||
// recursively search this child bean descriptor
|
||||
prop = childInfo.desc().findBeanProperty(propertyName);
|
||||
if (prop != null) {
|
||||
@@ -193,8 +189,7 @@ public class InheritInfo {
|
||||
*/
|
||||
public void addChildrenProperties(SqlTreeProperties selectProps) {
|
||||
|
||||
for (int i = 0, x = children.size(); i < x; i++) {
|
||||
InheritInfo childInfo = children.get(i);
|
||||
for (InheritInfo childInfo : children) {
|
||||
selectProps.add(childInfo.descriptor.propertiesLocal());
|
||||
|
||||
childInfo.addChildrenProperties(selectProps);
|
||||
|
||||
@@ -100,8 +100,8 @@ public class IntersectionRow {
|
||||
sb.append(" ) ");
|
||||
|
||||
List<Object> bindValues = er.getBindValues();
|
||||
for (int i = 0; i < bindValues.size(); i++) {
|
||||
bindParams.setParameter(++count, bindValues.get(i));
|
||||
for (Object bindValue : bindValues) {
|
||||
bindParams.setParameter(++count, bindValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,17 +20,17 @@ public class ParamTypeUtil {
|
||||
* @param matchType the type which has the generic parameter
|
||||
*/
|
||||
public static Class<?> findParamType(Class<?> cls, Class<?> matchType) {
|
||||
|
||||
|
||||
// search for: implementing a generic interface
|
||||
Type paramType = matchByInterfaces(cls, matchType);
|
||||
if (paramType == null){
|
||||
// search for: extending a generic class
|
||||
Type genericSuperclass = cls.getGenericSuperclass();
|
||||
if (genericSuperclass != null){
|
||||
paramType = matchParamType(genericSuperclass, matchType);
|
||||
paramType = matchParamType(genericSuperclass, matchType);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (paramType instanceof Class<?>){
|
||||
// only interested in classes
|
||||
return (Class<?>)paramType;
|
||||
@@ -38,7 +38,7 @@ public class ParamTypeUtil {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if the type is a generic one with parameters and of the correct type we are
|
||||
* searching for. Return the parameter type if this matches otherwise return null.
|
||||
@@ -60,19 +60,19 @@ public class ParamTypeUtil {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Search the interfaces this class implements.
|
||||
*/
|
||||
private static Type matchByInterfaces(Class<?> cls, Class<?> matchType) {
|
||||
|
||||
|
||||
Type[] gis = cls.getGenericInterfaces();
|
||||
for (int i = 0; i < gis.length; i++) {
|
||||
Type match = matchParamType(gis[i], matchType);
|
||||
if (match != null){
|
||||
return match;
|
||||
}
|
||||
}
|
||||
for (Type gi : gis) {
|
||||
Type match = matchParamType(gi, matchType);
|
||||
if (match != null) {
|
||||
return match;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,8 +31,7 @@ public class PersistControllerManager {
|
||||
*/
|
||||
public void addPersistControllers(DeployBeanDescriptor<?> deployDesc) {
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
BeanPersistController c = list.get(i);
|
||||
for (BeanPersistController c : list) {
|
||||
if (c.isRegisterFor(deployDesc.getBeanType())) {
|
||||
logger.debug("BeanPersistController on[" + deployDesc.getFullName() + "] " + c.getClass().getName());
|
||||
deployDesc.addPersistController(c);
|
||||
|
||||
@@ -31,13 +31,12 @@ public class PersistListenerManager {
|
||||
*/
|
||||
public <T> void addPersistListeners(DeployBeanDescriptor<T> deployDesc) {
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
BeanPersistListener listener = list.get(i);
|
||||
for (BeanPersistListener listener : list) {
|
||||
if (listener.isRegisterFor(deployDesc.getBeanType())) {
|
||||
logger.debug("BeanPersistListener on[{}] {}", deployDesc.getFullName(), listener.getClass().getName());
|
||||
deployDesc.addPersistListener(listener);
|
||||
}
|
||||
}
|
||||
logger.debug("BeanPersistListener on[{}] {}", deployDesc.getFullName(), listener.getClass().getName());
|
||||
deployDesc.addPersistListener(listener);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,8 +30,7 @@ public class PostConstructManager {
|
||||
*/
|
||||
public void addPostConstructListeners(DeployBeanDescriptor<?> deployDesc) {
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
BeanPostConstructListener c = list.get(i);
|
||||
for (BeanPostConstructListener c : list) {
|
||||
if (c.isRegisterFor(deployDesc.getBeanType())) {
|
||||
logger.debug("BeanPostLoad on[" + deployDesc.getFullName() + "] " + c.getClass().getName());
|
||||
deployDesc.addPostConstructListener(c);
|
||||
|
||||
@@ -30,8 +30,7 @@ public class PostLoadManager {
|
||||
*/
|
||||
public void addPostLoad(DeployBeanDescriptor<?> deployDesc) {
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
BeanPostLoad c = list.get(i);
|
||||
for (BeanPostLoad c : list) {
|
||||
if (c.isRegisterFor(deployDesc.getBeanType())) {
|
||||
logger.debug("BeanPostLoad on[" + deployDesc.getFullName() + "] " + c.getClass().getName());
|
||||
deployDesc.addPostLoad(c);
|
||||
|
||||
@@ -22,7 +22,7 @@ public final class TableJoin {
|
||||
private final SqlJoinType type;
|
||||
|
||||
private final InheritInfo inheritInfo;
|
||||
|
||||
|
||||
/**
|
||||
* Columns as an array.
|
||||
*/
|
||||
@@ -57,8 +57,8 @@ public final class TableJoin {
|
||||
private int calcQueryHash() {
|
||||
int hc = type.hashCode();
|
||||
hc = hc * 92821 + (table == null ? 0 : table.hashCode());
|
||||
for (int i = 0; i < columns.length; i++) {
|
||||
hc = hc * 92821 + columns[i].queryHash();
|
||||
for (TableJoinColumn column : columns) {
|
||||
hc = hc * 92821 + column.queryHash();
|
||||
}
|
||||
return hc;
|
||||
}
|
||||
@@ -99,8 +99,8 @@ public final class TableJoin {
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder(30);
|
||||
sb.append(type).append(" ").append(table).append(" ");
|
||||
for (int i = 0; i < columns.length; i++) {
|
||||
sb.append(columns[i]).append(" ");
|
||||
for (TableJoinColumn column : columns) {
|
||||
sb.append(column).append(" ");
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
@@ -141,8 +141,8 @@ public final class TableJoin {
|
||||
|
||||
String joinLiteral = joinType.getLiteral(type);
|
||||
ctx.addJoin(joinLiteral, table, columns(), a1, a2, inheritance);
|
||||
|
||||
|
||||
return joinType.autoToOuter(type);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -117,15 +117,15 @@ public final class IdBinderEmbedded implements IdBinder {
|
||||
|
||||
prefix = SplitName.add(prefix, embIdProperty.getName());
|
||||
|
||||
for (int i = 0; i < props.length; i++) {
|
||||
props[i].buildRawSqlSelectChain(prefix, selectChain);
|
||||
for (BeanProperty prop : props) {
|
||||
prop.buildRawSqlSelectChain(prefix, selectChain);
|
||||
}
|
||||
}
|
||||
|
||||
public BeanProperty findBeanProperty(String dbColumnName) {
|
||||
for (int i = 0; i < props.length; i++) {
|
||||
if (dbColumnName.equalsIgnoreCase(props[i].getDbColumn())) {
|
||||
return props[i];
|
||||
for (BeanProperty prop : props) {
|
||||
if (dbColumnName.equalsIgnoreCase(prop.getDbColumn())) {
|
||||
return prop;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@@ -156,8 +156,8 @@ public final class IdBinderEmbedded implements IdBinder {
|
||||
}
|
||||
|
||||
public void addIdInBindValue(SpiExpressionRequest request, Object value) {
|
||||
for (int i = 0; i < props.length; i++) {
|
||||
request.addBindValue(props[i].getValue((EntityBean) value));
|
||||
for (BeanProperty prop : props) {
|
||||
request.addBindValue(prop.getValue((EntityBean) value));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,8 +235,8 @@ public final class IdBinderEmbedded implements IdBinder {
|
||||
|
||||
EntityBean ebValue = (EntityBean)embIdProperty.getValue(bean);
|
||||
Map<String,Object> map = new LinkedHashMap<>();
|
||||
for (int i = 0; i < props.length; i++) {
|
||||
map.put(props[i].getName(), props[i].getValue(ebValue));
|
||||
for (BeanProperty prop : props) {
|
||||
map.put(prop.getName(), prop.getValue(ebValue));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
@@ -250,26 +250,26 @@ public final class IdBinderEmbedded implements IdBinder {
|
||||
Map<String,Object> map = (Map<String, Object>)value;
|
||||
|
||||
EntityBean idValue = idDesc.createEntityBean();
|
||||
for (int i = 0; i < props.length; i++) {
|
||||
Object val = map.get(props[i].getName());
|
||||
props[i].setValue(idValue, val);
|
||||
for (BeanProperty prop : props) {
|
||||
Object val = map.get(prop.getName());
|
||||
prop.setValue(idValue, val);
|
||||
}
|
||||
return idValue;
|
||||
}
|
||||
|
||||
|
||||
public void bindId(DefaultSqlUpdate sqlUpdate, Object value) {
|
||||
for (int i = 0; i < props.length; i++) {
|
||||
Object embFieldValue = props[i].getValue((EntityBean) value);
|
||||
for (BeanProperty prop : props) {
|
||||
Object embFieldValue = prop.getValue((EntityBean) value);
|
||||
sqlUpdate.addParameter(embFieldValue);
|
||||
}
|
||||
}
|
||||
|
||||
public void bindId(DataBind dataBind, Object value) throws SQLException {
|
||||
|
||||
for (int i = 0; i < props.length; i++) {
|
||||
Object embFieldValue = props[i].getValue((EntityBean) value);
|
||||
props[i].bind(dataBind, embFieldValue);
|
||||
for (BeanProperty prop : props) {
|
||||
Object embFieldValue = prop.getValue((EntityBean) value);
|
||||
prop.bind(dataBind, embFieldValue);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -278,9 +278,9 @@ public final class IdBinderEmbedded implements IdBinder {
|
||||
EntityBean embId = idDesc.createEntityBean();
|
||||
boolean notNull = true;
|
||||
|
||||
for (int i = 0; i < props.length; i++) {
|
||||
Object value = props[i].readData(dataInput);
|
||||
props[i].setValue(embId, value);
|
||||
for (BeanProperty prop : props) {
|
||||
Object value = prop.readData(dataInput);
|
||||
prop.setValue(embId, value);
|
||||
if (value == null) {
|
||||
notNull = false;
|
||||
}
|
||||
@@ -294,15 +294,15 @@ public final class IdBinderEmbedded implements IdBinder {
|
||||
}
|
||||
|
||||
public void writeData(DataOutput dataOutput, Object idValue) throws IOException {
|
||||
for (int i = 0; i < props.length; i++) {
|
||||
Object embFieldValue = props[i].getValue((EntityBean) idValue);
|
||||
props[i].writeData(dataOutput, embFieldValue);
|
||||
for (BeanProperty prop : props) {
|
||||
Object embFieldValue = prop.getValue((EntityBean) idValue);
|
||||
prop.writeData(dataOutput, embFieldValue);
|
||||
}
|
||||
}
|
||||
|
||||
public void loadIgnore(DbReadContext ctx) {
|
||||
for (int i = 0; i < props.length; i++) {
|
||||
props[i].loadIgnore(ctx);
|
||||
for (BeanProperty prop : props) {
|
||||
prop.loadIgnore(ctx);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,8 +311,8 @@ public final class IdBinderEmbedded implements IdBinder {
|
||||
EntityBean embId = idDesc.createEntityBean();
|
||||
boolean notNull = true;
|
||||
|
||||
for (int i = 0; i < props.length; i++) {
|
||||
Object value = props[i].readSet(ctx, embId);
|
||||
for (BeanProperty prop : props) {
|
||||
Object value = prop.readSet(ctx, embId);
|
||||
if (value == null) {
|
||||
notNull = false;
|
||||
}
|
||||
@@ -337,8 +337,8 @@ public final class IdBinderEmbedded implements IdBinder {
|
||||
}
|
||||
|
||||
public void appendSelect(DbSqlContext ctx, boolean subQuery) {
|
||||
for (int i = 0; i < props.length; i++) {
|
||||
props[i].appendSelect(ctx, subQuery);
|
||||
for (BeanProperty prop : props) {
|
||||
prop.appendSelect(ctx, subQuery);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,15 +52,15 @@ public class ImportedIdEmbedded implements ImportedId {
|
||||
}
|
||||
|
||||
public void sqlAppend(DbSqlContext ctx) {
|
||||
for (int i = 0; i < imported.length; i++) {
|
||||
ctx.appendColumn(imported[i].localDbColumn);
|
||||
for (ImportedIdSimple anImported : imported) {
|
||||
ctx.appendColumn(anImported.localDbColumn);
|
||||
}
|
||||
}
|
||||
|
||||
public void dmlAppend(GenerateDmlRequest request) {
|
||||
|
||||
for (int i = 0; i < imported.length; i++) {
|
||||
request.appendColumn(imported[i].localDbColumn);
|
||||
for (ImportedIdSimple anImported : imported) {
|
||||
request.appendColumn(anImported.localDbColumn);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,9 +83,9 @@ public class ImportedIdEmbedded implements ImportedId {
|
||||
int pos = position;
|
||||
|
||||
EntityBean embedded = (EntityBean) foreignAssocOne.getValue(bean);
|
||||
for (int i = 0; i < imported.length; i++) {
|
||||
if (imported[i].owner.isUpdateable()) {
|
||||
Object scalarValue = imported[i].foreignProperty.getValue(embedded);
|
||||
for (ImportedIdSimple anImported : imported) {
|
||||
if (anImported.owner.isUpdateable()) {
|
||||
Object scalarValue = anImported.foreignProperty.getValue(embedded);
|
||||
update.setParameter(pos++, scalarValue);
|
||||
}
|
||||
}
|
||||
@@ -101,18 +101,18 @@ public class ImportedIdEmbedded implements ImportedId {
|
||||
}
|
||||
|
||||
if (embeddedId == null) {
|
||||
for (int i = 0; i < imported.length; i++) {
|
||||
if (imported[i].owner.isUpdateable()) {
|
||||
request.bind(null, imported[i].foreignProperty);
|
||||
for (ImportedIdSimple anImported : imported) {
|
||||
if (anImported.owner.isUpdateable()) {
|
||||
request.bind(null, anImported.foreignProperty);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
EntityBean embedded = (EntityBean) embeddedId;
|
||||
for (int i = 0; i < imported.length; i++) {
|
||||
if (imported[i].owner.isUpdateable()) {
|
||||
Object scalarValue = imported[i].foreignProperty.getValue(embedded);
|
||||
request.bind(scalarValue, imported[i].foreignProperty);
|
||||
for (ImportedIdSimple anImported : imported) {
|
||||
if (anImported.owner.isUpdateable()) {
|
||||
Object scalarValue = anImported.foreignProperty.getValue(embedded);
|
||||
request.bind(scalarValue, anImported.foreignProperty);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -128,9 +128,9 @@ public class ImportedIdEmbedded implements ImportedId {
|
||||
throw new PersistenceException(msg);
|
||||
}
|
||||
|
||||
for (int i = 0; i < imported.length; i++) {
|
||||
Object scalarValue = imported[i].foreignProperty.getValue(embeddedId);
|
||||
row.put(imported[i].localDbColumn, scalarValue);
|
||||
for (ImportedIdSimple anImported : imported) {
|
||||
Object scalarValue = anImported.foreignProperty.getValue(embeddedId);
|
||||
row.put(anImported.localDbColumn, scalarValue);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -140,8 +140,8 @@ public class ImportedIdEmbedded implements ImportedId {
|
||||
*/
|
||||
public BeanProperty findMatchImport(String matchDbColumn) {
|
||||
|
||||
for (int i = 0; i < imported.length; i++) {
|
||||
BeanProperty p = imported[i].findMatchImport(matchDbColumn);
|
||||
for (ImportedIdSimple anImported : imported) {
|
||||
BeanProperty p = anImported.findMatchImport(matchDbColumn);
|
||||
if (p != null) {
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -302,8 +302,8 @@ public class DeployBeanDescriptor<T> {
|
||||
|
||||
public boolean isScalaObject() {
|
||||
Class<?>[] interfaces = beanType.getInterfaces();
|
||||
for (int i = 0; i < interfaces.length; i++) {
|
||||
String iname = interfaces[i].getName();
|
||||
for (Class<?> anInterface : interfaces) {
|
||||
String iname = anInterface.getName();
|
||||
if (I_SCALAOBJECT.equals(iname)) {
|
||||
return true;
|
||||
}
|
||||
@@ -546,7 +546,7 @@ public class DeployBeanDescriptor<T> {
|
||||
return new ChainedBeanPostConstructListener(postConstructListeners);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void addPersistController(BeanPersistController controller) {
|
||||
persistControllers.add(controller);
|
||||
}
|
||||
@@ -566,7 +566,7 @@ public class DeployBeanDescriptor<T> {
|
||||
public void addPostConstructListener(BeanPostConstructListener postConstructListener) {
|
||||
postConstructListeners.add(postConstructListener);
|
||||
}
|
||||
|
||||
|
||||
public String getDraftTable() {
|
||||
return draftTable;
|
||||
}
|
||||
@@ -635,8 +635,8 @@ public class DeployBeanDescriptor<T> {
|
||||
Collections.sort(list, PROP_ORDER);
|
||||
|
||||
propMap = new LinkedHashMap<>(list.size());
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
addBeanProperty(list.get(i));
|
||||
for (DeployBeanProperty aList : list) {
|
||||
addBeanProperty(aList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+36
-40
@@ -42,7 +42,7 @@ public class DeployBeanPropertyLists {
|
||||
private final List<BeanProperty> mutable = new ArrayList<>();
|
||||
|
||||
private final List<BeanPropertyAssocMany<?>> manys = new ArrayList<>();
|
||||
|
||||
|
||||
private final List<BeanProperty> nonManys = new ArrayList<>();
|
||||
|
||||
private final List<BeanPropertyAssocOne<?>> ones = new ArrayList<>();
|
||||
@@ -179,7 +179,7 @@ public class DeployBeanPropertyLists {
|
||||
if (prop.isMutableScalarType()) {
|
||||
mutable.add(prop);
|
||||
}
|
||||
|
||||
|
||||
if (desc.getInheritInfo() != null && prop.isLocal()) {
|
||||
local.add(prop);
|
||||
}
|
||||
@@ -349,22 +349,21 @@ public class DeployBeanPropertyLists {
|
||||
|
||||
private BeanPropertyAssocOne<?>[] getOne(boolean imported, Mode mode) {
|
||||
ArrayList<BeanPropertyAssocOne<?>> list = new ArrayList<>();
|
||||
for (int i = 0; i < ones.size(); i++) {
|
||||
BeanPropertyAssocOne<?> prop = ones.get(i);
|
||||
for (BeanPropertyAssocOne<?> prop : ones) {
|
||||
if (imported != prop.isOneToOneExported()) {
|
||||
switch (mode) {
|
||||
case Save:
|
||||
if (prop.getCascadeInfo().isSave()) {
|
||||
list.add(prop);
|
||||
}
|
||||
break;
|
||||
case Delete:
|
||||
if (prop.getCascadeInfo().isDelete()) {
|
||||
list.add(prop);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case Save:
|
||||
if (prop.getCascadeInfo().isSave()) {
|
||||
list.add(prop);
|
||||
}
|
||||
break;
|
||||
case Delete:
|
||||
if (prop.getCascadeInfo().isDelete()) {
|
||||
list.add(prop);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -374,8 +373,7 @@ public class DeployBeanPropertyLists {
|
||||
|
||||
private BeanPropertyAssocMany<?>[] getMany2Many() {
|
||||
ArrayList<BeanPropertyAssocMany<?>> list = new ArrayList<>();
|
||||
for (int i = 0; i < manys.size(); i++) {
|
||||
BeanPropertyAssocMany<?> prop = manys.get(i);
|
||||
for (BeanPropertyAssocMany<?> prop : manys) {
|
||||
if (prop.isManyToMany()) {
|
||||
list.add(prop);
|
||||
}
|
||||
@@ -386,27 +384,25 @@ public class DeployBeanPropertyLists {
|
||||
|
||||
private BeanPropertyAssocMany<?>[] getMany(Mode mode) {
|
||||
ArrayList<BeanPropertyAssocMany<?>> list = new ArrayList<>();
|
||||
for (int i = 0; i < manys.size(); i++) {
|
||||
BeanPropertyAssocMany<?> prop = manys.get(i);
|
||||
|
||||
for (BeanPropertyAssocMany<?> prop : manys) {
|
||||
switch (mode) {
|
||||
case Save:
|
||||
if (prop.getCascadeInfo().isSave() || prop.isManyToMany()
|
||||
case Save:
|
||||
if (prop.getCascadeInfo().isSave() || prop.isManyToMany()
|
||||
|| ModifyListenMode.REMOVALS.equals(prop.getModifyListenMode())) {
|
||||
// Note ManyToMany always included as we always 'save'
|
||||
// the relationship via insert/delete of intersection table
|
||||
// REMOVALS means including PrivateOwned relationships
|
||||
list.add(prop);
|
||||
}
|
||||
break;
|
||||
case Delete:
|
||||
if (prop.getCascadeInfo().isDelete() || ModifyListenMode.REMOVALS.equals(prop.getModifyListenMode())) {
|
||||
// REMOVALS means including PrivateOwned relationships
|
||||
list.add(prop);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
// Note ManyToMany always included as we always 'save'
|
||||
// the relationship via insert/delete of intersection table
|
||||
// REMOVALS means including PrivateOwned relationships
|
||||
list.add(prop);
|
||||
}
|
||||
break;
|
||||
case Delete:
|
||||
if (prop.getCascadeInfo().isDelete() || ModifyListenMode.REMOVALS.equals(prop.getModifyListenMode())) {
|
||||
// REMOVALS means including PrivateOwned relationships
|
||||
list.add(prop);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -419,15 +415,15 @@ public class DeployBeanPropertyLists {
|
||||
if (deployProp instanceof DeployBeanPropertyAssocOne) {
|
||||
return new BeanPropertyAssocOne(owner, desc, (DeployBeanPropertyAssocOne) deployProp);
|
||||
}
|
||||
|
||||
|
||||
if (deployProp instanceof DeployBeanPropertySimpleCollection<?>) {
|
||||
return new BeanPropertySimpleCollection(desc, (DeployBeanPropertySimpleCollection) deployProp);
|
||||
}
|
||||
|
||||
|
||||
if (deployProp instanceof DeployBeanPropertyAssocMany) {
|
||||
return new BeanPropertyAssocMany(desc, (DeployBeanPropertyAssocMany) deployProp);
|
||||
}
|
||||
|
||||
|
||||
if (deployProp instanceof DeployBeanPropertyCompound) {
|
||||
return new BeanPropertyCompound(desc, (DeployBeanPropertyCompound) deployProp);
|
||||
}
|
||||
|
||||
@@ -54,8 +54,8 @@ public class DeployTableJoin {
|
||||
*/
|
||||
public void setColumns(DeployTableJoinColumn[] cols, boolean reverse) {
|
||||
columns = new ArrayList<>();
|
||||
for (int i = 0; i < cols.length; i++) {
|
||||
addJoinColumn(cols[i].copy(reverse));
|
||||
for (DeployTableJoinColumn col : cols) {
|
||||
addJoinColumn(col.copy(reverse));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,8 +86,8 @@ public class DeployTableJoin {
|
||||
* Add a JoinColumn array.
|
||||
*/
|
||||
public void addJoinColumn(boolean order, JoinColumn[] jcArray, BeanTable beanTable) {
|
||||
for (int i = 0; i < jcArray.length; i++) {
|
||||
addJoinColumn(order, jcArray[i], beanTable);
|
||||
for (JoinColumn aJcArray : jcArray) {
|
||||
addJoinColumn(order, aJcArray, beanTable);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -228,20 +228,20 @@ public class AnnotationAssocManys extends AnnotationParser {
|
||||
if (!intJoin.hasJoinColumns()) {
|
||||
// define foreign key columns
|
||||
BeanProperty[] localIds = localTable.getIdProperties();
|
||||
for (int i = 0; i < localIds.length; i++) {
|
||||
for (BeanProperty localId : localIds) {
|
||||
// add the source to intersection join columns
|
||||
String fkCol = localTableName + "_" + localIds[i].getDbColumn();
|
||||
intJoin.addJoinColumn(new DeployTableJoinColumn(localIds[i].getDbColumn(), namingConvention.getColumnFromProperty(null, fkCol)));
|
||||
String fkCol = localTableName + "_" + localId.getDbColumn();
|
||||
intJoin.addJoinColumn(new DeployTableJoinColumn(localId.getDbColumn(), namingConvention.getColumnFromProperty(null, fkCol)));
|
||||
}
|
||||
}
|
||||
|
||||
if (!destJoin.hasJoinColumns()) {
|
||||
// define inverse foreign key columns
|
||||
BeanProperty[] otherIds = otherTable.getIdProperties();
|
||||
for (int i = 0; i < otherIds.length; i++) {
|
||||
for (BeanProperty otherId : otherIds) {
|
||||
// set the intersection to dest table join columns
|
||||
final String fkCol = otherTableName + "_" + otherIds[i].getDbColumn();
|
||||
destJoin.addJoinColumn(new DeployTableJoinColumn(namingConvention.getColumnFromProperty(null, fkCol), otherIds[i].getDbColumn()));
|
||||
final String fkCol = otherTableName + "_" + otherId.getDbColumn();
|
||||
destJoin.addJoinColumn(new DeployTableJoinColumn(namingConvention.getColumnFromProperty(null, fkCol), otherId.getDbColumn()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ public abstract class AnnotationParser extends AnnotationBase {
|
||||
protected final Class<?> beanType;
|
||||
|
||||
protected final boolean validationAnnotations;
|
||||
|
||||
|
||||
public AnnotationParser(DeployBeanInfo<?> info, boolean validationAnnotations) {
|
||||
super(info.getUtil());
|
||||
this.validationAnnotations = validationAnnotations;
|
||||
@@ -56,9 +56,9 @@ public abstract class AnnotationParser extends AnnotationBase {
|
||||
if (attrOverrides != null) {
|
||||
HashMap<String, String> propMap = new HashMap<>();
|
||||
AttributeOverride[] aoArray = attrOverrides.value();
|
||||
for (int i = 0; i < aoArray.length; i++) {
|
||||
String propName = aoArray[i].name();
|
||||
String columnName = aoArray[i].column().name();
|
||||
for (AttributeOverride anAoArray : aoArray) {
|
||||
String propName = anAoArray.name();
|
||||
String columnName = anAoArray.column().name();
|
||||
|
||||
propMap.put(propName, columnName);
|
||||
}
|
||||
|
||||
+6
-7
@@ -38,7 +38,7 @@ import java.lang.reflect.Type;
|
||||
public class DeployCreateProperties {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(DeployCreateProperties.class);
|
||||
|
||||
|
||||
private final DetermineManyType determineManyType;
|
||||
|
||||
private final TypeManager typeManager;
|
||||
@@ -183,10 +183,9 @@ public class DeployCreateProperties {
|
||||
String methIsName = "is" + initFieldName;
|
||||
String scalaGet = field.getName();
|
||||
|
||||
for (int i = 0; i < declaredMethods.length; i++) {
|
||||
Method m = declaredMethods[i];
|
||||
for (Method m : declaredMethods) {
|
||||
if ((scalaObject && m.getName().equals(scalaGet)) || m.getName().equals(methGetName)
|
||||
|| m.getName().equals(methIsName)) {
|
||||
|| m.getName().equals(methIsName)) {
|
||||
|
||||
Class<?>[] params = m.getParameterTypes();
|
||||
if (params.length == 0) {
|
||||
@@ -222,7 +221,7 @@ public class DeployCreateProperties {
|
||||
private DeployBeanProperty createProp(DeployBeanDescriptor<?> desc, Field field) {
|
||||
|
||||
Class<?> propertyType = field.getType();
|
||||
|
||||
|
||||
ManyToOne manyToOne = AnnotationBase.findAnnotation(field,ManyToOne.class);
|
||||
if (manyToOne != null){
|
||||
Class<?> tt = manyToOne.targetEntity();
|
||||
@@ -233,7 +232,7 @@ public class DeployCreateProperties {
|
||||
if (isSpecialScalarType(field)) {
|
||||
return new DeployBeanProperty(desc, propertyType, field.getGenericType());
|
||||
}
|
||||
|
||||
|
||||
// check for Collection type (list, set or map)
|
||||
ManyType manyType = determineManyType.getManyType(propertyType);
|
||||
if (manyType != null) {
|
||||
@@ -303,7 +302,7 @@ public class DeployCreateProperties {
|
||||
|| (AnnotationBase.findAnnotation(field,DbArray.class) != null)
|
||||
|| (AnnotationBase.findAnnotation(field,DbHstore.class) != null);
|
||||
}
|
||||
|
||||
|
||||
private boolean isTransientField(Field field) {
|
||||
|
||||
Transient t = AnnotationBase.findAnnotation(field,Transient.class);
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.util.HashSet;
|
||||
*/
|
||||
public class SqlReservedWords {
|
||||
|
||||
private static final String baseKeyWords =
|
||||
private static final String baseKeyWords =
|
||||
"ALIAS,ALTER,ADD,ALL,ARE,AND,ANY,ARRAY"
|
||||
+",AS,ASC,AT"
|
||||
+",AVG,BEGIN,BETWEEN,BIGINT,BINARY,BIT,BIT_LENGTH,BLOB,BOOLEAN"
|
||||
@@ -44,15 +44,15 @@ public class SqlReservedWords {
|
||||
+",UPDATE,USER,VARCHAR,VIEW,WHEN"
|
||||
+",WHERE,WITH";
|
||||
|
||||
|
||||
|
||||
private static final HashSet<String> keywords = new HashSet<>();
|
||||
static {
|
||||
|
||||
|
||||
String[] initialKeywords = baseKeyWords.split(",");
|
||||
for (int i = 0; i < initialKeywords.length; i++) {
|
||||
keywords.add(initialKeywords[i].trim());
|
||||
}
|
||||
|
||||
for (String initialKeyword : initialKeywords) {
|
||||
keywords.add(initialKeyword.trim());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ public class SqlReservedWords {
|
||||
String s = keyword.trim().toUpperCase();
|
||||
return keywords.contains(s);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a sql keyword to the known set.
|
||||
*/
|
||||
@@ -71,7 +71,7 @@ public class SqlReservedWords {
|
||||
if (keyword != null){
|
||||
keyword = keyword.trim().toUpperCase();
|
||||
if (!keyword.isEmpty()){
|
||||
keywords.add(keyword);
|
||||
keywords.add(keyword);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+20
-23
@@ -11,41 +11,38 @@ import com.avaje.ebeaninternal.server.deploy.meta.DeployBeanPropertyAssocOne;
|
||||
* Mark transient properties.
|
||||
*/
|
||||
public class TransientProperties {
|
||||
|
||||
|
||||
public TransientProperties() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Mark any additional properties as transient.
|
||||
*/
|
||||
public void process(DeployBeanDescriptor<?> desc) {
|
||||
|
||||
|
||||
List<DeployBeanProperty> props = desc.propertiesBase();
|
||||
for (int i = 0; i < props.size(); i++) {
|
||||
DeployBeanProperty prop = props.get(i);
|
||||
if (!prop.isDbRead() && !prop.isDbInsertable() && !prop.isDbUpdateable()) {
|
||||
// non-transient...
|
||||
prop.setTransient();
|
||||
}
|
||||
}
|
||||
for (DeployBeanProperty prop : props) {
|
||||
if (!prop.isDbRead() && !prop.isDbInsertable() && !prop.isDbUpdateable()) {
|
||||
// non-transient...
|
||||
prop.setTransient();
|
||||
}
|
||||
}
|
||||
|
||||
List<DeployBeanPropertyAssocOne<?>> ones = desc.propertiesAssocOne();
|
||||
for (int i = 0; i < ones.size(); i++) {
|
||||
DeployBeanPropertyAssocOne<?> prop = ones.get(i);
|
||||
if (prop.getBeanTable() == null) {
|
||||
if (!prop.isEmbedded()) {
|
||||
prop.setTransient();
|
||||
}
|
||||
}
|
||||
for (DeployBeanPropertyAssocOne<?> prop : ones) {
|
||||
if (prop.getBeanTable() == null) {
|
||||
if (!prop.isEmbedded()) {
|
||||
prop.setTransient();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<DeployBeanPropertyAssocMany<?>> manys = desc.propertiesAssocMany();
|
||||
for (int i = 0; i < manys.size(); i++) {
|
||||
DeployBeanPropertyAssocMany<?> prop = manys.get(i);
|
||||
if (prop.getBeanTable() == null) {
|
||||
prop.setTransient();
|
||||
}
|
||||
for (DeployBeanPropertyAssocMany<?> prop : manys) {
|
||||
if (prop.getBeanTable() == null) {
|
||||
prop.setTransient();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,8 +18,8 @@ public final class ElComparatorCompound<T> implements Comparator<T>, ElComparato
|
||||
|
||||
public int compare(T o1, T o2) {
|
||||
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
int ret = array[i].compare(o1, o2);
|
||||
for (ElComparator<T> anArray : array) {
|
||||
int ret = anArray.compare(o1, o2);
|
||||
if (ret != 0) {
|
||||
return ret;
|
||||
}
|
||||
@@ -30,8 +30,8 @@ public final class ElComparatorCompound<T> implements Comparator<T>, ElComparato
|
||||
|
||||
public int compareValue(Object value, T o2) {
|
||||
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
int ret = array[i].compareValue(value, o2);
|
||||
for (ElComparator<T> anArray : array) {
|
||||
int ret = anArray.compareValue(value, o2);
|
||||
if (ret != 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -47,8 +47,7 @@ public final class ElFilter<T> implements Filter<T> {
|
||||
}
|
||||
|
||||
protected boolean isMatch(T bean) {
|
||||
for (int i = 0; i < matches.size(); i++) {
|
||||
ElMatcher<T> matcher = matches.get(i);
|
||||
for (ElMatcher<T> matcher : matches) {
|
||||
if (!matcher.isMatch(bean)) {
|
||||
return false;
|
||||
}
|
||||
@@ -235,8 +234,7 @@ public final class ElFilter<T> implements Filter<T> {
|
||||
|
||||
ArrayList<T> filterList = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
T t = list.get(i);
|
||||
for (T t : list) {
|
||||
if (isMatch(t)) {
|
||||
filterList.add(t);
|
||||
if (maxRows > 0 && filterList.size() >= maxRows) {
|
||||
|
||||
@@ -193,8 +193,8 @@ public class ElPropertyChain implements ElPropertyValue {
|
||||
}
|
||||
|
||||
public boolean isAssocProperty() {
|
||||
for (int i = 0; i < chain.length; i++) {
|
||||
if (chain[i].isAssocProperty()) {
|
||||
for (ElPropertyValue aChain : chain) {
|
||||
if (aChain.isAssocProperty()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -233,8 +233,8 @@ public class ElPropertyChain implements ElPropertyValue {
|
||||
|
||||
@Override
|
||||
public Object pathGet(Object bean) {
|
||||
for (int i = 0; i < chain.length; i++) {
|
||||
bean = chain[i].pathGet(bean);
|
||||
for (ElPropertyValue aChain : chain) {
|
||||
bean = aChain.pathGet(bean);
|
||||
if (bean == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
+2
-2
@@ -35,8 +35,8 @@ public class ArrayContainsExpression extends AbstractExpression {
|
||||
} else {
|
||||
context.startBoolMustNot();
|
||||
}
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
context.writeEqualTo(propName, values[i]);
|
||||
for (Object value : values) {
|
||||
context.writeEqualTo(propName, value);
|
||||
}
|
||||
context.endBool();
|
||||
}
|
||||
|
||||
+9
-10
@@ -124,8 +124,8 @@ public class DefaultExampleExpression implements SpiExpression, ExampleExpressio
|
||||
public void containsMany(BeanDescriptor<?> desc, ManyWhereJoins whereManyJoins) {
|
||||
list = buildExpressions(desc);
|
||||
if (list != null) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
list.get(i).containsMany(desc, whereManyJoins);
|
||||
for (SpiExpression aList : list) {
|
||||
aList.containsMany(desc, whereManyJoins);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -173,8 +173,8 @@ public class DefaultExampleExpression implements SpiExpression, ExampleExpressio
|
||||
|
||||
@Override
|
||||
public void validate(SpiExpressionValidation validation) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
list.get(i).validate(validation);
|
||||
for (SpiExpression aList : list) {
|
||||
aList.validate(validation);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,8 +184,7 @@ public class DefaultExampleExpression implements SpiExpression, ExampleExpressio
|
||||
@Override
|
||||
public void addBindValues(SpiExpressionRequest request) {
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
SpiExpression item = list.get(i);
|
||||
for (SpiExpression item : list) {
|
||||
item.addBindValues(request);
|
||||
}
|
||||
}
|
||||
@@ -218,8 +217,8 @@ public class DefaultExampleExpression implements SpiExpression, ExampleExpressio
|
||||
public void queryPlanHash(HashQueryPlanBuilder builder) {
|
||||
|
||||
builder.add(DefaultExampleExpression.class);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
list.get(i).queryPlanHash(builder);
|
||||
for (SpiExpression aList : list) {
|
||||
aList.queryPlanHash(builder);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,8 +228,8 @@ public class DefaultExampleExpression implements SpiExpression, ExampleExpressio
|
||||
@Override
|
||||
public int queryBindHash() {
|
||||
int hc = DefaultExampleExpression.class.getName().hashCode();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
hc = hc * 92821 + list.get(i).queryBindHash();
|
||||
for (SpiExpression aList : list) {
|
||||
hc = hc * 92821 + aList.queryBindHash();
|
||||
}
|
||||
return hc;
|
||||
}
|
||||
|
||||
+16
-17
@@ -139,11 +139,10 @@ public class DefaultExpressionList<T> implements SpiExpressionList<T> {
|
||||
if (implicitBool) {
|
||||
context.startBoolGroupList(Junction.Type.SHOULD);
|
||||
}
|
||||
for (int i = 0; i < size; i++) {
|
||||
SpiExpression expr = list.get(i);
|
||||
for (SpiExpression expr : list) {
|
||||
if (explicitBool) {
|
||||
try {
|
||||
((SpiJunction<?>)expr).writeDocQueryJunction(context);
|
||||
((SpiJunction<?>) expr).writeDocQueryJunction(context);
|
||||
} catch (ClassCastException e) {
|
||||
throw new IllegalStateException("The top level text() expressions should be all be 'Must', 'Should' or 'Must Not' or none of them should be.", e);
|
||||
}
|
||||
@@ -177,8 +176,8 @@ public class DefaultExpressionList<T> implements SpiExpressionList<T> {
|
||||
if (idEquals != null) {
|
||||
idEquals.writeDocQuery(context);
|
||||
}
|
||||
for (int i = 0; i < size; i++) {
|
||||
list.get(i).writeDocQuery(context);
|
||||
for (SpiExpression aList : list) {
|
||||
aList.writeDocQuery(context);
|
||||
}
|
||||
context.endBool();
|
||||
}
|
||||
@@ -226,15 +225,15 @@ public class DefaultExpressionList<T> implements SpiExpressionList<T> {
|
||||
@Override
|
||||
public void containsMany(BeanDescriptor<?> desc, ManyWhereJoins whereManyJoins) {
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
list.get(i).containsMany(desc, whereManyJoins);
|
||||
for (SpiExpression aList : list) {
|
||||
aList.containsMany(desc, whereManyJoins);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate(SpiExpressionValidation validation) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
list.get(i).validate(validation);
|
||||
for (SpiExpression aList : list) {
|
||||
aList.validate(validation);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -480,15 +479,15 @@ public class DefaultExpressionList<T> implements SpiExpressionList<T> {
|
||||
|
||||
@Override
|
||||
public void addBindValues(SpiExpressionRequest request) {
|
||||
for (int i = 0, size = list.size(); i < size; i++) {
|
||||
list.get(i).addBindValues(request);
|
||||
for (SpiExpression aList : list) {
|
||||
aList.addBindValues(request);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prepareExpression(BeanQueryRequest<?> request) {
|
||||
for (int i = 0, size = list.size(); i < size; i++) {
|
||||
list.get(i).prepareExpression(request);
|
||||
for (SpiExpression aList : list) {
|
||||
aList.prepareExpression(request);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -499,8 +498,8 @@ public class DefaultExpressionList<T> implements SpiExpressionList<T> {
|
||||
@Override
|
||||
public void queryPlanHash(HashQueryPlanBuilder builder) {
|
||||
builder.add(DefaultExpressionList.class);
|
||||
for (int i = 0, size = list.size(); i < size; i++) {
|
||||
list.get(i).queryPlanHash(builder);
|
||||
for (SpiExpression aList : list) {
|
||||
aList.queryPlanHash(builder);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -510,8 +509,8 @@ public class DefaultExpressionList<T> implements SpiExpressionList<T> {
|
||||
@Override
|
||||
public int queryBindHash() {
|
||||
int hash = DefaultExpressionList.class.getName().hashCode();
|
||||
for (int i = 0, size = list.size(); i < size; i++) {
|
||||
hash = hash * 92821 + list.get(i).queryBindHash();
|
||||
for (SpiExpression aList : list) {
|
||||
hash = hash * 92821 + aList.queryBindHash();
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
+1
-2
@@ -63,8 +63,7 @@ public class DefaultExpressionRequest implements SpiExpressionRequest {
|
||||
* Bind the values from the underlying expression list.
|
||||
*/
|
||||
public void bind(DataBind dataBind) throws SQLException {
|
||||
for (int i = 0; i < bindValues.size(); i++) {
|
||||
Object bindValue = bindValues.get(i);
|
||||
for (Object bindValue : bindValues) {
|
||||
binder.bindObject(dataBind, bindValue);
|
||||
}
|
||||
if (bindLog != null) {
|
||||
|
||||
@@ -98,8 +98,8 @@ class ExistsQueryExpression implements SpiExpression, UnsupportedDocStoreExpress
|
||||
@Override
|
||||
public void addBindValues(SpiExpressionRequest request) {
|
||||
|
||||
for (int i = 0; i < bindParams.size(); i++) {
|
||||
request.addBindValue(bindParams.get(i));
|
||||
for (Object bindParam : bindParams) {
|
||||
request.addBindValue(bindParam);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,8 +50,8 @@ class IdExpression extends NonPrepareExpression implements SpiExpression {
|
||||
// into an array of the underlying scalar field values
|
||||
DefaultExpressionRequest r = (DefaultExpressionRequest) request;
|
||||
Object[] bindIdValues = r.getBeanDescriptor().getBindIdValues(value);
|
||||
for (int i = 0; i < bindIdValues.length; i++) {
|
||||
request.addBindValue(bindIdValues[i]);
|
||||
for (Object bindIdValue : bindIdValues) {
|
||||
request.addBindValue(bindIdValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,8 +50,8 @@ public class IdInExpression extends NonPrepareExpression {
|
||||
BeanDescriptor<?> descriptor = r.getBeanDescriptor();
|
||||
IdBinder idBinder = descriptor.getIdBinder();
|
||||
|
||||
for (int i = 0; i < idList.size(); i++) {
|
||||
idBinder.addIdInBindValue(request, idList.get(i));
|
||||
for (Object anIdList : idList) {
|
||||
idBinder.addIdInBindValue(request, anIdList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -59,16 +59,16 @@ class InExpression extends AbstractExpression {
|
||||
prop = null;
|
||||
}
|
||||
|
||||
for (int i = 0; i < bindValues.length; i++) {
|
||||
for (Object bindValue : bindValues) {
|
||||
if (prop == null) {
|
||||
request.addBindValue(bindValues[i]);
|
||||
request.addBindValue(bindValue);
|
||||
|
||||
} else {
|
||||
// extract the id values from the bean
|
||||
Object[] ids = prop.getAssocIdValues((EntityBean) bindValues[i]);
|
||||
Object[] ids = prop.getAssocIdValues((EntityBean) bindValue);
|
||||
if (ids != null) {
|
||||
for (int j = 0; j < ids.length; j++) {
|
||||
request.addBindValue(ids[j]);
|
||||
for (Object id : ids) {
|
||||
request.addBindValue(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -120,8 +120,8 @@ class InExpression extends AbstractExpression {
|
||||
@Override
|
||||
public int queryBindHash() {
|
||||
int hc = 92821;
|
||||
for (int i = 0; i < bindValues.length; i++) {
|
||||
hc = 92821 * hc + bindValues[i].hashCode();
|
||||
for (Object bindValue : bindValues) {
|
||||
hc = 92821 * hc + bindValue.hashCode();
|
||||
}
|
||||
return hc;
|
||||
}
|
||||
|
||||
@@ -91,8 +91,8 @@ class InQueryExpression extends AbstractExpression implements UnsupportedDocStor
|
||||
@Override
|
||||
public void addBindValues(SpiExpressionRequest request) {
|
||||
|
||||
for (int i = 0; i < bindParams.size(); i++) {
|
||||
request.addBindValue(bindParams.get(i));
|
||||
for (Object bindParam : bindParams) {
|
||||
request.addBindValue(bindParam);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -91,8 +91,8 @@ class JunctionExpression<T> implements SpiJunction<T>, SpiExpression, Expression
|
||||
public void writeDocQuery(DocQueryContext context) throws IOException {
|
||||
context.startBool(type);
|
||||
List<SpiExpression> list = exprList.internalList();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
list.get(i).writeDocQuery(context);
|
||||
for (SpiExpression aList : list) {
|
||||
aList.writeDocQuery(context);
|
||||
}
|
||||
context.endBool();
|
||||
}
|
||||
@@ -101,8 +101,8 @@ class JunctionExpression<T> implements SpiJunction<T>, SpiExpression, Expression
|
||||
public void writeDocQueryJunction(DocQueryContext context) throws IOException {
|
||||
context.startBoolGroupList(type);
|
||||
List<SpiExpression> list = exprList.internalList();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
list.get(i).writeDocQuery(context);
|
||||
for (SpiExpression aList : list) {
|
||||
aList.writeDocQuery(context);
|
||||
}
|
||||
context.endBoolGroupList();
|
||||
}
|
||||
@@ -125,8 +125,8 @@ class JunctionExpression<T> implements SpiJunction<T>, SpiExpression, Expression
|
||||
manyWhereJoin.setRequireOuterJoins(true);
|
||||
}
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
list.get(i).containsMany(desc, manyWhereJoin);
|
||||
for (SpiExpression aList : list) {
|
||||
aList.containsMany(desc, manyWhereJoin);
|
||||
}
|
||||
if (type == Type.OR && !parentOuterJoins) {
|
||||
// restore state to not forcing outer joins
|
||||
@@ -155,8 +155,8 @@ class JunctionExpression<T> implements SpiJunction<T>, SpiExpression, Expression
|
||||
public void addBindValues(SpiExpressionRequest request) {
|
||||
|
||||
List<SpiExpression> list = exprList.internalList();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
list.get(i).addBindValues(request);
|
||||
for (SpiExpression aList : list) {
|
||||
aList.addBindValues(request);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,8 +182,8 @@ class JunctionExpression<T> implements SpiJunction<T>, SpiExpression, Expression
|
||||
@Override
|
||||
public void prepareExpression(BeanQueryRequest<?> request) {
|
||||
List<SpiExpression> list = exprList.internalList();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
list.get(i).prepareExpression(request);
|
||||
for (SpiExpression aList : list) {
|
||||
aList.prepareExpression(request);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,8 +194,8 @@ class JunctionExpression<T> implements SpiJunction<T>, SpiExpression, Expression
|
||||
public void queryPlanHash(HashQueryPlanBuilder builder) {
|
||||
builder.add(JunctionExpression.class).add(type);
|
||||
List<SpiExpression> list = exprList.internalList();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
list.get(i).queryPlanHash(builder);
|
||||
for (SpiExpression aList : list) {
|
||||
aList.queryPlanHash(builder);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,8 +203,8 @@ class JunctionExpression<T> implements SpiJunction<T>, SpiExpression, Expression
|
||||
public int queryBindHash() {
|
||||
int hc = JunctionExpression.class.getName().hashCode();
|
||||
List<SpiExpression> list = exprList.internalList();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
hc = hc * 92821 + list.get(i).queryBindHash();
|
||||
for (SpiExpression aList : list) {
|
||||
hc = hc * 92821 + aList.queryBindHash();
|
||||
}
|
||||
return hc;
|
||||
}
|
||||
|
||||
@@ -43,8 +43,8 @@ class RawExpression extends NonPrepareExpression {
|
||||
@Override
|
||||
public void addBindValues(SpiExpressionRequest request) {
|
||||
if (values != null) {
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
request.addBindValue(values[i]);
|
||||
for (Object value : values) {
|
||||
request.addBindValue(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,8 +64,8 @@ public class SimpleExpression extends AbstractValueExpression {
|
||||
if (prop.isAssocId()) {
|
||||
Object[] ids = prop.getAssocIdValues((EntityBean) value());
|
||||
if (ids != null) {
|
||||
for (int i = 0; i < ids.length; i++) {
|
||||
request.addBindValue(ids[i]);
|
||||
for (Object id : ids) {
|
||||
request.addBindValue(id);
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
||||
@@ -11,22 +11,22 @@ public class Str {
|
||||
* Append strings together.
|
||||
*/
|
||||
public static String add(String s0, String s1, String ... args) {
|
||||
|
||||
|
||||
// determine a decent buffer size
|
||||
int len = 16 + s0.length() + s1.length();
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
len += args[i].length();
|
||||
for (String arg1 : args) {
|
||||
len += arg1.length();
|
||||
}
|
||||
|
||||
// append all the strings into the buffer
|
||||
|
||||
// append all the strings into the buffer
|
||||
StringBuilder sb = new StringBuilder(len);
|
||||
sb.append(s0).append(s1);
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
sb.append(args[i]);
|
||||
for (String arg : args) {
|
||||
sb.append(arg);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Append two strings together.
|
||||
*/
|
||||
@@ -35,5 +35,5 @@ public class Str {
|
||||
StringBuilder sb = new StringBuilder(s0.length() + s1.length() + 5);
|
||||
return sb.append(s0).append(s1).toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -169,8 +169,8 @@ public class DLoadContext implements LoadContext {
|
||||
}
|
||||
|
||||
int maxBatch = 0;
|
||||
for (int i = 0; i < secQuery.size(); i++) {
|
||||
int batchSize = secQuery.get(i).getQueryFetchBatch();
|
||||
for (OrmQueryProperties aSecQuery : secQuery) {
|
||||
int batchSize = aSecQuery.getQueryFetchBatch();
|
||||
if (batchSize == 0) {
|
||||
batchSize = defaultQueryBatch;
|
||||
}
|
||||
@@ -185,8 +185,8 @@ public class DLoadContext implements LoadContext {
|
||||
public void executeSecondaryQueries(OrmQueryRequest<?> parentRequest, boolean forEach) {
|
||||
|
||||
if (secQuery != null) {
|
||||
for (int i = 0; i < secQuery.size(); i++) {
|
||||
LoadSecondaryQuery load = getLoadSecondaryQuery(secQuery.get(i).getPath());
|
||||
for (OrmQueryProperties aSecQuery : secQuery) {
|
||||
LoadSecondaryQuery load = getLoadSecondaryQuery(aSecQuery.getPath());
|
||||
load.loadSecondaryQuery(parentRequest, forEach);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,8 +248,8 @@ public final class BatchControl {
|
||||
if (transaction.isLogSummary()) {
|
||||
transaction.logSummary("BatchControl flush " + Arrays.toString(bsArray));
|
||||
}
|
||||
for (int i = 0; i < bsArray.length; i++) {
|
||||
bsArray[i].executeNow();
|
||||
for (BatchedBeanHolder aBsArray : bsArray) {
|
||||
aBsArray.executeNow();
|
||||
}
|
||||
|
||||
if (resetTop) {
|
||||
|
||||
@@ -93,8 +93,8 @@ public class BatchedPstmt {
|
||||
}
|
||||
|
||||
private void postExecute() {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
list.get(i).postExecute();
|
||||
for (BatchPostExecute aList : list) {
|
||||
aList.postExecute();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -74,9 +74,7 @@ public class Binder {
|
||||
String logPrefix = "";
|
||||
|
||||
ArrayList<BindValues.Value> list = bindValues.values();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
BindValues.Value bindValue = list.get(i);
|
||||
|
||||
for (BindValues.Value bindValue : list) {
|
||||
Object val = bindValue.getValue();
|
||||
int dt = bindValue.getDbType();
|
||||
bindObject(dataBind, val, dt);
|
||||
@@ -136,9 +134,7 @@ public class Binder {
|
||||
// the iterator is assumed to be in the correct order
|
||||
Object value = null;
|
||||
try {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
|
||||
BindParams.Param param = list.get(i);
|
||||
for (BindParams.Param param : list) {
|
||||
|
||||
if (param.isOutParam() && cstmt != null) {
|
||||
cstmt.registerOutParameter(dataBind.nextPos(), param.getType());
|
||||
|
||||
@@ -197,7 +197,7 @@ public final class DefaultPersister implements Persister {
|
||||
for (T draftBean: draftBeans) {
|
||||
T liveBean = draftHandler.publishToDestinationBean(draftBean);
|
||||
livePublish.add(liveBean);
|
||||
|
||||
|
||||
// reset @DraftDirty and @DraftReset properties
|
||||
draftHandler.resetDraft(draftBean);
|
||||
|
||||
@@ -557,8 +557,8 @@ public final class DefaultPersister implements Persister {
|
||||
}
|
||||
|
||||
private void deleteList(List<?> beanList, Transaction t, boolean softDelete) {
|
||||
for (int i = 0; i < beanList.size(); i++) {
|
||||
deleteRecurse((EntityBean) beanList.get(i), t, softDelete);
|
||||
for (Object aBeanList : beanList) {
|
||||
deleteRecurse((EntityBean) aBeanList, t, softDelete);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -634,15 +634,15 @@ public final class DefaultPersister implements Persister {
|
||||
if (t.isPersistCascade()) {
|
||||
// OneToOne exported side with delete cascade
|
||||
BeanPropertyAssocOne<?>[] expOnes = descriptor.propertiesOneExportedDelete();
|
||||
for (int i = 0; i < expOnes.length; i++) {
|
||||
BeanDescriptor<?> targetDesc = expOnes[i].getTargetDescriptor();
|
||||
for (BeanPropertyAssocOne<?> expOne : expOnes) {
|
||||
BeanDescriptor<?> targetDesc = expOne.getTargetDescriptor();
|
||||
// only cascade soft deletes when supported by target
|
||||
if (!softDelete || targetDesc.isSoftDelete()) {
|
||||
if (!softDelete && targetDesc.isDeleteByStatement()) {
|
||||
SqlUpdate sqlDelete = expOnes[i].deleteByParentId(id, idList);
|
||||
SqlUpdate sqlDelete = expOne.deleteByParentId(id, idList);
|
||||
executeSqlUpdate(sqlDelete, t);
|
||||
} else {
|
||||
List<Object> childIds = expOnes[i].findIdsByParentId(id, idList, t);
|
||||
List<Object> childIds = expOne.findIdsByParentId(id, idList, t);
|
||||
deleteChildrenById(t, targetDesc, childIds, softDelete);
|
||||
}
|
||||
}
|
||||
@@ -650,17 +650,17 @@ public final class DefaultPersister implements Persister {
|
||||
|
||||
// OneToMany's with delete cascade
|
||||
BeanPropertyAssocMany<?>[] manys = descriptor.propertiesManyDelete();
|
||||
for (int i = 0; i < manys.length; i++) {
|
||||
BeanDescriptor<?> targetDesc = manys[i].getTargetDescriptor();
|
||||
for (BeanPropertyAssocMany<?> many : manys) {
|
||||
BeanDescriptor<?> targetDesc = many.getTargetDescriptor();
|
||||
// only cascade soft deletes when supported by target
|
||||
if (!softDelete || targetDesc.isSoftDelete()) {
|
||||
if (!softDelete && targetDesc.isDeleteByStatement()) {
|
||||
// we can just delete children with a single statement
|
||||
SqlUpdate sqlDelete = manys[i].deleteByParentId(id, idList);
|
||||
SqlUpdate sqlDelete = many.deleteByParentId(id, idList);
|
||||
executeSqlUpdate(sqlDelete, t);
|
||||
} else {
|
||||
// we need to fetch the Id's to delete (recurse or notify L2 cache)
|
||||
List<Object> childIds = manys[i].findIdsByParentId(id, idList, t, null);
|
||||
List<Object> childIds = many.findIdsByParentId(id, idList, t, null);
|
||||
if (!childIds.isEmpty()) {
|
||||
delete(targetDesc, null, childIds, t, softDelete);
|
||||
}
|
||||
@@ -672,10 +672,10 @@ public final class DefaultPersister implements Persister {
|
||||
if (!softDelete) {
|
||||
// ManyToMany's ... delete from intersection table
|
||||
BeanPropertyAssocMany<?>[] manys = descriptor.propertiesManyToMany();
|
||||
for (int i = 0; i < manys.length; i++) {
|
||||
SqlUpdate sqlDelete = manys[i].deleteByParentId(id, idList);
|
||||
for (BeanPropertyAssocMany<?> many : manys) {
|
||||
SqlUpdate sqlDelete = many.deleteByParentId(id, idList);
|
||||
if (t.isLogSummary()) {
|
||||
t.logSummary("-- Deleting intersection table entries: " + manys[i].getFullBeanName());
|
||||
t.logSummary("-- Deleting intersection table entries: " + many.getFullBeanName());
|
||||
}
|
||||
executeSqlUpdate(sqlDelete, t);
|
||||
}
|
||||
@@ -720,8 +720,8 @@ public final class DefaultPersister implements Persister {
|
||||
|
||||
Query<?> q = server.createQuery(desc.getBeanType());
|
||||
StringBuilder sb = new StringBuilder(30);
|
||||
for (int i = 0; i < propImportDelete.length; i++) {
|
||||
sb.append(propImportDelete[i].getName()).append(",");
|
||||
for (BeanPropertyAssocOne<?> aPropImportDelete : propImportDelete) {
|
||||
sb.append(aPropImportDelete.getName()).append(",");
|
||||
}
|
||||
q.setAutoTune(false);
|
||||
q.select(sb.toString());
|
||||
@@ -786,9 +786,7 @@ public final class DefaultPersister implements Persister {
|
||||
|
||||
// exported ones with cascade save
|
||||
BeanPropertyAssocOne<?>[] expOnes = desc.propertiesOneExportedSave();
|
||||
for (int i = 0; i < expOnes.length; i++) {
|
||||
BeanPropertyAssocOne<?> prop = expOnes[i];
|
||||
|
||||
for (BeanPropertyAssocOne<?> prop : expOnes) {
|
||||
// check for partial beans
|
||||
if (request.isLoadedProperty(prop)) {
|
||||
EntityBean detailBean = prop.getValueAsEntityBean(parentBean);
|
||||
@@ -805,12 +803,12 @@ public final class DefaultPersister implements Persister {
|
||||
|
||||
// many's with cascade save
|
||||
BeanPropertyAssocMany<?>[] manys = desc.propertiesManySave();
|
||||
for (int i = 0; i < manys.length; i++) {
|
||||
for (BeanPropertyAssocMany<?> many : manys) {
|
||||
// check that property is loaded and collection should be cascaded to
|
||||
if (request.isLoadedProperty(manys[i]) && !manys[i].isSkipSaveBeanCollection(parentBean, insertedParent)) {
|
||||
saveMany(new SaveManyPropRequest(insertedParent, manys[i], parentBean, request), insertMode);
|
||||
if (request.isLoadedProperty(many) && !many.isSkipSaveBeanCollection(parentBean, insertedParent)) {
|
||||
saveMany(new SaveManyPropRequest(insertedParent, many, parentBean, request), insertMode);
|
||||
if (!insertedParent) {
|
||||
request.addUpdatedManyProperty(manys[i]);
|
||||
request.addUpdatedManyProperty(many);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -916,7 +914,7 @@ public final class DefaultPersister implements Persister {
|
||||
}
|
||||
} else {
|
||||
if (saveMany.isModifyListenMode()) {
|
||||
// delete any removed beans via private owned. Needs to occur before
|
||||
// delete any removed beans via private owned. Needs to occur before
|
||||
// a 'deleteMissingChildren' statement occurs
|
||||
removeAssocManyPrivateOwned(saveMany);
|
||||
}
|
||||
@@ -1188,14 +1186,13 @@ public final class DefaultPersister implements Persister {
|
||||
if (expOnes.length > 0) {
|
||||
|
||||
DeleteUnloadedForeignKeys unloaded = null;
|
||||
for (int i = 0; i < expOnes.length; i++) {
|
||||
BeanPropertyAssocOne<?> prop = expOnes[i];
|
||||
for (BeanPropertyAssocOne<?> prop : expOnes) {
|
||||
// for soft delete check cascade type also supports soft delete
|
||||
if (!softDelete || prop.getTargetDescriptor().isSoftDelete()) {
|
||||
if (request.isLoadedProperty(prop)) {
|
||||
Object detailBean = prop.getValue(parentBean);
|
||||
if (detailBean != null) {
|
||||
deleteRecurse((EntityBean)detailBean, t, softDelete);
|
||||
deleteRecurse((EntityBean) detailBean, t, softDelete);
|
||||
}
|
||||
} else {
|
||||
if (unloaded == null) {
|
||||
@@ -1213,19 +1210,19 @@ public final class DefaultPersister implements Persister {
|
||||
|
||||
// Many's with delete cascade
|
||||
BeanPropertyAssocMany<?>[] manys = desc.propertiesManyDelete();
|
||||
for (int i = 0; i < manys.length; i++) {
|
||||
if (manys[i].isManyToMany()) {
|
||||
for (BeanPropertyAssocMany<?> many : manys) {
|
||||
if (many.isManyToMany()) {
|
||||
if (!softDelete) {
|
||||
// delete associated rows from intersection table (but not during soft delete)
|
||||
deleteAssocManyIntersection(parentBean, manys[i], t, request.isPublish());
|
||||
deleteAssocManyIntersection(parentBean, many, t, request.isPublish());
|
||||
}
|
||||
} else {
|
||||
|
||||
if (ModifyListenMode.REMOVALS.equals(manys[i].getModifyListenMode())) {
|
||||
if (ModifyListenMode.REMOVALS.equals(many.getModifyListenMode())) {
|
||||
// PrivateOwned ...
|
||||
// if soft delete then check target also supports soft delete
|
||||
if (!softDelete || manys[i].getTargetDescriptor().isSoftDelete()) {
|
||||
Object details = manys[i].getValue(parentBean);
|
||||
if (!softDelete || many.getTargetDescriptor().isSoftDelete()) {
|
||||
Object details = many.getValue(parentBean);
|
||||
if (details instanceof BeanCollection<?>) {
|
||||
Set<?> modifyRemovals = ((BeanCollection<?>) details).getModifyRemovals();
|
||||
if (modifyRemovals != null && !modifyRemovals.isEmpty()) {
|
||||
@@ -1233,7 +1230,7 @@ public final class DefaultPersister implements Persister {
|
||||
// delete the orphans that have been removed from the collection
|
||||
for (Object detail : modifyRemovals) {
|
||||
EntityBean detailBean = (EntityBean) detail;
|
||||
if (manys[i].hasId(detailBean)) {
|
||||
if (many.hasId(detailBean)) {
|
||||
deleteRecurse(detailBean, t, softDelete);
|
||||
}
|
||||
}
|
||||
@@ -1242,7 +1239,7 @@ public final class DefaultPersister implements Persister {
|
||||
}
|
||||
}
|
||||
|
||||
deleteManyDetails(t, desc, parentBean, manys[i], null, softDelete);
|
||||
deleteManyDetails(t, desc, parentBean, many, null, softDelete);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1314,16 +1311,14 @@ public final class DefaultPersister implements Persister {
|
||||
// imported ones with save cascade
|
||||
BeanPropertyAssocOne<?>[] ones = desc.propertiesOneImportedSave();
|
||||
|
||||
for (int i = 0; i < ones.length; i++) {
|
||||
BeanPropertyAssocOne<?> prop = ones[i];
|
||||
|
||||
for (BeanPropertyAssocOne<?> prop : ones) {
|
||||
// check for partial objects
|
||||
if (request.isLoadedProperty(prop)) {
|
||||
EntityBean detailBean = prop.getValueAsEntityBean(request.getEntityBean());
|
||||
if (detailBean != null
|
||||
&& !prop.isSaveRecurseSkippable(detailBean)
|
||||
&& !prop.isReference(detailBean)
|
||||
&& !request.isParent(detailBean)) {
|
||||
&& !prop.isSaveRecurseSkippable(detailBean)
|
||||
&& !prop.isReference(detailBean)
|
||||
&& !request.isParent(detailBean)) {
|
||||
SpiTransaction t = request.getTransaction();
|
||||
t.depth(-1);
|
||||
saveRecurse(detailBean, t, null, insertMode, request.isPublish());
|
||||
@@ -1342,14 +1337,14 @@ public final class DefaultPersister implements Persister {
|
||||
DeleteUnloadedForeignKeys fkeys = null;
|
||||
|
||||
BeanPropertyAssocOne<?>[] ones = request.getBeanDescriptor().propertiesOneImportedDelete();
|
||||
for (int i = 0; i < ones.length; i++) {
|
||||
if (!request.isLoadedProperty(ones[i])) {
|
||||
for (BeanPropertyAssocOne<?> one : ones) {
|
||||
if (!request.isLoadedProperty(one)) {
|
||||
// we have cascade Delete on a partially populated bean and
|
||||
// this property was not loaded (so we are going to have to fetch it)
|
||||
if (fkeys == null) {
|
||||
fkeys = new DeleteUnloadedForeignKeys(server, request);
|
||||
}
|
||||
fkeys.add(ones[i]);
|
||||
fkeys.add(one);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1362,8 +1357,7 @@ public final class DefaultPersister implements Persister {
|
||||
private void deleteAssocOne(PersistRequestBean<?> request) {
|
||||
|
||||
BeanPropertyAssocOne<?>[] ones = request.getBeanDescriptor().propertiesOneImportedDelete();
|
||||
for (int i = 0; i < ones.length; i++) {
|
||||
BeanPropertyAssocOne<?> prop = ones[i];
|
||||
for (BeanPropertyAssocOne<?> prop : ones) {
|
||||
if (request.isLoadedProperty(prop)) {
|
||||
Object detailBean = prop.getValue(request.getEntityBean());
|
||||
if (detailBean != null) {
|
||||
|
||||
@@ -59,8 +59,8 @@ class DeleteUnloadedForeignKeys {
|
||||
Object id = request.getBeanId();
|
||||
|
||||
StringBuilder sb = new StringBuilder(30);
|
||||
for (int i = 0; i < propList.size(); i++) {
|
||||
sb.append(propList.get(i).getName()).append(",");
|
||||
for (BeanPropertyAssocOne<?> aPropList : propList) {
|
||||
sb.append(aPropList.getName()).append(",");
|
||||
}
|
||||
|
||||
// run query in a separate persistence context
|
||||
@@ -84,8 +84,7 @@ class DeleteUnloadedForeignKeys {
|
||||
*/
|
||||
void deleteCascade() {
|
||||
|
||||
for (int i = 0; i < propList.size(); i++) {
|
||||
BeanPropertyAssocOne<?> prop = propList.get(i);
|
||||
for (BeanPropertyAssocOne<?> prop : propList) {
|
||||
Object detailBean = prop.getValue(beanWithForeignKeys);
|
||||
|
||||
// if bean exists with a unique id then delete it
|
||||
|
||||
@@ -34,8 +34,8 @@ public class BindableCompound implements Bindable {
|
||||
|
||||
public void dmlAppend(GenerateDmlRequest request) {
|
||||
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
items[i].dmlAppend(request);
|
||||
for (BindableProperty item : items) {
|
||||
item.dmlAppend(request);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,8 +51,8 @@ public class BindableCompound implements Bindable {
|
||||
Object valueObject = compound.getValue(bean);
|
||||
|
||||
// bind each of the underlying scalar values for this compound type
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
items[i].dmlBindObject(bindRequest, valueObject);
|
||||
for (BindableProperty item : items) {
|
||||
item.dmlBindObject(bindRequest, valueObject);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,8 +34,8 @@ public class BindableEmbedded implements Bindable {
|
||||
|
||||
public void dmlAppend(GenerateDmlRequest request) {
|
||||
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
items[i].dmlAppend(request);
|
||||
for (Bindable item : items) {
|
||||
item.dmlAppend(request);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,14 +50,14 @@ public class BindableEmbedded implements Bindable {
|
||||
// get the embedded bean
|
||||
EntityBean embBean = (EntityBean) embProp.getValue(bean);
|
||||
if (embBean == null) {
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
items[i].dmlBind(bindRequest, null);
|
||||
for (Bindable item : items) {
|
||||
item.dmlBind(bindRequest, null);
|
||||
}
|
||||
} else {
|
||||
//EntityBeanIntercept ebi = embBean._ebean_getIntercept();
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
for (Bindable item : items) {
|
||||
//if (ebi.isLoadedProperty(props[i].getPropertyIndex())) {
|
||||
items[i].dmlBind(bindRequest, embBean);
|
||||
item.dmlBind(bindRequest, embBean);
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
+7
-7
@@ -64,18 +64,18 @@ public final class BindableIdEmbedded implements BindableId {
|
||||
|
||||
EntityBean idValue = (EntityBean) embId.getValue(bean);
|
||||
|
||||
for (int i = 0; i < props.length; i++) {
|
||||
for (BeanProperty prop : props) {
|
||||
|
||||
Object value = props[i].getValue(idValue);
|
||||
request.bind(value, props[i]);
|
||||
Object value = prop.getValue(idValue);
|
||||
request.bind(value, prop);
|
||||
}
|
||||
|
||||
request.setIdValue(idValue);
|
||||
}
|
||||
|
||||
public void dmlAppend(GenerateDmlRequest request) {
|
||||
for (int i = 0; i < props.length; i++) {
|
||||
request.appendColumn(props[i].getDbColumn());
|
||||
for (BeanProperty prop : props) {
|
||||
request.appendColumn(prop.getDbColumn());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,8 +94,8 @@ public final class BindableIdEmbedded implements BindableId {
|
||||
EntityBean newId = (EntityBean) embId.createEmbeddedId();
|
||||
|
||||
// populate it from the assoc one id values...
|
||||
for (int i = 0; i < matches.length; i++) {
|
||||
matches[i].populate(bean, newId);
|
||||
for (MatchedImportedProperty matche : matches) {
|
||||
matche.populate(bean, newId);
|
||||
}
|
||||
|
||||
// support PropertyChangeSupport
|
||||
|
||||
@@ -43,23 +43,23 @@ public class BindableList implements Bindable {
|
||||
}
|
||||
|
||||
public void addToUpdate(PersistRequestBean<?> request, List<Bindable> list) {
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
items[i].addToUpdate(request, list);
|
||||
for (Bindable item : items) {
|
||||
item.addToUpdate(request, list);
|
||||
}
|
||||
}
|
||||
|
||||
public void dmlAppend(GenerateDmlRequest request) {
|
||||
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
items[i].dmlAppend(request);
|
||||
for (Bindable item : items) {
|
||||
item.dmlAppend(request);
|
||||
}
|
||||
}
|
||||
|
||||
public void dmlBind(BindableRequest bindRequest, EntityBean bean)
|
||||
throws SQLException {
|
||||
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
items[i].dmlBind(bindRequest, bean);
|
||||
for (Bindable item : items) {
|
||||
item.dmlBind(bindRequest, bean);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,21 +21,21 @@ public class FactoryAssocOnes {
|
||||
|
||||
BeanPropertyAssocOne<?>[] ones = desc.propertiesOneImported();
|
||||
|
||||
for (int i = 0; i < ones.length; i++) {
|
||||
if (!ones[i].isImportedPrimaryKey()) {
|
||||
for (BeanPropertyAssocOne<?> one : ones) {
|
||||
if (!one.isImportedPrimaryKey()) {
|
||||
switch (mode) {
|
||||
case INSERT:
|
||||
if (!ones[i].isInsertable()) {
|
||||
if (!one.isInsertable()) {
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case UPDATE:
|
||||
if (!ones[i].isUpdateable()) {
|
||||
if (!one.isUpdateable()) {
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
list.add(new BindableAssocOne(ones[i]));
|
||||
list.add(new BindableAssocOne(one));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+7
-7
@@ -31,13 +31,13 @@ public class FactoryBaseProperties {
|
||||
add(desc.propertiesBaseScalar(), list, mode, withLobs);
|
||||
|
||||
BeanPropertyCompound[] compoundProps = desc.propertiesBaseCompound();
|
||||
for (int i = 0; i < compoundProps.length; i++) {
|
||||
BeanProperty[] props = compoundProps[i].getScalarProperties();
|
||||
for (BeanPropertyCompound compoundProp : compoundProps) {
|
||||
BeanProperty[] props = compoundProp.getScalarProperties();
|
||||
|
||||
List<BindableProperty> newList = new ArrayList<>(props.length);
|
||||
addCompound(props, newList, mode, withLobs);
|
||||
|
||||
BindableCompound compoundBindable = new BindableCompound(compoundProps[i], newList);
|
||||
BindableCompound compoundBindable = new BindableCompound(compoundProp, newList);
|
||||
|
||||
list.add(compoundBindable);
|
||||
}
|
||||
@@ -45,8 +45,8 @@ public class FactoryBaseProperties {
|
||||
|
||||
private void add(BeanProperty[] props, List<Bindable> list, DmlMode mode, boolean withLobs) {
|
||||
|
||||
for (int i = 0; i < props.length; i++) {
|
||||
Bindable item = factoryProperty.create(props[i], mode, withLobs);
|
||||
for (BeanProperty prop : props) {
|
||||
Bindable item = factoryProperty.create(prop, mode, withLobs);
|
||||
if (item != null) {
|
||||
list.add(item);
|
||||
}
|
||||
@@ -55,8 +55,8 @@ public class FactoryBaseProperties {
|
||||
|
||||
private void addCompound(BeanProperty[] props, List<BindableProperty> list, DmlMode mode, boolean withLobs) {
|
||||
|
||||
for (int i = 0; i < props.length; i++) {
|
||||
BindableProperty item = (BindableProperty) factoryProperty.create(props[i], mode, withLobs);
|
||||
for (BeanProperty prop : props) {
|
||||
BindableProperty item = (BindableProperty) factoryProperty.create(prop, mode, withLobs);
|
||||
if (item != null) {
|
||||
list.add(item);
|
||||
}
|
||||
|
||||
@@ -26,20 +26,20 @@ public class FactoryEmbedded {
|
||||
|
||||
BeanPropertyAssocOne<?>[] embedded = desc.propertiesEmbedded();
|
||||
|
||||
for (int j = 0; j < embedded.length; j++) {
|
||||
for (BeanPropertyAssocOne<?> anEmbedded : embedded) {
|
||||
|
||||
BeanProperty[] props = embedded[j].getProperties();
|
||||
BeanProperty[] props = anEmbedded.getProperties();
|
||||
|
||||
List<Bindable> bindList = new ArrayList<>(props.length);
|
||||
|
||||
for (int i = 0; i < props.length; i++) {
|
||||
Bindable item = factoryProperty.create(props[i], mode, withLobs);
|
||||
for (BeanProperty prop : props) {
|
||||
Bindable item = factoryProperty.create(prop, mode, withLobs);
|
||||
if (item != null) {
|
||||
bindList.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
list.add(new BindableEmbedded(embedded[j], bindList));
|
||||
list.add(new BindableEmbedded(anEmbedded, bindList));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -66,14 +66,14 @@ class MatchedImportedProperty {
|
||||
String dbColumn = prop.getDbColumn();
|
||||
|
||||
BeanPropertyAssocOne<?>[] assocOnes = desc.propertiesOne();
|
||||
for (int i = 0; i < assocOnes.length; i++) {
|
||||
if (assocOnes[i].isImportedPrimaryKey()) {
|
||||
for (BeanPropertyAssocOne<?> assocOne1 : assocOnes) {
|
||||
if (assocOne1.isImportedPrimaryKey()) {
|
||||
|
||||
// search using the ImportedId from the assoc one
|
||||
BeanProperty foreignMatch = assocOnes[i].getImportedId().findMatchImport(dbColumn);
|
||||
BeanProperty foreignMatch = assocOne1.getImportedId().findMatchImport(dbColumn);
|
||||
|
||||
if (foreignMatch != null) {
|
||||
return new MatchedImportedProperty(assocOnes[i], foreignMatch, prop);
|
||||
return new MatchedImportedProperty(assocOne1, foreignMatch, prop);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,8 +142,8 @@ public class CQueryPlan {
|
||||
DataBind bindEncryptedProperties(PreparedStatement stmt, Connection conn) throws SQLException {
|
||||
DataBind dataBind = new DataBind(dataTimeZone, stmt, conn);
|
||||
if (encryptedProps != null) {
|
||||
for (int i = 0; i < encryptedProps.length; i++) {
|
||||
String key = encryptedProps[i].getEncryptKey().getStringValue();
|
||||
for (BeanProperty encryptedProp : encryptedProps) {
|
||||
String key = encryptedProp.getEncryptKey().getStringValue();
|
||||
dataBind.setString(key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,20 +219,20 @@ public class SqlTreeBuilder {
|
||||
List<SqlTreeNode> myJoinList = new ArrayList<>();
|
||||
|
||||
BeanPropertyAssocOne<?>[] ones = desc.propertiesOne();
|
||||
for (int i = 0; i < ones.length; i++) {
|
||||
String propPrefix = SplitName.add(prefix, ones[i].getName());
|
||||
for (BeanPropertyAssocOne<?> one : ones) {
|
||||
String propPrefix = SplitName.add(prefix, one.getName());
|
||||
if (isIncludeBean(propPrefix)) {
|
||||
selectIncludes.add(propPrefix);
|
||||
buildSelectChain(propPrefix, ones[i], ones[i].getTargetDescriptor(), myJoinList);
|
||||
buildSelectChain(propPrefix, one, one.getTargetDescriptor(), myJoinList);
|
||||
}
|
||||
}
|
||||
|
||||
BeanPropertyAssocMany<?>[] manys = desc.propertiesMany();
|
||||
for (int i = 0; i < manys.length; i++) {
|
||||
String propPrefix = SplitName.add(prefix, manys[i].getName());
|
||||
if (isIncludeMany(propPrefix, manys[i])) {
|
||||
for (BeanPropertyAssocMany<?> many : manys) {
|
||||
String propPrefix = SplitName.add(prefix, many.getName());
|
||||
if (isIncludeMany(propPrefix, many)) {
|
||||
selectIncludes.add(propPrefix);
|
||||
buildSelectChain(propPrefix, manys[i], manys[i].getTargetDescriptor(), myJoinList);
|
||||
buildSelectChain(propPrefix, many, many.getTargetDescriptor(), myJoinList);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -458,13 +458,13 @@ public class SqlTreeBuilder {
|
||||
selectProps.add(desc.propertiesEmbedded());
|
||||
|
||||
BeanPropertyAssocOne<?>[] propertiesOne = desc.propertiesOne();
|
||||
for (int i = 0; i < propertiesOne.length; i++) {
|
||||
for (BeanPropertyAssocOne<?> aPropertiesOne : propertiesOne) {
|
||||
//noinspection StatementWithEmptyBody
|
||||
if (queryProps != null && queryProps.isIncludedBeanJoin(propertiesOne[i].getName())) {
|
||||
if (queryProps != null && queryProps.isIncludedBeanJoin(aPropertiesOne.getName())) {
|
||||
// if it is a joined bean... then don't add the property
|
||||
// as it will have its own entire Node in the SqlTree
|
||||
} else {
|
||||
selectProps.add(propertiesOne[i]);
|
||||
selectProps.add(aPropertiesOne);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -576,8 +576,8 @@ public class SqlTreeBuilder {
|
||||
Arrays.sort(extras);
|
||||
|
||||
// reverse order so get the leaves first...
|
||||
for (int i = 0; i < extras.length; i++) {
|
||||
createExtraJoin(extras[i]);
|
||||
for (String extra : extras) {
|
||||
createExtraJoin(extra);
|
||||
}
|
||||
|
||||
return rootRegister.values();
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user