org.paneris.jal.model
Class RecordSet

java.lang.Object
  extended by org.paneris.jal.model.RecordSet

public class RecordSet
extends java.lang.Object

A RecordSet provides functionality that allows you to navigate a set of results.

It does this by storing itself in the session so that it can be navigated

For this reason, the constructors are private, and you will be expected to always get the RecordsSet using getInstance();

If you want to force the creation of a new record set, ensure that the context contains a "submit" form value. (inplying that a new search has been run.)

usage example: RecordSet set = RecordSet.getInstance(context, db, table, sqlString, null); context.put("navigation", set); for (Enumeration enum = set.getNext(); enum.hasMoreElements();) { Integer id = (Integer) enum.nextElement(); body.addElement(new DDRecord(db,table,id)); }


Field Summary
 java.lang.String database
           
 DataCache dataCache
           
protected static boolean debug
           
 int increment
           
 java.lang.String sqlString
           
 
Constructor Summary
RecordSet(java.lang.String db, java.lang.String table, java.sql.PreparedStatement sqlStatement, java.lang.Integer inc)
          Private Constructor to build a RecordSet given a prepared statement nb this method does not set a max limit of the records returned.
RecordSet(java.lang.String db, java.lang.String table, java.lang.String sql, java.lang.Integer inc)
          Private Constructor to build a RecordSet given an sql string.
RecordSet(java.lang.String db, java.lang.String table, UniqueVector results, java.lang.Integer inc)
          Constructor to build a RecordSet given a vector of id's of results.
 
Method Summary
 void addElement(java.lang.Integer id)
           
 void buildSet(java.lang.String db, java.lang.String table, java.sql.PreparedStatement sqlStatement, java.lang.Integer inc)
           
 void doNavigation(org.webmacro.servlet.WebContext context)
           
 int getCurrentRecord()
           
 int getDisplayCurrentRecord()
           
 boolean getEnd()
           
 int getIncrement()
           
static RecordSet getInstance(org.webmacro.servlet.WebContext context, java.lang.String identifier)
          Returns the single instance, or null it can't be found (or has changed) the RecordSet is referenced in the session by the identifier
static RecordSet getInstance(org.webmacro.servlet.WebContext context, java.lang.String db, java.lang.String table, java.sql.PreparedStatement sql, java.lang.Integer inc, java.lang.String identifier)
          Returns the single instance, creating one if it can't be found (or has changed) set the increment to null, in order to have it defaulted for this table the RecordSet is referenced in the session by the identifier
static RecordSet getInstance(org.webmacro.servlet.WebContext context, java.lang.String db, java.lang.String table, java.lang.String sql, java.lang.Integer inc)
          copes with situations where no identifier is specified (should be marked as depreciated)
static RecordSet getInstance(org.webmacro.servlet.WebContext context, java.lang.String db, java.lang.String table, java.lang.String sql, java.lang.Integer inc, java.lang.String identifier)
          Returns the single instance, creating one if it can't be found (or has changed) set the increment to null, in order to have it defaulted for this table the RecordSet is referenced in the session by the identifier
static RecordSet getInstance(org.webmacro.servlet.WebContext context, java.lang.String db, java.lang.String table, UniqueVector results, java.lang.Integer inc)
          Returns the single instance, creating one if it can't be found (or has changed) use this method if you have pre-built your results (ie a simple sql string does not provide enough flexability).
 boolean getLimited()
           
 int getMaxRecord()
           
 TableMetaData getMetaData()
           
 java.util.Enumeration getNext()
           
 int getPage()
           
 int getPages()
           
 DDRecord getRecord(java.lang.String database, java.lang.String table, java.lang.Integer id)
           
 java.util.Vector getRows()
           
 int getSize()
           
 java.lang.String getSqlString()
           
 boolean getStart()
           
 java.util.Hashtable getState()
           
 void loadData()
           
 void moveNext()
           
 void movePrevious()
           
 boolean removeID(java.lang.Integer id)
           
 void setCurrentRecord(int i)
           
 void setIgnoreDeleted(boolean del)
          set the ignore deleted flag
 void setMaxRecord(int a)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

protected static final boolean debug
See Also:
Constant Field Values

database

public java.lang.String database

sqlString

public java.lang.String sqlString

increment

public int increment

dataCache

public DataCache dataCache
Constructor Detail

RecordSet

public RecordSet(java.lang.String db,
                 java.lang.String table,
                 java.lang.String sql,
                 java.lang.Integer inc)
          throws java.lang.Exception
Private Constructor to build a RecordSet given an sql string.

Throws:
java.lang.Exception

RecordSet

