IDEMPIERE-308 Performance: Replace with StringBuilder / Thanks to Richard Morales and David Peñuela

This commit is contained in:
Carlos Ruiz 2012-09-26 18:37:43 -05:00
parent 2defc00efb
commit a210231735
20 changed files with 237 additions and 208 deletions

View File

@ -113,71 +113,71 @@ public class PaySelectionCreateFrom extends SvrProcess
// psel.getPayDate(); // psel.getPayDate();
String sql = "SELECT C_Invoice_ID," StringBuilder sql = new StringBuilder("SELECT C_Invoice_ID,")
// Open // Open
+ " currencyConvert(invoiceOpen(i.C_Invoice_ID, 0)" .append(" currencyConvert(invoiceOpen(i.C_Invoice_ID, 0)")
+ ",i.C_Currency_ID, ?,?, i.C_ConversionType_ID,i.AD_Client_ID,i.AD_Org_ID)," // ##1/2 Currency_To,PayDate .append(",i.C_Currency_ID, ?,?, i.C_ConversionType_ID,i.AD_Client_ID,i.AD_Org_ID),") // ##1/2 Currency_To,PayDate
// Discount // Discount
+ " currencyConvert(paymentTermDiscount(i.GrandTotal,i.C_Currency_ID,i.C_PaymentTerm_ID,i.DateInvoiced, ?)" // ##3 PayDate .append(" currencyConvert(paymentTermDiscount(i.GrandTotal,i.C_Currency_ID,i.C_PaymentTerm_ID,i.DateInvoiced, ?)") // ##3 PayDate
+ ",i.C_Currency_ID, ?,?,i.C_ConversionType_ID,i.AD_Client_ID,i.AD_Org_ID)," // ##4/5 Currency_To,PayDate .append(",i.C_Currency_ID, ?,?,i.C_ConversionType_ID,i.AD_Client_ID,i.AD_Org_ID),") // ##4/5 Currency_To,PayDate
+ " PaymentRule, IsSOTrx " // 4..6 .append(" PaymentRule, IsSOTrx ") // 4..6
+ "FROM C_Invoice i " .append("FROM C_Invoice i ")
+ "WHERE IsSOTrx='N' AND IsPaid='N' AND DocStatus IN ('CO','CL')" .append("WHERE IsSOTrx='N' AND IsPaid='N' AND DocStatus IN ('CO','CL')")
+ " AND AD_Client_ID=?" // ##6 .append(" AND AD_Client_ID=?") // ##6
// Existing Payments - Will reselect Invoice if prepared but not paid // Existing Payments - Will reselect Invoice if prepared but not paid
+ " AND NOT EXISTS (SELECT * FROM C_PaySelectionLine psl" .append(" AND NOT EXISTS (SELECT * FROM C_PaySelectionLine psl")
+ " INNER JOIN C_PaySelectionCheck psc ON (psl.C_PaySelectionCheck_ID=psc.C_PaySelectionCheck_ID)" .append(" INNER JOIN C_PaySelectionCheck psc ON (psl.C_PaySelectionCheck_ID=psc.C_PaySelectionCheck_ID)")
+ " LEFT OUTER JOIN C_Payment pmt ON (pmt.C_Payment_ID=psc.C_Payment_ID)" .append(" LEFT OUTER JOIN C_Payment pmt ON (pmt.C_Payment_ID=psc.C_Payment_ID)")
+ " WHERE i.C_Invoice_ID=psl.C_Invoice_ID AND psl.IsActive='Y'" .append(" WHERE i.C_Invoice_ID=psl.C_Invoice_ID AND psl.IsActive='Y'")
+ " AND (pmt.DocStatus IS NULL OR pmt.DocStatus NOT IN ('VO','RE')) )"; .append(" AND (pmt.DocStatus IS NULL OR pmt.DocStatus NOT IN ('VO','RE')) )");
// Disputed // Disputed
if (!p_IncludeInDispute) if (!p_IncludeInDispute)
sql += " AND i.IsInDispute='N'"; sql.append(" AND i.IsInDispute='N'");
// PaymentRule (optional) // PaymentRule (optional)
if (p_PaymentRule != null) if (p_PaymentRule != null)
sql += " AND PaymentRule=?"; // ## sql.append(" AND PaymentRule=?"); // ##
// OnlyDiscount // OnlyDiscount
if (p_OnlyDiscount) if (p_OnlyDiscount)
{ {
if (p_OnlyDue) if (p_OnlyDue)
sql += " AND ("; sql.append(" AND (");
else else
sql += " AND "; sql.append(" AND ");
sql += "paymentTermDiscount(invoiceOpen(C_Invoice_ID, 0), C_Currency_ID, C_PaymentTerm_ID, DateInvoiced, ?) > 0"; // ## sql.append("paymentTermDiscount(invoiceOpen(C_Invoice_ID, 0), C_Currency_ID, C_PaymentTerm_ID, DateInvoiced, ?) > 0"); // ##
} }
// OnlyDue // OnlyDue
if (p_OnlyDue) if (p_OnlyDue)
{ {
if (p_OnlyDiscount) if (p_OnlyDiscount)
sql += " OR "; sql.append(" OR ");
else else
sql += " AND "; sql.append(" AND ");
sql += "paymentTermDueDays(C_PaymentTerm_ID, DateInvoiced, ?) >= 0"; // ## sql.append("paymentTermDueDays(C_PaymentTerm_ID, DateInvoiced, ?) >= 0"); // ##
if (p_OnlyDiscount) if (p_OnlyDiscount)
sql += ")"; sql.append(")");
} }
// Business Partner // Business Partner
if (p_C_BPartner_ID != 0) if (p_C_BPartner_ID != 0)
sql += " AND C_BPartner_ID=?"; // ## sql.append(" AND C_BPartner_ID=?"); // ##
// Business Partner Group // Business Partner Group
else if (p_C_BP_Group_ID != 0) else if (p_C_BP_Group_ID != 0)
sql += " AND EXISTS (SELECT * FROM C_BPartner bp " sql.append(" AND EXISTS (SELECT * FROM C_BPartner bp ")
+ "WHERE bp.C_BPartner_ID=i.C_BPartner_ID AND bp.C_BP_Group_ID=?)"; // ## .append("WHERE bp.C_BPartner_ID=i.C_BPartner_ID AND bp.C_BP_Group_ID=?)"); // ##
// PO Matching Requirement // PO Matching Requirement
if (p_MatchRequirement.equals("P") || p_MatchRequirement.equals("B")) if (p_MatchRequirement.equals("P") || p_MatchRequirement.equals("B"))
{ {
sql += " AND EXISTS (SELECT * FROM C_InvoiceLine il " sql.append(" AND EXISTS (SELECT * FROM C_InvoiceLine il ")
+ "WHERE i.C_Invoice_ID=il.C_Invoice_ID" .append("WHERE i.C_Invoice_ID=il.C_Invoice_ID")
+ " AND QtyInvoiced=(SELECT SUM(Qty) FROM M_MatchPO m " .append(" AND QtyInvoiced=(SELECT SUM(Qty) FROM M_MatchPO m ")
+ "WHERE il.C_InvoiceLine_ID=m.C_InvoiceLine_ID))"; .append("WHERE il.C_InvoiceLine_ID=m.C_InvoiceLine_ID))");
} }
// Receipt Matching Requirement // Receipt Matching Requirement
if (p_MatchRequirement.equals("R") || p_MatchRequirement.equals("B")) if (p_MatchRequirement.equals("R") || p_MatchRequirement.equals("B"))
{ {
sql += " AND EXISTS (SELECT * FROM C_InvoiceLine il " sql.append(" AND EXISTS (SELECT * FROM C_InvoiceLine il ")
+ "WHERE i.C_Invoice_ID=il.C_Invoice_ID" .append("WHERE i.C_Invoice_ID=il.C_Invoice_ID")
+ " AND QtyInvoiced=(SELECT SUM(Qty) FROM M_MatchInv m " .append(" AND QtyInvoiced=(SELECT SUM(Qty) FROM M_MatchInv m ")
+ "WHERE il.C_InvoiceLine_ID=m.C_InvoiceLine_ID))"; .append("WHERE il.C_InvoiceLine_ID=m.C_InvoiceLine_ID))");
} }
// //
@ -186,7 +186,7 @@ public class PaySelectionCreateFrom extends SvrProcess
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
try try
{ {
pstmt = DB.prepareStatement (sql, get_TrxName()); pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
int index = 1; int index = 1;
pstmt.setInt (index++, C_CurrencyTo_ID); pstmt.setInt (index++, C_CurrencyTo_ID);
pstmt.setTimestamp(index++, psel.getPayDate()); pstmt.setTimestamp(index++, psel.getPayDate());
@ -234,7 +234,7 @@ public class PaySelectionCreateFrom extends SvrProcess
} }
catch (Exception e) catch (Exception e)
{ {
log.log(Level.SEVERE, sql, e); log.log(Level.SEVERE, sql.toString(), e);
} }
try try
{ {
@ -246,8 +246,8 @@ public class PaySelectionCreateFrom extends SvrProcess
{ {
pstmt = null; pstmt = null;
} }
StringBuilder msgreturn = new StringBuilder("@C_PaySelectionLine_ID@ - #").append(lines);
return "@C_PaySelectionLine_ID@ - #" + lines; return msgreturn.toString();
} // doIt } // doIt
} // PaySelectionCreateFrom } // PaySelectionCreateFrom

