diff --git a/base/.classpath b/base/.classpath
index 5fdce263ed..2702943833 100644
--- a/base/.classpath
+++ b/base/.classpath
@@ -9,7 +9,6 @@
-
@@ -19,5 +18,6 @@
+
diff --git a/base/ADempiere.launch b/base/ADempiere.launch
index f6d420c2aa..b8f2b09c0e 100644
--- a/base/ADempiere.launch
+++ b/base/ADempiere.launch
@@ -41,9 +41,10 @@
+
-
+
diff --git a/base/src/org/compiere/model/I_AD_UserQuery.java b/base/src/org/compiere/model/I_AD_UserQuery.java
index d0f1e7ffc6..9f6f6867d9 100644
--- a/base/src/org/compiere/model/I_AD_UserQuery.java
+++ b/base/src/org/compiere/model/I_AD_UserQuery.java
@@ -136,5 +136,13 @@ import org.compiere.util.*;
/** Get Name.
* Alphanumeric identifier of the entity
*/
- public String getName();
+ public String getName();
+
+ /** Set Tab.
+ @param AD_Tab_ID Tab within a Window */
+ public void setAD_Tab_ID (int AD_Tab_ID);
+
+ /** Get Tab.
+ @return Tab within a Window */
+ public int getAD_Tab_ID();
}
diff --git a/base/src/org/compiere/model/MUserQuery.java b/base/src/org/compiere/model/MUserQuery.java
new file mode 100644
index 0000000000..1121945959
--- /dev/null
+++ b/base/src/org/compiere/model/MUserQuery.java
@@ -0,0 +1,153 @@
+/******************************************************************************
+ * Product: Compiere ERP & CRM Smart Business Solution
+ * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved.
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms version 2 of the GNU General Public License as published
+ * by the Free Software Foundation. This program is distributed in the hope
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ * You may reach us at: ComPiere, Inc. - http://www.compiere.org/license.html
+ * 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA or info@compiere.org
+ *****************************************************************************/
+package org.compiere.model;
+
+import java.sql.*;
+import java.util.*;
+import java.util.logging.*;
+import org.compiere.util.*;
+
+
+/**
+ * User Query Model
+ *
+ * @author Jorg Janke
+ * @version $Id$
+ */
+public class MUserQuery extends X_AD_UserQuery
+{
+ /**
+ * Get all active queries of client for Tab
+ * @param ctx context
+ * @param AD_Tab_ID tab
+ * @return array of queries
+ */
+ public static MUserQuery[] get (Properties ctx, int AD_Tab_ID)
+ {
+ int AD_User_ID = Env.getAD_User_ID(ctx);
+ String sql = "SELECT * FROM AD_UserQuery "
+ + "WHERE AD_Client_ID=? AND AD_Tab_ID=? AND IsActive='Y' "
+ + "AND AD_User_ID in (0, " + AD_User_ID + ") "
+ + "ORDER BY Name";
+ int AD_Client_ID = Env.getAD_Client_ID (ctx);
+ ArrayList list = new ArrayList();
+ PreparedStatement pstmt = null;
+ try
+ {
+ pstmt = DB.prepareStatement (sql, null);
+ pstmt.setInt (1, AD_Client_ID);
+ pstmt.setInt (2, AD_Tab_ID);
+ ResultSet rs = pstmt.executeQuery();
+ while (rs.next ())
+ list.add(new MUserQuery (ctx, rs, null));
+ rs.close ();
+ pstmt.close ();
+ pstmt = null;
+ }
+ catch (Exception e)
+ {
+ s_log.log (Level.SEVERE, sql, e);
+ }
+ try
+ {
+ if (pstmt != null)
+ pstmt.close ();
+ pstmt = null;
+ }
+ catch (Exception e)
+ {
+ pstmt = null;
+ }
+ MUserQuery[] retValue = new MUserQuery[list.size()];
+ list.toArray(retValue);
+ return retValue;
+ } // get
+
+ /**
+ * Get Specific Tab Query
+ * @param ctx context
+ * @param AD_Tab_ID tab
+ * @param name name
+ * @return query or null
+ */
+ public static MUserQuery get (Properties ctx, int AD_Tab_ID, String name)
+ {
+ int AD_User_ID = Env.getAD_User_ID(ctx);
+ String sql = "SELECT * FROM AD_UserQuery "
+ + "WHERE AD_Client_ID=? AND AD_Tab_ID=? AND UPPER(Name) LIKE ? AND IsActive='Y' "
+ + "AND AD_User_ID in (0, " + AD_User_ID + ") "
+ + "ORDER BY Name";
+ int AD_Client_ID = Env.getAD_Client_ID (ctx);
+ if (name == null)
+ name = "%";
+ MUserQuery retValue = null;
+ PreparedStatement pstmt = null;
+ try
+ {
+ pstmt = DB.prepareStatement (sql, null);
+ pstmt.setInt (1, AD_Client_ID);
+ pstmt.setInt (2, AD_Tab_ID);
+ pstmt.setString (3, name.toUpperCase());
+ ResultSet rs = pstmt.executeQuery ();
+ if (rs.next ())
+ retValue = new MUserQuery (ctx, rs, null);
+ rs.close ();
+ pstmt.close ();
+ pstmt = null;
+ }
+ catch (Exception e)
+ {
+ s_log.log (Level.SEVERE, sql, e);
+ }
+ try
+ {
+ if (pstmt != null)
+ pstmt.close ();
+ pstmt = null;
+ }
+ catch (Exception e)
+ {
+ pstmt = null;
+ }
+ return retValue;
+ } // get
+
+ /** Logger */
+ private static CLogger s_log = CLogger.getCLogger (MUserQuery.class);
+
+ /**************************************************************************
+ * Standard Constructor
+ * @param ctx context
+ * @param AD_UserQuery_ID id
+ * @param trxName trx
+ */
+ public MUserQuery(Properties ctx, int AD_UserQuery_ID, String trxName)
+ {
+ super (ctx, AD_UserQuery_ID, trxName);
+ } // MUserQuery
+
+ /**
+ * Load Constructor
+ * @param ctx context
+ * @param rs result set
+ * @param trxName trx
+ */
+ public MUserQuery(Properties ctx, ResultSet rs, String trxName)
+ {
+ super (ctx, rs, trxName);
+ } // MUserQuery
+
+} // MUserQuery
diff --git a/base/src/org/compiere/model/X_AD_UserQuery.java b/base/src/org/compiere/model/X_AD_UserQuery.java
index b967354c88..ef3ed295f0 100644
--- a/base/src/org/compiere/model/X_AD_UserQuery.java
+++ b/base/src/org/compiere/model/X_AD_UserQuery.java
@@ -87,7 +87,25 @@ public class X_AD_UserQuery extends PO implements I_AD_UserQuery, I_Persistent
throw e;
}
return result;
- }
+ }
+
+ /** Set Tab.
+ @param AD_Tab_ID Tab within a Window */
+ public void setAD_Tab_ID (int AD_Tab_ID)
+ {
+ if (AD_Tab_ID <= 0) set_Value ("AD_Tab_ID", null);
+ else
+ set_Value ("AD_Tab_ID", new Integer(AD_Tab_ID));
+ }
+
+ /** Get Tab.
+ @return Tab within a Window */
+ public int getAD_Tab_ID()
+ {
+ Integer ii = (Integer)get_Value("AD_Tab_ID");
+ if (ii == null) return 0;
+ return ii.intValue();
+ }
/** Set Table.
@param AD_Table_ID