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

View File

@ -264,12 +264,12 @@ public class ClientAcctProcessor extends SvrProcess
if (countError[i] > 0) if (countError[i] > 0)
m_summary.append("(Errors=").append(countError[i]).append(")"); m_summary.append("(Errors=").append(countError[i]).append(")");
m_summary.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()); log.finer(msglog.toString());
} }
else 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()); log.finer(msglog.toString());
} }
} }

View File

@ -141,7 +141,7 @@ public class HouseKeeping extends SvrProcess{
houseKeeping.setLastDeleted(nodel); houseKeeping.setLastDeleted(nodel);
houseKeeping.saveEx(); houseKeeping.saveEx();
addLog("@Deleted@ " + nodel); 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(); return msg.toString();
}//doIt }//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) private int getShipmentDocTypeId(int M_RMA_ID)
@ -241,7 +242,7 @@ public class InOutGenerateRMA extends SvrProcess
log.log(Level.WARNING, msglog.toString()); log.log(Level.WARNING, msglog.toString());
} }
StringBuffer processMsg = new StringBuffer(shipment.getDocumentNo()); StringBuffer processMsg = new StringBuffer().append(shipment.getDocumentNo());
if (!shipment.processIt(p_docAction)) 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"); 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) private int getInvoiceDocTypeId(int M_RMA_ID)
@ -203,7 +204,7 @@ public class InvoiceGenerateRMA extends SvrProcess
log.log(Level.WARNING, msglog.toString()); log.log(Level.WARNING, msglog.toString());
} }
StringBuilder processMsg = new StringBuilder(invoice.getDocumentNo()); StringBuilder processMsg = new StringBuilder().append(invoice.getDocumentNo());
if (!invoice.processIt(p_docAction)) if (!invoice.processIt(p_docAction))
{ {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -63,7 +63,7 @@ public class BOMFlagValidate extends SvrProcess {
while (rs.next()) 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)); addLog(0, null, null, msglog.toString(), MProduct.Table_ID, rs.getInt(2));
} }
} catch (SQLException e) { } catch (SQLException e) {
@ -119,7 +119,7 @@ public class BOMFlagValidate extends SvrProcess {
while (rs.next()) 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)); addLog(0, null, null, msglog.toString(), MProduct.Table_ID, rs.getInt(2));
} }
} catch (SQLException e) { } catch (SQLException e) {

View File

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

View File

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

View File

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

View File

@ -112,7 +112,7 @@ public class CopyOrder extends SvrProcess
// //
// Env.setSOTrx(getCtx(), newOrder.isSOTrx()); // Env.setSOTrx(getCtx(), newOrder.isSOTrx());
// return "@C_Order_ID@ " + newOrder.getDocumentNo(); // 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(); return msgreturn.toString();
} // doIt } // doIt

View File

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

View File

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

View File

@ -55,7 +55,7 @@ public class EMailTest extends SvrProcess
// Test Client Mail // Test Client Mail
String clientTest = client.testEMail(); 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()); addLog(0, null, null, msglog.toString());
// Test Client DocumentDir // Test Client DocumentDir
@ -76,7 +76,7 @@ public class EMailTest extends SvrProcess
{ {
MStore store = wstores[i]; MStore store = wstores[i];
String test = store.testEMail(); 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()); 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.setM_PriceList_ID(te.getM_PriceList_ID());
invoice.setSalesRep_ID(te.getDoc_User_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(": ").append(te.getDocumentNo()).append(" " )
.append(DisplayType.getDateFormat(DisplayType.Date).format(te.getDateReport())); .append(DisplayType.getDateFormat(DisplayType.Date).format(te.getDateReport()));
invoice.setDescription(descr.toString()); invoice.setDescription(descr.toString());

View File

@ -75,7 +75,7 @@ public class ImportDelete extends SvrProcess
// Delete // Delete
StringBuilder sql = new StringBuilder("DELETE FROM ").append(tableName).append(" WHERE AD_Client_ID=").append(getAD_Client_ID()); 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()); 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(); return msg.toString();
} // ImportDelete } // ImportDelete

View File

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

View File

@ -92,7 +92,7 @@ public class ImportPayment extends SvrProcess
StringBuilder sql = null; StringBuilder sql = null;
int no = 0; 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 **** // **** Prepare ****

View File

@ -402,7 +402,7 @@ public class InvoiceGenerate extends SvrProcess
AD_Language = Language.getBaseAD_Language(); AD_Language = Language.getBaseAD_Language();
java.text.SimpleDateFormat format = DisplayType.getDateFormat java.text.SimpleDateFormat format = DisplayType.getDateFormat
(DisplayType.Date, Language.getLanguage(AD_Language)); (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(ship.getDocumentNo())
.append(" - ").append(format.format(ship.getMovementDate())); .append(" - ").append(format.format(ship.getMovementDate()));
m_ship = ship; m_ship = ship;

View File

@ -82,7 +82,7 @@ public class OrderRePrice extends SvrProcess
} }
order = new MOrder (getCtx(), p_C_Order_ID, get_TrxName()); order = new MOrder (getCtx(), p_C_Order_ID, get_TrxName());
BigDecimal newPrice = order.getGrandTotal(); 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) 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.setPlannedMarginAmt(pp.getPriceStd().subtract(pp.getPriceLimit()));
projectLine.saveEx(); 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(), "PriceStd")).append(pp.getPriceStd()).append(" - ")
.append(Msg.getElement(getCtx(), "PriceLimit")).append(pp.getPriceLimit()); .append(Msg.getElement(getCtx(), "PriceLimit")).append(pp.getPriceLimit());
return retValue.toString(); return retValue.toString();

View File

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

View File

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

View File

@ -369,7 +369,7 @@ public class TableCreateColumns extends SvrProcess
// Done // Done
if (column.save ()) 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()); addLog (0, null, null, msglog.toString());
m_count++; m_count++;
} }

View File

