Peer review for 11751 - FR: [ 2214883 ] Remove SQL code and Replace for Query

minor refactoring
Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=2214883
This commit is contained in:
Carlos Ruiz 2010-03-26 18:42:14 +00:00
parent 9dd5c1543b
commit 6e8d32a311
1 changed files with 9 additions and 10 deletions

View File

@ -48,8 +48,7 @@ public class MCostDetail extends X_M_CostDetail
/** /**
* *
*/ */
private static final long serialVersionUID = 5452006110417178583L; private static final long serialVersionUID = -7882724307127281675L;
/** /**
* Create New Order Cost Detail for Purchase Orders. * Create New Order Cost Detail for Purchase Orders.
@ -524,13 +523,13 @@ public class MCostDetail extends X_M_CostDetail
* @param trxName trx * @param trxName trx
* @return cost detail * @return cost detail
*/ */
public static MCostDetail get (Properties ctx, String passedClause, public static MCostDetail get (Properties ctx, String whereClause,
int ID, int M_AttributeSetInstance_ID, int C_AcctSchema_ID, String trxName) int ID, int M_AttributeSetInstance_ID, int C_AcctSchema_ID, String trxName)
{ {
final String whereClause = passedClause final String localWhereClause = whereClause
+ " AND M_AttributeSetInstance_ID=?" + " AND M_AttributeSetInstance_ID=?"
+ " AND C_AcctSchema_ID=?"; + " AND C_AcctSchema_ID=?";
MCostDetail retValue = new Query(ctx,I_M_CostDetail.Table_Name,whereClause,trxName) MCostDetail retValue = new Query(ctx,I_M_CostDetail.Table_Name,localWhereClause,trxName)
.setParameters(ID,M_AttributeSetInstance_ID,C_AcctSchema_ID) .setParameters(ID,M_AttributeSetInstance_ID,C_AcctSchema_ID)
.first(); .first();
return retValue; return retValue;
@ -552,12 +551,12 @@ public class MCostDetail extends X_M_CostDetail
.setParameters(product.getM_Product_ID(),false) .setParameters(product.getM_Product_ID(),false)
.setOrderBy("C_AcctSchema_ID, M_CostElement_ID, AD_Org_ID, M_AttributeSetInstance_ID, Created") .setOrderBy("C_AcctSchema_ID, M_CostElement_ID, AD_Org_ID, M_AttributeSetInstance_ID, Created")
.list(); .list();
for (MCostDetail cd:list){ for (MCostDetail cd : list) {
if (cd.process()) // saves if (cd.process()) // saves
counterOK++; counterOK++;
else else
counterError++; counterError++;
} }
s_log.config("OK=" + counterOK + ", Errors=" + counterError); s_log.config("OK=" + counterOK + ", Errors=" + counterError);
return counterError == 0; return counterError == 0;
} // processProduct } // processProduct