com.sas.storage
Class BaseDataBean

com.sas.storage.BaseDataBean
All Implemented Interfaces:
com.sas.beans.PropertyChangeSource, com.sas.beans.VetoableChangeSource, com.sas.ComponentInterface, com.sas.LinkPropertiesInterface, com.sas.ModelInterface, TableNavigationInterface, TableNavigationV2Interface, com.sas.ViewInterface, MultipleValueEventSourceInterface, java.beans.PropertyChangeListener, java.io.ObjectInputValidation, java.io.Serializable, java.util.EventListener

public abstract class BaseDataBean
implements TableNavigationV2Interface

The BaseDataBean is the parent of classes that typically are generated by the DataBean Wizard of webAF. The BaseDataBean provides a mapping between properties of the generated class to columns in the data source. It also implements the TableNavigationV2Interface so that the NavigationBar component can be used with the generated class. This means that the generated bean can provide a row of data for display in viewers while the navigation bar supports scrolling among rows. If the data source is updatable, the navigation bar will support committing changes, adding rows, and deleting rows.

The data source is a JDBC result set. The BaseDataBean provides methods from the JDBC API for working with the data. The data source is represented by a property that can be changed, as long as the new data source has at least the same columns in it as those in the generated bean. The data can be subset by setting the queryStatement property with a SQL query.

Since:
2.0
See Also:
Serialized Form

Field Summary
protected  com.sas.sasserver.datawizard.StackChecker _stackChecker
           
protected  boolean atBeginning
           
protected  boolean atEnd
           
protected  int autoCommitLevel
           
protected  boolean badState
           
protected  boolean calledFromExecuteQuery
           
protected  boolean calledFromFireAll
           
protected  boolean calledFromInit
           
protected static int CANCELSUPPORTED
           
static int COLUMNMAP_BASEDATABEAN_FUTURES
           
static int COLUMNMAP_COLUMN_INDEX
           
static int COLUMNMAP_COLUMN_NAME
           
static int COLUMNMAP_COLUMN_TYPE
           
static int COLUMNMAP_FORMATTED_PROPERTY_NAME
           
static int COLUMNMAP_PROPERTY_NAME
           
static int COLUMNMAP_USERBASE
           
protected static int COMMITSUPPORTED
           
protected  boolean commitWithUpdate
           
protected  boolean cursorValid
           
protected  boolean dataNeedsCommit
           
protected  java.sql.Connection dataSource
           
protected  boolean delayCommit
           
protected static int DELETESUPPORTED
           
protected  boolean endOfForwardOnlyResultSet
           
protected static int FIRSTSUPPORTED
           
protected  boolean initialized
           
protected static int INSERTSUPPORTED
           
protected  boolean isDesignTime
           
protected  boolean isOnInsertRow
           
protected static int LASTSUPPORTED
           
protected static int NEXTSUPPORTED
           
protected static int PAGEBACKWARDSUPPORTED
           
protected static int PAGEFORWARDSUPPORTED
           
protected  int pageSize
           
protected static int PREVIOUSSUPPORTED
           
protected  java.lang.String queryStatement
           
static java.lang.String RB_KEY
           
protected static int REFRESHSUPPORTED
           
protected  java.sql.ResultSet results
           
protected  int resultSetConcurrency
           
protected  int resultSetType
           
protected  boolean setBadState
           
protected  java.sql.Statement statement
           
protected  java.sql.SQLException statusException
           
protected  boolean[] supported
           
 
Fields inherited from interface com.sas.table.TableNavigationV2Interface
COMMITLEVEL_CELL, COMMITLEVEL_NONE, COMMITLEVEL_ROW, DEFAULT_PAGESIZE
 
Constructor Summary
BaseDataBean()
           
BaseDataBean(java.sql.Connection dataSource)
          Constructor that takes a Connection object and creates a read-only data bean.
BaseDataBean(java.sql.Connection dataSource, int resultSetConcurrency)
          Constructor that takes a Connection object and a value for result set concurrency.
BaseDataBean(java.sql.Connection dataSource, java.lang.String queryStatement)
          Constructor used to create a read-only data bean.
BaseDataBean(java.sql.Connection dataSource, java.lang.String queryStatement, int resultSetConcurrency)
          Constructor that takes a Connection object, a query statement and a value for result set concurrency.
 
Method Summary
protected  void _fireAll()
           
 boolean cancel()
          Cancels any changes to the current row.
protected  boolean checkValue()
           
 boolean commit()
          Commits any changes to the current row to the data source.