View File

@ -69,7 +69,7 @@ public class PeriodStatus extends SvrProcess
if (period.get_ID() == 0) if (period.get_ID() == 0)
throw new AdempiereUserError("@NotFound@ @C_Period_ID@=" + p_C_Period_ID); throw new AdempiereUserError("@NotFound@ @C_Period_ID@=" + p_C_Period_ID);
StringBuffer sql = new StringBuffer ("UPDATE C_PeriodControl "); StringBuilder sql = new StringBuilder ("UPDATE C_PeriodControl ");
sql.append("SET PeriodStatus='"); sql.append("SET PeriodStatus='");
// Open // Open
if (MPeriodControl.PERIODACTION_OpenPeriod.equals(p_PeriodAction)) if (MPeriodControl.PERIODACTION_OpenPeriod.equals(p_PeriodAction))
@ -93,7 +93,8 @@ public class PeriodStatus extends SvrProcess
CacheMgt.get().reset("C_PeriodControl", 0); CacheMgt.get().reset("C_PeriodControl", 0);
CacheMgt.get().reset("C_Period", p_C_Period_ID); CacheMgt.get().reset("C_Period", p_C_Period_ID);
return "@Updated@ #" + no; StringBuilder msgreturn = new StringBuilder("@Updated@ #").append(no);
return msgreturn.toString();
} // doIt } // doIt
} // PeriodStatus } // PeriodStatus

View File

