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
This commit is contained in:
Redhuan D. Oon 2010-02-27 02:47:51 +00:00
parent d0fcc6068a
commit 998d5c20f5
7 changed files with 13 additions and 12 deletions

View File

@ -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<MAccount> accounts = new Query(Env.getCtx(),MAccount.Table_Name,whereClause,null)
List<MAccount> accounts = new Query(Env.getCtx(),I_C_ValidCombination.Table_Name,whereClause,null)
.setParameters(params)
.setOrderBy(MAccount.COLUMNNAME_Combination)
.setOnlyActiveRecords(onlyActive)

View File

@ -49,7 +49,7 @@ public class MAcctProcessor extends X_C_AcctProcessor
*/
public static MAcctProcessor[] getActive (Properties ctx)
{
List<MAcctProcessor> list = new Query(ctx, MAcctProcessor.Table_Name, null, null)
List<MAcctProcessor> 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<MAcctProcessor> list = new Query(getCtx(), MAcctProcessorLog.Table_Name,whereClause,get_TrxName())
.setParameters(new Object[]{getC_AcctProcessor_ID()})
List<MAcctProcessor> 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()]);

View File

@ -115,7 +115,7 @@ public class MAcctSchema extends X_C_AcctSchema
params.add(AD_Client_ID);
}
List <MAcctSchema> ass = new Query(ctx, MAcctSchema.Table_Name,whereClause,trxName)
List <MAcctSchema> ass = new Query(ctx, I_C_AcctSchema.Table_Name,whereClause,trxName)
.setParameters(params)
.setOrderBy(MAcctSchema.COLUMNNAME_C_AcctSchema_ID)
.list();

View File

@ -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

View File

@ -62,8 +62,9 @@ public final class MAcctSchemaElement extends X_C_AcctSchema_Element
ArrayList<MAcctSchemaElement> list = new ArrayList<MAcctSchemaElement>();
String whereClause = "C_AcctSchema_ID=? AND IsActive=?";
List<MAcctSchemaElement> elements= new Query(as.getCtx(), MAcctSchemaElement.Table_Name,whereClause,as.get_TrxName())
.setParameters(new Object[]{as.getC_AcctSchema_ID(),"Y"}).setOrderBy("SeqNo")
List<MAcctSchemaElement> 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)

View File

@ -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

View File

@ -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