protected  void commitData(int commitLevel)
           
 boolean delete()
          Deletes the current row from the table.
 boolean executeQuery()
          This method directly calls executeQuery(queryStatement).
 boolean executeQuery(java.lang.String queryStatement)
          This method attempts to commit any modified data before executing the query.
 boolean first()
          Move the cursor to the first row (or observation).
protected  void fpc(java.lang.String propertyName, boolean newValue, int index)
           
protected  java.sql.Array getArrayColumn(int columnIndex)
          Gets the value of the designated column in the current row as an array object.
 int getAutoCommitLevel()
          Gets the the level at which the data will be committed.
protected  java.math.BigDecimal getBigDecimalColumn(int columnIndex)
           
protected  java.sql.Blob getBlobColumn(int columnIndex)
           
protected  boolean getBooleanColumn(int columnIndex)
           
protected  byte[] getByteArrayColumn(int columnIndex)
          Gets the value of the designated column in the current row as an array of bytes in the Java programming language.
protected  byte getByteColumn(int columnIndex)
           
protected  java.sql.Clob getClobColumn(int columnIndex)
           
protected abstract  java.lang.Object[][] getColumnMapping()
           
 java.sql.Connection getDataSource()
          Gets the Connection object used as the bean's data source.
protected  java.sql.Date getDateColumn(int columnIndex)
           
protected  double getDoubleColumn(int columnIndex)
           
static com.sas.beans.ExtendedBeanInfo getExtendedBeanInfo()
           
protected  float getFloatColumn(int columnIndex)
           
protected  int getIntColumn(int columnIndex)
           
protected  long getLongColumn(int columnIndex)
           
protected  java.lang.Object getObjectColumn(int columnIndex)
           
 int getPageSize()
          Gets the number of records in a page.
protected abstract  java.util.Hashtable getPropertyNameMap()
           
 java.lang.String getQueryStatement()
          Returns the SQL query that has been applied to the data source.
protected  java.sql.Ref getRefColumn(int columnIndex)
           
 int getResultSetConcurrency()
          Returns one of ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE.
protected  java.sql.ResultSetMetaData getResultSetMetaData()
          Returns the ResultSetMetaData object used within the data bean.
 int getResultSetType()
          Retrieves the type of the underlying ResultSet object.
 int getRow()
          Returns the number of the current row in the data bean.
 int getRowCount()
          Returns the number of rows in the data bean or -1 if the number of rows cannot be determined, or the result set is on the insert row.
protected  short getShortColumn(int columnIndex)
           
 java.sql.Statement getStatement()
          Gets the Statement object.
 java.lang.Exception getStatusException()
          Gets a status exception.
protected  java.lang.String getStringColumn(int columnIndex)
           
protected  java.sql.Time getTimeColumn(int columnIndex)
           
protected  java.sql.Timestamp getTimestampColumn(int columnIndex)
           
protected  void init()
          Initializes the data bean by creating a Statement and calling executeQuery(queryStatement).
protected  int initColumnIndex(java.lang.String propertyName)
           
protected abstract  void initColumnIndexes()
           
protected  void initializeData()
           
protected  void initializeResults()
          Called by some methods and constructors, to commit any data needing commital before re-initialization of the data bean.
protected  void initPropertyNameMap(java.util.Hashtable propertyNameMap)
           
 boolean insert()
          Prepares for a new record to be inserted into the table.
 boolean isCancelSupported()
          Determines whether the cancel() method can be called.
 boolean isCommitSupported()
          Determines whether the commit() method can be called.
 boolean isCursorValid()
          Determines whether the current row position is valid
 boolean isDeleteSupported()
          Determines whether the delete() method can be called.
 boolean isFirstSupported()
          Determines whether the first() method can be called.
 boolean isInsertSupported()
          Determines whether the insert() method can be called.
 boolean isLastSupported()
          Determines whether the last() method can be called.
 boolean isModified()
          Determines whether the current row has been modified.
 boolean isNextSupported()
          Determines whether the next() method can be called.
 boolean isOnInsertRow()
           
 boolean isPageBackwardSupported()
          Determines whether the pageBackward() method can be called.
 boolean isPageForwardSupported()
          Determines whether the pageForward() method can be called.
 boolean isPreviousSupported()
          Determines whether the previous() method can be called.
 boolean isRefreshSupported()
          Determines whether the refresh() method can be called.
protected  void itemChanged(int columnIndex)
           
 boolean last()
          Move to the last row (or observation).
 boolean move(int row)
          Moves to the absolute row number given (one-based).
 boolean next()
          Move to the next row (or observation).
 boolean pageBackward()
          Moves the cursor backward one page, which is determined by pageSize.
 boolean pageForward()
          Moves the cursor forward one page, which is determined by pageSize.
 boolean previous()
          Move to the previous row (or observation).
 boolean refresh()
          Causes the data in the table to be re-read by calling executeQuery().
