Class DatabaseConnection.TriggeredOldNewDataSource
- java.lang.Object
-
- com.mckoi.database.GTDataSource
-
- com.mckoi.database.DatabaseConnection.TriggeredOldNewDataSource
-
- All Implemented Interfaces:
MutableTableDataSource,TableDataSource
- Enclosing class:
- DatabaseConnection
private static class DatabaseConnection.TriggeredOldNewDataSource extends GTDataSource
A MutableTableDataSource implementation that is used for trigger actions to represent the data in the OLD and NEW tables.
-
-
Field Summary
Fields Modifier and Type Field Description private RowDatacontentprivate booleanimmutableprivate DataTableDeftable_def
-
Constructor Summary
Constructors Constructor Description TriggeredOldNewDataSource(TransactionSystem system, DataTableDef table_def)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intaddRow(RowData row_data)Adds a row to the source.voidconstraintIntegrityCheck()Performs all constraint integrity checks and actions to any modifications based on any changes that happened to the table since that last call to this method.voidflushIndexChanges()Flushes all changes made on this MutableTableDataSource to the backing index scheme (IndexSet).TObjectgetCellContents(int column, int row)Returns an object that represents the information in the given cell in the table.DataTableDefgetDataTableDef()Returns a DataTableDef object that defines the layout of the table that this data is in.MasterTableJournalgetJournal()Returns a journal that details the changes to this data source since it was created.intgetRowCount()Returns the number of rows in this data source.voidremoveRow(int row_index)Completely removes a row from the source.(package private) voidsetImmutable(boolean im)(package private) voidsetRowData(RowData row_data)intupdateRow(int row_index, RowData row_data)Updates a row in the source.-
Methods inherited from class com.mckoi.database.GTDataSource
addRootLock, booleanColumn, columnValue, dateColumn, dispose, getColumnScheme, getSystem, numericColumn, removeRootLock, rowEnumeration, stringColumn
-
-
-
-
Field Detail
-
table_def
private DataTableDef table_def
-
content
private RowData content
-
immutable
private boolean immutable
-
-
Constructor Detail
-
TriggeredOldNewDataSource
public TriggeredOldNewDataSource(TransactionSystem system, DataTableDef table_def)
Constructor.
-
-
Method Detail
-
setImmutable
void setImmutable(boolean im)
-
setRowData
void setRowData(RowData row_data)
-
getDataTableDef
public DataTableDef getDataTableDef()
Description copied from interface:TableDataSourceReturns a DataTableDef object that defines the layout of the table that this data is in.This may return 'null' if there is no table definition.
- Specified by:
getDataTableDefin interfaceTableDataSource- Specified by:
getDataTableDefin classGTDataSource
-
getRowCount
public int getRowCount()
Description copied from interface:TableDataSourceReturns the number of rows in this data source.NOTE: Returns 'n' - getCellContents(column, row) is not necessarily valid for row = [0..n]. Use 'rowEnumerator' to generate an iterator for valid row values over this data source.
- Specified by:
getRowCountin interfaceTableDataSource- Specified by:
getRowCountin classGTDataSource
-
getCellContents
public TObject getCellContents(int column, int row)
Description copied from interface:TableDataSourceReturns an object that represents the information in the given cell in the table. This may be an expensive operation, so calls to it should be kept to a minimum. Note that the offset between two rows is not necessarily 1. Use 'rowEnumeration' to create a row iterator.- Specified by:
getCellContentsin interfaceTableDataSource- Specified by:
getCellContentsin classGTDataSource
-
addRow
public int addRow(RowData row_data)
Description copied from interface:MutableTableDataSourceAdds a row to the source. This will add a permanent record into the the underlying data structure. It will also update the indexing schemes as appropriate, and also add the row into the set returned by the 'rowEnumeration' iterator.It returns a row index that is used to reference this data in future queries. Throws an exception if the row additional was not possible because of IO reasons.
- Specified by:
addRowin interfaceMutableTableDataSource- Overrides:
addRowin classGTDataSource
-
removeRow
public void removeRow(int row_index)
Description copied from interface:MutableTableDataSourceCompletely removes a row from the source. This will permanently remove the record from the underlying data structure. It also updates the indexing schemes and removes the row index from the set returned by the 'rowEnumeration' iterator.Throws an exception if the row index does not reference a valid row within the context of this data source.
- Specified by:
removeRowin interfaceMutableTableDataSource- Overrides:
removeRowin classGTDataSource
-
updateRow
public int updateRow(int row_index, RowData row_data)Description copied from interface:MutableTableDataSourceUpdates a row in the source. This will make a permanent change to the underlying data structure. It will update the indexing schemes as appropriate, and also add the row into the set returned by the 'rowEnumeration' iterator.It returns a row index for the new updated records. Throws an exception if the row update was not possible because of IO reasons or the row index not being a valid reference to a record in this data source.
- Specified by:
updateRowin interfaceMutableTableDataSource- Overrides:
updateRowin classGTDataSource
-
getJournal
public MasterTableJournal getJournal()
Description copied from interface:MutableTableDataSourceReturns a journal that details the changes to this data source since it was created. This method may return a 'null' object to denote that no logging is being done. If this returns a MasterTableJournal, then all 'addRow' and 'removeRow' method calls and their relative order will be described in this journal.- Specified by:
getJournalin interfaceMutableTableDataSource- Overrides:
getJournalin classGTDataSource
-
flushIndexChanges
public void flushIndexChanges()
Description copied from interface:MutableTableDataSourceFlushes all changes made on this MutableTableDataSource to the backing index scheme (IndexSet). This is used during the commit phase of this objects lifetime. The transaction control mechanism has found that there are no clashes and now we need to commit the current table view to the conglomerate. Because this object may not update index information immediately, we call this to flush all the changes to the table to the backing index set.When this method returns, the backing IndexSet of this view will be completely up to date.
- Specified by:
flushIndexChangesin interfaceMutableTableDataSource- Overrides:
flushIndexChangesin classGTDataSource
-
constraintIntegrityCheck
public void constraintIntegrityCheck()
Description copied from interface:MutableTableDataSourcePerforms all constraint integrity checks and actions to any modifications based on any changes that happened to the table since that last call to this method. It is important that is called after any call to 'addRow', 'removeRow' or 'updateRow'.Any constraints that are marked as INITIALLY_IMMEDIATE are checked when this is called, otherwise the constraint is checked at commit time.
Any referential actions are performed when this method is called. If a referential action causes a modification to another table, this method is recursively called on the table modified.
If a referential integrity constraint is violated and a referential action is unable to maintain the integrity of the database, any changes made to the table are reverted.
- Specified by:
constraintIntegrityCheckin interfaceMutableTableDataSource- Overrides:
constraintIntegrityCheckin classGTDataSource
-
-