IDEMPIERE-308 Performance: Replace with StringBuilder / Thanks to Richard Morales and David Peñuela
This commit is contained in:
parent
a210231735
commit
62cb8851cb
|
@ -103,6 +103,7 @@ public class RfQCopyLines extends SvrProcess
|
||||||
} // copy all lines
|
} // copy all lines
|
||||||
|
|
||||||
//
|
//
|
||||||
return "# " + counter;
|
StringBuilder msgreturn = new StringBuilder("# ").append(counter);
|
||||||
|
return msgreturn.toString();
|
||||||
} // doIt
|
} // doIt
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,10 +110,10 @@ public class RfQCreate extends SvrProcess
|
||||||
}
|
}
|
||||||
} // for all subscribers
|
} // for all subscribers
|
||||||
|
|
||||||
String retValue = "@Created@ " + counter;
|
StringBuilder retValue = new StringBuilder("@Created@ ").append(counter);
|
||||||
if (p_IsSendRfQ)
|
if (p_IsSendRfQ)
|
||||||
retValue += " - @IsSendRfQ@=" + sent + " - @Error@=" + notSent;
|
retValue.append(" - @IsSendRfQ@=").append(sent).append(" - @Error@=").append(notSent);
|
||||||
return retValue;
|
return retValue.toString();
|
||||||
} // doIt
|
} // doIt
|
||||||
|
|
||||||
} // RfQCreate
|
} // RfQCreate
|
||||||
|
|
|
@ -202,7 +202,7 @@ public class RfQCreatePO extends SvrProcess
|
||||||
response.saveEx();
|
response.saveEx();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
StringBuilder msgreturn = new StringBuilder("#").append(noOrders);
|
||||||
return "#" + noOrders;
|
return msgreturn.toString();
|
||||||
} // doIt
|
} // doIt
|
||||||
} // RfQCreatePO
|
} // RfQCreatePO
|
||||||
|
|
|
@ -97,7 +97,8 @@ public class RfQResponseRank extends SvrProcess
|
||||||
rankResponses(rfq, responses);
|
rankResponses(rfq, responses);
|
||||||
else
|
else
|
||||||
rankLines (rfq, responses);
|
rankLines (rfq, responses);
|
||||||
return "# " + responses.length;
|
StringBuilder msgreturn = new StringBuilder("# ").append(responses.length);
|
||||||
|
return msgreturn.toString();
|
||||||
} // doIt
|
} // doIt
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -86,20 +86,20 @@ public class RoleAccessUpdate extends SvrProcess
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
List<Object> params = new ArrayList<Object>();
|
List<Object> params = new ArrayList<Object>();
|
||||||
String whereClause = "1=1";
|
StringBuilder whereClause = new StringBuilder("1=1");
|
||||||
if (p_AD_Client_ID > 0)
|
if (p_AD_Client_ID > 0)
|
||||||
{
|
{
|
||||||
whereClause += " AND AD_Client_ID=? ";
|
whereClause.append(" AND AD_Client_ID=? ");
|
||||||
params.add(p_AD_Client_ID);
|
params.add(p_AD_Client_ID);
|
||||||
}
|
}
|
||||||
if (p_AD_Role_ID == 0) // System Role
|
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);
|
params.add(p_AD_Role_ID);
|
||||||
}
|
}
|
||||||
//sql += "ORDER BY AD_Client_ID, Name";
|
//sql += "ORDER BY AD_Client_ID, Name";
|
||||||
|
|
||||||
List<MRole> roles = new Query(getCtx(), MRole.Table_Name, whereClause, get_TrxName())
|
List<MRole> roles = new Query(getCtx(), MRole.Table_Name, whereClause.toString(), get_TrxName())
|
||||||
.setOnlyActiveRecords(true)
|
.setOnlyActiveRecords(true)
|
||||||
.setParameters(params)
|
.setParameters(params)
|
||||||
.setOrderBy("AD_Client_ID, Name")
|
.setOrderBy("AD_Client_ID, Name")
|
||||||
|
@ -120,8 +120,9 @@ public class RoleAccessUpdate extends SvrProcess
|
||||||
*/
|
*/
|
||||||
private void updateRole (MRole role)
|
private void updateRole (MRole role)
|
||||||
{
|
{
|
||||||
addLog(0, null, null, role.getName() + ": "
|
StringBuilder msglog = new StringBuilder(role.getName()).append(": ")
|
||||||
+ role.updateAccessRecords(p_IsReset));
|
.append(role.updateAccessRecords(p_IsReset));
|
||||||
|
addLog(0, null, null, msglog.toString());
|
||||||
} // updateRole
|
} // updateRole
|
||||||
|
|
||||||
//add main method, preparing for nightly build
|
//add main method, preparing for nightly build
|
||||||
|
@ -138,7 +139,8 @@ public class RoleAccessUpdate extends SvrProcess
|
||||||
RoleAccessUpdate rau = new RoleAccessUpdate();
|
RoleAccessUpdate rau = new RoleAccessUpdate();
|
||||||
rau.startProcess(Env.getCtx(), pi, null);
|
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
|
} // RoleAccessUpdate
|
||||||
|
|
|
@ -95,9 +95,9 @@ public class RollUpCosts extends SvrProcess {
|
||||||
|
|
||||||
protected void rollUpCosts(int p_id) throws Exception
|
protected void rollUpCosts(int p_id) throws Exception
|
||||||
{
|
{
|
||||||
String sql = "SELECT M_ProductBOM_ID FROM M_Product_BOM WHERE M_Product_ID = ? " +
|
StringBuilder sql = new StringBuilder("SELECT M_ProductBOM_ID FROM M_Product_BOM WHERE M_Product_ID = ? ")
|
||||||
" AND AD_Client_ID = " + client_id;
|
.append(" AND AD_Client_ID = ").append(client_id);
|
||||||
int[] prodbomids = DB.getIDsEx(get_TrxName(), sql, client_id);
|
int[] prodbomids = DB.getIDsEx(get_TrxName(), sql.toString(), client_id);
|
||||||
|
|
||||||
for (int prodbomid : prodbomids) {
|
for (int prodbomid : prodbomids) {
|
||||||
if ( !processed.contains(p_id)) {
|
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
|
//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)" +
|
StringBuilder update = new StringBuilder("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) " +
|
.append(" 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)," +
|
.append(" WHERE b.M_Product_ID = ").append(p_id).append(" AND M_CostElement_ID = ").append(costelement_id).append("),0),")
|
||||||
" FutureCostPrice = COALESCE((select Sum (b.BOMQty * c.futurecostprice) FROM M_Product_BOM b " +
|
.append(" 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) " +
|
.append(" 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)" +
|
.append(" WHERE b.M_Product_ID = ").append(p_id).append(" AND M_CostElement_ID = ").append(costelement_id).append("),0)")
|
||||||
" WHERE M_Product_ID = " + p_id + " AND AD_Client_ID = " + client_id +
|
.append(" WHERE M_Product_ID = ").append(p_id).append(" AND AD_Client_ID = ").append(client_id)
|
||||||
" AND M_CostElement_ID = " + costelement_id +
|
.append(" AND M_CostElement_ID = ").append(costelement_id)
|
||||||
" AND M_PRODUCT_ID IN (SELECT M_PRODUCT_ID FROM M_PRODUCT_BOM)";;
|
.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);
|
processed.add(p_id);
|
||||||
|
|
||||||
|
|
|
@ -124,8 +124,9 @@ public class SendMailText extends SvrProcess
|
||||||
if (m_C_BP_Group_ID > 0)
|
if (m_C_BP_Group_ID > 0)
|
||||||
sendBPGroup();
|
sendBPGroup();
|
||||||
|
|
||||||
return "@Created@=" + m_counter + ", @Errors@=" + m_errors + " - "
|
StringBuilder msgreturn = new StringBuilder("@Created@=").append(m_counter).append(", @Errors@=").append(m_errors).append(" - ")
|
||||||
+ (System.currentTimeMillis()-start) + "ms";
|
.append((System.currentTimeMillis()-start)).append("ms");
|
||||||
|
return msgreturn.toString();
|
||||||
} // doIt
|
} // doIt
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -135,14 +136,14 @@ public class SendMailText extends SvrProcess
|
||||||
{
|
{
|
||||||
log.info("R_InterestArea_ID=" + m_R_InterestArea_ID);
|
log.info("R_InterestArea_ID=" + m_R_InterestArea_ID);
|
||||||
m_ia = MInterestArea.get(getCtx(), m_R_InterestArea_ID);
|
m_ia = MInterestArea.get(getCtx(), m_R_InterestArea_ID);
|
||||||
String unsubscribe = null;
|
StringBuilder unsubscribe = null;
|
||||||
if (m_ia.isSelfService())
|
if (m_ia.isSelfService())
|
||||||
{
|
{
|
||||||
unsubscribe = "\n\n---------.----------.----------.----------.----------.----------\n"
|
unsubscribe = new StringBuilder("\n\n---------.----------.----------.----------.----------.----------\n")
|
||||||
+ Msg.getElement(getCtx(), "R_InterestArea_ID")
|
.append(Msg.getElement(getCtx(), "R_InterestArea_ID"))
|
||||||
+ ": " + m_ia.getName()
|
.append(": ").append(m_ia.getName())
|
||||||
+ "\n" + Msg.getMsg(getCtx(), "UnsubscribeInfo")
|
.append("\n").append(Msg.getMsg(getCtx(), "UnsubscribeInfo"))
|
||||||
+ "\n";
|
.append("\n");
|
||||||
MStore[] wstores = MStore.getOfClient(m_client);
|
MStore[] wstores = MStore.getOfClient(m_client);
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (int i = 0; i < wstores.length; i++)
|
for (int i = 0; i < wstores.length; i++)
|
||||||
|
@ -154,7 +155,7 @@ public class SendMailText extends SvrProcess
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (wstores.length > 0)
|
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
|
* @param unsubscribe unsubscribe message
|
||||||
* @return true if mail has been sent
|
* @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
|
// Prevent two email
|
||||||
Integer ii = new Integer (AD_User_ID);
|
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);
|
MUser to = new MUser (getCtx(), AD_User_ID, null);
|
||||||
m_MailText.setUser(AD_User_ID); // parse context
|
m_MailText.setUser(AD_User_ID); // parse context
|
||||||
String message = m_MailText.getMailText(true);
|
StringBuilder message = new StringBuilder(m_MailText.getMailText(true));
|
||||||
// Unsubscribe
|
// Unsubscribe
|
||||||
if (unsubscribe != null)
|
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())
|
if (m_MailText.isHtml())
|
||||||
email.setMessageHTML(m_MailText.getMailHeader(), message);
|
email.setMessageHTML(m_MailText.getMailHeader(), message.toString());
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
email.setSubject (m_MailText.getMailHeader());
|
email.setSubject (m_MailText.getMailHeader());
|
||||||
email.setMessageText (message);
|
email.setMessageText (message.toString());
|
||||||
}
|
}
|
||||||
if (!email.isValid() && !email.isValid(true))
|
if (!email.isValid() && !email.isValid(true))
|
||||||
{
|
{
|
||||||
|
@ -296,7 +297,8 @@ public class SendMailText extends SvrProcess
|
||||||
log.fine(to.getEMail());
|
log.fine(to.getEMail());
|
||||||
else
|
else
|
||||||
log.warning("FAILURE - " + to.getEMail());
|
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);
|
return new Boolean(OK);
|
||||||
} // sendIndividualMail
|
} // sendIndividualMail
|
||||||
|
|
||||||
|
|
|
@ -143,8 +143,10 @@ public class SequenceCheck extends SvrProcess
|
||||||
int no = DB.executeUpdate(sql, trxName);
|
int no = DB.executeUpdate(sql, trxName);
|
||||||
if (no > 0)
|
if (no > 0)
|
||||||
{
|
{
|
||||||
if (sp != null)
|
if (sp != null){
|
||||||
sp.addLog(0, null, null, "SyncName #" + no);
|
StringBuilder msglog = new StringBuilder("SyncName #").append(no);
|
||||||
|
sp.addLog(0, null, null,msglog.toString());
|
||||||
|
}
|
||||||
else
|
else
|
||||||
s_log.fine("Sync #" + no);
|
s_log.fine("Sync #" + no);
|
||||||
}
|
}
|
||||||
|
@ -165,7 +167,8 @@ public class SequenceCheck extends SvrProcess
|
||||||
{
|
{
|
||||||
String TableName = rs.getString(1);
|
String TableName = rs.getString(1);
|
||||||
String SeqName = rs.getString(2);
|
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)
|
catch (Exception e)
|
||||||
|
@ -215,21 +218,21 @@ public class SequenceCheck extends SvrProcess
|
||||||
{
|
{
|
||||||
if (seq.getCurrentNext() != old)
|
if (seq.getCurrentNext() != old)
|
||||||
{
|
{
|
||||||
String msg = seq.getName() + " ID "
|
StringBuilder msg = new StringBuilder(seq.getName()).append(" ID ")
|
||||||
+ old + " -> " + seq.getCurrentNext();
|
.append(old).append(" -> ").append(seq.getCurrentNext());
|
||||||
if (sp != null)
|
if (sp != null)
|
||||||
sp.addLog(0, null, null, msg);
|
sp.addLog(0, null, null, msg.toString());
|
||||||
else
|
else
|
||||||
s_log.fine(msg);
|
s_log.fine(msg.toString());
|
||||||
}
|
}
|
||||||
if (seq.getCurrentNextSys() != oldSys)
|
if (seq.getCurrentNextSys() != oldSys)
|
||||||
{
|
{
|
||||||
String msg = seq.getName() + " Sys "
|
StringBuilder msg = new StringBuilder(seq.getName()).append(" Sys ")
|
||||||
+ oldSys + " -> " + seq.getCurrentNextSys();
|
.append(oldSys).append(" -> ").append(seq.getCurrentNextSys());
|
||||||
if (sp != null)
|
if (sp != null)
|
||||||
sp.addLog(0, null, null, msg);
|
sp.addLog(0, null, null, msg.toString());
|
||||||
else
|
else
|
||||||
s_log.fine(msg);
|
s_log.fine(msg.toString());
|
||||||
}
|
}
|
||||||
if (seq.save())
|
if (seq.save())
|
||||||
counter++;
|
counter++;
|
||||||
|
@ -305,6 +308,7 @@ public class SequenceCheck extends SvrProcess
|
||||||
SequenceCheck sc = new SequenceCheck();
|
SequenceCheck sc = new SequenceCheck();
|
||||||
sc.startProcess(Env.getCtx(), pi, null);
|
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
|
} // SequenceCheck
|
||||||
|
|
|
@ -117,8 +117,8 @@ public class StorageCleanup extends SvrProcess
|
||||||
DB.close(rs, pstmt);
|
DB.close(rs, pstmt);
|
||||||
rs = null; pstmt = null;
|
rs = null; pstmt = null;
|
||||||
}
|
}
|
||||||
|
StringBuilder msgreturn = new StringBuilder("#").append(lines);
|
||||||
return "#" + lines;
|
return msgreturn.toString();
|
||||||
} // doIt
|
} // doIt
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -176,10 +176,10 @@ public class StorageCleanup extends SvrProcess
|
||||||
|
|
||||||
}
|
}
|
||||||
mh.saveEx();
|
mh.saveEx();
|
||||||
|
StringBuilder msglog= new StringBuilder("@M_Movement_ID@ ").append(mh.getDocumentNo()).append(" (")
|
||||||
addLog(0, null, new BigDecimal(lines), "@M_Movement_ID@ " + mh.getDocumentNo() + " ("
|
.append(MRefList.get(getCtx(), MMovement.DOCSTATUS_AD_Reference_ID,
|
||||||
+ MRefList.get(getCtx(), MMovement.DOCSTATUS_AD_Reference_ID,
|
mh.getDocStatus(), get_TrxName())).append(")");
|
||||||
mh.getDocStatus(), get_TrxName()) + ")");
|
addLog(0, null, new BigDecimal(lines), msglog.toString());
|
||||||
|
|
||||||
eliminateReservation(target);
|
eliminateReservation(target);
|
||||||
return lines;
|
return lines;
|
||||||
|
|
|
@ -861,7 +861,7 @@ public class SynchronizeTerminology extends SvrProcess
|
||||||
|
|
||||||
SynchronizeTerminology sc = new SynchronizeTerminology();
|
SynchronizeTerminology sc = new SynchronizeTerminology();
|
||||||
sc.startProcess(Env.getCtx(), pi, null);
|
sc.startProcess(Env.getCtx(), pi, null);
|
||||||
|
StringBuilder msgout = new StringBuilder("Process=").append(pi.getTitle()).append(" Error=").append(pi.isError()).append(" Summary=").append(pi.getSummary());
|
||||||
System.out.println("Process=" + pi.getTitle() + " Error="+pi.isError() + " Summary=" + pi.getSummary());
|
System.out.println(msgout.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,8 +83,8 @@ public class TabCopy extends SvrProcess
|
||||||
else
|
else
|
||||||
throw new AdempiereUserError("@Error@ @AD_Field_ID@");
|
throw new AdempiereUserError("@Error@ @AD_Field_ID@");
|
||||||
}
|
}
|
||||||
|
StringBuilder msgreturn = new StringBuilder("@Copied@ #").append(count);
|
||||||
return "@Copied@ #" + count;
|
return msgreturn.toString();
|
||||||
} // doIt
|
} // doIt
|
||||||
|
|
||||||
} // TabCopy
|
} // TabCopy
|
||||||
|
|
|
@ -124,7 +124,8 @@ public class TabCreateFields extends SvrProcess
|
||||||
DB.close(rs, pstmt);
|
DB.close(rs, pstmt);
|
||||||
rs = null; pstmt = null;
|
rs = null; pstmt = null;
|
||||||
}
|
}
|
||||||
return "@Created@ #" + count;
|
StringBuilder msgreturn = new StringBuilder("@Created@ #").append(count);
|
||||||
|
return msgreturn.toString();
|
||||||
} // doIt
|
} // doIt
|
||||||
|
|
||||||
} // TabCreateFields
|
} // TabCreateFields
|
||||||
|
|
|
@ -116,8 +116,8 @@ public class TableCreateColumns extends SvrProcess
|
||||||
ResultSet rs = md.getColumns(catalog, schema, tableName, null);
|
ResultSet rs = md.getColumns(catalog, schema, tableName, null);
|
||||||
addTableColumn(rs, table);
|
addTableColumn(rs, table);
|
||||||
}
|
}
|
||||||
|
StringBuilder msgreturn = new StringBuilder("#").append(m_count);
|
||||||
return "#" + m_count;
|
return msgreturn.toString();
|
||||||
} finally {
|
} finally {
|
||||||
if (conn != null) {
|
if (conn != null) {
|
||||||
try {
|
try {
|
||||||
|
@ -369,7 +369,8 @@ public class TableCreateColumns extends SvrProcess
|
||||||
// Done
|
// Done
|
||||||
if (column.save ())
|
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++;
|
m_count++;
|
||||||
}
|
}
|
||||||
} // while columns
|
} // while columns
|
||||||
|
|
|
@ -125,9 +125,9 @@ public class TaxDeclarationCreate extends SvrProcess
|
||||||
rs = null; pstmt = null;
|
rs = null; pstmt = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StringBuilder msgreturn = new StringBuilder("@C_Invoice_ID@ #").append(noInvoices)
|
||||||
return "@C_Invoice_ID@ #" + noInvoices
|
.append(" (").append(m_noLines).append(", ").append(m_noAccts).append(")");
|
||||||
+ " (" + m_noLines + ", " + m_noAccts + ")";
|
return msgreturn.toString();
|
||||||
} // doIt
|
} // doIt
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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
|
log.info("M_InOut_ID=" + p_Search_InOut_ID + ", C_Order_ID=" + p_Search_Order_ID
|
||||||
+ ", C_Invoice_ID=" + p_Search_Invoice_ID);
|
+ ", C_Invoice_ID=" + p_Search_Invoice_ID);
|
||||||
//
|
//
|
||||||
if (p_Search_InOut_ID != 0)
|
if (p_Search_InOut_ID != 0){
|
||||||
insertTrx(
|
StringBuilder msgtrx = new StringBuilder(
|
||||||
"SELECT NVL(ma.M_AttributeSetInstance_ID,iol.M_AttributeSetInstance_ID) "
|
"SELECT NVL(ma.M_AttributeSetInstance_ID,iol.M_AttributeSetInstance_ID) ")
|
||||||
+ "FROM M_InOutLine iol"
|
.append("FROM M_InOutLine iol")
|
||||||
+ " LEFT OUTER JOIN M_InOutLineMA ma ON (iol.M_InOutLine_ID=ma.M_InOutLine_ID) "
|
.append(" LEFT OUTER JOIN M_InOutLineMA ma ON (iol.M_InOutLine_ID=ma.M_InOutLine_ID) ")
|
||||||
+ "WHERE M_InOut_ID=" + p_Search_InOut_ID
|
.append("WHERE M_InOut_ID=").append(p_Search_InOut_ID);
|
||||||
);
|
insertTrx(msgtrx.toString());
|
||||||
else if (p_Search_Order_ID != 0)
|
}
|
||||||
insertTrx(
|
else if (p_Search_Order_ID != 0){
|
||||||
"SELECT NVL(ma.M_AttributeSetInstance_ID,iol.M_AttributeSetInstance_ID) "
|
StringBuilder msgtrx = new StringBuilder(
|
||||||
+ "FROM M_InOutLine iol"
|
"SELECT NVL(ma.M_AttributeSetInstance_ID,iol.M_AttributeSetInstance_ID) ")
|
||||||
+ " LEFT OUTER JOIN M_InOutLineMA ma ON (iol.M_InOutLine_ID=ma.M_InOutLine_ID) "
|
.append("FROM M_InOutLine iol")
|
||||||
+ " INNER JOIN M_InOut io ON (iol.M_InOut_ID=io.M_InOut_ID)"
|
.append(" LEFT OUTER JOIN M_InOutLineMA ma ON (iol.M_InOutLine_ID=ma.M_InOutLine_ID) ")
|
||||||
+ "WHERE io.C_Order_ID=" + p_Search_Order_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);
|
||||||
else if (p_Search_Invoice_ID != 0)
|
insertTrx(msgtrx.toString());
|
||||||
insertTrx(
|
}
|
||||||
"SELECT NVL(ma.M_AttributeSetInstance_ID,iol.M_AttributeSetInstance_ID) "
|
else if (p_Search_Invoice_ID != 0){
|
||||||
+ "FROM M_InOutLine iol"
|
StringBuilder msgtrx = new StringBuilder(
|
||||||
+ " LEFT OUTER JOIN M_InOutLineMA ma ON (iol.M_InOutLine_ID=ma.M_InOutLine_ID) "
|
"SELECT NVL(ma.M_AttributeSetInstance_ID,iol.M_AttributeSetInstance_ID) ")
|
||||||
+ " INNER JOIN C_InvoiceLine il ON (iol.M_InOutLine_ID=il.M_InOutLine_ID) "
|
.append("FROM M_InOutLine iol")
|
||||||
+ "WHERE il.C_Invoice_ID=" + p_Search_Invoice_ID
|
.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
|
else
|
||||||
throw new AdempiereUserError("Select one Parameter");
|
throw new AdempiereUserError("Select one Parameter");
|
||||||
//
|
//
|
||||||
|
@ -101,37 +104,37 @@ public class TransactionXRef extends SvrProcess
|
||||||
*/
|
*/
|
||||||
private void insertTrx (String sqlSubSelect)
|
private void insertTrx (String sqlSubSelect)
|
||||||
{
|
{
|
||||||
String sql = "INSERT INTO T_Transaction "
|
StringBuilder sql = new StringBuilder("INSERT INTO T_Transaction ")
|
||||||
+ "(AD_PInstance_ID, M_Transaction_ID,"
|
.append("(AD_PInstance_ID, M_Transaction_ID,")
|
||||||
+ " AD_Client_ID, AD_Org_ID, IsActive, Created,CreatedBy, Updated,UpdatedBy,"
|
.append(" AD_Client_ID, AD_Org_ID, IsActive, Created,CreatedBy, Updated,UpdatedBy,")
|
||||||
+ " MovementType, M_Locator_ID, M_Product_ID, M_AttributeSetInstance_ID,"
|
.append(" MovementType, M_Locator_ID, M_Product_ID, M_AttributeSetInstance_ID,")
|
||||||
+ " MovementDate, MovementQty,"
|
.append(" MovementDate, MovementQty,")
|
||||||
+ " M_InOutLine_ID, M_InOut_ID,"
|
.append(" M_InOutLine_ID, M_InOut_ID,")
|
||||||
+ " M_MovementLine_ID, M_Movement_ID,"
|
.append(" M_MovementLine_ID, M_Movement_ID,")
|
||||||
+ " M_InventoryLine_ID, M_Inventory_ID, "
|
.append(" M_InventoryLine_ID, M_Inventory_ID, ")
|
||||||
+ " C_ProjectIssue_ID, C_Project_ID, "
|
.append(" C_ProjectIssue_ID, C_Project_ID, ")
|
||||||
+ " M_ProductionLine_ID, M_Production_ID, "
|
.append(" M_ProductionLine_ID, M_Production_ID, ")
|
||||||
+ " Search_Order_ID, Search_Invoice_ID, Search_InOut_ID) "
|
.append(" Search_Order_ID, Search_Invoice_ID, Search_InOut_ID) ")
|
||||||
// Data
|
// Data
|
||||||
+ "SELECT " + getAD_PInstance_ID() + ", M_Transaction_ID,"
|
.append("SELECT ").append(getAD_PInstance_ID()).append(", M_Transaction_ID,")
|
||||||
+ " AD_Client_ID, AD_Org_ID, IsActive, Created,CreatedBy, Updated,UpdatedBy,"
|
.append(" AD_Client_ID, AD_Org_ID, IsActive, Created,CreatedBy, Updated,UpdatedBy,")
|
||||||
+ " MovementType, M_Locator_ID, M_Product_ID, M_AttributeSetInstance_ID,"
|
.append(" MovementType, M_Locator_ID, M_Product_ID, M_AttributeSetInstance_ID,")
|
||||||
+ " MovementDate, MovementQty,"
|
.append(" MovementDate, MovementQty,")
|
||||||
+ " M_InOutLine_ID, M_InOut_ID, "
|
.append(" M_InOutLine_ID, M_InOut_ID, ")
|
||||||
+ " M_MovementLine_ID, M_Movement_ID,"
|
.append(" M_MovementLine_ID, M_Movement_ID,")
|
||||||
+ " M_InventoryLine_ID, M_Inventory_ID, "
|
.append(" M_InventoryLine_ID, M_Inventory_ID, ")
|
||||||
+ " C_ProjectIssue_ID, C_Project_ID, "
|
.append(" C_ProjectIssue_ID, C_Project_ID, ")
|
||||||
+ " M_ProductionLine_ID, M_Production_ID, "
|
.append(" M_ProductionLine_ID, M_Production_ID, ")
|
||||||
// Parameter
|
// 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 "
|
.append("FROM M_Transaction_v ")
|
||||||
+ "WHERE M_AttributeSetInstance_ID > 0 AND M_AttributeSetInstance_ID IN ("
|
.append("WHERE M_AttributeSetInstance_ID > 0 AND M_AttributeSetInstance_ID IN (")
|
||||||
+ sqlSubSelect
|
.append(sqlSubSelect)
|
||||||
+ ") ORDER BY M_Transaction_ID";
|
.append(") ORDER BY M_Transaction_ID");
|
||||||
//
|
//
|
||||||
int no = DB.executeUpdate(sql, get_TrxName());
|
int no = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||||
log.fine(sql);
|
log.fine(sql.toString());
|
||||||
log.config("#" + no);
|
log.config("#" + no);
|
||||||
|
|
||||||
// Multi-Level
|
// Multi-Level
|
||||||
|
|
|
@ -99,7 +99,7 @@ public class TranslationDocSync extends SvrProcess
|
||||||
*/
|
*/
|
||||||
private void processTable (MTable table, int AD_Client_ID)
|
private void processTable (MTable table, int AD_Client_ID)
|
||||||
{
|
{
|
||||||
StringBuffer sql = new StringBuffer();
|
StringBuilder sql = new StringBuilder();
|
||||||
MColumn[] columns = table.getColumns(false);
|
MColumn[] columns = table.getColumns(false);
|
||||||
for (int i = 0; i < columns.length; i++)
|
for (int i = 0; i < columns.length; i++)
|
||||||
{
|
{
|
||||||
|
@ -119,7 +119,7 @@ public class TranslationDocSync extends SvrProcess
|
||||||
log.config(baseTable + ": " + sql);
|
log.config(baseTable + ": " + sql);
|
||||||
String columnNames = sql.toString();
|
String columnNames = sql.toString();
|
||||||
|
|
||||||
sql = new StringBuffer();
|
sql = new StringBuilder();
|
||||||
sql.append("UPDATE ").append(table.getTableName()).append(" t SET (")
|
sql.append("UPDATE ").append(table.getTableName()).append(" t SET (")
|
||||||
.append(columnNames).append(") = (SELECT ").append(columnNames)
|
.append(columnNames).append(") = (SELECT ").append(columnNames)
|
||||||
.append(" FROM ").append(baseTable).append(" b WHERE t.")
|
.append(" FROM ").append(baseTable).append(" b WHERE t.")
|
||||||
|
|
|
@ -90,15 +90,15 @@ public class TreeMaintenance extends SvrProcess
|
||||||
int C_Element_ID = 0;
|
int C_Element_ID = 0;
|
||||||
if (MTree.TREETYPE_ElementValue.equals(tree.getTreeType()))
|
if (MTree.TREETYPE_ElementValue.equals(tree.getTreeType()))
|
||||||
{
|
{
|
||||||
String sql = "SELECT C_Element_ID FROM C_Element "
|
StringBuilder sql = new StringBuilder("SELECT C_Element_ID FROM C_Element ")
|
||||||
+ "WHERE AD_Tree_ID=" + tree.getAD_Tree_ID();
|
.append("WHERE AD_Tree_ID=").append(tree.getAD_Tree_ID());
|
||||||
C_Element_ID = DB.getSQLValue(null, sql);
|
C_Element_ID = DB.getSQLValue(null, sql.toString());
|
||||||
if (C_Element_ID <= 0)
|
if (C_Element_ID <= 0)
|
||||||
throw new IllegalStateException("No Account Element found");
|
throw new IllegalStateException("No Account Element found");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete unused
|
// Delete unused
|
||||||
StringBuffer sql = new StringBuffer();
|
StringBuilder sql = new StringBuilder();
|
||||||
sql.append("DELETE ").append(nodeTableName)
|
sql.append("DELETE ").append(nodeTableName)
|
||||||
.append(" WHERE AD_Tree_ID=").append(tree.getAD_Tree_ID())
|
.append(" WHERE AD_Tree_ID=").append(tree.getAD_Tree_ID())
|
||||||
.append(" AND Node_ID NOT IN (SELECT ").append(sourceTableKey)
|
.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());
|
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()){
|
||||||
return tree.getName() + " OK";
|
StringBuilder msgreturn = new StringBuilder(tree.getName()).append(" OK");
|
||||||
|
return msgreturn.toString();
|
||||||
|
}
|
||||||
// Insert new
|
// Insert new
|
||||||
int inserts = 0;
|
int inserts = 0;
|
||||||
sql = new StringBuffer();
|
sql = new StringBuilder();
|
||||||
sql.append("SELECT ").append(sourceTableKey)
|
sql.append("SELECT ").append(sourceTableKey)
|
||||||
.append(" FROM ").append(sourceTableName)
|
.append(" FROM ").append(sourceTableName)
|
||||||
.append(" WHERE AD_Client_ID=").append(AD_Client_ID);
|
.append(" WHERE AD_Client_ID=").append(AD_Client_ID);
|
||||||
|
@ -175,8 +176,10 @@ public class TreeMaintenance extends SvrProcess
|
||||||
{
|
{
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
addLog(0,null, new BigDecimal(inserts), tree.getName()+ " Inserted");
|
StringBuilder msglog = new StringBuilder(tree.getName()).append(" Inserted");
|
||||||
return tree.getName() + (ok ? " OK" : " Error");
|
addLog(0,null, new BigDecimal(inserts), msglog.toString());
|
||||||
|
StringBuilder msgreturn = new StringBuilder(tree.getName()).append((ok ? " OK" : " Error"));
|
||||||
|
return msgreturn.toString();
|
||||||
} // verifyTree
|
} // verifyTree
|
||||||
|
|
||||||
} // TreeMaintenence
|
} // TreeMaintenence
|
||||||
|
|
|
@ -45,8 +45,8 @@ public class UniversalSubstitution extends SvrProcess {
|
||||||
bom.saveEx();
|
bom.saveEx();
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
StringBuilder msgreturn = new StringBuilder(count).append(" BOM products updated");
|
||||||
return count + " BOM products updated";
|
return msgreturn.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,8 +96,8 @@ public class WindowCopy extends SvrProcess
|
||||||
else
|
else
|
||||||
throw new AdempiereUserError("@Error@ @AD_Tab_ID@");
|
throw new AdempiereUserError("@Error@ @AD_Tab_ID@");
|
||||||
}
|
}
|
||||||
|
StringBuilder msgreturn = new StringBuilder("@Copied@ #").append(tabCount).append("/").append(fieldCount);
|
||||||
return "@Copied@ #" + tabCount + "/" + fieldCount;
|
return msgreturn.toString();
|
||||||
} // doIt
|
} // doIt
|
||||||
|
|
||||||
} // WindowCopy
|
} // WindowCopy
|
||||||
|
|
Loading…
Reference in New Issue