protected  void rowChanged()
           
 void setAutoCommitLevel(int autoCommitLevel)
          Sets the level at which data will be committed.
 void setDataSource(java.sql.Connection dataSource)
          Sets a connection object as the data source for the data bean.
 void setDataSource(java.sql.Connection dataSource, int resultSetConcurrency)
          Sets a connection object as the data source for the data bean and applies the specified value of result set concurrency.
 void setPageSize(int pageSize)
          Sets the number of records in a page.
 void setQueryStatement(java.lang.String queryStatement)
          Sets a SQL query that will be used to obtain a selection of data from the data source.
 void setResultSetConcurrency(int concur)
          Changes the concurrency of the result set to determine whether it can be updated.
 void setResultSetType(int type)
          Changes the type of the result set to determine whether it can be scrolled and whether changes to column values made to the underlying data base are ever shown in the result set.
 void setStatement(java.sql.Statement statement)
          Sets a new Statement object.
protected  void setStatusException(java.sql.SQLException statusException)
          Sets a status exception.
protected  void updateColumn(int columnIndex)
           
protected  void updateColumn(int columnIndex, java.math.BigDecimal value)
           
protected  void updateColumn(int columnIndex, boolean value)
           
protected  void updateColumn(int columnIndex, byte value)
           
protected  void updateColumn(int columnIndex, byte[] value)
           
protected  void updateColumn(int columnIndex, java.sql.Date value)
           
protected  void updateColumn(int columnIndex, double value)
           
protected  void updateColumn(int columnIndex, float value)
           
protected  void updateColumn(int columnIndex, int value)
           
protected  void updateColumn(int columnIndex, long value)
           
protected  void updateColumn(int columnIndex, java.lang.Object value)
           
protected  void updateColumn(int columnIndex, short value)
           
protected  void updateColumn(int columnIndex, java.lang.String value)
           
protected  void updateColumn(int columnIndex, java.sql.Time value)
           
protected  void updateColumn(int columnIndex, java.sql.Timestamp value)
           
 

Field Detail

RB_KEY

public static final java.lang.String RB_KEY
See Also:
Constant Field Values

NEXTSUPPORTED

protected static final int NEXTSUPPORTED
See Also:
Constant Field Values

PREVIOUSSUPPORTED

protected static final int PREVIOUSSUPPORTED
See Also:
Constant Field Values

FIRSTSUPPORTED

protected static final int FIRSTSUPPORTED
See Also:
Constant Field Values

LASTSUPPORTED

protected static final int LASTSUPPORTED
See Also:
Constant Field Values

COMMITSUPPORTED

protected static final int COMMITSUPPORTED
See Also:
Constant Field Values

INSERTSUPPORTED

protected static final int INSERTSUPPORTED
See Also:
Constant Field Values

DELETESUPPORTED

protected static final int DELETESUPPORTED
See Also:
Constant Field Values

CANCELSUPPORTED

protected static final int CANCELSUPPORTED
See Also:
Constant Field Values

REFRESHSUPPORTED

protected static final int REFRESHSUPPORTED
See Also:
Constant Field Values

PAGEFORWARDSUPPORTED

protected static final int PAGEFORWARDSUPPORTED
See Also:
Constant Field Values

PAGEBACKWARDSUPPORTED

protected static final int PAGEBACKWARDSUPPORTED
See Also:
Constant Field Values

supported

protected transient boolean[] supported

COLUMNMAP_PROPERTY_NAME

public static int COLUMNMAP_PROPERTY_NAME

COLUMNMAP_COLUMN_NAME

public static int COLUMNMAP_COLUMN_NAME

COLUMNMAP_COLUMN_TYPE

public static int COLUMNMAP_COLUMN_TYPE

COLUMNMAP_COLUMN_INDEX

public static int COLUMNMAP_COLUMN_INDEX

COLUMNMAP_FORMATTED_PROPERTY_NAME

public static int COLUMNMAP_FORMATTED_PROPERTY_NAME

COLUMNMAP_BASEDATABEAN_FUTURES

public static int COLUMNMAP_BASEDATABEAN_FUTURES

COLUMNMAP_USERBASE

public static int COLUMNMAP_USERBASE

atBeginning

protected boolean atBeginning

atEnd

protected boolean atEnd

badState

protected boolean badState

commitWithUpdate

protected boolean commitWithUpdate

dataNeedsCommit

protected boolean dataNeedsCommit

delayCommit

protected boolean delayCommit

isDesignTime

protected boolean isDesignTime

