From 998d5c20f53ab6fc275ffc456ff4948f9920a63f Mon Sep 17 00:00:00 2001 From: "Redhuan D. Oon" Date: Sat, 27 Feb 2010 02:47:51 +0000 Subject: [PATCH] Review FR: [ 2214883 ] Remove SQL code and Replace for Query >> to incorporate Heng Sin's advice. No unit testing done but compiler tested OK. Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=2214883 --- base/src/org/compiere/model/MAccountLookup.java | 2 +- base/src/org/compiere/model/MAcctProcessor.java | 6 +++--- base/src/org/compiere/model/MAcctSchema.java | 2 +- base/src/org/compiere/model/MAcctSchemaDefault.java | 4 ++-- base/src/org/compiere/model/MAcctSchemaElement.java | 5 +++-- base/src/org/compiere/model/MAcctSchemaGL.java | 4 ++-- base/src/org/compiere/model/M_Element.java | 2 +- 7 files changed, 13 insertions(+), 12 deletions(-) diff --git a/base/src/org/compiere/model/MAccountLookup.java b/base/src/org/compiere/model/MAccountLookup.java index b364e29145..1aa584edac 100644 --- a/base/src/org/compiere/model/MAccountLookup.java +++ b/base/src/org/compiere/model/MAccountLookup.java @@ -181,7 +181,7 @@ public final class MAccountLookup extends Lookup implements Serializable String whereClause = "AD_Client_ID=?"; params.add(Env.getAD_Client_ID(m_ctx)); - List accounts = new Query(Env.getCtx(),MAccount.Table_Name,whereClause,null) + List accounts = new Query(Env.getCtx(),I_C_ValidCombination.Table_Name,whereClause,null) .setParameters(params) .setOrderBy(MAccount.COLUMNNAME_Combination) .setOnlyActiveRecords(onlyActive) diff --git a/base/src/org/compiere/model/MAcctProcessor.java b/base/src/org/compiere/model/MAcctProcessor.java index c09ab4fb59..d57a359468 100644 --- a/base/src/org/compiere/model/MAcctProcessor.java +++ b/base/src/org/compiere/model/MAcctProcessor.java @@ -49,7 +49,7 @@ public class MAcctProcessor extends X_C_AcctProcessor */ public static MAcctProcessor[] getActive (Properties ctx) { - List list = new Query(ctx, MAcctProcessor.Table_Name, null, null) + List list = new Query(ctx, I_C_AcctProcessor.Table_Name, null, null) .setOnlyActiveRecords(true) .list(); return list.toArray(new MAcctProcessor[list.size()]); @@ -129,8 +129,8 @@ public class MAcctProcessor extends X_C_AcctProcessor public AdempiereProcessorLog[] getLogs () { String whereClause = "C_AcctProcessor_ID=? "; - List list = new Query(getCtx(), MAcctProcessorLog.Table_Name,whereClause,get_TrxName()) - .setParameters(new Object[]{getC_AcctProcessor_ID()}) + List list = new Query(getCtx(), I_C_AcctProcessorLog.Table_Name,whereClause,get_TrxName()) + .setParameters(getC_AcctProcessor_ID()) .setOrderBy("Created DESC") .list(); return list.toArray(new MAcctProcessorLog[list.size()]); diff --git a/base/src/org/compiere/model/MAcctSchema.java b/base/src/org/compiere/model/MAcctSchema.java index f75cdc4838..3d0ee9b452 100644 --- a/base/src/org/compiere/model/MAcctSchema.java +++ b/base/src/org/compiere/model/MAcctSchema.java @@ -115,7 +115,7 @@ public class MAcctSchema extends X_C_AcctSchema params.add(AD_Client_ID); } - List ass = new Query(ctx, MAcctSchema.Table_Name,whereClause,trxName) + List ass = new Query(ctx, I_C_AcctSchema.Table_Name,whereClause,trxName) .setParameters(params) .setOrderBy(MAcctSchema.COLUMNNAME_C_AcctSchema_ID) .list(); diff --git a/base/src/org/compiere/model/MAcctSchemaDefault.java b/base/src/org/compiere/model/MAcctSchemaDefault.java index f8f9afbc02..b8de7d0aba 100644 --- a/base/src/org/compiere/model/MAcctSchemaDefault.java +++ b/base/src/org/compiere/model/MAcctSchemaDefault.java @@ -47,8 +47,8 @@ public class MAcctSchemaDefault extends X_C_AcctSchema_Default public static MAcctSchemaDefault get (Properties ctx, int C_AcctSchema_ID) { String whereClause = "C_AcctSchema_ID=?"; - return new Query(ctx,MAcctSchemaDefault.Table_Name,whereClause,null) - .setParameters(new Object[]{C_AcctSchema_ID}) + return new Query(ctx,I_C_AcctSchema_Default.Table_Name,whereClause,null) + .setParameters(C_AcctSchema_ID) .firstOnly(); } // get diff --git a/base/src/org/compiere/model/MAcctSchemaElement.java b/base/src/org/compiere/model/MAcctSchemaElement.java index c76e33c671..ec6f1aaeb0 100644 --- a/base/src/org/compiere/model/MAcctSchemaElement.java +++ b/base/src/org/compiere/model/MAcctSchemaElement.java @@ -62,8 +62,9 @@ public final class MAcctSchemaElement extends X_C_AcctSchema_Element ArrayList list = new ArrayList(); String whereClause = "C_AcctSchema_ID=? AND IsActive=?"; - List elements= new Query(as.getCtx(), MAcctSchemaElement.Table_Name,whereClause,as.get_TrxName()) - .setParameters(new Object[]{as.getC_AcctSchema_ID(),"Y"}).setOrderBy("SeqNo") + List elements= new Query(as.getCtx(), I_C_AcctSchema_Element.Table_Name,whereClause,as.get_TrxName()) + .setParameters(as.getC_AcctSchema_ID(),"Y") + .setOrderBy("SeqNo") .list(); for(MAcctSchemaElement ase : elements) diff --git a/base/src/org/compiere/model/MAcctSchemaGL.java b/base/src/org/compiere/model/MAcctSchemaGL.java index 28ebeed12f..89396a57f2 100644 --- a/base/src/org/compiere/model/MAcctSchemaGL.java +++ b/base/src/org/compiere/model/MAcctSchemaGL.java @@ -50,8 +50,8 @@ public class MAcctSchemaGL extends X_C_AcctSchema_GL public static MAcctSchemaGL get (Properties ctx, int C_AcctSchema_ID) { String whereClause = "C_AcctSchema_ID=?"; - return new Query(ctx,MAcctSchemaGL.Table_Name,whereClause,null) - .setParameters(new Object[]{C_AcctSchema_ID}) + return new Query(ctx,I_C_AcctSchema_GL.Table_Name,whereClause,null) + .setParameters(C_AcctSchema_ID) .firstOnly(); } // get diff --git a/base/src/org/compiere/model/M_Element.java b/base/src/org/compiere/model/M_Element.java index 7f24ec1335..07e4e31050 100644 --- a/base/src/org/compiere/model/M_Element.java +++ b/base/src/org/compiere/model/M_Element.java @@ -110,7 +110,7 @@ public class M_Element extends X_AD_Element String whereClause = "EXISTS (SELECT 1 FROM AD_Column c " + "WHERE c.AD_Element_ID=AD_Element.AD_Element_ID AND c.AD_Column_ID=?)"; M_Element retValue = new Query(ctx, Table_Name, whereClause, trxName) - .setParameters(new Object[]{AD_Column_ID}) + .setParameters(AD_Column_ID) .firstOnly(); return retValue; } // get