No effective change - code cleanup - remove unused - TableJoin properties

This commit is contained in:
Robin Bygrave
2015-07-31 22:22:57 +12:00
parent 1ce84ec343
commit 2e1f02163c
9 changed files with 9 additions and 136 deletions
@@ -248,7 +248,7 @@ public class BeanProperty implements ElPropertyValue {
this.secondaryTable = deploy.isSecondaryTable();
if (secondaryTable) {
this.secondaryTableJoin = new TableJoin(deploy.getSecondaryTableJoin(), null);
this.secondaryTableJoin = new TableJoin(deploy.getSecondaryTableJoin());
this.secondaryTableJoinPrefix = deploy.getSecondaryTableJoinPrefix();
} else {
this.secondaryTableJoin = null;
@@ -80,7 +80,7 @@ public abstract class BeanPropertyAssoc<T> extends BeanProperty {
this.beanTable = deploy.getBeanTable();
this.mappedBy = InternString.intern(deploy.getMappedBy());
this.tableJoin = new TableJoin(deploy.getTableJoin(), null);
this.tableJoin = new TableJoin(deploy.getTableJoin());
this.targetType = deploy.getTargetType();
this.cascadeInfo = deploy.getCascadeInfo();
@@ -28,11 +28,6 @@ public final class TableJoin {
private final InheritInfo inheritInfo;
/**
* Properties as an array.
*/
private final BeanProperty[] properties;
/**
* Columns as an array.
*/
@@ -46,7 +41,7 @@ public final class TableJoin {
/**
* Create a TableJoin.
*/
public TableJoin(DeployTableJoin deploy, LinkedHashMap<String, BeanProperty> propMap) {
public TableJoin(DeployTableJoin deploy) {
this.table = InternString.intern(deploy.getTable());
this.type = deploy.getType();
@@ -58,16 +53,6 @@ public final class TableJoin {
this.columns[i] = new TableJoinColumn(deployCols[i]);
}
DeployBeanProperty[] deployProps = deploy.properties();
if (deployProps.length > 0 && propMap == null) {
throw new NullPointerException("propMap is null?");
}
this.properties = new BeanProperty[deployProps.length];
for (int i = 0; i < deployProps.length; i++) {
BeanProperty prop = propMap.get(deployProps[i].getName());
this.properties[i] = prop;
}
this.queryHash = calcQueryHash();
}
@@ -99,18 +84,6 @@ public final class TableJoin {
return sb.toString();
}
public void appendSelect(DbSqlContext ctx, boolean subQuery) {
for (int i = 0, x = properties.length; i < x; i++) {
properties[i].appendSelect(ctx, subQuery);
}
}
public void load(SqlBeanLoad sqlBeanLoad) throws SQLException {
for (int i = 0, x = properties.length; i < x; i++) {
properties[i].load(sqlBeanLoad);
}
}
/**
* Return the join columns.
*/
@@ -118,13 +91,6 @@ public final class TableJoin {
return columns;
}
/**
* For secondary table joins returns the properties mapped to that table.
*/
public BeanProperty[] properties() {
return properties;
}
/**
* Return the joined table name.
*/
@@ -77,13 +77,6 @@ public abstract class DeployBeanPropertyAssoc<T> extends DeployBeanProperty {
return isOuterJoin;
}
/**
* Specify that this bean should use an outer join.
*/
public void setOuterJoin(boolean isOuterJoin) {
this.isOuterJoin = isOuterJoin;
}
/**
* Return a literal expression that is added to the query that lazy loads
* the collection.
@@ -115,7 +115,7 @@ public class DeployBeanPropertyAssocMany<T> extends DeployBeanPropertyAssoc<T> {
*/
public TableJoin createIntersectionTableJoin() {
if (intersectionJoin != null){
return new TableJoin(intersectionJoin, null);
return new TableJoin(intersectionJoin);
} else {
return null;
}
@@ -126,7 +126,7 @@ public class DeployBeanPropertyAssocMany<T> extends DeployBeanPropertyAssoc<T> {
*/
public TableJoin createInverseTableJoin() {
if (inverseJoin != null){
return new TableJoin(inverseJoin, null);
return new TableJoin(inverseJoin);
} else {
return null;
}
@@ -77,11 +77,4 @@ public class DeployBeanPropertyAssocOne<T> extends DeployBeanPropertyAssoc<T> {
return importedPrimaryKey;
}
/**
* Set to true if the bean maps to the primary key.
*/
public void setImportedPrimaryKey(boolean importedPrimaryKey) {
this.importedPrimaryKey = importedPrimaryKey;
}
}
@@ -104,9 +104,8 @@ public class DeployBeanPropertyLists {
List<DeployTableJoin> deployTableJoins = deploy.getTableJoins();
tableJoins = new TableJoin[deployTableJoins.size()];
for (int i = 0; i < deployTableJoins.size(); i++) {
tableJoins[i] = new TableJoin(deployTableJoins.get(i), propertyMap);
tableJoins[i] = new TableJoin(deployTableJoins.get(i));
}
}
/**
@@ -231,10 +230,6 @@ public class DeployBeanPropertyLists {
return embedded.toArray(new BeanPropertyAssocOne[embedded.size()]);
}
public BeanPropertyAssocOne<?>[] getOneExported() {
return onesExported.toArray(new BeanPropertyAssocOne[onesExported.size()]);
}
public BeanPropertyAssocOne<?>[] getOneImported() {
return onesImported.toArray(new BeanPropertyAssocOne[onesImported.size()]);
}
@@ -1,14 +1,12 @@
package com.avaje.ebeaninternal.server.deploy.meta;
import java.util.ArrayList;
import javax.persistence.JoinColumn;
import com.avaje.ebeaninternal.server.deploy.BeanCascadeInfo;
import com.avaje.ebeaninternal.server.deploy.BeanTable;
import com.avaje.ebeaninternal.server.deploy.InheritInfo;
import com.avaje.ebeaninternal.server.query.SqlJoinType;
import javax.persistence.JoinColumn;
import java.util.ArrayList;
/**
* Represents a join to another table during deployment phase.
* <p>
@@ -17,12 +15,6 @@ import com.avaje.ebeaninternal.server.query.SqlJoinType;
*/
public class DeployTableJoin {
/**
* Flag set when the imported key maps to the primary key. This occurs for intersection tables
* (ManyToMany).
*/
private boolean importedPrimaryKey;
/**
* The joined table.
*/
@@ -33,21 +25,11 @@ public class DeployTableJoin {
*/
private SqlJoinType type = SqlJoinType.INNER;
/**
* The list of properties mapped to this joined table.
*/
private final ArrayList<DeployBeanProperty> properties = new ArrayList<DeployBeanProperty>();
/**
* The list of join column pairs. Used to generate the on clause.
*/
private ArrayList<DeployTableJoinColumn> columns = new ArrayList<DeployTableJoinColumn>(4);
/**
* The persist cascade info.
*/
private final BeanCascadeInfo cascadeInfo = new BeanCascadeInfo();
private InheritInfo inheritInfo;
/**
@@ -60,21 +42,6 @@ public class DeployTableJoin {
return type + " " + table + " " + columns;
}
/**
* Return true if the imported foreign key maps to the primary key.
*/
public boolean isImportedPrimaryKey() {
return importedPrimaryKey;
}
/**
* Flag set when the imported key maps to the primary key. This occurs for intersection tables
* (ManyToMany).
*/
public void setImportedPrimaryKey(boolean importedPrimaryKey) {
this.importedPrimaryKey = importedPrimaryKey;
}
/**
* Return true if the JoinOnPair have been set.
*/
@@ -82,13 +49,6 @@ public class DeployTableJoin {
return columns.size() > 0;
}
/**
* Return the persist info.
*/
public BeanCascadeInfo getCascadeInfo() {
return cascadeInfo;
}
/**
* Copy all the columns to this join potentially reversing the columns.
*/
@@ -138,13 +98,6 @@ public class DeployTableJoin {
return columns.toArray(new DeployTableJoinColumn[columns.size()]);
}
/**
* For secondary table joins returns the properties mapped to that table.
*/
public DeployBeanProperty[] properties() {
return properties.toArray(new DeployBeanProperty[properties.size()]);
}
/**
* Return the joined table name.
*/
@@ -166,13 +119,6 @@ public class DeployTableJoin {
return type;
}
/**
* Return true if this join is a left outer join.
*/
public boolean isOuterJoin() {
return type == SqlJoinType.OUTER;
}
public void setType(SqlJoinType type) {
this.type = type;
}
@@ -288,10 +288,6 @@ public class SqlTreeNodeBean implements SqlTreeNode {
}
}
for (int i = 0, x = tableJoins.length; i < x; i++) {
tableJoins[i].load(sqlBeanLoad);
}
boolean lazyLoadMany = false;
if (localBean == null && queryMode.equals(Mode.LAZYLOAD_MANY)) {
// batch lazy load many into existing contextBean
@@ -406,7 +402,6 @@ public class SqlTreeNodeBean implements SqlTreeNode {
appendSelect(ctx, false, idBinder.getBeanProperty());
}
appendSelect(ctx, subQuery, properties);
appendSelectTableJoins(ctx);
for (int i = 0; i < children.length; i++) {
// read each child... and let them set their
@@ -418,21 +413,6 @@ public class SqlTreeNodeBean implements SqlTreeNode {
ctx.popJoin();
}
private void appendSelectTableJoins(DbSqlContext ctx) {
String baseAlias = ctx.getTableAlias(prefix);
for (int i = 0; i < tableJoins.length; i++) {
TableJoin join = tableJoins[i];
String alias = baseAlias + i;
ctx.pushSecondaryTableAlias(alias);
join.appendSelect(ctx, false);
ctx.popTableAlias();
}
}
/**
* Append the properties to the buffer.
*/