IDEMPIERE-308 Performance: Replace with StringBuilder / some classes revisited to make them safer against NPE

This commit is contained in:
Carlos Ruiz 2012-10-11 14:15:53 -05:00
parent 549f7c3249
commit 78f498a662
84 changed files with 526 additions and 436 deletions

View File

@ -57,7 +57,7 @@ public class CalloutAssignment extends CalloutEngine
return "";
int M_Product_ID = 0;
StringBuilder Name = null;
String Name = null;
String Description = null;
BigDecimal Qty = null;
String sql = "SELECT p.M_Product_ID, ra.Name, ra.Description, ra.Qty "
@ -74,7 +74,7 @@ public class CalloutAssignment extends CalloutEngine
if (rs.next())
{
M_Product_ID = rs.getInt (1);
Name = new StringBuilder(rs.getString(2));
Name = rs.getString(2);
Description = rs.getString(3);
Qty = rs.getBigDecimal(4);
}
@ -94,9 +94,9 @@ public class CalloutAssignment extends CalloutEngine
{
mTab.setValue ("M_Product_ID", new Integer (M_Product_ID));
if (Description != null)
Name.append(" (").append(Description).append(")");
if (!".".equals(Name.toString()))
mTab.setValue("Description", Name.toString());
Name += " (" + Description + ")";
if (!".".equals(Name))
mTab.setValue("Description", Name);
//
String variable = "Qty"; // TimeExpenseLine
if (mTab.getTableName().startsWith("C_Order"))

View File

@ -264,12 +264,12 @@ public class ClientAcctProcessor extends SvrProcess
if (countError[i] > 0)
m_summary.append("(Errors=").append(countError[i]).append(")");
m_summary.append(" - ");
StringBuilder msglog = new StringBuilder(getName()).append(": ").append(m_summary.toString());
StringBuilder msglog = new StringBuilder().append(getName()).append(": ").append(m_summary.toString());
log.finer(msglog.toString());
}
else
{
StringBuilder msglog = new StringBuilder(getName()).append(": ").append(TableName).append(" - no work");
StringBuilder msglog = new StringBuilder().append(getName()).append(": ").append(TableName).append(" - no work");
log.finer(msglog.toString());
}
}

View File

@ -141,7 +141,7 @@ public class HouseKeeping extends SvrProcess{
houseKeeping.setLastDeleted(nodel);
houseKeeping.saveEx();
addLog("@Deleted@ " + nodel);
StringBuilder msg = new StringBuilder(Msg.getElement(getCtx(), tableName + "_ID")).append(" #").append(nodel);
StringBuilder msg = new StringBuilder().append(Msg.getElement(getCtx(), tableName + "_ID")).append(" #").append(nodel);
return msg.toString();
}//doIt
}

View File

@ -126,7 +126,8 @@ public class InOutGenerateRMA extends SvrProcess
}
}
return "@Created@ = " + m_created;
StringBuilder msgreturn = new StringBuilder("@Created@ = ").append(m_created);
return msgreturn.toString();
}
private int getShipmentDocTypeId(int M_RMA_ID)
@ -241,7 +242,7 @@ public class InOutGenerateRMA extends SvrProcess
log.log(Level.WARNING, msglog.toString());
}
StringBuffer processMsg = new StringBuffer(shipment.getDocumentNo());
StringBuffer processMsg = new StringBuffer().append(shipment.getDocumentNo());
if (!shipment.processIt(p_docAction))
{

View File

@ -120,7 +120,8 @@ public class InvoiceGenerateRMA extends SvrProcess
log.log(Level.SEVERE, "Could not close prepared statement");
}
}
return "@Created@ = " + m_created;
StringBuilder msgreturn = new StringBuilder("@Created@ = ").append(m_created);
return msgreturn.toString();
}
private int getInvoiceDocTypeId(int M_RMA_ID)
@ -203,7 +204,7 @@ public class InvoiceGenerateRMA extends SvrProcess
log.log(Level.WARNING, msglog.toString());
}
StringBuilder processMsg = new StringBuilder(invoice.getDocumentNo());
StringBuilder processMsg = new StringBuilder().append(invoice.getDocumentNo());
if (!invoice.processIt(p_docAction))
{

View File

@ -160,7 +160,7 @@ public class PrepareMigrationScripts extends SvrProcess {
}
}
if (blBody) {
body.append(line + '\n');
body.append(line).append('\n');
}
if (line.equals("--BEGINHEADER--")) {
blHeader = true;
@ -173,7 +173,7 @@ public class PrepareMigrationScripts extends SvrProcess {
} else {
if (!isFirstLine)
line = scanner.nextLine();
body.append(line + '\n');
body.append(line).append('\n');
}
isFirstLine = false;
}

View File

@ -87,7 +87,8 @@ public class AD_PrintPaper_Default extends SvrProcess
log.log(Level.SEVERE, "set print format", e);
}
return "@Copied@=" + cnt;
StringBuilder msgreturn = new StringBuilder("@Copied@=").append(cnt);
return msgreturn.toString();
} // doIt
} // AD_PrintPaper_Default

View File

@ -76,7 +76,7 @@ public class AcctSchemaDefaultCopy extends SvrProcess
if (acct == null || acct.get_ID() == 0)
throw new AdempiereSystemError("Default Not Found - C_AcctSchema_ID=" + p_C_AcctSchema_ID);
StringBuilder sql;
StringBuilder sql = null;
int updated = 0;
int created = 0;
int updatedTotal = 0;

View File

@ -111,7 +111,8 @@ public class AllocationReset extends SvrProcess
if (delete(hdr))
count++;
m_trx.close();
return "@Deleted@ #" + count;
StringBuilder msgreturn = new StringBuilder("@Deleted@ #").append(count);
return msgreturn.toString();
}
// Selection
@ -171,7 +172,8 @@ public class AllocationReset extends SvrProcess
rs = null; pstmt = null;
}
m_trx.close();
return "@Deleted@ #" + count;
StringBuilder msgreturn = new StringBuilder("@Deleted@ #").append(count);
return msgreturn.toString();
} // doIt

View File

@ -181,7 +181,8 @@ public class AssetDelivery extends SvrProcess
log.info("Count=" + count + ", Errors=" + errors + ", Reminder=" + reminders
+ " - " + (System.currentTimeMillis()-start) + "ms");
return "@Sent@=" + count + " - @Errors@=" + errors;
StringBuilder msgreturn = new StringBuilder("@Sent@=").append(count).append(" - @Errors@=").append(errors);
return msgreturn.toString();
} // doIt
@ -218,8 +219,10 @@ public class AssetDelivery extends SvrProcess
}
String msg = email.send();
new MUserMail(m_MailText, asset.getAD_User_ID(), email).saveEx();
if (!EMail.SENT_OK.equals(msg))
return "** Not delivered: " + user.getEMail() + " - " + msg;
if (!EMail.SENT_OK.equals(msg)){
StringBuilder msgreturn = new StringBuilder("** Not delivered: ").append(user.getEMail()).append(" - ").append(msg);
return msgreturn.toString();
}
//
return user.getEMail();
} // sendNoGuaranteeMail
@ -285,8 +288,10 @@ public class AssetDelivery extends SvrProcess
}
String msg = email.send();
new MUserMail(m_MailText, asset.getAD_User_ID(), email).saveEx();
if (!EMail.SENT_OK.equals(msg))
return "** Not delivered: " + user.getEMail() + " - " + msg;
if (!EMail.SENT_OK.equals(msg)){
StringBuilder msgreturn = new StringBuilder("** Not delivered: ").append(user.getEMail()).append(" - ").append(msg);
return msgreturn.toString();
}
MAssetDelivery ad = asset.confirmDelivery(email, user.getAD_User_ID());
ad.saveEx();
@ -294,7 +299,8 @@ public class AssetDelivery extends SvrProcess
//
log.fine((System.currentTimeMillis()-start) + " ms");
// success
return user.getEMail() + " - " + asset.getProductVersionNo();
StringBuilder msgreturn = new StringBuilder().append(user.getEMail()).append(" - ").append(asset.getProductVersionNo());
return msgreturn.toString();
} // deliverIt
} // AssetDelivery

View File

@ -63,7 +63,7 @@ public class BOMFlagValidate extends SvrProcess {
while (rs.next())
{
StringBuilder msglog=new StringBuilder(rs.getString(1)).append(" BOM without BOM lines");
StringBuilder msglog=new StringBuilder().append(rs.getString(1)).append(" BOM without BOM lines");
addLog(0, null, null, msglog.toString(), MProduct.Table_ID, rs.getInt(2));
}
} catch (SQLException e) {
@ -119,7 +119,7 @@ public class BOMFlagValidate extends SvrProcess {
while (rs.next())
{
StringBuilder msglog = new StringBuilder(rs.getString(1)).append(" not BOM with BOM lines");
StringBuilder msglog = new StringBuilder().append(rs.getString(1)).append(" not BOM with BOM lines");
addLog(0, null, null, msglog.toString(), MProduct.Table_ID, rs.getInt(2));
}
} catch (SQLException e) {

View File

@ -391,7 +391,7 @@ public class ChangeLogProcess extends SvrProcess
.append (" FROM ").append(tableName)
.append (" WHERE EntityType IN ('D','C'))");
int no = DB.executeUpdate(update.toString(), get_TrxName());
StringBuilder msglog = new StringBuilder(table.getTableName()).append(" = ").append(no);
StringBuilder msglog = new StringBuilder().append(table.getTableName()).append(" = ").append(no);
log.config(msglog.toString());
updateNo += no;
@ -406,8 +406,8 @@ public class ChangeLogProcess extends SvrProcess
DB.close(rs, pstmt);
rs = null; pstmt = null;
}
return "@Reset@: " + resetNo + " - @Updated@: " + updateNo;
StringBuilder msgreturn = new StringBuilder("@Reset@: ").append(resetNo).append(" - @Updated@: ").append(updateNo);
return msgreturn.toString();
} // setCustomization
} // ChangeLogProcess

View File