@ -112,7 +112,7 @@ public class TreeMaintenance extends SvrProcess
int deletes = DB.executeUpdate(sql.toString(), get_TrxName()); int deletes = DB.executeUpdate(sql.toString(), get_TrxName());
addLog(0,null, new BigDecimal(deletes), tree.getName()+ " Deleted"); addLog(0,null, new BigDecimal(deletes), tree.getName()+ " Deleted");
if (!tree.isAllNodes()){ if (!tree.isAllNodes()){
StringBuilder msgreturn = new StringBuilder(tree.getName()).append(" OK"); StringBuilder msgreturn = new StringBuilder().append(tree.getName()).append(" OK");
return msgreturn.toString(); return msgreturn.toString();
} }
// Insert new // Insert new
@ -176,9 +176,9 @@ public class TreeMaintenance extends SvrProcess
{ {
pstmt = null; 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()); 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(); return msgreturn.toString();
} // verifyTree } // verifyTree

View File

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

View File

@ -55,7 +55,8 @@ public class ResetLockedAccount extends SvrProcess {
if (no < 0) if (no < 0)
throw new AdempiereException("Could not unlock user account" + user.toString()); 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 else
{ {
@ -84,7 +85,8 @@ public class ResetLockedAccount extends SvrProcess {
int no = DB.executeUpdate(sql.toString(), p_AD_Client_ID, get_TrxName()); int no = DB.executeUpdate(sql.toString(), p_AD_Client_ID, get_TrxName());
if (no < 0) if (no < 0)
throw new AdempiereException("Could not unlock user account"); 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 { } finally {
DB.close(rs,stmt); 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) { public static void updateUUID(MColumn column, String trxName) {
@ -241,13 +242,13 @@ public class UUIDGenerator extends SvrProcess {
while (rs.next()) while (rs.next())
{ {
noColumns++; noColumns++;
StringBuilder columnName = new StringBuilder(rs.getString ("COLUMN_NAME")); StringBuilder columnName = new StringBuilder().append(rs.getString ("COLUMN_NAME"));
if (!columnName.toString().equalsIgnoreCase(column.getColumnName())) if (!columnName.toString().equalsIgnoreCase(column.getColumnName()))
continue; continue;
// update existing column // update existing column
boolean notNull = DatabaseMetaData.columnNoNulls == rs.getInt("NULLABLE"); 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; break;
} }
} }
@ -282,10 +283,10 @@ public class UUIDGenerator extends SvrProcess {
if (no != -1) if (no != -1)
{ {
StringBuilder indexName = new StringBuilder(column.getColumnName()).append("_idx"); StringBuilder indexName = new StringBuilder().append(column.getColumnName()).append("_idx");
if (indexName.length() > 30) { if (indexName.length() > 30) {
int i = indexName.length() - 31; 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"); indexName.append("_uu_idx");
} }
StringBuilder indexSql = new StringBuilder("CREATE UNIQUE INDEX ").append(indexName).append(" ON ").append(tableName) 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 // SearchDefinition with a special query
} else if (msd.getSearchType().equals(MSearchDefinition.SEARCHTYPE_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); pstmtSO = DB.prepareStatement(sqlSO.toString(), null);
// count '?' in statement // count '?' in statement
int count = 1; int count = 1;

View File

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

View File

@ -171,7 +171,7 @@ public class ModelInterfaceGenerator
accessLevelInfo.append("- Org "); accessLevelInfo.append("- Org ");
// //
String className = "I_" + tableName; StringBuilder className = new StringBuilder("I_").append(tableName);
// //
StringBuilder start = new StringBuilder() StringBuilder start = new StringBuilder()
.append (COPY) .append (COPY)
@ -216,12 +216,12 @@ public class ModelInterfaceGenerator
//.append(" POInfo initPO (Properties ctx);") // INFO - Should this be here??? //.append(" POInfo initPO (Properties ctx);") // INFO - Should this be here???
; ;
StringBuilder end = new StringBuilder("}"); String end = "}";
// //
sb.insert(0, start); sb.insert(0, start);
sb.append(end); sb.append(end);
return className; return className.toString();
} }
/** /**
@ -418,7 +418,8 @@ public class ModelInterfaceGenerator
fw.close(); fw.close();
float size = out.length(); float size = out.length();
size /= 1024; 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) { } catch (Exception ex) {
log.log(Level.SEVERE, fileName, ex); log.log(Level.SEVERE, fileName, ex);
throw new RuntimeException(ex); throw new RuntimeException(ex);
@ -797,7 +798,7 @@ public class ModelInterfaceGenerator
entityTypeFilter.append("EntityType IN ('U','A')"); 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); String packagePath = packageName.replace(".", File.separator);
if (!(directory.toString().endsWith("/") || directory.toString().endsWith("\\"))) 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_Voided)
|| m_DocStatus.equals(DocumentEngine.STATUS_Reversed)) || m_DocStatus.equals(DocumentEngine.STATUS_Reversed))
; ;
else else{
return "Invalid DocStatus='" + m_DocStatus + "' for DocumentNo=" + getDocumentNo(); 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()) if (p_po.getAD_Client_ID() != m_as.getAD_Client_ID())
{ {
String error = "AD_Client_ID Conflict - Document=" + p_po.getAD_Client_ID() StringBuilder error = new StringBuilder("AD_Client_ID Conflict - Document=").append(p_po.getAD_Client_ID())
+ ", AcctSchema=" + m_as.getAD_Client_ID(); .append(", AcctSchema=").append(m_as.getAD_Client_ID());
log.severe(error); log.severe(error.toString());
return error; return error.toString();
} }
// Lock Record ---- // Lock Record ----
String trxName = null; // outside trx if on server String trxName = null; // outside trx if on server
if (! m_manageLocalTrx) if (! m_manageLocalTrx)
trxName = getTrxName(); // on trx if it's in client 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 ") sql.append(get_TableName()).append( " SET Processing='Y' WHERE ")
.append(get_TableName()).append("_ID=").append(get_ID()) .append(get_TableName()).append("_ID=").append(get_ID())
.append(" AND Processed='Y' AND IsActive='Y'"); .append(" AND Processed='Y' AND IsActive='Y'");
@ -565,7 +567,7 @@ public abstract class Doc
// Reference // Reference
note.setReference(toString()); // Document note.setReference(toString()); // Document
// Text // 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) if (p_Error != null)
Text.append(" (").append(p_Error).append(")"); Text.append(" (").append(p_Error).append(")");
String cn = getClass().getName(); String cn = getClass().getName();
@ -603,7 +605,7 @@ public abstract class Doc
*/ */
protected int deleteAcct() 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(get_Table_ID())
.append(" AND Record_ID=").append(p_po.get_ID()) .append(" AND Record_ID=").append(p_po.get_ID())
.append(" AND C_AcctSchema_ID=").append(m_as.getC_AcctSchema_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 String trxName = null; // outside trx if on server
if (! m_manageLocalTrx) if (! m_manageLocalTrx)
trxName = getTrxName(); // on trx if it's in client 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 ") sql.append(get_TableName()).append( " SET Processing='N' WHERE ")
.append(get_TableName()).append("_ID=").append(p_po.get_ID()); .append(get_TableName()).append("_ID=").append(p_po.get_ID());
DB.executeUpdate(sql.toString(), trxName); DB.executeUpdate(sql.toString(), trxName);

View File

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

View File

@ -227,10 +227,11 @@ public class DocManager {
if (tableName == null) if (tableName == null)
{ {
s_log.severe("Table not a financial document. AD_Table_ID=" + AD_Table_ID); 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(tableName)
.append(" WHERE ").append(tableName).append("_ID=? AND Processed='Y'"); .append(" WHERE ").append(tableName).append("_ID=? AND Processed='Y'");
PreparedStatement pstmt = null; 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) 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); 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) sql.append(table.getTableName()).append(" SET Posted='").append(status)
.append("',Processing='N' ") .append("',Processing='N' ")
.append("WHERE ") .append("WHERE ")

View File

@ -170,7 +170,8 @@ public final class DocTax
*/ */
public String getDescription() 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 } // getDescription
/** /**
@ -236,7 +237,7 @@ public final class DocTax
*/ */
public String toString() public String toString()
{ {
StringBuffer sb = new StringBuffer("Tax=("); StringBuilder sb = new StringBuilder("Tax=(");
sb.append(m_name); sb.append(m_name);
sb.append(" Amt=").append(m_amount); sb.append(" Amt=").append(m_amount);
sb.append(")"); sb.append(")");

View File

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

View File

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

View File

@ -282,7 +282,7 @@ public class Doc_Order extends Doc
public BigDecimal getBalance() public BigDecimal getBalance()
{ {
BigDecimal retValue = Env.ZERO; BigDecimal retValue = Env.ZERO;
StringBuffer sb = new StringBuffer (" ["); StringBuilder sb = new StringBuilder (" [");
// Total // Total
retValue = retValue.add(getAmount(Doc.AMTTYPE_Gross)); retValue = retValue.add(getAmount(Doc.AMTTYPE_Gross));
sb.append(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()) if (ci.getC_AcctSchema1_ID() != as.getC_AcctSchema_ID())
return; return;
StringBuffer sql = new StringBuffer ( StringBuilder sql = new StringBuilder (
"UPDATE M_Product_PO po ") "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("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 ") .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 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(") "); .append(" AND o1.C_Order_ID=").append(get_ID()).append(") ");
sql.append(" AND o.C_Order_ID=").append(get_ID()).append(") ") sql.append(" AND o.C_Order_ID=").append(get_ID()).append(") ")
.append("WHERE EXISTS (SELECT * " .append("WHERE EXISTS (SELECT * ")
+ "FROM C_Order o, C_OrderLine ol " .append("FROM C_Order o, C_OrderLine ol ")
+ "WHERE o.C_Order_ID=ol.C_Order_ID" .append("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" .append(" 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(" AND o.C_Order_ID=").append(get_ID()).append(")");
int no = DB.executeUpdate(sql.toString(), getTrxName()); int no = DB.executeUpdate(sql.toString(), getTrxName());
log.fine("Updated=" + no); log.fine("Updated=" + no);
} // updateProductPO } // updateProductPO

View File

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

View File

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

View File

@ -157,12 +157,12 @@ public class Matcher
// MMatchInv inv = new MMatchInv (); // MMatchInv inv = new MMatchInv ();
int M_MatchInv_ID = DB.getNextID (AD_Client_ID, "M_MatchInv", m_trxName); int M_MatchInv_ID = DB.getNextID (AD_Client_ID, "M_MatchInv", m_trxName);
// //
StringBuffer sql = new StringBuffer("INSERT INTO M_MatchInv (" StringBuilder sql = new StringBuilder("INSERT INTO M_MatchInv (")
+ "M_MatchInv_ID, " .append("M_MatchInv_ID, ")
+ "AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy, " .append("AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy, ")
+ "M_InOutLine_ID,C_InvoiceLine_ID, " .append("M_InOutLine_ID,C_InvoiceLine_ID, ")
+ "M_Product_ID,DateTrx,Qty, " .append("M_Product_ID,DateTrx,Qty, ")
+ "Processing,Processed,Posted) VALUES (") .append("Processing,Processed,Posted) VALUES (")
.append(M_MatchInv_ID).append(", ") .append(M_MatchInv_ID).append(", ")
.append(AD_Client_ID).append(",").append(AD_Org_ID).append(",'Y',SysDate,0,SysDate,0, ") .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(", ") .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) private BigDecimal getPriceList (MAcctSchema as, boolean onlyPOPriceList)
{ {
StringBuffer sql = new StringBuffer ( StringBuilder sql = new StringBuilder (
"SELECT pl.C_Currency_ID, pp.PriceList, pp.PriceStd, pp.PriceLimit " "SELECT pl.C_Currency_ID, pp.PriceList, pp.PriceStd, pp.PriceLimit ")
+ "FROM M_PriceList pl, M_PriceList_Version plv, M_ProductPrice pp " .append("FROM M_PriceList pl, M_PriceList_Version plv, M_ProductPrice pp ")
+ "WHERE pl.M_PriceList_ID = plv.M_PriceList_ID" .append("WHERE pl.M_PriceList_ID = plv.M_PriceList_ID")
+ " AND plv.M_PriceList_Version_ID = pp.M_PriceList_Version_ID" .append(" AND plv.M_PriceList_Version_ID = pp.M_PriceList_Version_ID")
+ " AND pp.M_Product_ID=?"); .append(" AND pp.M_Product_ID=?");
if (onlyPOPriceList) if (onlyPOPriceList)
sql.append(" AND pl.IsSOPriceList='N'"); sql.append(" AND pl.IsSOPriceList='N'");
sql.append(" ORDER BY pl.IsSOPriceList ASC, plv.ValidFrom DESC"); 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++) for (int i = 0; i < m_rows.size(); i++)
{ {
ImpFormatRow row = (ImpFormatRow)m_rows.get(i); ImpFormatRow row = (ImpFormatRow)m_rows.get(i);
StringBuffer entry = new StringBuffer (); StringBuilder entry = new StringBuilder ();
// Label-Start // Label-Start
if (withLabel) if (withLabel)
{ {
@ -439,7 +439,7 @@ public final class ImpFormat
int length = line.length(); int length = line.length();
for (int field = 1; field <= fieldNo && pos < length; field++) for (int field = 1; field <= fieldNo && pos < length; field++)
{ {
StringBuffer content = new StringBuffer(); StringBuilder content = new StringBuilder();
// two delimiter directly after each other // two delimiter directly after each other
if (line.charAt(pos) == delimiter) if (line.charAt(pos) == delimiter)
{ {
@ -518,7 +518,7 @@ public final class ImpFormat
// Check if the record is already there ------------------------------ // 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(m_tablePK).append(") FROM ").append(m_tableName)
.append(" WHERE AD_Client_ID=").append(AD_Client_ID).append(" AND ("); .append(" WHERE AD_Client_ID=").append(AD_Client_ID).append(" AND (");
// //
@ -541,7 +541,7 @@ public final class ImpFormat
whereParentChild += " AND " + nodes[i]; whereParentChild += " AND " + nodes[i];
} }
} }
StringBuffer find = new StringBuffer(); StringBuilder find = new StringBuilder();
if (where1 != null) if (where1 != null)
find.append(where1); find.append(where1);
if (where2 != null) if (where2 != null)
@ -587,7 +587,7 @@ public final class ImpFormat
if (ID == 0) if (ID == 0)
{ {
ID = DB.getNextID(ctx, m_tableName, null); // get ID 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(m_tableName).append("(").append(m_tablePK).append(",")
.append("AD_Client_ID,AD_Org_ID,Created,CreatedBy,Updated,UpdatedBy,IsActive") // StdFields .append("AD_Client_ID,AD_Org_ID,Created,CreatedBy,Updated,UpdatedBy,IsActive") // StdFields
.append(") VALUES (").append(ID).append(",") .append(") VALUES (").append(ID).append(",")
@ -607,7 +607,7 @@ public final class ImpFormat
log.finer("Old ID=" + ID + " " + find); log.finer("Old ID=" + ID + " " + find);
// Update Info ------------------------------------------------------- // Update Info -------------------------------------------------------
sql = new StringBuffer ("UPDATE ") sql = new StringBuilder ("UPDATE ")
.append(m_tableName).append(" SET "); .append(m_tableName).append(" SET ");
for (int i = 0; i < nodes.length; i++) for (int i = 0; i < nodes.length; i++)
sql.append(nodes[i]).append(","); // column=value sql.append(nodes[i]).append(","); // column=value

View File

@ -731,7 +731,7 @@ public abstract class OFXBankStatementHandler extends DefaultHandler
{ {
if (!m_controller.saveLine()) 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()); m_errorDescription = new StringBuffer(m_controller.getErrorDescription());
throw new SAXException(m_errorMessage.toString()); throw new SAXException(m_errorMessage.toString());
} }

View File

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

View File

@ -413,7 +413,8 @@ public class GridWindow implements Serializable
*/ */
public String toString() 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 } // toString
/** /**
@ -423,15 +424,15 @@ public class GridWindow implements Serializable
*/ */
public WebDoc getHelpDoc (boolean javaClient) 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; WebDoc doc = null;
if (javaClient) if (javaClient)
{ {
doc = WebDoc.create (false, title, javaClient); doc = WebDoc.create (false, title.toString(), javaClient);
} }
else // HTML else // HTML
{ {
doc = WebDoc.createPopup (title); doc = WebDoc.createPopup (title.toString());
doc.addPopupClose(Env.getCtx()); doc.addPopupClose(Env.getCtx());
} }

View File

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

View File

@ -191,7 +191,7 @@ public final class MAccountLookup extends Lookup implements Serializable
for(MAccount account :accounts) for(MAccount account :accounts)
{ {
StringBuilder msglist = new StringBuilder(account.getCombination()).append(" - ") StringBuilder msglist = new StringBuilder().append(account.getCombination()).append(" - ")
.append(account.getDescription()); .append(account.getDescription());
list.add (new KeyNamePair(account.getC_ValidCombination_ID(), msglist.toString())); 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()); this (client.getCtx(), 0, client.get_TrxName());
setClientOrg(client); setClientOrg(client);
StringBuilder msgset = new StringBuilder(client.getName()).append(" - ") StringBuilder msgset = new StringBuilder().append(client.getName()).append(" - ")
.append(Msg.translate(getCtx(), "C_AcctProcessor_ID")); .append(Msg.translate(getCtx(), "C_AcctProcessor_ID"));
setName (msgset.toString()); setName (msgset.toString());
setSupervisor_ID (Supervisor_ID); setSupervisor_ID (Supervisor_ID);

View File

@ -195,7 +195,7 @@ public class MAcctSchema extends X_C_AcctSchema
this (client.getCtx(), 0, client.get_TrxName()); this (client.getCtx(), 0, client.get_TrxName());
setClientOrg(client); setClientOrg(client);
setC_Currency_ID (currency.getKey()); 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()); setName (msgset.toString());
} // MAcctSchema } // MAcctSchema

View File

@ -649,7 +649,7 @@ public final class MAllocationHdr extends X_C_AllocationHdr implements DocAction
*/ */
public String getDocumentInfo() 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(); return msgreturn.toString();
} // getDocumentInfo } // getDocumentInfo
@ -661,7 +661,7 @@ public final class MAllocationHdr extends X_C_AllocationHdr implements DocAction
{ {
try 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"); File temp = File.createTempFile(msgctf.toString(), ".pdf");
return createPDF (temp); return createPDF (temp);
} }

View File

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

View File

@ -187,14 +187,14 @@ public class MAsset extends X_A_Asset
if (deliveryCount > 1) if (deliveryCount > 1)
documentNo.append("_").append(deliveryCount); documentNo.append("_").append(deliveryCount);
// Value // 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()) if (value.length() > 40-documentNo.length())
value.delete(40-documentNo.length(), value.length()).append(documentNo); value.delete(40-documentNo.length(), value.length()).append(documentNo);
setValue(value.toString()); setValue(value.toString());
// Name MProduct.afterSave // 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) if (name.length() > 60)
name.delete(60,name.length()); name.delete(60,name.length());
setName(name.toString()); setName(name.toString());

View File

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

View File

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

View File

@ -117,7 +117,7 @@ public class MBankAccount extends X_C_BankAccount
*/ */
public String getName() 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(); return msgreturn.toString();
} // getName } // getName

View File

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

View File

@ -263,7 +263,7 @@ public class MCStage extends X_CM_CStage
*/ */
protected boolean checkElements () { protected boolean checkElements () {
X_CM_Template thisTemplate = new X_CM_Template(getCtx(), this.getCM_Template_ID(), get_TrxName()); 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) { while (thisElementList.indexOf("\n")>=0) {
String thisElement = thisElementList.substring(0,thisElementList.indexOf("\n")); String thisElement = thisElementList.substring(0,thisElementList.indexOf("\n"));
thisElementList.delete(0,thisElementList.indexOf("\n")+1); 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()); super(client.getCtx(), 0, client.get_TrxName());
setClientOrg(client); 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()); setName(msgset.toString());
} // MCalendar } // MCalendar

View File

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

View File

@ -61,7 +61,7 @@ public class MChangeRequest extends X_M_ChangeRequest
{ {
this (request.getCtx(), 0, request.get_TrxName()); this (request.getCtx(), 0, request.get_TrxName());
setClientOrg(request); 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()); setName(msgset.toString());
setHelp(request.getSummary()); setHelp(request.getSummary());
// //

View File

@ -311,7 +311,7 @@ public class MClient extends X_AD_Client
while (rs.next()) while (rs.next())
{ {
String value = rs.getString(1); 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)) if (value.equals(X_AD_Tree.TREETYPE_Organization))
{ {

View File

@ -218,7 +218,7 @@ public class MClientShare extends X_AD_ClientShare
.append(getTableName()) .append(getTableName())
.append(" SET AD_Org_ID=0 WHERE AD_Org_ID<>0 AND AD_Client_ID=?"); .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()); 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()); log.info(info.toString());
} }
else if (isOrgLevelOnly()) else if (isOrgLevelOnly())
@ -227,7 +227,7 @@ public class MClientShare extends X_AD_ClientShare
.append(getTableName()) .append(getTableName())
.append(" WHERE AD_Org_ID=0 AND AD_Client_ID=?"); .append(" WHERE AD_Org_ID=0 AND AD_Client_ID=?");
int no = DB.getSQLValue(get_TrxName(), sql.toString(), getAD_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()); log.info(info.toString());
} }
return info.toString(); return info.toString();

View File

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

View File

@ -167,7 +167,7 @@ public class MGLCategory extends X_GL_Category
@Override @Override
public String toString() 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(", Name=").append(getName())
.append(", IsDefault=").append(isDefault()) .append(", IsDefault=").append(isDefault())
.append(", IsActive=").append(isActive()) .append(", IsActive=").append(isActive())

View File

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

View File

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

View File

@ -162,8 +162,10 @@ public class MInventory extends X_M_Inventory implements DocAction
String desc = getDescription(); String desc = getDescription();
if (desc == null) if (desc == null)
setDescription(description); setDescription(description);
else else{
setDescription(desc + " | " + description); StringBuilder msgreturn = new StringBuilder(desc).append(" | ").append(description);
setDescription(msgreturn.toString());
}
} // addDescription } // addDescription
/** /**
@ -182,7 +184,7 @@ public class MInventory extends X_M_Inventory implements DocAction
*/ */
public String toString () public String toString ()
{ {
StringBuffer sb = new StringBuffer ("MInventory["); StringBuilder sb = new StringBuilder ("MInventory[");
sb.append (get_ID()) sb.append (get_ID())
.append ("-").append (getDocumentNo()) .append ("-").append (getDocumentNo())
.append (",M_Warehouse_ID=").append(getM_Warehouse_ID()) .append (",M_Warehouse_ID=").append(getM_Warehouse_ID())
@ -197,7 +199,8 @@ public class MInventory extends X_M_Inventory implements DocAction
public String getDocumentInfo() public String getDocumentInfo()
{ {
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); 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 } // getDocumentInfo
/** /**
@ -208,7 +211,8 @@ public class MInventory extends X_M_Inventory implements DocAction
{ {
try 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); return createPDF (temp);
} }
catch (Exception e) catch (Exception e)
@ -688,7 +692,8 @@ public class MInventory extends X_M_Inventory implements DocAction
{ {
line.setQtyInternalUse(Env.ZERO); line.setQtyInternalUse(Env.ZERO);
line.setQtyCount(line.getQtyBook()); 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()); line.saveEx(get_TrxName());
} }
} }
@ -750,7 +755,8 @@ public class MInventory extends X_M_Inventory implements DocAction
reversal.setIsApproved (false); reversal.setIsApproved (false);
reversal.setPosted(false); reversal.setPosted(false);
reversal.setProcessed(false); reversal.setProcessed(false);
reversal.addDescription("{->" + getDocumentNo() + ")"); StringBuilder msgd = new StringBuilder("{->").append(getDocumentNo()).append(")");
reversal.addDescription(msgd.toString());
//FR1948157 //FR1948157
reversal.setReversal_ID(getM_Inventory_ID()); reversal.setReversal_ID(getM_Inventory_ID());
reversal.saveEx(); reversal.saveEx();
@ -802,7 +808,8 @@ public class MInventory extends X_M_Inventory implements DocAction
m_processMsg = reversal.getDocumentNo(); m_processMsg = reversal.getDocumentNo();
// Update Reversed (this) // Update Reversed (this)
addDescription("(" + reversal.getDocumentNo() + "<-)"); msgd = new StringBuilder("(").append(reversal.getDocumentNo()).append("<-)");
addDescription(msgd.toString());
// After reverseCorrect // After reverseCorrect
m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSECORRECT); m_processMsg = ModelValidationEngine.get().fireDocValidate(this,ModelValidator.TIMING_AFTER_REVERSECORRECT);
if (m_processMsg != null) if (m_processMsg != null)
@ -863,7 +870,7 @@ public class MInventory extends X_M_Inventory implements DocAction
*/ */
public String getSummary() public String getSummary()
{ {
StringBuffer sb = new StringBuffer(); StringBuilder sb = new StringBuilder();
sb.append(getDocumentNo()); sb.append(getDocumentNo());
// : Total Lines = 123.00 (#1) // : Total Lines = 123.00 (#1)
sb.append(": ") 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) public static String getPDFFileName (String documentDir, int C_Invoice_ID)
{ {
StringBuffer sb = new StringBuffer (documentDir); StringBuilder sb = new StringBuilder (documentDir);
if (sb.length() == 0) if (sb.length() == 0)
sb.append("."); sb.append(".");
if (!sb.toString().endsWith(File.separator)) if (!sb.toString().endsWith(File.separator))
@ -825,8 +825,10 @@ public class MInvoice extends X_C_Invoice implements DocAction
String desc = getDescription(); String desc = getDescription();
if (desc == null) if (desc == null)
setDescription(description); setDescription(description);
else else{
setDescription(desc + " | " + description); StringBuilder msgd = new StringBuilder(desc).append(" | ").append(description);
setDescription(msgd.toString());
}
} // addDescription } // addDescription
/** /**
@ -851,11 +853,14 @@ public class MInvoice extends X_C_Invoice implements DocAction
super.setProcessed (processed); super.setProcessed (processed);
if (get_ID() == 0) if (get_ID() == 0)
return; return;
String set = "SET Processed='" StringBuilder set = new StringBuilder("SET Processed='")
+ (processed ? "Y" : "N") .append((processed ? "Y" : "N"))
+ "' WHERE C_Invoice_ID=" + getC_Invoice_ID(); .append("' WHERE C_Invoice_ID=").append(getC_Invoice_ID());
int noLine = DB.executeUpdate("UPDATE C_InvoiceLine " + set, get_TrxName());
int noTax = DB.executeUpdate("UPDATE C_InvoiceTax " + set, get_TrxName()); 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_lines = null;
m_taxes = null; m_taxes = null;
log.fine(processed + " - Lines=" + noLine + ", Tax=" + noTax); log.fine(processed + " - Lines=" + noLine + ", Tax=" + noTax);
@ -1021,7 +1026,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
*/ */
public String toString () public String toString ()
{ {
StringBuffer sb = new StringBuffer ("MInvoice[") StringBuilder sb = new StringBuilder ("MInvoice[")
.append(get_ID()).append("-").append(getDocumentNo()) .append(get_ID()).append("-").append(getDocumentNo())
.append(",GrandTotal=").append(getGrandTotal()); .append(",GrandTotal=").append(getGrandTotal());
if (m_lines != null) if (m_lines != null)
@ -1037,7 +1042,8 @@ public class MInvoice extends X_C_Invoice implements DocAction
public String getDocumentInfo() public String getDocumentInfo()
{ {
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); 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 } // getDocumentInfo
@ -1054,12 +1060,12 @@ public class MInvoice extends X_C_Invoice implements DocAction
if (is_ValueChanged("AD_Org_ID")) if (is_ValueChanged("AD_Org_ID"))
{ {
String sql = "UPDATE C_InvoiceLine ol" StringBuilder sql = new StringBuilder("UPDATE C_InvoiceLine ol")
+ " SET AD_Org_ID =" .append(" SET AD_Org_ID =")
+ "(SELECT AD_Org_ID" .append("(SELECT AD_Org_ID")
+ " FROM C_Invoice o WHERE ol.C_Invoice_ID=o.C_Invoice_ID) " .append(" FROM C_Invoice o WHERE ol.C_Invoice_ID=o.C_Invoice_ID) ")
+ "WHERE C_Invoice_ID=" + getC_Invoice_ID(); .append("WHERE C_Invoice_ID=").append(getC_Invoice_ID());
int no = DB.executeUpdate(sql, get_TrxName()); int no = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine("Lines -> #" + no); log.fine("Lines -> #" + no);
} }
return true; 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) public static void setIsPaid (Properties ctx, int C_BPartner_ID, String trxName)
{ {
List<Object> params = new ArrayList<Object>(); 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) if (C_BPartner_ID > 1)
{ {
whereClause.append(" AND C_BPartner_ID=?"); whereClause.append(" AND C_BPartner_ID=?");
@ -1255,7 +1261,8 @@ public class MInvoice extends X_C_Invoice implements DocAction
{ {
try 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); return createPDF (temp);
} }
catch (Exception e) catch (Exception e)
@ -1541,12 +1548,12 @@ public class MInvoice extends X_C_Invoice implements DocAction
line.setPriceList (Env.ZERO); line.setPriceList (Env.ZERO);
line.setLineNetAmt (Env.ZERO); line.setLineNetAmt (Env.ZERO);
// //
String description = product.getName (); StringBuilder description = new StringBuilder().append(product.getName ());
if (product.getDescription () != null) if (product.getDescription () != null)
description += " " + product.getDescription (); description.append(" ").append(product.getDescription ());
if (line.getDescription () != null) if (line.getDescription () != null)
description += " " + line.getDescription (); description.append(" ").append(line.getDescription ());
line.setDescription (description); line.setDescription (description.toString());
line.saveEx (get_TrxName()); line.saveEx (get_TrxName());
} // for all lines with BOM } // for all lines with BOM
@ -1564,7 +1571,8 @@ public class MInvoice extends X_C_Invoice implements DocAction
{ {
log.fine(""); log.fine("");
// Delete Taxes // 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; m_taxes = null;
// Lines // Lines
@ -1706,7 +1714,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
if (!isApproved()) if (!isApproved())
approveIt(); approveIt();
log.info(toString()); log.info(toString());
StringBuffer info = new StringBuffer(); StringBuilder info = new StringBuilder();
// POS supports multiple payments // POS supports multiple payments
boolean fromPOS = false; 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()); MUser user = new MUser (getCtx(), getAD_User_ID(), get_TrxName());
user.setLastContact(new Timestamp(System.currentTimeMillis())); 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())) if (!user.save(get_TrxName()))
{ {
m_processMsg = "Could not update Business Partner User"; 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.setTaxAmt(Env.ZERO);
line.setLineNetAmt(Env.ZERO); line.setLineNetAmt(Env.ZERO);
line.setLineTotalAmt(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 // Unlink Shipment
if (line.getM_InOutLine_ID() != 0) 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.setC_Order_ID(getC_Order_ID());
reversal.addDescription("{->" + getDocumentNo() + ")"); StringBuilder msgadd = new StringBuilder("{->").append(getDocumentNo()).append(")");
reversal.addDescription(msgadd.toString());
//FR1948157 //FR1948157
reversal.setReversal_ID(getC_Invoice_ID()); reversal.setReversal_ID(getC_Invoice_ID());
reversal.saveEx(get_TrxName()); reversal.saveEx(get_TrxName());
@ -2271,7 +2282,8 @@ public class MInvoice extends X_C_Invoice implements DocAction
reversal.saveEx(get_TrxName()); reversal.saveEx(get_TrxName());
m_processMsg = reversal.getDocumentNo(); m_processMsg = reversal.getDocumentNo();
// //
addDescription("(" + reversal.getDocumentNo() + "<-)"); msgadd = new StringBuilder("(").append(reversal.getDocumentNo()).append("<-)");
addDescription(msgadd.toString());
// Clean up Reversed (this) // Clean up Reversed (this)
MInvoiceLine[] iLines = getLines(false); MInvoiceLine[] iLines = getLines(false);
@ -2297,9 +2309,10 @@ public class MInvoice extends X_C_Invoice implements DocAction
setIsPaid(true); setIsPaid(true);
// Create Allocation // 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(), MAllocationHdr alloc = new MAllocationHdr(getCtx(), false, getDateAcct(),
getC_Currency_ID(), getC_Currency_ID(),
Msg.translate(getCtx(), "C_Invoice_ID") + ": " + getDocumentNo() + "/" + reversal.getDocumentNo(), msgall.toString(),
get_TrxName()); get_TrxName());
alloc.setAD_Org_ID(getAD_Org_ID()); alloc.setAD_Org_ID(getAD_Org_ID());
if (alloc.save()) if (alloc.save())
@ -2381,7 +2394,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
*/ */
public String getSummary() public String getSummary()
{ {
StringBuffer sb = new StringBuffer(); StringBuilder sb = new StringBuilder();
sb.append(getDocumentNo()); sb.append(getDocumentNo());
// : Grand Total = 123.00 (#1) // : Grand Total = 123.00 (#1)
sb.append(": "). sb.append(": ").

View File

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

View File

@ -203,8 +203,10 @@ public class MJournal extends X_GL_Journal implements DocAction
String desc = getDescription(); String desc = getDescription();
if (desc == null) if (desc == null)
setDescription(description); setDescription(description);
else else{
setDescription(desc + " | " + description); 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); super.setProcessed (processed);
if (get_ID() == 0) if (get_ID() == 0)
return; return;
String sql = "UPDATE GL_JournalLine SET Processed='" StringBuilder sql = new StringBuilder("UPDATE GL_JournalLine SET Processed='")
+ (processed ? "Y" : "N") .append((processed ? "Y" : "N"))
+ "' WHERE GL_Journal_ID=" + getGL_Journal_ID(); .append("' WHERE GL_Journal_ID=").append(getGL_Journal_ID());
int noLine = DB.executeUpdate(sql, get_TrxName()); int noLine = DB.executeUpdate(sql.toString(), get_TrxName());
log.fine(processed + " - Lines=" + noLine); log.fine(processed + " - Lines=" + noLine);
} // setProcessed } // setProcessed
@ -372,11 +374,11 @@ public class MJournal extends X_GL_Journal implements DocAction
private boolean updateBatch() private boolean updateBatch()
{ {
if (getGL_JournalBatch_ID()!=0) { // idempiere 344 - nmicoud if (getGL_JournalBatch_ID()!=0) { // idempiere 344 - nmicoud
String sql = "UPDATE GL_JournalBatch jb" StringBuilder sql = new StringBuilder("UPDATE GL_JournalBatch jb")
+ " SET (TotalDr, TotalCr) = (SELECT COALESCE(SUM(TotalDr),0), COALESCE(SUM(TotalCr),0)" .append(" 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) " .append(" FROM GL_Journal j WHERE j.IsActive='Y' AND jb.GL_JournalBatch_ID=j.GL_JournalBatch_ID) ")
+ "WHERE GL_JournalBatch_ID=" + getGL_JournalBatch_ID(); .append("WHERE GL_JournalBatch_ID=").append(getGL_JournalBatch_ID());
int no = DB.executeUpdate(sql, get_TrxName()); int no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no != 1) if (no != 1)
log.warning("afterSave - Update Batch #" + no); log.warning("afterSave - Update Batch #" + no);
return no == 1; return no == 1;
@ -739,12 +741,14 @@ public class MJournal extends X_GL_Journal implements DocAction
reverse.setC_Period_ID(getC_Period_ID()); reverse.setC_Period_ID(getC_Period_ID());
reverse.setDateAcct(getDateAcct()); reverse.setDateAcct(getDateAcct());
// Reverse indicator // Reverse indicator
reverse.addDescription("(->" + getDocumentNo() + ")"); StringBuilder msgd = new StringBuilder("(->").append(getDocumentNo()).append(")");
reverse.addDescription(msgd.toString());
//FR [ 1948157 ] //FR [ 1948157 ]
reverse.setReversal_ID(getGL_Journal_ID()); reverse.setReversal_ID(getGL_Journal_ID());
if (!reverse.save()) if (!reverse.save())
return null; return null;
addDescription("(" + reverse.getDocumentNo() + "<-)"); msgd = new StringBuilder("(").append(reverse.getDocumentNo()).append("<-)");
addDescription(msgd.toString());
// Lines // Lines
reverse.copyLinesFrom(this, null, 'C'); 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.set_ValueNoCheck ("C_Period_ID", null); // reset
reverse.setDateAcct(reverse.getDateDoc()); reverse.setDateAcct(reverse.getDateDoc());
// Reverse indicator // Reverse indicator
String description = reverse.getDescription(); StringBuilder description;
if (description == null) if (reverse.getDescription() == null)
description = "** " + getDocumentNo() + " **"; description = new StringBuilder("** ").append(getDocumentNo()).append(" **");
else else
description += " ** " + getDocumentNo() + " **"; description = new StringBuilder(reverse.getDescription()).append(" ** ").append(getDocumentNo()).append(" **");
reverse.setDescription(description); reverse.setDescription(description.toString());
if (!reverse.save()) if (!reverse.save())
return null; return null;
@ -848,7 +852,7 @@ public class MJournal extends X_GL_Journal implements DocAction
*/ */
public String getSummary() public String getSummary()
{ {
StringBuffer sb = new StringBuffer(); StringBuilder sb = new StringBuilder();
sb.append(getDocumentNo()); sb.append(getDocumentNo());
// : Total Lines = 123.00 (#1) // : Total Lines = 123.00 (#1)
sb.append(": ") sb.append(": ")
@ -868,7 +872,7 @@ public class MJournal extends X_GL_Journal implements DocAction
*/ */
public String toString () public String toString ()
{ {
StringBuffer sb = new StringBuffer ("MJournal["); StringBuilder sb = new StringBuilder ("MJournal[");
sb.append(get_ID()).append(",").append(getDescription()) sb.append(get_ID()).append(",").append(getDescription())
.append(",DR=").append(getTotalDr()) .append(",DR=").append(getTotalDr())
.append(",CR=").append(getTotalCr()) .append(",CR=").append(getTotalCr())
@ -883,7 +887,8 @@ public class MJournal extends X_GL_Journal implements DocAction
public String getDocumentInfo() public String getDocumentInfo()
{ {
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); 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 } // getDocumentInfo
/** /**
@ -894,7 +899,8 @@ public class MJournal extends X_GL_Journal implements DocAction
{ {
try 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); return createPDF (temp);
} }
catch (Exception e) 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.setC_Period_ID(getC_Period_ID());
reverse.setDateAcct(getDateAcct()); reverse.setDateAcct(getDateAcct());
// Reverse indicator // Reverse indicator
String description = reverse.getDescription(); StringBuilder description;
if (description == null) if (reverse.getDescription() == null)
description = "** " + getDocumentNo() + " **"; description = new StringBuilder("** ").append(getDocumentNo()).append(" **");
else else
description += " ** " + getDocumentNo() + " **"; description = new StringBuilder(reverse.getDescription()).append(" ** ").append(getDocumentNo()).append(" **");
reverse.setDescription(description); reverse.setDescription(description.toString());
//[ 1948157 ] //[ 1948157 ]
reverse.setReversal_ID(getGL_JournalBatch_ID()); reverse.setReversal_ID(getGL_JournalBatch_ID());
reverse.saveEx(); reverse.saveEx();
@ -704,12 +704,12 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
reverse.setDateDoc(new Timestamp(System.currentTimeMillis())); reverse.setDateDoc(new Timestamp(System.currentTimeMillis()));
reverse.setDateAcct(reverse.getDateDoc()); reverse.setDateAcct(reverse.getDateDoc());
// Reverse indicator // Reverse indicator
String description = reverse.getDescription(); StringBuilder description;
if (description == null) if (reverse.getDescription() == null)
description = "** " + getDocumentNo() + " **"; description = new StringBuilder("** ").append(getDocumentNo()).append(" **");
else else
description += " ** " + getDocumentNo() + " **"; description = new StringBuilder(reverse.getDescription()).append(" ** ").append(getDocumentNo()).append(" **");
reverse.setDescription(description); reverse.setDescription(description.toString());
reverse.saveEx(); reverse.saveEx();
// Reverse Journals // Reverse Journals
@ -778,7 +778,7 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
*/ */
public String getSummary() public String getSummary()
{ {
StringBuffer sb = new StringBuffer(); StringBuilder sb = new StringBuilder();
sb.append(getDocumentNo()); sb.append(getDocumentNo());
// : Total Lines = 123.00 (#1) // : Total Lines = 123.00 (#1)
sb.append(": ") sb.append(": ")
@ -798,7 +798,7 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
*/ */
public String toString () public String toString ()
{ {
StringBuffer sb = new StringBuffer ("MJournalBatch["); StringBuilder sb = new StringBuilder ("MJournalBatch[");
sb.append(get_ID()).append(",").append(getDescription()) sb.append(get_ID()).append(",").append(getDescription())
.append(",DR=").append(getTotalDr()) .append(",DR=").append(getTotalDr())
.append(",CR=").append(getTotalCr()) .append(",CR=").append(getTotalCr())
@ -813,7 +813,8 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
public String getDocumentInfo() public String getDocumentInfo()
{ {
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); 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 } // getDocumentInfo
/** /**
@ -824,7 +825,8 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
{ {
try 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); return createPDF (temp);
} }
catch (Exception e) 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); log.log(Level.SEVERE, "No Columns found for " + baseTable);
return 0; return 0;
} }
StringBuffer cols = new StringBuffer(); StringBuilder cols = new StringBuilder();
for (int i = 0; i < columns.size(); i++) for (int i = 0; i < columns.size(); i++)
cols.append(",").append(columns.get(i)); cols.append(",").append(columns.get(i));
// Insert Statement // Insert Statement
int AD_User_ID = Env.getAD_User_ID(getCtx()); 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) StringBuilder insert = new StringBuilder("INSERT INTO ").append(tableName)
.append("(AD_Language,IsTranslated, AD_Client_ID,AD_Org_ID, ") .append("(AD_Language,IsTranslated, AD_Client_ID,AD_Org_ID, ")
.append("Createdby,UpdatedBy, ") .append("Createdby,UpdatedBy, ")
@ -441,7 +441,7 @@ public class MLanguage extends X_AD_Language
if (column != null) if (column != null)
UUIDGenerator.updateUUID(column, get_TrxName()); 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()); log.fine(msglog.toString());
return no; return no;
} // addTable } // addTable

View File

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

View File

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

View File

@ -307,7 +307,7 @@ public class MMailText extends X_R_MailText
{ {
if (m_bpartner != null && m_bpartner.getAD_Language() != null) 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); MMailTextTrl trl = s_cacheTrl.get(key);
if (trl == null) if (trl == null)
{ {

View File

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

View File

@ -995,7 +995,7 @@ public class DB_Oracle implements AdempiereDatabase
System.out.println(myString.length()); System.out.println(myString.length());
System.out.println(Util.size(myString.toString())); 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(myString.length());
System.out.println(Util.size(myString.toString())); System.out.println(Util.size(myString.toString()));
// //