Review FR: [ 2214883 ] Remove SQL code and Replace for Query >> to incorporate Best Practice. 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-03-02 15:38:35 +00:00
parent 4d76cea47e
commit d2333e9026
4 changed files with 13 additions and 13 deletions

View File

@ -33,9 +33,7 @@ import org.compiere.util.Env;
*/
public class MAchievement extends X_PA_Achievement
{
/**
*
*/
private static final long serialVersionUID = -1438593600498523664L;
/**
@ -56,9 +54,11 @@ public class MAchievement extends X_PA_Achievement
*/
public static MAchievement[] getOfMeasure (Properties ctx, int PA_Measure_ID)
{
String whereClause ="PA_Measure_ID=? AND IsAchieved='Y'";
List <MAchievement> list = new Query(ctx,MAchievement.Table_Name, whereClause, null)
.setParameters(new Object[]{PA_Measure_ID}).setOrderBy("SeqNo, DateDoc").list();
final String whereClause ="PA_Measure_ID=? AND IsAchieved='Y'";
List <MAchievement> list = new Query(ctx,I_PA_Achievement.Table_Name, whereClause, null)
.setParameters(PA_Measure_ID)
.setOrderBy("SeqNo, DateDoc")
.list();
MAchievement[] retValue = new MAchievement[list.size ()];
retValue = list.toArray (retValue);

View File

@ -89,8 +89,8 @@ public class MAlert extends X_AD_Alert
return m_rules;
//FR: [ 2214883 ] Remove SQL code and Replace for Query - red1
final String whereClause = "AD_Alert_ID=?";
List <MAlertRule> list = new Query(getCtx(), MAlertRule.Table_Name, whereClause, null)
.setParameters(new Object[]{getAD_Alert_ID()})
List <MAlertRule> list = new Query(getCtx(), I_AD_AlertRule.Table_Name, whereClause, null)
.setParameters(getAD_Alert_ID())
.setOrderBy("Name, AD_AlertRule_ID")
.setOnlyActiveRecords(true)
.list()
@ -116,8 +116,8 @@ public class MAlert extends X_AD_Alert
return m_recipients;
//FR: [ 2214883 ] Remove SQL code and Replace for Query - red1
final String whereClause = "AD_Alert_ID=?";
List <MAlertRecipient> list = new Query(getCtx(), MAlertRecipient.Table_Name, whereClause, null)
.setParameters(new Object[]{getAD_Alert_ID()})
List <MAlertRecipient> list = new Query(getCtx(), I_AD_AlertRecipient.Table_Name, whereClause, null)
.setParameters(getAD_Alert_ID())
.setOnlyActiveRecords(true)
.list()
;

View File

@ -416,7 +416,7 @@ public final class MAllocationHdr extends X_C_AllocationHdr implements DocAction
+ I_C_Invoice.COLUMNNAME_DocStatus + " NOT IN (?,?)";
boolean InvoiceIsPaid = new Query(getCtx(), I_C_Invoice.Table_Name, whereClause, get_TrxName())
.setClient_ID()
.setParameters(new Object[]{line.getC_Invoice_ID(), "Y", MInvoice.DOCSTATUS_Voided, MInvoice.DOCSTATUS_Reversed})
.setParameters(line.getC_Invoice_ID(), "Y", X_C_Invoice.DOCSTATUS_Voided, X_C_Invoice.DOCSTATUS_Reversed)
.match();
if(InvoiceIsPaid)
throw new AdempiereException("@ValidationError@ @C_Invoice_ID@ @IsPaid@");

View File

@ -91,8 +91,8 @@ public class M_Element extends X_AD_Element
//
// TODO: caching if trxName == null
final String whereClause = "UPPER(ColumnName)=?";
M_Element retValue = new Query(ctx, M_Element.Table_Name, whereClause, trxName)
.setParameters(new Object[]{columnName.toUpperCase()})
M_Element retValue = new Query(ctx, I_AD_Element.Table_Name, whereClause, trxName)
.setParameters(columnName.toUpperCase())
.firstOnly();
return retValue;
} // get