java.lang.Object
edu.internet2.middleware.grouper.ext.org.apache.ddlutils.model.Table
All Implemented Interfaces:
Serializable, Cloneable

public class Table extends Object implements Serializable, Cloneable
Represents a table in the database model.
Version:
$Revision: 494338 $
See Also:
  • Constructor Details

    • Table

      public Table()
  • Method Details

    • getCatalog

      public String getCatalog()
      Returns the catalog of this table as read from the database.
      Returns:
      The catalog
    • setCatalog

      public void setCatalog(String catalog)
      Sets the catalog of this table.
      Parameters:
      catalog - The catalog
    • getSchema

      public String getSchema()
      Returns the schema of this table as read from the database.
      Returns:
      The schema
    • setSchema

      public void setSchema(String schema)
      Sets the schema of this table.
      Parameters:
      schema - The schema
    • getType

      public String getType()
      Returns the type of this table as read from the database.
      Returns:
      The type
    • setType

      public void setType(String type)
      Sets the type of this table.
      Parameters:
      type - The type
    • getName

      public String getName()
      Returns the name of the table.
      Returns:
      The name
    • setName

      public void setName(String name)
      Sets the name of the table.
      Parameters:
      name - The name
    • getDescription

      public String getDescription()
      Returns the description of the table.
      Returns:
      The description
    • setDescription

      public void setDescription(String description)
      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

      public Column getColumn(int idx)
      Returns the column at the specified position.
      Parameters:
      idx - The column index
      Returns:
      The column at this position
    • getColumns

      public Column[] getColumns()
      Returns the columns in this table.
      Returns:
      The columns
    • addColumn

      public void addColumn(Column column)
      Adds the given column.
      Parameters:
      column - The column
    • addColumn

      public void addColumn(int idx, Column column)
      Adds the given column at the specified position.
      Parameters:
      idx - The index where to add the column
      column - The column
    • addColumn

      public void addColumn(Column previousColumn, Column column)
      Adds the column after the given previous column.
      Parameters:
      previousColumn - The column to add the new column after; use null for adding at the begin
      column - The column
    • addColumns

      public void addColumns(Collection columns)
      Adds the given columns.
      Parameters:
      columns - The columns
    • removeColumn

      public void removeColumn(Column column)
      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

      public ForeignKey getForeignKey(int idx)
      Returns the foreign key at the given position.
      Parameters:
      idx - The foreign key index
      Returns:
      The foreign key
    • getForeignKeys

      public ForeignKey[] getForeignKeys()
      Returns the foreign keys of this table.
      Returns:
      The foreign keys
    • addForeignKey

      public void addForeignKey(ForeignKey foreignKey)
      Adds the given foreign key.
      Parameters:
      foreignKey - The foreign key
    • addForeignKey

      public void addForeignKey(int idx, ForeignKey foreignKey)
      Adds the given foreign key at the specified position.
      Parameters:
      idx - The index to add the foreign key at
      foreignKey - The foreign key
    • addForeignKeys

      public void addForeignKeys(Collection foreignKeys)
      Adds the given foreign keys.
      Parameters:
      foreignKeys - The foreign keys
    • removeForeignKey

      public void removeForeignKey(ForeignKey foreignKey)
      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

      public Index getIndex(int idx)
      Returns the index at the specified position.
      Parameters:
      idx - The position
      Returns:
      The index
    • addIndex

      public void addIndex(Index index)
      Adds the given index.
      Parameters:
      index - The index
    • addIndex

      public void addIndex(int idx, Index index)
      Adds the given index at the specified position.
      Parameters:
      idx - The position to add the index at
      index - The index
    • addIndices

      public void addIndices(Collection indices)
      Adds the given indices.
      Parameters:
      indices - The indices
    • getIndices

      public Index[] getIndices()
      Returns the indices of this table.
      Returns:
      The indices
    • getNonUniqueIndices

      public Index[] getNonUniqueIndices()
      Gets a list of non-unique indices on this table.
      Returns:
      The unique indices
    • getUniqueIndices

      public Index[] getUniqueIndices()
      Gets a list of unique indices on this table.
      Returns:
      The unique indices
    • removeIndex

      public void removeIndex(Index index)
      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

      public Column findColumn(String name)
      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

      public Column findColumn(String name, boolean caseSensitive)
      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
      caseSensitive - Whether case matters for the names
      Returns:
      The column or null if there is no such column
    • getColumnIndex

      public int getColumnIndex(Column column)
      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

      public Index findIndex(String name)
      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

      public Index findIndex(String name, boolean caseSensitive)
      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
      caseSensitive - Whether case matters for the names
      Returns:
      The index or null if there is no such index
    • findForeignKey

      public ForeignKey findForeignKey(ForeignKey key)
      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

      public ForeignKey findForeignKey(ForeignKey key, boolean caseSensitive)
      Finds the foreign key in this table that is equal to the supplied foreign key.
      Parameters:
      key - The foreign key to search for
      caseSensitive - Whether case matters for the names
      Returns:
      The found foreign key
    • getSelfReferencingForeignKey

      public ForeignKey getSelfReferencingForeignKey()
      Returns the foreign key referencing this table if it exists.
      Returns:
      The self-referencing foreign key if any
    • getPrimaryKeyColumns

      public Column[] getPrimaryKeyColumns()
      Returns the primary key columns of this table.
      Returns:
      The primary key columns
    • getAutoIncrementColumns

      public Column[] 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

      public Object clone() throws CloneNotSupportedException
      Overrides:
      clone in class Object
      Throws:
      CloneNotSupportedException
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toVerboseString

      public String toVerboseString()
      Returns a verbose string representation of this table.
      Returns:
      The string representation