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:
parent
ce29e05125
commit
5fba554eab
|
@ -77,9 +77,9 @@ public class MDocType extends X_C_DocType
|
|||
*/
|
||||
static public MDocType[] getOfClient (Properties ctx)
|
||||
{
|
||||
String whereClause = "AD_Client_ID=?";
|
||||
final String whereClause = "AD_Client_ID=?";
|
||||
List<MDocType> list = new Query(ctx, Table_Name, whereClause, null)
|
||||
.setParameters(new Object[]{Env.getAD_Client_ID(ctx)})
|
||||
.setParameters(Env.getAD_Client_ID(ctx))
|
||||
.setOnlyActiveRecords(true)
|
||||
.list();
|
||||
return list.toArray(new MDocType[list.size()]);
|
||||
|
|
|
@ -85,11 +85,11 @@ public class MDunningRun extends X_C_DunningRun
|
|||
// just one level
|
||||
levels = new Query(
|
||||
getCtx(),
|
||||
MDunningLevel.Table_Name,
|
||||
I_C_DunningLevel.Table_Name,
|
||||
"C_Dunning_ID=? AND C_DunningLevel_ID=?",
|
||||
get_TrxName())
|
||||
.setOnlyActiveRecords(true)
|
||||
.setParameters(new Object[]{getC_Dunning_ID(), getC_DunningLevel_ID()})
|
||||
.setParameters(getC_Dunning_ID(), getC_DunningLevel_ID())
|
||||
.setOrderBy("DaysAfterDue DESC, C_DunningLevel_ID")
|
||||
.list();
|
||||
} else {
|
||||
|
|
|
@ -87,7 +87,7 @@ public class MEXPFormat extends X_EXP_Format {
|
|||
final String clauseWhere = X_EXP_FormatLine.COLUMNNAME_EXP_Format_ID + "=?";
|
||||
m_lines = new Query(getCtx() , I_EXP_FormatLine.Table_Name, clauseWhere , get_TrxName())
|
||||
.setOnlyActiveRecords(true)
|
||||
.setParameters(new Object[]{getEXP_Format_ID()})
|
||||
.setParameters(getEXP_Format_ID())
|
||||
.setOrderBy(orderBy)
|
||||
.list();
|
||||
return m_lines;
|
||||
|
@ -102,7 +102,7 @@ public class MEXPFormat extends X_EXP_Format {
|
|||
+ " AND " + X_EXP_FormatLine.COLUMNNAME_IsPartUniqueIndex +"= ?";
|
||||
m_lines_unique = new Query(getCtx(), I_EXP_FormatLine.Table_Name, clauseWhere, get_TrxName())
|
||||
.setOnlyActiveRecords(true)
|
||||
.setParameters(new Object[]{getEXP_Format_ID(), "Y"})
|
||||
.setParameters(getEXP_Format_ID(), "Y")
|
||||
.setOrderBy(X_EXP_FormatLine.COLUMNNAME_Position)
|
||||
.list();
|
||||
return m_lines_unique;
|
||||
|
@ -135,7 +135,7 @@ public class MEXPFormat extends X_EXP_Format {
|
|||
.append(" AND ").append(X_EXP_Format.COLUMNNAME_Version).append(" = ?");
|
||||
|
||||
retValue = (MEXPFormat) new Query(ctx,X_EXP_Format.Table_Name,whereCluse.toString(),trxName)
|
||||
.setParameters(new Object[] {value,AD_Client_ID,version}).first();
|
||||
.setParameters(value,AD_Client_ID,version).first();
|
||||
|
||||
if(retValue != null)
|
||||
{
|
||||
|
@ -161,7 +161,7 @@ public class MEXPFormat extends X_EXP_Format {
|
|||
.append(" AND ").append(X_EXP_Format.COLUMNNAME_Version).append(" = ?");
|
||||
|
||||
retValue = (MEXPFormat) new Query(ctx,X_EXP_Format.Table_Name,whereClause.toString(),trxName)
|
||||
.setParameters(new Object[] {AD_Client_ID,AD_Table_ID,version})
|
||||
.setParameters(AD_Client_ID,AD_Table_ID,version)
|
||||
.first();
|
||||
if(retValue!=null)
|
||||
{
|
||||
|
|
|
@ -213,8 +213,8 @@ public class MElementValue extends X_C_ElementValue
|
|||
{
|
||||
//
|
||||
// Check if we have accounting facts
|
||||
boolean match = new Query(getCtx(), MFactAcct.Table_Name, MFactAcct.COLUMNNAME_Account_ID+"=?", get_TrxName())
|
||||
.setParameters(new Object[]{getC_ElementValue_ID()})
|
||||
boolean match = new Query(getCtx(), I_Fact_Acct.Table_Name, I_Fact_Acct.COLUMNNAME_Account_ID+"=?", get_TrxName())
|
||||
.setParameters(getC_ElementValue_ID())
|
||||
.match();
|
||||
if (match)
|
||||
{
|
||||
|
|
|
@ -80,8 +80,8 @@ public class MFreightCategory extends X_M_FreightCategory {
|
|||
*/
|
||||
public static MFreightCategory getByValue(Properties ctx, String value, String trxName) {
|
||||
|
||||
Query q = new Query(ctx, MFreightCategory.Table_Name, "Value=? AND AD_Client_ID=?", trxName);
|
||||
q.setParameters(new Object[]{value, Env.getAD_Client_ID(ctx)});
|
||||
Query q = new Query(ctx, I_M_FreightCategory.Table_Name, "Value=? AND AD_Client_ID=?", trxName);
|
||||
q.setParameters(value, Env.getAD_Client_ID(ctx));
|
||||
return q.first();
|
||||
}
|
||||
|
||||
|
|
|
@ -623,8 +623,8 @@ public class MInOut extends X_M_InOut implements DocAction
|
|||
set_TrxName(m_lines, get_TrxName());
|
||||
return m_lines;
|
||||
}
|
||||
List<MInOutLine> list = new Query(getCtx(), MInOutLine.Table_Name, "M_InOut_ID=?", get_TrxName())
|
||||
.setParameters(new Object[]{getM_InOut_ID()})
|
||||
List<MInOutLine> list = new Query(getCtx(), I_M_InOutLine.Table_Name, "M_InOut_ID=?", get_TrxName())
|
||||
.setParameters(getM_InOut_ID())
|
||||
.setOrderBy(MInOutLine.COLUMNNAME_Line)
|
||||
.list();
|
||||
//
|
||||
|
@ -655,8 +655,8 @@ public class MInOut extends X_M_InOut implements DocAction
|
|||
set_TrxName(m_confirms, get_TrxName());
|
||||
return m_confirms;
|
||||
}
|
||||
List<MInOutConfirm> list = new Query(getCtx(), MInOutConfirm.Table_Name, "M_InOut_ID=?", get_TrxName())
|
||||
.setParameters(new Object[]{getM_InOut_ID()})
|
||||
List<MInOutConfirm> list = new Query(getCtx(), I_M_InOutConfirm.Table_Name, "M_InOut_ID=?", get_TrxName())
|
||||
.setParameters(getM_InOut_ID())
|
||||
.list();
|
||||
m_confirms = new MInOutConfirm[list.size ()];
|
||||
list.toArray (m_confirms);
|
||||
|
|
|
@ -151,9 +151,9 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
|
|||
set_TrxName(m_lines, get_TrxName());
|
||||
return m_lines;
|
||||
}
|
||||
final String whereClause = MInOutLineConfirm.COLUMNNAME_M_InOutConfirm_ID+"=?";
|
||||
List<MInOutLineConfirm> list = new Query(getCtx(), MInOutLineConfirm.Table_Name, whereClause, get_TrxName())
|
||||
.setParameters(new Object[]{getM_InOutConfirm_ID()})
|
||||
final String whereClause = I_M_InOutLineConfirm.COLUMNNAME_M_InOutConfirm_ID+"=?";
|
||||
List<MInOutLineConfirm> list = new Query(getCtx(), I_M_InOutLineConfirm.Table_Name, whereClause, get_TrxName())
|
||||
.setParameters(getM_InOutConfirm_ID())
|
||||
.list();
|
||||
m_lines = new MInOutLineConfirm[list.size ()];
|
||||
list.toArray (m_lines);
|
||||
|
|
|
@ -60,7 +60,7 @@ public class MInOutLine extends X_M_InOutLine
|
|||
{
|
||||
String whereClause = "C_OrderLine_ID=?" + (!Util.isEmpty(where, true) ? " AND "+where : "");
|
||||
List<MInOutLine> list = new Query(ctx, Table_Name, whereClause, trxName)
|
||||
.setParameters(new Object[]{C_OrderLine_ID})
|
||||
.setParameters(C_OrderLine_ID)
|
||||
.list();
|
||||
return list.toArray (new MInOutLine[list.size()]);
|
||||
} // getOfOrderLine
|
||||
|
@ -78,7 +78,7 @@ public class MInOutLine extends X_M_InOutLine
|
|||
{
|
||||
String whereClause = "M_RMALine_ID=? " + (!Util.isEmpty(where, true) ? " AND "+where : "");
|
||||
List<MRMALine> list = new Query(ctx, Table_Name, whereClause, trxName)
|
||||
.setParameters(new Object[]{M_RMALine_ID})
|
||||
.setParameters(M_RMALine_ID)
|
||||
.list();
|
||||
return list.toArray (new MInOutLine[list.size()]);
|
||||
} // getOfRMALine
|
||||
|
|
|
@ -46,8 +46,8 @@ public class MInOutLineMA extends X_M_InOutLineMA
|
|||
public static MInOutLineMA[] get (Properties ctx, int M_InOutLine_ID, String trxName)
|
||||
{
|
||||
Query query = MTable.get(ctx, MInOutLineMA.Table_Name)
|
||||
.createQuery(MInOutLineMA.COLUMNNAME_M_InOutLine_ID+"=?", trxName);
|
||||
query.setParameters(new Object[]{M_InOutLine_ID});
|
||||
.createQuery(I_M_InOutLineMA.COLUMNNAME_M_InOutLine_ID+"=?", trxName);
|
||||
query.setParameters(M_InOutLine_ID);
|
||||
List<MInOutLineMA> list = query.list();
|
||||
MInOutLineMA[] retValue = new MInOutLineMA[list.size ()];
|
||||
list.toArray (retValue);
|
||||
|
|
|
@ -146,7 +146,7 @@ public class MInventory extends X_M_Inventory implements DocAction
|
|||
}
|
||||
//
|
||||
List<MInventoryLine> list = new Query(getCtx(), MInventoryLine.Table_Name, "M_Inventory_ID=?", get_TrxName())
|
||||
.setParameters(new Object[]{get_ID()})
|
||||
.setParameters(get_ID())
|
||||
.setOrderBy(MInventoryLine.COLUMNNAME_Line)
|
||||
.list();
|
||||
m_lines = list.toArray(new MInventoryLine[list.size()]);
|
||||
|
|
|
@ -55,8 +55,8 @@ public class MInventoryLine extends X_M_InventoryLine
|
|||
{
|
||||
final String whereClause = "M_Inventory_ID=? AND M_Locator_ID=?"
|
||||
+" AND M_Product_ID=? AND M_AttributeSetInstance_ID=?";
|
||||
return new Query(inventory.getCtx(), MInventoryLine.Table_Name, whereClause, inventory.get_TrxName())
|
||||
.setParameters(new Object[]{inventory.get_ID(), M_Locator_ID, M_Product_ID, M_AttributeSetInstance_ID})
|
||||
return new Query(inventory.getCtx(), I_M_InventoryLine.Table_Name, whereClause, inventory.get_TrxName())
|
||||
.setParameters(inventory.get_ID(), M_Locator_ID, M_Product_ID, M_AttributeSetInstance_ID)
|
||||
.firstOnly();
|
||||
} // get
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
|||
public static MInvoice[] getOfBPartner (Properties ctx, int C_BPartner_ID, String trxName)
|
||||
{
|
||||
List<MInvoice> list = new Query(ctx, Table_Name, COLUMNNAME_C_BPartner_ID+"=?", trxName)
|
||||
.setParameters(new Object[]{C_BPartner_ID})
|
||||
.setParameters(C_BPartner_ID)
|
||||
.list();
|
||||
return list.toArray(new MInvoice[list.size()]);
|
||||
} // getOfBPartner
|
||||
|
@ -630,9 +630,9 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
|||
String whereClauseFinal = "C_Invoice_ID=? ";
|
||||
if (whereClause != null)
|
||||
whereClauseFinal += whereClause;
|
||||
List<MInvoiceLine> list = new Query(getCtx(), MInvoiceLine.Table_Name, whereClauseFinal, get_TrxName())
|
||||
.setParameters(new Object[]{getC_Invoice_ID()})
|
||||
.setOrderBy(MInvoiceLine.COLUMNNAME_Line)
|
||||
List<MInvoiceLine> list = new Query(getCtx(), I_C_InvoiceLine.Table_Name, whereClauseFinal, get_TrxName())
|
||||
.setParameters(getC_Invoice_ID())
|
||||
.setOrderBy(I_C_InvoiceLine.COLUMNNAME_Line)
|
||||
.list();
|
||||
return list.toArray(new MInvoiceLine[list.size()]);
|
||||
} // getLines
|
||||
|
@ -784,8 +784,8 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
|||
return m_taxes;
|
||||
|
||||
final String whereClause = MInvoiceTax.COLUMNNAME_C_Invoice_ID+"=?";
|
||||
List<MInvoiceTax> list = new Query(getCtx(), MInvoiceTax.Table_Name, whereClause, get_TrxName())
|
||||
.setParameters(new Object[]{get_ID()})
|
||||
List<MInvoiceTax> list = new Query(getCtx(), I_C_InvoiceTax.Table_Name, whereClause, get_TrxName())
|
||||
.setParameters(get_ID())
|
||||
.list();
|
||||
m_taxes = list.toArray(new MInvoiceTax[list.size()]);
|
||||
return m_taxes;
|
||||
|
|
|
@ -74,7 +74,7 @@ public class MInvoiceTax extends X_C_InvoiceTax
|
|||
}
|
||||
|
||||
retValue = new Query(line.getCtx(), Table_Name, "C_Invoice_ID=? AND C_Tax_ID=?", trxName)
|
||||
.setParameters(new Object[]{line.getC_Invoice_ID(), C_Tax_ID})
|
||||
.setParameters(line.getC_Invoice_ID(), C_Tax_ID)
|
||||
.firstOnly();
|
||||
if (retValue != null)
|
||||
{
|
||||
|
|
|
@ -215,9 +215,9 @@ public class MJournal extends X_GL_Journal implements DocAction
|
|||
public MJournalLine[] getLines (boolean requery)
|
||||
{
|
||||
//FR: [ 2214883 ] Remove SQL code and Replace for Query - red1
|
||||
String whereClause = "GL_Journal_ID=?";
|
||||
List <MJournalLine> list = new Query(getCtx(), MJournalLine.Table_Name, whereClause.toString(), null)
|
||||
.setParameters(new Object[]{getGL_Journal_ID()})
|
||||
final String whereClause = "GL_Journal_ID=?";
|
||||
List <MJournalLine> list = new Query(getCtx(), I_GL_JournalLine.Table_Name, whereClause.toString(), null)
|
||||
.setParameters(getGL_Journal_ID())
|
||||
.setOrderBy("Line")
|
||||
.list();
|
||||
//
|
||||
|
|
|
@ -70,7 +70,7 @@ public class MLanguage extends X_AD_Language
|
|||
public static MLanguage get (Properties ctx, String AD_Language)
|
||||
{
|
||||
return new Query(ctx, Table_Name, COLUMNNAME_AD_Language+"=?", null)
|
||||
.setParameters(new Object[]{AD_Language})
|
||||
.setParameters(AD_Language)
|
||||
.firstOnly();
|
||||
} // get
|
||||
|
||||
|
@ -83,7 +83,7 @@ public class MLanguage extends X_AD_Language
|
|||
public static MLanguage[] getWithLanguage (Properties ctx, String LanguageISO)
|
||||
{
|
||||
List<MLanguage> list = new Query(ctx, Table_Name, COLUMNNAME_LanguageISO+"=?", null)
|
||||
.setParameters(new Object[]{LanguageISO})
|
||||
.setParameters(LanguageISO)
|
||||
.list();
|
||||
return list.toArray(new MLanguage[list.size()]);
|
||||
} // get
|
||||
|
@ -95,7 +95,7 @@ public class MLanguage extends X_AD_Language
|
|||
public static void maintain (Properties ctx)
|
||||
{
|
||||
List<MLanguage> list = new Query(ctx, Table_Name, "IsSystemLanguage=? AND IsBaseLanguage=?", null)
|
||||
.setParameters(new Object[]{true, false})
|
||||
.setParameters(true, false)
|
||||
.setOnlyActiveRecords(true)
|
||||
.list();
|
||||
for (MLanguage language : list) {
|
||||
|
|
Loading…
Reference in New Issue