pt.moredata.dao
Interface RecordSet


public interface RecordSet

A table of data representing a repository result set, which is usually generated by executing a statement that queries the repository. Company MoreData

Version:
$Revision: 1.9 $
Author:
pcarmo

Method Summary
 void backup()
          Backup all data set in paralel struture
 void backupCell(int rowNumber, int columnNumber)
          Backup a cell content.
 void backupRow(int rowNumber)
          Backup an entire row.
 void clear()
          Remove all the data from the RecordSet.
 void deleteRow(int rowNumber)
          Remove a row from the RecordSet.
 java.lang.Object getBackupCell(int rowNumber, int columnNumber)
          Return the value of a backup cell.
 java.lang.Object getCellAt(int rowNumber, int columnNumber)
          Return the value of a cell.
 int getColumns()
          Return the number of columns of the RecordSet.
 int getColumns(int rowNumber)
          Return the number of columns of a giveen row of the RecordSet.
 java.util.List getDataRows()
          Return a list of DataRow objects with all the rows of the RecordSet.
 int getDataSourceAction(int rowNumber)
          Return the code of the action to be executed for a specific row to update the repository.
 java.util.List getDataSourcePK(int rowNumber)
          Return a list of Object values for the primary key columns of all tables as they was readed from the repository.
 java.util.List getDataSourcePK(java.lang.String tableName, int rowNumber)
          Return a list of Object values for the primary key columns of one table as they was readed from the repository.
 java.util.List getPKValue(int rowNumber)
          Return a list with the primary key columns value of a row.
 java.util.List getPKValue(java.lang.String tableName, int rowNumber)
          Return a list with the primary key columns value of one table row.
 int getRows()
          Return the number of row of the RecordSet.
 boolean isColumnModified(int columnNumber)
          Check if a giveen column is modified.
 boolean isDeleted(int rowNumber)
          Check if a row is deleted.
 boolean isEngineProcessed(int rowNumber)
          Check if any cell of a row is processed by the repository.
 boolean isEngineProcessed(int rowNumber, int columnNumber)
          Check if a cell is processed by the repository.
 boolean isEngineProcessed(int rowNumber, java.lang.String tableName)
          Check if any cell of a row for a giveen table is processed by the repository.
 boolean isModified()
          Check if the RecordSet is modified.
 boolean isModified(int rowNumber)
          Check if a RecordSet row is modified.
 boolean isModified(int rowNumber, int columnNumber)
          Check if a cell of the RecordSet is modified.
 boolean isNewRow(int rowNumber)
          Check if a row is a new row.
 boolean isWaitingToBeLoad(int rowNumber, int columnNumber)
          Check if the cell data is waiting for a call to the getCellAt(..)
 void resetAllFlags()
          Reset all flags for all row of the Recordset.
 void resetAllFlags(int rowNumber)
          Reset all flags of a giveen row.
 void restore()
          Restore all data in the backup to the original struture
 void restoreCell(int rowNumber, int columnNumber)
          Restore a cell content.
 void restoreRow(int rowNumber)
          Restore an entire row.
 void setDeleted(int rowNumber, boolean deleted)
          Change the deleted property flag of a giveen row.
 void setEngineProcessed(int rowNumber, boolean engineProcessed)
          Change the engineProcessed property of a row.
 void setNewRow(int rowNumber, boolean newRow)
          Change the value of the newRow property of a row.
 void setWaitingToBeLoad(int rowNumber, int columnNumber, boolean isWaiting)
          Change the cell data flag that indicate that the cell is waiting for a call to the getCellAt(..) method to be load.
 void touch(int rowNumber)
          Mark all cells of a row as not modified.
 void touch(int rowNumber, int columnNumber)
          Mark the cell as not modified.
 void touch(java.lang.String tableName, int rowNumber)
          Mark all cells of a row of a table as not modified.
 void updateCellAt(int rowNumber, int columnNumber, java.lang.Object value)
          Change the value of a cell.
 void updateCellAt(int rowNumber, int columnNumber, java.lang.Object value, boolean engineProcessed)
          Change the value of a cell.
 void updateColumn(int columnNumber, java.lang.Object value)
          Change the value of all cell of a RecordSet column.
 

Method Detail

backup

public void backup()
Backup all data set in paralel struture


backupCell

public void backupCell(int rowNumber,
                       int columnNumber)
                throws RowIndexOutOfBoundsException,
                       ColumnIndexOutOfBoundsException
Backup a cell content. If the cell already exists, the modified flag is unchanged, otherwise a new cell is created with null data and the modified flag as false.

Parameters:
rowNumber - The row number, an integer from 0 to getRows()-1.
columnNumber - The column number, an integer from 0 to getColumns()-1.
Throws:
RowIndexOutOfBoundsException - If rowNumber < 0 or rowNumber >= getRows().
ColumnIndexOutOfBoundsException - If columnNumber < 0 or columnNumber >= getColumns().

backupRow

public void backupRow(int rowNumber)
               throws RowIndexOutOfBoundsException
Backup an entire row.

Parameters:
rowNumber - The row number, an integer from 0 to getRows()-1.
Throws:
RowIndexOutOfBoundsException - If rowNumber < 0 or rowNumber >= getRows().

clear

public void clear()
Remove all the data from the RecordSet.


deleteRow

public void deleteRow(int rowNumber)
               throws RowIndexOutOfBoundsException
Remove a row from the RecordSet.

Parameters:
rowNumber - The row number, an integer from 0 to getRows()-1.
Throws:
RowIndexOutOfBoundsException - If rowNumber < 0 or rowNumber >= getRows().

getBackupCell

public java.lang.Object getBackupCell(int rowNumber,
                                      int columnNumber)
                               throws RowIndexOutOfBoundsException,
                                      ColumnIndexOutOfBoundsException
Return the value of a backup cell.

Parameters:
rowNumber - The row number, an integer from 0 to getRows()-1.
columnNumber - The column number, an integer from 0 to getColumns()-1.
Returns:
The Object value of the backup cell.
Throws:
RowIndexOutOfBoundsException - If rowNumber < 0 or rowNumber >= getRows().
ColumnIndexOutOfBoundsException - If columnNumber < 0 or columnNumber >= getColumns().

getCellAt

public java.lang.Object getCellAt(int rowNumber,
                                  int columnNumber)
                           throws RowIndexOutOfBoundsException,
                                  ColumnIndexOutOfBoundsException
Return the value of a cell.

Parameters:
rowNumber - The row number, an integer from 0 to getRows()-1.
columnNumber - The column number, an integer from 0 to getColumns()-1.
Returns:
The Object value of the cell.
Throws:
RowIndexOutOfBoundsException - If rowNumber < 0 or rowNumber >= getRows().
ColumnIndexOutOfBoundsException - If columnNumber < 0 or columnNumber >= getColumns().

getColumns

public int getColumns()
Return the number of columns of the RecordSet. The number of columns of the RecordSet could be bigger than the number of columns of a row since the row could have cells that are not instanciated.

Returns:
The number of columns of the RecordSet.

getColumns

public int getColumns(int rowNumber)
               throws RowIndexOutOfBoundsException
Return the number of columns of a giveen row of the RecordSet. The number of columns of the RecordSet could be bigger than the number of columns of a row since the row could have cells that are not instanciated.

Parameters:
rowNumber - The row number, an integer from 0 to getRows()-1.
Returns:
O numero de colunas de uma linha do Recordset.
Throws:
RowIndexOutOfBoundsException - If rowNumber < 0 or rowNumber >= getRows().

getDataRows

public java.util.List getDataRows()
Return a list of DataRow objects with all the rows of the RecordSet.

Returns:
A list of DataRow objects with all the rows of the RecordSet.

getDataSourceAction

public int getDataSourceAction(int rowNumber)
                        throws RowIndexOutOfBoundsException
Return the code of the action to be executed for a specific row to update the repository.

Parameters:
rowNumber - The row number, an integer from 0 to getRows()-1.
Throws:
RowIndexOutOfBoundsException - If rowNumber < 0 or rowNumber >= getRows().

getDataSourcePK

public java.util.List getDataSourcePK(java.lang.String tableName,
                                      int rowNumber)
                               throws RowIndexOutOfBoundsException,
                                      UnknownTableNameException,
                                      AmbiguousTableNameException
Return a list of Object values for the primary key columns of one table as they was readed from the repository.

Parameters:
tableName - The table name.
rowNumber - The row number, an integer from 0 to getRows()-1.
Returns:
A list of Object values for the primary key columns of one table as they was readed from the repository.
Throws:
RowIndexOutOfBoundsException - If rowNumber < 0 or rowNumber >= getRows().
UnknownTableNameException - When the supplied table name is invalid.
AmbiguousTableNameException - When the supplied tableName exists more than once.

getDataSourcePK

public java.util.List getDataSourcePK(int rowNumber)
                               throws RowIndexOutOfBoundsException
Return a list of Object values for the primary key columns of all tables as they was readed from the repository.

Parameters:
rowNumber - The row number, an integer from 0 to getRows()-1.
Throws:
RowIndexOutOfBoundsException - If rowNumber < 0 or rowNumber >= getRows().

getPKValue

public java.util.List getPKValue(java.lang.String tableName,
                                 int rowNumber)
                          throws RowIndexOutOfBoundsException,
                                 UnknownTableNameException,
                                 AmbiguousTableNameException
Return a list with the primary key columns value of one table row.

Parameters:
tableName - The table name.
rowNumber - The row number, an integer from 0 to getRows()-1.
Returns:
A list with the primary key columns value of one table row.
Throws:
RowIndexOutOfBoundsException - If rowNumber < 0 or rowNumber >= getRows().
UnknownTableNameException - When the supplied table name is invalid.
AmbiguousTableNameException - When the supplied tableName exists more than once.

getPKValue

public java.util.List getPKValue(int rowNumber)
                          throws RowIndexOutOfBoundsException
Return a list with the primary key columns value of a row.

Parameters:
rowNumber - The row number, an integer from 0 to getRows()-1.
Returns:
A list with the primary key columns value of a row.
Throws:
RowIndexOutOfBoundsException - If rowNumber < 0 or rowNumber >= getRows().

getRows

public int getRows()
Return the number of row of the RecordSet.

Returns:
The number of row of the RecordSet.

isColumnModified

public boolean isColumnModified(int columnNumber)
                         throws ColumnIndexOutOfBoundsException
Check if a giveen column is modified. A column is modified if a cell of the column is modified in a row.

Parameters:
columnNumber - The column number, an integer from 0 to getColumns()-1.
Returns:
True if the giveen column is modified.
Throws:
ColumnIndexOutOfBoundsException - If columnNumber < 0 or columnNumber >= getColumns().

isDeleted

public boolean isDeleted(int rowNumber)
                  throws RowIndexOutOfBoundsException
Check if a row is deleted.

Parameters:
rowNumber - The row number, an integer from 0 to getRows()-1.
Returns:
True if the row was deleted.
Throws:
RowIndexOutOfBoundsException - If rowNumber < 0 or rowNumber >= getRows().

isEngineProcessed

public boolean isEngineProcessed(int rowNumber,
                                 int columnNumber)
                          throws RowIndexOutOfBoundsException,
                                 ColumnIndexOutOfBoundsException
Check if a cell is processed by the repository. Data of cells processed by the repository are only avaliable after the execution of the insert or update methods.

Parameters:
rowNumber - The row number, an integer from 0 to getRows()-1.
columnNumber - The column number, an integer from 0 to getColumns()-1.
Returns:
True if a cell is processed by the repository, false otherwise.
Throws:
RowIndexOutOfBoundsException - If rowNumber < 0 or rowNumber >= getRows().
ColumnIndexOutOfBoundsException - If columnNumber < 0 or columnNumber >= getColumns().

isEngineProcessed

public boolean isEngineProcessed(int rowNumber)
                          throws RowIndexOutOfBoundsException
Check if any cell of a row is processed by the repository. Data of cells processed by the repository are only avaliable after the execution of the insert or update methods.

Parameters:
rowNumber - The row number, an integer from 0 to getRows()-1.
Returns:
True if the row has any cell processed by the repository, false otherwise.
Throws:
RowIndexOutOfBoundsException - If rowNumber < 0 or rowNumber >= getRows().

isEngineProcessed

public boolean isEngineProcessed(int rowNumber,
                                 java.lang.String tableName)
                          throws RowIndexOutOfBoundsException,
                                 UnknownTableNameException,
                                 AmbiguousTableNameException
Check if any cell of a row for a giveen table is processed by the repository. Data of cells processed by the repository are only avaliable after the execution of the insert or update methods.

Parameters:
rowNumber - The row number, an integer from 0 to getRows()-1.
tableName - The table name.
Returns:
True if the row has any cell processed by the repository, false otherwise.
Throws:
RowIndexOutOfBoundsException - If rowNumber < 0 or rowNumber >= getRows().
UnknownTableNameException - When the supplied table name is invalid.
AmbiguousTableNameException - When the supplied tableName exists more than once.

isModified

public boolean isModified(int rowNumber)
                   throws RowIndexOutOfBoundsException
Check if a RecordSet row is modified. A row is modified if any cell of that row is modified.

Parameters:
rowNumber - The row number, an integer from 0 to getRows()-1.
Returns:
True if the row is modified, false otherwise.
Throws:
RowIndexOutOfBoundsException - If rowNumber < 0 or rowNumber >= getRows().

isModified

public boolean isModified()
Check if the RecordSet is modified. The recordSet is modified if any row of the RecordSet is modified.

Returns:
True if the RecordSet is modified, false otherwise.

isModified

public boolean isModified(int rowNumber,
                          int columnNumber)
                   throws RowIndexOutOfBoundsException,
                          ColumnIndexOutOfBoundsException
Check if a cell of the RecordSet is modified.

Parameters:
rowNumber - The row number, an integer from 0 to getRows()-1.
columnNumber - The column number, an integer from 0 to getColumns()-1.
Returns:
True if the cell is modified, false otherwise.
Throws:
RowIndexOutOfBoundsException - If rowNumber < 0 or rowNumber >= getRows().
ColumnIndexOutOfBoundsException - If columnNumber < 0 or columnNumber >= getColumns().

isNewRow

public boolean isNewRow(int rowNumber)
                 throws RowIndexOutOfBoundsException
Check if a row is a new row.

Parameters:
rowNumber - The row number, an integer from 0 to getRows()-1.
Returns:
True if the row is new, false otherwise.
Throws:
RowIndexOutOfBoundsException - If rowNumber < 0 or rowNumber >= getRows().

isWaitingToBeLoad

public boolean isWaitingToBeLoad(int rowNumber,
                                 int columnNumber)
                          throws RowIndexOutOfBoundsException,
                                 ColumnIndexOutOfBoundsException
Check if the cell data is waiting for a call to the getCellAt(..) method to be load.

Parameters:
rowNumber - The row number, an integer from 0 to getRows()-1.
columnNumber - The column number, an integer from 0 to getColumns()-1.
Throws:
RowIndexOutOfBoundsException - If rowNumber < 0 or rowNumber >= getRows().
ColumnIndexOutOfBoundsException - If columnNumber < 0 or columnNumber >= getColumns().

resetAllFlags

public void resetAllFlags(int rowNumber)
                   throws RowIndexOutOfBoundsException
Reset all flags of a giveen row.

Parameters:
rowNumber - The row number, an integer from 0 to getRows()-1.
Throws:
RowIndexOutOfBoundsException - If rowNumber < 0 or rowNumber >= getRows().

resetAllFlags

public void resetAllFlags()
Reset all flags for all row of the Recordset.


restore

public void restore()
Restore all data in the backup to the original struture


restoreCell

public void restoreCell(int rowNumber,
                        int columnNumber)
                 throws RowIndexOutOfBoundsException,
                        ColumnIndexOutOfBoundsException
Restore a cell content.

Parameters:
rowNumber - The row number, an integer from 0 to getRows()-1.
columnNumber - The column number, an integer from 0 to getColumns()-1.
Throws:
RowIndexOutOfBoundsException - If rowNumber < 0 or rowNumber >= getRows().
ColumnIndexOutOfBoundsException - If columnNumber < 0 or columnNumber >= getColumns().

restoreRow

public void restoreRow(int rowNumber)
                throws RowIndexOutOfBoundsException
Restore an entire row.

Parameters:
rowNumber - The row number, an integer from 0 to getRows()-1.
Throws:
RowIndexOutOfBoundsException - If rowNumber < 0 or rowNumber >= getRows().

setDeleted

public void setDeleted(int rowNumber,
                       boolean deleted)
                throws RowIndexOutOfBoundsException
Change the deleted property flag of a giveen row.

Parameters:
rowNumber - The row number, an integer from 0 to getRows()-1.
deleted - True for change the row state to deleted, false otherwise.
Throws:
RowIndexOutOfBoundsException - If rowNumber < 0 or rowNumber >= getRows().

setEngineProcessed

public void setEngineProcessed(int rowNumber,
                               boolean engineProcessed)
                        throws RowIndexOutOfBoundsException
Change the engineProcessed property of a row.

Parameters:
rowNumber - The row number, an integer from 0 to getRows()-1.
engineProcessed - New value of property engineProcessed.
Throws:
RowIndexOutOfBoundsException - If rowNumber < 0 or rowNumber >= getRows().

setNewRow