@ -72,55 +72,56 @@ public class ProductCategoryAcctCopy extends SvrProcess
throw new AdempiereSystemError("Not Found - C_AcctSchema_ID=" + p_C_AcctSchema_ID); throw new AdempiereSystemError("Not Found - C_AcctSchema_ID=" + p_C_AcctSchema_ID);
// Update // Update
String sql = "UPDATE M_Product_Acct pa " StringBuilder sql = new StringBuilder("UPDATE M_Product_Acct pa ")
+ "SET (P_Revenue_Acct,P_Expense_Acct,P_CostAdjustment_Acct,P_InventoryClearing_Acct,P_Asset_Acct,P_COGS_Acct," .append("SET (P_Revenue_Acct,P_Expense_Acct,P_CostAdjustment_Acct,P_InventoryClearing_Acct,P_Asset_Acct,P_COGS_Acct,")
+ " P_PurchasePriceVariance_Acct,P_InvoicePriceVariance_Acct,P_AverageCostVariance_Acct," .append(" P_PurchasePriceVariance_Acct,P_InvoicePriceVariance_Acct,P_AverageCostVariance_Acct,")
+ " P_TradeDiscountRec_Acct,P_TradeDiscountGrant_Acct," .append(" P_TradeDiscountRec_Acct,P_TradeDiscountGrant_Acct,")
+ " P_WIP_Acct,P_FloorStock_Acct,P_MethodChangeVariance_Acct,P_UsageVariance_Acct,P_RateVariance_Acct," .append(" P_WIP_Acct,P_FloorStock_Acct,P_MethodChangeVariance_Acct,P_UsageVariance_Acct,P_RateVariance_Acct,")
+ " P_MixVariance_Acct,P_Labor_Acct,P_Burden_Acct,P_CostOfProduction_Acct,P_OutsideProcessing_Acct,P_Overhead_Acct,P_Scrap_Acct)=" .append(" P_MixVariance_Acct,P_Labor_Acct,P_Burden_Acct,P_CostOfProduction_Acct,P_OutsideProcessing_Acct,P_Overhead_Acct,P_Scrap_Acct)=")
+ " (SELECT P_Revenue_Acct,P_Expense_Acct,P_CostAdjustment_Acct,P_InventoryClearing_Acct,P_Asset_Acct,P_COGS_Acct," .append(" (SELECT P_Revenue_Acct,P_Expense_Acct,P_CostAdjustment_Acct,P_InventoryClearing_Acct,P_Asset_Acct,P_COGS_Acct,")
+ " P_PurchasePriceVariance_Acct,P_InvoicePriceVariance_Acct,P_AverageCostVariance_Acct," .append(" P_PurchasePriceVariance_Acct,P_InvoicePriceVariance_Acct,P_AverageCostVariance_Acct,")
+ " P_TradeDiscountRec_Acct,P_TradeDiscountGrant_Acct," .append(" P_TradeDiscountRec_Acct,P_TradeDiscountGrant_Acct,")
+ " P_WIP_Acct,P_FloorStock_Acct,P_MethodChangeVariance_Acct,P_UsageVariance_Acct,P_RateVariance_Acct," .append(" P_WIP_Acct,P_FloorStock_Acct,P_MethodChangeVariance_Acct,P_UsageVariance_Acct,P_RateVariance_Acct,")
+ " P_MixVariance_Acct,P_Labor_Acct,P_Burden_Acct,P_CostOfProduction_Acct,P_OutsideProcessing_Acct,P_Overhead_Acct,P_Scrap_Acct" .append(" P_MixVariance_Acct,P_Labor_Acct,P_Burden_Acct,P_CostOfProduction_Acct,P_OutsideProcessing_Acct,P_Overhead_Acct,P_Scrap_Acct")
+ " FROM M_Product_Category_Acct pca" .append(" FROM M_Product_Category_Acct pca")
+ " WHERE pca.M_Product_Category_ID=" + p_M_Product_Category_ID .append(" WHERE pca.M_Product_Category_ID=").append(p_M_Product_Category_ID)
+ " AND pca.C_AcctSchema_ID=" + p_C_AcctSchema_ID .append(" AND pca.C_AcctSchema_ID=").append(p_C_AcctSchema_ID)
+ "), Updated=SysDate, UpdatedBy=0 " .append("), Updated=SysDate, UpdatedBy=0 ")
+ "WHERE pa.C_AcctSchema_ID=" + p_C_AcctSchema_ID .append("WHERE pa.C_AcctSchema_ID=").append(p_C_AcctSchema_ID)
+ " AND EXISTS (SELECT * FROM M_Product p " .append(" AND EXISTS (SELECT * FROM M_Product p ")
+ "WHERE p.M_Product_ID=pa.M_Product_ID" .append("WHERE p.M_Product_ID=pa.M_Product_ID")
+ " AND p.M_Product_Category_ID=" + p_M_Product_Category_ID + ")"; .append(" AND p.M_Product_Category_ID=").append(p_M_Product_Category_ID).append(")");
int updated = DB.executeUpdate(sql, get_TrxName()); int updated = DB.executeUpdate(sql.toString(), get_TrxName());
addLog(0, null, new BigDecimal(updated), "@Updated@"); addLog(0, null, new BigDecimal(updated), "@Updated@");
// Insert new Products // Insert new Products
sql = "INSERT INTO M_Product_Acct " sql = new StringBuilder("INSERT INTO M_Product_Acct ")
+ "(M_Product_ID, C_AcctSchema_ID," .append("(M_Product_ID, C_AcctSchema_ID,")
+ " AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy," .append(" AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy,")
+ " P_Revenue_Acct, P_Expense_Acct, P_CostAdjustment_Acct, P_InventoryClearing_Acct, P_Asset_Acct, P_CoGs_Acct," .append(" P_Revenue_Acct, P_Expense_Acct, P_CostAdjustment_Acct, P_InventoryClearing_Acct, P_Asset_Acct, P_CoGs_Acct,")
+ " P_PurchasePriceVariance_Acct, P_InvoicePriceVariance_Acct, P_AverageCostVariance_Acct," .append(" P_PurchasePriceVariance_Acct, P_InvoicePriceVariance_Acct, P_AverageCostVariance_Acct,")
+ " P_TradeDiscountRec_Acct, P_TradeDiscountGrant_Acct, " .append(" P_TradeDiscountRec_Acct, P_TradeDiscountGrant_Acct, ")
+ " P_WIP_Acct,P_FloorStock_Acct, P_MethodChangeVariance_Acct, P_UsageVariance_Acct, P_RateVariance_Acct," .append(" P_WIP_Acct,P_FloorStock_Acct, P_MethodChangeVariance_Acct, P_UsageVariance_Acct, P_RateVariance_Acct,")
+ " P_MixVariance_Acct, P_Labor_Acct, P_Burden_Acct, P_CostOfProduction_Acct, P_OutsideProcessing_Acct, P_Overhead_Acct, P_Scrap_Acct) " .append(" P_MixVariance_Acct, P_Labor_Acct, P_Burden_Acct, P_CostOfProduction_Acct, P_OutsideProcessing_Acct, P_Overhead_Acct, P_Scrap_Acct) ")
+ "SELECT p.M_Product_ID, acct.C_AcctSchema_ID," .append("SELECT p.M_Product_ID, acct.C_AcctSchema_ID,")
+ " p.AD_Client_ID, p.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0," .append(" p.AD_Client_ID, p.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0,")
+ " acct.P_Revenue_Acct, acct.P_Expense_Acct, acct.P_CostAdjustment_Acct, acct.P_InventoryClearing_Acct, acct.P_Asset_Acct, acct.P_CoGs_Acct," .append(" acct.P_Revenue_Acct, acct.P_Expense_Acct, acct.P_CostAdjustment_Acct, acct.P_InventoryClearing_Acct, acct.P_Asset_Acct, acct.P_CoGs_Acct,")
+ " acct.P_PurchasePriceVariance_Acct, acct.P_InvoicePriceVariance_Acct, acct.P_AverageCostVariance_Acct," .append(" acct.P_PurchasePriceVariance_Acct, acct.P_InvoicePriceVariance_Acct, acct.P_AverageCostVariance_Acct,")
+ " acct.P_TradeDiscountRec_Acct, acct.P_TradeDiscountGrant_Acct, " .append(" acct.P_TradeDiscountRec_Acct, acct.P_TradeDiscountGrant_Acct, ")
+ " acct.P_WIP_Acct, acct.P_FloorStock_Acct, acct.P_MethodChangeVariance_Acct, acct.P_UsageVariance_Acct, acct.P_RateVariance_Acct," .append(" acct.P_WIP_Acct, acct.P_FloorStock_Acct, acct.P_MethodChangeVariance_Acct, acct.P_UsageVariance_Acct, acct.P_RateVariance_Acct,")
+ " acct.P_MixVariance_Acct, acct.P_Labor_Acct, acct.P_Burden_Acct, acct.P_CostOfProduction_Acct, acct.P_OutsideProcessing_Acct, acct.P_Overhead_Acct, acct.P_Scrap_Acct " .append(" acct.P_MixVariance_Acct, acct.P_Labor_Acct, acct.P_Burden_Acct, acct.P_CostOfProduction_Acct, acct.P_OutsideProcessing_Acct, acct.P_Overhead_Acct, acct.P_Scrap_Acct ")
+ "FROM M_Product p" .append("FROM M_Product p")
+ " INNER JOIN M_Product_Category_Acct acct ON (acct.M_Product_Category_ID=p.M_Product_Category_ID)" .append(" INNER JOIN M_Product_Category_Acct acct ON (acct.M_Product_Category_ID=p.M_Product_Category_ID)")
+ "WHERE acct.C_AcctSchema_ID=" + p_C_AcctSchema_ID // # .append("WHERE acct.C_AcctSchema_ID=").append(p_C_AcctSchema_ID) // #
+ " AND p.M_Product_Category_ID=" + p_M_Product_Category_ID // # .append(" AND p.M_Product_Category_ID=").append(p_M_Product_Category_ID) // #
+ " AND NOT EXISTS (SELECT * FROM M_Product_Acct pa " .append(" AND NOT EXISTS (SELECT * FROM M_Product_Acct pa ")
+ "WHERE pa.M_Product_ID=p.M_Product_ID" .append("WHERE pa.M_Product_ID=p.M_Product_ID")
+ " AND pa.C_AcctSchema_ID=acct.C_AcctSchema_ID)"; .append(" AND pa.C_AcctSchema_ID=acct.C_AcctSchema_ID)");
int created = DB.executeUpdate(sql, get_TrxName()); int created = DB.executeUpdate(sql.toString(), get_TrxName());
addLog(0, null, new BigDecimal(created), "@Created@"); addLog(0, null, new BigDecimal(created), "@Created@");
return "@Created@=" + created + ", @Updated@=" + updated; StringBuilder msgreturn = new StringBuilder("@Created@=").append(created).append(", @Updated@=").append(updated);
return msgreturn.toString();
} // doIt } // doIt
} // ProductCategoryAcctCopy } // ProductCategoryAcctCopy

View File

@ -105,7 +105,8 @@ public class ProductionCreate extends SvrProcess {
m_production.setIsCreated("Y"); m_production.setIsCreated("Y");
m_production.save(get_TrxName()); m_production.save(get_TrxName());
return created + " production lines were created"; StringBuilder msgreturn = new StringBuilder(created).append(" production lines were created");
return msgreturn.toString();
} }
protected void isBom(int M_Product_ID) throws Exception protected void isBom(int M_Product_ID) throws Exception

View File