@ -125,7 +125,8 @@ public class ColumnEncryption extends SvrProcess {
column.setIsEncrypted(false);
column.saveEx();
}
return columnName + ": cannot be encrypted";
StringBuilder msgreturn = new StringBuilder().append(columnName).append(": cannot be encrypted");
return msgreturn.toString();
}
// Start
@ -257,7 +258,8 @@ public class ColumnEncryption extends SvrProcess {
}
}
return "Encryption=" + column.isEncrypted();
StringBuilder msgreturn = new StringBuilder("Encryption=").append(column.isEncrypted());
return msgreturn.toString();
} // doIt
/**
@ -346,7 +348,7 @@ public class ColumnEncryption extends SvrProcess {
for (int i = 0; i < colLength; i++) {
str.append("1");
}
str = new StringBuilder(SecureEngine.encrypt(str.toString()));
str = new StringBuilder().append(SecureEngine.encrypt(str.toString()));
return str.length();
} // encryptedColumnLength
@ -372,14 +374,14 @@ public class ColumnEncryption extends SvrProcess {
selectSql.append(" WHERE AD_Column_ID=?");
// Alter SQL
StringBuffer alterSql = new StringBuffer();
StringBuilder alterSql = new StringBuilder();
alterSql.append("ALTER TABLE ").append(tableName);
alterSql.append(" MODIFY ").append(columnName);
alterSql.append(" NVARCHAR2(");
alterSql.append(length).append(") ");
// Update SQL
StringBuffer updateSql = new StringBuffer();
StringBuilder updateSql = new StringBuilder();
updateSql.append("UPDATE AD_Column");
updateSql.append(" SET FieldLength=").append(length);
updateSql.append(" WHERE AD_Column_ID=").append(columnID);

View File

@ -89,7 +89,7 @@ public class CommissionCalc extends SvrProcess
comRun.setStartDate(p_StartDate);
// 01-Jan-2000 - 31-Jan-2001 - USD
SimpleDateFormat format = DisplayType.getDateFormat(DisplayType.Date);
StringBuilder description = new StringBuilder(format.format(p_StartDate))
StringBuilder description = new StringBuilder().append(format.format(p_StartDate))
.append(" - ").append(format.format(m_EndDate))
.append(" - ").append(MCurrency.getISO_Code(getCtx(), m_com.getC_Currency_ID()));
comRun.setDescription(description.toString());

View File

@ -112,7 +112,7 @@ public class CopyOrder extends SvrProcess
//
// Env.setSOTrx(getCtx(), newOrder.isSOTrx());
// return "@C_Order_ID@ " + newOrder.getDocumentNo();
StringBuilder msgreturn = new StringBuilder(dt.getName()).append(": ").append(newOrder.getDocumentNo());
StringBuilder msgreturn = new StringBuilder().append(dt.getName()).append(": ").append(newOrder.getDocumentNo());
return msgreturn.toString();
} // doIt

View File

@ -208,7 +208,8 @@ public class DistributionRun extends SvrProcess
createOrders();
}
return "@Created@ #" + m_counter;
StringBuilder msgreturn = new StringBuilder("@Created@ #").append(m_counter);
return msgreturn.toString();
} // doIt
@ -547,7 +548,7 @@ public class DistributionRun extends SvrProcess
product = MProduct.get (getCtx(), detail.getM_Product_ID());
if (p_IsTest)
{
StringBuilder msglog = new StringBuilder(bp.getName()).append(" - ").append(product.getName());
StringBuilder msglog = new StringBuilder().append(bp.getName()).append(" - ").append(product.getName());
addLog(0,null, detail.getActualAllocation(), msglog.toString());
continue;
}
@ -571,7 +572,7 @@ public class DistributionRun extends SvrProcess
log.log(Level.SEVERE, "OrderLine not saved");
return false;
}
StringBuilder msglog = new StringBuilder(order.getDocumentNo()).append(": ").append(bp.getName()).append(" - ").append(product.getName());
StringBuilder msglog = new StringBuilder().append(order.getDocumentNo()).append(": ").append(bp.getName()).append(" - ").append(product.getName());
addLog(0,null, detail.getActualAllocation(), msglog.toString());
}
// finish order
@ -997,7 +998,7 @@ public class DistributionRun extends SvrProcess
product = MProduct.get (getCtx(), detail.getM_Product_ID());
if (p_IsTest)
{
StringBuilder msglog = new StringBuilder(bp.getName()).append(" - ").append(product.getName());
StringBuilder msglog = new StringBuilder().append(bp.getName()).append(" - ").append(product.getName());
addLog(0,null, detail.getActualAllocation(), msglog.toString());
continue;
}
@ -1082,7 +1083,7 @@ public class DistributionRun extends SvrProcess
line.saveEx();
}
StringBuilder msglog = new StringBuilder(order.getDocumentNo())
StringBuilder msglog = new StringBuilder().append(order.getDocumentNo())
.append(": ").append(bp.getName()).append(" - ").append(product.getName());
addLog(0,null, detail.getActualAllocation(), msglog.toString());
}

View File

@ -167,7 +167,7 @@ public class DunningPrint extends SvrProcess
MDunningRunEntry.Table_ID,
entry.getC_DunningRunEntry_ID(),
entry.getC_BPartner_ID());
StringBuilder msginfo = new StringBuilder(bp.getName()).append(", Amt=").append(entry.getAmt());
StringBuilder msginfo = new StringBuilder().append(bp.getName()).append(", Amt=").append(entry.getAmt());
info.setDescription(msginfo.toString());
ReportEngine re = null;
if (format != null)
@ -198,7 +198,7 @@ public class DunningPrint extends SvrProcess
//
if (re != null) {
File attachment = re.getPDF(File.createTempFile("Dunning", ".pdf"));
StringBuilder msglog = new StringBuilder(to.toString()).append(" - ").append(attachment);
StringBuilder msglog = new StringBuilder().append(to.toString()).append(" - ").append(attachment);
log.fine(msglog.toString());
email.addAttachment(attachment);
}
@ -208,15 +208,15 @@ public class DunningPrint extends SvrProcess
um.saveEx();
if (msg.equals(EMail.SENT_OK))
{
StringBuilder msglog = new StringBuilder(
bp.getName()).append(" @RequestActionEMailOK@");
StringBuilder msglog = new StringBuilder()
.append(bp.getName()).append(" @RequestActionEMailOK@");
addLog (entry.get_ID(), null, null,msglog.toString());
count++;
printed = true;
}
else
{
StringBuilder msglog = new StringBuilder(bp.getName()).append(" @RequestActionEMailError@ ").append(msg);
StringBuilder msglog = new StringBuilder().append(bp.getName()).append(" @RequestActionEMailError@ ").append(msg);
addLog (entry.get_ID(), null, null,msglog.toString() );
errors++;
}
@ -244,7 +244,8 @@ public class DunningPrint extends SvrProcess
StringBuilder msgreturn = new StringBuilder("@Sent@=").append(count).append(" - @Errors@=").append(errors);
return msgreturn.toString();
}
return "@Printed@=" + count;
StringBuilder msgreturn = new StringBuilder("@Printed@=").append(count);
return msgreturn.toString();
} // doIt
} // DunningPrint

View File

@ -123,7 +123,8 @@ public class DunningRunCreate extends SvrProcess
int entries = DB.getSQLValue(get_TrxName(), "SELECT COUNT(*) FROM C_DunningRunEntry WHERE C_DunningRun_ID=?", m_run.get_ID());
return "@C_DunningRunEntry_ID@ #" + entries;
StringBuilder msgreturn = new StringBuilder("@C_DunningRunEntry_ID@ #").append(entries);
return msgreturn.toString();
} // doIt

View File

@ -55,7 +55,7 @@ public class EMailTest extends SvrProcess
// Test Client Mail
String clientTest = client.testEMail();
StringBuilder msglog = new StringBuilder(client.getName()).append(": ").append(clientTest);
StringBuilder msglog = new StringBuilder().append(client.getName()).append(": ").append(clientTest);
addLog(0, null, null, msglog.toString());
// Test Client DocumentDir
@ -76,7 +76,7 @@ public class EMailTest extends SvrProcess
{
MStore store = wstores[i];
String test = store.testEMail();
msglog = new StringBuilder(store.getName()).append(": ").append(test);
msglog = new StringBuilder().append(store.getName()).append(": ").append(test);
addLog(0, null, null, msglog.toString());
}

View File

@ -137,7 +137,7 @@ public class ExpenseAPInvoice extends SvrProcess
}
invoice.setM_PriceList_ID(te.getM_PriceList_ID());
invoice.setSalesRep_ID(te.getDoc_User_ID());
StringBuilder descr = new StringBuilder(Msg.translate(getCtx(), "S_TimeExpense_ID"))
StringBuilder descr = new StringBuilder().append(Msg.translate(getCtx(), "S_TimeExpense_ID"))
.append(": ").append(te.getDocumentNo()).append(" " )
.append(DisplayType.getDateFormat(DisplayType.Date).format(te.getDateReport()));
invoice.setDescription(descr.toString());

View File

@ -75,7 +75,7 @@ public class ImportDelete extends SvrProcess
// Delete
StringBuilder sql = new StringBuilder("DELETE FROM ").append(tableName).append(" WHERE AD_Client_ID=").append(getAD_Client_ID());
int no = DB.executeUpdate(sql.toString(), get_TrxName());
StringBuilder msg = new StringBuilder(Msg.translate(getCtx(), tableName + "_ID")).append(" #").append(no);
StringBuilder msg = new StringBuilder().append(Msg.translate(getCtx(), tableName + "_ID")).append(" #").append(no);
return msg.toString();
} // ImportDelete

View File

@ -580,8 +580,8 @@ public class ImportGLJournal extends SvrProcess
commitEx();
// Count Errors
int errors = DB.getSQLValue(get_TrxName(),
"SELECT COUNT(*) FROM I_GLJournal WHERE I_IsImported NOT IN ('Y','N')" + clientCheck);
StringBuilder msgdb = new StringBuilder("SELECT COUNT(*) FROM I_GLJournal WHERE I_IsImported NOT IN ('Y','N')").append(clientCheck);
int errors = DB.getSQLValue(get_TrxName(), msgdb.toString());
if (errors != 0)
{
@ -652,11 +652,11 @@ public class ImportGLJournal extends SvrProcess
batch.setDocumentNo (imp.getBatchDocumentNo());
batch.setC_DocType_ID(imp.getC_DocType_ID());
batch.setPostingType(imp.getPostingType());
StringBuilder description = new StringBuilder(imp.getBatchDescription());
if (description == null || description.length() == 0)
StringBuilder description;
if (imp.getBatchDescription() == null || imp.getBatchDescription().toString().length() == 0)
description = new StringBuilder("*Import-");
else
description.append(" *Import-");
description = new StringBuilder(imp.getBatchDescription()).append(" *Import-");
description.append(new Timestamp(System.currentTimeMillis()));
batch.setDescription(description.toString());
if (!batch.save())

View File

@ -92,7 +92,7 @@ public class ImportPayment extends SvrProcess
StringBuilder sql = null;
int no = 0;
String clientCheck = " AND AD_Client_ID=" + ba.getAD_Client_ID();
StringBuilder clientCheck = new StringBuilder(" AND AD_Client_ID=").append(ba.getAD_Client_ID());
// **** Prepare ****

View File

@ -402,7 +402,7 @@ public class InvoiceGenerate extends SvrProcess
AD_Language = Language.getBaseAD_Language();
java.text.SimpleDateFormat format = DisplayType.getDateFormat
(DisplayType.Date, Language.getLanguage(AD_Language));
StringBuilder reference = new StringBuilder(dt.getPrintName(m_bp.getAD_Language()))
StringBuilder reference = new StringBuilder().append(dt.getPrintName(m_bp.getAD_Language()))
.append(": ").append(ship.getDocumentNo())
.append(" - ").append(format.format(ship.getMovementDate()));
m_ship = ship;

View File

@ -82,7 +82,7 @@ public class OrderRePrice extends SvrProcess
}
order = new MOrder (getCtx(), p_C_Order_ID, get_TrxName());
BigDecimal newPrice = order.getGrandTotal();
retValue = new StringBuilder(order.getDocumentNo()).append(": ").append(oldPrice).append(" -> ").append(newPrice);
retValue = new StringBuilder().append(order.getDocumentNo()).append(": ").append(oldPrice).append(" -> ").append(newPrice);
}
if (p_C_Invoice_ID != 0)
{

View File

@ -80,7 +80,7 @@ public class ProjectLinePricing extends SvrProcess
projectLine.setPlannedMarginAmt(pp.getPriceStd().subtract(pp.getPriceLimit()));
projectLine.saveEx();
//
StringBuilder retValue = new StringBuilder(Msg.getElement(getCtx(), "PriceList")).append(pp.getPriceList()).append(" - ")
StringBuilder retValue = new StringBuilder().append(Msg.getElement(getCtx(), "PriceList")).append(pp.getPriceList()).append(" - ")
.append(Msg.getElement(getCtx(), "PriceStd")).append(pp.getPriceStd()).append(" - ")
.append(Msg.getElement(getCtx(), "PriceLimit")).append(pp.getPriceLimit());
return retValue.toString();

View File

@ -131,7 +131,7 @@ public class RegisterSystem extends SvrProcess
// Send it
URL url = new URL (urlString.toString());
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
try
{
URLConnection uc = url.openConnection();

View File

@ -243,7 +243,7 @@ public class RequisitionPOCreate extends SvrProcess
whereClause.append(")"); // End Requisition Header
//
// ORDER BY clause
StringBuffer orderClause = new StringBuffer();
StringBuilder orderClause = new StringBuilder();
if (!p_ConsolidateDocument)
{
orderClause.append("M_Requisition_ID, ");
@ -355,7 +355,7 @@ public class RequisitionPOCreate extends SvrProcess
// default po document type
if (!p_ConsolidateDocument)
{
StringBuilder msgsd= new StringBuilder(Msg.getElement(getCtx(), "M_Requisition_ID"))
StringBuilder msgsd= new StringBuilder().append(Msg.getElement(getCtx(), "M_Requisition_ID"))
.append(": ").append(rLine.getParent().getDocumentNo());
m_order.setDescription(msgsd.toString());
}

View File

@ -369,7 +369,7 @@ public class TableCreateColumns extends SvrProcess
// Done
if (column.save ())
{
StringBuilder msglog = new StringBuilder(table.getTableName()).append(".").append(column.getColumnName());
StringBuilder msglog = new StringBuilder().append(table.getTableName()).append(".").append(column.getColumnName());
addLog (0, null, null, msglog.toString());
m_count++;
}

View File

@ -112,7 +112,7 @@ public class TreeMaintenance extends SvrProcess
int deletes = DB.executeUpdate(sql.toString(), get_TrxName());
addLog(0,null, new BigDecimal(deletes), tree.getName()+ " Deleted");
if (!tree.isAllNodes()){
StringBuilder msgreturn = new StringBuilder(tree.getName()).append(" OK");
StringBuilder msgreturn = new StringBuilder().append(tree.getName()).append(" OK");
return msgreturn.toString();
}
// Insert new
@ -176,9 +176,9 @@ public class TreeMaintenance extends SvrProcess
{
pstmt = null;
}
StringBuilder msglog = new StringBuilder(tree.getName()).append(" Inserted");
StringBuilder msglog = new StringBuilder().append(tree.getName()).append(" Inserted");
addLog(0,null, new BigDecimal(inserts), msglog.toString());
StringBuilder msgreturn = new StringBuilder(tree.getName()).append((ok ? " OK" : " Error"));
StringBuilder msgreturn = new StringBuilder().append(tree.getName()).append((ok ? " OK" : " Error"));
return msgreturn.toString();
} // verifyTree

View File

@ -414,8 +414,8 @@ public class MRelationType extends X_AD_RelationType implements IZoomProvider {
private static void evaluateQuery(final MQuery query) {
final String sqlCommon = " FROM " + query.getZoomTableName()
+ " WHERE " + query.getWhereClause(false);
StringBuilder sqlCommon = new StringBuilder(" FROM ").append(query.getZoomTableName())
.append(" WHERE ").append(query.getWhereClause(false));
final String sqlCount = "SELECT COUNT(*) " + sqlCommon;
@ -424,10 +424,10 @@ public class MRelationType extends X_AD_RelationType implements IZoomProvider {
if (count > 0) {
final String sqlFirstKey = "SELECT " + query.getZoomColumnName()
+ sqlCommon;
StringBuilder sqlFirstKey = new StringBuilder("SELECT ").append(query.getZoomColumnName())
.append(sqlCommon);
final int firstKey = DB.getSQLValueEx(null, sqlFirstKey);
final int firstKey = DB.getSQLValueEx(null, sqlFirstKey.toString());
query.setZoomValue(firstKey);
}
}
@ -462,7 +462,7 @@ public class MRelationType extends X_AD_RelationType implements IZoomProvider {
@Override
public String toString() {
final StringBuffer sb = new StringBuffer("MRelationType[");
StringBuilder sb = new StringBuilder("MRelationType[");
//
sb.append(get_ID());
sb.append(", Name=").append(getName());

View File

@ -55,7 +55,8 @@ public class ResetLockedAccount extends SvrProcess {
if (no < 0)
throw new AdempiereException("Could not unlock user account" + user.toString());
return "@OK@ - The user '" + user.getName() + "' has been unlocked";
StringBuilder msgreturn = new StringBuilder("@OK@ - The user '").append(user.getName()).append("' has been unlocked");
return msgreturn.toString();
}
else
{
@ -84,7 +85,8 @@ public class ResetLockedAccount extends SvrProcess {
int no = DB.executeUpdate(sql.toString(), p_AD_Client_ID, get_TrxName());
if (no < 0)
throw new AdempiereException("Could not unlock user account");
return no + " locked account has been reset";
StringBuilder msgreturn = new StringBuilder().append(no).append(" locked account has been reset");
return msgreturn.toString();
}
}
}

View File

@ -127,7 +127,8 @@ public class UUIDGenerator extends SvrProcess {
} finally {
DB.close(rs,stmt);
}
return count + " table altered";
StringBuilder msgreturn = new StringBuilder().append(count).append(" table altered");
return msgreturn.toString();
}
public static void updateUUID(MColumn column, String trxName) {
@ -241,13 +242,13 @@ public class UUIDGenerator extends SvrProcess {
while (rs.next())
{
noColumns++;
StringBuilder columnName = new StringBuilder(rs.getString ("COLUMN_NAME"));
StringBuilder columnName = new StringBuilder().append(rs.getString ("COLUMN_NAME"));
if (!columnName.toString().equalsIgnoreCase(column.getColumnName()))
continue;
// update existing column
boolean notNull = DatabaseMetaData.columnNoNulls == rs.getInt("NULLABLE");
sql = new StringBuilder(column.getSQLModify(table, column.isMandatory() != notNull));
sql = new StringBuilder().append(column.getSQLModify(table, column.isMandatory() != notNull));
break;
}
}
@ -282,10 +283,10 @@ public class UUIDGenerator extends SvrProcess {
if (no != -1)
{
StringBuilder indexName = new StringBuilder(column.getColumnName()).append("_idx");
StringBuilder indexName = new StringBuilder().append(column.getColumnName()).append("_idx");
if (indexName.length() > 30) {
int i = indexName.length() - 31;
indexName = new StringBuilder(column.getColumnName().substring(0, column.getColumnName().length() - i));
indexName = new StringBuilder().append(column.getColumnName().substring(0, column.getColumnName().length() - i));
indexName.append("_uu_idx");
}
StringBuilder indexSql = new StringBuilder("CREATE UNIQUE INDEX ").append(indexName).append(" ON ").append(tableName)

View File

@ -176,7 +176,7 @@ public abstract class AbstractDocumentSearch {
}
// SearchDefinition with a special query
} else if (msd.getSearchType().equals(MSearchDefinition.SEARCHTYPE_QUERY)) {
sqlSO = new StringBuilder(msd.getQuery());
sqlSO = new StringBuilder().append(msd.getQuery());
pstmtSO = DB.prepareStatement(sqlSO.toString(), null);
// count '?' in statement
int count = 1;

View File

@ -135,22 +135,22 @@ public class ModelClassGenerator
if (tableName == null)
throw new RuntimeException ("TableName not found for ID=" + AD_Table_ID);
//
String accessLevelInfo = accessLevel + " ";
StringBuilder accessLevelInfo = new StringBuilder().append(accessLevel).append(" ");
if (accessLevel >= 4 )
accessLevelInfo += "- System ";
accessLevelInfo.append("- System ");
if (accessLevel == 2 || accessLevel == 3 || accessLevel == 6 || accessLevel == 7)
accessLevelInfo += "- Client ";
accessLevelInfo.append("- Client ");
if (accessLevel == 1 || accessLevel == 3 || accessLevel == 5 || accessLevel == 7)
accessLevelInfo += "- Org ";
accessLevelInfo.append("- Org ");
//
String keyColumn = tableName + "_ID";
String className = "X_" + tableName;
StringBuilder keyColumn = new StringBuilder().append(tableName).append("_ID");
StringBuilder className = new StringBuilder("X_").append(tableName);
//
StringBuilder start = new StringBuilder()
.append (ModelInterfaceGenerator.COPY)
.append ("/** Generated Model - DO NOT CHANGE */").append(NL)
.append("package " + packageName + ";").append(NL)
.append("package ").append(packageName).append(";").append(NL)
.append(NL)
;
@ -248,12 +248,12 @@ public class ModelClassGenerator
.append(" }").append(NL)
;
StringBuilder end = new StringBuilder ("}");
String end = "}";
//
sb.insert(0, start);
sb.append(end);
return className;
return className.toString();
}
/**
@ -398,10 +398,10 @@ public class ModelClassGenerator
if (fieldName != null && referenceClassName != null)
{
sb.append(NL)
.append("\tpublic "+referenceClassName+" get").append(fieldName).append("() throws RuntimeException").append(NL)
.append("\tpublic ").append(referenceClassName).append(" get").append(fieldName).append("() throws RuntimeException").append(NL)
.append(" {").append(NL)
.append("\t\treturn ("+referenceClassName+")MTable.get(getCtx(), "+referenceClassName+".Table_Name)").append(NL)
.append("\t\t\t.getPO(get"+columnName+"(), get_TrxName());")
.append("\t\treturn (").append(referenceClassName).append(")MTable.get(getCtx(), ").append(referenceClassName).append(".Table_Name)").append(NL)
.append("\t\t\t.getPO(get").append(columnName).append("(), get_TrxName());")
/**/
.append("\t}").append(NL)
;
@ -701,9 +701,9 @@ public class ModelClassGenerator
*/
private StringBuilder createKeyNamePair (String columnName, int displayType)
{
String method = "get" + columnName + "()";
StringBuilder method = new StringBuilder("get").append(columnName).append("()");
if (displayType != DisplayType.String)
method = "String.valueOf(" + method + ")";
method = new StringBuilder("String.valueOf(").append(method).append(")");
StringBuilder sb = new StringBuilder(NL)
.append(" /** Get Record ID/ColumnName").append(NL)
@ -757,7 +757,8 @@ public class ModelClassGenerator
fw.close ();
float size = out.length();
size /= 1024;
System.out.println(out.getAbsolutePath() + " - " + size + " kB");
StringBuilder msgout = new StringBuilder().append(out.getAbsolutePath()).append(" - ").append(size).append(" kB");
System.out.println(msgout.toString());
}
catch (Exception ex)
{
@ -837,9 +838,9 @@ public class ModelClassGenerator
if (tableName == null || tableName.trim().length() == 0)
throw new IllegalArgumentException("Must specify table name");
String tableLike = tableName.trim();
if (!tableLike.startsWith("'") || !tableLike.endsWith("'"))
tableLike = "'" + tableLike + "'";
StringBuilder tableLike = new StringBuilder().append(tableName.trim());
if (!tableLike.toString().startsWith("'") || !tableLike.toString().endsWith("'"))
tableLike = new StringBuilder("'").append(tableLike).append("'");
StringBuilder entityTypeFilter = new StringBuilder();
if (entityType != null && entityType.trim().length() > 0)
@ -848,9 +849,9 @@ public class ModelClassGenerator
StringTokenizer tokenizer = new StringTokenizer(entityType, ",");
int i = 0;
while(tokenizer.hasMoreTokens()) {
String token = tokenizer.nextToken().trim();
if (!token.startsWith("'") || !token.endsWith("'"))
token = "'" + token + "'";
StringBuilder token = new StringBuilder().append(tokenizer.nextToken().trim());
if (!token.toString().startsWith("'") || !token.toString().endsWith("'"))
token = new StringBuilder("'").append(token).append("'");
if (i > 0)
entityTypeFilter.append(",");
entityTypeFilter.append(token);
@ -863,18 +864,18 @@ public class ModelClassGenerator
entityTypeFilter.append("EntityType IN ('U','A')");
}
String directory = sourceFolder.trim();
StringBuilder directory = new StringBuilder().append(sourceFolder.trim());
String packagePath = packageName.replace(".", File.separator);
if (!(directory.endsWith("/") || directory.endsWith("\\")))
if (!(directory.toString().endsWith("/") || directory.toString().endsWith("\\")))
{
directory = directory + File.separator;
directory.append(File.separator);
}
if (File.separator.equals("/"))
directory = directory.replaceAll("[\\\\]", File.separator);
directory = new StringBuilder(directory.toString().replaceAll("[\\\\]", File.separator));
else
directory = directory.replaceAll("[/]", File.separator);
directory = directory + packagePath;
file = new File(directory);
directory = new StringBuilder(directory.toString().replaceAll("[/]", File.separator));
directory.append(packagePath);
file = new File(directory.toString());
if (!file.exists())
file.mkdirs();
@ -899,7 +900,7 @@ public class ModelClassGenerator
rs = pstmt.executeQuery();
while (rs.next())
{
new ModelClassGenerator(rs.getInt(1), directory, packageName);
new ModelClassGenerator(rs.getInt(1), directory.toString(), packageName);
count++;
}
}

