No effective change - tidy whitespace

This commit is contained in:
rob bygrave
2020-09-14 21:05:38 +12:00
parent 775f184450
commit 2ad99794ea
10 changed files with 3 additions and 55 deletions
@@ -10,7 +10,6 @@ public class IntersectionBuilder {
private final String publishTable;
private final String draftTable;
private final List<String> columns = new ArrayList<>();
IntersectionBuilder(String publishTable, String draftTable) {
@@ -23,10 +22,8 @@ public class IntersectionBuilder {
}
public IntersectionTable build() {
String insertSql = insertSql(publishTable);
String deleteSql = deleteSql(publishTable);
String draftInsertSql;
String draftDeleteSql;
if (publishTable.equals(draftTable)) {
@@ -36,15 +33,12 @@ public class IntersectionBuilder {
draftInsertSql = insertSql(draftTable);
draftDeleteSql = deleteSql(draftTable);
}
return new IntersectionTable(insertSql, deleteSql, draftInsertSql, draftDeleteSql);
}
private String insertSql(String tableName) {
StringBuilder sb = new StringBuilder();
sb.append("insert into ").append(tableName).append(" (");
int count = 0;
for (String column : columns) {
if (count++ > 0) {
@@ -60,16 +54,13 @@ public class IntersectionBuilder {
sb.append("?");
}
sb.append(")");
return sb.toString();
}
private String deleteSql(String tableName) {
StringBuilder sb = new StringBuilder();
sb.append("delete from ").append(tableName);
sb.append(" where ");
int count = 0;
for (String column : columns) {
if (count++ > 0) {
@@ -78,8 +69,6 @@ public class IntersectionBuilder {
sb.append(column);
sb.append(" = ?");
}
return sb.toString();
}
}
@@ -46,12 +46,9 @@ public class IntersectionRow {
}
public SpiSqlUpdate createInsert(SpiEbeanServer server) {
BindParams bindParams = new BindParams();
StringBuilder sb = new StringBuilder();
sb.append("insert into ").append(tableName).append(" (");
int count = 0;
for (Map.Entry<String, Object> entry : values.entrySet()) {
if (count++ > 0) {
@@ -60,7 +57,6 @@ public class IntersectionRow {
sb.append(entry.getKey());
bindParams.setParameter(count, entry.getValue());
}
sb.append(") values (");
for (int i = 0; i < count; i++) {
if (i > 0) {
@@ -69,14 +65,11 @@ public class IntersectionRow {
sb.append("?");
}
sb.append(")");
return new DefaultSqlUpdate(server, sb.toString(), bindParams);
}
public SpiSqlUpdate createDelete(SpiEbeanServer server, DeleteMode deleteMode) {
BindParams bindParams = new BindParams();
StringBuilder sb = new StringBuilder();
if (deleteMode.isHard()) {
sb.append("delete from ").append(tableName);
@@ -85,55 +78,41 @@ public class IntersectionRow {
sb.append(targetDescriptor.getSoftDeleteDbSet());
}
sb.append(" where ");
int count = setBindParams(bindParams, sb);
if (excludeIds != null) {
IdInExpression idIn = new IdInExpression(excludeIds);
DefaultExpressionRequest er = new DefaultExpressionRequest(excludeDescriptor);
idIn.addSqlNoAlias(er);
idIn.addBindValues(er);
sb.append(" and not ( ");
sb.append(er.getSql());
sb.append(" ) ");
List<Object> bindValues = er.getBindValues();
for (Object bindValue : bindValues) {
bindParams.setParameter(++count, bindValue);
}
}
return new DefaultSqlUpdate(server, sb.toString(), bindParams);
}
public SpiSqlUpdate createDeleteChildren(SpiEbeanServer server) {
BindParams bindParams = new BindParams();
StringBuilder sb = new StringBuilder();
sb.append("delete from ").append(tableName).append(" where ");
setBindParams(bindParams, sb);
return new DefaultSqlUpdate(server, sb.toString(), bindParams);
}
private int setBindParams(BindParams bindParams, StringBuilder sb) {
int count = 0;
for (Map.Entry<String, Object> entry : values.entrySet()) {
if (count++ > 0) {
sb.append(" and ");
}
sb.append(entry.getKey());
sb.append(" = ?");
bindParams.setParameter(count, entry.getValue());
}
return count;
}
}
@@ -1,6 +1,6 @@
package io.ebeaninternal.server.deploy;
import io.ebean.EbeanServer;
import io.ebean.Database;
import io.ebean.SqlUpdate;
public class IntersectionTable {
@@ -20,14 +20,14 @@ public class IntersectionTable {
/**
* Return a SqlUpdate for inserting into the intersection table.
*/
public SqlUpdate insert(EbeanServer server, boolean draft) {
public SqlUpdate insert(Database server, boolean draft) {
return server.sqlUpdate(draft ? draftInsertSql : insertSql);
}
/**
* Return a SqlUpdate for deleting from the intersection table.
*/
public SqlUpdate delete(EbeanServer server, boolean draft) {
public SqlUpdate delete(Database server, boolean draft) {
return server.sqlUpdate(draft ? draftDeleteSql : deleteSql);
}
@@ -8,14 +8,11 @@ import java.util.Set;
* Represents the type of a OneToMany or ManyToMany property.
*/
public enum ManyType {
LIST(false, List.class),
SET(false, Set.class),
MAP(true, null);
private final boolean map;
@SuppressWarnings("rawtypes")
private final Class<? extends Collection> type;
@@ -18,7 +18,6 @@ class PersistControllerManager {
private final List<BeanPersistController> list;
PersistControllerManager(BootupClasses bootupClasses) {
list = bootupClasses.getBeanPersistControllers();
}
@@ -30,7 +29,6 @@ class PersistControllerManager {
* Return the BeanPersistController for a given entity type.
*/
void addPersistControllers(DeployBeanDescriptor<?> deployDesc) {
for (BeanPersistController c : list) {
if (c.isRegisterFor(deployDesc.getBeanType())) {
logger.debug("BeanPersistController on[{}] {}", deployDesc.getFullName(), c.getClass().getName());
@@ -30,7 +30,6 @@ class PersistListenerManager {
* Return the BeanPersistController for a given entity type.
*/
<T> void addPersistListeners(DeployBeanDescriptor<T> deployDesc) {
for (BeanPersistListener listener : list) {
if (listener.isRegisterFor(deployDesc.getBeanType())) {
logger.debug("BeanPersistListener on[{}] {}", deployDesc.getFullName(), listener.getClass().getName());
@@ -29,7 +29,6 @@ class PostConstructManager {
* Register BeanPostLoad listeners for a given entity type.
*/
void addPostConstructListeners(DeployBeanDescriptor<?> deployDesc) {
for (BeanPostConstructListener c : list) {
if (c.isRegisterFor(deployDesc.getBeanType())) {
logger.debug("BeanPostLoad on[{}] {}", deployDesc.getFullName(), c.getClass().getName());
@@ -29,7 +29,6 @@ class PostLoadManager {
* Register BeanPostLoad listeners for a given entity type.
*/
void addPostLoad(DeployBeanDescriptor<?> deployDesc) {
for (BeanPostLoad c : list) {
if (c.isRegisterFor(deployDesc.getBeanType())) {
logger.debug("BeanPostLoad on[{}] {}", deployDesc.getFullName(), c.getClass().getName());
@@ -47,13 +47,11 @@ public final class TableJoin {
this.table = InternString.intern(deploy.getTable());
this.type = deploy.getType();
this.inheritInfo = deploy.getInheritInfo();
DeployTableJoinColumn[] deployCols = deploy.columns();
this.columns = new TableJoinColumn[deployCols.length];
for (int i = 0; i < deployCols.length; i++) {
this.columns[i] = new TableJoinColumn(deployCols[i]);
}
this.queryHash = calcQueryHash();
}
@@ -88,13 +86,10 @@ public final class TableJoin {
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TableJoin that = (TableJoin) o;
if (!table.equals(that.table)) return false;
if (type != that.type) return false;
if (columns.length != that.columns.length) return false;
for (int i = 0; i < columns.length; i++) {
if (!columns[i].equals(that.columns[i])) {
return false;
@@ -138,22 +133,18 @@ public final class TableJoin {
String[] names = SplitName.split(prefix);
String a1 = ctx.getTableAlias(names[0]);
String a2 = ctx.getTableAlias(prefix);
addJoin(joinType, a1, a2, ctx);
ctx.append("and ").append(a2).append(predicate);
}
public SqlJoinType addJoin(SqlJoinType joinType, String prefix, DbSqlContext ctx) {
String[] names = SplitName.split(prefix);
String a1 = ctx.getTableAlias(names[0]);
String a2 = ctx.getTableAlias(prefix);
return addJoin(joinType, a1, a2, ctx);
}
public SqlJoinType addJoin(SqlJoinType joinType, String a1, String a2, DbSqlContext ctx) {
String joinLiteral = joinType.getLiteral(type);
ctx.addJoin(joinLiteral, table, columns(), a1, a2);
return joinType.autoToOuter(type);
@@ -26,7 +26,6 @@ public class TableJoinColumn {
private final boolean updateable;
/**
* Hash for including in a query plan
*/
@@ -62,7 +61,6 @@ public class TableJoinColumn {
result = 92821 * result + (foreignSqlFormula != null ? foreignSqlFormula.hashCode() : 0);
result = 92821 * result + (insertable ? 1 : 0);
result = 92821 * result + (updateable ? 1 : 0);
return result;
}
@@ -75,7 +73,6 @@ public class TableJoinColumn {
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TableJoinColumn that = (TableJoinColumn) o;
if (insertable != that.insertable) return false;
if (updateable != that.updateable) return false;