Class TableMetaData


  • public class TableMetaData
    extends java.lang.Object
    Database meta data for a table that is part of the model.
    Author:
    harald
    • Constructor Summary

      Constructors 
      Constructor Description
      TableMetaData​(ModelMetaData modelMetaData, java.lang.String modelTableName)
      Creates a table meta instance.
    • Constructor Detail

      • TableMetaData

        public TableMetaData​(ModelMetaData modelMetaData,
                             java.lang.String modelTableName)
        Creates a table meta instance.
        Parameters:
        modelMetaData - the model this table belongs to
        modelTableName - the tablename used in the model
    • Method Detail

      • setupTableFromMetaData

        public void setupTableFromMetaData​(java.sql.DatabaseMetaData metaData,
                                           java.lang.String[] schemas,
                                           java.lang.String schemaPattern,
                                           java.lang.String tablePattern)
                                    throws java.sql.SQLException
        Sets up the column from the database meta data result.
        Parameters:
        metaData - the database metadata
        schemas - valid schemas to scan, null if all
        schemaPattern - the schema (null if none, "" if without schema)
        tablePattern - the table pattern
        Throws:
        java.sql.SQLException - the processing failed
        BackendException - if logical meta data processing error
      • getModelMetaData

        public ModelMetaData getModelMetaData()
        Gets the model this table belongs to.
        Returns:
        the model
      • getModelTableName

        public java.lang.String getModelTableName()
        Gets the table name used in the model.
        Returns:
        the model's tablename
      • getSchemaName

        public java.lang.String getSchemaName()
        Gets the database schema name.
        Always in lowercase.
        Returns:
        the schema, null if none
      • getTableName

        public java.lang.String getTableName()
        Gets the database table name.
        Always in lowercase.
        Returns:
        the table name (without schema)
      • getFullTableName

        public java.lang.String getFullTableName()
        Gets the database table name with optional schemaname prepended.
        Always in lowercase.
        Returns:
        the full table name
      • getComment

        public java.lang.String getComment()
        Gets the comment.
        Returns:
        the comment, null if none
      • setComment

        public void setComment​(java.lang.String comment)
        Sets the comment.
        Parameters:
        comment - the comment, null if none
      • getColumns

        public java.util.Collection<ColumnMetaData> getColumns()
        Gets the meta data for columns.
        Returns:
        the columns
      • getColumnByName

        public ColumnMetaData getColumnByName​(java.lang.String columnName)
        Gets a column by its column name.
        Parameters:
        columnName - the column name
        Returns:
        the column, null if no such column
      • getIndexes

        public java.util.Collection<IndexMetaData> getIndexes()
        Gets the meta data for indexes.
        Returns:
        the indexes
      • getForeignKeys

        public java.util.Collection<ForeignKeyMetaData> getForeignKeys()
        Gets the foreign keys.
        Returns:
        the foreign keys
      • validate

        public void validate()
        Validates and postprocesses the table data.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object