IDEMPIERE-308 Performance: Replace use of StringBuffer and String concatenation with StringBuilder

This commit is contained in:
Carlos Ruiz 2020-04-13 14:47:46 +02:00
parent 680bb2090c
commit 455ed28e92
123 changed files with 268 additions and 270 deletions

View File

@ -197,7 +197,7 @@ public class Export extends SvrProcess
outbandProcessor.process(getCtx(), ediProcessor, result.toString(), "C_Invoice-"+p_Record_ID+".txt", Trx.get( get_TrxName(), false ));
} catch (Exception e) {
result = new StringBuffer( e.toString() );
result = new StringBuilder( e.toString() );
}
*/
addLog(0, null, null, Msg.getMsg (getCtx(), "ExportProcessResult") + "\n" + outDocument.toString());

View File

@ -183,7 +183,7 @@ public class ImportPriceList extends SvrProcess
/* UOM For Future USE
// Set UOM (System/own)
sql = new StringBuffer ("UPDATE I_PriceList "
sql = new StringBuilder ("UPDATE I_PriceList "
+ "SET X12DE355 = "
+ "(SELECT MAX(X12DE355) FROM C_UOM u WHERE u.IsDefault='Y' AND u.AD_Client_ID IN (0,I_PriceList.AD_Client_ID)) "
+ "WHERE X12DE355 IS NULL AND C_UOM_ID IS NULL"
@ -191,14 +191,14 @@ public class ImportPriceList extends SvrProcess
no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Set UOM Default=" + no);
//
sql = new StringBuffer ("UPDATE I_PriceList "
sql = new StringBuilder ("UPDATE I_PriceList "
+ "SET C_UOM_ID = (SELECT C_UOM_ID FROM C_UOM u WHERE u.X12DE355=I_PriceList.X12DE355 AND u.AD_Client_ID IN (0,I_PriceList.AD_Client_ID)) "
+ "WHERE C_UOM_ID IS NULL"
+ " AND I_IsImported<>'Y'").append(clientCheck);
no = DB.executeUpdate(sql.toString(), get_TrxName());
log.info("Set UOM=" + no);
//
sql = new StringBuffer ("UPDATE I_PriceList "
sql = new StringBuilder ("UPDATE I_PriceList "
+ "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Invalid UOM, ' "
+ "WHERE C_UOM_ID IS NULL"
+ " AND I_IsImported<>'Y'").append(clientCheck);

View File

@ -249,7 +249,7 @@ public class InOutGenerateRMA extends SvrProcess
log.log(Level.WARNING, msglog.toString());
}
StringBuffer processMsg = new StringBuffer().append(shipment.getDocumentNo());
StringBuilder processMsg = new StringBuilder().append(shipment.getDocumentNo());
if (!shipment.processIt(p_docAction))
{

View File

@ -330,7 +330,7 @@ public class CommissionCalc extends SvrProcess
/**
String sd = DB.TO_DATE(p_StartDate, true);
StringBuffer sql = new StringBuffer ("SELECT ");
StringBuilder sql = new StringBuilder ("SELECT ");
if (MCommission.FREQUENCYTYPE_Quarterly.equals(m_com.getFrequencyType()))
sql.append("TRUNC(").append(sd).append(", 'Q'), TRUNC(").append(sd).append("+92, 'Q')-1");
else if (MCommission.FREQUENCYTYPE_Weekly.equals(m_com.getFrequencyType()))

View File

@ -149,7 +149,7 @@ implements ImportProcess
// Set Country
/**
sql = new StringBuffer ("UPDATE I_BPartner i "
sql = new StringBuilder ("UPDATE I_BPartner i "
+ "SET CountryCode=(SELECT CountryCode FROM C_Country c WHERE c.IsDefault='Y'"
+ " AND c.AD_Client_ID IN (0, i.AD_Client_ID) AND ROWNUM=1) "
+ "WHERE CountryCode IS NULL AND C_Country_ID IS NULL"

View File

@ -220,7 +220,7 @@ public class ImportConversionRate extends SvrProcess
no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 0)
log.warning ("Invalid Rates =" + no);
// sql = new StringBuffer ("UPDATE I_Conversion_Rate i " // Rate diff > 10%
// sql = new StringBuilder ("UPDATE I_Conversion_Rate i " // Rate diff > 10%
// + "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Inconsistent Rates='||(MultiplyRate - (1/DivideRate)) "
// + "WHERE ((MultiplyRate - (1/DivideRate)) > (MultiplyRate * .1))"
// + " AND I_IsImported<>'Y'").append (clientCheck);

View File

@ -572,7 +572,7 @@ public class ImportGLJournal extends SvrProcess
//AZ Goodwill
//BF: 2391401 Remove account balance limitation in Import GL Journal
/*
sql = new StringBuffer ("UPDATE I_GLJournal i "
sql = new StringBuilder ("UPDATE I_GLJournal i "
+ "SET I_ErrorMsg=I_ErrorMsg||'WARN=Check Acct Balance, ' "
+ "WHERE ABS(AmtAcctDr-AmtAcctCr)>100000000" // 100 mio
+ " AND I_IsImported<>'Y'").append (clientCheck);

View File

@ -368,7 +368,7 @@ public class ImportInvoice extends SvrProcess
// Set Country
/**
sql = new StringBuffer ("UPDATE I_Invoice o "
sql = new StringBuilder ("UPDATE I_Invoice o "
+ "SET CountryCode=(SELECT MAX(CountryCode) FROM C_Country c WHERE c.IsDefault='Y'"
+ " AND c.AD_Client_ID IN (0, o.AD_Client_ID)) "
+ "WHERE C_BPartner_ID IS NULL AND CountryCode IS NULL AND C_Country_ID IS NULL"

View File

@ -369,7 +369,7 @@ public class ImportOrder extends SvrProcess
// Set Country
/**
sql = new StringBuffer ("UPDATE I_Order o "
sql = new StringBuilder ("UPDATE I_Order o "
+ "SET CountryCode=(SELECT MAX(CountryCode) FROM C_Country c WHERE c.IsDefault='Y'"
+ " AND c.AD_Client_ID IN (0, o.AD_Client_ID)) "
+ "WHERE C_BPartner_ID IS NULL AND CountryCode IS NULL AND C_Country_ID IS NULL"

View File

@ -359,7 +359,7 @@ public class ImportProduct extends SvrProcess implements ImportProcess
log.warning("No Mandatory Value=" + no);
// Vendor Product No
// sql = new StringBuffer ("UPDATE I_Product i "
// sql = new StringBuilder ("UPDATE I_Product i "
// + "SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No Mandatory VendorProductNo,' "
// + "WHERE I_IsImported<>'Y'"
// + " AND VendorProductNo IS NULL AND (C_BPartner_ID IS NOT NULL OR BPartner_Value IS NOT NULL)").append(clientCheck);

View File

@ -634,7 +634,7 @@ public class ReplenishReport extends SvrProcess
order = new MDDOrder (getCtx(), 0, get_TrxName());
order.setC_DocType_ID(p_C_DocType_ID);
StringBuffer msgsd = new StringBuffer(Msg.getMsg(getCtx(), "Replenishment"))
StringBuilder msgsd = new StringBuilder(Msg.getMsg(getCtx(), "Replenishment"))
.append(": ").append(whSource.getName()).append("->").append(wh.getName());
order.setDescription(msgsd.toString());
// Set Org

View File

@ -97,7 +97,7 @@ public class RecurringRun extends SvrProcess
+ ", Cut_Date=" + p_Cut_Date + ", DocAction=" + p_DocAction);
ArrayList<Object> parameters = new ArrayList<Object>();
StringBuffer whereClause = new StringBuffer("RunsMax>(SELECT COUNT(*) FROM C_Recurring_Run WHERE C_Recurring_Run.C_Recurring_ID=C_Recurring.C_Recurring_ID)");
StringBuilder whereClause = new StringBuilder("RunsMax>(SELECT COUNT(*) FROM C_Recurring_Run WHERE C_Recurring_Run.C_Recurring_ID=C_Recurring.C_Recurring_ID)");
if (p_C_RecurringGroup_ID > 0) {
whereClause.append(" AND C_RecurringGroup_ID=?");
parameters.add(p_C_RecurringGroup_ID);

View File

@ -118,7 +118,7 @@ public class AddressLookup implements AddressLookupInterface {
*/
private URL buildUrl(String postcode) {
try {
StringBuffer urlStr = new StringBuffer();
StringBuilder urlStr = new StringBuilder();
urlStr.append(serverUrl);
urlStr.append(serverUrl.endsWith("/") ? "" : "/");
urlStr.append("/query?op=query&");

View File

@ -41,7 +41,7 @@ public class DefaultDocumentFactory implements IDocFactory {
String tableName = MTable.getTableName(Env.getCtx(), AD_Table_ID);
//
Doc doc = null;
StringBuffer sql = new StringBuffer("SELECT * FROM ")
StringBuilder sql = new StringBuilder("SELECT * FROM ")
.append(tableName)
.append(" WHERE ").append(tableName).append("_ID=? AND Processed='Y'");
PreparedStatement pstmt = null;

View File

@ -165,7 +165,7 @@ public class DefaultModelFactory implements IModelFactory {
// Search packages
for (int i = 0; i < s_packages.length; i++)
{
StringBuffer name = new StringBuffer(s_packages[i]).append(".M").append(className);
StringBuilder name = new StringBuilder(s_packages[i]).append(".M").append(className);
Class<?> clazz = getPOclass(name.toString(), tableName);
if (clazz != null)
{

View File

@ -412,7 +412,7 @@ public class RequestEventHandler extends AbstractEventHandler implements Managed
*/
private String getMailTrailer(MRequest r, String serverAddress)
{
StringBuffer sb = new StringBuffer("\n").append(MRequest.SEPARATOR)
StringBuilder sb = new StringBuilder("\n").append(MRequest.SEPARATOR)
.append(Msg.translate(r.getCtx(), "R_Request_ID"))
.append(": ").append(r.getDocumentNo())
.append(" ").append(r.getMailTag())

View File

@ -35,7 +35,7 @@ public class TaxCriteriaNotFoundException extends AdempiereException
private static final String buildMessage (String criteriaName, int criteria_ID)
{
StringBuffer msg = new StringBuffer("@").append(AD_Message).append("@");
StringBuilder msg = new StringBuilder("@").append(AD_Message).append("@");
msg.append(" @").append(criteriaName).append("@");
msg.append(" (ID ").append(criteria_ID).append(")");
return msg.toString();

View File

@ -40,7 +40,7 @@ public class TaxForChangeNotFoundException extends AdempiereException
private static final String buildMessage(int C_Charge_ID, int AD_Org_ID, int M_Warehouse_ID,
int billC_BPartner_Location_ID, int shipC_BPartner_Location_ID, String additionalMsg)
{
StringBuffer msg = new StringBuffer("@").append(AD_Message).append("@");
StringBuilder msg = new StringBuilder("@").append(AD_Message).append("@");
if (!Util.isEmpty(additionalMsg, true))
{
msg.append(" ").append(additionalMsg).append(" - ");

View File

@ -37,7 +37,7 @@ public class TaxNoExemptFoundException extends AdempiereException
private static final String buildMessage (int AD_Org_ID)
{
StringBuffer msg = new StringBuffer("@").append(AD_Message).append("@");
StringBuilder msg = new StringBuilder("@").append(AD_Message).append("@");
msg.append("@AD_Org_ID@:").append(getOrgString(AD_Org_ID));
//
return msg.toString();

View File

@ -50,7 +50,7 @@ public class TaxNotFoundException extends AdempiereException
Timestamp billDate, int billFromC_Location_ID, int billToC_Location_ID)
{
final DateFormat df = DisplayType.getDateFormat();
StringBuffer msg = new StringBuffer("@").append(AD_Message).append("@");
StringBuilder msg = new StringBuilder("@").append(AD_Message).append("@");
//
msg.append(" - @C_TaxCategory_ID@:").append(getTaxCategoryString(C_TaxCategory_ID));
msg.append(", @IsSOTrx@:@").append(IsSOTrx ? "Y":"N").append("@");

View File

@ -203,7 +203,7 @@ public abstract class AbstractExcelExporter
* @return number excel format string
*/
private String getFormatString(NumberFormat df, boolean isHighlightNegativeNumbers) {
StringBuffer format = new StringBuffer();
StringBuilder format = new StringBuilder();
int integerDigitsMin = df.getMinimumIntegerDigits();
int integerDigitsMax = df.getMaximumIntegerDigits();
for (int i = 0; i < integerDigitsMax; i++) {
@ -227,7 +227,7 @@ public abstract class AbstractExcelExporter
}
if (isHighlightNegativeNumbers) {
String f = format.toString();
format = new StringBuffer(f).append(";[RED]-").append(f);
format = new StringBuilder(f).append(";[RED]-").append(f);
}
//
if (log.isLoggable(Level.FINEST)) log.finest("NumberFormat: "+format);

View File

@ -225,7 +225,7 @@ public abstract class AbstractXLSXExporter
*/
private String getFormatString(NumberFormat df, boolean isHighlightNegativeNumbers)
{
StringBuffer format = new StringBuffer();
StringBuilder format = new StringBuilder();
int integerDigitsMin = df.getMinimumIntegerDigits();
int integerDigitsMax = df.getMaximumIntegerDigits();
for (int i = 0; i < integerDigitsMax; i++)
@ -253,7 +253,7 @@ public abstract class AbstractXLSXExporter
if (isHighlightNegativeNumbers)
{
String f = format.toString();
format = new StringBuffer(f).append(";[RED]-").append(f);
format = new StringBuilder(f).append(";[RED]-").append(f);
}
//
if (log.isLoggable(Level.FINEST))

View File

@ -100,7 +100,7 @@ public class GenericPO extends PO {
}
public String toString() {
StringBuffer sb = new StringBuffer("GenericPO[Table=").append(
StringBuilder sb = new StringBuilder("GenericPO[Table=").append(
"" + tableID + ",ID=").append(get_ID()).append("]");
return sb.toString();
}

View File

@ -14,8 +14,6 @@
package org.adempiere.model;
import static org.compiere.model.I_AD_Ref_Table.COLUMNNAME_AD_Reference_ID;
import static org.compiere.model.I_AD_Ref_Table.COLUMNNAME_OrderByClause;
import static org.compiere.model.I_AD_Ref_Table.COLUMNNAME_WhereClause;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
@ -64,32 +62,32 @@ public class MRelationType extends X_AD_RelationType implements IZoomProvider {
* <b>Warning:</b> Doesn't support POs with more or less than one key
* column.
*/
static StringBuffer SQL = //
new StringBuffer(" SELECT " )//
.append(" rt.AD_RelationType_ID AS ").append(COLUMNNAME_AD_RelationType_ID) //
.append(", rt.Name AS ").append(COLUMNNAME_Name )//
.append(", rt.IsDirected AS ").append(COLUMNNAME_IsDirected) //
.append(", ref.AD_Reference_ID AS ").append(COLUMNNAME_AD_Reference_ID) //
.append(", tab.WhereClause AS ").append(COLUMNNAME_WhereClause) //
.append(", tab.OrderByClause AS ").append(COLUMNNAME_OrderByClause) //
.append(" FROM") //
.append(" AD_RelationType rt, AD_Reference ref, AD_Ref_Table tab") //
.append(" WHERE ") //
.append(" rt.IsActive='Y'") //
.append(" AND ref.IsActive='Y'") //
.append(" AND ref.ValidationType='T'") // must have table validation
.append(" AND (") // join the source AD_Reference
.append(" rt.AD_Reference_Source_ID=ref.AD_Reference_ID") //
.append(" OR (") // not directed? -> also join the target AD_Reference
.append(" rt.IsDirected='N' ") //
.append(" AND rt.AD_Reference_Target_ID=ref.AD_Reference_ID") //
.append(" )") //
.append(" )") //
.append(" AND tab.IsActive='Y'") // Join the AD_Reference's AD_Ref_Table
.append(" AND tab.AD_Reference_ID=ref.AD_Reference_ID") //
.append(" AND tab.AD_Table_ID=?") //
.append(" AND tab.AD_Key=?") //
.append(" ORDER BY rt.Name");
final static String SQL =
" SELECT "
+ " rt.AD_RelationType_ID"
+ ", rt.Name"
+ ", rt.IsDirected"
+ ", ref.AD_Reference_ID"
+ ", tab.WhereClause"
+ ", tab.OrderByClause"
+ " FROM"
+ " AD_RelationType rt, AD_Reference ref, AD_Ref_Table tab"
+ " WHERE "
+ " rt.IsActive='Y'"
+ " AND ref.IsActive='Y'"
+ " AND ref.ValidationType='T'" // must have table validation
+ " AND (" // join the source AD_Reference
+ " rt.AD_Reference_Source_ID=ref.AD_Reference_ID" //
+ " OR (" // not directed? -> also join the target AD_Reference
+ " rt.IsDirected='N' "
+ " AND rt.AD_Reference_Target_ID=ref.AD_Reference_ID"
+ " )"
+ " )"
+ " AND tab.IsActive='Y'" // Join the AD_Reference's AD_Ref_Table
+ " AND tab.AD_Reference_ID=ref.AD_Reference_ID"
+ " AND tab.AD_Table_ID=?"
+ " AND tab.AD_Key=?"
+ " ORDER BY rt.Name";
final static String SQL_WINDOW_NAME = "SELECT Name FROM AD_Window WHERE AD_WINDOW_ID=?";
@ -132,7 +130,7 @@ public class MRelationType extends X_AD_RelationType implements IZoomProvider {
final int colId = MColumn.getColumn_ID(po.get_TableName(), keyColumn);
final PreparedStatement pstmt = DB.prepareStatement(SQL.toString(), po
final PreparedStatement pstmt = DB.prepareStatement(SQL, po
.get_TrxName());
ResultSet rs = null;

View File

@ -356,7 +356,7 @@ public class UUIDGenerator extends SvrProcess {
public static void updateAllUUID(MColumn column) {
MTable table = (MTable) column.getAD_Table();
int AD_Column_ID = DB.getSQLValue(null, "SELECT AD_Column_ID FROM AD_Column WHERE AD_Table_ID=? AND ColumnName=?", table.getAD_Table_ID(), table.getTableName()+"_ID");
StringBuffer sql = new StringBuffer("SELECT ");
StringBuilder sql = new StringBuilder("SELECT ");
String keyColumn = null;
// second script - just generate for tables with _ID primary key

View File

@ -51,7 +51,7 @@ public class GenerateModel
*/
public String toString()
{
StringBuffer sb = new StringBuffer ("GenerateModel[").append("]");
StringBuilder sb = new StringBuilder ("GenerateModel[").append("]");
return sb.toString();
}
@ -106,7 +106,7 @@ public class GenerateModel
System.err.println("No EntityType");
System.exit(1);
}
StringBuffer sql = new StringBuffer("EntityType IN (")
StringBuilder sql = new StringBuilder("EntityType IN (")
.append(entityType).append(")");
log.info(sql.toString());
log.info("----------------------------------");

View File

@ -131,7 +131,7 @@ public class GenerateModelJPA
//String className = "X_" + tableName;
String className = "" + tableName;
//
StringBuffer start = new StringBuffer ()
StringBuilder start = new StringBuilder ()
.append (COPY)
.append ("package " + packageName + ";\n"
+ "/** Generated Model JPA - DO NOT CHANGE */\n");
@ -200,12 +200,12 @@ public class GenerateModelJPA
+ "/** Info\n@return info\n*/\n"
+ "public String toString()"
+ "{"
+ "StringBuffer sb = new StringBuffer (\"").append(className).append("[\")"
+ "StringBuilder sb = new StringBuilder (\"").append(className).append("[\")"
+ ".append(get_ID()).append(\"]\");"
+ "return sb.toString();"
+ "}");
StringBuffer end = new StringBuffer ("}");
StringBuilder end = new StringBuilder ("}");
//
sb.insert(0, start);
sb.append(end);
@ -538,9 +538,9 @@ public class GenerateModelJPA
.append("_AD_Reference_ID=").append(AD_Reference_ID).append(";");
//
boolean found = false;
StringBuffer values = new StringBuffer("Reference_ID=")
StringBuilder values = new StringBuilder("Reference_ID=")
.append(AD_Reference_ID);
StringBuffer statement = new StringBuffer();
StringBuilder statement = new StringBuilder();
if (nullable)
statement.append("if (").append(columnName).append(" == null");
//
@ -573,7 +573,7 @@ public class GenerateModelJPA
// Name (SmallTalkNotation)
String name = rs.getString(2);
char[] nameArray = name.toCharArray();
StringBuffer nameClean = new StringBuffer();
StringBuilder nameClean = new StringBuilder();
boolean initCap = true;
for (int i = 0; i < nameArray.length; i++)
{
@ -708,7 +708,7 @@ public class GenerateModelJPA
*/
public String toString()
{
StringBuffer sb = new StringBuffer ("GenerateModel[")
StringBuilder sb = new StringBuilder ("GenerateModel[")
.append("]");
return sb.toString();
} // toString
@ -766,7 +766,7 @@ public class GenerateModelJPA
System.err.println("No EntityType");
System.exit(1);
}
StringBuffer sql = new StringBuffer("EntityType IN (")
StringBuilder sql = new StringBuilder("EntityType IN (")
.append(entityType).append(")");
if (log.isLoggable(Level.INFO)) log.info(sql.toString());
log.info("----------------------------------");

View File

@ -901,7 +901,7 @@ public class Doc_MatchInv extends Doc
+ "WHERE C_InvoiceLine_ID IN (SELECT C_InvoiceLine_ID FROM C_InvoiceLine WHERE C_Invoice_ID=?) "
+ "AND COALESCE(Reversal_ID,0)=0";
List<List<Object>> list = DB.getSQLArrayObjectsEx(getTrxName(), matchInvLineSql, invoice.get_ID());
StringBuffer s = new StringBuffer();
StringBuilder s = new StringBuilder();
if (list == null)
return null;
@ -1084,7 +1084,7 @@ public class Doc_MatchInv extends Doc
+ "WHERE M_InOutLine_ID IN (SELECT M_InOutLine_ID FROM M_InOutLine WHERE M_InOut_ID=?) "
+ "AND COALESCE(Reversal_ID,0)=0";
List<List<Object>> list = DB.getSQLArrayObjectsEx(getTrxName(), matchInvLineSql, receipt.get_ID());
StringBuffer s = new StringBuffer();
StringBuilder s = new StringBuilder();
if (list == null)
return null;

View File

@ -406,10 +406,10 @@ public interface AdempiereDatabase
*/
public default String getSQLCreate(MTable table)
{
StringBuffer sb = new StringBuffer("CREATE TABLE ")
StringBuilder sb = new StringBuilder("CREATE TABLE ")
.append(table.getTableName()).append(" (");
//
StringBuffer constraints = new StringBuffer();
StringBuilder constraints = new StringBuilder();
MColumn[] columns = table.getColumns(true);
boolean columnAdded = false;
for (int i = 0; i < columns.length; i++)

View File

@ -565,9 +565,9 @@ public class CreateAdempiere
*/
private boolean createTableDataRow (ResultSet rs, MTable mTable)
{
StringBuffer insert = new StringBuffer ("INSERT INTO ")
StringBuilder insert = new StringBuilder ("INSERT INTO ")
.append(mTable.getTableName()).append(" (");
StringBuffer values = new StringBuffer ();
StringBuilder values = new StringBuilder ();
//
MColumn[] columns = mTable.getColumns(false);
for (int i = 0; i < columns.length; i++)

View File

@ -53,11 +53,11 @@ public class LDAP
// ldap://dc.compiere.org
env.put(Context.PROVIDER_URL, ldapURL);
env.put(Context.SECURITY_AUTHENTICATION, "simple");
StringBuffer principal;
StringBuilder principal;
if ("openldap".equals(MSysConfig.getValue(MSysConfig.LDAP_TYPE))) {
principal = new StringBuffer("uid=").append(userName).append(",").append(domain);
principal = new StringBuilder("uid=").append(userName).append(",").append(domain);
} else {
principal = new StringBuffer(userName).append("@").append(domain);
principal = new StringBuilder(userName).append("@").append(domain);
}
env.put(Context.SECURITY_PRINCIPAL, principal.toString());
env.put(Context.SECURITY_CREDENTIALS, password);

View File

@ -306,7 +306,7 @@ public abstract class Convert
Pattern p = Pattern.compile("'[[^']*]*'");
Matcher m = p.matcher(inputValue);
int i = 0;
StringBuffer retValue = new StringBuffer(inputValue.length());
StringBuilder retValue = new StringBuilder(inputValue.length());
while (m.find()) {
String var = inputValue.substring(m.start(), m.end()).replace(quoteMarker, "''"); // Put back quotes, if any
retVars.addElement(var);

View File

@ -188,7 +188,7 @@ public abstract class Convert_SQL92 extends Convert {
WHERE tn.AD_Tree_ID=10
*/
StringBuffer newFrom = new StringBuffer ();
StringBuilder newFrom = new StringBuilder ();
for (int i = 0; i < joins.size(); i++)
{
Join first = new Join ((String)joins.get(i));

View File

@ -196,7 +196,7 @@ public class Translation implements IApplication
String uuidColumn = MTable.getUUIDColumnName(Base_Table);
String[] trlColumns = getTrlColumns (Base_Table);
//
StringBuffer sql = null;
StringBuilder sql = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
try
@ -216,7 +216,7 @@ public class Translation implements IApplication
root.setAttribute(XML_ATTRIBUTE_TABLE, Base_Table);
document.appendChild(root);
//
sql = new StringBuffer ("SELECT ");
sql = new StringBuilder ("SELECT ");
if (isBaseLanguage)
sql.append("'Y',"); // 1
else

View File

@ -82,7 +82,7 @@ public class CalloutEngine implements Callout
//
String retValue = "";
StringBuffer msg = new StringBuffer(methodName).append(" - ")
StringBuilder msg = new StringBuilder(methodName).append(" - ")
.append(mField.getColumnName())
.append("=").append(value)
.append(" (old=").append(oldValue)
@ -143,7 +143,7 @@ public class CalloutEngine implements Callout
throw new IllegalArgumentException ("No Method Name");
//
String retValue = null;
StringBuffer msg = new StringBuffer(methodName).append(" - ").append(value);
StringBuilder msg = new StringBuilder(methodName).append(" - ").append(value);
if (log.isLoggable(Level.INFO)) log.info (msg.toString());
//
// Find Method

View File

@ -2218,7 +2218,7 @@ public class GridField
*/
public String toString()
{
StringBuffer sb = new StringBuffer("GridField[")
StringBuilder sb = new StringBuilder("GridField[")
.append(m_vo.ColumnName).append("=").append(m_value);
if (isKey())
sb.append("(Key)");

View File

@ -636,7 +636,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
* Set Where Clause
*/
// Tab Where Clause
StringBuffer where = new StringBuffer(m_vo.WhereClause);
StringBuilder where = new StringBuilder(m_vo.WhereClause);
if (m_vo.onlyCurrentDays > 0)
{
if (where.length() > 0)
@ -739,9 +739,9 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
public void resetDetailForNewParentRecord() {
if (m_mTable.isOpen())
{
StringBuffer where = new StringBuffer("2=3");
m_extendedWhere = where.toString();
m_oldQuery = where.toString();
String where = "2=3";
m_extendedWhere = where;
m_oldQuery = where;
m_parentNeedSave = true;
m_currentRow = -1;
@ -749,7 +749,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
* Query
*/
if (log.isLoggable(Level.FINE)) log.fine("#" + m_vo.TabNo + " - " + where);
m_mTable.dataRequery(where.toString(), m_vo.onlyCurrentRows && !isDetail(), 0);
m_mTable.dataRequery(where, m_vo.onlyCurrentRows && !isDetail(), 0);
// Go to Record 0
setCurrentRow(0, true);
@ -888,7 +888,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
query.setTableName("xx");
// use IN instead of EXISTS as subquery should be highly selective
StringBuffer result = new StringBuffer (getTableName()).append(".").append(tabKeyColumn)
StringBuilder result = new StringBuilder (getTableName()).append(".").append(tabKeyColumn)
.append(" IN (SELECT xx.").append(tabKeyColumn)
.append(" FROM ")
.append(tableName).append(" xx WHERE ")
@ -1855,7 +1855,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
int Record_ID;
boolean isOrder = m_vo.TableName.startsWith("C_Order");
//
StringBuffer sql = new StringBuffer("SELECT COUNT(*) AS Lines,c.ISO_Code,o.TotalLines,o.GrandTotal,"
StringBuilder sql = new StringBuilder("SELECT COUNT(*) AS Lines,c.ISO_Code,o.TotalLines,o.GrandTotal,"
+ "currencyBase(o.GrandTotal,o.C_Currency_ID,o.DateAcct, o.AD_Client_ID,o.AD_Org_ID) AS ConvAmt ");
if (isOrder)
{

View File

@ -2077,7 +2077,7 @@ public class GridTable extends AbstractTableModel
// Need to re-read row to get ROWID, Key, DocumentNo, Trigger, virtual columns
if (log.isLoggable(Level.FINE)) log.fine("Reading ... " + whereClause);
StringBuffer refreshSQL = new StringBuffer(m_SQL_Select)
StringBuilder refreshSQL = new StringBuilder(m_SQL_Select)
.append(" WHERE ").append(whereClause);
pstmt = DB.prepareStatement(refreshSQL.toString(), null);
rs = pstmt.executeQuery();
@ -2279,7 +2279,7 @@ public class GridTable extends AbstractTableModel
// Refresh - update buffer
String whereClause = po.get_WhereClause(true);
if (log.isLoggable(Level.FINE)) log.fine("Reading ... " + whereClause);
StringBuffer refreshSQL = new StringBuffer(m_SQL_Select)
StringBuilder refreshSQL = new StringBuilder(m_SQL_Select)
.append(" WHERE ").append(whereClause);
PreparedStatement pstmt = null;
ResultSet rs = null;
@ -2349,8 +2349,8 @@ public class GridTable extends AbstractTableModel
private String getWhereClause (Object[] rowData)
{
int size = m_fields.size();
StringBuffer singleRowWHERE = null;
StringBuffer multiRowWHERE = null;
StringBuilder singleRowWHERE = null;
StringBuilder multiRowWHERE = null;
String tableName = getTableName();
for (int col = 0; col < size; col++)
{
@ -2365,10 +2365,10 @@ public class GridTable extends AbstractTableModel
return null;
}
if (columnName.endsWith ("_ID"))
singleRowWHERE = new StringBuffer(tableName).append(".").append(columnName)
singleRowWHERE = new StringBuilder(tableName).append(".").append(columnName)
.append ("=").append (value);
else
singleRowWHERE = new StringBuffer(tableName).append(".").append(columnName)
singleRowWHERE = new StringBuilder(tableName).append(".").append(columnName)
.append ("=").append (DB.TO_STRING(value.toString()));
}
else if (field.isParentColumn())
@ -2381,7 +2381,7 @@ public class GridTable extends AbstractTableModel
continue;
}
if (multiRowWHERE == null)
multiRowWHERE = new StringBuffer();
multiRowWHERE = new StringBuilder();
else
multiRowWHERE.append(" AND ");
if (columnName.endsWith ("_ID"))
@ -3486,7 +3486,7 @@ public class GridTable extends AbstractTableModel
*/
public String toString()
{
return new StringBuffer("MTable[").append(m_tableName)
return new StringBuilder("MTable[").append(m_tableName)
.append(",WindowNo=").append(m_WindowNo)
.append(",Tab=").append(m_TabNo).append("]").toString();
} // toString

View File

@ -109,7 +109,7 @@ public class GridWindowVO implements Serializable
// -- Get Window
StringBuffer sql = new StringBuffer("SELECT Name,Description,Help,WindowType, "
StringBuilder sql = new StringBuilder("SELECT Name,Description,Help,WindowType, "
+ "AD_Color_ID,AD_Image_ID,WinHeight,WinWidth, "
+ "IsSOTrx, AD_Window_UU ");

View File

@ -288,7 +288,7 @@ implements DocAction
public String getSummary()
{
return new StringBuffer()
return new StringBuilder()
.append(getDocumentNo()).append("/").append(getDateDoc())
.toString();
}

View File

@ -65,7 +65,7 @@ public class MBankAccountProcessor extends X_C_BankAccount_Processor {
int AD_Client_ID, int C_Currency_ID, BigDecimal Amt, String trxName)
{
ArrayList<MBankAccountProcessor> list = new ArrayList<MBankAccountProcessor>();
StringBuffer sql = new StringBuffer("SELECT bap.* "
StringBuilder sql = new StringBuilder("SELECT bap.* "
+ "FROM C_BankAccount_Processor bap, C_PaymentProcessor pp, C_BankAccount ba "
+ "WHERE pp.C_PaymentProcessor_ID = bap.C_PaymentProcessor_ID"
+ " AND ba.C_BankAccount_ID = bap.C_BankAccount_ID"

View File

@ -88,7 +88,7 @@ public class MChartDatasource extends X_AD_ChartDatasource {
sql += " GROUP BY " + series + ", " + category + "," + getKeyColumn()
+ " ORDER BY " + series + ", " + category + "," + getKeyColumn();
StringBuffer includedIds = new StringBuffer();
StringBuilder includedIds = new StringBuilder();
// Execute
PreparedStatement pstmt = null;
ResultSet rs = null;

View File

@ -53,7 +53,7 @@ public class MDashboardContentAccess extends X_PA_DashboardContent_Access {
parameters.add(AD_Client_ID);
parameters.add(AD_Client_ID);
StringBuffer sql= new StringBuffer();
StringBuilder sql= new StringBuilder();
// First part : dashboards not configured in access and flagged to be shown in login (this is intended to show new dashboards, otherwise new dashboards won't be shown unless the user go and configure them)
sql.append("SELECT PA_DashboardContent_ID,ColumnNo ")
.append(" FROM PA_DashboardContent ")

View File

@ -182,7 +182,7 @@ public class MDepositBatch extends X_C_DepositBatch
*/
public String toString ()
{
StringBuffer sb = new StringBuffer ("MDepositBatch[");
StringBuilder sb = new StringBuilder ("MDepositBatch[");
sb.append(get_ID()).append(",").append(getDescription())
.append(",Amount=").append(getDepositAmt())
.append ("]");

View File

@ -91,7 +91,7 @@ public class MDocumentStatus extends X_PA_DocumentStatus {
} // getDocumentStatusIndicators
public static int evaluate(MDocumentStatus documentStatus) {
StringBuffer sql = new StringBuffer("SELECT COUNT(*) FROM ");
StringBuilder sql = new StringBuilder("SELECT COUNT(*) FROM ");
String tableName = MTable.getTableName(Env.getCtx(), documentStatus.getAD_Table_ID());
sql.append(tableName);
String where = getWhereClause(documentStatus);
@ -102,7 +102,7 @@ public class MDocumentStatus extends X_PA_DocumentStatus {
}
public static String getWhereClause(MDocumentStatus documentStatus) {
StringBuffer where = new StringBuffer(" AD_Client_ID=" + Env.getAD_Client_ID(Env.getCtx()) );
StringBuilder where = new StringBuilder(" AD_Client_ID=" + Env.getAD_Client_ID(Env.getCtx()) );
if (documentStatus.getC_Project_ID() > 0)
{
where.append(" AND C_Project_ID=").append(documentStatus.getC_Project_ID());

View File

@ -57,7 +57,7 @@ public class MIFixedAsset extends X_I_FixedAsset
int M_Product_ID = getM_Product_ID();
if (M_Product_ID <= 0) {
StringBuffer whereClause = new StringBuffer();
StringBuilder whereClause = new StringBuilder();
String key = getProductValue();
if (key == null || key.trim().length() == 0) {
key = getName();

View File

@ -197,7 +197,7 @@ public class MNote extends X_AD_Note
*/
public String toString()
{
StringBuffer sb = new StringBuffer ("MNote[")
StringBuilder sb = new StringBuilder ("MNote[")
.append(get_ID()).append(",AD_Message_ID=").append(getAD_Message_ID())
.append(",").append(getReference())
.append(",Processed=").append(isProcessed())

View File

@ -578,7 +578,7 @@ public class MOrder extends X_C_Order implements DocAction
*/
public String toString ()
{
StringBuffer sb = new StringBuffer ("MOrder[")
StringBuilder sb = new StringBuilder ("MOrder[")
.append(get_ID()).append("-").append(getDocumentNo())
.append(",IsSOTrx=").append(isSOTrx())
.append(",C_DocType_ID=").append(getC_DocType_ID())

View File

@ -605,7 +605,7 @@ public class MOrderLine extends X_C_OrderLine
*/
public String toString ()
{
StringBuffer sb = new StringBuffer ("MOrderLine[")
StringBuilder sb = new StringBuilder ("MOrderLine[")
.append(get_ID())
.append(", Line=").append(getLine())
.append(", Ordered=").append(getQtyOrdered())

View File

@ -258,7 +258,7 @@ public class MOrderTax extends X_C_OrderTax
*/
public String toString ()
{
StringBuffer sb = new StringBuffer ("MOrderTax[")
StringBuilder sb = new StringBuilder ("MOrderTax[")
.append("C_Order_ID=").append(getC_Order_ID())
.append(", C_Tax_ID=").append(getC_Tax_ID())
.append(", Base=").append(getTaxBaseAmt())

View File

@ -286,7 +286,7 @@ public class MPInstance extends X_AD_PInstance
*/
public String toString ()
{
StringBuffer sb = new StringBuffer ("MPInstance[")
StringBuilder sb = new StringBuilder ("MPInstance[")
.append (get_ID())
.append(",OK=").append(isOK());
String msg = getErrorMsg();

View File

@ -93,7 +93,7 @@ public class MPInstancePara extends X_AD_PInstance_Para
*/
public String toString ()
{
StringBuffer sb = new StringBuffer ("MPInstancePara[")
StringBuilder sb = new StringBuilder ("MPInstancePara[")
.append (get_ID ()).append("-").append(getParameterName());
if (getP_String() != null)
{

View File

@ -85,7 +85,7 @@ public class MPaymentProcessor extends X_C_PaymentProcessor
*/
public String toString ()
{
StringBuffer sb = new StringBuffer ("MPaymentProcessor[")
StringBuilder sb = new StringBuilder ("MPaymentProcessor[")
.append(get_ID ()).append("-").append(getName())
.append ("]");
return sb.toString ();

View File

@ -119,7 +119,7 @@ public class MPrivateAccess extends X_AD_Private_Access
if (list.size() == 1)
return "<>" + list.get(0);
//
StringBuffer sb = new StringBuffer(" NOT IN(");
StringBuilder sb = new StringBuilder(" NOT IN(");
for (int i = 0; i < list.size(); i++)
{
if (i > 0)

View File

@ -189,7 +189,7 @@ public class MProcess extends X_AD_Process
*/
public String toString ()
{
StringBuffer sb = new StringBuffer ("MProcess[")
StringBuilder sb = new StringBuilder ("MProcess[")
.append (get_ID())
.append("-").append(getName())
.append ("]");

View File

@ -210,7 +210,7 @@ public class MProcessPara extends X_AD_Process_Para
*/
public String toString ()
{
StringBuffer sb = new StringBuffer ("MProcessPara[")
StringBuilder sb = new StringBuilder ("MProcessPara[")
.append (get_ID ())
.append ("]");
return sb.toString ();

View File

@ -139,7 +139,7 @@ public class MProductDownload extends X_M_ProductDownload
*/
public String toString ()
{
StringBuffer sb = new StringBuffer ("MProductDownload[")
StringBuilder sb = new StringBuilder ("MProductDownload[")
.append(get_ID())
.append(",M_Product_ID=").append(getM_Product_ID())
.append(",").append(getDownloadURL())

View File

@ -140,7 +140,7 @@ public class MProject extends X_C_Project
*/
public String toString()
{
StringBuffer sb = new StringBuffer ("MProject[").append(get_ID())
StringBuilder sb = new StringBuilder ("MProject[").append(get_ID())
.append("-").append(getValue()).append(",ProjectCategory=").append(getProjectCategory())
.append("]");
return sb.toString();

View File

@ -99,7 +99,7 @@ public class MProjectType extends X_C_ProjectType
*/
public String toString()
{
StringBuffer sb = new StringBuffer ("MProjectType[")
StringBuilder sb = new StringBuilder ("MProjectType[")
.append(get_ID())
.append("-").append(getName())
.append("]");

View File

@ -250,7 +250,7 @@ public class MRMATax extends X_M_RMATax
*/
public String toString ()
{
StringBuffer sb = new StringBuffer ("MRMATax[")
StringBuilder sb = new StringBuilder ("MRMATax[")
.append("M_RMA_ID=").append(getM_RMA_ID())
.append(", C_Tax_ID=").append(getC_Tax_ID())
.append(", Base=").append(getTaxBaseAmt())

View File

@ -197,7 +197,7 @@ public class MRecordAccess extends X_AD_Record_Access
*/
public String toString()
{
StringBuffer sb = new StringBuffer("MRecordAccess[AD_Role_ID=")
StringBuilder sb = new StringBuilder("MRecordAccess[AD_Role_ID=")
.append(getAD_Role_ID())
.append(",AD_Table_ID=").append(getAD_Table_ID())
.append(",Record_ID=").append(getRecord_ID())

View File

@ -64,7 +64,7 @@ public class MRecurring extends X_C_Recurring
*/
public String toString()
{
StringBuffer sb = new StringBuffer ("MRecurring[")
StringBuilder sb = new StringBuilder ("MRecurring[")
.append(get_ID()).append("-").append(getName());
if (getRecurringType().equals(MRecurring.RECURRINGTYPE_Order))
sb.append(",C_Order_ID=").append(getC_Order_ID());

View File

@ -179,7 +179,7 @@ public class MResource extends X_S_Resource
@Override
public String toString()
{
StringBuffer sb = new StringBuffer ("MResource[")
StringBuilder sb = new StringBuilder ("MResource[")
.append(get_ID())
.append(", Value=").append(getValue())
.append(", Name=").append(getName())

View File

@ -2395,8 +2395,8 @@ public final class MRole extends X_AD_Role
{
loadRecordAccess(false);
//
StringBuffer sbInclude = new StringBuffer();
StringBuffer sbExclude = new StringBuffer();
StringBuilder sbInclude = new StringBuilder();
StringBuilder sbExclude = new StringBuilder();
// Role Access
for (int i = 0; i < m_recordAccess.length; i++)
{
@ -2559,7 +2559,7 @@ public final class MRole extends X_AD_Role
final ArrayList<String> validOptions = new ArrayList<String>();
final List<Object> optionParams = new ArrayList<Object>();
//
final StringBuffer sql_values = new StringBuffer();
final StringBuilder sql_values = new StringBuilder();
for (int i = 0; i < maxIndex; i++) {
if (sql_values.length() > 0)
sql_values.append(",");

View File

@ -56,7 +56,7 @@ public class MRoleIncluded extends X_AD_Role_Included
List<Integer> trace = new ArrayList<Integer>();
if (hasLoop(Table_Name, COLUMNNAME_Included_Role_ID, COLUMNNAME_AD_Role_ID, getIncluded_Role_ID(), trace, get_TrxName()))
{
StringBuffer roles = new StringBuffer();
StringBuilder roles = new StringBuilder();
for (int role_id : trace)
{
MRole role = MRole.get(getCtx(), role_id);

View File

@ -1292,7 +1292,7 @@ public class MSequence extends X_AD_Sequence
String website, String prm_USER, String prm_PASSWORD,
String prm_TABLE, String prm_ALTKEY, String prm_COMMENT,
String prm_PROJECT) {
StringBuffer read = new StringBuffer();
StringBuilder read = new StringBuilder();
int retValue = -1;
try {
String completeUrl = website + "?" + "USER="

View File

@ -221,7 +221,7 @@ public class MSession extends X_AD_Session
*/
public String toString()
{
StringBuffer sb = new StringBuffer("MSession[")
StringBuilder sb = new StringBuilder("MSession[")
.append(getAD_Session_ID())
.append(",AD_User_ID=").append(getCreatedBy())
.append(",").append(getCreated())

View File

@ -427,7 +427,7 @@ public final class MSetup
// Standard variables
m_info = new StringBuffer();
String name = null;
StringBuffer sqlCmd = null;
StringBuilder sqlCmd = null;
int no = 0;
/**
@ -595,7 +595,7 @@ public final class MSetup
if (IsMandatory != null)
{
sqlCmd = new StringBuffer ("INSERT INTO C_AcctSchema_Element(");
sqlCmd = new StringBuilder ("INSERT INTO C_AcctSchema_Element(");
sqlCmd.append(m_stdColumns).append(",C_AcctSchema_Element_ID,C_AcctSchema_ID,")
.append("ElementType,Name,SeqNo,IsMandatory,IsBalanced,C_AcctSchema_Element_UU) VALUES (");
sqlCmd.append(m_stdValues).append(",").append(C_AcctSchema_Element_ID).append(",").append(m_as.getC_AcctSchema_ID()).append(",")
@ -608,7 +608,7 @@ public final class MSetup
/** Default value for mandatory elements: OO and AC */
if (ElementType.equals("OO"))
{
sqlCmd = new StringBuffer ("UPDATE C_AcctSchema_Element SET Org_ID=");
sqlCmd = new StringBuilder ("UPDATE C_AcctSchema_Element SET Org_ID=");
sqlCmd.append(getAD_Org_ID()).append(" WHERE C_AcctSchema_Element_ID=").append(C_AcctSchema_Element_ID);
no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName());
if (no != 1)
@ -616,7 +616,7 @@ public final class MSetup
}
if (ElementType.equals("AC"))
{
sqlCmd = new StringBuffer ("UPDATE C_AcctSchema_Element SET C_ElementValue_ID=");
sqlCmd = new StringBuilder ("UPDATE C_AcctSchema_Element SET C_ElementValue_ID=");
sqlCmd.append(C_ElementValue_ID).append(", C_Element_ID=").append(C_Element_ID);
sqlCmd.append(" WHERE C_AcctSchema_Element_ID=").append(C_AcctSchema_Element_ID);
no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName());
@ -798,7 +798,7 @@ public final class MSetup
createPreference("C_DocTypeTarget_ID", String.valueOf(DT), 143);
// Update ClientInfo
sqlCmd = new StringBuffer ("UPDATE AD_ClientInfo SET ");
sqlCmd = new StringBuilder ("UPDATE AD_ClientInfo SET ");
sqlCmd.append("C_AcctSchema1_ID=").append(m_as.getC_AcctSchema_ID())
.append(", C_Calendar_ID=").append(m_calendar.getC_Calendar_ID())
.append(" WHERE AD_Client_ID=").append(m_client.getAD_Client_ID());
@ -1012,12 +1012,12 @@ public final class MSetup
//
String defaultName = Msg.translate(m_lang, "Standard");
String defaultEntry = "'" + defaultName + "',";
StringBuffer sqlCmd = null;
StringBuilder sqlCmd = null;
int no = 0;
// Create Marketing Channel/Campaign
int C_Channel_ID = getNextID(getAD_Client_ID(), "C_Channel");
sqlCmd = new StringBuffer("INSERT INTO C_Channel ");
sqlCmd = new StringBuilder("INSERT INTO C_Channel ");
sqlCmd.append("(C_Channel_ID,Name,");
sqlCmd.append(m_stdColumns).append(",C_Channel_UU) VALUES (");
sqlCmd.append(C_Channel_ID).append(",").append(defaultEntry);
@ -1027,7 +1027,7 @@ public final class MSetup
log.log(Level.SEVERE, "Channel NOT inserted");
int C_Campaign_ID = getNextID(getAD_Client_ID(), "C_Campaign");
sqlCmd = new StringBuffer("INSERT INTO C_Campaign ");
sqlCmd = new StringBuilder("INSERT INTO C_Campaign ");
sqlCmd.append("(C_Campaign_ID,C_Channel_ID,").append(m_stdColumns).append(",");
sqlCmd.append(" Value,Name,Costs,C_Campaign_UU) VALUES (");
sqlCmd.append(C_Campaign_ID).append(",").append(C_Channel_ID).append(",").append(m_stdValues).append(",");
@ -1040,7 +1040,7 @@ public final class MSetup
if (m_hasMCampaign)
{
// Default
sqlCmd = new StringBuffer ("UPDATE C_AcctSchema_Element SET ");
sqlCmd = new StringBuilder ("UPDATE C_AcctSchema_Element SET ");
sqlCmd.append("C_Campaign_ID=").append(C_Campaign_ID);
sqlCmd.append(" WHERE C_AcctSchema_ID=").append(m_as.getC_AcctSchema_ID());
sqlCmd.append(" AND ElementType='MC'");
@ -1049,7 +1049,7 @@ public final class MSetup
log.log(Level.SEVERE, "AcctSchema Element Campaign NOT updated");
}
// Campaign Translation
sqlCmd = new StringBuffer ("INSERT INTO C_Campaign_Trl (AD_Language,C_Campaign_ID, Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,C_Campaign_Trl_UU)");
sqlCmd = new StringBuilder ("INSERT INTO C_Campaign_Trl (AD_Language,C_Campaign_ID, Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,C_Campaign_Trl_UU)");
sqlCmd.append(" SELECT l.AD_Language,t.C_Campaign_ID, t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy, generate_uuid() FROM AD_Language l, C_Campaign t");
sqlCmd.append(" WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.C_Campaign_ID=").append(C_Campaign_ID);
sqlCmd.append(" AND NOT EXISTS (SELECT * FROM C_Campaign_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.C_Campaign_ID=t.C_Campaign_ID)");
@ -1059,7 +1059,7 @@ public final class MSetup
// Create Sales Region
int C_SalesRegion_ID = getNextID(getAD_Client_ID(), "C_SalesRegion");
sqlCmd = new StringBuffer ("INSERT INTO C_SalesRegion ");
sqlCmd = new StringBuilder ("INSERT INTO C_SalesRegion ");
sqlCmd.append("(C_SalesRegion_ID,").append(m_stdColumns).append(",");
sqlCmd.append(" Value,Name,IsSummary,C_SalesRegion_UU) VALUES (");
sqlCmd.append(C_SalesRegion_ID).append(",").append(m_stdValues).append(", ");
@ -1072,7 +1072,7 @@ public final class MSetup
if (m_hasSRegion)
{
// Default
sqlCmd = new StringBuffer ("UPDATE C_AcctSchema_Element SET ");
sqlCmd = new StringBuilder ("UPDATE C_AcctSchema_Element SET ");
sqlCmd.append("C_SalesRegion_ID=").append(C_SalesRegion_ID);
sqlCmd.append(" WHERE C_AcctSchema_ID=").append(m_as.getC_AcctSchema_ID());
sqlCmd.append(" AND ElementType='SR'");
@ -1081,7 +1081,7 @@ public final class MSetup
log.log(Level.SEVERE, "AcctSchema Element SalesRegion NOT updated");
}
// Sales Region Translation
sqlCmd = new StringBuffer ("INSERT INTO C_SalesRegion_Trl (AD_Language,C_SalesRegion_ID, Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,C_SalesRegion_Trl_UU)");
sqlCmd = new StringBuilder ("INSERT INTO C_SalesRegion_Trl (AD_Language,C_SalesRegion_ID, Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,C_SalesRegion_Trl_UU)");
sqlCmd.append(" SELECT l.AD_Language,t.C_SalesRegion_ID, t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy, generate_uuid() FROM AD_Language l, C_SalesRegion t");
sqlCmd.append(" WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.C_SalesRegion_ID=").append(C_SalesRegion_ID);
sqlCmd.append(" AND NOT EXISTS (SELECT * FROM C_SalesRegion_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.C_SalesRegion_ID=t.C_SalesRegion_ID)");
@ -1091,7 +1091,7 @@ public final class MSetup
// Create Activity
int C_Activity_ID = getNextID(getAD_Client_ID(), "C_Activity");
sqlCmd = new StringBuffer ("INSERT INTO C_Activity ");
sqlCmd = new StringBuilder ("INSERT INTO C_Activity ");
sqlCmd.append("(C_Activity_ID,").append(m_stdColumns).append(",");
sqlCmd.append(" Value,Name,IsSummary,C_Activity_UU) VALUES (");
sqlCmd.append(C_Activity_ID).append(",").append(m_stdValues).append(", ");
@ -1104,7 +1104,7 @@ public final class MSetup
if (m_hasActivity)
{
// Default
sqlCmd = new StringBuffer ("UPDATE C_AcctSchema_Element SET ");
sqlCmd = new StringBuilder ("UPDATE C_AcctSchema_Element SET ");
sqlCmd.append("C_Activity_ID=").append(C_Activity_ID);
sqlCmd.append(" WHERE C_AcctSchema_ID=").append(m_as.getC_AcctSchema_ID());
sqlCmd.append(" AND ElementType='AY'");
@ -1113,7 +1113,7 @@ public final class MSetup
log.log(Level.SEVERE, "AcctSchema Element Activity NOT updated");
}
// Activity Translation
sqlCmd = new StringBuffer ("INSERT INTO C_Activity_Trl (AD_Language,C_Activity_ID, Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,C_Activity_Trl_UU)");
sqlCmd = new StringBuilder ("INSERT INTO C_Activity_Trl (AD_Language,C_Activity_ID, Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,C_Activity_Trl_UU)");
sqlCmd.append(" SELECT l.AD_Language,t.C_Activity_ID, t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy, generate_uuid() FROM AD_Language l, C_Activity t");
sqlCmd.append(" WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.C_Activity_ID=").append(C_Activity_ID);
sqlCmd.append(" AND NOT EXISTS (SELECT * FROM C_Activity_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.C_Activity_ID=t.C_Activity_ID)");
@ -1151,7 +1151,7 @@ public final class MSetup
if (!bpl.save())
log.log(Level.SEVERE, "BP_Location (Standard) NOT inserted");
// Default
sqlCmd = new StringBuffer ("UPDATE C_AcctSchema_Element SET ");
sqlCmd = new StringBuilder ("UPDATE C_AcctSchema_Element SET ");
sqlCmd.append("C_BPartner_ID=").append(bp.getC_BPartner_ID());
sqlCmd.append(" WHERE C_AcctSchema_ID=").append(m_as.getC_AcctSchema_ID());
sqlCmd.append(" AND ElementType='BP'");
@ -1178,7 +1178,7 @@ public final class MSetup
// TaxCategory
int C_TaxCategory_ID = getNextID(getAD_Client_ID(), "C_TaxCategory");
sqlCmd = new StringBuffer ("INSERT INTO C_TaxCategory ");
sqlCmd = new StringBuilder ("INSERT INTO C_TaxCategory ");
sqlCmd.append("(C_TaxCategory_ID,").append(m_stdColumns).append(",");
sqlCmd.append(" Name,IsDefault,C_TaxCategory_UU) VALUES (");
sqlCmd.append(C_TaxCategory_ID).append(",").append(m_stdValues).append(", ");
@ -1192,7 +1192,7 @@ public final class MSetup
log.log(Level.SEVERE, "TaxCategory NOT inserted");
// TaxCategory translation
sqlCmd = new StringBuffer ("INSERT INTO C_TaxCategory_Trl (AD_Language,C_TaxCategory_ID, Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,C_TaxCategory_Trl_UU)");
sqlCmd = new StringBuilder ("INSERT INTO C_TaxCategory_Trl (AD_Language,C_TaxCategory_ID, Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,C_TaxCategory_Trl_UU)");
sqlCmd.append(" SELECT l.AD_Language,t.C_TaxCategory_ID, t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy, generate_uuid() FROM AD_Language l, C_TaxCategory t");
sqlCmd.append(" WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.C_TaxCategory_ID=").append(C_TaxCategory_ID);
sqlCmd.append(" AND NOT EXISTS (SELECT * FROM C_TaxCategory_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.C_TaxCategory_ID=t.C_TaxCategory_ID)");
@ -1221,7 +1221,7 @@ public final class MSetup
else
log.log(Level.SEVERE, "Product NOT inserted");
// Default
sqlCmd = new StringBuffer ("UPDATE C_AcctSchema_Element SET ");
sqlCmd = new StringBuilder ("UPDATE C_AcctSchema_Element SET ");
sqlCmd.append("M_Product_ID=").append(product.getM_Product_ID());
sqlCmd.append(" WHERE C_AcctSchema_ID=").append(m_as.getC_AcctSchema_ID());
sqlCmd.append(" AND ElementType='PR'");
@ -1237,7 +1237,7 @@ public final class MSetup
loc.setAddress1(address1);
loc.setPostal(postal);
loc.saveEx();
sqlCmd = new StringBuffer ("UPDATE AD_OrgInfo SET C_Location_ID=");
sqlCmd = new StringBuilder ("UPDATE AD_OrgInfo SET C_Location_ID=");
sqlCmd.append(loc.getC_Location_ID()).append(" WHERE AD_Org_ID=").append(getAD_Org_ID());
no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName());
if (no != 1)
@ -1263,7 +1263,7 @@ public final class MSetup
log.log(Level.SEVERE, "Locator NOT inserted");
// Update ClientInfo
sqlCmd = new StringBuffer ("UPDATE AD_ClientInfo SET ");
sqlCmd = new StringBuilder ("UPDATE AD_ClientInfo SET ");
sqlCmd.append("C_BPartnerCashTrx_ID=").append(bp.getC_BPartner_ID());
sqlCmd.append(",M_ProductFreight_ID=").append(product.getM_Product_ID());
// sqlCmd.append("C_UOM_Volume_ID=");
@ -1328,7 +1328,7 @@ public final class MSetup
if (!bplCU.save())
log.log(Level.SEVERE, "BP_Location (User) NOT inserted");
// Update User
sqlCmd = new StringBuffer ("UPDATE AD_User SET C_BPartner_ID=");
sqlCmd = new StringBuilder ("UPDATE AD_User SET C_BPartner_ID=");
sqlCmd.append(bpCU.getC_BPartner_ID()).append(" WHERE AD_User_ID=").append(AD_User_U_ID);
no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName());
if (no != 1)
@ -1354,7 +1354,7 @@ public final class MSetup
if (!bplCA.save())
log.log(Level.SEVERE, "BP_Location (Admin) NOT inserted");
// Update User
sqlCmd = new StringBuffer ("UPDATE AD_User SET C_BPartner_ID=");
sqlCmd = new StringBuilder ("UPDATE AD_User SET C_BPartner_ID=");
sqlCmd.append(bpCA.getC_BPartner_ID()).append(" WHERE AD_User_ID=").append(AD_User_ID);
no = DB.executeUpdateEx(sqlCmd.toString(), m_trx.getTrxName());
if (no != 1)
@ -1363,7 +1363,7 @@ public final class MSetup
// Payment Term
int C_PaymentTerm_ID = getNextID(getAD_Client_ID(), "C_PaymentTerm");
sqlCmd = new StringBuffer ("INSERT INTO C_PaymentTerm ");
sqlCmd = new StringBuilder ("INSERT INTO C_PaymentTerm ");
sqlCmd.append("(C_PaymentTerm_ID,").append(m_stdColumns).append(",");
sqlCmd.append("Value,Name,NetDays,GraceDays,DiscountDays,Discount,DiscountDays2,Discount2,IsDefault,C_PaymentTerm_UU) VALUES (");
sqlCmd.append(C_PaymentTerm_ID).append(",").append(m_stdValues).append(",");
@ -1372,7 +1372,7 @@ public final class MSetup
if (no != 1)
log.log(Level.SEVERE, "PaymentTerm NOT inserted");
// Payment Term Translation
sqlCmd = new StringBuffer ("INSERT INTO C_PaymentTerm_Trl (AD_Language,C_PaymentTerm_ID, Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,C_PaymentTerm_Trl_UU)");
sqlCmd = new StringBuilder ("INSERT INTO C_PaymentTerm_Trl (AD_Language,C_PaymentTerm_ID, Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,C_PaymentTerm_Trl_UU)");
sqlCmd.append(" SELECT l.AD_Language,t.C_PaymentTerm_ID, t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy, generate_uuid() FROM AD_Language l, C_PaymentTerm t");
sqlCmd.append(" WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.C_PaymentTerm_ID=").append(C_PaymentTerm_ID);
sqlCmd.append(" AND NOT EXISTS (SELECT * FROM C_PaymentTerm_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.C_PaymentTerm_ID=t.C_PaymentTerm_ID)");
@ -1382,7 +1382,7 @@ public final class MSetup
// Project Cycle
C_Cycle_ID = getNextID(getAD_Client_ID(), "C_Cycle");
sqlCmd = new StringBuffer ("INSERT INTO C_Cycle ");
sqlCmd = new StringBuilder ("INSERT INTO C_Cycle ");
sqlCmd.append("(C_Cycle_ID,").append(m_stdColumns).append(",");
sqlCmd.append(" Name,C_Currency_ID,C_Cycle_UU) VALUES (");
sqlCmd.append(C_Cycle_ID).append(",").append(m_stdValues).append(", ");
@ -1397,7 +1397,7 @@ public final class MSetup
// Create Default Project
int C_Project_ID = getNextID(getAD_Client_ID(), "C_Project");
sqlCmd = new StringBuffer ("INSERT INTO C_Project ");
sqlCmd = new StringBuilder ("INSERT INTO C_Project ");
sqlCmd.append("(C_Project_ID,").append(m_stdColumns).append(",");
sqlCmd.append(" Value,Name,C_Currency_ID,IsSummary,C_Project_UU) VALUES (");
sqlCmd.append(C_Project_ID).append(",").append(m_stdValuesOrg).append(", ");
@ -1410,7 +1410,7 @@ public final class MSetup
// Default Project
if (m_hasProject)
{
sqlCmd = new StringBuffer ("UPDATE C_AcctSchema_Element SET ");
sqlCmd = new StringBuilder ("UPDATE C_AcctSchema_Element SET ");
sqlCmd.append("C_Project_ID=").append(C_Project_ID);
sqlCmd.append(" WHERE C_AcctSchema_ID=").append(m_as.getC_AcctSchema_ID());
sqlCmd.append(" AND ElementType='PJ'");

View File

@ -1017,7 +1017,7 @@ public class MStorageOnHand extends X_M_StorageOnHand
*/
public String toString()
{
StringBuffer sb = new StringBuffer("MStorageOnHand[")
StringBuilder sb = new StringBuilder("MStorageOnHand[")
.append("M_Locator_ID=").append(getM_Locator_ID())
.append(",M_Product_ID=").append(getM_Product_ID())
.append(",M_AttributeSetInstance_ID=").append(getM_AttributeSetInstance_ID())

View File

@ -328,7 +328,7 @@ public class MStorageReservation extends X_M_StorageReservation {
*/
public String toString()
{
StringBuffer sb = new StringBuffer("MStorageReservation[")
StringBuilder sb = new StringBuilder("MStorageReservation[")
.append("M_Warehouse_ID=").append(getM_Warehouse_ID())
.append(",M_Product_ID=").append(getM_Product_ID())
.append(",M_AttributeSetInstance_ID=").append(getM_AttributeSetInstance_ID())

View File

@ -229,7 +229,7 @@ public class MTax extends X_C_Tax
public String toString()
{
StringBuffer sb = new StringBuffer("MTax[")
StringBuilder sb = new StringBuilder("MTax[")
.append(get_ID())
.append(", Name = ").append(getName())
.append(", SO/PO=").append(getSOPOType())

View File

@ -162,7 +162,7 @@ public class MToolBarButtonRestrict extends X_AD_ToolBarButtonRestrict
*/
public String toString()
{
StringBuffer sb = new StringBuffer ("MToolBarButtonRestrict[")
StringBuilder sb = new StringBuilder ("MToolBarButtonRestrict[")
.append(get_ID()).append(",AD_ToolBarButtonRestrict_ID=").append(getAD_ToolBarButtonRestrict_ID())
.append("]");
return sb.toString();

View File

@ -237,10 +237,10 @@ public class MTree extends MTree_Base
private void loadNodes (int AD_User_ID, String linkColName, int linkID)
{
// SQL for TreeNodes
StringBuffer sql = new StringBuffer();
StringBuilder sql = new StringBuilder();
if (getTreeType().equals(TREETYPE_Menu)) // specific sql, need to load TreeBar IDEMPIERE 329 - nmicoud
{
sql = new StringBuffer("SELECT "
sql = new StringBuilder("SELECT "
+ "tn.Node_ID,tn.Parent_ID,tn.SeqNo,tb.IsActive "
+ "FROM ").append(getNodeTableName()).append(" tn"
+ " LEFT OUTER JOIN AD_TreeBar tb ON (tn.AD_Tree_ID=tb.AD_Tree_ID"
@ -260,7 +260,7 @@ public class MTree extends MTree_Base
if (getAD_Table_ID() > 0)
sourceTableName = MTable.getTableName(getCtx(), getAD_Table_ID());
}
sql = new StringBuffer("SELECT "
sql = new StringBuilder("SELECT "
+ "tn.Node_ID,tn.Parent_ID,tn.SeqNo,st.IsActive "
+ "FROM ").append(sourceTableName).append(" st "
+ "LEFT OUTER JOIN ").append(getNodeTableName()).append(" tn ON (tn.Node_ID=st."+sourceTableName+"_ID) "
@ -272,7 +272,7 @@ public class MTree extends MTree_Base
sql.append(" ORDER BY COALESCE(tn.Parent_ID, -1), tn.SeqNo");
//do not check access if allNodes
if (AD_User_ID != -1)
sql = new StringBuffer(MRole.getDefault().addAccessSQL(sql.toString(), "st", MRole.SQL_FULLYQUALIFIED, MRole.SQL_RO)); // SQL_RO for Org_ID = 0
sql = new StringBuilder(MRole.getDefault().addAccessSQL(sql.toString(), "st", MRole.SQL_FULLYQUALIFIED, MRole.SQL_RO)); // SQL_RO for Org_ID = 0
}
if (log.isLoggable(Level.FINEST)) log.finest(sql.toString());
// The Node Loop

View File

@ -531,7 +531,7 @@ public class MUser extends X_AD_User
*/
public String toString ()
{
StringBuffer sb = new StringBuffer ("MUser[")
StringBuilder sb = new StringBuilder ("MUser[")
.append(get_ID())
.append(",Name=").append(getName())
.append(",EMailUserID=").append(getEMailUser())
@ -989,7 +989,7 @@ public class MUser extends X_AD_User
MUser retValue = null;
int AD_Client_ID = Env.getAD_Client_ID(ctx);
StringBuffer sql = new StringBuffer("SELECT DISTINCT u.AD_User_ID ")
StringBuilder sql = new StringBuilder("SELECT DISTINCT u.AD_User_ID ")
.append("FROM AD_User u")
.append(" INNER JOIN AD_User_Roles ur ON (u.AD_User_ID=ur.AD_User_ID AND ur.IsActive='Y')")
.append(" INNER JOIN AD_Role r ON (ur.AD_Role_ID=r.AD_Role_ID AND r.IsActive='Y') ");

View File

@ -167,7 +167,7 @@ public class MViewComponent extends X_AD_ViewComponent {
@Override
public String toString()
{
StringBuffer sb = new StringBuffer("MViewComponent[")
StringBuilder sb = new StringBuilder("MViewComponent[")
.append(get_ID())
.append("-").append(getName());
sb.append("]");

View File

@ -100,7 +100,7 @@ public class PO_LOB implements Serializable
|| (m_value instanceof byte[] && ((byte[])m_value).length == 0)
)
{
StringBuffer sql = new StringBuffer ("UPDATE ")
StringBuilder sql = new StringBuilder ("UPDATE ")
.append(m_tableName)
.append(" SET ").append(m_columnName)
.append("=null WHERE ").append(m_whereClause);
@ -111,12 +111,12 @@ public class PO_LOB implements Serializable
return true;
}
StringBuffer sql = new StringBuffer ("UPDATE ")
StringBuilder sql = new StringBuilder ("UPDATE ")
.append(m_tableName)
.append(" SET ").append(m_columnName)
.append("=? WHERE ").append(m_whereClause);
if (!DB.isPostgreSQL() && !DB.isOracle())
sql = new StringBuffer(DB.getDatabase().convertStatement(sql.toString()));
sql = new StringBuilder(DB.getDatabase().convertStatement(sql.toString()));
//
if (log.isLoggable(Level.FINE)) log.fine("[" + trxName + "] - Local - " + m_value);

View File

@ -110,7 +110,7 @@ public class PO_Record
}
else
{
StringBuffer sql = new StringBuffer ("DELETE FROM ")
StringBuilder sql = new StringBuilder ("DELETE FROM ")
.append(s_cascadeNames[i])
.append(" WHERE AD_Table_ID=? AND Record_ID=?");
int no = DB.executeUpdate(sql.toString(), params, false, trxName);
@ -134,7 +134,7 @@ public class PO_Record
Object[] params = new Object[]{Integer.valueOf(AD_Table_IDchild), Integer.valueOf(Record_ID)};
for (int i = 0; i < s_cascades.length; i++)
{
StringBuffer sql = new StringBuffer ("DELETE FROM ")
StringBuilder sql = new StringBuilder ("DELETE FROM ")
.append(s_cascadeNames[i])
.append(" WHERE AD_Table_ID=? AND Record_ID IN (SELECT ")
.append(s_parentChildNames[j]).append("_ID FROM ")
@ -204,7 +204,7 @@ public class PO_Record
for (int i = 0; i < s_restricts.length; i++)
{
// SELECT COUNT(*) FROM table WHERE AD_Table_ID=#1 AND Record_ID=#2
StringBuffer sql = new StringBuffer ("SELECT COUNT(*) FROM ")
StringBuilder sql = new StringBuilder ("SELECT COUNT(*) FROM ")
.append(s_restrictNames[i])
.append(" WHERE AD_Table_ID=? AND Record_ID=?");
int no = DB.getSQLValue(trxName, sql.toString(), AD_Table_ID, Record_ID);
@ -263,7 +263,7 @@ public class PO_Record
{
for (int i = 0; i < s_cascades.length; i++)
{
StringBuffer sql = new StringBuffer ("DELETE FROM ")
StringBuilder sql = new StringBuilder ("DELETE FROM ")
.append(s_cascadeNames[i])
.append(" WHERE AD_Table_ID=").append(AD_Table_ID)
.append(" AND Record_ID NOT IN (SELECT ")

View File

@ -162,7 +162,7 @@ public class SalesMgmtValidator implements ModelValidator
*/
public String toString ()
{
StringBuffer sb = new StringBuffer ("SalesMgmtValidator");
StringBuilder sb = new StringBuilder ("SalesMgmtValidator");
return sb.toString ();
} // toString

View File

@ -171,9 +171,9 @@ public class TranslationTable
if (po.get_ID() == 0)
throw new IllegalArgumentException("PO ID is 0");
//
StringBuffer sql1 = new StringBuffer();
StringBuilder sql1 = new StringBuilder();
sql1.append("INSERT INTO ").append(m_trlTableName).append(" (");
StringBuffer sql2 = new StringBuffer();
StringBuilder sql2 = new StringBuilder();
sql2.append(") SELECT ");
// Key Columns

View File

@ -345,7 +345,7 @@ public class MPrintFormat extends X_AD_PrintFormat
*/
public void setTranslation()
{
StringBuffer sb = new StringBuffer ("UPDATE AD_PrintFormatItem_Trl t"
StringBuilder sb = new StringBuilder ("UPDATE AD_PrintFormatItem_Trl t"
+ " SET (PrintName, PrintNameSuffix)="
+ " (SELECT PrintName, PrintNameSuffix FROM AD_PrintFormatItem i WHERE i.AD_PrintFormatItem_ID=t.AD_PrintFormatItem_ID) "
+ "WHERE AD_PrintFormatItem_ID IN"
@ -453,7 +453,7 @@ public class MPrintFormat extends X_AD_PrintFormat
*/
public String toString()
{
StringBuffer sb = new StringBuffer ("MPrintFormat[ID=").append(get_ID())
StringBuilder sb = new StringBuilder ("MPrintFormat[ID=").append(get_ID())
.append(",Name=").append(getName())
.append(",Language=").append(getLanguage())
.append(",Items=").append(getItemCount())
@ -989,7 +989,7 @@ public class MPrintFormat extends X_AD_PrintFormat
int fromID = fromItems[i].getAD_PrintFormatItem_ID();
int toID = toItems[i].getAD_PrintFormatItem_ID();
StringBuffer sql = new StringBuffer("UPDATE AD_PrintFormatItem_Trl new ")
StringBuilder sql = new StringBuilder("UPDATE AD_PrintFormatItem_Trl new ")
// Set
.append("SET (PrintName, PrintNameSuffix, IsTranslated) = ")
.append("(")

View File

@ -408,7 +408,7 @@ public class PrintDataElement implements Serializable
*/
public String toString()
{
StringBuffer sb = new StringBuffer(m_columnName).append("=").append(m_value);
StringBuilder sb = new StringBuilder(m_columnName).append("=").append(m_value);
if (m_isPKey)
sb.append("(PK)");
return sb.toString();

View File

@ -174,7 +174,7 @@ public class PrintDataFunction
*/
public String toString()
{
StringBuffer sb = new StringBuffer("[")
StringBuilder sb = new StringBuilder("[")
.append("Count=").append(m_count).append(",").append(m_totalCount)
.append(",Sum=").append(m_sum)
.append(",SumSquare=").append(m_sumSquare)

View File

@ -1125,7 +1125,7 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
return;
//
boolean needMask = false;
StringBuffer buff = new StringBuffer();
StringBuilder buff = new StringBuilder();
char chars[] = content.toCharArray();
for (int i = 0; i < chars.length; i++)
{

View File

@ -139,7 +139,7 @@ public class StringElement extends PrintElement
int startIndex = 0;
int endOffset = 0;
StringBuffer text = new StringBuffer();
StringBuilder text = new StringBuilder();
if (label != null && label.length() > 0)
{
text.append(label).append(" ");

View File

@ -60,7 +60,7 @@ public class BankRegister extends SvrProcess
*/
protected void prepare()
{
StringBuffer sb = new StringBuffer ("Record_ID=")
StringBuilder sb = new StringBuilder ("Record_ID=")
.append(getRecord_ID());
// Parameter
ProcessInfoParameter[] para = getParameter();
@ -147,7 +147,7 @@ public class BankRegister extends SvrProcess
*/
private void createBalanceLine()
{
StringBuffer sb = new StringBuffer ("INSERT INTO T_BankRegister "
StringBuilder sb = new StringBuilder ("INSERT INTO T_BankRegister "
+ "(AD_PInstance_ID, AD_Client_ID, AD_Org_ID, "
+ "DateAcct, C_Bank_ID, BankName, C_BPartner_ID, BPartner, DocumentNo," // Account,
+ "AmtAcctDr, AmtAcctCr, Balance) ");
@ -184,7 +184,7 @@ public class BankRegister extends SvrProcess
*/
private void createDetailLines()
{
StringBuffer sb = new StringBuffer ("INSERT INTO T_BankRegister "
StringBuilder sb = new StringBuilder ("INSERT INTO T_BankRegister "
+ "(AD_PInstance_ID, AD_Client_ID, AD_Org_ID, "
+ "DateAcct, C_Bank_ID, BankName, C_BPartner_ID, BPartner, DocumentNo, " //Account,
+ "AmtAcctDr, AmtAcctCr, Balance) ");

View File

@ -106,7 +106,7 @@ public class FinReport extends SvrProcess
*/
protected void prepare()
{
StringBuffer sb = new StringBuffer ("Record_ID=")
StringBuilder sb = new StringBuilder ("Record_ID=")
.append(getRecord_ID());
// Parameter
ProcessInfoParameter[] para = getParameter();
@ -311,7 +311,7 @@ public class FinReport extends SvrProcess
// ** Create Temporary and empty Report Lines from PA_ReportLine
// - AD_PInstance_ID, PA_ReportLine_ID, 0, 0
int PA_ReportLineSet_ID = m_report.getLineSet().getPA_ReportLineSet_ID();
StringBuffer sql = new StringBuffer ("INSERT INTO T_Report "
StringBuilder sql = new StringBuilder ("INSERT INTO T_Report "
+ "(AD_PInstance_ID, PA_ReportLine_ID, Record_ID,Fact_Acct_ID, SeqNo,LevelNo, Name,Description) "
+ "SELECT ").append(getAD_PInstance_ID()).append(", rl.PA_ReportLine_ID, 0,0, rl.SeqNo,0, NVL(trl.Name, rl.Name) as Name, NVL(trl.Description,rl.Description) as Description "
+ "FROM PA_ReportLine rl "
@ -376,7 +376,7 @@ public class FinReport extends SvrProcess
return;
}
StringBuffer update = new StringBuffer();
StringBuilder update = new StringBuilder();
// for all columns
for (int col = 0; col < m_columns.length; col++)
{
@ -387,7 +387,7 @@ public class FinReport extends SvrProcess
info.append("Line=").append(line).append(",Col=").append(col);
// SELECT SUM()
StringBuffer select = new StringBuffer ("SELECT ");
StringBuilder select = new StringBuilder ("SELECT ");
if (m_lines[line].getPAAmountType() != null) // line amount type overwrites column
{
String sql = m_lines[line].getSelectClause (true);
@ -944,7 +944,7 @@ public class FinReport extends SvrProcess
// allow opposite sign
boolean hasOpposites = false;
StringBuffer sb = new StringBuffer("UPDATE T_Report SET ");
StringBuilder sb = new StringBuilder("UPDATE T_Report SET ");
for (int col = 0; col < m_columns.length; col++)
{
if (m_columns[col].isAllowOppositeSign())
@ -1073,7 +1073,7 @@ public class FinReport extends SvrProcess
for (int i = 0; i < seqlist.size(); i++)
{
int currentSeq = seqlist.get(i);
StringBuffer sb = new StringBuffer ("UPDATE T_Report SET ");
StringBuilder sb = new StringBuilder ("UPDATE T_Report SET ");
// Column to set
sb.append ("Col_").append (col).append("=");
@ -1333,7 +1333,7 @@ public class FinReport extends SvrProcess
if (log.isLoggable(Level.FINE)) log.fine("Variable=" + variable);
// Insert
StringBuffer insert = new StringBuffer("INSERT INTO T_Report "
StringBuilder insert = new StringBuilder("INSERT INTO T_Report "
+ "(AD_PInstance_ID, PA_ReportLine_ID, Record_ID,Fact_Acct_ID,LevelNo ");
for (int col = 0; col < m_columns.length; col++)
insert.append(",Col_").append(col);
@ -1345,7 +1345,7 @@ public class FinReport extends SvrProcess
boolean listSourceNoTrx = m_report.isListSourcesXTrx() && variable.equalsIgnoreCase(I_C_ValidCombination.COLUMNNAME_Account_ID);
//SQL to get the Account Element which no transaction
StringBuffer unionInsert = listSourceNoTrx ? new StringBuffer() : null;
StringBuilder unionInsert = listSourceNoTrx ? new StringBuilder() : null;
if (listSourceNoTrx) {
unionInsert.append(" UNION SELECT ")
.append(getAD_PInstance_ID()).append(",")
@ -1378,7 +1378,7 @@ public class FinReport extends SvrProcess
}
// SELECT SUM()
StringBuffer select = new StringBuffer ("SELECT ");
StringBuilder select = new StringBuilder ("SELECT ");
if (m_lines[line].getPAAmountType() != null) // line amount type overwrites column
select.append (m_lines[line].getSelectClause (true));
else if (m_columns[col].getPAAmountType() != null)
@ -1450,9 +1450,9 @@ public class FinReport extends SvrProcess
insert.append("(").append(select).append(")");
}
// WHERE (sources, posting type)
StringBuffer where = new StringBuffer(m_lines[line].getWhereClause(p_PA_Hierarchy_ID));
StringBuilder where = new StringBuilder(m_lines[line].getWhereClause(p_PA_Hierarchy_ID));
StringBuffer unionWhere = listSourceNoTrx ? new StringBuffer() : null;
StringBuilder unionWhere = listSourceNoTrx ? new StringBuilder() : null;
if (listSourceNoTrx && m_lines[line].getSources() != null && m_lines[line].getSources().length > 0){
// Only one
if (m_lines[line].getSources().length == 1
@ -1463,7 +1463,7 @@ public class FinReport extends SvrProcess
else
{
// Multiple
StringBuffer sb = new StringBuffer ("(");
StringBuilder sb = new StringBuilder ("(");
for (int i = 0; i < m_lines[line].getSources().length; i++)
{
if ((m_lines[line].getSources()[i]).getElementType().equalsIgnoreCase(MReportSource.ELEMENTTYPE_Account)) {
@ -1530,7 +1530,7 @@ public class FinReport extends SvrProcess
return;
// Set Name,Description
StringBuffer sql = new StringBuffer ("UPDATE T_Report SET (Name,Description)=(")
StringBuilder sql = new StringBuilder ("UPDATE T_Report SET (Name,Description)=(")
.append(m_lines[line].getSourceValueQuery()).append("T_Report.Record_ID) "
//
+ "WHERE Record_ID <> 0 AND AD_PInstance_ID=").append(getAD_PInstance_ID())
@ -1554,7 +1554,7 @@ public class FinReport extends SvrProcess
if (log.isLoggable(Level.INFO)) log.info("Line=" + line + " - Variable=" + variable);
// Insert
StringBuffer insert = new StringBuffer("INSERT INTO T_Report "
StringBuilder insert = new StringBuilder("INSERT INTO T_Report "
+ "(AD_PInstance_ID, PA_ReportLine_ID, Record_ID,Fact_Acct_ID,LevelNo ");
for (int col = 0; col < m_columns.length; col++)
insert.append(",Col_").append(col);
@ -1580,7 +1580,7 @@ public class FinReport extends SvrProcess
}
// SELECT
StringBuffer select = new StringBuffer ("SELECT ");
StringBuilder select = new StringBuilder ("SELECT ");
if (m_lines[line].getPAAmountType() != null) // line amount type overwrites column
select.append (m_lines[line].getSelectClause (false));
else if (m_columns[col].getPAAmountType() != null)

View File

@ -103,7 +103,7 @@ public class FinStatement extends SvrProcess
*/
protected void prepare()
{
StringBuffer sb = new StringBuffer ("Record_ID=")
StringBuilder sb = new StringBuilder ("Record_ID=")
.append(getRecord_ID());
// Parameter
ProcessInfoParameter[] para = getParameter();
@ -325,7 +325,7 @@ public class FinStatement extends SvrProcess
*/
private void createDetailLines()
{
StringBuffer sb = new StringBuffer ("INSERT INTO T_ReportStatement "
StringBuilder sb = new StringBuilder ("INSERT INTO T_ReportStatement "
+ "(AD_PInstance_ID, Fact_Acct_ID, LevelNo,"
+ "DateAcct, Name, Description,"
+ "AmtAcctDr, AmtAcctCr, Balance, Qty) ");
@ -359,7 +359,7 @@ public class FinStatement extends SvrProcess
+ "WHERE r.Fact_Acct_ID=fa.Fact_Acct_ID";
}
// Translated Version ...
sb = new StringBuffer ("UPDATE T_ReportStatement r SET (Name,Description)=(")
sb = new StringBuilder ("UPDATE T_ReportStatement r SET (Name,Description)=(")
.append(sql_select).append(") "
+ "WHERE Fact_Acct_ID <> 0 AND AD_PInstance_ID=").append(getAD_PInstance_ID());
//

View File

@ -110,7 +110,7 @@ public class MReport extends X_PA_Report
*/
public String toString ()
{
StringBuffer sb = new StringBuffer ("MReport[")
StringBuilder sb = new StringBuilder ("MReport[")
.append(get_ID()).append(" - ").append(getName());
if (getDescription() != null)
sb.append("(").append(getDescription()).append(")");

View File

@ -343,7 +343,7 @@ public class MReportColumn extends X_PA_ReportColumn
*/
public String toString ()
{
StringBuffer sb = new StringBuffer ("MReportColumn[")
StringBuilder sb = new StringBuilder ("MReportColumn[")
.append(get_ID()).append(" - ").append(getName()).append(" - ").append(getDescription())
.append(", SeqNo=").append(getSeqNo()).append(", AmountType=").append(getPAAmountType())
.append(", PeriodType=").append(getPAPeriodType())

View File

@ -126,7 +126,7 @@ public class MReportColumnSet extends X_PA_ReportColumnSet
*/
public String toString ()
{
StringBuffer sb = new StringBuffer ("MReportColumnSet[")
StringBuilder sb = new StringBuilder ("MReportColumnSet[")
.append(get_ID()).append(" - ").append(getName())
.append ("]");
return sb.toString ();

View File

@ -313,7 +313,7 @@ public class MReportLine extends X_PA_ReportLine
*/
public String toString ()
{
StringBuffer sb = new StringBuffer ("MReportLine[")
StringBuilder sb = new StringBuilder ("MReportLine[")
.append(get_ID()).append(" - ").append(getName()).append(" - ").append(getDescription())
.append(", SeqNo=").append(getSeqNo()).append(", AmountType=").append(getPAAmountType())
.append(", PeriodType=").append(getPAPeriodType())

View File

@ -126,7 +126,7 @@ public class MReportLineSet extends X_PA_ReportLineSet
*/
public String toString ()
{
StringBuffer sb = new StringBuffer ("MReportLineSet[")
StringBuilder sb = new StringBuilder ("MReportLineSet[")
.append(get_ID()).append(" - ").append(getName())
.append ("]");
return sb.toString ();

View File

@ -252,7 +252,7 @@ public class MReportSource extends X_PA_ReportSource
*/
public String toString ()
{
StringBuffer sb = new StringBuffer ("MReportSource[")
StringBuilder sb = new StringBuilder ("MReportSource[")
.append(get_ID()).append(" - ").append(getDescription())
.append(" - ").append(getElementType());
sb.append ("]");

View File

@ -249,11 +249,11 @@ public class MReportTree
MTreeNode node = m_tree.getRoot().findNode(ID);
if (log.isLoggable(Level.FINEST)) log.finest("Root=" + node);
//
StringBuffer result = null;
StringBuilder result = null;
if (node != null && node.isSummary ())
{
Enumeration<TreeNode> en = node.preorderEnumeration ();
StringBuffer sb = new StringBuffer ();
StringBuilder sb = new StringBuilder ();
while (en.hasMoreElements ())
{
MTreeNode nn = (MTreeNode)en.nextElement ();
@ -271,12 +271,12 @@ public class MReportTree
else
if (log.isLoggable(Level.FINEST)) log.finest ("- skipped parent (" + nn + ")");
}
result = new StringBuffer (" ( ");
result = new StringBuilder (" ( ");
result.append (sb);
result.append (" ) ");
}
else // not found or not summary
result = new StringBuffer (ColumnName).append("=").append(ID);
result = new StringBuilder (ColumnName).append("=").append(ID);
//
if (log.isLoggable(Level.FINEST)) log.finest(result.toString());
return result.toString();

View File

@ -107,7 +107,7 @@ public class TrialBalance extends SvrProcess
*/
protected void prepare()
{
StringBuffer sb = new StringBuffer ("AD_PInstance_ID=")
StringBuilder sb = new StringBuilder ("AD_PInstance_ID=")
.append(getAD_PInstance_ID());
// Parameter
ProcessInfoParameter[] para = getParameter();

View File

@ -269,7 +269,7 @@ public class AmtInWords_PT implements AmtInWords
if (amount == null)
return amount;
//
StringBuffer sb = new StringBuffer ();
StringBuilder sb = new StringBuilder ();
int pos = amount.lastIndexOf ('.'); // Old
// int pos = amount.lastIndexOf (',');
int pos2 = amount.lastIndexOf (','); // Old

View File

@ -128,7 +128,7 @@ public class AmtInWords_ZH implements AmtInWords
*/
private String convert (BigDecimal number)
{
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
int signum = number.signum(); // positive , 0 , negative
int numUnit = 0; // each number character
int numIndex = 0; // each number position

View File

@ -157,7 +157,7 @@ public class CLogFormatter extends Formatter
int index = className.lastIndexOf('.');
if (index != -1)
className = className.substring(index+1);
StringBuffer sb = new StringBuffer()
StringBuilder sb = new StringBuilder()
.append("*** ")
.append(new Timestamp(System.currentTimeMillis()))
.append(" idempiere Log (").append(className)

View File

@ -223,7 +223,7 @@ public final class DB
// if (mailPassword == null || mailPassword.length() == 0)
// return;
//
StringBuffer sql = new StringBuffer("UPDATE AD_Client SET")
StringBuilder sql = new StringBuilder("UPDATE AD_Client SET")
.append(" SMTPHost=").append(DB.TO_STRING(server))
.append(", RequestEMail=").append(DB.TO_STRING(adminEMail))
.append(", RequestUser=").append(DB.TO_STRING(mailUser))
@ -232,7 +232,7 @@ public final class DB
int no = DB.executeUpdate(sql.toString(), null);
if (log.isLoggable(Level.FINE)) log.fine("Client #"+no);
//
sql = new StringBuffer("UPDATE AD_User SET ")
sql = new StringBuilder("UPDATE AD_User SET ")
.append(" EMail=").append(DB.TO_STRING(adminEMail))
.append(", EMailUser=").append(DB.TO_STRING(mailUser))
.append(", EMailUserPW=").append(DB.TO_STRING(mailPassword))

View File

@ -880,7 +880,7 @@ public final class EMail implements Serializable
public void setMessageHTML (String subject, String message)
{
m_subject = subject;
StringBuffer sb = new StringBuffer("<HTML>\n")
StringBuilder sb = new StringBuilder("<HTML>\n")
.append("<HEAD>\n")
.append("<TITLE>\n")
.append(subject + "\n")

Some files were not shown because too many files have changed in this diff Show More