java.lang.Objectorg.objectweb.telosys.common.TelosysObject
org.objectweb.telosys.common.data.DataSet
The abstract DataSet class
A DataSet is set of DataRows whith the same number of cells in each row
It's a kind of grid that can be accessed by row or by cell coordinates (X,Y)
A DataSet can be sorted by column
Implemented by SQLDataSet, MemDataSet, ...
Constructor Summary | |
DataSet()
Constructs a new void 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)
Returns the boolean value located at the given cell coordinates |
byte |
getByte(int iRow,
int iCol)
Returns the byte value located at the given cell coordinates |
DataRow |
getDataRow(int iRow)
Returns the DataRow located at the given index |
java.util.Date |
getDate(int iRow,
int iCol)
Returns the java.util.Date located at the given cell coordinates |
double |
getDouble(int iRow,
int iCol)
Returns the double value located at the given cell coordinates |
float |
getFloat(int iRow,
int iCol)
Returns the float value located at the given cell coordinates |
int |
getInt(int iRow,
int iCol)
Returns the int value located at the given cell coordinates |
long |
getLong(int iRow,
int iCol)
Returns the long value located at the given cell coordinates |
java.lang.Object |
getObject(int iRow,
int iCol)
Returns the object located at the given cell coordinates |
int |
getRowCount()
Returns the number of rows |
short |
getShort(int iRow,
int iCol)
Returns the short value located at the given cell coordinates |
int |
getSortColumn()
Returns the column used as current sort criteria |
java.sql.Date |
getSqlDate(int iRow,
int iCol)
Returns the java.sql.Date located at the given cell coordinates |
java.lang.String |
getString(int iRow,
int iCol)
Returns the String located at the given cell coordinates |
java.lang.String |
getString(int iRow,
int iCol,
java.lang.String sNullValue)
Returns the String located at the given cell coordinates with a default value |
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 |
public DataSet()
Method Detail |
protected void initBeforeLoad()
protected DataRow replaceRow(int iRow, DataRow dataRow)
iRow
- index of row to replace ( 1 to N )dataRow
- the DataRow to be stored at the specified position
protected int addRow(DataRow dataRow)
dataRow
- the DataRow to add
protected int addRow()
public abstract int load() throws java.lang.Exception
java.lang.Exception
public abstract int load(java.lang.Object obj) throws java.lang.Exception
obj
- useful parameter for the load operation ( cannot be null )java.lang.Exception
public int getRowCount()
public boolean isEmpty()
public java.util.Iterator iterator()
public DataRow getDataRow(int iRow)
iRow
- the row index ( 1 to N )
public java.lang.Object getObject(int iRow, int iCol)
iRow
- row index ( 1 to N )iCol
- column index ( 1 to N )
TelosysRuntimeException
- if invalid column indexpublic java.lang.String getString(int iRow, int iCol)
iRow
- row index ( 1 to N )iCol
- column index ( 1 to N )
TelosysRuntimeException
- if invalid column indexpublic java.lang.String getString(int iRow, int iCol, java.lang.String sNullValue)
iRow
- row index ( 1 to N )iCol
- column index ( 1 to N )sNullValue
-
TelosysRuntimeException
- if invalid column indexpublic java.util.Date getDate(int iRow, int iCol)
iRow
- iRow row index ( 1 to N )iCol
- iCol column index ( 1 to N )
TelosysRuntimeException
- if invalid column indexpublic java.sql.Date getSqlDate(int iRow, int iCol)
iRow
- iRow row index ( 1 to N )iCol
- iCol column index ( 1 to N )
TelosysRuntimeException
- if invalid column indexpublic boolean getBoolean(int iRow, int iCol)
iRow
- iRow row index ( 1 to N )iCol
- iCol column index ( 1 to N )
public byte getByte(int iRow, int iCol)
iRow
- iRow row index ( 1 to N )iCol
- iCol column index ( 1 to N )
public int getInt(int iRow, int iCol)
iRow
- iRow row index ( 1 to N )iCol
- iCol column index ( 1 to N )
public short getShort(int iRow, int iCol)
iRow
- iRow row index ( 1 to N )iCol
- iCol column index ( 1 to N )
public long getLong(int iRow, int iCol)
iRow
- iRow row index ( 1 to N )iCol
- iCol column index ( 1 to N )
public float getFloat(int iRow, int iCol)
iRow
- iRow row index ( 1 to N )iCol
- iCol column index ( 1 to N )
public double getDouble(int iRow, int iCol)
iRow
- iRow row index ( 1 to N )iCol
- iCol column index ( 1 to N )
public int getSortColumn()
public boolean isSortedBy(int iCol)
iCol
-
public boolean isSortedInAscendingOrder()
public boolean isSortedInDescendingOrder()
public void sort(int iCol)
iCol
- public void sort(int iCol, java.lang.String sOrder)
iCol
- sOrder
- ( "asc" or "desc" )public void sortIgnoreCase(int iCol)
iCol
- public void sortIgnoreCase(int iCol, java.lang.String sOrder)
iCol
- sOrder
- ( "asc" or "desc" )