View File

@ -171,7 +171,7 @@ public class ModelInterfaceGenerator
accessLevelInfo.append("- Org ");
//
String className = "I_" + tableName;
StringBuilder className = new StringBuilder("I_").append(tableName);
//
StringBuilder start = new StringBuilder()
.append (COPY)
@ -216,12 +216,12 @@ public class ModelInterfaceGenerator
//.append(" POInfo initPO (Properties ctx);") // INFO - Should this be here???
;
StringBuilder end = new StringBuilder("}");
String end = "}";
//
sb.insert(0, start);
sb.append(end);
return className;
return className.toString();
}
/**
@ -418,7 +418,8 @@ public class ModelInterfaceGenerator
fw.close();
float size = out.length();
size /= 1024;
System.out.println(out.getAbsolutePath() + " - " + size + " kB");
StringBuilder msgout = new StringBuilder().append(out.getAbsolutePath()).append(" - ").append(size).append(" kB");
System.out.println(msgout.toString());
} catch (Exception ex) {
log.log(Level.SEVERE, fileName, ex);
throw new RuntimeException(ex);
@ -797,7 +798,7 @@ public class ModelInterfaceGenerator
entityTypeFilter.append("EntityType IN ('U','A')");
}
StringBuilder directory = new StringBuilder(sourceFolder.trim());
StringBuilder directory = new StringBuilder().append(sourceFolder.trim());
String packagePath = packageName.replace(".", File.separator);
if (!(directory.toString().endsWith("/") || directory.toString().endsWith("\\")))
{

View File

@ -426,22 +426,24 @@ public abstract class Doc
|| m_DocStatus.equals(DocumentEngine.STATUS_Voided)
|| m_DocStatus.equals(DocumentEngine.STATUS_Reversed))
;
else
return "Invalid DocStatus='" + m_DocStatus + "' for DocumentNo=" + getDocumentNo();
else{
StringBuilder msgreturn = new StringBuilder("Invalid DocStatus='").append(m_DocStatus).append("' for DocumentNo=").append(getDocumentNo());
return msgreturn.toString();
}
//
if (p_po.getAD_Client_ID() != m_as.getAD_Client_ID())
{
String error = "AD_Client_ID Conflict - Document=" + p_po.getAD_Client_ID()
+ ", AcctSchema=" + m_as.getAD_Client_ID();
log.severe(error);
return error;
StringBuilder error = new StringBuilder("AD_Client_ID Conflict - Document=").append(p_po.getAD_Client_ID())
.append(", AcctSchema=").append(m_as.getAD_Client_ID());
log.severe(error.toString());
return error.toString();
}
// Lock Record ----
String trxName = null; // outside trx if on server
if (! m_manageLocalTrx)
trxName = getTrxName(); // on trx if it's in client
StringBuffer sql = new StringBuffer ("UPDATE ");
StringBuilder sql = new StringBuilder ("UPDATE ");
sql.append(get_TableName()).append( " SET Processing='Y' WHERE ")
.append(get_TableName()).append("_ID=").append(get_ID())
.append(" AND Processed='Y' AND IsActive='Y'");
@ -565,7 +567,7 @@ public abstract class Doc
// Reference
note.setReference(toString()); // Document
// Text
StringBuffer Text = new StringBuffer (Msg.getMsg(Env.getCtx(), AD_MessageValue));
StringBuilder Text = new StringBuilder (Msg.getMsg(Env.getCtx(), AD_MessageValue));
if (p_Error != null)
Text.append(" (").append(p_Error).append(")");
String cn = getClass().getName();
@ -603,7 +605,7 @@ public abstract class Doc
*/
protected int deleteAcct()
{
StringBuffer sql = new StringBuffer ("DELETE Fact_Acct WHERE AD_Table_ID=")
StringBuilder sql = new StringBuilder ("DELETE Fact_Acct WHERE AD_Table_ID=")
.append(get_Table_ID())
.append(" AND Record_ID=").append(p_po.get_ID())
.append(" AND C_AcctSchema_ID=").append(m_as.getC_AcctSchema_ID());
@ -776,7 +778,7 @@ public abstract class Doc
String trxName = null; // outside trx if on server
if (! m_manageLocalTrx)
trxName = getTrxName(); // on trx if it's in client
StringBuffer sql = new StringBuffer ("UPDATE ");
StringBuilder sql = new StringBuilder ("UPDATE ");
sql.append(get_TableName()).append( " SET Processing='N' WHERE ")
.append(get_TableName()).append("_ID=").append(p_po.get_ID());
DB.executeUpdate(sql.toString(), trxName);

View File

@ -84,7 +84,7 @@ public class DocLine_Allocation extends DocLine
*/
public String toString ()
{
StringBuffer sb = new StringBuffer ("DocLine_Allocation[");
StringBuilder sb = new StringBuilder ("DocLine_Allocation[");
sb.append(get_ID())
.append(",Amt=").append(getAmtSource())
.append(",Discount=").append(getDiscountAmt())

View File

@ -227,10 +227,11 @@ public class DocManager {
if (tableName == null)
{
s_log.severe("Table not a financial document. AD_Table_ID=" + AD_Table_ID);
return "Table not a financial document. AD_Table_ID="+AD_Table_ID;
StringBuilder msgreturn = new StringBuilder("Table not a financial document. AD_Table_ID=").append(AD_Table_ID);
return msgreturn.toString();
}
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;
@ -366,7 +367,7 @@ public class DocManager {
private final static boolean save (String trxName, int AD_Table_ID, int Record_ID, String status)
{
MTable table = MTable.get(Env.getCtx(), AD_Table_ID);
StringBuffer sql = new StringBuffer("UPDATE ");
StringBuilder sql = new StringBuilder("UPDATE ");
sql.append(table.getTableName()).append(" SET Posted='").append(status)
.append("',Processing='N' ")
.append("WHERE ")

View File

@ -170,7 +170,8 @@ public final class DocTax
*/
public String getDescription()
{
return m_name + " " + m_taxBaseAmt.toString();
StringBuilder msgreturn = new StringBuilder().append(m_name).append(" ").append(m_taxBaseAmt.toString());
return msgreturn.toString();
} // getDescription
/**
@ -236,7 +237,7 @@ public final class DocTax
*/
public String toString()
{
StringBuffer sb = new StringBuffer("Tax=(");
StringBuilder sb = new StringBuilder("Tax=(");
sb.append(m_name);
sb.append(" Amt=").append(m_amount);
sb.append(")");

View File

@ -747,9 +747,9 @@ public class Doc_AllocationHdr extends Doc
if (invoiceSource == null || invoiceAccounted == null)
return "Gain/Loss - Invoice not posted yet";
//
String description = "Invoice=(" + invoice.getC_Currency_ID() + ")" + invoiceSource + "/" + invoiceAccounted
+ " - Allocation=(" + getC_Currency_ID() + ")" + allocationSource + "/" + allocationAccounted;
log.fine(description);
StringBuilder description = new StringBuilder("Invoice=(").append(invoice.getC_Currency_ID()).append(")").append(invoiceSource).append("/").append(invoiceAccounted)
.append(" - Allocation=(").append(getC_Currency_ID()).append(")").append(allocationSource).append("/").append(allocationAccounted);
log.fine(description.toString());
// Allocation not Invoice Currency
if (getC_Currency_ID() != invoice.getC_Currency_ID())
{
@ -759,10 +759,10 @@ public class Doc_AllocationHdr extends Doc
invoice.getC_ConversionType_ID(), invoice.getAD_Client_ID(), invoice.getAD_Org_ID());
if (allocationSourceNew == null)
return "Gain/Loss - No Conversion from Allocation->Invoice";
String d2 = "Allocation=(" + getC_Currency_ID() + ")" + allocationSource
+ "->(" + invoice.getC_Currency_ID() + ")" + allocationSourceNew;
log.fine(d2);
description += " - " + d2;
StringBuilder d2 = new StringBuilder("Allocation=(").append(getC_Currency_ID()).append(")").append(allocationSource)
.append("->(").append(invoice.getC_Currency_ID()).append(")").append(allocationSourceNew);
log.fine(d2.toString());
description.append(" - ").append(d2);
allocationSource = allocationSourceNew;
}
@ -771,9 +771,9 @@ public class Doc_AllocationHdr extends Doc
if (allocationSource.compareTo(invoiceSource) == 0)
{
acctDifference = invoiceAccounted.subtract(allocationAccounted); // gain is negative
String d2 = "(full) = " + acctDifference;
log.fine(d2);
description += " - " + d2;
StringBuilder d2 = new StringBuilder("(full) = ").append(acctDifference);
log.fine(d2.toString());
description.append(" - ").append(d2);
}
else // partial or MC
{
@ -790,9 +790,9 @@ public class Doc_AllocationHdr extends Doc
int precision = as.getStdPrecision();
if (acctDifference.scale() > precision)
acctDifference = acctDifference.setScale(precision, BigDecimal.ROUND_HALF_UP);
String d2 = "(partial) = " + acctDifference + " - Multiplier=" + multiplier;
log.fine(d2);
description += " - " + d2;
StringBuilder d2 = new StringBuilder("(partial) = ").append(acctDifference).append(" - Multiplier=").append(multiplier);
log.fine(d2.toString());
description.append(" - ").append(d2);
}
if (acctDifference.signum() == 0)
@ -808,10 +808,10 @@ public class Doc_AllocationHdr extends Doc
{
FactLine fl = fact.createLine (line, loss, gain,
as.getC_Currency_ID(), acctDifference);
fl.setDescription(description);
fl.setDescription(description.toString());
fact.createLine (line, acct,
as.getC_Currency_ID(), acctDifference.negate());
fl.setDescription(description);
fl.setDescription(description.toString());
}
else
{

View File

@ -245,7 +245,7 @@ public class Doc_Invoice extends Doc
public BigDecimal getBalance()
{
BigDecimal retValue = Env.ZERO;
StringBuffer sb = new StringBuffer (" [");
StringBuilder sb = new StringBuilder (" [");
// Total
retValue = retValue.add(getAmount(Doc.AMTTYPE_Gross));
sb.append(getAmount(Doc.AMTTYPE_Gross));
@ -900,19 +900,19 @@ public class Doc_Invoice extends Doc
}
else
{
sql.append(" AND il.C_InvoiceLine_ID = (SELECT MIN(il1.C_InvoiceLine_ID) "
+ "FROM C_Invoice i1, C_InvoiceLine il1 "
+ "WHERE i1.C_Invoice_ID=il1.C_Invoice_ID"
+ " AND po.M_Product_ID=il1.M_Product_ID AND po.C_BPartner_ID=i1.C_BPartner_ID")
sql.append(" AND il.C_InvoiceLine_ID = (SELECT MIN(il1.C_InvoiceLine_ID) ")
.append("FROM C_Invoice i1, C_InvoiceLine il1 ")
.append("WHERE i1.C_Invoice_ID=il1.C_Invoice_ID")
.append(" AND po.M_Product_ID=il1.M_Product_ID AND po.C_BPartner_ID=i1.C_BPartner_ID")
.append(" AND i1.C_Invoice_ID=").append(get_ID()).append(") ");
}
sql.append(" AND i.C_Invoice_ID=").append(get_ID()).append(") ")
// update
.append("WHERE EXISTS (SELECT * "
+ "FROM C_Invoice i, C_InvoiceLine il "
+ "WHERE i.C_Invoice_ID=il.C_Invoice_ID"
+ " AND po.M_Product_ID=il.M_Product_ID AND po.C_BPartner_ID=i.C_BPartner_ID"
+ " AND i.C_Invoice_ID=").append(get_ID()).append(")");
.append("WHERE EXISTS (SELECT * ")
.append("FROM C_Invoice i, C_InvoiceLine il ")
.append("WHERE i.C_Invoice_ID=il.C_Invoice_ID")
.append(" AND po.M_Product_ID=il.M_Product_ID AND po.C_BPartner_ID=i.C_BPartner_ID")
.append(" AND i.C_Invoice_ID=").append(get_ID()).append(")");
int no = DB.executeUpdate(sql.toString(), getTrxName());
log.fine("Updated=" + no);
} // updateProductPO

View File

@ -282,7 +282,7 @@ public class Doc_Order extends Doc
public BigDecimal getBalance()
{
BigDecimal retValue = Env.ZERO;
StringBuffer sb = new StringBuffer (" [");
StringBuilder sb = new StringBuilder (" [");
// Total
retValue = retValue.add(getAmount(Doc.AMTTYPE_Gross));
sb.append(getAmount(Doc.AMTTYPE_Gross));
@ -461,7 +461,7 @@ public class Doc_Order extends Doc
if (ci.getC_AcctSchema1_ID() != as.getC_AcctSchema_ID())
return;
StringBuffer sql = new StringBuffer (
StringBuilder sql = new StringBuilder (
"UPDATE M_Product_PO po ")
.append("SET PriceLastPO = (SELECT currencyConvert(ol.PriceActual,ol.C_Currency_ID,po.C_Currency_ID,o.DateOrdered,o.C_ConversionType_ID,o.AD_Client_ID,o.AD_Org_ID) ")
.append("FROM C_Order o, C_OrderLine ol ")
@ -479,11 +479,11 @@ public class Doc_Order extends Doc
.append(" AND po.M_Product_ID=ol1.M_Product_ID AND po.C_BPartner_ID=o1.C_BPartner_ID")
.append(" AND o1.C_Order_ID=").append(get_ID()).append(") ");
sql.append(" AND o.C_Order_ID=").append(get_ID()).append(") ")
.append("WHERE EXISTS (SELECT * "
+ "FROM C_Order o, C_OrderLine ol "
+ "WHERE o.C_Order_ID=ol.C_Order_ID"
+ " AND po.M_Product_ID=ol.M_Product_ID AND po.C_BPartner_ID=o.C_BPartner_ID"
+ " AND o.C_Order_ID=").append(get_ID()).append(")");
.append("WHERE EXISTS (SELECT * ")
.append("FROM C_Order o, C_OrderLine ol ")
.append("WHERE o.C_Order_ID=ol.C_Order_ID")
.append(" AND po.M_Product_ID=ol.M_Product_ID AND po.C_BPartner_ID=o.C_BPartner_ID")
.append(" AND o.C_Order_ID=").append(get_ID()).append(")");
int no = DB.executeUpdate(sql.toString(), getTrxName());
log.fine("Updated=" + no);
} // updateProductPO

View File

@ -86,9 +86,12 @@ public class Doc_ProjectIssue extends Doc
public String getDocumentNo ()
{
MProject p = m_issue.getParent();
if (p != null)
return p.getValue() + " #" + m_issue.getLine();
return "(" + m_issue.get_ID() + ")";
if (p != null){
StringBuilder msgreturn = new StringBuilder().append(p.getValue()).append(" #").append(m_issue.getLine());
return msgreturn.toString();
}
StringBuilder msgreturn = new StringBuilder("(").append(m_issue.get_ID()).append(")");
return msgreturn.toString();
} // getDocumentNo
/**

View File

@ -351,7 +351,7 @@ public final class FactLine extends X_Fact_Acct
if (m_docLine != null)
setC_Tax_ID (m_docLine.getC_Tax_ID());
// Description
StringBuffer description = new StringBuffer(m_doc.getDocumentNo());
StringBuilder description = new StringBuilder().append(m_doc.getDocumentNo());
if (m_docLine != null)
{
description.append(" #").append(m_docLine.getLine());
@ -458,8 +458,10 @@ public final class FactLine extends X_Fact_Acct
String original = getDescription();
if (original == null || original.trim().length() == 0)
super.setDescription(description);
else
super.setDescription(original + " - " + description);
else{
StringBuilder msgd = new StringBuilder(original).append(" - ").append(description);
super.setDescription(msgd.toString());
}
} // addDescription
/**
@ -729,7 +731,7 @@ public final class FactLine extends X_Fact_Acct
*/
public String toString()
{
StringBuffer sb = new StringBuffer("FactLine=[");
StringBuilder sb = new StringBuilder("FactLine=[");
sb.append(getAD_Table_ID()).append(":").append(getRecord_ID())
.append(",").append(m_acct)
.append(",Cur=").append(getC_Currency_ID())
@ -1104,7 +1106,7 @@ public final class FactLine extends X_Fact_Acct
// end Bayu Sistematika
//
success = true;
log.fine(new StringBuffer("(Table=").append(AD_Table_ID)
log.fine(new StringBuilder("(Table=").append(AD_Table_ID)
.append(",Record_ID=").append(Record_ID)
.append(",Line=").append(Record_ID)
.append(", Account=").append(m_acct)
@ -1132,7 +1134,7 @@ public final class FactLine extends X_Fact_Acct
setAD_Org_ID (fact.getAD_Org_ID());
}
else
log.warning(new StringBuffer("Not Found (try later) ")
log.warning(new StringBuilder("Not Found (try later) ")
.append(",C_AcctSchema_ID=").append(getC_AcctSchema_ID())
.append(", AD_Table_ID=").append(AD_Table_ID)
.append(",Record_ID=").append(Record_ID)

View File

@ -157,12 +157,12 @@ public class Matcher
// MMatchInv inv = new MMatchInv ();
int M_MatchInv_ID = DB.getNextID (AD_Client_ID, "M_MatchInv", m_trxName);
//
StringBuffer sql = new StringBuffer("INSERT INTO M_MatchInv ("
+ "M_MatchInv_ID, "
+ "AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy, "
+ "M_InOutLine_ID,C_InvoiceLine_ID, "
+ "M_Product_ID,DateTrx,Qty, "
+ "Processing,Processed,Posted) VALUES (")
StringBuilder sql = new StringBuilder("INSERT INTO M_MatchInv (")
.append("M_MatchInv_ID, ")
.append("AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy, ")
.append("M_InOutLine_ID,C_InvoiceLine_ID, ")
.append("M_Product_ID,DateTrx,Qty, ")
.append("Processing,Processed,Posted) VALUES (")
.append(M_MatchInv_ID).append(", ")
.append(AD_Client_ID).append(",").append(AD_Org_ID).append(",'Y',SysDate,0,SysDate,0, ")
.append(M_InOutLine_ID).append(",").append(C_InvoiceLine_ID).append(", ")

View File

@ -236,12 +236,12 @@ public class ProductInfo
*/
private BigDecimal getPriceList (MAcctSchema as, boolean onlyPOPriceList)
{
StringBuffer sql = new StringBuffer (
"SELECT pl.C_Currency_ID, pp.PriceList, pp.PriceStd, pp.PriceLimit "
+ "FROM M_PriceList pl, M_PriceList_Version plv, M_ProductPrice pp "
+ "WHERE pl.M_PriceList_ID = plv.M_PriceList_ID"
+ " AND plv.M_PriceList_Version_ID = pp.M_PriceList_Version_ID"
+ " AND pp.M_Product_ID=?");
StringBuilder sql = new StringBuilder (
"SELECT pl.C_Currency_ID, pp.PriceList, pp.PriceStd, pp.PriceLimit ")
.append("FROM M_PriceList pl, M_PriceList_Version plv, M_ProductPrice pp ")
.append("WHERE pl.M_PriceList_ID = plv.M_PriceList_ID")
.append(" AND plv.M_PriceList_Version_ID = pp.M_PriceList_Version_ID")
.append(" AND pp.M_Product_ID=?");
if (onlyPOPriceList)
sql.append(" AND pl.IsSOPriceList='N'");
sql.append(" ORDER BY pl.IsSOPriceList ASC, plv.ValidFrom DESC");

View File

@ -350,7 +350,7 @@ public final class ImpFormat
for (int i = 0; i < m_rows.size(); i++)
{
ImpFormatRow row = (ImpFormatRow)m_rows.get(i);
StringBuffer entry = new StringBuffer ();
StringBuilder entry = new StringBuilder ();
// Label-Start
if (withLabel)
{
@ -439,7 +439,7 @@ public final class ImpFormat
int length = line.length();
for (int field = 1; field <= fieldNo && pos < length; field++)
{
StringBuffer content = new StringBuffer();
StringBuilder content = new StringBuilder();
// two delimiter directly after each other
if (line.charAt(pos) == delimiter)
{
@ -518,7 +518,7 @@ public final class ImpFormat
// Check if the record is already there ------------------------------
StringBuffer sql = new StringBuffer ("SELECT COUNT(*), MAX(")
StringBuilder sql = new StringBuilder ("SELECT COUNT(*), MAX(")
.append(m_tablePK).append(") FROM ").append(m_tableName)
.append(" WHERE AD_Client_ID=").append(AD_Client_ID).append(" AND (");
//
@ -541,7 +541,7 @@ public final class ImpFormat
whereParentChild += " AND " + nodes[i];
}
}
StringBuffer find = new StringBuffer();
StringBuilder find = new StringBuilder();
if (where1 != null)
find.append(where1);
if (where2 != null)
@ -587,7 +587,7 @@ public final class ImpFormat
if (ID == 0)
{
ID = DB.getNextID(ctx, m_tableName, null); // get ID
sql = new StringBuffer("INSERT INTO ")
sql = new StringBuilder("INSERT INTO ")
.append(m_tableName).append("(").append(m_tablePK).append(",")
.append("AD_Client_ID,AD_Org_ID,Created,CreatedBy,Updated,UpdatedBy,IsActive") // StdFields
.append(") VALUES (").append(ID).append(",")
@ -607,7 +607,7 @@ public final class ImpFormat
log.finer("Old ID=" + ID + " " + find);
// Update Info -------------------------------------------------------
sql = new StringBuffer ("UPDATE ")
sql = new StringBuilder ("UPDATE ")
.append(m_tableName).append(" SET ");
for (int i = 0; i < nodes.length; i++)
sql.append(nodes[i]).append(","); // column=value

View File

@ -731,7 +731,7 @@ public abstract class OFXBankStatementHandler extends DefaultHandler
{
if (!m_controller.saveLine())
{
m_errorMessage = new StringBuffer(m_controller.getErrorMessage());
m_errorMessage = new StringBuffer().append(m_controller.getErrorMessage());
m_errorDescription = new StringBuffer(m_controller.getErrorDescription());
throw new SAXException(m_errorMessage.toString());
}

View File

@ -676,7 +676,7 @@ public class GridFieldVO implements Serializable
*/
public String toString ()
{
StringBuffer sb = new StringBuffer ("MFieldVO[");
StringBuilder sb = new StringBuilder ("MFieldVO[");
sb.append(AD_Column_ID).append("-").append(ColumnName)
.append ("]");
return sb.toString ();

View File

@ -413,7 +413,8 @@ public class GridWindow implements Serializable
*/
public String toString()
{
return "MWindow[" + m_vo.WindowNo + "," + m_vo.Name + " (" + m_vo.AD_Window_ID + ")]";
StringBuilder msgreturn = new StringBuilder("MWindow[").append(m_vo.WindowNo).append(",").append(m_vo.Name).append(" (").append(m_vo.AD_Window_ID).append(")]");
return msgreturn.toString();
} // toString
/**
@ -423,15 +424,15 @@ public class GridWindow implements Serializable
*/
public WebDoc getHelpDoc (boolean javaClient)
{
String title = Msg.getMsg(Env.getCtx(), "Window") + ": " + getName();
StringBuilder title = new StringBuilder(Msg.getMsg(Env.getCtx(), "Window")).append(": ").append(getName());
WebDoc doc = null;
if (javaClient)
{
doc = WebDoc.create (false, title, javaClient);
doc = WebDoc.create (false, title.toString(), javaClient);
}
else // HTML
{
doc = WebDoc.createPopup (title);
doc = WebDoc.createPopup (title.toString());
doc.addPopupClose(Env.getCtx());
}

View File

@ -83,10 +83,10 @@ public class MAccount extends X_C_ValidCombination
ArrayList<Object> params = new ArrayList<Object>();
// Mandatory fields
StringBuilder whereClause = new StringBuilder("AD_Client_ID=?" // #1
+ " AND AD_Org_ID=?"
+ " AND C_AcctSchema_ID=?"
+ " AND Account_ID=?"); // #4
StringBuilder whereClause = new StringBuilder("AD_Client_ID=?") // #1
.append(" AND AD_Org_ID=?")
.append(" AND C_AcctSchema_ID=?")
.append(" AND Account_ID=?"); // #4
params.add(AD_Client_ID);
params.add(AD_Org_ID);
params.add(C_AcctSchema_ID);

View File

@ -191,7 +191,7 @@ public final class MAccountLookup extends Lookup implements Serializable
for(MAccount account :accounts)
{
StringBuilder msglist = new StringBuilder(account.getCombination()).append(" - ")
StringBuilder msglist = new StringBuilder().append(account.getCombination()).append(" - ")
.append(account.getDescription());
list.add (new KeyNamePair(account.getC_ValidCombination_ID(), msglist.toString()));
}

View File

@ -94,7 +94,7 @@ public class MAcctProcessor extends X_C_AcctProcessor
{
this (client.getCtx(), 0, client.get_TrxName());
setClientOrg(client);
StringBuilder msgset = new StringBuilder(client.getName()).append(" - ")
StringBuilder msgset = new StringBuilder().append(client.getName()).append(" - ")
.append(Msg.translate(getCtx(), "C_AcctProcessor_ID"));
setName (msgset.toString());
setSupervisor_ID (Supervisor_ID);

View File

@ -195,7 +195,7 @@ public class MAcctSchema extends X_C_AcctSchema
this (client.getCtx(), 0, client.get_TrxName());
setClientOrg(client);
setC_Currency_ID (currency.getKey());
StringBuilder msgset = new StringBuilder(client.getName()).append(" ").append(getGAAP()).append("/").append(get_ColumnCount()).append(" ").append(currency.getName());
StringBuilder msgset = new StringBuilder().append(client.getName()).append(" ").append(getGAAP()).append("/").append(get_ColumnCount()).append(" ").append(currency.getName());
setName (msgset.toString());
} // MAcctSchema

View File

@ -649,7 +649,7 @@ public final class MAllocationHdr extends X_C_AllocationHdr implements DocAction
*/
public String getDocumentInfo()
{
StringBuilder msgreturn = new StringBuilder(Msg.getElement(getCtx(), "C_AllocationHdr_ID")).append(" ").append(getDocumentNo());
StringBuilder msgreturn = new StringBuilder().append(Msg.getElement(getCtx(), "C_AllocationHdr_ID")).append(" ").append(getDocumentNo());
return msgreturn.toString();
} // getDocumentInfo
@ -661,7 +661,7 @@ public final class MAllocationHdr extends X_C_AllocationHdr implements DocAction
{
try
{
StringBuilder msgctf = new StringBuilder(get_TableName()).append(get_ID()).append("_");
StringBuilder msgctf = new StringBuilder().append(get_TableName()).append(get_ID()).append("_");
File temp = File.createTempFile(msgctf.toString(), ".pdf");
return createPDF (temp);
}

View File

@ -411,15 +411,16 @@ public class MArchive extends X_AD_Archive {
BufferedOutputStream out = null;
try {
// create destination folder
final File destFolder = new File(m_archivePathRoot + File.separator
+ getArchivePathSnippet());
StringBuilder msgfile = new StringBuilder().append(m_archivePathRoot).append(File.separator)
.append(getArchivePathSnippet());
final File destFolder = new File(msgfile.toString());
if (!destFolder.exists()) {
if (!destFolder.mkdirs()) {
log.warning("unable to create folder: " + destFolder.getPath());
}
}
// write to pdf
StringBuilder msgfile = new StringBuilder(m_archivePathRoot).append(File.separator)
msgfile = new StringBuilder().append(m_archivePathRoot).append(File.separator)
.append(getArchivePathSnippet()).append(this.get_ID()).append(".pdf");
final File destFile = new File(msgfile.toString());

View File

@ -187,14 +187,14 @@ public class MAsset extends X_A_Asset
if (deliveryCount > 1)
documentNo.append("_").append(deliveryCount);
// Value
StringBuilder value = new StringBuilder(partner.getValue()).append("_").append(product.getValue());
StringBuilder value = new StringBuilder().append(partner.getValue()).append("_").append(product.getValue());
if (value.length() > 40-documentNo.length())
value.delete(40-documentNo.length(), value.length()).append(documentNo);
setValue(value.toString());
// Name MProduct.afterSave
StringBuilder name = new StringBuilder(partner.getName()).append(" - ").append(product.getName());
StringBuilder name = new StringBuilder().append(partner.getName()).append(" - ").append(product.getName());
if (name.length() > 60)
name.delete(60,name.length());
setName(name.toString());

View File

@ -579,14 +579,14 @@ public class MAttachment extends X_AD_Attachment
FileChannel out = null;
try {
//create destination folder
StringBuilder msgfile = new StringBuilder(m_attachmentPathRoot).append(File.separator).append(getAttachmentPathSnippet());
StringBuilder msgfile = new StringBuilder().append(m_attachmentPathRoot).append(File.separator).append(getAttachmentPathSnippet());
final File destFolder = new File(msgfile.toString());
if(!destFolder.exists()){
if(!destFolder.mkdirs()){
log.warning("unable to create folder: " + destFolder.getPath());
}
}
msgfile = new StringBuilder(m_attachmentPathRoot).append(File.separator)
msgfile = new StringBuilder().append(m_attachmentPathRoot).append(File.separator)
.append(getAttachmentPathSnippet()).append(File.separator).append(entryFile.getName());
final File destFile = new File(msgfile.toString());
in = new FileInputStream(entryFile).getChannel();

View File

@ -125,7 +125,7 @@ public class MBPartnerLocation extends X_C_BPartner_Location {
/** Cached Location */
private MLocation m_location = null;
/** Unique Name */
private StringBuffer m_uniqueName = null;
private String m_uniqueName = null;
private int m_unique = 0;
/**
@ -181,21 +181,21 @@ public class MBPartnerLocation extends X_C_BPartner_Location {
* address
*/
private void makeUnique(MLocation address) {
m_uniqueName = new StringBuffer();
m_uniqueName = "";
// 0 - City
if (m_unique >= 0 || m_uniqueName.length() == 0) {
String xx = address.getCity();
if (xx != null && xx.length() > 0)
m_uniqueName = new StringBuffer(xx);
m_uniqueName = xx;
}
// 1 + Address1
if (m_unique >= 1 || m_uniqueName.length() == 0) {
String xx = address.getAddress1();
if (xx != null && xx.length() > 0) {
if (m_uniqueName.length() > 0)
m_uniqueName.append(" ");
m_uniqueName.append(xx);
m_uniqueName += " ";
m_uniqueName += xx;
}
}
// 2 + Address2
@ -203,8 +203,8 @@ public class MBPartnerLocation extends X_C_BPartner_Location {
String xx = address.getAddress2();
if (xx != null && xx.length() > 0) {
if (m_uniqueName.length() > 0)
m_uniqueName.append(" ");
m_uniqueName.append(xx);
m_uniqueName += " ";
m_uniqueName += xx;
}
}
// 3 - Region
@ -212,8 +212,8 @@ public class MBPartnerLocation extends X_C_BPartner_Location {
String xx = address.getRegionName(true);
if (xx != null && xx.length() > 0) {
if (m_uniqueName.length() > 0)
m_uniqueName.append(" ");
m_uniqueName.append(xx);
m_uniqueName += " ";
m_uniqueName += xx;
}
}
// 4 - ID
@ -221,12 +221,12 @@ public class MBPartnerLocation extends X_C_BPartner_Location {
int id = get_ID();
if (id == 0)
id = address.get_ID();
m_uniqueName.append("#").append(id);
m_uniqueName += "#" + id;
}
} // makeUnique
public String getBPLocName(MLocation address) {
m_uniqueName = new StringBuffer(getName());
m_uniqueName = getName();
m_unique = MSysConfig.getIntValue("START_VALUE_BPLOCATION_NAME", 0,
getAD_Client_ID(), getAD_Org_ID());
if (m_unique < 0 || m_unique > 4)

View File

@ -117,7 +117,7 @@ public class MBankAccount extends X_C_BankAccount
*/
public String getName()
{
StringBuilder msgreturn = new StringBuilder(getBank().getName()).append(" ").append(getAccountNo());
StringBuilder msgreturn = new StringBuilder().append(getBank().getName()).append(" ").append(getAccountNo());
return msgreturn.toString();
} // getName

View File

@ -148,8 +148,10 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
String desc = getDescription();
if (desc == null)
setDescription(description);
else
setDescription(desc + " | " + description);
else{
StringBuilder msgd = new StringBuilder(desc).append(" | ").append(description);
setDescription(msgd.toString());
}
} // addDescription
/**
@ -162,10 +164,10 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
super.setProcessed (processed);
if (get_ID() == 0)
return;
String sql = "UPDATE C_BankStatementLine SET Processed='"
+ (processed ? "Y" : "N")
+ "' WHERE C_BankStatement_ID=" + getC_BankStatement_ID();
int noLine = DB.executeUpdate(sql, get_TrxName());
StringBuilder sql = new StringBuilder("UPDATE C_BankStatementLine SET Processed='")
.append((processed ? "Y" : "N"))
.append("' WHERE C_BankStatement_ID=").append(getC_BankStatement_ID());
int noLine = DB.executeUpdate(sql.toString(), get_TrxName());
m_lines = null;
log.fine("setProcessed - " + processed + " - Lines=" + noLine);
} // setProcessed
@ -194,7 +196,8 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
*/
public String getDocumentInfo()
{
return getBankAccount().getName() + " " + getDocumentNo();
StringBuilder msgreturn = new StringBuilder().append(getBankAccount().getName()).append(" ").append(getDocumentNo());
return msgreturn.toString();
} // getDocumentInfo
/**
@ -205,7 +208,8 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
{
try
{
File temp = File.createTempFile(get_TableName()+get_ID()+"_", ".pdf");
StringBuilder msgfile = new StringBuilder().append(get_TableName()).append(get_ID()).append("_");
File temp = File.createTempFile(msgfile.toString(), ".pdf");
return createPDF (temp);
}
catch (Exception e)
@ -460,16 +464,16 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
MBankStatementLine line = lines[i];
if (line.getStmtAmt().compareTo(Env.ZERO) != 0)
{
String description = Msg.getMsg(getCtx(), "Voided") + " ("
+ Msg.translate(getCtx(), "StmtAmt") + "=" + line.getStmtAmt();
StringBuilder description = new StringBuilder(Msg.getMsg(getCtx(), "Voided")).append(" (")
.append(Msg.translate(getCtx(), "StmtAmt")).append("=").append(line.getStmtAmt());
if (line.getTrxAmt().compareTo(Env.ZERO) != 0)
description += ", " + Msg.translate(getCtx(), "TrxAmt") + "=" + line.getTrxAmt();
description.append(", ").append(Msg.translate(getCtx(), "TrxAmt")).append("=").append(line.getTrxAmt());
if (line.getChargeAmt().compareTo(Env.ZERO) != 0)
description += ", " + Msg.translate(getCtx(), "ChargeAmt") + "=" + line.getChargeAmt();
description.append(", ").append(Msg.translate(getCtx(), "ChargeAmt")).append("=").append(line.getChargeAmt());
if (line.getInterestAmt().compareTo(Env.ZERO) != 0)
description += ", " + Msg.translate(getCtx(), "InterestAmt") + "=" + line.getInterestAmt();
description += ")";
line.addDescription(description);
description.append(", ").append(Msg.translate(getCtx(), "InterestAmt")).append("=").append(line.getInterestAmt());
description.append(")");
line.addDescription(description.toString());
//
line.setStmtAmt(Env.ZERO);
line.setTrxAmt(Env.ZERO);
@ -585,7 +589,7 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
*/
public String getSummary()
{
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
sb.append(getName());
// : Total Lines = 123.00 (#1)
sb.append(": ")

View File

@ -263,7 +263,7 @@ public class MCStage extends X_CM_CStage
*/
protected boolean checkElements () {
X_CM_Template thisTemplate = new X_CM_Template(getCtx(), this.getCM_Template_ID(), get_TrxName());
StringBuilder thisElementList = new StringBuilder(thisTemplate.getElements());
StringBuilder thisElementList = new StringBuilder().append(thisTemplate.getElements());
while (thisElementList.indexOf("\n")>=0) {
String thisElement = thisElementList.substring(0,thisElementList.indexOf("\n"));
thisElementList.delete(0,thisElementList.indexOf("\n")+1);

View File

@ -113,7 +113,7 @@ public class MCalendar extends X_C_Calendar
{
super(client.getCtx(), 0, client.get_TrxName());
setClientOrg(client);
StringBuilder msgset = new StringBuilder(client.getName()).append(" ").append(Msg.translate(client.getCtx(), "C_Calendar_ID"));
StringBuilder msgset = new StringBuilder().append(client.getName()).append(" ").append(Msg.translate(client.getCtx(), "C_Calendar_ID"));
setName(msgset.toString());
} // MCalendar

View File

@ -159,9 +159,10 @@ public class MCash extends X_C_Cash implements DocAction
Timestamp today = TimeUtil.getDay(System.currentTimeMillis());
setStatementDate (today); // @#Date@
setDateAcct (today); // @#Date@
String name = DisplayType.getDateFormat(DisplayType.Date).format(today)
+ " " + MOrg.get(ctx, getAD_Org_ID()).getValue();
setName (name);
StringBuilder name = new StringBuilder(DisplayType.getDateFormat(DisplayType.Date).format(today))
.append(" ").append(MOrg.get(ctx, getAD_Org_ID()).getValue());
setName (name.toString());
setIsApproved(false);
setPosted (false); // N
setProcessed (false);
@ -193,9 +194,9 @@ public class MCash extends X_C_Cash implements DocAction
{
setStatementDate (today);
setDateAcct (today);
String name = DisplayType.getDateFormat(DisplayType.Date).format(today)
+ " " + cb.getName();
setName (name);
StringBuilder name = new StringBuilder(DisplayType.getDateFormat(DisplayType.Date).format(today))
.append(" ").append(cb.getName());
setName (name.toString());
}
m_book = cb;
} // MCash
@ -254,7 +255,8 @@ public class MCash extends X_C_Cash implements DocAction
*/
public String getDocumentInfo()
{
return Msg.getElement(getCtx(), "C_Cash_ID") + " " + getDocumentNo();
StringBuilder msgreturn = new StringBuilder().append(Msg.getElement(getCtx(), "C_Cash_ID")).append(" ").append(getDocumentNo());
return msgreturn.toString();
} // getDocumentInfo
/**
@ -265,7 +267,8 @@ public class MCash extends X_C_Cash implements DocAction
{
try
{
File temp = File.createTempFile(get_TableName()+get_ID()+"_", ".pdf");
StringBuilder msgfile = new StringBuilder().append(get_TableName()).append(get_ID()).append("_");
File temp = File.createTempFile(msgfile.toString(), ".pdf");
return createPDF (temp);
}
catch (Exception e)
@ -470,11 +473,11 @@ public class MCash extends X_C_Cash implements DocAction
return DocAction.STATUS_Invalid;
}
//
String name = Msg.translate(getCtx(), "C_Cash_ID") + ": " + getName()
+ " - " + Msg.translate(getCtx(), "Line") + " " + line.getLine();
StringBuilder name = new StringBuilder().append(Msg.translate(getCtx(), "C_Cash_ID")).append(": ").append(getName())
.append(" - ").append(Msg.translate(getCtx(), "Line")).append(" ").append(line.getLine());
MAllocationHdr hdr = new MAllocationHdr(getCtx(), false,
getDateAcct(), line.getC_Currency_ID(),
name, get_TrxName());
name.toString(), get_TrxName());
hdr.setAD_Org_ID(getAD_Org_ID());
if (!hdr.save())
{
@ -621,9 +624,10 @@ public class MCash extends X_C_Cash implements DocAction
cashline.setAmount(Env.ZERO);
cashline.setDiscountAmt(Env.ZERO);
cashline.setWriteOffAmt(Env.ZERO);
cashline.addDescription(Msg.getMsg(getCtx(), "Voided")
+ " (Amount=" + oldAmount + ", Discount=" + oldDiscount
+ ", WriteOff=" + oldWriteOff + ", )");
StringBuilder msgadd = new StringBuilder().append(Msg.getMsg(getCtx(), "Voided"))
.append(" (Amount=").append(oldAmount).append(", Discount=").append(oldDiscount)
.append(", WriteOff=").append(oldWriteOff).append(", )");
cashline.addDescription(msgadd.toString());
if (MCashLine.CASHTYPE_BankAccountTransfer.equals(cashline.getCashType()))
{
if (cashline.getC_Payment_ID() == 0)
@ -659,8 +663,10 @@ public class MCash extends X_C_Cash implements DocAction
String desc = getDescription();
if (desc == null)
setDescription(description);
else
setDescription(desc + " | " + description);
else{
StringBuilder msgd = new StringBuilder(desc).append(" | ").append(description);
setDescription(msgd.toString());
}
} // addDescription
/**
@ -760,10 +766,10 @@ public class MCash extends X_C_Cash implements DocAction
public void setProcessed (boolean processed)
{
super.setProcessed (processed);
String sql = "UPDATE C_CashLine SET Processed='"
+ (processed ? "Y" : "N")
+ "' WHERE C_Cash_ID=" + getC_Cash_ID();
int noLine = DB.executeUpdate (sql, get_TrxName());
StringBuilder sql = new StringBuilder("UPDATE C_CashLine SET Processed='")
.append((processed ? "Y" : "N"))
.append("' WHERE C_Cash_ID=").append(getC_Cash_ID());
int noLine = DB.executeUpdate (sql.toString(), get_TrxName());
m_lines = null;
log.fine(processed + " - Lines=" + noLine);
} // setProcessed
@ -774,7 +780,7 @@ public class MCash extends X_C_Cash implements DocAction
*/
public String toString ()
{
StringBuffer sb = new StringBuffer ("MCash[");
StringBuilder sb = new StringBuilder ("MCash[");
sb.append (get_ID ())
.append ("-").append (getName())
.append(", Balance=").append(getBeginningBalance())
@ -789,7 +795,7 @@ public class MCash extends X_C_Cash implements DocAction
*/
public String getSummary()
{
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
sb.append(getName());
// : Total Lines = 123.00 (#1)
sb.append(": ")

View File

@ -61,7 +61,7 @@ public class MChangeRequest extends X_M_ChangeRequest
{
this (request.getCtx(), 0, request.get_TrxName());
setClientOrg(request);
StringBuilder msgset = new StringBuilder(Msg.getElement(getCtx(), "R_Request_ID")).append(": ").append(request.getDocumentNo());
StringBuilder msgset = new StringBuilder().append(Msg.getElement(getCtx(), "R_Request_ID")).append(": ").append(request.getDocumentNo());
setName(msgset.toString());
setHelp(request.getSummary());
//

View File

@ -311,7 +311,7 @@ public class MClient extends X_AD_Client
while (rs.next())
{
String value = rs.getString(1);
StringBuilder name = new StringBuilder(getName()).append(" ").append(rs.getString(2));
StringBuilder name = new StringBuilder().append(getName()).append(" ").append(rs.getString(2));
//
if (value.equals(X_AD_Tree.TREETYPE_Organization))
{

View File

@ -218,7 +218,7 @@ public class MClientShare extends X_AD_ClientShare
.append(getTableName())
.append(" SET AD_Org_ID=0 WHERE AD_Org_ID<>0 AND AD_Client_ID=?");
int no = DB.executeUpdate(sql.toString(), getAD_Client_ID(), get_TrxName());
info = new StringBuilder(getTableName()).append(" set to Shared #").append(no);
info = new StringBuilder().append(getTableName()).append(" set to Shared #").append(no);
log.info(info.toString());
}
else if (isOrgLevelOnly())
@ -227,7 +227,7 @@ public class MClientShare extends X_AD_ClientShare
.append(getTableName())
.append(" WHERE AD_Org_ID=0 AND AD_Client_ID=?");
int no = DB.getSQLValue(get_TrxName(), sql.toString(), getAD_Client_ID());
info = new StringBuilder(getTableName()).append(" Shared records #").append(no);
info = new StringBuilder().append(getTableName()).append(" Shared records #").append(no);
log.info(info.toString());
}
return info.toString();

View File

@ -345,7 +345,7 @@ public class MColumn extends X_AD_Column
if (isVirtualColumn())
return null;
StringBuilder sql = new StringBuilder (getColumnName())
StringBuilder sql = new StringBuilder ().append(getColumnName())
.append(" ").append(getSQLDataType());
// Default

View File

@ -167,7 +167,7 @@ public class MGLCategory extends X_GL_Category
@Override
public String toString()
{
StringBuilder msgreturn = new StringBuilder(getClass().getSimpleName()).append("[").append(get_ID())
StringBuilder msgreturn = new StringBuilder().append(getClass().getSimpleName()).append("[").append(get_ID())
.append(", Name=").append(getName())
.append(", IsDefault=").append(isDefault())
.append(", IsActive=").append(isActive())

View File

@ -564,8 +564,10 @@ public class MInOut extends X_M_InOut implements DocAction
String desc = getDescription();
if (desc == null)
setDescription(description);
else
setDescription(desc + " | " + description);
else{
StringBuilder msgd = new StringBuilder(desc).append(" | ").append(description);
setDescription(msgd.toString());
}
} // addDescription
/**
@ -574,7 +576,7 @@ public class MInOut extends X_M_InOut implements DocAction
*/
public String toString ()
{
StringBuffer sb = new StringBuffer ("MInOut[")
StringBuilder sb = new StringBuilder ("MInOut[")
.append (get_ID()).append("-").append(getDocumentNo())
.append(",DocStatus=").append(getDocStatus())
.append ("]");
@ -588,7 +590,8 @@ public class MInOut extends X_M_InOut implements DocAction
public String getDocumentInfo()
{
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
return dt.getName() + " " + getDocumentNo();
StringBuilder msgreturn = new StringBuilder().append(dt.getName()).append(" ").append(getDocumentNo());
return msgreturn.toString();
} // getDocumentInfo
/**
@ -599,7 +602,8 @@ public class MInOut extends X_M_InOut implements DocAction
{
try
{
File temp = File.createTempFile(get_TableName()+get_ID()+"_", ".pdf");
StringBuilder msgfile = new StringBuilder().append(get_TableName()).append(get_ID()).append("_");
File temp = File.createTempFile(msgfile.toString(), ".pdf");
return createPDF (temp);
}
catch (Exception e)
@ -801,10 +805,10 @@ public class MInOut extends X_M_InOut implements DocAction
super.setProcessed (processed);
if (get_ID() == 0)
return;
String sql = "UPDATE M_InOutLine SET Processed='"
+ (processed ? "Y" : "N")
+ "' WHERE M_InOut_ID=" + getM_InOut_ID();
int noLine = DB.executeUpdate(sql, get_TrxName());
StringBuilder sql = new StringBuilder("UPDATE M_InOutLine SET Processed='")
.append((processed ? "Y" : "N"))
.append("' WHERE M_InOut_ID=").append(getM_InOut_ID());
int noLine = DB.executeUpdate(sql.toString(), get_TrxName());
m_lines = null;
log.fine(processed + " - Lines=" + noLine);
} // setProcessed
@ -1045,12 +1049,12 @@ public class MInOut extends X_M_InOut implements DocAction
if (is_ValueChanged("AD_Org_ID"))
{
String sql = "UPDATE M_InOutLine ol"
+ " SET AD_Org_ID ="
+ "(SELECT AD_Org_ID"
+ " FROM M_InOut o WHERE ol.M_InOut_ID=o.M_InOut_ID) "
+ "WHERE M_InOut_ID=" + getC_Order_ID();
int no = DB.executeUpdate(sql, get_TrxName());
StringBuilder sql = new StringBuilder("UPDATE M_InOutLine ol")
.append(" SET AD_Org_ID =")
.append("(SELECT AD_Org_ID")
.append(" FROM M_InOut o WHERE ol.M_InOut_ID=o.M_InOut_ID) ")
.append("WHERE M_InOut_ID=").append(getC_Order_ID());
int no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Lines -> #" + no);
}
return true;
@ -1265,7 +1269,7 @@ public class MInOut extends X_M_InOut implements DocAction
if (!isApproved())
approveIt();
log.info(toString());
StringBuffer info = new StringBuffer();
StringBuilder info = new StringBuilder();
// For all lines
MInOutLine[] lines = getLines(false);
@ -1970,7 +1974,8 @@ public class MInOut extends X_M_InOut implements DocAction
if (old.signum() != 0)
{
line.setQty(Env.ZERO);
line.addDescription("Void (" + old + ")");
StringBuilder msgadd = new StringBuilder("Void (").append(old).append(")");
line.addDescription(msgadd.toString());
line.saveEx(get_TrxName());
}
}
@ -2100,14 +2105,16 @@ public class MInOut extends X_M_InOut implements DocAction
if (asset != null)
{
asset.setIsActive(false);
asset.addDescription("(" + reversal.getDocumentNo() + " #" + rLine.getLine() + "<-)");
StringBuilder msgadd = new StringBuilder("(").append(reversal.getDocumentNo()).append(" #").append(rLine.getLine()).append("<-)");
asset.addDescription(msgadd.toString());
asset.saveEx();
}
}
reversal.setC_Order_ID(getC_Order_ID());
// Set M_RMA_ID
reversal.setM_RMA_ID(getM_RMA_ID());
reversal.addDescription("{->" + getDocumentNo() + ")");
StringBuilder msgadd = new StringBuilder("{->").append(getDocumentNo()).append(")");
reversal.addDescription(msgadd.toString());
//FR1948157
reversal.setReversal_ID(getM_InOut_ID());
reversal.saveEx(get_TrxName());
@ -2124,7 +2131,8 @@ public class MInOut extends X_M_InOut implements DocAction
reversal.setDocAction(DOCACTION_None);
reversal.saveEx(get_TrxName());
//
addDescription("(" + reversal.getDocumentNo() + "<-)");
msgadd = new StringBuilder("(").append(reversal.getDocumentNo()).append("<-)");
addDescription(msgadd.toString());
//
// Void Confirmations
@ -2193,7 +2201,7 @@ public class MInOut extends X_M_InOut implements DocAction
*/
public String getSummary()
{
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
sb.append(getDocumentNo());
// : Total Lines = 123.00 (#1)
sb.append(":")

View File

@ -174,8 +174,10 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
String desc = getDescription();
if (desc == null)
setDescription(description);
else
setDescription(desc + " | " + description);
else{
StringBuilder msgd = new StringBuilder(desc).append(" | ").append(description);
setDescription(msgd.toString());
}
} // addDescription
/**
@ -193,7 +195,7 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
*/
public String toString ()
{
StringBuffer sb = new StringBuffer ("MInOutConfirm[");
StringBuilder sb = new StringBuilder ("MInOutConfirm[");
sb.append(get_ID()).append("-").append(getSummary())
.append ("]");
return sb.toString ();
@ -205,7 +207,8 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
*/
public String getDocumentInfo()
{
return Msg.getElement(getCtx(), "M_InOutConfirm_ID") + " " + getDocumentNo();
StringBuilder msgreturn = new StringBuilder().append(Msg.getElement(getCtx(), "M_InOutConfirm_ID")).append(" ").append(getDocumentNo());
return msgreturn.toString();
} // getDocumentInfo
/**
@ -216,7 +219,8 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
{
try
{
File temp = File.createTempFile(get_TableName()+get_ID()+"_", ".pdf");
StringBuilder msgfile = new StringBuilder().append(get_TableName()).append(get_ID()).append("_");
File temp = File.createTempFile(msgfile.toString(), ".pdf");
return createPDF (temp);
}
catch (Exception e)
@ -249,11 +253,11 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
{
int AD_User_ID = Env.getAD_User_ID(getCtx());
MUser user = MUser.get(getCtx(), AD_User_ID);
String info = user.getName()
+ ": "
+ Msg.translate(getCtx(), "IsApproved")
+ " - " + new Timestamp(System.currentTimeMillis());
addDescription(info);
StringBuilder info = new StringBuilder().append(user.getName())
.append(": ")
.append(Msg.translate(getCtx(), "IsApproved"))
.append(" - ").append(new Timestamp(System.currentTimeMillis()));
addDescription(info.toString());
}
super.setIsApproved (IsApproved);
} // setIsApproved
@ -490,10 +494,12 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
if (split == null)
{
split = new MInOut (original, C_DocType_ID, original.getMovementDate());
split.addDescription("Splitted from " + original.getDocumentNo());
StringBuilder msgd = new StringBuilder("Splitted from ").append(original.getDocumentNo());
split.addDescription(msgd.toString());
split.setIsInDispute(true);
split.saveEx();
original.addDescription("Split: " + split.getDocumentNo());
msgd = new StringBuilder("Split: ").append(split.getDocumentNo());
original.addDescription(msgd.toString());
original.saveEx();
}
//
@ -508,12 +514,14 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
splitLine.setM_Product_ID(oldLine.getM_Product_ID());
splitLine.setM_Warehouse_ID(oldLine.getM_Warehouse_ID());
splitLine.setRef_InOutLine_ID(oldLine.getRef_InOutLine_ID());
splitLine.addDescription("Split: from " + oldLine.getMovementQty());
StringBuilder msgd = new StringBuilder("Split: from ").append(oldLine.getMovementQty());
splitLine.addDescription(msgd.toString());
// Qtys
splitLine.setQty(differenceQty); // Entered/Movement
splitLine.saveEx();
// Old
oldLine.addDescription("Splitted: from " + oldLine.getMovementQty());
msgd = new StringBuilder("Splitted: from ").append(oldLine.getMovementQty());
oldLine.addDescription(msgd.toString());
oldLine.setQty(oldLine.getMovementQty().subtract(differenceQty));
oldLine.saveEx();
// Update Confirmation Line
@ -595,7 +603,8 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
if (m_creditMemo == null)
{
m_creditMemo = new MInvoice (inout, null);
m_creditMemo.setDescription(Msg.translate(getCtx(), "M_InOutConfirm_ID") + " " + getDocumentNo());
StringBuilder msgd = new StringBuilder().append(Msg.translate(getCtx(), "M_InOutConfirm_ID")).append(" ").append(getDocumentNo());
m_creditMemo.setDescription(msgd.toString());
m_creditMemo.setC_DocTypeTarget_ID(MDocType.DOCBASETYPE_APCreditMemo);
m_creditMemo.saveEx();
setC_Invoice_ID(m_creditMemo.getC_Invoice_ID());
@ -620,7 +629,8 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
{
MWarehouse wh = MWarehouse.get(getCtx(), inout.getM_Warehouse_ID());
m_inventory = new MInventory (wh, get_TrxName());
m_inventory.setDescription(Msg.translate(getCtx(), "M_InOutConfirm_ID") + " " + getDocumentNo());
StringBuilder msgd = new StringBuilder().append(Msg.translate(getCtx(), "M_InOutConfirm_ID")).append(" ").append(getDocumentNo());
m_inventory.setDescription(msgd.toString());
m_inventory.saveEx();
setM_Inventory_ID(m_inventory.getM_Inventory_ID());
}
@ -794,7 +804,7 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
*/
public String getSummary()
{
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
sb.append(getDocumentNo());
// : Total Lines = 123.00 (#1)
sb.append(": ")

View File

@ -162,8 +162,10 @@ public class MInventory extends X_M_Inventory implements DocAction
String desc = getDescription();
if (desc == null)
setDescription(description);
else
setDescription(desc + " | " + description);
else{
StringBuilder msgreturn = new StringBuilder(desc).append(" | ").append(description);
setDescription(msgreturn.toString());
}
} // addDescription
/**
@ -182,7 +184,7 @@ public class MInventory extends X_M_Inventory implements DocAction
*/
public String toString ()
{
StringBuffer sb = new StringBuffer ("MInventory[");
StringBuilder sb = new StringBuilder ("MInventory[");
sb.append (get_ID())
.append ("-").append (getDocumentNo())
.append (",M_Warehouse_ID=").append(getM_Warehouse_ID())
@ -197,7 +199,8 @@ public class MInventory extends X_M_Inventory implements DocAction
public String getDocumentInfo()
{
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
return dt.getName() + " " + getDocumentNo();
StringBuilder msgreturn = new StringBuilder().append(dt.getName()).append(" ").append(getDocumentNo());
return msgreturn.toString();
} // getDocumentInfo
/**
@ -208,7 +211,8 @@ public class MInventory extends X_M_Inventory implements DocAction
{
try
{
File temp = File.createTempFile(get_TableName()+get_ID()+"_", ".pdf");
StringBuilder msgfile = new StringBuilder().append(get_TableName()).append(get_ID()).append("_");
File temp = File.createTempFile(msgfile.toString(), ".pdf");
return createPDF (temp);
}
catch (Exception e)
@ -688,7 +692,8 @@ public class MInventory extends X_M_Inventory implements DocAction
{
line.setQtyInternalUse(Env.ZERO);
line.setQtyCount(line.getQtyBook());
line.addDescription("Void (" + oldCount + "/" + oldInternal + ")");
StringBuilder msgd = new StringBuilder("Void (").append(oldCount).append("/").append(oldInternal).append(")");
line.addDescription(msgd.toString());
line.saveEx(get_TrxName());
}
}
@ -750,7 +755,8 @@ public class MInventory extends X_M_Inventory implements DocAction
reversal.setIsApproved (false);
reversal.setPosted(false);
reversal.setProcessed(false);
reversal.addDescription("{->" + getDocumentNo() + ")");
StringBuilder msgd = new StringBuilder("{->").append(getDocumentNo()).append(")");
reversal.addDescription(msgd.toString());
//FR1948157
reversal.setReversal_ID(getM_Inventory_ID());
reversal.saveEx();
@ -802,7 +808,8 @@ public class MInventory extends X_M_Inventory implements DocAction
m_processMsg = reversal.getDocumentNo();
// Update Reversed (this)
addDescription("(" + reversal.getDocumentNo() + "<-)");
msgd = new StringBuilder("(").append(reversal.getDocumentNo()).append("<-)");
addDescription(msgd.toString());
// After reverseCorrect
m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSECORRECT);
if (m_processMsg != null)
@ -863,7 +870,7 @@ public class MInventory extends X_M_Inventory implements DocAction
*/
public String getSummary()
{
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
sb.append(getDocumentNo());
// : Total Lines = 123.00 (#1)
sb.append(": ")

View File

@ -219,7 +219,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
*/
public static String getPDFFileName (String documentDir, int C_Invoice_ID)
{
StringBuffer sb = new StringBuffer (documentDir);
StringBuilder sb = new StringBuilder (documentDir);
if (sb.length() == 0)
sb.append(".");
if (!sb.toString().endsWith(File.separator))
@ -825,8 +825,10 @@ public class MInvoice extends X_C_Invoice implements DocAction
String desc = getDescription();
if (desc == null)
setDescription(description);
else
setDescription(desc + " | " + description);
else{
StringBuilder msgd = new StringBuilder(desc).append(" | ").append(description);
setDescription(msgd.toString());
}
} // addDescription
/**
@ -851,11 +853,14 @@ public class MInvoice extends X_C_Invoice implements DocAction
super.setProcessed (processed);
if (get_ID() == 0)
return;
String set = "SET Processed='"
+ (processed ? "Y" : "N")
+ "' WHERE C_Invoice_ID=" + getC_Invoice_ID();
int noLine = DB.executeUpdate("UPDATE C_InvoiceLine " + set, get_TrxName());
int noTax = DB.executeUpdate("UPDATE C_InvoiceTax " + set, get_TrxName());
StringBuilder set = new StringBuilder("SET Processed='")
.append((processed ? "Y" : "N"))
.append("' WHERE C_Invoice_ID=").append(getC_Invoice_ID());
StringBuilder msgdb = new StringBuilder("UPDATE C_InvoiceLine ").append(set);
int noLine = DB.executeUpdate(msgdb.toString(), get_TrxName());
msgdb = new StringBuilder("UPDATE C_InvoiceTax ").append(set);
int noTax = DB.executeUpdate(msgdb.toString(), get_TrxName());
m_lines = null;
m_taxes = null;
log.fine(processed + " - Lines=" + noLine + ", Tax=" + noTax);
@ -1021,7 +1026,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
*/
public String toString ()
{
StringBuffer sb = new StringBuffer ("MInvoice[")
StringBuilder sb = new StringBuilder ("MInvoice[")
.append(get_ID()).append("-").append(getDocumentNo())
.append(",GrandTotal=").append(getGrandTotal());
if (m_lines != null)
@ -1037,7 +1042,8 @@ public class MInvoice extends X_C_Invoice implements DocAction
public String getDocumentInfo()
{
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
return dt.getName() + " " + getDocumentNo();
StringBuilder msgreturn = new StringBuilder().append(dt.getName()).append(" ").append(getDocumentNo());
return msgreturn.toString();
} // getDocumentInfo
@ -1054,12 +1060,12 @@ public class MInvoice extends X_C_Invoice implements DocAction
if (is_ValueChanged("AD_Org_ID"))
{
String sql = "UPDATE C_InvoiceLine ol"
+ " SET AD_Org_ID ="
+ "(SELECT AD_Org_ID"
+ " FROM C_Invoice o WHERE ol.C_Invoice_ID=o.C_Invoice_ID) "
+ "WHERE C_Invoice_ID=" + getC_Invoice_ID();
int no = DB.executeUpdate(sql, get_TrxName());
StringBuilder sql = new StringBuilder("UPDATE C_InvoiceLine ol")
.append(" SET AD_Org_ID =")
.append("(SELECT AD_Org_ID")
.append(" FROM C_Invoice o WHERE ol.C_Invoice_ID=o.C_Invoice_ID) ")
.append("WHERE C_Invoice_ID=").append(getC_Invoice_ID());
int no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Lines -> #" + no);
}
return true;
@ -1161,7 +1167,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
public static void setIsPaid (Properties ctx, int C_BPartner_ID, String trxName)
{
List<Object> params = new ArrayList<Object>();
StringBuffer whereClause = new StringBuffer("IsPaid='N' AND DocStatus IN ('CO','CL')");
StringBuilder whereClause = new StringBuilder("IsPaid='N' AND DocStatus IN ('CO','CL')");
if (C_BPartner_ID > 1)
{
whereClause.append(" AND C_BPartner_ID=?");
@ -1255,7 +1261,8 @@ public class MInvoice extends X_C_Invoice implements DocAction
{
try
{
File temp = File.createTempFile(get_TableName()+get_ID()+"_", ".pdf");
StringBuilder msgfile = new StringBuilder().append(get_TableName()).append(get_ID()).append("_");
File temp = File.createTempFile(msgfile.toString(), ".pdf");
return createPDF (temp);
}
catch (Exception e)
@ -1541,12 +1548,12 @@ public class MInvoice extends X_C_Invoice implements DocAction
line.setPriceList (Env.ZERO);
line.setLineNetAmt (Env.ZERO);
//
String description = product.getName ();
StringBuilder description = new StringBuilder().append(product.getName ());
if (product.getDescription () != null)
description += " " + product.getDescription ();
description.append(" ").append(product.getDescription ());
if (line.getDescription () != null)
description += " " + line.getDescription ();
line.setDescription (description);
description.append(" ").append(line.getDescription ());
line.setDescription (description.toString());
line.saveEx (get_TrxName());
} // for all lines with BOM
@ -1564,7 +1571,8 @@ public class MInvoice extends X_C_Invoice implements DocAction
{
log.fine("");
// Delete Taxes
DB.executeUpdateEx("DELETE C_InvoiceTax WHERE C_Invoice_ID=" + getC_Invoice_ID(), get_TrxName());
StringBuilder msgdb = new StringBuilder("DELETE C_InvoiceTax WHERE C_Invoice_ID=").append(getC_Invoice_ID());
DB.executeUpdateEx(msgdb.toString(), get_TrxName());
m_taxes = null;
// Lines
@ -1706,7 +1714,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
if (!isApproved())
approveIt();
log.info(toString());
StringBuffer info = new StringBuffer();
StringBuilder info = new StringBuilder();
// POS supports multiple payments
boolean fromPOS = false;
@ -1911,7 +1919,8 @@ public class MInvoice extends X_C_Invoice implements DocAction
{
MUser user = new MUser (getCtx(), getAD_User_ID(), get_TrxName());
user.setLastContact(new Timestamp(System.currentTimeMillis()));
user.setLastResult(Msg.translate(getCtx(), "C_Invoice_ID") + ": " + getDocumentNo());
StringBuilder msgset = new StringBuilder().append(Msg.translate(getCtx(), "C_Invoice_ID")).append(": ").append(getDocumentNo());
user.setLastResult(msgset.toString());
if (!user.save(get_TrxName()))
{
m_processMsg = "Could not update Business Partner User";
@ -2124,7 +2133,8 @@ public class MInvoice extends X_C_Invoice implements DocAction
line.setTaxAmt(Env.ZERO);
line.setLineNetAmt(Env.ZERO);
line.setLineTotalAmt(Env.ZERO);
line.addDescription(Msg.getMsg(getCtx(), "Voided") + " (" + old + ")");
StringBuilder msgadd = new StringBuilder(Msg.getMsg(getCtx(), "Voided")).append(" (").append(old).append(")");
line.addDescription(msgadd.toString());
// Unlink Shipment
if (line.getM_InOutLine_ID() != 0)
{
@ -2252,7 +2262,8 @@ public class MInvoice extends X_C_Invoice implements DocAction
}
}
reversal.setC_Order_ID(getC_Order_ID());
reversal.addDescription("{->" + getDocumentNo() + ")");
StringBuilder msgadd = new StringBuilder("{->").append(getDocumentNo()).append(")");
reversal.addDescription(msgadd.toString());
//FR1948157
reversal.setReversal_ID(getC_Invoice_ID());
reversal.saveEx(get_TrxName());
@ -2271,7 +2282,8 @@ public class MInvoice extends X_C_Invoice implements DocAction
reversal.saveEx(get_TrxName());
m_processMsg = reversal.getDocumentNo();
//
addDescription("(" + reversal.getDocumentNo() + "<-)");
msgadd = new StringBuilder("(").append(reversal.getDocumentNo()).append("<-)");
addDescription(msgadd.toString());
// Clean up Reversed (this)
MInvoiceLine[] iLines = getLines(false);
@ -2297,9 +2309,10 @@ public class MInvoice extends X_C_Invoice implements DocAction
setIsPaid(true);
// Create Allocation
StringBuilder msgall = new StringBuilder().append(Msg.translate(getCtx(), "C_Invoice_ID")).append(": ").append(getDocumentNo()).append("/").append(reversal.getDocumentNo());
MAllocationHdr alloc = new MAllocationHdr(getCtx(), false, getDateAcct(),
getC_Currency_ID(),
Msg.translate(getCtx(), "C_Invoice_ID") + ": " + getDocumentNo() + "/" + reversal.getDocumentNo(),
msgall.toString(),
get_TrxName());
alloc.setAD_Org_ID(getAD_Org_ID());
if (alloc.save())
@ -2381,7 +2394,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
*/
public String getSummary()
{
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
sb.append(getDocumentNo());
// : Grand Total = 123.00 (#1)
sb.append(": ").

View File

@ -155,7 +155,7 @@ public class MIssue extends X_AD_Issue
public MIssue (LogRecord record)
{
this (Env.getCtx(), 0, null);
StringBuilder summary = new StringBuilder(record.getMessage());
String summary = record.getMessage();
setSourceClassName(record.getSourceClassName());
setSourceMethodName(record.getSourceMethodName());
setLoggerName(record.getLoggerName());
@ -163,9 +163,9 @@ public class MIssue extends X_AD_Issue
if (t != null)
{
if (summary != null && summary.length() > 0)
summary = new StringBuilder(t.toString()).append(" ").append(summary);
summary = t.toString() + " " + summary;
if (summary == null || summary.length() == 0)
summary = new StringBuilder(t.toString());
summary = t.toString();
//
StringBuilder error = new StringBuilder();
StackTraceElement[] tes = t.getStackTrace();
@ -179,7 +179,7 @@ public class MIssue extends X_AD_Issue
error.append(s).append("\n");
if (count == 0)
{
StringBuilder source = new StringBuilder(element.getClassName())
StringBuilder source = new StringBuilder().append(element.getClassName())
.append(".").append(element.getMethodName());
setSourceClassName(source.toString());
setLineNo(element.getLineNumber());
@ -197,7 +197,7 @@ public class MIssue extends X_AD_Issue
setStackTrace(cWriter.toString());
}
if (summary == null || summary.length() == 0)
summary = new StringBuilder("??");
summary = "??";
setIssueSummary(summary.toString());
setRecord_ID(1);
} // MIssue

View File

@ -203,8 +203,10 @@ public class MJournal extends X_GL_Journal implements DocAction
String desc = getDescription();
if (desc == null)
setDescription(description);
else
setDescription(desc + " | " + description);
else{
StringBuilder msgd = new StringBuilder(desc).append(" | ").append(description);
setDescription(msgd.toString());
}
}
/**************************************************************************
@ -279,10 +281,10 @@ public class MJournal extends X_GL_Journal implements DocAction
super.setProcessed (processed);
if (get_ID() == 0)
return;
String sql = "UPDATE GL_JournalLine SET Processed='"
+ (processed ? "Y" : "N")
+ "' WHERE GL_Journal_ID=" + getGL_Journal_ID();
int noLine = DB.executeUpdate(sql, get_TrxName());
StringBuilder sql = new StringBuilder("UPDATE GL_JournalLine SET Processed='")
.append((processed ? "Y" : "N"))
.append("' WHERE GL_Journal_ID=").append(getGL_Journal_ID());
int noLine = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine(processed + " - Lines=" + noLine);
} // setProcessed
@ -372,11 +374,11 @@ public class MJournal extends X_GL_Journal implements DocAction
private boolean updateBatch()
{
if (getGL_JournalBatch_ID()!=0) { // idempiere 344 - nmicoud
String sql = "UPDATE GL_JournalBatch jb"
+ " SET (TotalDr, TotalCr) = (SELECT COALESCE(SUM(TotalDr),0), COALESCE(SUM(TotalCr),0)"
+ " FROM GL_Journal j WHERE j.IsActive='Y' AND jb.GL_JournalBatch_ID=j.GL_JournalBatch_ID) "
+ "WHERE GL_JournalBatch_ID=" + getGL_JournalBatch_ID();
int no = DB.executeUpdate(sql, get_TrxName());
StringBuilder sql = new StringBuilder("UPDATE GL_JournalBatch jb")
.append(" SET (TotalDr, TotalCr) = (SELECT COALESCE(SUM(TotalDr),0), COALESCE(SUM(TotalCr),0)")
.append(" FROM GL_Journal j WHERE j.IsActive='Y' AND jb.GL_JournalBatch_ID=j.GL_JournalBatch_ID) ")
.append("WHERE GL_JournalBatch_ID=").append(getGL_JournalBatch_ID());
int no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 1)
log.warning("afterSave - Update Batch #" + no);
return no == 1;
@ -739,12 +741,14 @@ public class MJournal extends X_GL_Journal implements DocAction
reverse.setC_Period_ID(getC_Period_ID());
reverse.setDateAcct(getDateAcct());
// Reverse indicator
reverse.addDescription("(->" + getDocumentNo() + ")");
StringBuilder msgd = new StringBuilder("(->").append(getDocumentNo()).append(")");
reverse.addDescription(msgd.toString());
//FR [ 1948157 ]
reverse.setReversal_ID(getGL_Journal_ID());
if (!reverse.save())
return null;
addDescription("(" + reverse.getDocumentNo() + "<-)");
msgd = new StringBuilder("(").append(reverse.getDocumentNo()).append("<-)");
addDescription(msgd.toString());
// Lines
reverse.copyLinesFrom(this, null, 'C');
@ -797,12 +801,12 @@ public class MJournal extends X_GL_Journal implements DocAction
reverse.set_ValueNoCheck ("C_Period_ID", null); // reset
reverse.setDateAcct(reverse.getDateDoc());
// Reverse indicator
String description = reverse.getDescription();
if (description == null)
description = "** " + getDocumentNo() + " **";
StringBuilder description;
if (reverse.getDescription() == null)
description = new StringBuilder("** ").append(getDocumentNo()).append(" **");
else
description += " ** " + getDocumentNo() + " **";
reverse.setDescription(description);
description = new StringBuilder(reverse.getDescription()).append(" ** ").append(getDocumentNo()).append(" **");
reverse.setDescription(description.toString());
if (!reverse.save())
return null;
@ -848,7 +852,7 @@ public class MJournal extends X_GL_Journal implements DocAction
*/
public String getSummary()
{
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
sb.append(getDocumentNo());
// : Total Lines = 123.00 (#1)
sb.append(": ")
@ -868,7 +872,7 @@ public class MJournal extends X_GL_Journal implements DocAction
*/
public String toString ()
{
StringBuffer sb = new StringBuffer ("MJournal[");
StringBuilder sb = new StringBuilder ("MJournal[");
sb.append(get_ID()).append(",").append(getDescription())
.append(",DR=").append(getTotalDr())
.append(",CR=").append(getTotalCr())
@ -883,7 +887,8 @@ public class MJournal extends X_GL_Journal implements DocAction
public String getDocumentInfo()
{
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
return dt.getName() + " " + getDocumentNo();
StringBuilder msgreturn = new StringBuilder().append(dt.getName()).append(" ").append(getDocumentNo());
return msgreturn.toString();
} // getDocumentInfo
/**
@ -894,7 +899,8 @@ public class MJournal extends X_GL_Journal implements DocAction
{
try
{
File temp = File.createTempFile(get_TableName()+get_ID()+"_", ".pdf");
StringBuilder msgfile = new StringBuilder().append(get_TableName()).append(get_ID()).append("_");
File temp = File.createTempFile(msgfile.toString(), ".pdf");
return createPDF (temp);
}
catch (Exception e)

View File

@ -633,12 +633,12 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
reverse.setC_Period_ID(getC_Period_ID());
reverse.setDateAcct(getDateAcct());
// Reverse indicator
String description = reverse.getDescription();
if (description == null)
description = "** " + getDocumentNo() + " **";
StringBuilder description;
if (reverse.getDescription() == null)
description = new StringBuilder("** ").append(getDocumentNo()).append(" **");
else
description += " ** " + getDocumentNo() + " **";
reverse.setDescription(description);
description = new StringBuilder(reverse.getDescription()).append(" ** ").append(getDocumentNo()).append(" **");
reverse.setDescription(description.toString());
//[ 1948157 ]
reverse.setReversal_ID(getGL_JournalBatch_ID());
reverse.saveEx();
@ -704,12 +704,12 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
reverse.setDateDoc(new Timestamp(System.currentTimeMillis()));
reverse.setDateAcct(reverse.getDateDoc());
// Reverse indicator
String description = reverse.getDescription();
if (description == null)
description = "** " + getDocumentNo() + " **";
StringBuilder description;
if (reverse.getDescription() == null)
description = new StringBuilder("** ").append(getDocumentNo()).append(" **");
else
description += " ** " + getDocumentNo() + " **";
reverse.setDescription(description);
description = new StringBuilder(reverse.getDescription()).append(" ** ").append(getDocumentNo()).append(" **");
reverse.setDescription(description.toString());
reverse.saveEx();
// Reverse Journals
@ -778,7 +778,7 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
*/
public String getSummary()
{
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
sb.append(getDocumentNo());
// : Total Lines = 123.00 (#1)
sb.append(": ")
@ -798,7 +798,7 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
*/
public String toString ()
{
StringBuffer sb = new StringBuffer ("MJournalBatch[");
StringBuilder sb = new StringBuilder ("MJournalBatch[");
sb.append(get_ID()).append(",").append(getDescription())
.append(",DR=").append(getTotalDr())
.append(",CR=").append(getTotalCr())
@ -813,7 +813,8 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
public String getDocumentInfo()
{
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
return dt.getName() + " " + getDocumentNo();
StringBuilder msgreturn = new StringBuilder().append(dt.getName()).append(" ").append(getDocumentNo());
return msgreturn.toString();
} // getDocumentInfo
/**
@ -824,7 +825,8 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
{
try
{
File temp = File.createTempFile(get_TableName()+get_ID()+"_", ".pdf");
StringBuilder msgfile = new StringBuilder().append(get_TableName()).append(get_ID()).append("_");
File temp = File.createTempFile(msgfile.toString(), ".pdf");
return createPDF (temp);
}
catch (Exception e)

View File

@ -414,13 +414,13 @@ public class MLanguage extends X_AD_Language
log.log(Level.SEVERE, "No Columns found for " + baseTable);
return 0;
}
StringBuffer cols = new StringBuffer();
StringBuilder cols = new StringBuilder();
for (int i = 0; i < columns.size(); i++)
cols.append(",").append(columns.get(i));
// Insert Statement
int AD_User_ID = Env.getAD_User_ID(getCtx());
String keyColumn = baseTable + "_ID";
StringBuilder keyColumn = new StringBuilder(baseTable).append("_ID");
StringBuilder insert = new StringBuilder("INSERT INTO ").append(tableName)
.append("(AD_Language,IsTranslated, AD_Client_ID,AD_Org_ID, ")
.append("Createdby,UpdatedBy, ")
@ -441,7 +441,7 @@ public class MLanguage extends X_AD_Language
if (column != null)
UUIDGenerator.updateUUID(column, get_TrxName());
//
StringBuilder msglog = new StringBuilder(tableName).append(" #").append(no);
StringBuilder msglog = new StringBuilder().append(tableName).append(" #").append(no);
log.fine(msglog.toString());
return no;
} // addTable

View File

@ -668,7 +668,7 @@ public final class MLookup extends Lookup implements Serializable
long startTime = System.currentTimeMillis();
if (Ini.isClient())
MLookupCache.loadStart (m_info);
StringBuilder sql = new StringBuilder(m_info.Query);
StringBuilder sql = new StringBuilder().append(m_info.Query);
// not validated
if (!m_info.IsValidated)
@ -737,7 +737,7 @@ public final class MLookup extends Lookup implements Serializable
{
if (rows++ > MAX_ROWS)
{
StringBuilder s = new StringBuilder(m_info.KeyColumn).append(": Loader - Too many records");
StringBuilder s = new StringBuilder().append(m_info.KeyColumn).append(": Loader - Too many records");
if (m_info.Column_ID > 0)
{
MColumn mColumn = MColumn.get(m_info.ctx, m_info.Column_ID);
@ -754,7 +754,7 @@ public final class MLookup extends Lookup implements Serializable
break;
// load data
StringBuilder name = new StringBuilder(rs.getString(3));
StringBuilder name = new StringBuilder().append(rs.getString(3));
boolean isActive = rs.getString(4).equals("Y");
if (!isActive)
{

View File

@ -513,7 +513,7 @@ public class MLookupFactory
ZoomWindow = overrideZoomWindow;
ZoomWindowPO = 0;
}
StringBuilder msginf = new StringBuilder(TableName).append(".").append(KeyColumn);
StringBuilder msginf = new StringBuilder().append(TableName).append(".").append(KeyColumn);
retValue = new MLookupInfo (realSQL.toString(), TableName,
msginf.toString(), ZoomWindow, ZoomWindowPO, zoomQuery);
s_cacheRefTable.put(key.toString(), retValue.cloneIt());
@ -721,7 +721,7 @@ public class MLookupFactory
if (i > 0)
displayColumn.append(" ||'_'|| " );
LookupDisplayColumn ldc = (LookupDisplayColumn)list.get(i);
StringBuilder msg = new StringBuilder(TableName).append(".").append(ldc.ColumnName);
StringBuilder msg = new StringBuilder().append(TableName).append(".").append(ldc.ColumnName);
String columnSQL = ldc.IsVirtual ? ldc.ColumnSQL : msg.toString();
displayColumn.append("NVL(");
@ -797,7 +797,7 @@ public class MLookupFactory
if (CLogMgt.isLevelFinest())
s_log.fine("ColumnName=" + ColumnName + " - " + realSQL);
StringBuilder msginf = new StringBuilder(TableName).append(".").append(KeyColumn);
StringBuilder msginf = new StringBuilder().append(TableName).append(".").append(KeyColumn);
MLookupInfo lInfo = new MLookupInfo(realSQL.toString(), TableName,
msginf.toString(), ZoomWindow, ZoomWindowPO, zoomQuery);
s_cacheRefTable.put(cacheKey.toString(), lInfo.cloneIt());
@ -892,7 +892,7 @@ public class MLookupFactory
if (i > 0)
embedSQL.append("||' - '||" );
LookupDisplayColumn ldc = (LookupDisplayColumn)list.get(i);
StringBuilder msg = new StringBuilder(TableName).append(".").append(ldc.ColumnName);
StringBuilder msg = new StringBuilder().append(TableName).append(".").append(ldc.ColumnName);
String columnSQL = ldc.IsVirtual ? ldc.ColumnSQL : msg.toString();
// translated

View File

@ -307,7 +307,7 @@ public class MMailText extends X_R_MailText
{
if (m_bpartner != null && m_bpartner.getAD_Language() != null)
{
StringBuilder key = new StringBuilder(m_bpartner.getAD_Language()).append(get_ID());
StringBuilder key = new StringBuilder().append(m_bpartner.getAD_Language()).append(get_ID());
MMailTextTrl trl = s_cacheTrl.get(key);
if (trl == null)
{

View File

@ -670,16 +670,16 @@ public final class Find extends CDialog
{
GridField field = m_findFields[c];
String columnName = field.getColumnName();
StringBuilder header = new StringBuilder(field.getHeader());
String header = field.getHeader();
if (header == null || header.length() == 0)
{
header = new StringBuilder(Msg.translate(Env.getCtx(), columnName));
header = Msg.translate(Env.getCtx(), columnName);
if (header == null || header.length() == 0)
continue;
}
if (field.isKey())
header.append((" (ID)"));
ValueNamePair pp = new ValueNamePair(columnName, header.toString());
header += (" (ID)");
ValueNamePair pp = new ValueNamePair(columnName, header);
// System.out.println(pp + " = " + field);
items.add(pp);
}
@ -1056,15 +1056,15 @@ public final class Find extends CDialog
Object value = ved.getValue();
if (value != null && value.toString().length() > 0)
{
StringBuilder ColumnName = new StringBuilder(((Component)ved).getName ());
msglog = new StringBuilder(ColumnName).append("=").append(value);
String ColumnName = ((Component)ved).getName ();
msglog = new StringBuilder().append(ColumnName).append("=").append(value);
log.fine(msglog.toString());
// globalqss - Carlos Ruiz - 20060711
// fix a bug with virtualColumn + isSelectionColumn not yielding results
GridField field = getTargetMField(ColumnName.toString());
boolean isProductCategoryField = isProductCategoryField(field.getAD_Column_ID());
StringBuilder ColumnSQL = new StringBuilder(field.getColumnSQL(false));
StringBuilder ColumnSQL = new StringBuilder().append(field.getColumnSQL(false));
//
// Be more permissive for String columns
if (isSearchLike(field))
@ -1078,11 +1078,11 @@ public final class Find extends CDialog
}
//
if (value.toString().indexOf('%') != -1)
m_query.addRestriction(ColumnSQL.toString(), MQuery.LIKE, value, ColumnName.toString(), ved.getDisplay());
m_query.addRestriction(ColumnSQL.toString(), MQuery.LIKE, value, ColumnName, ved.getDisplay());
else if (isProductCategoryField && value instanceof Integer)
m_query.addRestriction(getSubCategoryWhereClause(((Integer) value).intValue()));
else
m_query.addRestriction(ColumnSQL.toString(), MQuery.EQUAL, value, ColumnName.toString(), ved.getDisplay());
m_query.addRestriction(ColumnSQL.toString(), MQuery.EQUAL, value, ColumnName, ved.getDisplay());
/*
if (value.toString().indexOf('%') != -1)
m_query.addRestriction(ColumnName, MQuery.LIKE, value, ColumnName, ved.getDisplay());
@ -1163,17 +1163,17 @@ public final class Find extends CDialog
Object column = advancedTable.getValueAt(row, INDEX_COLUMNNAME);
if (column == null)
continue;
StringBuilder ColumnName = new StringBuilder(column instanceof ValueNamePair ?
((ValueNamePair)column).getValue() : column.toString());
StringBuilder infoName = new StringBuilder(column.toString());
String ColumnName = column instanceof ValueNamePair ?
((ValueNamePair)column).getValue() : column.toString();
String infoName = column.toString();
//
GridField field = getTargetMField(ColumnName.toString());
if (field == null)
continue;
boolean isProductCategoryField = isProductCategoryField(field.getAD_Column_ID());
StringBuilder ColumnSQL = new StringBuilder(field.getColumnSQL(false));
String ColumnSQL = field.getColumnSQL(false);
StringBuilder lBrackets = new StringBuilder((String) advancedTable.getValueAt(row, INDEX_LEFTBRACKET));
String lBrackets = (String) advancedTable.getValueAt(row, INDEX_LEFTBRACKET);
if ( lBrackets != null )
openBrackets += lBrackets.length();
String rBrackets = (String) advancedTable.getValueAt(row, INDEX_RIGHTBRACKET);
@ -1196,12 +1196,12 @@ public final class Find extends CDialog
if ( MQuery.OPERATORS[MQuery.EQUAL_INDEX].equals(op)
|| MQuery.OPERATORS[MQuery.NOT_EQUAL_INDEX].equals(op) )
{
m_query.addRestriction(ColumnSQL.toString(), Operator, null,
infoName.toString(), null, and, openBrackets);
m_query.addRestriction(ColumnSQL, Operator, null,
infoName, null, and, openBrackets);
if (code.length() > 0)
code.append(SEGMENT_SEPARATOR);
code.append(ColumnName.toString())
code.append(ColumnName)
.append(FIELD_SEPARATOR)
.append(Operator)
.append(FIELD_SEPARATOR)
@ -1241,8 +1241,8 @@ public final class Find extends CDialog
String infoDisplay_to = value2.toString();
if (parsedValue2 == null)
continue;
m_query.addRangeRestriction(ColumnSQL.toString(), parsedValue, parsedValue2,
infoName.toString(), infoDisplay, infoDisplay_to, and, openBrackets);
m_query.addRangeRestriction(ColumnSQL, parsedValue, parsedValue2,
infoName, infoDisplay, infoDisplay_to, and, openBrackets);
}
else if (isProductCategoryField && MQuery.OPERATORS[MQuery.EQUAL_INDEX].equals(op)) {
if (!(parsedValue instanceof Integer)) {
@ -1253,8 +1253,8 @@ public final class Find extends CDialog
.addRestriction(getSubCategoryWhereClause(((Integer) parsedValue).intValue()), and, openBrackets);
}
else
m_query.addRestriction(ColumnSQL.toString(), Operator, parsedValue,
infoName.toString(), infoDisplay, and, openBrackets);
m_query.addRestriction(ColumnSQL, Operator, parsedValue,
infoName, infoDisplay, and, openBrackets);
if (code.length() > 0)
code.append(SEGMENT_SEPARATOR);
@ -1276,17 +1276,17 @@ public final class Find extends CDialog
}
Object selected = fQueryName.getSelectedItem();
if (selected != null && saveQuery) {
StringBuilder name = new StringBuilder(selected.toString());
String name = selected.toString();
if (Util.isEmpty(name.toString(), true))
{
ADialog.warn(m_targetWindowNo, this, "FillMandatory", Msg.translate(Env.getCtx(), "Name"));
return;
}
MUserQuery uq = MUserQuery.get(Env.getCtx(), m_AD_Tab_ID, name.toString());
MUserQuery uq = MUserQuery.get(Env.getCtx(), m_AD_Tab_ID, name);
if (uq == null && code.length() > 0)
{
uq = new MUserQuery (Env.getCtx(), 0, null);
uq.setName (name.toString());
uq.setName (name);
uq.setAD_Tab_ID(m_AD_Tab_ID); //red1 UserQuery [ 1798539 ] taking in new field from Compiere
uq.setAD_User_ID(Env.getAD_User_ID(Env.getCtx())); //red1 - [ 1798539 ] missing in Compiere delayed source :-)
}
@ -1294,11 +1294,11 @@ public final class Find extends CDialog
{
if (uq.delete(true))
{
ADialog.info (m_targetWindowNo, this, "Deleted", name.toString());
ADialog.info (m_targetWindowNo, this, "Deleted", name);
refreshUserQueries();
}
else
ADialog.warn (m_targetWindowNo, this, "DeleteError", name.toString());
ADialog.warn (m_targetWindowNo, this, "DeleteError", name);
return;
}
@ -1307,11 +1307,11 @@ public final class Find extends CDialog
//
if (uq.save())
{
ADialog.info (m_targetWindowNo, this, "Saved", name.toString());
ADialog.info (m_targetWindowNo, this, "Saved", name);
refreshUserQueries();
}
else
ADialog.warn (m_targetWindowNo, this, "SaveError", name.toString());
ADialog.warn (m_targetWindowNo, this, "SaveError", name);
}
} // cmd_save
@ -1401,7 +1401,8 @@ public final class Find extends CDialog
}
}
log.fine(ret.toString());
return ret.toString() + productCategoryId;
StringBuilder msgreturn = new StringBuilder(ret.toString()).append(productCategoryId);
return msgreturn.toString();
}
/**
@ -1472,7 +1473,7 @@ public final class Find extends CDialog
}
catch (Exception e)
{
StringBuilder msglog = new StringBuilder(in.toString()).append("(").append(in.getClass()).append(")").append(e);
StringBuilder msglog = new StringBuilder().append(in.toString()).append("(").append(in.getClass()).append(")").append(e);
log.log(Level.SEVERE, msglog.toString());
time = DisplayType.getDateFormat(dt).parse(in.toString()).getTime();
}

View File

@ -893,16 +893,16 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
GridField field = m_findFields[c];
String columnName = field.getColumnName();
StringBuilder header = new StringBuilder(field.getHeader());
String header = field.getHeader();
if (header == null || header.length() == 0)
{
header = new StringBuilder(Msg.translate(Env.getCtx(), columnName));
header = Msg.translate(Env.getCtx(), columnName);
if (header == null || header.length() == 0)
continue;
}
if (field.isKey())
header.append((" (ID)"));
header += (" (ID)");
ValueNamePair pp = new ValueNamePair(columnName, header.toString());
items.add(pp);
}
@ -1249,7 +1249,7 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
}
catch (Exception e)
{
StringBuilder msglog = new StringBuilder(in.toString()).append("(").append(in.getClass()).append(")").append(e);
StringBuilder msglog = new StringBuilder().append(in.toString()).append("(").append(in.getClass()).append(")").append(e);
log.log(Level.SEVERE, msglog.toString());
time = DisplayType.getDateFormat(dt).parse(in).getTime();
}
@ -1953,7 +1953,8 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
}
}
log.fine(ret.toString());
return ret.toString() + productCategoryId;
StringBuilder msgreturn = new StringBuilder(ret.toString()).append(productCategoryId);
return msgreturn.toString();
} // getSubCategoriesString

View File

@ -995,7 +995,7 @@ public class DB_Oracle implements AdempiereDatabase
System.out.println(myString.length());
System.out.println(Util.size(myString.toString()));
//
myString = new StringBuilder(Util.trimSize(myString.toString(), 2000));
myString = new StringBuilder().append(Util.trimSize(myString.toString(), 2000));
System.out.println(myString.length());
System.out.println(Util.size(myString.toString()));
//