FR: [ 2214883 ] Remove SQL code and Replace for Query
Applying defensive programming approach and ABP. Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=2214883
This commit is contained in:
parent
998d5c20f5
commit
ec4e2f798a
|
@ -33,10 +33,12 @@ import org.compiere.util.KeyNamePair;
|
|||
*/
|
||||
public class MAcctSchemaDefault extends X_C_AcctSchema_Default
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 199959007595802866L;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 199959007595802866L;
|
||||
|
||||
/**
|
||||
* Get Accounting Schema Default Info
|
||||
|
@ -46,7 +48,7 @@ public class MAcctSchemaDefault extends X_C_AcctSchema_Default
|
|||
*/
|
||||
public static MAcctSchemaDefault get (Properties ctx, int C_AcctSchema_ID)
|
||||
{
|
||||
String whereClause = "C_AcctSchema_ID=?";
|
||||
final String whereClause = "C_AcctSchema_ID=?";
|
||||
return new Query(ctx,I_C_AcctSchema_Default.Table_Name,whereClause,null)
|
||||
.setParameters(C_AcctSchema_ID)
|
||||
.firstOnly();
|
||||
|
|
|
@ -40,10 +40,12 @@ import org.compiere.util.Msg;
|
|||
*/
|
||||
public final class MAcctSchemaElement extends X_C_AcctSchema_Element
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 4215184252533527719L;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 4215184252533527719L;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -61,7 +63,7 @@ public final class MAcctSchemaElement extends X_C_AcctSchema_Element
|
|||
s_log.fine("C_AcctSchema_ID=" + as.getC_AcctSchema_ID());
|
||||
ArrayList<MAcctSchemaElement> list = new ArrayList<MAcctSchemaElement>();
|
||||
|
||||
String whereClause = "C_AcctSchema_ID=? AND IsActive=?";
|
||||
final String whereClause = "C_AcctSchema_ID=? AND IsActive=?";
|
||||
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")
|
||||
|
|
|
@ -35,10 +35,12 @@ import org.compiere.util.KeyNamePair;
|
|||
*/
|
||||
public class MAcctSchemaGL extends X_C_AcctSchema_GL
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 5303102649110271896L;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 5303102649110271896L;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -49,7 +51,7 @@ public class MAcctSchemaGL extends X_C_AcctSchema_GL
|
|||
*/
|
||||
public static MAcctSchemaGL get (Properties ctx, int C_AcctSchema_ID)
|
||||
{
|
||||
String whereClause = "C_AcctSchema_ID=?";
|
||||
final String whereClause = "C_AcctSchema_ID=?";
|
||||
return new Query(ctx,I_C_AcctSchema_GL.Table_Name,whereClause,null)
|
||||
.setParameters(C_AcctSchema_ID)
|
||||
.firstOnly();
|
||||
|
|
|
@ -40,10 +40,11 @@ import org.compiere.util.Env;
|
|||
*/
|
||||
public class MPInstance extends X_AD_PInstance
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -5848424269552679604L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -5848424269552679604L;
|
||||
|
||||
/**
|
||||
* Standard Constructor
|
||||
|
@ -126,7 +127,7 @@ public class MPInstance extends X_AD_PInstance
|
|||
if (m_parameters != null)
|
||||
return m_parameters;
|
||||
//FR: [ 2214883 ] Remove SQL code and Replace for Query - red1
|
||||
String whereClause = "AD_PInstance_ID=?";
|
||||
final String whereClause = "AD_PInstance_ID=?";
|
||||
List <MPInstancePara> list = new Query(getCtx(), I_AD_PInstance_Para.Table_Name, whereClause, null) // @TODO: Review implications of using transaction
|
||||
.setParameters(getAD_PInstance_ID())
|
||||
.list();
|
||||
|
|
|
@ -30,10 +30,11 @@ import org.compiere.util.Env;
|
|||
*/
|
||||
public class MPaySelection extends X_C_PaySelection
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -6521282913549455131L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -6521282913549455131L;
|
||||
|
||||
/**
|
||||
* Default Constructor
|
||||
|
@ -84,7 +85,7 @@ public class MPaySelection extends X_C_PaySelection
|
|||
return m_lines;
|
||||
}
|
||||
//FR: [ 2214883 ] Remove SQL code and Replace for Query - red1
|
||||
String whereClause = "C_PaySelection_ID=?";
|
||||
final String whereClause = "C_PaySelection_ID=?";
|
||||
List <MPaySelectionLine> list = new Query(getCtx(), I_C_PaySelectionLine.Table_Name, whereClause, get_TrxName())
|
||||
.setParameters(getC_PaySelection_ID())
|
||||
.setOrderBy("Line")
|
||||
|
|
|
@ -77,10 +77,12 @@ import org.compiere.util.ValueNamePair;
|
|||
public final class MPayment extends X_C_Payment
|
||||
implements DocAction, ProcessCall
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 6200327948230438741L;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 6200327948230438741L;
|
||||
|
||||
/**
|
||||
* Get Payments Of BPartner
|
||||
|
@ -92,7 +94,7 @@ public final class MPayment extends X_C_Payment
|
|||
public static MPayment[] getOfBPartner (Properties ctx, int C_BPartner_ID, String trxName)
|
||||
{
|
||||
//FR: [ 2214883 ] Remove SQL code and Replace for Query - red1
|
||||
String whereClause = "C_BPartner_ID=?";
|
||||
final String whereClause = "C_BPartner_ID=?";
|
||||
List <MPayment> list = new Query(ctx, I_C_Payment.Table_Name, whereClause, trxName)
|
||||
.setParameters(C_BPartner_ID)
|
||||
.list();
|
||||
|
|
|
@ -20,7 +20,6 @@ import java.math.BigDecimal;
|
|||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.util.CLogger;
|
||||
|
@ -719,7 +718,7 @@ public class MProductPricing
|
|||
return;
|
||||
//
|
||||
//FR: [ 2214883 ] Remove SQL code and Replace for Query - red1
|
||||
String whereClause = "M_Product_ID=?";
|
||||
final String whereClause = "M_Product_ID=?";
|
||||
MProduct retValue = new Query(Env.getCtx(), I_M_Product.Table_Name, whereClause, null)
|
||||
.setParameters(m_M_Product_ID)
|
||||
.first();
|
||||
|
|
|
@ -16,11 +16,8 @@
|
|||
*****************************************************************************/
|
||||
package org.compiere.model;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
@ -36,10 +33,11 @@ import org.compiere.util.Env;
|
|||
*/
|
||||
public class MProject extends X_C_Project
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -1781787100948563589L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -1781787100948563589L;
|
||||
|
||||
/**
|
||||
* Create new Project by copying
|
||||
|
@ -206,7 +204,7 @@ public class MProject extends X_C_Project
|
|||
public MProjectLine[] getLines()
|
||||
{
|
||||
//FR: [ 2214883 ] Remove SQL code and Replace for Query - red1
|
||||
String whereClause = "C_Project_ID=?";
|
||||
final String whereClause = "C_Project_ID=?";
|
||||
List <MProjectLine> list = new Query(getCtx(), I_C_ProjectLine.Table_Name, whereClause, get_TrxName())
|
||||
.setParameters(getC_Project_ID())
|
||||
.setOrderBy("Line")
|
||||
|
|
|
@ -18,10 +18,8 @@ package org.compiere.model;
|
|||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
|
@ -40,10 +38,11 @@ import org.compiere.util.Env;
|
|||
*/
|
||||
public class MRequestType extends X_R_RequestType
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 6235793036503665638L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 6235793036503665638L;
|
||||
|
||||
/**
|
||||
* Get Request Type (cached)
|
||||
|
@ -78,7 +77,7 @@ public class MRequestType extends X_R_RequestType
|
|||
int AD_Client_ID = Env.getAD_Client_ID(ctx);
|
||||
|
||||
//FR: [ 2214883 ] Remove SQL code and Replace for Query - red1
|
||||
String whereClause = "AD_Client_ID IN (0," + AD_Client_ID + ")";
|
||||
final String whereClause = "AD_Client_ID IN (0," + AD_Client_ID + ")";
|
||||
MRequestType retValue = new Query(ctx, I_R_RequestType.Table_Name, whereClause, null)
|
||||
.setOrderBy("IsDefault DESC, AD_Client_ID DESC")
|
||||
.first();
|
||||
|
|
|
@ -33,10 +33,11 @@ import org.compiere.util.Msg;
|
|||
*/
|
||||
public class M_Element extends X_AD_Element
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -7426812810619889250L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -6644398794862560030L;
|
||||
|
||||
/**
|
||||
* Get case sensitive Column Name
|
||||
|
@ -107,7 +108,7 @@ public class M_Element extends X_AD_Element
|
|||
{
|
||||
if (AD_Column_ID ==0)
|
||||
return null;
|
||||
String whereClause = "EXISTS (SELECT 1 FROM AD_Column c "
|
||||
final 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(AD_Column_ID)
|
||||
|
|
Loading…
Reference in New Issue