initialized

protected boolean initialized

calledFromExecuteQuery

protected boolean calledFromExecuteQuery

calledFromInit

protected boolean calledFromInit

calledFromFireAll

protected boolean calledFromFireAll

setBadState

protected boolean setBadState

autoCommitLevel

protected int autoCommitLevel

pageSize

protected int pageSize

resultSetConcurrency

protected int resultSetConcurrency

resultSetType

protected int resultSetType

queryStatement

protected java.lang.String queryStatement

statusException

protected java.sql.SQLException statusException

dataSource

protected transient java.sql.Connection dataSource

results

protected transient java.sql.ResultSet results

statement

protected transient java.sql.Statement statement

_stackChecker

protected transient com.sas.sasserver.datawizard.StackChecker _stackChecker

isOnInsertRow

protected boolean isOnInsertRow

endOfForwardOnlyResultSet

protected boolean endOfForwardOnlyResultSet

cursorValid

protected boolean cursorValid
Constructor Detail

BaseDataBean

public BaseDataBean()

BaseDataBean

public BaseDataBean(java.sql.Connection dataSource,
                    int resultSetConcurrency)
             throws java.sql.SQLException
Constructor that takes a Connection object and a value for result set concurrency.

Parameters:
dataSource - A Connection object.
resultSetConcurrency - Either java.sql.ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE.
Throws:
java.sql.SQLException - if one is thrown by any JDBC operation

BaseDataBean

public BaseDataBean(java.sql.Connection dataSource)
             throws java.sql.SQLException
Constructor that takes a Connection object and creates a read-only data bean.

Parameters:
dataSource - A Connection object.
Throws:
java.sql.SQLException - if one is thrown by any JDBC operation

BaseDataBean

public BaseDataBean(java.sql.Connection dataSource,
                    java.lang.String queryStatement,
                    int resultSetConcurrency)
             throws java.sql.SQLException
Constructor that takes a Connection object, a query statement and a value for result set concurrency.

Parameters:
dataSource - A Connection object.
queryStatement - A SQL query that is valid for the database represented by dataSource.
resultSetConcurrency - Either java.sql.ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE.
Throws:
java.sql.SQLException - if one is thrown by any JDBC operation

BaseDataBean

public BaseDataBean(java.sql.Connection dataSource,
                    java.lang.String queryStatement)
             throws java.sql.SQLException
Constructor used to create a read-only data bean.

Parameters:
dataSource - A Connection object.
queryStatement - A SQL query that is valid for the database represented by dataSource.
Throws:
java.sql.SQLException - if one is thrown by any JDBC operation
Method Detail

getExtendedBeanInfo

public static com.sas.beans.ExtendedBeanInfo getExtendedBeanInfo()

setDataSource

public void setDataSource(java.sql.Connection dataSource,
                          int resultSetConcurrency)
                   throws java.sql.SQLException
Sets a connection object as the data source for the data bean and applies the specified value of result set concurrency.

Parameters:
dataSource - A Connection object.
resultSetConcurrency - Either java.sql.ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE.
Throws:
java.sql.SQLException - if one is thrown by any JDBC operation

setDataSource

public void setDataSource(java.sql.Connection dataSource)
                   throws java.sql.SQLException
Sets a connection object as the data source for the data bean. The current value for result set concurrency is used.

