peer review for 11535 -> getBPartnerCashTrx refactored with junit test applied

FR: [ 2214883 ] Remove SQL code and Replace for Query
Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=2214883
This commit is contained in:
Carlos Ruiz 2010-03-03 19:47:16 +00:00
parent 63780c78b2
commit 6b59db69ed
1 changed files with 3 additions and 8 deletions

View File

@ -49,7 +49,6 @@ public class MBPartner extends X_C_BPartner
*/
private static final long serialVersionUID = -3669895599574182217L;
/**
* Get Empty Template Business Partner
* @param ctx context
@ -97,11 +96,7 @@ public class MBPartner extends X_C_BPartner
*/
public static MBPartner getBPartnerCashTrx (Properties ctx, int AD_Client_ID)
{
MBPartner retValue = null;
final String whereClause = "C_BPartner_ID IN (SELECT C_BPartnerCashTrx_ID FROM AD_ClientInfo WHERE AD_Client_ID=?)";
retValue = new Query(ctx, I_C_BPartner.Table_Name, whereClause, null)
.setParameters(AD_Client_ID)
.first();
MBPartner retValue = (MBPartner) MClientInfo.get(ctx, AD_Client_ID).getC_BPartnerCashTrx();
if (retValue == null)
s_log.log(Level.SEVERE, "Not found for AD_Client_ID=" + AD_Client_ID);
@ -119,7 +114,7 @@ public class MBPartner extends X_C_BPartner
if (Value == null || Value.length() == 0)
return null;
final String whereClause = "Value=? AND AD_Client_ID=?";
MBPartner retValue = new Query(ctx, I_C_BPartner.Table_Name, whereClause.toString(), null)
MBPartner retValue = new Query(ctx, I_C_BPartner.Table_Name, whereClause, null)
.setParameters(Value,Env.getAD_Client_ID(ctx))
.firstOnly();
return retValue;
@ -134,7 +129,7 @@ public class MBPartner extends X_C_BPartner
public static MBPartner get (Properties ctx, int C_BPartner_ID)
{
final String whereClause = "C_BPartner_ID=? AND AD_Client_ID=?";
MBPartner retValue = new Query(ctx,I_C_BPartner.Table_Name,whereClause.toString(),null)
MBPartner retValue = new Query(ctx,I_C_BPartner.Table_Name,whereClause,null)
.setParameters(C_BPartner_ID,Env.getAD_Client_ID(ctx))
.firstOnly();
return retValue;