@ -67,7 +67,7 @@ public class ProductionProcess extends SvrProcess {
int processed = 0; int processed = 0;
m_production.setMovementDate(p_MovementDate); m_production.setMovementDate(p_MovementDate);
MProductionLine[] lines = m_production.getLines(); MProductionLine[] lines = m_production.getLines();
StringBuffer errors = new StringBuffer(); StringBuilder errors = new StringBuilder();
for ( int i = 0; i<lines.length; i++) { for ( int i = 0; i<lines.length; i++) {
errors.append( lines[i].createTransactions(m_production.getMovementDate(), mustBeStocked) ); errors.append( lines[i].createTransactions(m_production.getMovementDate(), mustBeStocked) );
//TODO error handling //TODO error handling
@ -84,7 +84,8 @@ public class ProductionProcess extends SvrProcess {
m_production.setProcessed(true); m_production.setProcessed(true);
m_production.saveEx(get_TrxName()); m_production.saveEx(get_TrxName());
return processed + " production lines were processed"; StringBuilder msgreturn = new StringBuilder(processed).append(" production lines were processed");
return msgreturn.toString();
} }

View File

@ -105,7 +105,8 @@ public class ProjectGenOrder extends SvrProcess
log.log(Level.SEVERE, "Lines difference - ProjectLines=" + lines.length + " <> Saved=" + count); log.log(Level.SEVERE, "Lines difference - ProjectLines=" + lines.length + " <> Saved=" + count);
} // Order Lines } // Order Lines
return "@C_Order_ID@ " + order.getDocumentNo() + " (" + count + ")"; StringBuilder msgreturn = new StringBuilder("@C_Order_ID@ ").append(order.getDocumentNo()).append(" (").append(count).append(")");
return msgreturn.toString();
} // doIt } // doIt
/** /**

View File

@ -196,8 +196,8 @@ public class ProjectIssue extends SvrProcess
addLog(pi.getLine(), pi.getMovementDate(), pi.getMovementQty(), null); addLog(pi.getLine(), pi.getMovementDate(), pi.getMovementQty(), null);
counter++; counter++;
} // all InOutLines } // all InOutLines
StringBuilder msgreturn = new StringBuilder("@Created@ ").append(counter);
return "@Created@ " + counter; return msgreturn.toString();
} // issueReceipt } // issueReceipt
@ -258,8 +258,9 @@ public class ProjectIssue extends SvrProcess
addLog(pi.getLine(), pi.getMovementDate(), pi.getMovementQty(), null); addLog(pi.getLine(), pi.getMovementDate(), pi.getMovementQty(), null);
counter++; counter++;
} // allExpenseLines } // allExpenseLines
return "@Created@ " + counter; StringBuilder msgreturn = new StringBuilder("@Created@ ").append(counter);
return msgreturn.toString();
} // issueExpense } // issueExpense

View File

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

View File

@ -77,7 +77,7 @@ public class ProjectPhaseGenOrder extends SvrProcess
{ {
MOrderLine ol = new MOrderLine(order); MOrderLine ol = new MOrderLine(order);
ol.setLine(fromPhase.getSeqNo()); ol.setLine(fromPhase.getSeqNo());
StringBuffer sb = new StringBuffer (fromPhase.getName()); StringBuilder sb = new StringBuilder (fromPhase.getName());
if (fromPhase.getDescription() != null && fromPhase.getDescription().length() > 0) if (fromPhase.getDescription() != null && fromPhase.getDescription().length() > 0)
sb.append(" - ").append(fromPhase.getDescription()); sb.append(" - ").append(fromPhase.getDescription());
ol.setDescription(sb.toString()); ol.setDescription(sb.toString());
@ -90,7 +90,8 @@ public class ProjectPhaseGenOrder extends SvrProcess
ol.setTax(); ol.setTax();
if (!ol.save()) if (!ol.save())
log.log(Level.SEVERE, "doIt - Lines not generated"); log.log(Level.SEVERE, "doIt - Lines not generated");
return "@C_Order_ID@ " + order.getDocumentNo() + " (1)"; StringBuilder msgreturn = new StringBuilder("@C_Order_ID@ ").append(order.getDocumentNo()).append(" (1)");
return msgreturn.toString();
} }
// Project Phase Lines // Project Phase Lines
@ -121,7 +122,7 @@ public class ProjectPhaseGenOrder extends SvrProcess
{ {
MOrderLine ol = new MOrderLine(order); MOrderLine ol = new MOrderLine(order);
ol.setLine(tasks[i].getSeqNo()); ol.setLine(tasks[i].getSeqNo());
StringBuffer sb = new StringBuffer (tasks[i].getName()); StringBuilder sb = new StringBuilder (tasks[i].getName());
if (tasks[i].getDescription() != null && tasks[i].getDescription().length() > 0) if (tasks[i].getDescription() != null && tasks[i].getDescription().length() > 0)
sb.append(" - ").append(tasks[i].getDescription()); sb.append(" - ").append(tasks[i].getDescription());
ol.setDescription(sb.toString()); ol.setDescription(sb.toString());
@ -136,7 +137,8 @@ public class ProjectPhaseGenOrder extends SvrProcess
if (tasks.length != count - lines.length) if (tasks.length != count - lines.length)
log.log(Level.SEVERE, "doIt - Lines difference - ProjectTasks=" + tasks.length + " <> Saved=" + count); log.log(Level.SEVERE, "doIt - Lines difference - ProjectTasks=" + tasks.length + " <> Saved=" + count);
return "@C_Order_ID@ " + order.getDocumentNo() + " (" + count + ")"; StringBuilder msgreturn = new StringBuilder("@C_Order_ID@ ").append(order.getDocumentNo()).append(" (").append(count).append(")");
return msgreturn.toString();
} // doIt } // doIt
} // ProjectPhaseGenOrder } // ProjectPhaseGenOrder

View File

@ -86,7 +86,7 @@ public class RegisterSystem extends SvrProcess
// Create Query String // Create Query String
String enc = WebEnv.ENCODING; String enc = WebEnv.ENCODING;
// Send GET Request // Send GET Request
StringBuffer urlString = new StringBuffer ("http://www.adempiere.com") StringBuilder urlString = new StringBuilder ("http://www.adempiere.com")
.append("/wstore/registrationServlet?"); .append("/wstore/registrationServlet?");
// System Info // System Info
urlString.append("Name=").append(URLEncoder.encode(sys.getName(), enc)) urlString.append("Name=").append(URLEncoder.encode(sys.getName(), enc))

View File

@ -67,7 +67,7 @@ public class ReplenishReport extends SvrProcess
/** Document Type */ /** Document Type */
private int p_C_DocType_ID = 0; private int p_C_DocType_ID = 0;
/** Return Info */ /** Return Info */
private String m_info = ""; private StringBuffer m_info = new StringBuffer();
/** /**
* Prepare - e.g., get Parameters. * Prepare - e.g., get Parameters.
@ -130,7 +130,7 @@ public class ReplenishReport extends SvrProcess
createMovements(); createMovements();
else if (p_ReplenishmentCreate.equals("DOO")) else if (p_ReplenishmentCreate.equals("DOO"))
createDO(); createDO();
return m_info; return m_info.toString();
} // doIt } // doIt
/** /**
@ -435,8 +435,8 @@ public class ReplenishReport extends SvrProcess
line.setPrice(); line.setPrice();
line.saveEx(); line.saveEx();
} }
m_info = "#" + noOrders + info.toString(); m_info = new StringBuffer("#").append(noOrders).append(info.toString());
log.info(m_info); log.info(m_info.toString());
} // createPO } // createPO
/** /**
@ -481,8 +481,8 @@ public class ReplenishReport extends SvrProcess
line.setPrice(); line.setPrice();
line.saveEx(); line.saveEx();
} }
m_info = "#" + noReqs + info.toString(); m_info = new StringBuffer("#").append(noReqs).append(info.toString());
log.info(m_info); log.info(m_info.toString());
} // createRequisition } // createRequisition
/** /**
@ -567,13 +567,13 @@ public class ReplenishReport extends SvrProcess
} }
if (replenishs.length == 0) if (replenishs.length == 0)
{ {
m_info = "No Source Warehouse"; m_info = new StringBuffer("No Source Warehouse");
log.warning(m_info); log.warning(m_info.toString());
} }
else else
{ {
m_info = "#" + noMoves + info; m_info = new StringBuffer("#") .append(noMoves).append(info);
log.info(m_info); log.info(m_info.toString());
} }
} // Create Inventory Movements } // Create Inventory Movements
@ -608,10 +608,11 @@ public class ReplenishReport extends SvrProcess
M_WarehouseSource_ID = replenish.getM_WarehouseSource_ID(); M_WarehouseSource_ID = replenish.getM_WarehouseSource_ID();
M_Warehouse_ID = replenish.getM_Warehouse_ID(); M_Warehouse_ID = replenish.getM_Warehouse_ID();
order = new MDDOrder (getCtx(), 0, get_TrxName()); order = new MDDOrder (getCtx(), 0, get_TrxName());
order.setC_DocType_ID(p_C_DocType_ID); order.setC_DocType_ID(p_C_DocType_ID);
order.setDescription(Msg.getMsg(getCtx(), "Replenishment") StringBuffer msgsd = new StringBuffer(Msg.getMsg(getCtx(), "Replenishment"))
+ ": " + whSource.getName() + "->" + wh.getName()); .append(": ").append(whSource.getName()).append("->").append(wh.getName());
order.setDescription(msgsd.toString());
// Set Org // Set Org
order.setAD_Org_ID(whSource.getAD_Org_ID()); order.setAD_Org_ID(whSource.getAD_Org_ID());
// Set Org Trx // Set Org Trx
@ -714,13 +715,13 @@ public class ReplenishReport extends SvrProcess
} }
if (replenishs.length == 0) if (replenishs.length == 0)
{ {
m_info = "No Source Warehouse"; m_info = new StringBuffer("No Source Warehouse");
log.warning(m_info); log.warning(m_info.toString());
} }
else else
{ {
m_info = "#" + noMoves + info; m_info = new StringBuffer("#").append(noMoves).append(info);
log.info(m_info); log.info(m_info.toString());
} }
} // create Distribution Order } // create Distribution Order

View File

@ -70,7 +70,7 @@ public class ReplenishReportProduction extends SvrProcess
/** Document Type */ /** Document Type */
private int p_C_DocType_ID = 0; private int p_C_DocType_ID = 0;
/** Return Info */ /** Return Info */
private String m_info = ""; private StringBuffer m_info = new StringBuffer();
private int p_M_Product_Category_ID = 0; private int p_M_Product_Category_ID = 0;
private String isKanban = null; private String isKanban = null;
@ -108,12 +108,12 @@ public class ReplenishReportProduction extends SvrProcess
* @throws Exception if not successful * @throws Exception if not successful
*/ */
protected String doIt() throws Exception protected String doIt() throws Exception
{ {
StringBuilder msglog = new StringBuilder("M_Warehouse_ID=").append(p_M_Warehouse_ID) log.info("M_Warehouse_ID=" + p_M_Warehouse_ID
.append(", C_BPartner_ID=").append(p_C_BPartner_ID) + ", C_BPartner_ID=" + p_C_BPartner_ID
.append(" - ReplenishmentCreate=").append(p_ReplenishmentCreate) +" - ReplenishmentCreate=" + p_ReplenishmentCreate
.append(", C_DocType_ID=").append(p_C_DocType_ID); + ", C_DocType_ID=" + p_C_DocType_ID);
log.info(msglog.toString());
if (p_ReplenishmentCreate != null && p_C_DocType_ID == 0 && !p_ReplenishmentCreate.equals("PRD")) if (p_ReplenishmentCreate != null && p_C_DocType_ID == 0 && !p_ReplenishmentCreate.equals("PRD"))
throw new AdempiereUserError("@FillMandatory@ @C_DocType_ID@"); throw new AdempiereUserError("@FillMandatory@ @C_DocType_ID@");
@ -141,7 +141,7 @@ public class ReplenishReportProduction extends SvrProcess
createDO(); createDO();
else if (p_ReplenishmentCreate.equals("PRD")) else if (p_ReplenishmentCreate.equals("PRD"))
createProduction(); createProduction();
return m_info; return m_info.toString();
} // doIt } // doIt
/** /**
@ -470,8 +470,8 @@ public class ReplenishReportProduction extends SvrProcess
line.setPrice(); line.setPrice();
line.saveEx(); line.saveEx();
} }
m_info = "#" + noOrders + info.toString(); m_info = new StringBuffer("#").append(noOrders).append(info.toString());
log.info(m_info); log.info(m_info.toString());
} // createPO } // createPO
/** /**
@ -516,8 +516,8 @@ public class ReplenishReportProduction extends SvrProcess
line.setPrice(); line.setPrice();
line.saveEx(); line.saveEx();
} }
m_info = "#" + noReqs + info.toString(); m_info = new StringBuffer("#").append(noReqs).append(info.toString());
log.info(m_info); log.info(m_info.toString());
} // createRequisition } // createRequisition
/** /**
@ -554,8 +554,9 @@ public class ReplenishReportProduction extends SvrProcess
move = new MMovement (getCtx(), 0, get_TrxName()); move = new MMovement (getCtx(), 0, get_TrxName());
move.setC_DocType_ID(p_C_DocType_ID); move.setC_DocType_ID(p_C_DocType_ID);
move.setDescription(Msg.getMsg(getCtx(), "Replenishment") StringBuilder msgsd = new StringBuilder(Msg.getMsg(getCtx(), "Replenishment"))
+ ": " + whSource.getName() + "->" + wh.getName()); .append(": ").append(whSource.getName()).append("->").append(wh.getName());
move.setDescription(msgsd.toString());
// Set Org // Set Org
move.setAD_Org_ID(whSource.getAD_Org_ID()); move.setAD_Org_ID(whSource.getAD_Org_ID());
if (!move.save()) if (!move.save())
@ -602,13 +603,13 @@ public class ReplenishReportProduction extends SvrProcess
} }
if (replenishs.length == 0) if (replenishs.length == 0)
{ {
m_info = "No Source Warehouse"; m_info = new StringBuffer("No Source Warehouse");
log.warning(m_info); log.warning(m_info.toString());
} }
else else
{ {
m_info = "#" + noMoves + info.toString(); m_info = new StringBuffer("#").append(noMoves).append(info.toString());
log.info(m_info); log.info(m_info.toString());
} }
} // Create Inventory Movements } // Create Inventory Movements
@ -645,8 +646,9 @@ public class ReplenishReportProduction extends SvrProcess
order = new MDDOrder (getCtx(), 0, get_TrxName()); order = new MDDOrder (getCtx(), 0, get_TrxName());
order.setC_DocType_ID(p_C_DocType_ID); order.setC_DocType_ID(p_C_DocType_ID);
order.setDescription(Msg.getMsg(getCtx(), "Replenishment") StringBuilder msgsd = new StringBuilder(Msg.getMsg(getCtx(), "Replenishment"))
+ ": " + whSource.getName() + "->" + wh.getName()); .append(": ").append(whSource.getName()).append("->").append(wh.getName());
order.setDescription(msgsd.toString());
// Set Org // Set Org
order.setAD_Org_ID(whSource.getAD_Org_ID()); order.setAD_Org_ID(whSource.getAD_Org_ID());
// Set Org Trx // Set Org Trx
@ -749,13 +751,13 @@ public class ReplenishReportProduction extends SvrProcess
} }
if (replenishs.length == 0) if (replenishs.length == 0)
{ {
m_info = "No Source Warehouse"; m_info = new StringBuffer("No Source Warehouse");
log.warning(m_info); log.warning(m_info.toString());
} }
else else
{ {
m_info = "#" + noMoves + info.toString(); m_info = new StringBuffer("#").append(noMoves).append(info.toString());
log.info(m_info); log.info(m_info.toString());
} }
} // create Distribution Order } // create Distribution Order
/** /**
@ -820,8 +822,8 @@ public class ReplenishReportProduction extends SvrProcess
} }
} }
m_info = "#" + noProds + info.toString(); m_info = new StringBuffer("#").append(noProds).append(info.toString());
log.info(m_info); log.info(m_info.toString());
} // createRequisition } // createRequisition
/** /**

View File

@ -251,7 +251,7 @@ public class ReplicationLocal extends SvrProcess
data.Test = m_test; data.Test = m_test;
data.TableName = TableName; data.TableName = TableName;
// Create SQL // Create SQL
StringBuffer sql = new StringBuffer("SELECT * FROM ") StringBuilder sql = new StringBuilder("SELECT * FROM ")
.append(TableName) .append(TableName)
.append(" WHERE AD_Client_ID=").append(m_replication.getRemote_Client_ID()); .append(" WHERE AD_Client_ID=").append(m_replication.getRemote_Client_ID());
if (m_replication.getRemote_Org_ID() != 0) if (m_replication.getRemote_Org_ID() != 0)
@ -289,12 +289,12 @@ public class ReplicationLocal extends SvrProcess
// send it // send it
pi = m_serverRemote.process (new Properties (), pi); pi = m_serverRemote.process (new Properties (), pi);
ProcessInfoLog[] logs = pi.getLogs(); ProcessInfoLog[] logs = pi.getLogs();
String msg = "< "; StringBuilder msg = new StringBuilder("< ");
if (logs != null && logs.length > 0) if (logs != null && logs.length > 0)
msg += logs[0].getP_Msg(); // Remote Message msg.append(logs[0].getP_Msg()); // Remote Message
log.info("mergeDataTable - " + pi); log.info("mergeDataTable - " + pi);
// //
MReplicationLog rLog = new MReplicationLog (getCtx(), m_replicationRun.getAD_Replication_Run_ID(), AD_ReplicationTable_ID, msg, get_TrxName()); MReplicationLog rLog = new MReplicationLog (getCtx(), m_replicationRun.getAD_Replication_Run_ID(), AD_ReplicationTable_ID, msg.toString(), get_TrxName());
if (pi.isError()) if (pi.isError())
{ {
log.severe ("mergeDataTable Error - " + pi); log.severe ("mergeDataTable Error - " + pi);
@ -429,7 +429,7 @@ public class ReplicationLocal extends SvrProcess
data.Test = m_test; data.Test = m_test;
data.TableName = TableName; data.TableName = TableName;
// Create SQL // Create SQL
StringBuffer sql = new StringBuffer ("SELECT * FROM ") StringBuilder sql = new StringBuilder ("SELECT * FROM ")
.append(TableName) .append(TableName)
.append(" WHERE AD_Client_ID=").append(m_replication.getRemote_Client_ID()); .append(" WHERE AD_Client_ID=").append(m_replication.getRemote_Client_ID());
if (m_replication.getRemote_Org_ID() != 0) if (m_replication.getRemote_Org_ID() != 0)
@ -488,11 +488,11 @@ public class ReplicationLocal extends SvrProcess
pi = m_serverRemote.process (new Properties (), pi); pi = m_serverRemote.process (new Properties (), pi);
log.info("sendUpdatesTable - " + pi); log.info("sendUpdatesTable - " + pi);
ProcessInfoLog[] logs = pi.getLogs(); ProcessInfoLog[] logs = pi.getLogs();
String msg = "> "; StringBuilder msg = new StringBuilder("> ");
if (logs != null && logs.length > 0) if (logs != null && logs.length > 0)
msg += logs[0].getP_Msg(); // Remote Message msg.append(logs[0].getP_Msg()); // Remote Message
// //
MReplicationLog rLog = new MReplicationLog (getCtx(), m_replicationRun.getAD_Replication_Run_ID(), AD_ReplicationTable_ID, msg, get_TrxName()); MReplicationLog rLog = new MReplicationLog (getCtx(), m_replicationRun.getAD_Replication_Run_ID(), AD_ReplicationTable_ID, msg.toString(), get_TrxName());
if (pi.isError()) if (pi.isError())
m_replicated = false; m_replicated = false;
rLog.setIsReplicated(!pi.isError()); rLog.setIsReplicated(!pi.isError());

View File

@ -152,21 +152,21 @@ public class ReplicationRemote extends SvrProcess
*/ */
private void setupRemoteAD_Sequence (BigDecimal IDRangeStart) throws Exception private void setupRemoteAD_Sequence (BigDecimal IDRangeStart) throws Exception
{ {
String sql = "UPDATE AD_Sequence SET StartNo = " + IDRangeStart StringBuilder sql = new StringBuilder("UPDATE AD_Sequence SET StartNo = ").append(IDRangeStart)
+ " WHERE IsTableID='Y' AND StartNo < " + IDRangeStart; .append(" WHERE IsTableID='Y' AND StartNo < ").append(IDRangeStart);
int no = DB.executeUpdate(sql, get_TrxName()); int no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no == -1) if (no == -1)
throw new Exception("setupRemoteAD_Sequence_Start"); throw new Exception("setupRemoteAD_Sequence_Start");
// //
sql = "UPDATE AD_Sequence SET CurrentNext = " + IDRangeStart sql = new StringBuilder("UPDATE AD_Sequence SET CurrentNext = ").append(IDRangeStart)
+ " WHERE IsTableID='Y' AND CurrentNext < " + IDRangeStart; .append(" WHERE IsTableID='Y' AND CurrentNext < ").append(IDRangeStart);
no = DB.executeUpdate(sql, get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no == -1) if (no == -1)
throw new Exception("setupRemoteAD_Sequence_Next"); throw new Exception("setupRemoteAD_Sequence_Next");
// //
sql = "UPDATE AD_Sequence SET CurrentNextSys = -1" sql = new StringBuilder("UPDATE AD_Sequence SET CurrentNextSys = -1")
+ " WHERE IsTableID='Y' AND CurrentNextSys <> -1"; .append(" WHERE IsTableID='Y' AND CurrentNextSys <> -1");
no = DB.executeUpdate(sql, get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no == -1) if (no == -1)
throw new Exception("setupRemoteAD_Sequence_Sys"); throw new Exception("setupRemoteAD_Sequence_Sys");
} // setupRemoteAD_Sequence } // setupRemoteAD_Sequence
@ -185,17 +185,17 @@ public class ReplicationRemote extends SvrProcess
if (Suffix == null) if (Suffix == null)
Suffix = ""; Suffix = "";
// DocNoSequence_ID // DocNoSequence_ID
String sql = "UPDATE AD_Sequence SET Prefix=" + DB.TO_STRING(Prefix) + ", Suffix=" + DB.TO_STRING(Suffix) StringBuilder sql = new StringBuilder("UPDATE AD_Sequence SET Prefix=").append(DB.TO_STRING(Prefix)).append(", Suffix=").append(DB.TO_STRING(Suffix))
+ " WHERE AD_Sequence_ID IN (SELECT DocNoSequence_ID FROM C_DocType" .append(" WHERE AD_Sequence_ID IN (SELECT DocNoSequence_ID FROM C_DocType")
+ " WHERE AD_Client_ID=" + AD_Client_ID + " AND DocNoSequence_ID IS NOT NULL)"; .append(" WHERE AD_Client_ID=").append(AD_Client_ID).append(" AND DocNoSequence_ID IS NOT NULL)");
int no = DB.executeUpdate(sql, get_TrxName()); int no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no == -1) if (no == -1)
throw new Exception("setupRemoteC_DocType_DocNo"); throw new Exception("setupRemoteC_DocType_DocNo");
// BatchNoSequence_ID // BatchNoSequence_ID
sql = "UPDATE AD_Sequence SET Prefix=" + DB.TO_STRING(Prefix) + ", Suffix=" + DB.TO_STRING(Suffix) sql = new StringBuilder("UPDATE AD_Sequence SET Prefix=").append(DB.TO_STRING(Prefix)).append(", Suffix=").append(DB.TO_STRING(Suffix))
+ " WHERE AD_Sequence_ID IN (SELECT BatchNoSequence_ID FROM C_DocType" .append(" WHERE AD_Sequence_ID IN (SELECT BatchNoSequence_ID FROM C_DocType")
+ " WHERE AD_Client_ID=" + AD_Client_ID + " AND BatchNoSequence_ID IS NOT NULL)"; .append(" WHERE AD_Client_ID=").append(AD_Client_ID).append(" AND BatchNoSequence_ID IS NOT NULL)");
no = DB.executeUpdate(sql, get_TrxName()); no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no == -1) if (no == -1)
throw new Exception("setupRemoteC_DocType_Batch"); throw new Exception("setupRemoteC_DocType_Batch");
} // setupRemoteC_DocType } // setupRemoteC_DocType
@ -208,9 +208,9 @@ public class ReplicationRemote extends SvrProcess
*/ */
private void setupRemoteAD_Table(String TableName, String ReplicationType) throws Exception private void setupRemoteAD_Table(String TableName, String ReplicationType) throws Exception
{ {
String sql = "UPDATE AD_Table SET ReplicationType = '" + ReplicationType StringBuilder sql = new StringBuilder("UPDATE AD_Table SET ReplicationType = '").append(ReplicationType)
+ "' WHERE TableName='" + TableName + "' AND ReplicationType <> '" + ReplicationType + "'"; .append("' WHERE TableName='").append(TableName).append("' AND ReplicationType <> '").append(ReplicationType).append("'");
int no = DB.executeUpdate(sql, get_TrxName()); int no = DB.executeUpdate(sql.toString(), get_TrxName());
if (no == -1) if (no == -1)
throw new Exception("setupRemoteAD_Table"); throw new Exception("setupRemoteAD_Table");
} // setupRemoteAD_Table } // setupRemoteAD_Table

View File

@ -80,7 +80,8 @@ public class ReportColumnSet_Copy extends SvrProcess
rc.saveEx(); rc.saveEx();
} }
// Oper 1/2 were set to Null ! // Oper 1/2 were set to Null !
return "@Copied@=" + rcs.length; StringBuilder msgreturn = new StringBuilder("@Copied@=").append(rcs.length);
return msgreturn.toString();
} // doIt } // doIt
} // ReportColumnSet_Copy } // ReportColumnSet_Copy

