|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.dse.tools.workbench.base.AbstractTable
This class represents a generic database table
Field Summary | |
protected java.lang.String |
alias
The Table Name Alias, Used to generate PK Names |
protected CheckConstraint[] |
checks
The list of column check constraints |
protected int[] |
columnLengths
The list of column lengths |
protected java.lang.String[] |
columns
The list of column names |
static char |
DATA_DELIMITER
The delimiter for the data in data exchange files (Imports and Exports) |
static char |
DATA_SEPARATOR
The separator for the data in data exchange files (Imports and Exports) |
protected java.util.Hashtable |
deletedRows
The list of deleted rows since the last commit or rollback |
static char |
ESCAPE_SEQUENCE
The escape sequence for the data in data exchange files (Imports and Exports) |
protected java.util.Hashtable |
fks
The list of foreign keys with other tables |
protected Index[] |
indexes
The list of indexes |
protected java.util.Hashtable |
insertedRows
The list of inserted rows since the last commit or rollback |
protected java.util.Hashtable |
modifiedRows
The list of modified rows since the last commit or rollback |
protected java.lang.String |
name
The name of the table |
protected int[] |
pk
The list of columns in the primary key |
protected Relationship[] |
relations
The list of relationships with other tables |
protected Repository |
repository
The repository where the table is located |
protected boolean[] |
required
The list of column mandatory indicators |
protected OrderedHashtable |
rows
The list of cached rows |
protected boolean |
triggers
Switch to deactivate triggers when importing data |
Fields inherited from interface com.ibm.dse.tools.workbench.base.TableNames |
ALLOWED_VALUES,
ATTRIBUTES,
DOMAINS,
ENTITIES,
ENTITIES_ENTITIES,
GROUPS,
GROUPS_ENTITIES,
GROUPS_GROUPS,
GROUPS_INSTANCES,
INSTANCE_ERRORS,
INSTANCES,
PROPERTIES,
USERS |
Constructor Summary | |
AbstractTable()
This constructor creates an AbstractTable object |
|
AbstractTable(Repository repository)
This constructor creates an AbstractTable object in a repository. |
Method Summary | |
void |
add(TableRow row)
This method adds a row to the list of rows. |
boolean |
areTriggersActive()
This method returns the triggers state |
void |
cleanRollbackData()
This method cleans the lists of inserted, modified and deleted rows, and marks them as commited. |
int |
count(Clause where)
This method counts the rows that accomplish the conditions in the where clause |
abstract void |
createRelations()
This method creates the relationships for a table |
TableRow |
createTableRow()
This method creates a new TableRow object for this table. |
TableRow |
createTableRow(boolean isNew,
java.lang.String[] values)
This method creates a TableRow object for this table with a list of values for the columns. |
void |
exportToFile(java.io.Writer w)
This method sends the table data to a file writer. |
void |
flush()
This method persists the modifications, creations or deletions of rows in this table |
java.lang.String |
getAlias()
This method returns the table alias. |
CheckConstraint[] |
getChecks()
Returns the list of check constraints for this table |
CheckConstraint[] |
getChecks(int column)
Returns the list of check constraints for a column of the table |
int[] |
getColumnLengths()
Returns the list of column lengths. |
java.lang.String[] |
getColumns()
Returns the list of column names for this table |
java.lang.String |
getColumnsString(int[] columnsList,
java.lang.String separator)
This method constructs a String with column names to use in clauses like select, order by, insert, ... |
java.lang.String |
getColumnsString(java.lang.String separator)
This method constructs a String with all column names to use in clauses like select... |
java.sql.Connection |
getConnection()
Returns the connection to the database for this table |
java.lang.String[] |
getCreateChecksStrings()
This method returns the list of sentences to create the check constraints for the table. |
java.lang.String[] |
getCreateFksStrings()
This method returns the list of sentences to create the foreign keys for the table. |
java.lang.String[] |
getCreateIndexesStrings()
This method returns the list of sentences to create the indexes for the table. |
java.lang.String |
getCreatePkString()
This method returns the sentence to create the primary key for the table. |
java.lang.String |
getCreateTableString()
This method returns the sentence to create the table. |
java.lang.String |
getDefaultVersion()
Returns a default version code |
java.util.Hashtable |
getFks()
Returns the list of foreign keys that this table has with other tables |
Index[] |
getIndexes()
Returns the list of indexes. |
java.lang.String |
getName()
Returns the name of the table |
int[] |
getPk()
Returns the list of column identifiers that are part of the primary key of this table |
java.lang.String |
getPkValue(TableRow row)
Returns the Values in the primary key of a row in a String with separators |
TableRow[] |
getRelated(int relation,
java.lang.String[] values,
Clause where,
int[] orderBy)
Returns the rows of another table based on a relationship |
Relationship[] |
getRelations()
Returns the list of relationships that this table has with other tables |
Repository |
getRepository()
Returns repository in which this table is created |
java.lang.String |
getTimestamp()
Returns a timestamp value |
java.lang.String |
getUniqueValue()
Returns a unique value for generation of unique identifiers (primary keys) purpose |
abstract boolean |
hasSelfGeneratedPk()
This method indicates if the field in the primary key must be generated automatically |
void |
importFromString(java.lang.String s)
This method inserts data into the table from a String that can be read from a stream |
boolean |
isInPk(int column)
Checks if a column is part of the primary key |
boolean |
isRequired(int column)
Checks if a column in the table is mandatory |
void |
postDelete(TableRow row)
This method is called after a row is deleted |
void |
postInsert(TableRow row)
This method is called after a row is inserted |
void |
postUpdate(TableRow row)
This method is called after a row is updated |
void |
preDelete(TableRow row)
This method is called before deleting a row |
void |
preInsert(TableRow row)
This method is called before inserting a row |
void |
preUpdate(TableRow row)
This method is called before modifying a row |
void |
registerDeletedRow(TableRow row)
This method adds a row to the list of deleted rows |
void |
registerInsertedRow(TableRow row)
This method adds a row to the list of inserted rows |
void |
registerModifiedRow(TableRow row)
This method adds a row to the list of modified rows |
void |
removeFromList(TableRow row)
This method removes a row from the list of rows |
void |
restoreRows()
This method restores the mapped rows when doing a rollback |
TableRow[] |
retrieveAll(Clause where,
int[] orderBy)
Returns all the rows that accomplish the conditions in the where Clause |
TableRow |
retrieveByPk(java.lang.String[] values)
Returns the row corresponding to the values of the primary key |
java.lang.String[] |
retrieveDistinct(int column,
Clause where)
This method retrieves the distinct values in a column in the rows that accomplish the conditions in a where clause |
protected void |
setAlias(java.lang.String newAlias)
This method sets the alias for the table |
void |
setRepository(Repository repository)
Sets the repository where this table is located |
void |
setTriggersState(boolean active)
This method sets the triggers state |
abstract java.lang.String[] |
validate(TableRow row)
This abstract method must validate the correctness of a row based on the rules of each object |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected java.lang.String[] columns
protected boolean[] required
protected int[] columnLengths
protected java.lang.String name
protected int[] pk
protected Relationship[] relations
protected CheckConstraint[] checks
protected Index[] indexes
protected Repository repository
protected OrderedHashtable rows
protected java.util.Hashtable fks
protected java.lang.String alias
public static final char DATA_DELIMITER
public static final char ESCAPE_SEQUENCE
public static final char DATA_SEPARATOR
protected java.util.Hashtable modifiedRows
protected java.util.Hashtable insertedRows
protected java.util.Hashtable deletedRows
protected boolean triggers
Constructor Detail |
public AbstractTable()
public AbstractTable(Repository repository)
repository
- com.ibm.dse.tools.workbench.base.DefaultRepositoryMethod Detail |
public void add(TableRow row)
row
- com.ibm.dse.tools.workbench.base.TableRowpublic boolean areTriggersActive()
public void cleanRollbackData()
public int count(Clause where) throws RepositoryException
where
- com.ibm.dse.tools.workbench.base.Clause The where clause to applypublic abstract void createRelations() throws WBInvalidArgumentException
public TableRow createTableRow() throws WorkbenchException
public TableRow createTableRow(boolean isNew, java.lang.String[] values) throws WorkbenchException
It can be new or retrieved
isNew
- booleanvalues
- java.lang.String[]public void exportToFile(java.io.Writer w) throws WorkbenchException, java.io.IOException
w
- java.io.Writerpublic void flush() throws RepositoryException
public java.lang.String getAlias()
public CheckConstraint[] getChecks()
public CheckConstraint[] getChecks(int column)
column
- intpublic int[] getColumnLengths()
public java.lang.String[] getColumns()
public java.lang.String getColumnsString(int[] columnsList, java.lang.String separator)
columnsList
- int[] The list of column identifiers to concatseparator
- java.lang.String The separator between column namespublic java.lang.String getColumnsString(java.lang.String separator)
separator
- java.lang.String The separator between column namespublic java.sql.Connection getConnection()
public java.lang.String[] getCreateChecksStrings()
public java.lang.String[] getCreateFksStrings()
public java.lang.String[] getCreateIndexesStrings()
public java.lang.String getCreatePkString()
public java.lang.String getCreateTableString()
public java.lang.String getDefaultVersion()
public java.util.Hashtable getFks()
public Index[] getIndexes()
public java.lang.String getName()
public int[] getPk()
public java.lang.String getPkValue(TableRow row)
row
- com.ibm.dse.tools.workbench.base.TableRowpublic TableRow[] getRelated(int relation, java.lang.String[] values, Clause where, int[] orderBy) throws WorkbenchException
relation
- int The relationship identifiervalues
- java.lang.String[] The list of values to apply to the columns of the relationshipwhere
- com.ibm.dse.tools.workbench.base.Clause The where clause to add to the conditions of relationshiporderBy
- int[] The list of columns used to order the resultspublic Relationship[] getRelations()
public Repository getRepository()
public java.lang.String getTimestamp()
public java.lang.String getUniqueValue()
public abstract boolean hasSelfGeneratedPk()
public void importFromString(java.lang.String s) throws WorkbenchException
s
- java.lang.Stringpublic boolean isInPk(int column)
column
- int The column to checkpublic boolean isRequired(int column)
column
- int The identifier of the column to checkpublic void postDelete(TableRow row) throws RepositoryException
row
- com.ibm.dse.tools.workbench.base.TableRowpublic void postInsert(TableRow row) throws RepositoryException
row
- com.ibm.dse.tools.workbench.base.TableRowpublic void postUpdate(TableRow row) throws RepositoryException
row
- com.ibm.dse.tools.workbench.base.TableRowpublic void preDelete(TableRow row) throws RepositoryException
row
- com.ibm.dse.tools.workbench.base.TableRowpublic void preInsert(TableRow row) throws RepositoryException
row
- com.ibm.dse.tools.workbench.base.TableRowpublic void preUpdate(TableRow row) throws RepositoryException
row
- com.ibm.dse.tools.workbench.base.TableRowpublic void registerDeletedRow(TableRow row)
row
- com.ibm.dse.tools.workbench.base.TableRowpublic void registerInsertedRow(TableRow row)
row
- com.ibm.dse.tools.workbench.base.TableRowpublic void registerModifiedRow(TableRow row)
row
- com.ibm.dse.tools.workbench.base.TableRowpublic void removeFromList(TableRow row)
(does not deletes the row from the repository)
com.ibm.dse.tools.workbench.base.TableRow
- The row to be removedpublic void restoreRows()
public TableRow[] retrieveAll(Clause where, int[] orderBy) throws WorkbenchException
The rows retrieved are added to the list, for cache purpose
where
- com.ibm.dse.tools.workbench.base.Clause The where clause to accomplishorderBy
- int[] The list of column identifiers used to order the resultspublic TableRow retrieveByPk(java.lang.String[] values) throws WorkbenchException
The row retrieved is added to the list, for cache purpose
values
- String[] The values of the primary key componentspublic java.lang.String[] retrieveDistinct(int column, Clause where) throws WorkbenchException
column
- intwhere
- com.ibm.dse.tools.workbench.base.Clauseprotected void setAlias(java.lang.String newAlias)
newAlias
- java.lang.Stringpublic void setRepository(Repository repository)
repository
- com.ibm.dse.tools.workbench.base.Repository The repository to setpublic void setTriggersState(boolean active)
active
- booleanpublic abstract java.lang.String[] validate(TableRow row)
It returns the list of error strings or null if there are no errors
com.ibm.dse.tools.workbench.base.TableRow
- the row to validate
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |