com.isti.util.database
Class SQLValuesTable

java.lang.Object
  extended by com.isti.util.BaseValueTableModel
      extended by com.isti.util.database.SQLValuesTable
All Implemented Interfaces:
ValueTableModel

public class SQLValuesTable
extends BaseValueTableModel
implements ValueTableModel


Constructor Summary
SQLValuesTable()
           
 
Method Summary
protected  java.lang.Object getColumnMapKey(java.util.List columnList)
          Gets the column map key.
protected  java.lang.Object getValue(java.sql.ResultSet rs, int columnIndex)
          Gets the value.
 int readAll(java.sql.ResultSet rs)
          Reads all of the rows.
 void readRow(java.sql.ResultSet rs)
          Reads the current row.
protected  void readRow(java.sql.ResultSet rs, java.util.List valueList, int numColumns)
          Reads the current row.
 void reset(java.sql.ResultSet rs)
          Resets the result set to before the first row.
 boolean setColumnNames(java.sql.ResultSetMetaData rsmd)
          Sets the column names.
 boolean setColumnNames(java.sql.ResultSetMetaData rsmd, java.util.List valueList)
          Sets the column names.
 void setIdColumn(int columnIndex)
          Sets the ID column.
 void setIdColumn(java.lang.String columnName)
          Sets the ID column.
protected  void updateRow(java.sql.ResultSet rs, boolean insertRowFlag)
          Update the row.
protected  void updateValue(java.sql.ResultSet rs, java.lang.Object valueObj, int columnIndex)
          Update the value.
protected  void updateValue(java.sql.ResultSet rs, java.lang.Object valueObj, java.lang.String columnName)
          Update the value.
 void writeAll(java.sql.ResultSet rs)
          Writes all the rows.
 void writeRow(java.sql.ResultSet rs, boolean insertRowFlag)
          Writes the current row.
protected  void writeRow(java.sql.ResultSet rs, int numColumns, int rowIndex, boolean insertRowFlag)
          Writes the current row.
 
Methods inherited from class com.isti.util.BaseValueTableModel
addColumnMapValues, addFixedSizeRow, addReadOnlyColumn, addRow, appendErrorMessageString, clearErrorMessageString, clearLists, clearRows, columnsExist, createColumnMap, createColumnNamesList, createFixedSizeList, createFixedSizeList, createList, createLists, createMap, createRowsList, getColumnClass, getColumnCount, getColumnIndex, getColumnMapValues, getColumnName, getColumnNames, getDefaultColumnName, getErrorMessageFlag, getErrorMessageString, getRawValueAt, getRow, getRowCount, getValueAt, importValues, importValues, isCellEditable, isEditable, isNull, setColumnNames, setColumnNames, setColumnNames, setEditable, setErrorMessageString, setValueAt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.isti.util.ValueTableModel
getColumnClass, getColumnCount, getColumnIndex, getColumnName, getRowCount, getValueAt, importValues, isCellEditable, setValueAt
 

Constructor Detail

SQLValuesTable

public SQLValuesTable()
Method Detail

readAll

public int readAll(java.sql.ResultSet rs)
            throws java.sql.SQLException
Reads all of the rows. This will attempt to load all of the rows into memory. Any existing error messages are cleared. To clear existing colums and rows the 'clearLists' method should be called. To clear existing rows the 'clearRows' method should be called.

Parameters:
rs - the result set.
Returns:
the number of rows read or 0 if error.
Throws:
java.sql.SQLException - if error.
See Also:
clearLists, clearRows, getErrorMessages

readRow

public void readRow(java.sql.ResultSet rs)
             throws java.sql.SQLException
Reads the current row. This will attempt to load the row into memory.

Parameters:
rs - the result set.
Throws:
java.sql.SQLException - if error.
See Also:
getErrorMessages

readRow

protected void readRow(java.sql.ResultSet rs,
                       java.util.List valueList,
                       int numColumns)
                throws java.sql.SQLException
Reads the current row. This will attempt to load the row into memory.

Parameters:
rs - the result set.
valueList - the value list.
numColumns - the number of columns.
Throws:
java.sql.SQLException - if error.
See Also:
getErrorMessages

getColumnMapKey

protected java.lang.Object getColumnMapKey(java.util.List columnList)
Gets the column map key.

Overrides:
getColumnMapKey in class BaseValueTableModel
Parameters:
columnList - the list of columns for the row.
Returns:
the column map key or null if none.

getValue

protected java.lang.Object getValue(java.sql.ResultSet rs,
                                    int columnIndex)
                             throws java.sql.SQLException
Gets the value.

Parameters:
rs - the result set.
columnIndex - the column index.
Returns:
the value.
Throws:
java.sql.SQLException - if error.

reset

public void reset(java.sql.ResultSet rs)
           throws java.sql.SQLException
Resets the result set to before the first row.

Parameters:
rs - the result set.
Throws:
java.sql.SQLException - if error.

setColumnNames

public boolean setColumnNames(java.sql.ResultSetMetaData rsmd)
                       throws java.sql.SQLException
Sets the column names.

Parameters:
rsmd - the result set meta data.
Returns:
true if the column names list was set, false if error.
Throws:
java.sql.SQLException - if error.
See Also:
getErrorMessages

setColumnNames

public boolean setColumnNames(java.sql.ResultSetMetaData rsmd,
                              java.util.List valueList)
                       throws java.sql.SQLException
Sets the column names.

Parameters:
rsmd - the result set meta data.
valueList - the value list.
Returns:
true if the column names list was set, false if error.
Throws:
java.sql.SQLException - if error.

setIdColumn

public void setIdColumn(int columnIndex)
Sets the ID column.

Parameters:
columnIndex - the column index.

setIdColumn

public void setIdColumn(java.lang.String columnName)
Sets the ID column.

Parameters:
columnName - the column name.

writeAll

public void writeAll(java.sql.ResultSet rs)
              throws java.sql.SQLException
Writes all the rows.

Parameters:
rs - the result set.
Throws:
java.sql.SQLException - if error.

writeRow

public void writeRow(java.sql.ResultSet rs,
                     boolean insertRowFlag)
              throws java.sql.SQLException
Writes the current row.

Parameters:
rs - the result set.
insertRowFlag - true to insert the row, false to update the row.
Throws:
java.sql.SQLException - if error.

writeRow

protected void writeRow(java.sql.ResultSet rs,
                        int numColumns,
                        int rowIndex,
                        boolean insertRowFlag)
                 throws java.sql.SQLException
Writes the current row.

Parameters:
rs - the result set.
numColumns - the number of columns.
rowIndex - the row index.
insertRowFlag - true to insert the row, false to update the row.
Throws:
java.sql.SQLException - if error.

updateRow

protected void updateRow(java.sql.ResultSet rs,
                         boolean insertRowFlag)
                  throws java.sql.SQLException
Update the row.

Parameters:
rs - the result set.
insertRowFlag - true to insert the row, false to update the row.
Throws:
java.sql.SQLException - if error.

updateValue

protected void updateValue(java.sql.ResultSet rs,
                           java.lang.Object valueObj,
                           int columnIndex)
                    throws java.sql.SQLException
Update the value.

Parameters:
rs - the result set.
valueObj - the value object.
columnIndex - the column index.
Throws:
java.sql.SQLException - if error.

updateValue

protected void updateValue(java.sql.ResultSet rs,
                           java.lang.Object valueObj,
                           java.lang.String columnName)
                    throws java.sql.SQLException
Update the value.

Parameters:
rs - the result set.
valueObj - the value object.
columnName - the column name.
Throws:
java.sql.SQLException - if error.