org.objectweb.telosys.common.data
Class DataSet

java.lang.Object
  extended byorg.objectweb.telosys.common.TelosysObject
      extended byorg.objectweb.telosys.common.data.DataSet
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
UpdatableDataSet

public abstract class DataSet
extends TelosysObject
implements java.io.Serializable

See Also:
Serialized Form

Constructor Summary
DataSet()
           
 
Method Summary
protected  int addRow()
          Adds a new void DataRow at the end of the DataSet
protected  int addRow(DataRow dataRow)
          Adds a DataRow at the end of the DataSet
 boolean getBoolean(int iRow, int iCol)
           
 byte getByte(int iRow, int iCol)
           
 DataRow getDataRow(int iRow)
           
 java.util.Date getDate(int iRow, int iCol)
           
 double getDouble(int iRow, int iCol)
           
 float getFloat(int iRow, int iCol)
           
 int getInt(int iRow, int iCol)
           
 long getLong(int iRow, int iCol)
           
 java.lang.Object getObject(int iRow, int iCol)
           
 int getRowCount()
          Returns the number of rows
 short getShort(int iRow, int iCol)
           
 int getSortColumn()
          Returns the column used as current sort criteria
 java.sql.Date getSqlDate(int iRow, int iCol)
           
 java.lang.String getString(int iRow, int iCol)
           
 java.lang.String getString(int iRow, int iCol, java.lang.String sNullValue)
           
protected  void initBeforeLoad()
          Data set initialization, must be called by subclasses before each load
 boolean isEmpty()
          Returns 'true' if the DataSet is empty.
 boolean isSortedBy(int iCol)
          Returns true if the DataSet is currently sorted by the given column
 boolean isSortedInAscendingOrder()
          Returns true if the DataSet is currently sorted in ascending order
 boolean isSortedInDescendingOrder()
          Returns true if the DataSet is currently sorted in descending order
 java.util.Iterator iterator()
          Returns an iterator over the 'datarows' in this DataSet
abstract  int load()
          Loads the DataSet using its definition
abstract  int load(java.lang.Object obj)
          Loads the DataSet using its definition and the given object
protected  DataRow replaceRow(int iRow, DataRow dataRow)
          Replaces the DataRow at the given position by a new one
 void sort(int iCol)
          Sort the DataSet using the given column as criteria (case sensitive) in ascending order
 void sort(int iCol, java.lang.String sOrder)
          Sort the DataSet using the given column as criteria (case sensitive) and the specified order ( ascending or descending )
 void sortIgnoreCase(int iCol)
          Sort the DataSet using the given column as criteria ( ignoring case ) in ascending order
 void sortIgnoreCase(int iCol, java.lang.String sOrder)
          Sort the DataSet using the given field as criteria ( ignoring case )
and the specified order ( ascending or descending )
 
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

DataSet

public DataSet()
Method Detail

initBeforeLoad

protected void initBeforeLoad()
Data set initialization, must be called by subclasses before each load


replaceRow

protected DataRow replaceRow(int iRow,
                             DataRow dataRow)
Replaces the DataRow at the given position by a new one

Parameters:
iRow - index of row to replace ( 1 to N )
dataRow - the DataRow to be stored at the specified position
Returns:
the DataRow previously at the specified position

addRow

protected int addRow(DataRow dataRow)
Adds a DataRow at the end of the DataSet

Parameters:
dataRow - the DataRow to add
Returns:

addRow

protected int addRow()
Adds a new void DataRow at the end of the DataSet

Returns:

load

public abstract int load()
                  throws java.lang.Exception
Loads the DataSet using its definition

Returns:
Throws:
java.lang.Exception

load

public abstract int load(java.lang.Object obj)
                  throws java.lang.Exception
Loads the DataSet using its definition and the given object

Parameters:
obj - useful parameter for the load operation ( cannot be null )
e.g. with SQLDataSet : Connection, DatabaseSession, ...
Returns:
Throws:
java.lang.Exception

getRowCount

public int getRowCount()
Returns the number of rows

Returns:

isEmpty

public boolean isEmpty()
Returns 'true' if the DataSet is empty.

Returns:

iterator

public java.util.Iterator iterator()
Returns an iterator over the 'datarows' in this DataSet

Returns:

getDataRow

public DataRow getDataRow(int iRow)

getObject

public java.lang.Object getObject(int iRow,
                                  int iCol)

getString

public java.lang.String getString(int iRow,
                                  int iCol)

getString

public java.lang.String getString(int iRow,
                                  int iCol,
                                  java.lang.String sNullValue)

getDate

public java.util.Date getDate(int iRow,
                              int iCol)

getSqlDate

public java.sql.Date getSqlDate(int iRow,
                                int iCol)

getBoolean

public boolean getBoolean(int iRow,
                          int iCol)

getByte

public byte getByte(int iRow,
                    int iCol)

getInt

public int getInt(int iRow,
                  int iCol)

getShort

public short getShort(int iRow,
                      int iCol)

getLong

public long getLong(int iRow,
                    int iCol)

getFloat

public float getFloat(int iRow,
                      int iCol)

getDouble

public double getDouble(int iRow,
                        int iCol)

getSortColumn

public int getSortColumn()
Returns the column used as current sort criteria

Returns:
: column number, or -1 if the DataSet is not sorted

isSortedBy

public boolean isSortedBy(int iCol)
Returns true if the DataSet is currently sorted by the given column

Parameters:
iCol -
Returns:

isSortedInAscendingOrder

public boolean isSortedInAscendingOrder()
Returns true if the DataSet is currently sorted in ascending order

Returns:

isSortedInDescendingOrder

public boolean isSortedInDescendingOrder()
Returns true if the DataSet is currently sorted in descending order

Returns:

sort

public void sort(int iCol)
Sort the DataSet using the given column as criteria (case sensitive) in ascending order

Parameters:
iCol -

sort

public void sort(int iCol,
                 java.lang.String sOrder)
Sort the DataSet using the given column as criteria (case sensitive) and the specified order ( ascending or descending )

Parameters:
iCol -
sOrder - ( "asc" or "desc" )

sortIgnoreCase

public void sortIgnoreCase(int iCol)
Sort the DataSet using the given column as criteria ( ignoring case ) in ascending order

Parameters:
iCol -

sortIgnoreCase

public void sortIgnoreCase(int iCol,
                           java.lang.String sOrder)
Sort the DataSet using the given field as criteria ( ignoring case )
and the specified order ( ascending or descending )

Parameters:
iCol -
sOrder - ( "asc" or "desc" )