public void setNewRow(int rowNumber,
                      boolean newRow)
               throws RowIndexOutOfBoundsException
Change the value of the newRow property of a row.

Parameters:
rowNumber - The row number, an integer from 0 to getRows()-1.
newRow - True for change the row state to new row, false otherwise.
Throws:
RowIndexOutOfBoundsException - If rowNumber < 0 or rowNumber >= getRows().

setWaitingToBeLoad

public void setWaitingToBeLoad(int rowNumber,
                               int columnNumber,
                               boolean isWaiting)
                        throws RowIndexOutOfBoundsException,
                               ColumnIndexOutOfBoundsException
Change the cell data flag that indicate that the cell is waiting for a call to the getCellAt(..) method to be load.

Parameters:
rowNumber - The row number, an integer from 0 to getRows()-1.
columnNumber - The column number, an integer from 0 to getColumns()-1.
isWaiting - True to indicate that the cell data is waiting to be loaded from the repository.
Throws:
RowIndexOutOfBoundsException - If rowNumber < 0 or rowNumber >= getRows().
ColumnIndexOutOfBoundsException - If columnNumber < 0 or columnNumber >= getColumns().

touch

public void touch(int rowNumber,
                  int columnNumber)
           throws RowIndexOutOfBoundsException,
                  ColumnIndexOutOfBoundsException
Mark the cell as not modified. If the cell column is a primary key column, the value of the primary is backup for later use.

Parameters:
rowNumber - The row number, an integer from 0 to getRows()-1.
columnNumber - The column number, an integer from 0 to getColumns()-1.
Throws:
RowIndexOutOfBoundsException - If rowNumber < 0 or rowNumber >= getRows().
ColumnIndexOutOfBoundsException - If columnNumber < 0 or columnNumber >= getColumns().

touch

public void touch(java.lang.String tableName,
                  int rowNumber)
           throws RowIndexOutOfBoundsException,
                  UnknownTableNameException,
                  AmbiguousTableNameException
Mark all cells of a row of a table as not modified. The primary key cells are backup for later use.

Parameters:
tableName - The table name.
rowNumber - The row number, an integer from 0 to getRows()-1.
Throws:
RowIndexOutOfBoundsException - If rowNumber < 0 or rowNumber >= getRows().
UnknownTableNameException - When the supplied table name is invalid.
AmbiguousTableNameException - When the supplied tableName exists more than once.

touch

public void touch(int rowNumber)
           throws RowIndexOutOfBoundsException
Mark all cells of a row as not modified. The primary key cells are backup for later use.

Parameters:
rowNumber - The row number, an integer from 0 to getRows()-1.
Throws:
RowIndexOutOfBoundsException - If rowNumber < 0 or rowNumber >= getRows().

updateCellAt

public void updateCellAt(int rowNumber,
                         int columnNumber,
                         java.lang.Object value)
                  throws ColumnIndexOutOfBoundsException
Change the value of a cell. If the specified row does not exist a new row is created. If the cell does not exist a new cell is created. The cell is marked as modified.

Parameters:
rowNumber - The row number, an integer from 0 to getRows()-1.
columnNumber - The column number, an integer from 0 to getColumns()-1.
value - The new cell value.
Throws:
ColumnIndexOutOfBoundsException - If columnNumber < 0 or columnNumber >= getColumns().

updateCellAt

public void updateCellAt(int rowNumber,
                         int columnNumber,
                         java.lang.Object value,
                         boolean engineProcessed)
                  throws ColumnIndexOutOfBoundsException
Change the value of a cell. If the specified row does not exist a new row is created. If the cell does not exist a new cell is created. The cell is marked as modified.

Parameters:
rowNumber - The row number, an integer from 0 to getRows()-1.
columnNumber - The column number, an integer from 0 to getColumns()-1.
value - The new cell value.
engineProcessed - True if the cell content is to be processed by the repository.
Throws:
ColumnIndexOutOfBoundsException - If columnNumber < 0 or columnNumber >= getColumns().

updateColumn

public void updateColumn(int columnNumber,
                         java.lang.Object value)
                  throws ColumnIndexOutOfBoundsException
Change the value of all cell of a RecordSet column. All the cells are marked as modified.

Parameters:
columnNumber - The column number, an integer from 0 to getColumns()-1.
value - The value to be set in each cell of the column.
Throws:
ColumnIndexOutOfBoundsException - If columnNumber < 0 or columnNumber >= getColumns().