Class Table
java.lang.Object
edu.internet2.middleware.grouper.ext.org.apache.ddlutils.model.Table
- All Implemented Interfaces:
Serializable
,Cloneable
Represents a table in the database model.
- Version:
- $Revision: 494338 $
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the given column at the specified position.void
Adds the given column.void
Adds the column after the given previous column.void
addColumns
(Collection columns) Adds the given columns.void
addForeignKey
(int idx, ForeignKey foreignKey) Adds the given foreign key at the specified position.void
addForeignKey
(ForeignKey foreignKey) Adds the given foreign key.void
addForeignKeys
(Collection foreignKeys) Adds the given foreign keys.void
Adds the given index at the specified position.void
Adds the given index.void
addIndices
(Collection indices) Adds the given indices.clone()
boolean
findColumn
(String name) Finds the column with the specified name, using case insensitive matching.findColumn
(String name, boolean caseSensitive) Finds the column with the specified name, using case insensitive matching.findForeignKey
(ForeignKey key) Finds the foreign key in this table that is equal to the supplied foreign key.findForeignKey
(ForeignKey key, boolean caseSensitive) Finds the foreign key in this table that is equal to the supplied foreign key.Finds the index with the specified name, using case insensitive matching.Finds the index with the specified name, using case insensitive matching.Column[]
Returns the auto increment columns in this table.Returns the catalog of this table as read from the database.getColumn
(int idx) Returns the column at the specified position.int
Returns the number of columns in this table.int
getColumnIndex
(Column column) Determines the index of the given column.Column[]
Returns the columns in this table.Returns the description of the table.getForeignKey
(int idx) Returns the foreign key at the given position.int
Returns the number of foreign keys.Returns the foreign keys of this table.getIndex
(int idx) Returns the index at the specified position.int
Returns the number of indices.Index[]
Returns the indices of this table.getName()
Returns the name of the table.Index[]
Gets a list of non-unique indices on this table.Column[]
Returns the primary key columns of this table.Returns the schema of this table as read from the database.Returns the foreign key referencing this table if it exists.getType()
Returns the type of this table as read from the database.Index[]
Gets a list of unique indices on this table.int
hashCode()
boolean
Determines whether there is at least one primary key column on this table.void
removeColumn
(int idx) Removes the indicated column.void
removeColumn
(Column column) Removes the given column.void
removeForeignKey
(int idx) Removes the indicated foreign key.void
removeForeignKey
(ForeignKey foreignKey) Removes the given foreign key.void
removeIndex
(int idx) Removes the indicated index.void
removeIndex
(Index index) Removes the given index.void
setCatalog
(String catalog) Sets the catalog of this table.void
setDescription
(String description) Sets the description of the table.void
Sets the name of the table.void
Sets the schema of this table.void
Sets the type of this table.void
sortForeignKeys
(boolean caseSensitive) Sorts the foreign keys alphabetically.toString()
Returns a verbose string representation of this table.
-
Constructor Details
-
Table
public Table()
-
-
Method Details
-
getCatalog
Returns the catalog of this table as read from the database.- Returns:
- The catalog
-
setCatalog
Sets the catalog of this table.- Parameters:
catalog
- The catalog
-
getSchema
Returns the schema of this table as read from the database.- Returns:
- The schema
-
setSchema
Sets the schema of this table.- Parameters:
schema
- The schema
-
getType
Returns the type of this table as read from the database.- Returns:
- The type
-
setType
Sets the type of this table.- Parameters:
type
- The type
-
getName
Returns the name of the table.- Returns:
- The name
-
setName
Sets the name of the table.- Parameters:
name
- The name
-
getDescription
Returns the description of the table.- Returns:
- The description
-
setDescription
Sets the description of the table.- Parameters:
description
- The description
-
getColumnCount
public int getColumnCount()Returns the number of columns in this table.- Returns:
- The number of columns
-
getColumn
Returns the column at the specified position.- Parameters:
idx
- The column index- Returns:
- The column at this position
-
getColumns
Returns the columns in this table.- Returns:
- The columns
-
addColumn
Adds the given column.- Parameters:
column
- The column
-
addColumn
Adds the given column at the specified position.- Parameters:
idx
- The index where to add the columncolumn
- The column
-
addColumn
Adds the column after the given previous column.- Parameters:
previousColumn
- The column to add the new column after; usenull
for adding at the begincolumn
- The column
-
addColumns
Adds the given columns.- Parameters:
columns
- The columns
-
removeColumn
Removes the given column.- Parameters:
column
- The column to remove
-
removeColumn
public void removeColumn(int idx) Removes the indicated column.- Parameters:
idx
- The index of the column to remove
-
getForeignKeyCount
public int getForeignKeyCount()Returns the number of foreign keys.- Returns:
- The number of foreign keys
-
getForeignKey
Returns the foreign key at the given position.- Parameters:
idx
- The foreign key index- Returns:
- The foreign key
-
getForeignKeys
Returns the foreign keys of this table.- Returns:
- The foreign keys
-
addForeignKey
Adds the given foreign key.- Parameters:
foreignKey
- The foreign key
-
addForeignKey
Adds the given foreign key at the specified position.- Parameters:
idx
- The index to add the foreign key atforeignKey
- The foreign key
-
addForeignKeys
Adds the given foreign keys.- Parameters:
foreignKeys
- The foreign keys
-
removeForeignKey
Removes the given foreign key.- Parameters:
foreignKey
- The foreign key to remove
-
removeForeignKey
public void removeForeignKey(int idx) Removes the indicated foreign key.- Parameters:
idx
- The index of the foreign key to remove
-
getIndexCount
public int getIndexCount()Returns the number of indices.- Returns:
- The number of indices
-
getIndex
Returns the index at the specified position.- Parameters:
idx
- The position- Returns:
- The index
-
addIndex
Adds the given index.- Parameters:
index
- The index
-
addIndex
Adds the given index at the specified position.- Parameters:
idx
- The position to add the index atindex
- The index
-
addIndices
Adds the given indices.- Parameters:
indices
- The indices
-
getIndices
Returns the indices of this table.- Returns:
- The indices
-
getNonUniqueIndices
Gets a list of non-unique indices on this table.- Returns:
- The unique indices
-
getUniqueIndices
Gets a list of unique indices on this table.- Returns:
- The unique indices
-
removeIndex
Removes the given index.- Parameters:
index
- The index to remove
-
removeIndex
public void removeIndex(int idx) Removes the indicated index.- Parameters:
idx
- The position of the index to remove
-
hasPrimaryKey
public boolean hasPrimaryKey()Determines whether there is at least one primary key column on this table.- Returns:
true
if there are one or more primary key columns
-
findColumn
Finds the column with the specified name, using case insensitive matching. Note that this method is not called getColumn(String) to avoid introspection problems.- Parameters:
name
- The name of the column- Returns:
- The column or
null
if there is no such column
-
findColumn
Finds the column with the specified name, using case insensitive matching. Note that this method is not called getColumn(String) to avoid introspection problems.- Parameters:
name
- The name of the columncaseSensitive
- Whether case matters for the names- Returns:
- The column or
null
if there is no such column
-
getColumnIndex
Determines the index of the given column.- Parameters:
column
- The column- Returns:
- The index or
-1
if it is no column of this table
-
findIndex
Finds the index with the specified name, using case insensitive matching. Note that this method is not called getIndex to avoid introspection problems.- Parameters:
name
- The name of the index- Returns:
- The index or
null
if there is no such index
-
findIndex
Finds the index with the specified name, using case insensitive matching. Note that this method is not called getIndex to avoid introspection problems.- Parameters:
name
- The name of the indexcaseSensitive
- Whether case matters for the names- Returns:
- The index or
null
if there is no such index
-
findForeignKey
Finds the foreign key in this table that is equal to the supplied foreign key.- Parameters:
key
- The foreign key to search for- Returns:
- The found foreign key
-
findForeignKey
Finds the foreign key in this table that is equal to the supplied foreign key.- Parameters:
key
- The foreign key to search forcaseSensitive
- Whether case matters for the names- Returns:
- The found foreign key
-
getSelfReferencingForeignKey
Returns the foreign key referencing this table if it exists.- Returns:
- The self-referencing foreign key if any
-
getPrimaryKeyColumns
Returns the primary key columns of this table.- Returns:
- The primary key columns
-
getAutoIncrementColumns
Returns the auto increment columns in this table. If no incrementcolumns are found, it will return an empty array.- Returns:
- The columns
-
sortForeignKeys
public void sortForeignKeys(boolean caseSensitive) Sorts the foreign keys alphabetically.- Parameters:
caseSensitive
- Whether case matters
-
clone
- Overrides:
clone
in classObject
- Throws:
CloneNotSupportedException
-
equals
-
hashCode
public int hashCode() -
toString
-
toVerboseString
Returns a verbose string representation of this table.- Returns:
- The string representation
-