com.knowgate.hipergate
Class RecentlyUsed

java.lang.Object
  extended by com.knowgate.hipergate.RecentlyUsed

public class RecentlyUsed
extends java.lang.Object

Generic list of recently used items held at a database table


Constructor Summary
RecentlyUsed(java.lang.String sBaseTable, int iListSize, java.lang.String sPrimaryKey, java.lang.String sFilterField)
          Open access to a recently used list.
 
Method Summary
 void add(JDCConnection oConn, DBPersist oItem)
          Add item to the list If list has reached its maximum allowed size then the oldest item is removed before inserting the new one
 void clear(JDCConnection oConn, java.lang.Object oFilterValue)
          Clear recently used list
 DBSubset list(JDCConnection oConn, java.lang.Object oFilterValue)
          Get list items Items are returned ordered by last use.
 int listSize(JDCConnection oConn, java.lang.Object oFilterValue)
          Current list size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RecentlyUsed

public RecentlyUsed(java.lang.String sBaseTable,
                    int iListSize,
                    java.lang.String sPrimaryKey,
                    java.lang.String sFilterField)

Open access to a recently used list.

Example: new RecentlyUsed ("k_companies_recent", 10, "gu_company", "gu_user")

Parameters:
sBaseTable - Name of database table that holds all instances of list class
iListSize - Maximum items per distinct list
sPrimaryKey - Primary key of the items at each list
sFilterField - Field used for filtering items from an specific list
Method Detail

clear

public void clear(JDCConnection oConn,
                  java.lang.Object oFilterValue)
           throws java.sql.SQLException
Clear recently used list

Parameters:
oConn - JDBC Database Connection
oFilterValue - Value for field used for filtering items from this list
Throws:
java.sql.SQLException

listSize

public int listSize(JDCConnection oConn,
                    java.lang.Object oFilterValue)
             throws java.sql.SQLException
Current list size

Parameters:
oConn - JDBC Database connection
oFilterValue - Value for field used for filtering items from this list
Returns:
Number of items in list
Throws:
java.sql.SQLException

list

public DBSubset list(JDCConnection oConn,
                     java.lang.Object oFilterValue)
              throws java.sql.SQLException

Get list items

Items are returned ordered by last use. First the most recently used one.

Parameters:
oConn - JDBC Database Connection
oFilterValue - Value for field used for filtering items from this list
Returns:
List items as a DBSubset
Throws:
java.sql.SQLException

add

public void add(JDCConnection oConn,
                DBPersist oItem)
         throws java.sql.SQLException

Add item to the list

If list has reached its maximum allowed size then the oldest item is removed before inserting the new one

Parameters:
oConn - JDBC Database Connection
oItem - DBPersist instance containing all neccessary values for the inserted item except the access date.
Throws:
java.sql.SQLException