Author: doogie
Date: Wed Oct 17 20:18:15 2007 New Revision: 585815 URL: http://svn.apache.org/viewvc?rev=585815&view=rev Log: Use StringBuilder instead of StringBuffer. Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityClause.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityComparisonOperator.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionBase.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionFunction.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionListBase.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionSubSelect.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionValue.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFieldValue.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFunction.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityJoinOperator.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityOperator.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/OrderByItem.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/OrderByList.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntityChecker.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelRelation.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelUtil.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityDataLoader.java Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java?rev=585815&r1=585814&r2=585815&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java Wed Oct 17 20:18:15 2007 @@ -721,7 +721,7 @@ return fieldValue; } - StringBuffer keyBuffer = new StringBuffer(); + StringBuilder keyBuffer = new StringBuilder(); // start with the Entity Name keyBuffer.append(modelEntityToUse.getEntityName()); // next add the Field Name @@ -1021,7 +1021,7 @@ String valueStr = this.getString(name); if (valueStr != null) { - StringBuffer value = new StringBuffer(valueStr); + StringBuilder value = new StringBuilder(valueStr); boolean needsCdata = false; // check each character, if line-feed or carriage-return is found set needsCdata to true; also look for invalid characters @@ -1181,7 +1181,7 @@ *@return String corresponding to this entity */ public String toString() { - StringBuffer theString = new StringBuffer(); + StringBuilder theString = new StringBuilder(); theString.append("[GenericEntity:"); theString.append(getEntityName()); theString.append(']'); @@ -1214,7 +1214,7 @@ *@return String corresponding to this entity */ public String toStringInsecure() { - StringBuffer theString = new StringBuffer(); + StringBuilder theString = new StringBuilder(); theString.append("[GenericEntity:"); theString.append(getEntityName()); theString.append(']'); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityClause.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityClause.java?rev=585815&r1=585814&r2=585815&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityClause.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityClause.java Wed Oct 17 20:18:15 2007 @@ -129,7 +129,7 @@ } public String toString() { - StringBuffer outputBuffer = new StringBuffer(); + StringBuilder outputBuffer = new StringBuilder(); outputBuffer.append("[firstEntity," + (firstEntity == null ? "null" : firstEntity) + "]"); outputBuffer.append("[secondEntity," + (secondEntity == null ? "null" : secondEntity) + "]"); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityComparisonOperator.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityComparisonOperator.java?rev=585815&r1=585814&r2=585815&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityComparisonOperator.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityComparisonOperator.java Wed Oct 17 20:18:15 2007 @@ -83,7 +83,7 @@ visitor.accept(rhs); } - public void addSqlValue(StringBuffer sql, ModelEntity entity, List entityConditionParams, boolean compat, Object lhs, Object rhs, DatasourceInfo datasourceInfo) { + public void addSqlValue(StringBuilder sql, ModelEntity entity, List entityConditionParams, boolean compat, Object lhs, Object rhs, DatasourceInfo datasourceInfo) { //Debug.logInfo("EntityComparisonOperator.addSqlValue field=" + lhs + ", value=" + rhs + ", value type=" + (rhs == null ? "null object" : rhs.getClass().getName()), module); // if this is an IN operator and the rhs Object isEmpty, add "FALSE" instead of the normal SQL @@ -112,12 +112,12 @@ makeRHSWhereString(entity, entityConditionParams, sql, field, rhs, datasourceInfo); } - protected void makeRHSWhereString(ModelEntity entity, List entityConditionParams, StringBuffer sql, ModelField field, Object rhs, DatasourceInfo datasourceInfo) { + protected void makeRHSWhereString(ModelEntity entity, List entityConditionParams, StringBuilder sql, ModelField field, Object rhs, DatasourceInfo datasourceInfo) { sql.append(' ').append(getCode()).append(' '); makeRHSWhereStringValue(entity, entityConditionParams, sql, field, rhs, datasourceInfo); } - protected void makeRHSWhereStringValue(ModelEntity entity, List entityConditionParams, StringBuffer sql, ModelField field, Object rhs, DatasourceInfo datasourceInfo) { + protected void makeRHSWhereStringValue(ModelEntity entity, List entityConditionParams, StringBuilder sql, ModelField field, Object rhs, DatasourceInfo datasourceInfo) { if (rhs instanceof EntityConditionValue) { EntityConditionValue ecv = (EntityConditionValue) rhs; ecv.addSqlValue(sql, entity, entityConditionParams, false, datasourceInfo); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionBase.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionBase.java?rev=585815&r1=585814&r2=585815&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionBase.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionBase.java Wed Oct 17 20:18:15 2007 @@ -95,7 +95,7 @@ return colName; } - protected void addValue(StringBuffer buffer, ModelField field, Object value, List params) { + protected void addValue(StringBuilder buffer, ModelField field, Object value, List params) { SqlJdbcUtil.addValue(buffer, params == null ? null : field, value, params); } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionFunction.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionFunction.java?rev=585815&r1=585814&r2=585815&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionFunction.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionFunction.java Wed Oct 17 20:18:15 2007 @@ -86,7 +86,7 @@ } public String makeWhereString(ModelEntity modelEntity, List entityConditionParams, DatasourceInfo datasourceInfo) { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append(codeString).append('('); sb.append(condition.makeWhereString(modelEntity, entityConditionParams, datasourceInfo)); sb.append(')'); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionListBase.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionListBase.java?rev=585815&r1=585814&r2=585815&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionListBase.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionListBase.java Wed Oct 17 20:18:15 2007 @@ -72,7 +72,7 @@ public String makeWhereString(ModelEntity modelEntity, List entityConditionParams, DatasourceInfo datasourceInfo) { // if (Debug.verboseOn()) Debug.logVerbose("makeWhereString for entity " + modelEntity.getEntityName(), module); - StringBuffer sql = new StringBuffer(); + StringBuilder sql = new StringBuilder(); operator.addSqlValue(sql, modelEntity, entityConditionParams, conditionList, datasourceInfo); return sql.toString(); } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionSubSelect.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionSubSelect.java?rev=585815&r1=585814&r2=585815&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionSubSelect.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionSubSelect.java Wed Oct 17 20:18:15 2007 @@ -51,7 +51,7 @@ this.requireAll = requireAll; } - public void addSqlValue(StringBuffer sql, Map tableAliases, ModelEntity parentModelEntity, List entityConditionParams, + public void addSqlValue(StringBuilder sql, Map tableAliases, ModelEntity parentModelEntity, List entityConditionParams, boolean includeTableNamePrefix, DatasourceInfo datasourceInfo) { if (localModelEntity instanceof ModelViewEntity && datasourceInfo == null) { throw new IllegalArgumentException("Call to EntityConditionSubSelect.addSqlValue with datasourceInfo=null which is not allowed because the local entity [" + this.localModelEntity.getEntityName() + "] is a view entity"); @@ -73,7 +73,7 @@ sql.append(SqlJdbcUtil.makeFromClause(localModelEntity, datasourceInfo)); // WHERE clause - StringBuffer whereString = new StringBuffer(); + StringBuilder whereString = new StringBuilder(); String entityCondWhereString = ""; if (this.whereCond != null) { entityCondWhereString = this.whereCond.makeWhereString(localModelEntity, entityConditionParams, datasourceInfo); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionValue.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionValue.java?rev=585815&r1=585814&r2=585815&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionValue.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionValue.java Wed Oct 17 20:18:15 2007 @@ -37,12 +37,12 @@ public abstract ModelField getModelField(ModelEntity modelEntity); - public void addSqlValue(StringBuffer sql, ModelEntity modelEntity, List entityConditionParams, boolean includeTableNamePrefix, + public void addSqlValue(StringBuilder sql, ModelEntity modelEntity, List entityConditionParams, boolean includeTableNamePrefix, DatasourceInfo datasourceinfo) { addSqlValue(sql, emptyMap, modelEntity, entityConditionParams, includeTableNamePrefix, datasourceinfo); } - public abstract void addSqlValue(StringBuffer sql, Map tableAliases, ModelEntity modelEntity, List entityConditionParams, + public abstract void addSqlValue(StringBuilder sql, Map tableAliases, ModelEntity modelEntity, List entityConditionParams, boolean includeTableNamePrefix, DatasourceInfo datasourceinfo); public abstract void validateSql(ModelEntity modelEntity) throws GenericModelException; @@ -64,12 +64,12 @@ throw new IllegalArgumentException("accept not implemented"); } - public void toString(StringBuffer sb) { + public void toString(StringBuilder sb) { addSqlValue(sb, null, new ArrayList(), false, null); } public String toString() { - StringBuffer sql = new StringBuffer(); + StringBuilder sql = new StringBuilder(); toString(sql); return sql.toString(); } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java?rev=585815&r1=585814&r2=585815&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java Wed Oct 17 20:18:15 2007 @@ -146,7 +146,7 @@ public String makeWhereString(ModelEntity modelEntity, List entityConditionParams, DatasourceInfo datasourceInfo) { // if (Debug.verboseOn()) Debug.logVerbose("makeWhereString for entity " + modelEntity.getEntityName(), module); - StringBuffer sql = new StringBuffer(); + StringBuilder sql = new StringBuilder(); operator.addSqlValue(sql, modelEntity, entityConditionParams, true, lhs, rhs, datasourceInfo); return sql.toString(); } @@ -163,7 +163,7 @@ } } - protected void addValue(StringBuffer buffer, ModelField field, Object value, List params) { + protected void addValue(StringBuilder buffer, ModelField field, Object value, List params) { if (rhs instanceof EntityFunction.UPPER) { if (value instanceof String) { value = ((String) value).toUpperCase(); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFieldValue.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFieldValue.java?rev=585815&r1=585814&r2=585815&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFieldValue.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFieldValue.java Wed Oct 17 20:18:15 2007 @@ -59,7 +59,7 @@ return getField(modelEntity, fieldName); } - public void addSqlValue(StringBuffer sql, Map tableAliases, ModelEntity modelEntity, List entityConditionParams, boolean includeTableNamePrefix, DatasourceInfo datasourceInfo) { + public void addSqlValue(StringBuilder sql, Map tableAliases, ModelEntity modelEntity, List entityConditionParams, boolean includeTableNamePrefix, DatasourceInfo datasourceInfo) { sql.append(getColName(tableAliases, modelEntity, fieldName, includeTableNamePrefix, datasourceInfo)); } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFunction.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFunction.java?rev=585815&r1=585814&r2=585815&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFunction.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFunction.java Wed Oct 17 20:18:15 2007 @@ -132,7 +132,7 @@ (this.value != null ? value.equals(otherFunc.value) : otherFunc.value == null)); } - public void addSqlValue(StringBuffer sql, Map tableAliases, ModelEntity modelEntity, List entityConditionParams, boolean includeTableNamePrefix, DatasourceInfo datasourceinfo) { + public void addSqlValue(StringBuilder sql, Map tableAliases, ModelEntity modelEntity, List entityConditionParams, boolean includeTableNamePrefix, DatasourceInfo datasourceinfo) { sql.append(codeString).append('('); if (nested != null) { nested.addSqlValue(sql, tableAliases, modelEntity, entityConditionParams, includeTableNamePrefix, datasourceinfo); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityJoinOperator.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityJoinOperator.java?rev=585815&r1=585814&r2=585815&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityJoinOperator.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityJoinOperator.java Wed Oct 17 20:18:15 2007 @@ -43,7 +43,7 @@ this.shortCircuitValue = shortCircuitValue; } - public void addSqlValue(StringBuffer sql, ModelEntity modelEntity, List entityConditionParams, boolean compat, Object lhs, Object rhs, DatasourceInfo datasourceInfo) { + public void addSqlValue(StringBuilder sql, ModelEntity modelEntity, List entityConditionParams, boolean compat, Object lhs, Object rhs, DatasourceInfo datasourceInfo) { sql.append('('); sql.append(((EntityCondition) lhs).makeWhereString(modelEntity, entityConditionParams, datasourceInfo)); sql.append(' '); @@ -57,7 +57,7 @@ sql.append(')'); } - public void addSqlValue(StringBuffer sql, ModelEntity modelEntity, List entityConditionParams, List conditionList, DatasourceInfo datasourceInfo) { + public void addSqlValue(StringBuilder sql, ModelEntity modelEntity, List entityConditionParams, List conditionList, DatasourceInfo datasourceInfo) { if (conditionList != null && conditionList.size() > 0) { sql.append('('); Iterator conditionIter = conditionList.iterator(); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityOperator.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityOperator.java?rev=585815&r1=585814&r2=585815&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityOperator.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityOperator.java Wed Oct 17 20:18:15 2007 @@ -79,7 +79,7 @@ public static final EntityComparisonOperator EQUALS = new EntityComparisonOperator(ID_EQUALS, "=") { public boolean compare(Object lhs, Object rhs) { return EntityComparisonOperator.compareEqual(lhs, rhs); } - protected void makeRHSWhereString(ModelEntity entity, List entityConditionParams, StringBuffer sb, ModelField field, Object rhs, DatasourceInfo datasourceInfo) { + protected void makeRHSWhereString(ModelEntity entity, List entityConditionParams, StringBuilder sb, ModelField field, Object rhs, DatasourceInfo datasourceInfo) { if (rhs == null || rhs == GenericEntity.NULL_FIELD) { //Debug.logInfo("makeRHSWhereString: field IS NULL: " + field.getName(), module); sb.append(" IS NULL"); @@ -92,7 +92,7 @@ static { register( "equals", EQUALS ); } public static final EntityComparisonOperator NOT_EQUAL = new EntityComparisonOperator(ID_NOT_EQUAL, "<>") { public boolean compare(Object lhs, Object rhs) { return EntityComparisonOperator.compareNotEqual(lhs, rhs); } - protected void makeRHSWhereString(ModelEntity entity, List entityConditionParams, StringBuffer sb, ModelField field, Object rhs, DatasourceInfo datasourceInfo) { + protected void makeRHSWhereString(ModelEntity entity, List entityConditionParams, StringBuilder sb, ModelField field, Object rhs, DatasourceInfo datasourceInfo) { if (rhs == null || rhs == GenericEntity.NULL_FIELD) { sb.append(" IS NOT NULL"); } else { @@ -129,7 +129,7 @@ static { register( "greaterThanEqualTo", GREATER_THAN_EQUAL_TO ); } public static final EntityComparisonOperator IN = new EntityComparisonOperator(ID_IN, "IN") { public boolean compare(Object lhs, Object rhs) { return EntityComparisonOperator.compareIn(lhs, rhs); } - protected void makeRHSWhereStringValue(ModelEntity entity, List entityConditionParams, StringBuffer sb, ModelField field, Object rhs) { appendRHSList(entityConditionParams, sb, field, rhs); } + protected void makeRHSWhereStringValue(ModelEntity entity, List entityConditionParams, StringBuilder sb, ModelField field, Object rhs) { appendRHSList(entityConditionParams, sb, field, rhs); } }; static { register( "in", IN ); } public static final EntityComparisonOperator BETWEEN = new EntityComparisonOperator(ID_BETWEEN, "BETWEEN"); @@ -150,7 +150,7 @@ static { register( "not-like", NOT_LIKE); } public static final EntityComparisonOperator NOT_IN = new EntityComparisonOperator(ID_NOT_IN, "NOT IN") { public boolean compare(Object lhs, Object rhs) { return !EntityComparisonOperator.compareIn(lhs, rhs); } - protected void makeRHSWhereStringValue(ModelEntity entity, List entityConditionParams, StringBuffer sb, ModelField field, Object rhs) { appendRHSList(entityConditionParams, sb, field, rhs); } + protected void makeRHSWhereStringValue(ModelEntity entity, List entityConditionParams, StringBuilder sb, ModelField field, Object rhs) { appendRHSList(entityConditionParams, sb, field, rhs); } }; static { register( "not-in", NOT_IN ); } @@ -191,7 +191,7 @@ return mapMatches(entity.getDelegator(), entity, lhs, rhs); } - protected void appendRHSList(List entityConditionParams, StringBuffer whereStringBuffer, ModelField field, Object rhs) { + protected void appendRHSList(List entityConditionParams, StringBuilder whereStringBuffer, ModelField field, Object rhs) { whereStringBuffer.append('('); if (rhs instanceof Collection) { @@ -217,11 +217,11 @@ public abstract boolean mapMatches(GenericDelegator delegator, Map map, Object lhs, Object rhs); public abstract void validateSql(ModelEntity entity, Object lhs, Object rhs) throws GenericModelException; - public void addSqlValue(StringBuffer sql, ModelEntity entity, List entityConditionParams, Object lhs, Object rhs, DatasourceInfo datasourceInfo) { + public void addSqlValue(StringBuilder sql, ModelEntity entity, List entityConditionParams, Object lhs, Object rhs, DatasourceInfo datasourceInfo) { addSqlValue(sql, entity, entityConditionParams, true, lhs, rhs, datasourceInfo); } - public abstract void addSqlValue(StringBuffer sql, ModelEntity entity, List entityConditionParams, boolean compat, Object rhs, Object lhs, DatasourceInfo datasourceInfo); + public abstract void addSqlValue(StringBuilder sql, ModelEntity entity, List entityConditionParams, boolean compat, Object rhs, Object lhs, DatasourceInfo datasourceInfo); public abstract EntityCondition freeze(Object lhs, Object rhs); public abstract void visit(EntityConditionVisitor visitor, Object lhs, Object rhs); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/OrderByItem.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/OrderByItem.java?rev=585815&r1=585814&r2=585815&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/OrderByItem.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/OrderByItem.java Wed Oct 17 20:18:15 2007 @@ -149,12 +149,12 @@ } public String makeOrderByString(ModelEntity modelEntity, boolean includeTablenamePrefix, DatasourceInfo datasourceInfo) { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); makeOrderByString(sb, modelEntity, includeTablenamePrefix, datasourceInfo); return sb.toString(); } - public void makeOrderByString(StringBuffer sb, ModelEntity modelEntity, boolean includeTablenamePrefix, DatasourceInfo datasourceInfo) { + public void makeOrderByString(StringBuilder sb, ModelEntity modelEntity, boolean includeTablenamePrefix, DatasourceInfo datasourceInfo) { getValue().addSqlValue(sb, modelEntity, null, includeTablenamePrefix, datasourceInfo); sb.append(descending ? " DESC" : " ASC"); } @@ -167,7 +167,7 @@ } public String toString() { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); sb.append(getValue()); sb.append(descending ? " DESC" : " ASC"); return sb.toString(); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/OrderByList.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/OrderByList.java?rev=585815&r1=585814&r2=585815&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/OrderByList.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/OrderByList.java Wed Oct 17 20:18:15 2007 @@ -82,12 +82,12 @@ } public String makeOrderByString(ModelEntity modelEntity, boolean includeTablenamePrefix, DatasourceInfo datasourceInfo) { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); makeOrderByString(sb, modelEntity, includeTablenamePrefix, datasourceInfo); return sb.toString(); } - public void makeOrderByString(StringBuffer sb, ModelEntity modelEntity, boolean includeTablenamePrefix, DatasourceInfo datasourceInfo) { + public void makeOrderByString(StringBuilder sb, ModelEntity modelEntity, boolean includeTablenamePrefix, DatasourceInfo datasourceInfo) { if (!orderByList.isEmpty()) { sb.append(" ORDER BY "); } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java?rev=585815&r1=585814&r2=585815&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java Wed Oct 17 20:18:15 2007 @@ -512,7 +512,7 @@ throw new GenericEntityException("Entity has no primary keys, cannot select by primary key"); } - StringBuffer sqlBuffer = new StringBuffer("SELECT "); + StringBuilder sqlBuffer = new StringBuilder("SELECT "); if (modelEntity.getNopksSize() > 0) { sqlBuffer.append(modelEntity.colNameString(modelEntity.getNopksCopy(), ", ", "", datasourceInfo.aliasViews)); @@ -582,7 +582,7 @@ throw new GenericModelException("In partialSelect invalid field names specified: " + tempKeys.toString()); } - StringBuffer sqlBuffer = new StringBuffer("SELECT "); + StringBuilder sqlBuffer = new StringBuilder("SELECT "); if (partialFields.size() > 0) { sqlBuffer.append(modelEntity.colNameString(partialFields, ", ", "", datasourceInfo.aliasViews)); @@ -666,7 +666,7 @@ selectFields = modelEntity.getFieldsCopy(); } - StringBuffer sqlBuffer = new StringBuffer("SELECT "); + StringBuilder sqlBuffer = new StringBuilder("SELECT "); if (findOptions.getDistinct()) { sqlBuffer.append("DISTINCT "); @@ -682,7 +682,7 @@ sqlBuffer.append(SqlJdbcUtil.makeFromClause(modelEntity, datasourceInfo)); // WHERE clause - StringBuffer whereString = new StringBuffer(); + StringBuilder whereString = new StringBuilder(); String entityCondWhereString = ""; List whereEntityConditionParams = FastList.newInstance(); if (whereEntityCondition != null) { @@ -786,7 +786,7 @@ String ttable = modelEntityTwo.getTableName(datasourceInfo); // get the column name string to select - StringBuffer selsb = new StringBuffer(); + StringBuilder selsb = new StringBuilder(); List collist = FastList.newInstance(); List fldlist = FastList.newInstance(); @@ -805,7 +805,7 @@ // construct assoc->target relation string int kmsize = modelRelationTwo.getKeyMapsSize(); - StringBuffer wheresb = new StringBuffer(); + StringBuilder wheresb = new StringBuilder(); for (int i = 0; i < kmsize; i++) { ModelKeyMap mkm = modelRelationTwo.getKeyMap(i); @@ -841,7 +841,7 @@ } // construct a join sql query - StringBuffer sqlsb = new StringBuffer(); + StringBuilder sqlsb = new StringBuilder(); sqlsb.append("SELECT "); sqlsb.append(selsb.toString()); @@ -906,7 +906,7 @@ Debug.logVerbose("Doing selectListIteratorByCondition with whereEntityCondition: " + whereEntityCondition, module); } - StringBuffer sqlBuffer = new StringBuffer("SELECT "); + StringBuilder sqlBuffer = new StringBuilder("SELECT "); if (findOptions.getDistinct()) { sqlBuffer.append("DISTINCT "); @@ -918,7 +918,7 @@ sqlBuffer.append(SqlJdbcUtil.makeFromClause(modelEntity, datasourceInfo)); // WHERE clause - StringBuffer whereString = new StringBuffer(); + StringBuilder whereString = new StringBuilder(); String entityCondWhereString = ""; List whereEntityConditionParams = FastList.newInstance(); if (whereEntityCondition != null) { Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java?rev=585815&r1=585814&r2=585815&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java Wed Oct 17 20:18:15 2007 @@ -1668,7 +1668,7 @@ return errMsg; } - StringBuffer sqlBuf = new StringBuffer("CREATE TABLE "); + StringBuilder sqlBuf = new StringBuilder("CREATE TABLE "); sqlBuf.append(entity.getTableName(this.datasourceInfo)); sqlBuf.append(" ("); Iterator fieldIter = entity.getFieldsIterator(); @@ -1822,7 +1822,7 @@ Debug.logImportant(message, module); if (messages != null) messages.add(message); - StringBuffer sqlBuf = new StringBuffer("DROP TABLE "); + StringBuilder sqlBuf = new StringBuilder("DROP TABLE "); sqlBuf.append(entity.getTableName(datasourceInfo)); if (Debug.verboseOn()) Debug.logVerbose("[deleteTable] sql=" + sqlBuf.toString(), module); try { @@ -1876,7 +1876,7 @@ return "Field type [" + type + "] not found for field [" + field.getName() + "] of entity [" + entity.getEntityName() + "], not adding column."; } - StringBuffer sqlBuf = new StringBuffer("ALTER TABLE "); + StringBuilder sqlBuf = new StringBuilder("ALTER TABLE "); sqlBuf.append(entity.getTableName(datasourceInfo)); sqlBuf.append(" ADD "); sqlBuf.append(field.getColName()); @@ -1904,7 +1904,7 @@ stmt.executeUpdate(sql); } catch (SQLException e) { // if that failed try the alternate syntax real quick - StringBuffer sql2Buf = new StringBuffer("ALTER TABLE "); + StringBuilder sql2Buf = new StringBuilder("ALTER TABLE "); sql2Buf.append(entity.getTableName(datasourceInfo)); sql2Buf.append(" ADD COLUMN "); sql2Buf.append(field.getColName()); @@ -1981,7 +1981,7 @@ return "Field type [" + type + "] not found for field [" + field.getName() + "] of entity [" + entity.getEntityName() + "], not renaming column."; } - StringBuffer sqlBuf = new StringBuffer("ALTER TABLE "); + StringBuilder sqlBuf = new StringBuilder("ALTER TABLE "); sqlBuf.append(entity.getTableName(datasourceInfo)); sqlBuf.append(" RENAME "); sqlBuf.append(field.getColName()); @@ -2055,7 +2055,7 @@ } // copy the data from old to new - StringBuffer sqlBuf1 = new StringBuffer("UPDATE "); + StringBuilder sqlBuf1 = new StringBuilder("UPDATE "); sqlBuf1.append(entity.getTableName(datasourceInfo)); sqlBuf1.append(" SET "); sqlBuf1.append(field.getColName()); @@ -2105,7 +2105,7 @@ } // remove the old column - StringBuffer sqlBuf2 = new StringBuffer("ALTER TABLE "); + StringBuilder sqlBuf2 = new StringBuilder("ALTER TABLE "); sqlBuf2.append(entity.getTableName(datasourceInfo)); sqlBuf2.append(" DROP COLUMN "); sqlBuf2.append(tempName); @@ -2283,7 +2283,7 @@ } // now add constraint clause - StringBuffer sqlBuf = new StringBuffer("ALTER TABLE "); + StringBuilder sqlBuf = new StringBuilder("ALTER TABLE "); sqlBuf.append(entity.getTableName(datasourceInfo)); sqlBuf.append(" ADD "); String fkConstraintClause = makeFkConstraintClause(entity, modelRelation, relModelEntity, constraintNameClipLength, fkStyle, useFkInitiallyDeferred); @@ -2320,8 +2320,8 @@ public String makeFkConstraintClause(ModelEntity entity, ModelRelation modelRelation, ModelEntity relModelEntity, int constraintNameClipLength, String fkStyle, boolean useFkInitiallyDeferred) { // make the two column lists Iterator keyMapsIter = modelRelation.getKeyMapsIterator(); - StringBuffer mainCols = new StringBuffer(); - StringBuffer relCols = new StringBuffer(); + StringBuilder mainCols = new StringBuilder(); + StringBuilder relCols = new StringBuilder(); while (keyMapsIter.hasNext()) { ModelKeyMap keyMap = (ModelKeyMap) keyMapsIter.next(); @@ -2348,7 +2348,7 @@ relCols.append(relField.getColName()); } - StringBuffer sqlBuf = new StringBuffer(""); + StringBuilder sqlBuf = new StringBuilder(""); if ("name_constraint".equals(fkStyle)) { sqlBuf.append("CONSTRAINT "); @@ -2462,7 +2462,7 @@ String relConstraintName = makeFkConstraintName(modelRelation, constraintNameClipLength); // now add constraint clause - StringBuffer sqlBuf = new StringBuffer("ALTER TABLE "); + StringBuilder sqlBuf = new StringBuilder("ALTER TABLE "); sqlBuf.append(entity.getTableName(datasourceInfo)); if (datasourceInfo.dropFkUseForeignKeyKeyword) { sqlBuf.append(" DROP FOREIGN KEY "); @@ -2536,7 +2536,7 @@ } // now add constraint clause - StringBuffer sqlBuf = new StringBuffer("ALTER TABLE "); + StringBuilder sqlBuf = new StringBuilder("ALTER TABLE "); sqlBuf.append(entity.getTableName(datasourceInfo)); sqlBuf.append(" ADD "); @@ -2622,7 +2622,7 @@ } // now add constraint clause - StringBuffer sqlBuf = new StringBuffer("ALTER TABLE "); + StringBuilder sqlBuf = new StringBuilder("ALTER TABLE "); sqlBuf.append(entity.getTableName(datasourceInfo)); sqlBuf.append(" DROP "); @@ -2752,7 +2752,7 @@ public String makeIndexClause(ModelEntity entity, ModelIndex modelIndex) { Iterator fieldNamesIter = modelIndex.getIndexFieldsIterator(); - StringBuffer mainCols = new StringBuffer(); + StringBuilder mainCols = new StringBuilder(); while (fieldNamesIter.hasNext()) { String fieldName = (String) fieldNamesIter.next(); @@ -2763,7 +2763,7 @@ mainCols.append(mainField.getColName()); } - StringBuffer indexSqlBuf = new StringBuffer("CREATE "); + StringBuilder indexSqlBuf = new StringBuilder("CREATE "); if (datasourceInfo.useIndicesUnique && modelIndex.getUnique()) { indexSqlBuf.append("UNIQUE "); } @@ -2795,7 +2795,7 @@ return "ERROR: Cannot delete declared indices for a view entity"; } - StringBuffer retMsgsBuffer = new StringBuffer(); + StringBuilder retMsgsBuffer = new StringBuilder(); // go through the relationships to see if any foreign keys need to be added Iterator indexesIter = entity.getIndexesIterator(); @@ -2836,7 +2836,7 @@ // TODO: also remove the constraing if this was a unique index, in most databases dropping the index does not drop the constraint - StringBuffer indexSqlBuf = new StringBuffer("DROP INDEX "); + StringBuilder indexSqlBuf = new StringBuilder("DROP INDEX "); String tableName = entity.getTableName(datasourceInfo); String schemaName = (tableName == null || tableName.length() == 0 || tableName.indexOf('.') == -1) ? "" : tableName.substring(0, tableName.indexOf('.')); @@ -2964,7 +2964,7 @@ public String makeFkIndexClause(ModelEntity entity, ModelRelation modelRelation, int constraintNameClipLength) { Iterator keyMapsIter = modelRelation.getKeyMapsIterator(); - StringBuffer mainCols = new StringBuffer(); + StringBuilder mainCols = new StringBuilder(); while (keyMapsIter.hasNext()) { ModelKeyMap keyMap = (ModelKeyMap) keyMapsIter.next(); @@ -2981,7 +2981,7 @@ mainCols.append(mainField.getColName()); } - StringBuffer indexSqlBuf = new StringBuffer("CREATE INDEX "); + StringBuilder indexSqlBuf = new StringBuilder("CREATE INDEX "); String relConstraintName = makeFkConstraintName(modelRelation, constraintNameClipLength); indexSqlBuf.append(relConstraintName); @@ -3011,7 +3011,7 @@ return "ERROR: Cannot delete foreign keys indices for a view entity"; } - StringBuffer retMsgsBuffer = new StringBuffer(); + StringBuilder retMsgsBuffer = new StringBuilder(); // go through the relationships to see if any foreign keys need to be added Iterator relationsIter = entity.getRelationsIterator(); @@ -3053,7 +3053,7 @@ return errMsg; } - StringBuffer indexSqlBuf = new StringBuffer("DROP INDEX "); + StringBuilder indexSqlBuf = new StringBuilder("DROP INDEX "); String relConstraintName = makeFkConstraintName(modelRelation, constraintNameClipLength); String tableName = entity.getTableName(datasourceInfo); @@ -3136,7 +3136,7 @@ return; } - StringBuffer sqlTableBuf = new StringBuffer("ALTER TABLE "); + StringBuilder sqlTableBuf = new StringBuilder("ALTER TABLE "); sqlTableBuf.append(entity.getTableName(this.datasourceInfo)); //sqlTableBuf.append(""); @@ -3181,7 +3181,7 @@ continue; } - StringBuffer sqlBuf = new StringBuffer("ALTER TABLE "); + StringBuilder sqlBuf = new StringBuilder("ALTER TABLE "); sqlBuf.append(entity.getTableName(this.datasourceInfo)); sqlBuf.append(" MODIFY COLUMN "); sqlBuf.append(field.getColName()); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java?rev=585815&r1=585814&r2=585815&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java Wed Oct 17 20:18:15 2007 @@ -68,7 +68,7 @@ /** Makes the FROM clause and when necessary the JOIN clause(s) as well */ public static String makeFromClause(ModelEntity modelEntity, DatasourceInfo datasourceInfo) throws GenericEntityException { - StringBuffer sql = new StringBuffer(" FROM "); + StringBuilder sql = new StringBuilder(" FROM "); if (modelEntity instanceof ModelViewEntity) { ModelViewEntity modelViewEntity = (ModelViewEntity) modelEntity; @@ -95,9 +95,9 @@ // TODO: at view-link read time make sure they are ordered properly so that each // left hand alias after the first view-link has already been linked before - StringBuffer openParens = null; - if (useParenthesis) openParens = new StringBuffer(); - StringBuffer restOfStatement = new StringBuffer(); + StringBuilder openParens = null; + if (useParenthesis) openParens = new StringBuilder(); + StringBuilder restOfStatement = new StringBuilder(); for (int i = 0; i < modelViewEntity.getViewLinksSize(); i++) { // don't put starting parenthesis @@ -140,7 +140,7 @@ restOfStatement.append(viewLink.getRelEntityAlias()); restOfStatement.append(" ON "); - StringBuffer condBuffer = new StringBuffer(); + StringBuilder condBuffer = new StringBuilder(); for (int j = 0; j < viewLink.getKeyMapsSize(); j++) { ModelKeyMap keyMap = viewLink.getKeyMap(j); @@ -233,7 +233,7 @@ return ""; } - StringBuffer returnString = new StringBuffer(""); + StringBuilder returnString = new StringBuilder(""); Iterator iter = modelFields.iterator(); while (iter.hasNext()) { Object item = iter.next(); @@ -267,7 +267,7 @@ } public static String makeWhereClause(ModelEntity modelEntity, List modelFields, Map fields, String operator, String joinStyle) throws GenericEntityException { - StringBuffer whereString = new StringBuffer(""); + StringBuilder whereString = new StringBuilder(""); if (modelFields != null && modelFields.size() > 0) { whereString.append(makeWhereStringFromFields(modelFields, fields, "AND")); @@ -294,7 +294,7 @@ public static String makeViewWhereClause(ModelEntity modelEntity, String joinStyle) throws GenericEntityException { if (modelEntity instanceof ModelViewEntity) { - StringBuffer whereString = new StringBuffer(); + StringBuilder whereString = new StringBuilder(); ModelViewEntity modelViewEntity = (ModelViewEntity) modelEntity; if ("ansi".equals(joinStyle) || "ansi-no-parenthesis".equals(joinStyle)) { @@ -364,7 +364,7 @@ } public static String makeOrderByClause(ModelEntity modelEntity, List orderBy, boolean includeTablenamePrefix, DatasourceInfo datasourceInfo) throws GenericModelException { - StringBuffer sql = new StringBuffer(""); + StringBuilder sql = new StringBuilder(""); //String fieldPrefix = includeTablenamePrefix ? (modelEntity.getTableName(datasourceInfo) + ".") : ""; if (orderBy != null && orderBy.size() > 0) { @@ -379,7 +379,7 @@ public static String makeViewTable(ModelEntity modelEntity, DatasourceInfo datasourceInfo) throws GenericEntityException { if (modelEntity instanceof ModelViewEntity) { - StringBuffer sql = new StringBuffer("(SELECT "); + StringBuilder sql = new StringBuilder("(SELECT "); Iterator fieldsIter = modelEntity.getFieldsIterator(); if (fieldsIter.hasNext()) { ModelField curField = (ModelField) fieldsIter.next(); @@ -515,7 +515,7 @@ //Reader valueReader = rs.getCharacterStream(ind); if (valueReader != null) { char[] inCharBuffer = new char[CHAR_BUFFER_SIZE]; - StringBuffer strBuf = new StringBuffer(); + StringBuilder strBuf = new StringBuilder(); int charsRead = 0; try { while ((charsRead = valueReader.read(inCharBuffer, 0, CHAR_BUFFER_SIZE)) > 0) { @@ -822,7 +822,7 @@ return val.intValue(); } - public static void addValueSingle(StringBuffer buffer, ModelField field, Object value, List params) { + public static void addValueSingle(StringBuilder buffer, ModelField field, Object value, List params) { if (field != null) { buffer.append('?'); } else { @@ -831,7 +831,7 @@ if (field != null && params != null) params.add(new EntityConditionParam(field, value)); } - public static void addValue(StringBuffer buffer, ModelField field, Object value, List params) { + public static void addValue(StringBuilder buffer, ModelField field, Object value, List params) { if (value instanceof Collection) { buffer.append("( "); Iterator it = ((Collection) value).iterator(); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java?rev=585815&r1=585814&r2=585815&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java Wed Oct 17 20:18:15 2007 @@ -743,7 +743,7 @@ } public String nameString(List flds, String separator, String afterLast) { - StringBuffer returnString = new StringBuffer(); + StringBuilder returnString = new StringBuilder(); if (flds.size() < 1) { return ""; @@ -765,7 +765,7 @@ } public String typeNameString(List flds) { - StringBuffer returnString = new StringBuffer(); + StringBuilder returnString = new StringBuilder(); if (flds.size() < 1) { return ""; @@ -836,7 +836,7 @@ } public String fieldsStringList(List flds, String eachString, String separator, boolean appendIndex, boolean onlyNonPK) { - StringBuffer returnString = new StringBuffer(); + StringBuilder returnString = new StringBuilder(); if (flds.size() < 1) { return ""; @@ -866,7 +866,7 @@ } public String colNameString(List flds, String separator, String afterLast, boolean alias) { - StringBuffer returnString = new StringBuffer(); + StringBuilder returnString = new StringBuilder(); if (flds.size() < 1) { return ""; @@ -898,7 +898,7 @@ } public String classNameString(List flds, String separator, String afterLast) { - StringBuffer returnString = new StringBuffer(); + StringBuilder returnString = new StringBuilder(); if (flds.size() < 1) { return ""; @@ -920,7 +920,7 @@ } public String finderQueryString(List flds) { - StringBuffer returnString = new StringBuffer(); + StringBuilder returnString = new StringBuilder(); if (flds.size() < 1) { return ""; @@ -945,7 +945,7 @@ } public String httpArgList(List flds) { - StringBuffer returnString = new StringBuffer(); + StringBuilder returnString = new StringBuilder(); if (flds.size() < 1) { return ""; @@ -975,7 +975,7 @@ } public String httpArgListFromClass(List flds) { - StringBuffer returnString = new StringBuffer(); + StringBuilder returnString = new StringBuilder(); if (flds.size() < 1) { return ""; @@ -1011,7 +1011,7 @@ } public String httpArgListFromClass(List flds, String entityNameSuffix) { - StringBuffer returnString = new StringBuffer(); + StringBuilder returnString = new StringBuilder(); if (flds.size() < 1) { return ""; @@ -1049,7 +1049,7 @@ } public String httpRelationArgList(List flds, ModelRelation relation) { - StringBuffer returnString = new StringBuffer(); + StringBuilder returnString = new StringBuilder(); if (flds.size() < 1) { return ""; @@ -1113,7 +1113,7 @@ } public String typeNameStringRelatedNoMapped(List flds, ModelRelation relation) { - StringBuffer returnString = new StringBuffer(); + StringBuilder returnString = new StringBuilder(); if (flds.size() < 1) { return ""; @@ -1143,7 +1143,7 @@ } public String typeNameStringRelatedAndMain(List flds, ModelRelation relation) { - StringBuffer returnString = new StringBuffer(); + StringBuilder returnString = new StringBuilder(); if (flds.size() < 1) { return ""; Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntityChecker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntityChecker.java?rev=585815&r1=585814&r2=585815&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntityChecker.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntityChecker.java Wed Oct 17 20:18:15 2007 @@ -119,7 +119,7 @@ if (reservedWords.contains(field.getColName().toUpperCase())) warningList.add("[FieldNameRW] Column name " + field.getColName() + " of entity " + entity.getEntityName() + " is a reserved word."); if (type == null) { - StringBuffer warningMsg = new StringBuffer(); + StringBuilder warningMsg = new StringBuilder(); warningMsg.append("[FieldTypeNotFound] Field type " + field.getType() + " of entity " + entity.getEntityName() + " not found in field type definitions"); if (helperName == null) { warningMsg.append(" (no helper definition found)"); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelRelation.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelRelation.java?rev=585815&r1=585814&r2=585815&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelRelation.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelRelation.java Wed Oct 17 20:18:15 2007 @@ -205,7 +205,7 @@ if (keyMaps.size() < 1) return ""; - StringBuffer returnString = new StringBuffer( keyMaps.size() * 10 ); + StringBuilder returnString = new StringBuilder( keyMaps.size() * 10 ); int i=0; while (true) { ModelKeyMap kmap = (ModelKeyMap) keyMaps.get(i); @@ -227,7 +227,7 @@ if (keyMaps.size() < 1) return ""; - StringBuffer returnString = new StringBuffer( keyMaps.size() * 10 ); + StringBuilder returnString = new StringBuilder( keyMaps.size() * 10 ); int i=0; while (true) { ModelKeyMap kmap = (ModelKeyMap) keyMaps.get(i); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelUtil.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelUtil.java?rev=585815&r1=585814&r2=585815&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelUtil.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelUtil.java Wed Oct 17 20:18:15 2007 @@ -38,7 +38,7 @@ public static String upperFirstChar(String string) { if (string == null) return null; if (string.length() <= 1) return string.toLowerCase(); - StringBuffer sb = new StringBuffer(string); + StringBuilder sb = new StringBuilder(string); sb.setCharAt(0, Character.toUpperCase(sb.charAt(0))); return sb.toString(); @@ -53,7 +53,7 @@ public static String lowerFirstChar(String string) { if (string == null) return null; if (string.length() <= 1) return string.toLowerCase(); - StringBuffer sb = new StringBuffer(string); + StringBuilder sb = new StringBuilder(string); sb.setCharAt(0, Character.toLowerCase(sb.charAt(0))); return sb.toString(); @@ -88,7 +88,7 @@ public static String dbNameToVarName(String columnName) { if (columnName == null) return null; - StringBuffer fieldName = new StringBuffer(columnName.length()); + StringBuilder fieldName = new StringBuilder(columnName.length()); boolean toUpper = false; for (int i=0; i < columnName.length(); i++) { @@ -121,7 +121,7 @@ public static String javaNameToDbName(String javaName) { if (javaName == null) return null; if (javaName.length() <= 0) return ""; - StringBuffer dbName = new StringBuffer(); + StringBuilder dbName = new StringBuilder(); dbName.append(Character.toUpperCase(javaName.charAt(0))); int namePos = 1; @@ -145,7 +145,7 @@ * @return shortened String */ public static String shortenDbName(String dbName, int desiredLength) { - StringBuffer dbBuf = new StringBuffer(dbName); + StringBuilder dbBuf = new StringBuilder(dbName); if (dbBuf.length() > desiredLength) { // remove one vowel at a time, starting at beginning for (int i = dbBuf.length() - 1; i > 0; i--) { Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java?rev=585815&r1=585814&r2=585815&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java Wed Oct 17 20:18:15 2007 @@ -285,7 +285,7 @@ } public String colNameString(List flds, String separator, String afterLast, boolean alias) { - StringBuffer returnString = new StringBuffer(); + StringBuilder returnString = new StringBuilder(); if (flds.size() < 1) { return ""; @@ -398,8 +398,8 @@ if (alias.isComplexAlias()) { // if this is a complex alias, make a complex column name... - StringBuffer colNameBuffer = new StringBuffer(); - StringBuffer fieldTypeBuffer = new StringBuffer(); + StringBuilder colNameBuffer = new StringBuilder(); + StringBuilder fieldTypeBuffer = new StringBuilder(); alias.makeAliasColName(colNameBuffer, fieldTypeBuffer, this, modelReader); field.colName = colNameBuffer.toString(); field.type = fieldTypeBuffer.toString(); @@ -605,7 +605,7 @@ } if (UtilValidate.isNotEmpty(prefix)) { - StringBuffer newAliasBuffer = new StringBuffer(prefix); + StringBuilder newAliasBuffer = new StringBuilder(prefix); //make sure the first letter is uppercase to delineate the field name newAliasBuffer.append(Character.toUpperCase(aliasName.charAt(0))); newAliasBuffer.append(aliasName.substring(1)); @@ -802,7 +802,7 @@ return complexAliasMember != null; } - public void makeAliasColName(StringBuffer colNameBuffer, StringBuffer fieldTypeBuffer, ModelViewEntity modelViewEntity, ModelReader modelReader) { + public void makeAliasColName(StringBuilder colNameBuffer, StringBuilder fieldTypeBuffer, ModelViewEntity modelViewEntity, ModelReader modelReader) { if (complexAliasMember != null) { complexAliasMember.makeAliasColName(colNameBuffer, fieldTypeBuffer, modelViewEntity, modelReader); } @@ -850,7 +850,7 @@ } public static interface ComplexAliasMember extends Serializable { - public void makeAliasColName(StringBuffer colNameBuffer, StringBuffer fieldTypeBuffer, ModelViewEntity modelViewEntity, ModelReader modelReader); + public void makeAliasColName(StringBuilder colNameBuffer, StringBuilder fieldTypeBuffer, ModelViewEntity modelViewEntity, ModelReader modelReader); } public static class ComplexAlias implements ComplexAliasMember { @@ -881,7 +881,7 @@ this.complexAliasMembers.add(complexAliasMember); } - public void makeAliasColName(StringBuffer colNameBuffer, StringBuffer fieldTypeBuffer, ModelViewEntity modelViewEntity, ModelReader modelReader) { + public void makeAliasColName(StringBuilder colNameBuffer, StringBuilder fieldTypeBuffer, ModelViewEntity modelViewEntity, ModelReader modelReader) { if (complexAliasMembers.size() == 0) { return; } else if (complexAliasMembers.size() == 1) { @@ -927,7 +927,7 @@ /** * Make the alias as follows: function(coalesce(entityAlias.field, defaultValue)) */ - public void makeAliasColName(StringBuffer colNameBuffer, StringBuffer fieldTypeBuffer, ModelViewEntity modelViewEntity, ModelReader modelReader) { + public void makeAliasColName(StringBuilder colNameBuffer, StringBuilder fieldTypeBuffer, ModelViewEntity modelViewEntity, ModelReader modelReader) { ModelEntity modelEntity = modelViewEntity.getAliasedEntity(entityAlias, modelReader); ModelField modelField = modelViewEntity.getAliasedField(modelEntity, field, modelReader); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java?rev=585815&r1=585814&r2=585815&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/test/EntityTestSuite.java Wed Oct 17 20:18:15 2007 @@ -550,7 +550,7 @@ * This creates an string id from a number */ private String getTestId(String strTestBase, int iNum) { - StringBuffer strBufTemp = new StringBuffer(strTestBase); + StringBuilder strBufTemp = new StringBuilder(strTestBase); if (iNum < 10000) { strBufTemp.append("0"); } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityDataLoader.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityDataLoader.java?rev=585815&r1=585814&r2=585815&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityDataLoader.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityDataLoader.java Wed Oct 17 20:18:15 2007 @@ -53,7 +53,7 @@ public static final String module = EntityDataLoader.class.getName(); public static String getPathsString(String helperName) { - StringBuffer pathBuffer = new StringBuffer(); + StringBuilder pathBuffer = new StringBuilder(); if (helperName != null && helperName.length() > 0) { DatasourceInfo datasourceInfo = EntityConfigUtil.getDatasourceInfo(helperName); List sqlLoadPathElements = datasourceInfo.sqlLoadPaths; |
Free forum by Nabble | Edit this page |