View File

@ -90,7 +90,8 @@ public class ReportLineSet_Copy extends SvrProcess
} }
// Oper 1/2 were set to Null ! // Oper 1/2 were set to Null !
} }
return "@Copied@=" + rls.length; StringBuilder msgreturn = new StringBuilder("@Copied@=").append(rls.length);
return msgreturn.toString();
} // doIt } // doIt
} // ReportLineSet_Copy } // ReportLineSet_Copy

View File

@ -160,9 +160,10 @@ public class RequestEMailProcessor extends SvrProcess
{ {
} }
return "processInBox - Total=" + noProcessed + StringBuilder msgreturn = new StringBuilder("processInBox - Total=").append(noProcessed)
" - Requests=" + noRequest + .append(" - Requests=").append(noRequest)
" - Errors=" + noError; .append(" - Errors=").append(noError);
return msgreturn.toString();
} // doIt } // doIt
/************************************************************************** /**************************************************************************
@ -409,9 +410,11 @@ public class RequestEMailProcessor extends SvrProcess
MRequest req = new MRequest(getCtx(), 0, get_TrxName()); MRequest req = new MRequest(getCtx(), 0, get_TrxName());
// Subject as summary // Subject as summary
req.setSummary("FROM: " + fromAddress + "\n" + msg.getSubject()); StringBuilder msgreq = new StringBuilder("FROM: ").append(fromAddress).append("\n").append(msg.getSubject());
req.setSummary(msgreq.toString());
// Body as result // Body as result
req.setResult("FROM: " + from[0].toString() + "\n" + getMessage(msg)); msgreq = new StringBuilder("FROM: ") .append(from[0].toString()).append("\n").append(getMessage(msg));
req.setResult(msgreq.toString());
// Message-ID as documentNo // Message-ID as documentNo
if (hdrs != null) if (hdrs != null)
req.setDocumentNo(hdrs[0].substring(0,30)); req.setDocumentNo(hdrs[0].substring(0,30));
@ -534,7 +537,8 @@ public class RequestEMailProcessor extends SvrProcess
MRequest requp = new MRequest(getCtx(), request_upd, get_TrxName()); MRequest requp = new MRequest(getCtx(), request_upd, get_TrxName());
// Body as result // Body as result
Address[] from = msg.getFrom(); Address[] from = msg.getFrom();
requp.setResult("FROM: " + from[0].toString() + "\n" + getMessage(msg)); StringBuilder msgreq = new StringBuilder("FROM: ").append(from[0].toString()).append("\n").append(getMessage(msg));
requp.setResult(msgreq.toString());
return requp.save(); return requp.save();
} }
@ -605,7 +609,7 @@ public class RequestEMailProcessor extends SvrProcess
*/ */
private String getMessage (Part msg) private String getMessage (Part msg)
{ {
StringBuffer sb = new StringBuffer(); StringBuilder sb = new StringBuilder();
try try
{ {
// Text // Text
@ -790,30 +794,37 @@ public class RequestEMailProcessor extends SvrProcess
{ {
printOut("-----------------------------------------------------------------"); printOut("-----------------------------------------------------------------");
Address[] a; Address[] a;
StringBuilder msgout = new StringBuilder();
// FROM // FROM
if ((a = m.getFrom()) != null) if ((a = m.getFrom()) != null)
{ {
for (int j = 0; j < a.length; j++) for (int j = 0; j < a.length; j++){
printOut("FROM: " + a[j].toString()); msgout = new StringBuilder("FROM: ").append(a[j].toString());
printOut(msgout.toString());
}
} }
// TO // TO
if ((a = m.getRecipients(Message.RecipientType.TO)) != null) if ((a = m.getRecipients(Message.RecipientType.TO)) != null)
{ {
for (int j = 0; j < a.length; j++) for (int j = 0; j < a.length; j++){
printOut("TO: " + a[j].toString()); msgout = new StringBuilder("TO: ").append(a[j].toString());
printOut(msgout.toString());
}
} }
// SUBJECT // SUBJECT
printOut("SUBJECT: " + m.getSubject()); msgout = new StringBuilder("SUBJECT: ").append(m.getSubject());
printOut(msgout.toString());
// DATE // DATE
java.util.Date d = m.getSentDate(); java.util.Date d = m.getSentDate();
printOut("SendDate: " + (d != null ? d.toString() : "UNKNOWN")); msgout = new StringBuilder("SendDate: ").append((d != null ? d.toString() : "UNKNOWN"));
printOut(msgout.toString());
// FLAGS // FLAGS
Flags flags = m.getFlags(); Flags flags = m.getFlags();
StringBuffer sb = new StringBuffer(); StringBuilder sb = new StringBuilder();
Flags.Flag[] sf = flags.getSystemFlags(); // get the system flags Flags.Flag[] sf = flags.getSystemFlags(); // get the system flags
boolean first = true; boolean first = true;
@ -851,13 +862,14 @@ public class RequestEMailProcessor extends SvrProcess
sb.append(' '); sb.append(' ');
sb.append(uf[i]); sb.append(uf[i]);
} }
printOut("FLAGS: " + sb.toString()); msgout = new StringBuilder("FLAGS: ").append(sb.toString());
printOut(msgout.toString());
// X-MAILER // X-MAILER
String[] hdrs = m.getHeader("X-Mailer"); String[] hdrs = m.getHeader("X-Mailer");
if (hdrs != null) if (hdrs != null)
{ {
StringBuffer sb1 = new StringBuffer("X-Mailer: "); StringBuilder sb1 = new StringBuilder("X-Mailer: ");
for (int i = 0; i < hdrs.length; i++) for (int i = 0; i < hdrs.length; i++)
sb1.append(hdrs[i]).append(" "); sb1.append(hdrs[i]).append(" ");
printOut(sb1.toString()); printOut(sb1.toString());
@ -869,7 +881,7 @@ public class RequestEMailProcessor extends SvrProcess
hdrs = m.getHeader("Message-ID"); hdrs = m.getHeader("Message-ID");
if (hdrs != null) if (hdrs != null)
{ {
StringBuffer sb1 = new StringBuffer("Message-ID: "); StringBuilder sb1 = new StringBuilder("Message-ID: ");
for (int i = 0; i < hdrs.length; i++) for (int i = 0; i < hdrs.length; i++)
sb1.append(hdrs[i]).append(" "); sb1.append(hdrs[i]).append(" ");
printOut(sb1.toString()); printOut(sb1.toString());
@ -883,7 +895,8 @@ public class RequestEMailProcessor extends SvrProcess
while (en.hasMoreElements()) while (en.hasMoreElements())
{ {
Header hdr = (Header)en.nextElement(); Header hdr = (Header)en.nextElement();
printOut (" " + hdr.getName() + " = " + hdr.getValue()); msgout = new StringBuilder(" ").append(hdr.getName()).append(" = ").append(hdr.getValue());
printOut (msgout.toString());
} }
@ -899,7 +912,8 @@ public class RequestEMailProcessor extends SvrProcess
{ {
// http://www.iana.org/assignments/media-types/ // http://www.iana.org/assignments/media-types/
printOut("================================================================="); printOut("=================================================================");
printOut("CONTENT-TYPE: " + p.getContentType()); StringBuilder msgout = new StringBuilder("CONTENT-TYPE: ").append(p.getContentType());
printOut(msgout.toString());
/** /**
Enumeration en = p.getAllHeaders(); Enumeration en = p.getAllHeaders();
while (en.hasMoreElements()) while (en.hasMoreElements())

View File

@ -98,26 +98,26 @@ public class RequestInvoice extends SvrProcess
if (!type.isInvoiced()) if (!type.isInvoiced())
throw new AdempiereSystemError("@R_RequestType_ID@ <> @IsInvoiced@"); throw new AdempiereSystemError("@R_RequestType_ID@ <> @IsInvoiced@");
String sql = "SELECT * FROM R_Request r" StringBuilder sql = new StringBuilder("SELECT * FROM R_Request r")
+ " INNER JOIN R_Status s ON (r.R_Status_ID=s.R_Status_ID) " .append(" INNER JOIN R_Status s ON (r.R_Status_ID=s.R_Status_ID) ")
+ "WHERE s.IsClosed='Y'" .append("WHERE s.IsClosed='Y'")
+ " AND r.R_RequestType_ID=?"; .append(" AND r.R_RequestType_ID=?");
// globalqss -- avoid double invoicing // globalqss -- avoid double invoicing
// + " AND EXISTS (SELECT 1 FROM R_RequestUpdate ru " + // + " AND EXISTS (SELECT 1 FROM R_RequestUpdate ru " +
// "WHERE ru.R_Request_ID=r.R_Request_ID AND NVL(C_InvoiceLine_ID,0)=0"; // "WHERE ru.R_Request_ID=r.R_Request_ID AND NVL(C_InvoiceLine_ID,0)=0";
if (p_R_Group_ID != 0) if (p_R_Group_ID != 0)
sql += " AND r.R_Group_ID=?"; sql.append(" AND r.R_Group_ID=?");
if (p_R_Category_ID != 0) if (p_R_Category_ID != 0)
sql += " AND r.R_Category_ID=?"; sql.append(" AND r.R_Category_ID=?");
if (p_C_BPartner_ID != 0) if (p_C_BPartner_ID != 0)
sql += " AND r.C_BPartner_ID=?"; sql.append(" AND r.C_BPartner_ID=?");
sql += " AND r.IsInvoiced='Y' " sql.append(" AND r.IsInvoiced='Y' ")
+ "ORDER BY C_BPartner_ID"; .append("ORDER BY C_BPartner_ID");
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
try try
{ {
pstmt = DB.prepareStatement (sql, get_TrxName()); pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
int index = 1; int index = 1;
pstmt.setInt (index++, p_R_RequestType_ID); pstmt.setInt (index++, p_R_RequestType_ID);
if (p_R_Group_ID != 0) if (p_R_Group_ID != 0)
@ -150,7 +150,7 @@ public class RequestInvoice extends SvrProcess
} }
catch (Exception e) catch (Exception e)
{ {
log.log (Level.SEVERE, sql, e); log.log (Level.SEVERE, sql.toString(), e);
} }
try try
{ {

View File

@ -173,7 +173,7 @@ public class RequisitionPOCreate extends SvrProcess
+ ", ConsolidateDocument" + p_ConsolidateDocument); + ", ConsolidateDocument" + p_ConsolidateDocument);
ArrayList<Object> params = new ArrayList<Object>(); ArrayList<Object> params = new ArrayList<Object>();
StringBuffer whereClause = new StringBuffer("C_OrderLine_ID IS NULL"); StringBuilder whereClause = new StringBuilder("C_OrderLine_ID IS NULL");
if (p_AD_Org_ID > 0) if (p_AD_Org_ID > 0)
{ {
whereClause.append(" AND AD_Org_ID=?"); whereClause.append(" AND AD_Org_ID=?");
@ -355,8 +355,9 @@ public class RequisitionPOCreate extends SvrProcess
// default po document type // default po document type
if (!p_ConsolidateDocument) if (!p_ConsolidateDocument)
{ {
m_order.setDescription(Msg.getElement(getCtx(), "M_Requisition_ID") StringBuilder msgsd= new StringBuilder(Msg.getElement(getCtx(), "M_Requisition_ID"))
+ ": " + rLine.getParent().getDocumentNo()); .append(": ").append(rLine.getParent().getDocumentNo());
m_order.setDescription(msgsd.toString());
} }
// Prepare Save // Prepare Save

View File

@ -78,7 +78,8 @@ public class RfQClose extends SvrProcess
counter++; counter++;
} }
// //
return "# " + counter; StringBuilder msgreturn = new StringBuilder("# ").append(counter);
return msgreturn.toString();
} // doIt } // doIt
} // RfQClose } // RfQClose