FR [ 2788465 ] MBPartnerLocation.getForBPartner method add trxName

https://sourceforge.net/tracker/index.php?func=detail&aid=2788465&group_id=176962&atid=879335
This commit is contained in:
teo_sarca 2009-05-07 15:57:15 +00:00
parent b4f70bce12
commit a538528589
1 changed files with 25 additions and 36 deletions

View File

@ -16,14 +16,9 @@
*****************************************************************************/ *****************************************************************************/
package org.compiere.model; package org.compiere.model;
import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.util.ArrayList; import java.util.List;
import java.util.Properties; import java.util.Properties;
import java.util.logging.Level;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
/** /**
@ -31,52 +26,46 @@ import org.compiere.util.DB;
* *
* @author Jorg Janke * @author Jorg Janke
* @version $Id: MBPartnerLocation.java,v 1.3 2006/07/30 00:51:03 jjanke Exp $ * @version $Id: MBPartnerLocation.java,v 1.3 2006/07/30 00:51:03 jjanke Exp $
* @author Teo Sarca, www.arhipac.ro
* <li>FR [ 2788465 ] MBPartnerLocation.getForBPartner method add trxName
* https://sourceforge.net/tracker/index.php?func=detail&aid=2788465&group_id=176962&atid=879335
*/ */
public class MBPartnerLocation extends X_C_BPartner_Location public class MBPartnerLocation extends X_C_BPartner_Location
{ {
/** /**
* *
*/ */
private static final long serialVersionUID = 2563622950216844404L; private static final long serialVersionUID = 1062151267747257338L;
/** /**
* Get Locations for BPartner * Get Locations for BPartner
* @param ctx context * @param ctx context
* @param C_BPartner_ID bp * @param C_BPartner_ID bp
* @return array of locations * @return array of locations
* @deprecated Since 3.5.3a. Please use {@link #getForBPartner(Properties, int, String)}.
*/ */
public static MBPartnerLocation[] getForBPartner (Properties ctx, int C_BPartner_ID) public static MBPartnerLocation[] getForBPartner (Properties ctx, int C_BPartner_ID)
{ {
ArrayList<MBPartnerLocation> list = new ArrayList<MBPartnerLocation>(); return getForBPartner(ctx, C_BPartner_ID, null);
String sql = "SELECT * FROM C_BPartner_Location WHERE C_BPartner_ID=?"; }
PreparedStatement pstmt = null;
ResultSet rs = null; /**
try * Get Locations for BPartner
{ * @param ctx context
pstmt = DB.prepareStatement (sql, null); * @param C_BPartner_ID bp
pstmt.setInt (1, C_BPartner_ID); * @param trxName
rs = pstmt.executeQuery (); * @return array of locations
while (rs.next ()) */
list.add(new MBPartnerLocation(ctx, rs, null)); public static MBPartnerLocation[] getForBPartner (Properties ctx, int C_BPartner_ID, String trxName)
} {
catch (Exception e) List<MBPartnerLocation> list = new Query(ctx, Table_Name, "C_BPartner_ID=?", trxName)
{ .setParameters(new Object[]{C_BPartner_ID})
s_log.log(Level.SEVERE, "getForBPartner", e); .list();
}
finally
{
DB.close(rs, pstmt);
}
MBPartnerLocation[] retValue = new MBPartnerLocation[list.size ()]; MBPartnerLocation[] retValue = new MBPartnerLocation[list.size ()];
list.toArray (retValue); list.toArray (retValue);
return retValue; return retValue;
} // getForBPartner } // getForBPartner
/** Static Logger */
private static CLogger s_log = CLogger.getCLogger (MBPartnerLocation.class);
/************************************************************************** /**************************************************************************
* Default Constructor * Default Constructor
* @param ctx context * @param ctx context