com.im.commons.db 5.9.2

com.im.commons.db.ddl
Class DBTableInfoImpl

java.lang.Object
  extended by com.im.commons.db.ddl.DBTableInfoImpl
All Implemented Interfaces:
DBTableInfo, Serializable

public class DBTableInfoImpl
extends Object
implements DBTableInfo

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.im.commons.db.ddl.DBTableInfo
DBTableInfo.Type
 
Constructor Summary
protected DBTableInfoImpl()
           
protected DBTableInfoImpl(DBTableInfo.Type type, String schema, String tableName, String sql, boolean readOnly, List<DBColInfo> columns, List<DBForeignKeyInfo> importedFKInfo, List<DBForeignKeyInfo> exportedFKInfo, List<DBConstraintInfo> uniqueConstraints, List<DBIndexInfo> indexInfo, List<DBTriggerInfo> triggerInfo, List<String> primaryKeyColumns)
           
 
Method Summary
 DBTableInfoImpl copy()
           
 boolean equals(Object obj)
           
 DBConstraintInfo findUniqueConstraintNameForColumns(String[] columnNames)
          Retrieves constraint name for the named columns.
static DBTableInfoImpl forTable(String schema, String tableName, List<DBColInfo> columns, List<DBForeignKeyInfo> importedFKInfo, List<DBForeignKeyInfo> exportedFKInfo, List<DBConstraintInfo> uniqueConstraints, List<DBIndexInfo> indexInfo, List<DBTriggerInfo> triggerInfo, List<String> primaryKeyColumns)
           
static DBTableInfoImpl forTableLazy(String schema, String tableName)
           
static DBTableInfoImpl forView(String schema, String viewName, String sql, boolean readOnly, List<DBColInfo> columns)
           
 DBColInfo getColumn(String columnName)
           
 String[] getColumnNamesAsArray()
          Convenience method to get the column names as an array.
 List<String> getColumnNamesAsList()
          Convenience method to get the column names as a list.
 List<DBColInfo> getColumns()
          Getter for property columns.
 long getCreationTime()
           
 List<DBForeignKeyInfo> getExportedFKInfo()
          Get the foreign keys that involve this table but are defined in a foreign key constraint definition that is defined in another table (though possibly this table).
 List<DBForeignKeyInfo> getImportedFKInfo()
          Get the foreign keys that this table defines.
 List<DBIndexInfo> getIndexInfo()
           
 String getName()
           
 List<String> getPrimaryKeyColumns()
          Get the value of primary key columns for the table.
 String getSchema()
           
 String getSQL()
          Getter for SQL that defines this view if it is a view, otherwise null.
 List<DBTriggerInfo> getTriggerInfo()
           
 DBTableInfo.Type getType()
           
 List<DBConstraintInfo> getUniqueConstraints()
           
 int hashCode()
           
 boolean isReadOnly()
           
 String schemaPlusTable()
           
 String toString()
           
 DBTableInfo updateColumns(List<DBColInfo> cols)
           
 DBTableInfo updateExportedForeignKeys(List<DBForeignKeyInfo> fkKeys)
           
 DBTableInfo updateImportedForeignKeys(List<DBForeignKeyInfo> pkKeys)
           
 DBTableInfo updateIndexInfos(List<DBIndexInfo> indexes)
           
 DBTableInfo updateUniqueConstraintInfos(List<DBConstraintInfo> constraints)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DBTableInfoImpl

protected DBTableInfoImpl()

DBTableInfoImpl

protected DBTableInfoImpl(DBTableInfo.Type type,
                          String schema,
                          String tableName,
                          String sql,
                          boolean readOnly,
                          List<DBColInfo> columns,
                          List<DBForeignKeyInfo> importedFKInfo,
                          List<DBForeignKeyInfo> exportedFKInfo,
                          List<DBConstraintInfo> uniqueConstraints,
                          List<DBIndexInfo> indexInfo,
                          List<DBTriggerInfo> triggerInfo,
                          List<String> primaryKeyColumns)
Method Detail

copy

public DBTableInfoImpl copy()
Specified by:
copy in interface DBTableInfo

forTable

public static DBTableInfoImpl forTable(String schema,
                                       String tableName,
                                       List<DBColInfo> columns,
                                       List<DBForeignKeyInfo> importedFKInfo,
                                       List<DBForeignKeyInfo> exportedFKInfo,
                                       List<DBConstraintInfo> uniqueConstraints,
                                       List<DBIndexInfo> indexInfo,
                                       List<DBTriggerInfo> triggerInfo,
                                       List<String> primaryKeyColumns)

forTableLazy

public static DBTableInfoImpl forTableLazy(String schema,
                                           String tableName)

forView