public RecordSet(java.lang.String db,
                 java.lang.String table,
                 UniqueVector results,
                 java.lang.Integer inc)
          throws java.lang.Exception
Constructor to build a RecordSet given a vector of id's of results.

Throws:
java.lang.Exception

RecordSet

public RecordSet(java.lang.String db,
                 java.lang.String table,
                 java.sql.PreparedStatement sqlStatement,
                 java.lang.Integer inc)
          throws java.lang.Exception
Private Constructor to build a RecordSet given a prepared statement nb this method does not set a max limit of the records returned.

Throws:
java.lang.Exception
Method Detail

buildSet

public void buildSet(java.lang.String db,
                     java.lang.String table,
                     java.sql.PreparedStatement sqlStatement,
                     java.lang.Integer inc)
              throws java.lang.Exception
Throws:
java.lang.Exception

getInstance

public static RecordSet getInstance(org.webmacro.servlet.WebContext context,
                                    java.lang.String db,
                                    java.lang.String table,
                                    UniqueVector results,
                                    java.lang.Integer inc)
                             throws java.lang.Exception
Returns the single instance, creating one if it can't be found (or has changed) use this method if you have pre-built your results (ie a simple sql string does not provide enough flexability). set the increment to null, in order to have it defaulted for this table

Throws:
java.lang.Exception

getInstance

public static RecordSet getInstance(org.webmacro.servlet.WebContext context,
                                    java.lang.String db,
                                    java.lang.String table,
                                    java.lang.String sql,
                                    java.lang.Integer inc,
                                    java.lang.String identifier)
                             throws java.lang.Exception
Returns the single instance, creating one if it can't be found (or has changed) set the increment to null, in order to have it defaulted for this table the RecordSet is referenced in the session by the identifier

Throws:
java.lang.Exception

getInstance

public static RecordSet getInstance(org.webmacro.servlet.WebContext context,
                                    java.lang.String db,
                                    java.lang.String table,
                                    java.sql.PreparedStatement sql,
                                    java.lang.Integer inc,
                                    java.lang.String identifier)
                             throws java.lang.Exception
Returns the single instance, creating one if it can't be found (or has changed) set the increment to null, in order to have it defaulted for this table the RecordSet is referenced in the session by the identifier

Throws:
java.lang.Exception

getInstance

public static RecordSet getInstance(org.webmacro.servlet.WebContext context,
                                    java.lang.String db,
                                    java.lang.String table,
                                    java.lang.String sql,
                                    java.lang.Integer inc)
                             throws java.lang.Exception
copes with situations where no identifier is specified (should be marked as depreciated)

Throws:
java.lang.Exception

setIgnoreDeleted

public void setIgnoreDeleted(boolean del)
set the ignore deleted flag


getInstance

public static RecordSet getInstance(org.webmacro.servlet.WebContext context,
                                    java.lang.String identifier)
                             throws java.lang.Exception
Returns the single instance, or null it can't be found (or has changed) the RecordSet is referenced in the session by the identifier

Throws:
java.lang.Exception

doNavigation

public void doNavigation(org.webmacro.servlet.WebContext context)
                  throws java.lang.Exception
Throws:
java.lang.Exception

getNext

public java.util.Enumeration getNext()
                              throws java.lang.Exception
Throws:
java.lang.Exception

getRows

public java.util.Vector getRows()
                         throws java.lang.Exception
Throws:
java.lang.Exception

loadData

public void loadData()
              throws java.lang.Exception
Throws:
java.lang.Exception

getRecord

public DDRecord getRecord(java.lang.String database,
                          java.lang.String table,
                          java.lang.Integer id)
                   throws java.lang.Exception
Throws:
java.lang.Exception

removeID

public boolean removeID(java.lang.Integer id)

addElement

public void addElement(java.lang.Integer id)

getMetaData

public TableMetaData getMetaData()

getIncrement

public int getIncrement()

getLimited

public boolean getLimited()

getSize

public int getSize()

getCurrentRecord

public int getCurrentRecord()

setCurrentRecord

public void setCurrentRecord(int i)

getDisplayCurrentRecord

public int getDisplayCurrentRecord()

getMaxRecord

public int getMaxRecord()

setMaxRecord

public void setMaxRecord(int a)

getPages

public int getPages()

getPage

public int getPage()

getSqlString

public java.lang.String getSqlString()

moveNext

public void moveNext()

movePrevious

public void movePrevious()

getStart

public boolean getStart()

getEnd

public boolean getEnd()

getState

public java.util.Hashtable getState()


Copyright © 2000-2008 PanEris. All Rights Reserved.