Class TableMap

    • Constructor Detail

      • TableMap

        public TableMap​(String tableName,
                        DatabaseMap containingDB)
        Constructor.
        Parameters:
        tableName - The name of the table, may be prefixed with a schema name, not null.
        containingDB - A DatabaseMap that this table belongs to.
      • TableMap

        public TableMap​(String tableName,
                        String prefix,
                        DatabaseMap containingDB)
        Constructor.
        Parameters:
        tableName - The name of the table, may be prefixed with a schema name, not null.
        prefix - The prefix for the table name (ie: SCARAB for SCARAB_PROJECT).
        containingDB - A DatabaseMap that this table belongs to.
    • Method Detail

      • containsColumn

        public boolean containsColumn​(ColumnMap column)
        Does this table contain the specified column?
        Parameters:
        column - A ColumnMap.
        Returns:
        True if the table contains the column.
      • containsColumn

        public boolean containsColumn​(String name)
        Does this table contain the specified column?
        Parameters:
        name - A String with the name of the column.
        Returns:
        True if the table contains the column.
      • getDatabaseMap

        public DatabaseMap getDatabaseMap()
        Get the DatabaseMap containing this TableMap.
        Returns:
        A DatabaseMap.
      • containsObjectColumn

        public boolean containsObjectColumn()
        Returns true if this tableMap contains a column with object data. If the type of the column is not a string, a number or a date, it is assumed that it is object data.
        Returns:
        True if map contains a column with object data.
      • getName

        public String getName()
        Get the name of the Table, not prefixed by a possible schema name
        Returns:
        A String with the name of the table, not null.
      • getSchemaName

        public String getSchemaName()
        Get the schema to which the table belongs to.
        Returns:
        the schema name, or null if the default schema should be used.
      • getFullyQualifiedTableName

        public String getFullyQualifiedTableName()
        Returns the fully qualified table name, if available.
        Returns:
        the fully qualified table name, if a schema is set, or just the table name if no schema is set, not null.
      • getJavaName

        public String getJavaName()
        Get the Java name of the table as defined in XML.
        Returns:
        A String with the Java name of the table.
      • setJavaName

        public void setJavaName​(String value)
        Set the Java name of the table as defined by generator/XML.
        Parameters:
        value - A String with the Java name of the table.
      • getPrefix

        public String getPrefix()
        Get table prefix name.
        Returns:
        A String with the prefix.
      • setPrefix

        public void setPrefix​(String prefix)
        Set table prefix name.
        Parameters:
        prefix - The prefix for the table name (ie: SCARAB for SCARAB_PROJECT).
      • getPrimaryKeyMethod

        public IDMethod getPrimaryKeyMethod()
        Get the method used to generate primary keys for this table.
        Returns:
        A String with the method.
      • getPrimaryKeyMethodInfo

        public Object getPrimaryKeyMethodInfo​(IDMethod idMethod)
        Get the information used to generate a primary key
        Parameters:
        idMethod - IDMethod used to generate a primary key
        Returns:
        An Object.
      • getColumns

        public ColumnMap[] getColumns()
        Get a ColumnMap[] of the columns in this table.
        Returns:
        A ColumnMap[].
      • getForeignKeys

        public List<ForeignKeyMap> getForeignKeys()
        Get all foreign keys in the table..
        Returns:
        All foreign keys, not null.
      • getColumn

        public ColumnMap getColumn​(String name)
        Get a ColumnMap for the named table.
        Parameters:
        name - A String with the name of the table.
        Returns:
        A ColumnMap.
      • addColumn

        public void addColumn​(ColumnMap cmap)
        Add a pre-created column to this table. It will replace any existing column.
        Parameters:
        cmap - A ColumnMap.
      • addForeignKey

        public void addForeignKey​(ForeignKeyMap foreignKey)
        Add a foreign key to this table.
        Parameters:
        foreignKey - the foreign key map, not null
      • setPrimaryKeyMethod

        public void setPrimaryKeyMethod​(IDMethod method)
        Sets the method used to generate a key for this table. Valid values are as specified in the IDMethod interface.
        Parameters:
        method - The ID generation method type, not null.
      • setPrimaryKeyMethodInfo

        public void setPrimaryKeyMethodInfo​(Object pkInfo)
        Sets the pk information needed to generate a key. This overrides all information set by setPrimaryKeyMethodInfo(String, Object).
        Parameters:
        pkInfo - information needed to generate a key
      • setPrimaryKeyMethodInfo

        public void setPrimaryKeyMethodInfo​(IDMethod idMethod,
                                            Object pkInfo)
        Sets the pk information needed to generate a key.
        Parameters:
        idMethod - the id method for which this information is stored.
        pkInfo - information needed to generate a key.
      • removeUnderScores

        public final String removeUnderScores​(String data)
        Removes the PREFIX, removes the underscores and makes first letter caps. SCARAB_FOO_BAR becomes FooBar.
        Parameters:
        data - A String.
        Returns:
        A String with data processed.
      • getDescription

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

        public void setDescription​(String description)
        Sets the table description.
        Parameters:
        description - The description to set.
      • getOMClass

        public Class<?> getOMClass()
        Returns the OM class for this table.
        Returns:
        the OM class.
      • setOMClass

        public void setOMClass​(Class<?> omClass)
        Sets the OM root class for this table.
        Parameters:
        omClass - The OM root class for this table.
      • getPeerClass

        public Class<?> getPeerClass()
        Returns the Peer Class for this table.
        Returns:
        The peerClass for this table.
      • setPeerClass

        public void setPeerClass​(Class<?> peerClass)
        Sets the Peer class for this table.
        Parameters:
        peerClass - The peerClass to set.
      • getDbMap

        public DatabaseMap getDbMap()
        Returns the database map for this table.
        Returns:
        the database map for this table.
      • isUseInheritance

        public boolean isUseInheritance()
        Returns whether this table uses inheritance.
        Returns:
        whether inheritance is used.
      • setUseInheritance

        public void setUseInheritance​(boolean useInheritance)
        Sets whether this table uses inheritance.
        Parameters:
        useInheritance - whether this table uses inheritance.
      • isUseManager

        public boolean isUseManager()
        Returns whether managers are used for this table.
        Returns:
        whether managers are used for this table.
      • setUseManager

        public void setUseManager​(boolean useManager)
        Sets whether managers are used for this table.
        Parameters:
        useManager - whether managers are used for this table.
      • getManagerClass

        public Class<?> getManagerClass()
        Returns the manager class for this table.
        Returns:
        the managerClass.
      • setManagerClass

        public void setManagerClass​(Class<?> managerClass)
        Sets the manager class for this table.
        Parameters:
        managerClass - the manager class for this table.
      • getPrimaryKey

        public ColumnMap getPrimaryKey()
                                throws TorqueException
        Returns the single primary key of this table, if it exists
        Returns:
        the single primary key column.
        Throws:
        TorqueException - If the table has no primary key or if the table has multiple primary keys.