Parameters:
dataSource - A Connection object.
Throws:
java.sql.SQLException - if one is thrown by dataSource(datasource, resultSetConcurrency.

initializeResults

protected void initializeResults()
                          throws java.sql.SQLException
Called by some methods and constructors, to commit any data needing commital before re-initialization of the data bean.

Throws:
java.sql.SQLException - if any underlying JDBC operation threw an exception
java.lang.IllegalStateException - if modified data is not committed.

getDataSource

public java.sql.Connection getDataSource()
Gets the Connection object used as the bean's data source.

Returns:
A Connection object.

setStatement

public void setStatement(java.sql.Statement statement)
Sets a new Statement object. It should have been created from the same dataSource object already set on the data bean.

Parameters:
statement - The Statement to apply

getStatement

public java.sql.Statement getStatement()
Gets the Statement object.

Returns:
the Statement object

executeQuery

public boolean executeQuery()
This method directly calls executeQuery(queryStatement).

See Also:
executeQuery()

executeQuery

public boolean executeQuery(java.lang.String queryStatement)
This method attempts to commit any modified data before executing the query. Once the query is executed, the next() method is called on the result set to move to the first row. This assures that any viewers attached to the data bean will immediately show data.

Returns:
True if successfully initialized and data bean is on the first row, or false if any operation threw an exception
Throws:
java.lang.IllegalStateException - if modified data cannot be committed.
See Also:
Statement.executeQuery(java.lang.String)

setQueryStatement

public void setQueryStatement(java.lang.String queryStatement)
Sets a SQL query that will be used to obtain a selection of data from the data source.

Parameters:
queryStatement - The query to apply.

getQueryStatement

public java.lang.String getQueryStatement()
Returns the SQL query that has been applied to the data source.

Returns:
The query.

setResultSetType

public void setResultSetType(int type)
                      throws java.sql.SQLException
Changes the type of the result set to determine whether it can be scrolled and whether changes to column values made to the underlying data base are ever shown in the result set. Valid values are ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, or ResultSet.TYPE_SCROLL_SENSITIVE. If the value of type changes from current value, a new statement object is created and the query statement is executed again.

Parameters:
type - the type of result set desired
Throws:
java.lang.IllegalArgumentException - if invalid result set type
java.sql.SQLException - if one is thrown by any JDBC operation

getResultSetType

public int getResultSetType()
Retrieves the type of the underlying ResultSet object.

Returns:
one of the following ResultSet constants: TYPE_FORWARD_ONLY, TYPE_SCROLL_INSENSITIVE, or TYPE_SCROLL_SENSITIVE
See Also:
ResultSet.getType()

setResultSetConcurrency

public void setResultSetConcurrency(int concur)
                             throws java.sql.SQLException
Changes the concurrency of the result set to determine whether it can be updated. Valid values are ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE. If the value of concur changes from current value, a new statement object is created and the query statement is executed again.

Parameters:
type - the type of result set desired
Throws:
java.lang.IllegalArgumentException - if invalid result set type
java.sql.SQLException

getResultSetConcurrency

public int getResultSetConcurrency()
Returns one of ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE.

Returns:
The concurrency value.
See Also:
ResultSet.getConcurrency()

updateColumn

protected void updateColumn(int columnIndex,
                            java.lang.String value)
                     throws java.sql.SQLException
Throws:
java.sql.SQLException

updateColumn

protected void updateColumn(int columnIndex,
                            double value)
                     throws java.sql.SQLException
Throws:
java.sql.SQLException

updateColumn

protected void updateColumn(int columnIndex,
                            long value)
                     throws java.sql.SQLException
Throws:
java.sql.SQLException

updateColumn

protected void updateColumn(int columnIndex,
                            byte[] value)
                     throws java.sql.SQLException
Throws:
java.sql.SQLException

updateColumn

protected void updateColumn(int columnIndex,
                            boolean value)
                     throws java.sql.SQLException
Throws:
java.sql.SQLException

updateColumn

protected void updateColumn(int columnIndex,
                            java.sql.Date value)
                     throws java.sql.SQLException
Throws:
java.sql.SQLException

updateColumn

protected void updateColumn(int columnIndex,
                            java.math.BigDecimal value)
                     throws java.sql.SQLException
Throws:
java.sql.SQLException

updateColumn

protected void updateColumn(int columnIndex,
                            float value)
                     throws java.sql.SQLException
Throws:
java.sql.SQLException

updateColumn

protected void updateColumn(int columnIndex,
                            int value)
                     throws java.sql.SQLException
Throws:
java.sql.SQLException

updateColumn

protected void updateColumn(int columnIndex,
                            java.lang.Object value)
                     throws java.sql.SQLException
Throws:
java.sql.SQLException

updateColumn

protected void updateColumn(int columnIndex,
                            short value)
                     throws java.sql.SQLException
Throws:
java.sql.SQLException

updateColumn

protected void updateColumn(int columnIndex,
                            java.sql.Time value)
                     throws java.sql.SQLException
Throws:
java.sql.SQLException

updateColumn

protected void updateColumn(int columnIndex,
                            java.sql.Timestamp value)
                     throws java.sql.SQLException
Throws:
java.sql.SQLException

updateColumn

protected void updateColumn(int columnIndex,
                            byte value)
                     throws java.sql.SQLException
Throws:
java.sql.SQLException

updateColumn

protected void updateColumn(int columnIndex)
                     throws java.sql.SQLException
Throws:
java.sql.SQLException

getArrayColumn

protected java.sql.Array getArrayColumn(int columnIndex)
                                 throws java.sql.SQLException
Gets the value of the designated column in the current row as an array object.

Parameters:
columnIndex - The one-based column index
Returns:
The array
Throws:
java.sql.SQLException - if one is thrown by any JDBC operation
See Also:
ResultSet.getArray(int)

getByteArrayColumn

protected byte[] getByteArrayColumn(int columnIndex)
                             throws java.sql.SQLException
Gets the value of the designated column in the current row as an array of bytes in the Java programming language.

Parameters:
columnIndex - The one-based column index
Returns:
The byte array
Throws:
java.sql.SQLException - if one is thrown by any JDBC operation
See Also:
ResultSet.getBytes(int)

getBooleanColumn

protected boolean getBooleanColumn(int columnIndex)
                            throws java.sql.SQLException
Throws:
java.sql.SQLException

getStringColumn

protected java.lang.String getStringColumn(int columnIndex)
                                    throws java.sql.SQLException
Throws:
java.sql.SQLException

getDoubleColumn

protected double getDoubleColumn(int columnIndex)
                          throws java.sql.SQLException
Throws:
java.sql.SQLException

getLongColumn

protected long getLongColumn(int columnIndex)
                      throws java.sql.SQLException
Throws:
java.sql.SQLException

getBigDecimalColumn

protected java.math.BigDecimal getBigDecimalColumn(int columnIndex)
                                            throws java.sql.SQLException
Throws:
java.sql.SQLException

getFloatColumn

protected float getFloatColumn(int columnIndex)
                        throws java.sql.SQLException
Throws:
java.sql.SQLException

getIntColumn

protected int getIntColumn(int columnIndex)
                    throws java.sql.SQLException
Throws:
java.sql.SQLException

getObjectColumn

protected java.lang.Object getObjectColumn(int columnIndex)
                                    throws java.sql.SQLException
Throws:
java.sql.SQLException

getRefColumn

protected java.sql.Ref getRefColumn(int columnIndex)
                             throws java.sql.SQLException
Throws:
java.sql.SQLException

getShortColumn

protected short getShortColumn(int columnIndex)
                        throws java.sql.SQLException
Throws:
java.sql.SQLException

getTimeColumn

protected java.sql.Time getTimeColumn(int columnIndex)
                               throws java.sql.SQLException
Throws:
java.sql.SQLException

getTimestampColumn

protected java.sql.Timestamp getTimestampColumn(int columnIndex)
                                         throws java.sql.SQLException
Throws:
java.sql.SQLException

getByteColumn

protected byte getByteColumn(int columnIndex)
                      throws java.sql.SQLException
Throws:
java.sql.SQLException

getBlobColumn

protected java.sql.Blob getBlobColumn(int columnIndex)
                               throws java.sql.SQLException
Throws:
java.sql.SQLException

getClobColumn

protected java.sql.Clob getClobColumn(int columnIndex)
                               throws java.sql.SQLException
Throws:
java.sql.SQLException

getDateColumn

protected java.sql.Date getDateColumn(int columnIndex)
                               throws java.sql.SQLException
Throws:
java.sql.SQLException

first

public boolean first()

Move the cursor to the first row (or observation). The autoCommitLevel will be honored before navigating rows. Use getStatusException() to learn more details if first() returns false.

Specified by:
first in interface TableNavigationInterface
Returns:
true if the cursor was positioned on the first row
See Also:
TableNavigationInterface.first()

last

public boolean last()

Move to the last row (or observation). The autoCommitLevel will be honored before navigating rows. Use getStatusException() to learn more details if last() returns false.

Specified by:
last in interface TableNavigationInterface
Returns:
true if the cursor was positioned to the last row
See Also:
TableNavigationInterface.last()

previous

public boolean previous()

Move to the previous row (or observation). The autoCommitLevel will be honored before navigating rows. Use getStatusException() to learn more details if previous() returns false.

Specified by:
previous in interface TableNavigationInterface
Returns:
true if the cursor was positioned to the previous row
See Also:
TableNavigationInterface.previous()

next

public boolean next()

Move to the next row (or observation). The autoCommitLevel will be honored before navigating rows. Use getStatusException to learn more details if next() returns false.

Specified by:
next in interface TableNavigationInterface
Returns:
true if the cursor was positioned to the next row
See Also:
TableNavigationInterface.next()

isOnInsertRow

public boolean isOnInsertRow()

insert

public boolean insert()

Prepares for a new record to be inserted into the table. The autoCommitLevel will be honored before leaving the current row. Use getStatusException to learn more details if insert() returns false.

Specified by:
insert in interface TableNavigationInterface
Returns:
true if ready to insert a new row
See Also:
TableNavigationInterface.insert()

move

public boolean move(int row)

Moves to the absolute row number given (one-based). The autoCommitLevel will be honored before navigating rows. Use getStatusException to learn more details if move() returns false.

Specified by:
move in interface TableNavigationInterface
Parameters:
row - 1-based row number
Returns:
true if the cursor was positioned to a valid row
See Also:
TableNavigationInterface.move(int)

commit

public boolean commit()

Commits any changes to the current row to the data source. This includes any updates or inserting a new row into the table. Use getStatusException to learn more details if commit() returns false.

Specified by:
commit in interface TableNavigationInterface
Returns:
true if the row was committed
See Also:
TableNavigationInterface.commit()

cancel

public boolean cancel()

Cancels any changes to the current row. This includes any updates or inserting a new row into the table. Use getStatusException() to learn more details if cancel() returns false.

Specified by:
cancel in interface TableNavigationV2Interface
Returns:
true if the row was cancelled
See Also:
TableNavigationV2Interface.cancel()

refresh

public boolean refresh()
Causes the data in the table to be re-read by calling executeQuery().

Specified by:
refresh in interface TableNavigationV2Interface
Returns:
true if the data was refreshed
See Also:
TableNavigationV2Interface.refresh()

setPageSize

public void setPageSize(int pageSize)

Sets the number of records in a page. To be used when paging forward or backward.

Specified by:
setPageSize in interface TableNavigationV2Interface
Parameters:
pageSize - Number of records in a page.
See Also:
TableNavigationV2Interface.setPageSize(int)

getPageSize

public int getPageSize()

Gets the number of records in a page. To be used when paging forward or backward.

Specified by:
getPageSize in interface TableNavigationV2Interface
Returns:
the number of records in a page.
See Also:
TableNavigationV2Interface.getPageSize()

setStatusException

protected void setStatusException(java.sql.SQLException statusException)

Sets a status exception. Many methods on the TableNavigationInterface and TableNaviationV2Interface return false rather than throwing an exception when a method fails. The statusException can be used to communicate a more detailed explanation for the failure. This method sets the exception on the dataBean so it can be retrieved with the public method getStatusException().

Parameters:
statusException - sets the exception object containing a description of an error

getStatusException

public java.lang.Exception getStatusException()

Gets a status exception. Many methods on the TableNavigationInterface and TableNavigationV2Interface return false rather than throwing an exception when a method fails. The statusException can be used to communicate a more detailed explanation for the failure. This method gets the exception which then may be examined. For example:

if (! dataBean.executeQuery) {
    // getStatusException to see what went wrong
    SQLException e = (SQLException)dataBean.getStatusException();
    String state = e.getSQLState();
        String reason = e.getMessage();
        }       
 
Calling this method on the BaseDataBean always returns a SQLException.

Specified by:
getStatusException in interface TableNavigationV2Interface
Returns:
a description for the last error that has occurred
See Also:
TableNavigationV2Interface.getStatusException(), SQLException

setAutoCommitLevel

public void setAutoCommitLevel(int autoCommitLevel)

Sets the level at which data will be committed.

Specified by:
setAutoCommitLevel in interface TableNavigationV2Interface
Parameters:
autoCommitLevel - Level at which the data will be committed.
See Also:
TableNavigationV2Interface.setAutoCommitLevel(int)

getAutoCommitLevel

public int getAutoCommitLevel()

Gets the the level at which the data will be committed.

Specified by:
getAutoCommitLevel in interface TableNavigationV2Interface
Returns:
the level at which the data will be committed.
See Also:
TableNavigationV2Interface.getAutoCommitLevel()

initializeData

protected void initializeData()

commitData

protected void commitData(int commitLevel)

pageForward

public boolean pageForward()

Moves the cursor forward one page, which is determined by pageSize.

Specified by:
pageForward in interface TableNavigationV2Interface
Returns:
true if the cursor was positioned on the next page
See Also:
TableNavigationV2Interface.pageForward()

pageBackward

public boolean pageBackward()

Moves the cursor backward one page, which is determined by pageSize.

Specified by:
pageBackward in interface TableNavigationV2Interface
Returns:
true if the cursor was positioned on the previous page
See Also:
TableNavigationV2Interface.pageBackward()

delete

public boolean delete()

Deletes the current row from the table.

Specified by:
delete in interface TableNavigationInterface
Returns:
true if the row was deleted
See Also:
TableNavigationInterface.delete()

isPreviousSupported

public boolean isPreviousSupported()

Determines whether the previous() method can be called.

Specified by:
isPreviousSupported in interface TableNavigationInterface
Returns:
true if the method can be called
See Also:
TableNavigationInterface.isPreviousSupported()

isPageBackwardSupported

public boolean isPageBackwardSupported()

Determines whether the pageBackward() method can be called.

Specified by:
isPageBackwardSupported in interface TableNavigationV2Interface
Returns:
true if the method can be called
See Also:
TableNavigationV2Interface.isPageBackwardSupported()

isNextSupported

public boolean isNextSupported()

Determines whether the next() method can be called.

Specified by:
isNextSupported in interface TableNavigationInterface
Returns:
true if the method can be called
See Also:
TableNavigationInterface.isNextSupported()

isPageForwardSupported

public boolean isPageForwardSupported()

Determines whether the pageForward() method can be called.

Specified by:
isPageForwardSupported in interface TableNavigationV2Interface
Returns:
true if the method can be called
See Also:
TableNavigationV2Interface.isPageForwardSupported()

isFirstSupported

public boolean isFirstSupported()

Determines whether the first() method can be called.

Specified by:
isFirstSupported in interface TableNavigationInterface
Returns:
true if the method can be called
See Also:
TableNavigationInterface.isFirstSupported()

isLastSupported

public boolean isLastSupported()

Determines whether the last() method can be called.

Specified by:
isLastSupported in interface TableNavigationInterface
Returns:
true if the method can be called
See Also:
TableNavigationInterface.isLastSupported()

isInsertSupported

public boolean isInsertSupported()

Determines whether the insert() method can be called.

Specified by:
isInsertSupported in interface TableNavigationInterface
Returns:
true if the method can be called
See Also:
TableNavigationInterface.isInsertSupported()

isCommitSupported

public boolean isCommitSupported()

Determines whether the commit() method can be called.

Specified by:
isCommitSupported in interface TableNavigationInterface
Returns:
true if the method can be called
See Also:
TableNavigationInterface.isCommitSupported()

isDeleteSupported

public boolean isDeleteSupported()

Determines whether the delete() method can be called.

Specified by:
isDeleteSupported in interface TableNavigationInterface
Returns:
true if the method can be called
See Also:
TableNavigationInterface.isDeleteSupported()

isCancelSupported

public boolean isCancelSupported()

Determines whether the cancel() method can be called.

Specified by:
isCancelSupported in interface TableNavigationV2Interface
Returns:
true if the method can be called
See Also:
TableNavigationV2Interface.isCancelSupported()

isRefreshSupported

public boolean isRefreshSupported()

Determines whether the refresh() method can be called.

Specified by:
isRefreshSupported in interface TableNavigationV2Interface
Returns:
true if the method can be called
See Also:
TableNavigationV2Interface.isRefreshSupported()

isModified

public boolean isModified()

Determines whether the current row has been modified.

Specified by:
isModified in interface TableNavigationInterface
Returns:
true if the current row has been modified
See Also:
TableNavigationInterface.isModified()

isCursorValid

public boolean isCursorValid()

Determines whether the current row position is valid

Specified by:
isCursorValid in interface TableNavigationInterface
Returns:
true if the cursor is positioned on a valid row
See Also:
TableNavigationInterface.isCursorValid()

getRow

public int getRow()
Returns the number of the current row in the data bean. The first row number is 1, the second is 2, and so on. Returns -1 if the result set threw an SQLException in the getRow() call.

Returns:
the number of the current row; 0 if there is no current row
See Also:
ResultSet.getRow()

getRowCount

public int getRowCount()
Returns the number of rows in the data bean or -1 if the number of rows cannot be determined, or the result set is on the insert row.

Returns:
the row count

initColumnIndexes

protected abstract void initColumnIndexes()
                                   throws java.sql.SQLException
Throws:
java.sql.SQLException

getColumnMapping

protected abstract java.lang.Object[][] getColumnMapping()

getPropertyNameMap

protected abstract java.util.Hashtable getPropertyNameMap()

initPropertyNameMap

protected void initPropertyNameMap(java.util.Hashtable propertyNameMap)

initColumnIndex

protected int initColumnIndex(java.lang.String propertyName)
                       throws java.sql.SQLException
Throws:
java.sql.SQLException

itemChanged

protected void itemChanged(int columnIndex)

rowChanged

protected void rowChanged()

_fireAll

protected void _fireAll()

fpc

protected void fpc(java.lang.String propertyName,
                   boolean newValue,
                   int index)

getResultSetMetaData

protected java.sql.ResultSetMetaData getResultSetMetaData()
                                                   throws java.sql.SQLException
Returns the ResultSetMetaData object used within the data bean.

Returns:
the ResultSetMetaData object
Throws:
java.sql.SQLException - if thrown by any underlying JDBC operation

init

protected void init()
             throws java.sql.SQLException
Initializes the data bean by creating a Statement and calling executeQuery(queryStatement).

Throws:
statusException - if dataSource is null.
java.sql.SQLException - if any underlying JDBC operation throws an exception

checkValue

protected boolean checkValue()



Copyright © 2009 SAS Institute Inc. All Rights Reserved.