public static DBTableInfoImpl forView(String schema,
                                      String viewName,
                                      String sql,
                                      boolean readOnly,
                                      List<DBColInfo> columns)

getType

public DBTableInfo.Type getType()
Specified by:
getType in interface DBTableInfo

getCreationTime

public long getCreationTime()
Specified by:
getCreationTime in interface DBTableInfo

getSchema

public String getSchema()
Specified by:
getSchema in interface DBTableInfo
Returns:
The schema this item belongs to.

getName

public String getName()
Specified by:
getName in interface DBTableInfo
Returns:
The name.

schemaPlusTable

public String schemaPlusTable()
Specified by:
schemaPlusTable in interface DBTableInfo

getSQL

public String getSQL()
Getter for SQL that defines this view if it is a view, otherwise null.

Specified by:
getSQL in interface DBTableInfo
Returns:
Value of property sql.

isReadOnly

public boolean isReadOnly()
Specified by:
isReadOnly in interface DBTableInfo

getColumn

public DBColInfo getColumn(String columnName)
Specified by:
getColumn in interface DBTableInfo

getColumns

public List<DBColInfo> getColumns()
Getter for property columns.

Specified by:
getColumns in interface DBTableInfo
Returns:
Value of property columns.

updateColumns

public DBTableInfo updateColumns(List<DBColInfo> cols)
Specified by:
updateColumns in interface DBTableInfo

getColumnNamesAsArray

public String[] getColumnNamesAsArray()
Convenience method to get the column names as an array.

Specified by:
getColumnNamesAsArray in interface DBTableInfo
Returns:
The names of the columns.

getColumnNamesAsList

public List<String> getColumnNamesAsList()
Convenience method to get the column names as a list.

Specified by:
getColumnNamesAsList in interface DBTableInfo
Returns:
The names of the columns.

findUniqueConstraintNameForColumns

public DBConstraintInfo findUniqueConstraintNameForColumns(String[] columnNames)
Retrieves constraint name for the named columns. The method will return name of the unique constraint for the given set of columns. The constraint name may be DatabasePlatform.NAME_PRIMARY_KEY_CONSTRAINT, which may be handled differently in some databases - for drop, use DatabasePlatform.sqlDropPrimaryConstraint(String, String, String[]).

Specified by:
findUniqueConstraintNameForColumns in interface DBTableInfo
Parameters:
columnNames - DB columns
Returns:
The constraint, or null if there's no unique constraint.

getImportedFKInfo

public List<DBForeignKeyInfo> getImportedFKInfo()
Get the foreign keys that this table defines. e.g. the primary keys of other tables (or possibly this table) that are referred to in a foreign key constraint definition.

Specified by:
getImportedFKInfo in interface DBTableInfo
Returns:
A list of foreign keys

getExportedFKInfo

public List<DBForeignKeyInfo> getExportedFKInfo()
Get the foreign keys that involve this table but are defined in a foreign key constraint definition that is defined in another table (though possibly this table). e.g. the keys in this table that are referred to in a foreign key constraint definition somewhere.

Specified by:
getExportedFKInfo in interface DBTableInfo
Returns:
A list of foreign keys

getUniqueConstraints

public List<DBConstraintInfo> getUniqueConstraints()
Specified by:
getUniqueConstraints in interface DBTableInfo

updateUniqueConstraintInfos

public DBTableInfo updateUniqueConstraintInfos(List<DBConstraintInfo> constraints)
Specified by:
updateUniqueConstraintInfos in interface DBTableInfo

updateImportedForeignKeys

public DBTableInfo updateImportedForeignKeys(List<DBForeignKeyInfo> pkKeys)
Specified by:
updateImportedForeignKeys in interface DBTableInfo

updateExportedForeignKeys

public DBTableInfo updateExportedForeignKeys(List<DBForeignKeyInfo> fkKeys)
Specified by:
updateExportedForeignKeys in interface DBTableInfo

getIndexInfo

public List<DBIndexInfo> getIndexInfo()
Specified by:
getIndexInfo in interface DBTableInfo

updateIndexInfos

public DBTableInfo updateIndexInfos(List<DBIndexInfo> indexes)
Specified by:
updateIndexInfos in interface DBTableInfo

getPrimaryKeyColumns

public List<String> getPrimaryKeyColumns()
Get the value of primary key columns for the table.

Specified by:
getPrimaryKeyColumns in interface DBTableInfo
Returns:
The primary key columns for the table in the order that they are defined

getTriggerInfo

public List<DBTriggerInfo> getTriggerInfo()
Specified by:
getTriggerInfo in interface DBTableInfo

toString

public String toString()
Overrides:
toString in class Object

equals

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

hashCode

public int hashCode()
Overrides:
hashCode in class Object

com.im.commons.db 5.9.2