| com.sun.rave.faces.data.RowSetDataModel
All known Subclasses: com.sun.jsfcl.data.RowSetDataModel,
RowSetDataModel | public class RowSetDataModel extends DataModel (Code) | | Runtime implementation of javax.faces.model.DataModel
that caches retrieved database data in memory (in a session scope
attribute of type DataCache ), even when the underlying
rowset is closed.
author: craigmcc |
Method Summary | |
public void | clear() Clear any cached row-specific data. | public void | commit() Push any deleted or updated cached rows to the specified table,
then call commit() on the JDBC Connection
underlying our current RowSet , as well as our associated
DataCache . | public void | execute() Clear any cached data, then re-execute the
query for the rowset we are connected to. | public DataCache | getDataCache() | public String | getDataCacheKey() Return the session attribute key under which our
DataCache instance will be stored. | public int | getRowCount() | public Object | getRowData() Return a Map representing the column values for
the row specified by the current rowIndex . | public int | getRowIndex() | public RowSet | getRowSet() Return the RowSet we are connected with,
if any; otherwise, return null . | public String | getSchemaName() | public String | getTableName() | public Object | getWrappedData() | public boolean | isRowAvailable() | public void | reset() Reset any deleted or updated values in the cache, so that any cached
rows no longer appear to have been modified. | public void | rollback() | public void | setDataCacheKey(String dataCacheKey) Set the session attribute key under which our
DataCache instance will be stored. | public void | setObject(int index, Object value) Set the designated parameter on the RowSet to which
we are connected. | public void | setObject(int index, Object value, int type) Set the designated parameter on the RowSet to which
we are connected. | public void | setObject(int index, Object value, int type, int scale) Set the designated parameter on the RowSet to which
we are connected. | public void | setRowIndex(int rowIndex) Set the zero relative index for the newly positioned row, or
set to -1 for no currently selected row. | public void | setRowSet(RowSet rowSet) Set the RowSet we are connected with,
or pass null to disconnect. | public void | setSchemaName(String schemaName) | public void | setTableName(String tableName) | public void | setWrappedData(Object rowSet) |
RowSetDataModel | public RowSetDataModel()(Code) | | Create a new
RowSetDataModel instance not connected to
any underlying RowSet .
|
RowSetDataModel | public RowSetDataModel(RowSet rowSet)(Code) | | Create a new
RowSetDataModel instance wrapping the
specified RowSet .
Parameters: rowSet - RowSet to be mapped |
clear | public void clear()(Code) | | Clear any cached row-specific data. This method may be called by
application logic when it is known that the next page to be processed
will not involve the RowSet we are connected to, or
when the application wants to refresh the cached data to reflect
any changes on the underlying database contents.
NOTE - Calling execute() on this
RowSetDataModel will implicitly call clear()
for you.
|
commit | public void commit() throws SQLException(Code) | | Push any deleted or updated cached rows to the specified table,
then call commit() on the JDBC Connection
underlying our current RowSet , as well as our associated
DataCache . If any SQLException occurs, call
rollback() on the Connection() and
reset() on the DataCache .
exception: IllegalArgumentException - if the tableName property has not yet been set exception: IllegalStateException - if this method is called whennot connected to an underlying rowset exception: SQLException - if an error occurs while committing |
execute | public void execute() throws SQLException(Code) | | Clear any cached data, then re-execute the
query for the rowset we are connected to. WARNING -
this method should ONLY be called when you
have changed the query parameters for your query, or your
application has performed other database transaction(s) on a
different page that should be reflected in the query results.
exception: IllegalStateException - if this method is called whennot connected to an underlying rowset exception: SQLException - if an error occurs executing the rowset |
getDataCache | public DataCache getDataCache()(Code) | | Return the
DataCache containing our cached row and
column data, creating one if necessary.
|
getDataCacheKey | public String getDataCacheKey()(Code) | | Return the session attribute key under which our
DataCache instance will be stored.
|
getRowCount | public int getRowCount()(Code) | | Return -1 to indicate that the number of rows available is
unknown.
|
getRowData | public Object getRowData()(Code) | | Return a Map representing the column values for
the row specified by the current rowIndex . The
returned Map supports case-insensitive matching on column names,
and records any updates to the column values for later transfer
to the database when commit() is called. It does
not allow column names (and corresponding values) to be added
or removed.
exception: IllegalArgumentException - if there is no cacheddata for the current rowIndex |
getRowIndex | public int getRowIndex()(Code) | | Return the zero-relative index of the currently positioned row,
or -1 if we are not positioned on a row.
|
getRowSet | public RowSet getRowSet()(Code) | | Return the RowSet we are connected with,
if any; otherwise, return null . This is a
type=safe alias for getWrappedData() .
|
getSchemaName | public String getSchemaName()(Code) | | Return the name of the database schema containing the table
we will update when commit() is called.
|
getTableName | public String getTableName()(Code) | | Return the name of the database table we will update when
commit() is called.
|
getWrappedData | public Object getWrappedData()(Code) | | Return the RowSet we are currently wrapping,
if any.
|
isRowAvailable | public boolean isRowAvailable()(Code) | | Return true if there is a cache entry for the
current rowIndex value.
|
reset | public void reset()(Code) | | Reset any deleted or updated values in the cache, so that any cached
rows no longer appear to have been modified. This method has no
effect on the connected rowset (if any).
|
rollback | public void rollback() throws SQLException(Code) | | Reset any deleted or updated values in the cache (as is done by
the reset() method), then call rollback()
on the JDBC Connectino underlying our current
RowSet .
exception: IllegalStateException - if this method is called whennot connected to an underlying rowset exception: SQLException - if an error occurs while committing |
setDataCacheKey | public void setDataCacheKey(String dataCacheKey)(Code) | | Set the session attribute key under which our
DataCache instance will be stored.
Parameters: dataCacheKey - The new key |
setObject | public void setObject(int index, Object value) throws SQLException(Code) | | Set the designated parameter on the RowSet to which
we are connected. This parameter will have no effect on any currently
selected rows; it takes effect the next time you call
execute().
Parameters: index - One-relative parameter index Parameters: value - Value to be set exception: IllegalStateException - if this method is called whennot connected to an underlying rowset exception: SQLException - if an error occurs setting the parameter value |
setObject | public void setObject(int index, Object value, int type) throws SQLException(Code) | | Set the designated parameter on the RowSet to which
we are connected. This parameter will have no effect on any currently
selected rows; it takes effect the next time you call
execute().
Parameters: index - One-relative parameter index Parameters: value - Value to be set Parameters: type - Destination SQL type (as defined in java.sql.Types ) exception: IllegalStateException - if this method is called whennot connected to an underlying rowset exception: SQLException - if an error occurs setting the parameter value |
setObject | public void setObject(int index, Object value, int type, int scale) throws SQLException(Code) | | Set the designated parameter on the RowSet to which
we are connected. This parameter will have no effect on any currently
selected rows; it takes effect the next time you call
execute().
Parameters: index - One-relative parameter index Parameters: value - Value to be set Parameters: type - Destination SQL type (as defined in java.sql.Types ) Parameters: scale - For java.sql.Types.DECIMAL orjava.sql.Types.NUMERIC types, the number of digitsafter the decimal point (ignored for all other types) exception: IllegalStateException - if this method is called whennot connected to an underlying rowset exception: SQLException - if an error occurs setting the parameter value |
setRowIndex | public void setRowIndex(int rowIndex)(Code) | | Set the zero relative index for the newly positioned row, or
set to -1 for no currently selected row. If there is no current
cache entry for this row, but we are currently connected, position
the underlying RowSet to the corresponding one-relative
row number, and create a new cache entry. In addition, fire a
DataModelEvent if needed, per the Javadocs for
this method on javax.faces.model.DataModel .
Parameters: rowIndex - The row index, or -1 for no selected row exception: FacesException - if an error occurs setting the row index exception: IllegalArgumentException - if rowIndex is less than -1 |
setRowSet | public void setRowSet(RowSet rowSet)(Code) | | Set the RowSet we are connected with,
or pass null to disconnect. This is a
type-safe alias for setWrappedData() .
Parameters: rowSet - The RowSet we are connected to,or null to disconnect |
setSchemaName | public void setSchemaName(String schemaName)(Code) | | Set the name of the database schema containing the table
we will update when commit() is called.
Parameters: schemaName - The schema name to be updated |
setTableName | public void setTableName(String tableName)(Code) | | Set the name of the database table we will update when
commit() is called.
Parameters: tableName - The table name to be updated |
setWrappedData | public void setWrappedData(Object rowSet)(Code) | | Set the RowSet wrapped by this
RowSetDataModel , or null to disconnect
from the previously connected RowSet .
Parameters: rowSet - RowSet to be wrapped, or null to disconnect exception: ClassCastException - if this object is not of thecorrect type |
|
|