FR [ 2788430 ] MUser.getOfBPartner add trxName parameter

https://sourceforge.net/tracker/index.php?func=detail&aid=2788430&group_id=176962&atid=879335
This commit is contained in:
teo_sarca 2009-05-07 15:54:12 +00:00
parent b362b9a8f1
commit b4f70bce12
1 changed files with 27 additions and 26 deletions

View File

@ -21,6 +21,7 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
import java.util.Properties; import java.util.Properties;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import java.util.logging.Level; import java.util.logging.Level;
@ -39,44 +40,44 @@ import org.compiere.util.SecureEngine;
* *
* @author Jorg Janke * @author Jorg Janke
* @version $Id: MUser.java,v 1.3 2006/07/30 00:58:18 jjanke Exp $ * @version $Id: MUser.java,v 1.3 2006/07/30 00:58:18 jjanke Exp $
*
* @author Teo Sarca, www.arhipac.ro
* <li>FR [ 2788430 ] MUser.getOfBPartner add trxName parameter
* https://sourceforge.net/tracker/index.php?func=detail&aid=2788430&group_id=176962&atid=879335
*/ */
public class MUser extends X_AD_User public class MUser extends X_AD_User
{ {
/** /**
* *
*/ */
private static final long serialVersionUID = 6092227157131291023L; private static final long serialVersionUID = 1399447378628744412L;
/** /**
* Get active Users of BPartner * Get active Users of BPartner
* @param ctx context * @param ctx context
* @param C_BPartner_ID id * @param C_BPartner_ID id
* @return array of users * @return array of users
* @deprecated Since 3.5.3a. Please use {@link #getOfBPartner(Properties, int, String)}.
*/ */
public static MUser[] getOfBPartner (Properties ctx, int C_BPartner_ID) public static MUser[] getOfBPartner (Properties ctx, int C_BPartner_ID)
{ {
ArrayList<MUser> list = new ArrayList<MUser>(); return getOfBPartner(ctx, C_BPartner_ID, null);
String sql = "SELECT * FROM AD_User WHERE C_BPartner_ID=? AND IsActive='Y'"; }
PreparedStatement pstmt = null;
ResultSet rs = null; /**
try * Get active Users of BPartner
{ * @param ctx
pstmt = DB.prepareStatement (sql, null); * @param C_BPartner_ID
pstmt.setInt (1, C_BPartner_ID); * @param trxName
rs = pstmt.executeQuery (); * @return array of users
while (rs.next ()) */
list.add(new MUser(ctx, rs, null)); public static MUser[] getOfBPartner (Properties ctx, int C_BPartner_ID, String trxName)
} {
catch (Exception e) List<MUser> list = new Query(ctx, MUser.Table_Name, "C_BPartner_ID=?", trxName)
{ .setParameters(new Object[]{C_BPartner_ID})
s_log.log(Level.SEVERE, sql, e); .setOnlyActiveRecords(true)
} .list();
finally
{
DB.close(rs, pstmt);
rs = null; pstmt = null;
}
MUser[] retValue = new MUser[list.size ()]; MUser[] retValue = new MUser[list.size ()];
list.toArray (retValue); list.toArray (retValue);