diff --git a/org.adempiere.base.process/src/org/compiere/process/RfQCopyLines.java b/org.adempiere.base.process/src/org/compiere/process/RfQCopyLines.java index 2f4c7f93f7..4057a4fa3a 100644 --- a/org.adempiere.base.process/src/org/compiere/process/RfQCopyLines.java +++ b/org.adempiere.base.process/src/org/compiere/process/RfQCopyLines.java @@ -103,6 +103,7 @@ public class RfQCopyLines extends SvrProcess } // copy all lines // - return "# " + counter; + StringBuilder msgreturn = new StringBuilder("# ").append(counter); + return msgreturn.toString(); } // doIt } diff --git a/org.adempiere.base.process/src/org/compiere/process/RfQCreate.java b/org.adempiere.base.process/src/org/compiere/process/RfQCreate.java index d04666b5eb..897e1dfb47 100644 --- a/org.adempiere.base.process/src/org/compiere/process/RfQCreate.java +++ b/org.adempiere.base.process/src/org/compiere/process/RfQCreate.java @@ -110,10 +110,10 @@ public class RfQCreate extends SvrProcess } } // for all subscribers - String retValue = "@Created@ " + counter; + StringBuilder retValue = new StringBuilder("@Created@ ").append(counter); if (p_IsSendRfQ) - retValue += " - @IsSendRfQ@=" + sent + " - @Error@=" + notSent; - return retValue; + retValue.append(" - @IsSendRfQ@=").append(sent).append(" - @Error@=").append(notSent); + return retValue.toString(); } // doIt } // RfQCreate diff --git a/org.adempiere.base.process/src/org/compiere/process/RfQCreatePO.java b/org.adempiere.base.process/src/org/compiere/process/RfQCreatePO.java index f18e11a4a0..60bf10829f 100644 --- a/org.adempiere.base.process/src/org/compiere/process/RfQCreatePO.java +++ b/org.adempiere.base.process/src/org/compiere/process/RfQCreatePO.java @@ -202,7 +202,7 @@ public class RfQCreatePO extends SvrProcess response.saveEx(); } } - - return "#" + noOrders; + StringBuilder msgreturn = new StringBuilder("#").append(noOrders); + return msgreturn.toString(); } // doIt } // RfQCreatePO diff --git a/org.adempiere.base.process/src/org/compiere/process/RfQResponseRank.java b/org.adempiere.base.process/src/org/compiere/process/RfQResponseRank.java index fda0e93371..a7e463e032 100644 --- a/org.adempiere.base.process/src/org/compiere/process/RfQResponseRank.java +++ b/org.adempiere.base.process/src/org/compiere/process/RfQResponseRank.java @@ -97,7 +97,8 @@ public class RfQResponseRank extends SvrProcess rankResponses(rfq, responses); else rankLines (rfq, responses); - return "# " + responses.length; + StringBuilder msgreturn = new StringBuilder("# ").append(responses.length); + return msgreturn.toString(); } // doIt diff --git a/org.adempiere.base.process/src/org/compiere/process/RoleAccessUpdate.java b/org.adempiere.base.process/src/org/compiere/process/RoleAccessUpdate.java index 77ebb01ce7..2085253cfd 100644 --- a/org.adempiere.base.process/src/org/compiere/process/RoleAccessUpdate.java +++ b/org.adempiere.base.process/src/org/compiere/process/RoleAccessUpdate.java @@ -86,20 +86,20 @@ public class RoleAccessUpdate extends SvrProcess else { List params = new ArrayList(); - String whereClause = "1=1"; + StringBuilder whereClause = new StringBuilder("1=1"); if (p_AD_Client_ID > 0) { - whereClause += " AND AD_Client_ID=? "; + whereClause.append(" AND AD_Client_ID=? "); params.add(p_AD_Client_ID); } if (p_AD_Role_ID == 0) // System Role { - whereClause += " AND AD_Role_ID=?"; + whereClause.append(" AND AD_Role_ID=?"); params.add(p_AD_Role_ID); } //sql += "ORDER BY AD_Client_ID, Name"; - List roles = new Query(getCtx(), MRole.Table_Name, whereClause, get_TrxName()) + List roles = new Query(getCtx(), MRole.Table_Name, whereClause.toString(), get_TrxName()) .setOnlyActiveRecords(true) .setParameters(params) .setOrderBy("AD_Client_ID, Name") @@ -120,8 +120,9 @@ public class RoleAccessUpdate extends SvrProcess */ private void updateRole (MRole role) { - addLog(0, null, null, role.getName() + ": " - + role.updateAccessRecords(p_IsReset)); + StringBuilder msglog = new StringBuilder(role.getName()).append(": ") + .append(role.updateAccessRecords(p_IsReset)); + addLog(0, null, null, msglog.toString()); } // updateRole //add main method, preparing for nightly build @@ -138,7 +139,8 @@ public class RoleAccessUpdate extends SvrProcess RoleAccessUpdate rau = new RoleAccessUpdate(); rau.startProcess(Env.getCtx(), pi, null); - System.out.println("Process=" + pi.getTitle() + " Error="+pi.isError() + " Summary=" + pi.getSummary()); + StringBuilder msgout= new StringBuilder("Process=").append(pi.getTitle()).append(" Error=").append(pi.isError()).append(" Summary=").append(pi.getSummary()); + System.out.println(msgout.toString()); } } // RoleAccessUpdate diff --git a/org.adempiere.base.process/src/org/compiere/process/RollUpCosts.java b/org.adempiere.base.process/src/org/compiere/process/RollUpCosts.java index b8f2987ad7..54a1256187 100644 --- a/org.adempiere.base.process/src/org/compiere/process/RollUpCosts.java +++ b/org.adempiere.base.process/src/org/compiere/process/RollUpCosts.java @@ -95,9 +95,9 @@ public class RollUpCosts extends SvrProcess { protected void rollUpCosts(int p_id) throws Exception { - String sql = "SELECT M_ProductBOM_ID FROM M_Product_BOM WHERE M_Product_ID = ? " + - " AND AD_Client_ID = " + client_id; - int[] prodbomids = DB.getIDsEx(get_TrxName(), sql, client_id); + StringBuilder sql = new StringBuilder("SELECT M_ProductBOM_ID FROM M_Product_BOM WHERE M_Product_ID = ? ") + .append(" AND AD_Client_ID = ").append(client_id); + int[] prodbomids = DB.getIDsEx(get_TrxName(), sql.toString(), client_id); for (int prodbomid : prodbomids) { if ( !processed.contains(p_id)) { @@ -106,17 +106,17 @@ public class RollUpCosts extends SvrProcess { } //once the subproducts costs are accurate, calculate the costs for this product - String update = "UPDATE M_Cost set CurrentCostPrice = COALESCE((select Sum (b.BOMQty * c.currentcostprice)" + - " FROM M_Product_BOM b INNER JOIN M_Cost c ON (b.M_PRODUCTBOM_ID = c.M_Product_ID) " + - " WHERE b.M_Product_ID = " + p_id + " AND M_CostElement_ID = " + costelement_id + "),0)," + - " FutureCostPrice = COALESCE((select Sum (b.BOMQty * c.futurecostprice) FROM M_Product_BOM b " + - " INNER JOIN M_Cost c ON (b.M_PRODUCTBOM_ID = c.M_Product_ID) " + - " WHERE b.M_Product_ID = " + p_id + " AND M_CostElement_ID = " + costelement_id + "),0)" + - " WHERE M_Product_ID = " + p_id + " AND AD_Client_ID = " + client_id + - " AND M_CostElement_ID = " + costelement_id + - " AND M_PRODUCT_ID IN (SELECT M_PRODUCT_ID FROM M_PRODUCT_BOM)";; + StringBuilder update = new StringBuilder("UPDATE M_Cost set CurrentCostPrice = COALESCE((select Sum (b.BOMQty * c.currentcostprice)") + .append(" FROM M_Product_BOM b INNER JOIN M_Cost c ON (b.M_PRODUCTBOM_ID = c.M_Product_ID) ") + .append(" WHERE b.M_Product_ID = ").append(p_id).append(" AND M_CostElement_ID = ").append(costelement_id).append("),0),") + .append(" FutureCostPrice = COALESCE((select Sum (b.BOMQty * c.futurecostprice) FROM M_Product_BOM b ") + .append(" INNER JOIN M_Cost c ON (b.M_PRODUCTBOM_ID = c.M_Product_ID) ") + .append(" WHERE b.M_Product_ID = ").append(p_id).append(" AND M_CostElement_ID = ").append(costelement_id).append("),0)") + .append(" WHERE M_Product_ID = ").append(p_id).append(" AND AD_Client_ID = ").append(client_id) + .append(" AND M_CostElement_ID = ").append(costelement_id) + .append(" AND M_PRODUCT_ID IN (SELECT M_PRODUCT_ID FROM M_PRODUCT_BOM)"); - DB.executeUpdate(update, get_TrxName()); + DB.executeUpdate(update.toString(), get_TrxName()); processed.add(p_id); diff --git a/org.adempiere.base.process/src/org/compiere/process/SendMailText.java b/org.adempiere.base.process/src/org/compiere/process/SendMailText.java index a1b7648d4a..e3529a65ae 100644 --- a/org.adempiere.base.process/src/org/compiere/process/SendMailText.java +++ b/org.adempiere.base.process/src/org/compiere/process/SendMailText.java @@ -124,8 +124,9 @@ public class SendMailText extends SvrProcess if (m_C_BP_Group_ID > 0) sendBPGroup(); - return "@Created@=" + m_counter + ", @Errors@=" + m_errors + " - " - + (System.currentTimeMillis()-start) + "ms"; + StringBuilder msgreturn = new StringBuilder("@Created@=").append(m_counter).append(", @Errors@=").append(m_errors).append(" - ") + .append((System.currentTimeMillis()-start)).append("ms"); + return msgreturn.toString(); } // doIt /** @@ -135,14 +136,14 @@ public class SendMailText extends SvrProcess { log.info("R_InterestArea_ID=" + m_R_InterestArea_ID); m_ia = MInterestArea.get(getCtx(), m_R_InterestArea_ID); - String unsubscribe = null; + StringBuilder unsubscribe = null; if (m_ia.isSelfService()) { - unsubscribe = "\n\n---------.----------.----------.----------.----------.----------\n" - + Msg.getElement(getCtx(), "R_InterestArea_ID") - + ": " + m_ia.getName() - + "\n" + Msg.getMsg(getCtx(), "UnsubscribeInfo") - + "\n"; + unsubscribe = new StringBuilder("\n\n---------.----------.----------.----------.----------.----------\n") + .append(Msg.getElement(getCtx(), "R_InterestArea_ID")) + .append(": ").append(m_ia.getName()) + .append("\n").append(Msg.getMsg(getCtx(), "UnsubscribeInfo")) + .append("\n"); MStore[] wstores = MStore.getOfClient(m_client); int index = 0; for (int i = 0; i < wstores.length; i++) @@ -154,7 +155,7 @@ public class SendMailText extends SvrProcess } } if (wstores.length > 0) - unsubscribe += wstores[index].getWebContext(true); + unsubscribe.append(wstores[index].getWebContext(true)); } // @@ -258,7 +259,7 @@ public class SendMailText extends SvrProcess * @param unsubscribe unsubscribe message * @return true if mail has been sent */ - private Boolean sendIndividualMail (String Name, int AD_User_ID, String unsubscribe) + private Boolean sendIndividualMail (String Name, int AD_User_ID, StringBuilder unsubscribe) { // Prevent two email Integer ii = new Integer (AD_User_ID); @@ -268,18 +269,18 @@ public class SendMailText extends SvrProcess // MUser to = new MUser (getCtx(), AD_User_ID, null); m_MailText.setUser(AD_User_ID); // parse context - String message = m_MailText.getMailText(true); + StringBuilder message = new StringBuilder(m_MailText.getMailText(true)); // Unsubscribe if (unsubscribe != null) - message += unsubscribe; + message.append(unsubscribe); // - EMail email = m_client.createEMail(m_from, to, m_MailText.getMailHeader(), message); + EMail email = m_client.createEMail(m_from, to, m_MailText.getMailHeader(), message.toString()); if (m_MailText.isHtml()) - email.setMessageHTML(m_MailText.getMailHeader(), message); + email.setMessageHTML(m_MailText.getMailHeader(), message.toString()); else { email.setSubject (m_MailText.getMailHeader()); - email.setMessageText (message); + email.setMessageText (message.toString()); } if (!email.isValid() && !email.isValid(true)) { @@ -296,7 +297,8 @@ public class SendMailText extends SvrProcess log.fine(to.getEMail()); else log.warning("FAILURE - " + to.getEMail()); - addLog(0, null, null, (OK ? "@OK@" : "@ERROR@") + " - " + to.getEMail()); + StringBuilder msglog = new StringBuilder((OK ? "@OK@" : "@ERROR@")).append(" - ").append(to.getEMail()); + addLog(0, null, null, msglog.toString()); return new Boolean(OK); } // sendIndividualMail diff --git a/org.adempiere.base.process/src/org/compiere/process/SequenceCheck.java b/org.adempiere.base.process/src/org/compiere/process/SequenceCheck.java index 841481e8e2..3b07a60af3 100644 --- a/org.adempiere.base.process/src/org/compiere/process/SequenceCheck.java +++ b/org.adempiere.base.process/src/org/compiere/process/SequenceCheck.java @@ -143,8 +143,10 @@ public class SequenceCheck extends SvrProcess int no = DB.executeUpdate(sql, trxName); if (no > 0) { - if (sp != null) - sp.addLog(0, null, null, "SyncName #" + no); + if (sp != null){ + StringBuilder msglog = new StringBuilder("SyncName #").append(no); + sp.addLog(0, null, null,msglog.toString()); + } else s_log.fine("Sync #" + no); } @@ -165,7 +167,8 @@ public class SequenceCheck extends SvrProcess { String TableName = rs.getString(1); String SeqName = rs.getString(2); - sp.addLog(0, null, null, "ERROR: TableName=" + TableName + " - Sequence=" + SeqName); + StringBuilder msglog = new StringBuilder("ERROR: TableName=").append(TableName).append(" - Sequence=").append(SeqName); + sp.addLog(0, null, null, msglog.toString()); } } catch (Exception e) @@ -215,21 +218,21 @@ public class SequenceCheck extends SvrProcess { if (seq.getCurrentNext() != old) { - String msg = seq.getName() + " ID " - + old + " -> " + seq.getCurrentNext(); + StringBuilder msg = new StringBuilder(seq.getName()).append(" ID ") + .append(old).append(" -> ").append(seq.getCurrentNext()); if (sp != null) - sp.addLog(0, null, null, msg); + sp.addLog(0, null, null, msg.toString()); else - s_log.fine(msg); + s_log.fine(msg.toString()); } if (seq.getCurrentNextSys() != oldSys) { - String msg = seq.getName() + " Sys " - + oldSys + " -> " + seq.getCurrentNextSys(); + StringBuilder msg = new StringBuilder(seq.getName()).append(" Sys ") + .append(oldSys).append(" -> ").append(seq.getCurrentNextSys()); if (sp != null) - sp.addLog(0, null, null, msg); + sp.addLog(0, null, null, msg.toString()); else - s_log.fine(msg); + s_log.fine(msg.toString()); } if (seq.save()) counter++; @@ -305,6 +308,7 @@ public class SequenceCheck extends SvrProcess SequenceCheck sc = new SequenceCheck(); sc.startProcess(Env.getCtx(), pi, null); - System.out.println("Process=" + pi.getTitle() + " Error="+pi.isError() + " Summary=" + pi.getSummary()); + StringBuilder msgout = new StringBuilder("Process=").append(pi.getTitle()).append(" Error=").append(pi.isError()).append(" Summary=").append(pi.getSummary()); + System.out.println(msgout.toString()); } } // SequenceCheck diff --git a/org.adempiere.base.process/src/org/compiere/process/StorageCleanup.java b/org.adempiere.base.process/src/org/compiere/process/StorageCleanup.java index 5fcc1bc8ef..bfe2371617 100644 --- a/org.adempiere.base.process/src/org/compiere/process/StorageCleanup.java +++ b/org.adempiere.base.process/src/org/compiere/process/StorageCleanup.java @@ -117,8 +117,8 @@ public class StorageCleanup extends SvrProcess DB.close(rs, pstmt); rs = null; pstmt = null; } - - return "#" + lines; + StringBuilder msgreturn = new StringBuilder("#").append(lines); + return msgreturn.toString(); } // doIt /** @@ -176,10 +176,10 @@ public class StorageCleanup extends SvrProcess } mh.saveEx(); - - addLog(0, null, new BigDecimal(lines), "@M_Movement_ID@ " + mh.getDocumentNo() + " (" - + MRefList.get(getCtx(), MMovement.DOCSTATUS_AD_Reference_ID, - mh.getDocStatus(), get_TrxName()) + ")"); + StringBuilder msglog= new StringBuilder("@M_Movement_ID@ ").append(mh.getDocumentNo()).append(" (") + .append(MRefList.get(getCtx(), MMovement.DOCSTATUS_AD_Reference_ID, + mh.getDocStatus(), get_TrxName())).append(")"); + addLog(0, null, new BigDecimal(lines), msglog.toString()); eliminateReservation(target); return lines; diff --git a/org.adempiere.base.process/src/org/compiere/process/SynchronizeTerminology.java b/org.adempiere.base.process/src/org/compiere/process/SynchronizeTerminology.java index 420c61c755..663c714f6b 100644 --- a/org.adempiere.base.process/src/org/compiere/process/SynchronizeTerminology.java +++ b/org.adempiere.base.process/src/org/compiere/process/SynchronizeTerminology.java @@ -861,7 +861,7 @@ public class SynchronizeTerminology extends SvrProcess SynchronizeTerminology sc = new SynchronizeTerminology(); sc.startProcess(Env.getCtx(), pi, null); - - System.out.println("Process=" + pi.getTitle() + " Error="+pi.isError() + " Summary=" + pi.getSummary()); + StringBuilder msgout = new StringBuilder("Process=").append(pi.getTitle()).append(" Error=").append(pi.isError()).append(" Summary=").append(pi.getSummary()); + System.out.println(msgout.toString()); } } diff --git a/org.adempiere.base.process/src/org/compiere/process/TabCopy.java b/org.adempiere.base.process/src/org/compiere/process/TabCopy.java index 08929a8373..f56cab2f86 100644 --- a/org.adempiere.base.process/src/org/compiere/process/TabCopy.java +++ b/org.adempiere.base.process/src/org/compiere/process/TabCopy.java @@ -83,8 +83,8 @@ public class TabCopy extends SvrProcess else throw new AdempiereUserError("@Error@ @AD_Field_ID@"); } - - return "@Copied@ #" + count; + StringBuilder msgreturn = new StringBuilder("@Copied@ #").append(count); + return msgreturn.toString(); } // doIt } // TabCopy diff --git a/org.adempiere.base.process/src/org/compiere/process/TabCreateFields.java b/org.adempiere.base.process/src/org/compiere/process/TabCreateFields.java index 25f2d7cc2f..a188ed56e4 100644 --- a/org.adempiere.base.process/src/org/compiere/process/TabCreateFields.java +++ b/org.adempiere.base.process/src/org/compiere/process/TabCreateFields.java @@ -124,7 +124,8 @@ public class TabCreateFields extends SvrProcess DB.close(rs, pstmt); rs = null; pstmt = null; } - return "@Created@ #" + count; + StringBuilder msgreturn = new StringBuilder("@Created@ #").append(count); + return msgreturn.toString(); } // doIt } // TabCreateFields diff --git a/org.adempiere.base.process/src/org/compiere/process/TableCreateColumns.java b/org.adempiere.base.process/src/org/compiere/process/TableCreateColumns.java index e2897c5712..a1a161ac56 100644 --- a/org.adempiere.base.process/src/org/compiere/process/TableCreateColumns.java +++ b/org.adempiere.base.process/src/org/compiere/process/TableCreateColumns.java @@ -116,8 +116,8 @@ public class TableCreateColumns extends SvrProcess ResultSet rs = md.getColumns(catalog, schema, tableName, null); addTableColumn(rs, table); } - - return "#" + m_count; + StringBuilder msgreturn = new StringBuilder("#").append(m_count); + return msgreturn.toString(); } finally { if (conn != null) { try { @@ -369,7 +369,8 @@ public class TableCreateColumns extends SvrProcess // Done if (column.save ()) { - addLog (0, null, null, table.getTableName() + "." + column.getColumnName()); + StringBuilder msglog = new StringBuilder(table.getTableName()).append(".").append(column.getColumnName()); + addLog (0, null, null, msglog.toString()); m_count++; } } // while columns diff --git a/org.adempiere.base.process/src/org/compiere/process/TaxDeclarationCreate.java b/org.adempiere.base.process/src/org/compiere/process/TaxDeclarationCreate.java index bb7d6b1fdb..0ade87fced 100644 --- a/org.adempiere.base.process/src/org/compiere/process/TaxDeclarationCreate.java +++ b/org.adempiere.base.process/src/org/compiere/process/TaxDeclarationCreate.java @@ -125,9 +125,9 @@ public class TaxDeclarationCreate extends SvrProcess rs = null; pstmt = null; } - - return "@C_Invoice_ID@ #" + noInvoices - + " (" + m_noLines + ", " + m_noAccts + ")"; + StringBuilder msgreturn = new StringBuilder("@C_Invoice_ID@ #").append(noInvoices) + .append(" (").append(m_noLines).append(", ").append(m_noAccts).append(")"); + return msgreturn.toString(); } // doIt /** diff --git a/org.adempiere.base.process/src/org/compiere/process/TransactionXRef.java b/org.adempiere.base.process/src/org/compiere/process/TransactionXRef.java index 96f60ffa98..77b5b5237a 100644 --- a/org.adempiere.base.process/src/org/compiere/process/TransactionXRef.java +++ b/org.adempiere.base.process/src/org/compiere/process/TransactionXRef.java @@ -66,29 +66,32 @@ public class TransactionXRef extends SvrProcess log.info("M_InOut_ID=" + p_Search_InOut_ID + ", C_Order_ID=" + p_Search_Order_ID + ", C_Invoice_ID=" + p_Search_Invoice_ID); // - if (p_Search_InOut_ID != 0) - insertTrx( - "SELECT NVL(ma.M_AttributeSetInstance_ID,iol.M_AttributeSetInstance_ID) " - + "FROM M_InOutLine iol" - + " LEFT OUTER JOIN M_InOutLineMA ma ON (iol.M_InOutLine_ID=ma.M_InOutLine_ID) " - + "WHERE M_InOut_ID=" + p_Search_InOut_ID - ); - else if (p_Search_Order_ID != 0) - insertTrx( - "SELECT NVL(ma.M_AttributeSetInstance_ID,iol.M_AttributeSetInstance_ID) " - + "FROM M_InOutLine iol" - + " LEFT OUTER JOIN M_InOutLineMA ma ON (iol.M_InOutLine_ID=ma.M_InOutLine_ID) " - + " INNER JOIN M_InOut io ON (iol.M_InOut_ID=io.M_InOut_ID)" - + "WHERE io.C_Order_ID=" + p_Search_Order_ID - ); - else if (p_Search_Invoice_ID != 0) - insertTrx( - "SELECT NVL(ma.M_AttributeSetInstance_ID,iol.M_AttributeSetInstance_ID) " - + "FROM M_InOutLine iol" - + " LEFT OUTER JOIN M_InOutLineMA ma ON (iol.M_InOutLine_ID=ma.M_InOutLine_ID) " - + " INNER JOIN C_InvoiceLine il ON (iol.M_InOutLine_ID=il.M_InOutLine_ID) " - + "WHERE il.C_Invoice_ID=" + p_Search_Invoice_ID - ); + if (p_Search_InOut_ID != 0){ + StringBuilder msgtrx = new StringBuilder( + "SELECT NVL(ma.M_AttributeSetInstance_ID,iol.M_AttributeSetInstance_ID) ") + .append("FROM M_InOutLine iol") + .append(" LEFT OUTER JOIN M_InOutLineMA ma ON (iol.M_InOutLine_ID=ma.M_InOutLine_ID) ") + .append("WHERE M_InOut_ID=").append(p_Search_InOut_ID); + insertTrx(msgtrx.toString()); + } + else if (p_Search_Order_ID != 0){ + StringBuilder msgtrx = new StringBuilder( + "SELECT NVL(ma.M_AttributeSetInstance_ID,iol.M_AttributeSetInstance_ID) ") + .append("FROM M_InOutLine iol") + .append(" LEFT OUTER JOIN M_InOutLineMA ma ON (iol.M_InOutLine_ID=ma.M_InOutLine_ID) ") + .append(" INNER JOIN M_InOut io ON (iol.M_InOut_ID=io.M_InOut_ID)") + .append("WHERE io.C_Order_ID=").append(p_Search_Order_ID); + insertTrx(msgtrx.toString()); + } + else if (p_Search_Invoice_ID != 0){ + StringBuilder msgtrx = new StringBuilder( + "SELECT NVL(ma.M_AttributeSetInstance_ID,iol.M_AttributeSetInstance_ID) ") + .append("FROM M_InOutLine iol") + .append(" LEFT OUTER JOIN M_InOutLineMA ma ON (iol.M_InOutLine_ID=ma.M_InOutLine_ID) ") + .append(" INNER JOIN C_InvoiceLine il ON (iol.M_InOutLine_ID=il.M_InOutLine_ID) ") + .append("WHERE il.C_Invoice_ID=").append(p_Search_Invoice_ID); + insertTrx(msgtrx.toString()); + } else throw new AdempiereUserError("Select one Parameter"); // @@ -101,37 +104,37 @@ public class TransactionXRef extends SvrProcess */ private void insertTrx (String sqlSubSelect) { - String sql = "INSERT INTO T_Transaction " - + "(AD_PInstance_ID, M_Transaction_ID," - + " AD_Client_ID, AD_Org_ID, IsActive, Created,CreatedBy, Updated,UpdatedBy," - + " MovementType, M_Locator_ID, M_Product_ID, M_AttributeSetInstance_ID," - + " MovementDate, MovementQty," - + " M_InOutLine_ID, M_InOut_ID," - + " M_MovementLine_ID, M_Movement_ID," - + " M_InventoryLine_ID, M_Inventory_ID, " - + " C_ProjectIssue_ID, C_Project_ID, " - + " M_ProductionLine_ID, M_Production_ID, " - + " Search_Order_ID, Search_Invoice_ID, Search_InOut_ID) " + StringBuilder sql = new StringBuilder("INSERT INTO T_Transaction ") + .append("(AD_PInstance_ID, M_Transaction_ID,") + .append(" AD_Client_ID, AD_Org_ID, IsActive, Created,CreatedBy, Updated,UpdatedBy,") + .append(" MovementType, M_Locator_ID, M_Product_ID, M_AttributeSetInstance_ID,") + .append(" MovementDate, MovementQty,") + .append(" M_InOutLine_ID, M_InOut_ID,") + .append(" M_MovementLine_ID, M_Movement_ID,") + .append(" M_InventoryLine_ID, M_Inventory_ID, ") + .append(" C_ProjectIssue_ID, C_Project_ID, ") + .append(" M_ProductionLine_ID, M_Production_ID, ") + .append(" Search_Order_ID, Search_Invoice_ID, Search_InOut_ID) ") // Data - + "SELECT " + getAD_PInstance_ID() + ", M_Transaction_ID," - + " AD_Client_ID, AD_Org_ID, IsActive, Created,CreatedBy, Updated,UpdatedBy," - + " MovementType, M_Locator_ID, M_Product_ID, M_AttributeSetInstance_ID," - + " MovementDate, MovementQty," - + " M_InOutLine_ID, M_InOut_ID, " - + " M_MovementLine_ID, M_Movement_ID," - + " M_InventoryLine_ID, M_Inventory_ID, " - + " C_ProjectIssue_ID, C_Project_ID, " - + " M_ProductionLine_ID, M_Production_ID, " + .append("SELECT ").append(getAD_PInstance_ID()).append(", M_Transaction_ID,") + .append(" AD_Client_ID, AD_Org_ID, IsActive, Created,CreatedBy, Updated,UpdatedBy,") + .append(" MovementType, M_Locator_ID, M_Product_ID, M_AttributeSetInstance_ID,") + .append(" MovementDate, MovementQty,") + .append(" M_InOutLine_ID, M_InOut_ID, ") + .append(" M_MovementLine_ID, M_Movement_ID,") + .append(" M_InventoryLine_ID, M_Inventory_ID, ") + .append(" C_ProjectIssue_ID, C_Project_ID, ") + .append(" M_ProductionLine_ID, M_Production_ID, ") // Parameter - + p_Search_Order_ID + ", " + p_Search_Invoice_ID + "," + p_Search_InOut_ID + " " + .append(p_Search_Order_ID).append(", ").append(p_Search_Invoice_ID).append(",").append(p_Search_InOut_ID).append(" ") // - + "FROM M_Transaction_v " - + "WHERE M_AttributeSetInstance_ID > 0 AND M_AttributeSetInstance_ID IN (" - + sqlSubSelect - + ") ORDER BY M_Transaction_ID"; + .append("FROM M_Transaction_v ") + .append("WHERE M_AttributeSetInstance_ID > 0 AND M_AttributeSetInstance_ID IN (") + .append(sqlSubSelect) + .append(") ORDER BY M_Transaction_ID"); // - int no = DB.executeUpdate(sql, get_TrxName()); - log.fine(sql); + int no = DB.executeUpdate(sql.toString(), get_TrxName()); + log.fine(sql.toString()); log.config("#" + no); // Multi-Level diff --git a/org.adempiere.base.process/src/org/compiere/process/TranslationDocSync.java b/org.adempiere.base.process/src/org/compiere/process/TranslationDocSync.java index 9b3fbc4007..9068f3f944 100644 --- a/org.adempiere.base.process/src/org/compiere/process/TranslationDocSync.java +++ b/org.adempiere.base.process/src/org/compiere/process/TranslationDocSync.java @@ -99,7 +99,7 @@ public class TranslationDocSync extends SvrProcess */ private void processTable (MTable table, int AD_Client_ID) { - StringBuffer sql = new StringBuffer(); + StringBuilder sql = new StringBuilder(); MColumn[] columns = table.getColumns(false); for (int i = 0; i < columns.length; i++) { @@ -119,7 +119,7 @@ public class TranslationDocSync extends SvrProcess log.config(baseTable + ": " + sql); String columnNames = sql.toString(); - sql = new StringBuffer(); + sql = new StringBuilder(); sql.append("UPDATE ").append(table.getTableName()).append(" t SET (") .append(columnNames).append(") = (SELECT ").append(columnNames) .append(" FROM ").append(baseTable).append(" b WHERE t.") diff --git a/org.adempiere.base.process/src/org/compiere/process/TreeMaintenance.java b/org.adempiere.base.process/src/org/compiere/process/TreeMaintenance.java index 8f268c7fdf..30559f6661 100644 --- a/org.adempiere.base.process/src/org/compiere/process/TreeMaintenance.java +++ b/org.adempiere.base.process/src/org/compiere/process/TreeMaintenance.java @@ -90,15 +90,15 @@ public class TreeMaintenance extends SvrProcess int C_Element_ID = 0; if (MTree.TREETYPE_ElementValue.equals(tree.getTreeType())) { - String sql = "SELECT C_Element_ID FROM C_Element " - + "WHERE AD_Tree_ID=" + tree.getAD_Tree_ID(); - C_Element_ID = DB.getSQLValue(null, sql); + StringBuilder sql = new StringBuilder("SELECT C_Element_ID FROM C_Element ") + .append("WHERE AD_Tree_ID=").append(tree.getAD_Tree_ID()); + C_Element_ID = DB.getSQLValue(null, sql.toString()); if (C_Element_ID <= 0) throw new IllegalStateException("No Account Element found"); } // Delete unused - StringBuffer sql = new StringBuffer(); + StringBuilder sql = new StringBuilder(); sql.append("DELETE ").append(nodeTableName) .append(" WHERE AD_Tree_ID=").append(tree.getAD_Tree_ID()) .append(" AND Node_ID NOT IN (SELECT ").append(sourceTableKey) @@ -111,12 +111,13 @@ public class TreeMaintenance extends SvrProcess // int deletes = DB.executeUpdate(sql.toString(), get_TrxName()); addLog(0,null, new BigDecimal(deletes), tree.getName()+ " Deleted"); - if (!tree.isAllNodes()) - return tree.getName() + " OK"; - + if (!tree.isAllNodes()){ + StringBuilder msgreturn = new StringBuilder(tree.getName()).append(" OK"); + return msgreturn.toString(); + } // Insert new int inserts = 0; - sql = new StringBuffer(); + sql = new StringBuilder(); sql.append("SELECT ").append(sourceTableKey) .append(" FROM ").append(sourceTableName) .append(" WHERE AD_Client_ID=").append(AD_Client_ID); @@ -175,8 +176,10 @@ public class TreeMaintenance extends SvrProcess { pstmt = null; } - addLog(0,null, new BigDecimal(inserts), tree.getName()+ " Inserted"); - return tree.getName() + (ok ? " OK" : " Error"); + StringBuilder msglog = new StringBuilder(tree.getName()).append(" Inserted"); + addLog(0,null, new BigDecimal(inserts), msglog.toString()); + StringBuilder msgreturn = new StringBuilder(tree.getName()).append((ok ? " OK" : " Error")); + return msgreturn.toString(); } // verifyTree } // TreeMaintenence diff --git a/org.adempiere.base.process/src/org/compiere/process/UniversalSubstitution.java b/org.adempiere.base.process/src/org/compiere/process/UniversalSubstitution.java index d95aae5d18..156381f256 100644 --- a/org.adempiere.base.process/src/org/compiere/process/UniversalSubstitution.java +++ b/org.adempiere.base.process/src/org/compiere/process/UniversalSubstitution.java @@ -45,8 +45,8 @@ public class UniversalSubstitution extends SvrProcess { bom.saveEx(); count++; } - - return count + " BOM products updated"; + StringBuilder msgreturn = new StringBuilder(count).append(" BOM products updated"); + return msgreturn.toString(); } } diff --git a/org.adempiere.base.process/src/org/compiere/process/WindowCopy.java b/org.adempiere.base.process/src/org/compiere/process/WindowCopy.java index 8f0a4fb4b0..20af8b71b1 100644 --- a/org.adempiere.base.process/src/org/compiere/process/WindowCopy.java +++ b/org.adempiere.base.process/src/org/compiere/process/WindowCopy.java @@ -96,8 +96,8 @@ public class WindowCopy extends SvrProcess else throw new AdempiereUserError("@Error@ @AD_Tab_ID@"); } - - return "@Copied@ #" + tabCount + "/" + fieldCount; + StringBuilder msgreturn = new StringBuilder("@Copied@ #").append(tabCount).append("/").append(fieldCount); + return msgreturn.toString(); } // doIt } // WindowCopy