org.objectweb.telosys.dal.dataset
Class SQLDataSet

java.lang.Object
  extended byorg.objectweb.telosys.common.TelosysObject
      extended byorg.objectweb.telosys.common.data.DataSet
          extended byorg.objectweb.telosys.common.data.UpdatableDataSet
              extended byorg.objectweb.telosys.dal.dataset.SQLDataSet
All Implemented Interfaces:
java.io.Serializable

public class SQLDataSet
extends UpdatableDataSet

DataSet designed to be loaded with a SQL request

See Also:
Serialized Form

Constructor Summary
SQLDataSet(SQLDataSetDefinition def)
          Creates a new SQLDataSet using the given definition
SQLDataSet(SQLDataSetDefinition def, Criteria crit)
          Creates a new SQLDataSet using the given definition and the given dynamic criterias
SQLDataSet(SQLDataSetDefinition def, java.lang.String[] paramValues)
          Creates a new SQLDataSet using the given definition and the given parameters values
 
Method Summary
 int count()
          Returns the number of lines corresponding to the WHERE parameters
(just count with SELECT COUNT, the lines are not loaded in the DataSet)
 boolean endOfResultSet()
          Indicates if the last line of the ResultSet is loaded in the DataSet
This method is significant only after a load() or loadPage()
 java.lang.String getSqlRequest()
          Returns the SQL request used to load the DataSet
 int load()
          Loads the DataSet using its definition
 int load(java.lang.Object obj)
          Loads the DataSet using its definition and the given object
 int loadPage(int iPage)
          Load a given page (set of rows) using the LinesPerPage parameter of the definition
IE : with 10 lines per page ...
 
Methods inherited from class org.objectweb.telosys.common.data.UpdatableDataSet
addRow, addRow, replaceObject, replaceRow
 
Methods inherited from class org.objectweb.telosys.common.data.DataSet
getBoolean, getByte, getDataRow, getDate, getDouble, getFloat, getInt, getLong, getObject, getRowCount, getShort, getSortColumn, getSqlDate, getString, getString, initBeforeLoad, isEmpty, isSortedBy, isSortedInAscendingOrder, isSortedInDescendingOrder, iterator, sort, sort, sortIgnoreCase, sortIgnoreCase
 
Methods inherited from class org.objectweb.telosys.common.TelosysObject
error, error, error, getFlagTrace, info, setFlagTrace, trace, warn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SQLDataSet

public SQLDataSet(SQLDataSetDefinition def)
           throws TelosysException
Creates a new SQLDataSet using the given definition

Parameters:
def - the DataSet definition without parameter
Throws:
TelosysException

SQLDataSet

public SQLDataSet(SQLDataSetDefinition def,
                  java.lang.String[] paramValues)
           throws TelosysException
Creates a new SQLDataSet using the given definition and the given parameters values

Parameters:
def - the DataSet definition with parameters
paramValues - array of parameters values
Throws:
TelosysException

SQLDataSet

public SQLDataSet(SQLDataSetDefinition def,
                  Criteria crit)
           throws TelosysException
Creates a new SQLDataSet using the given definition and the given dynamic criterias

Parameters:
def - the DataSet definition without parameter
crit - the dynamic criterias
Throws:
TelosysException
Method Detail

getSqlRequest

public java.lang.String getSqlRequest()
Returns the SQL request used to load the DataSet

Returns:

load

public int load()
         throws TelosysException
Description copied from class: DataSet
Loads the DataSet using its definition

Specified by:
load in class DataSet
Returns:
Throws:
TelosysException

load

public int load(java.lang.Object obj)
         throws TelosysException
Description copied from class: DataSet
Loads the DataSet using its definition and the given object

Specified by:
load in class DataSet
Parameters:
obj - useful parameter for the load operation ( cannot be null )
e.g. with SQLDataSet : Connection, DatabaseSession, ...
Returns:
Throws:
TelosysException

loadPage

public int loadPage(int iPage)
             throws TelosysException
Load a given page (set of rows) using the LinesPerPage parameter of the definition
IE : with 10 lines per page ...
loadPage(1) will load lines 1 to 10
loadPage(2) will load lines 11 to 20

Parameters:
iPage - the page number (from 1 to N)
Returns:
the number of lines loaded ( 0 to LinesPerPage )
Throws:
TelosysException - ( if the page number is < 0 )

endOfResultSet

public boolean endOfResultSet()
Indicates if the last line of the ResultSet is loaded in the DataSet
This method is significant only after a load() or loadPage()

Returns:
true if the end of the ResultSet was reached, else false

count

public int count()
          throws TelosysException
Returns the number of lines corresponding to the WHERE parameters
(just count with SELECT COUNT, the lines are not loaded in the DataSet)

Returns:
the count value
Throws:
TelosysException