Class MappingTableElementImpl

All Implemented Interfaces:
MappingElement, MappingElementProperties, MappingMemberElement, MappingTableElement, Comparable

public class MappingTableElementImpl extends MappingMemberElementImpl implements MappingTableElement
Version:
%I%
Author:
Mark Munro, Rochelle Raccah
  • Constructor Details

    • MappingTableElementImpl

      public MappingTableElementImpl()
      Create new MappingTableElementImpl with no corresponding name or declaring class. This constructor should only be used for cloning and archiving.
    • MappingTableElementImpl

      public MappingTableElementImpl(String name, MappingClassElement declaringClass)
      Create new MappingTableElementImpl with the corresponding name and declaring class.
      Parameters:
      name - the name of the element
      declaringClass - the class to attach to
    • MappingTableElementImpl

      public MappingTableElementImpl(org.netbeans.modules.dbschema.TableElement table, MappingClassElement declaringClass) throws ModelException
      Creates new MappingTableElementImpl with a corresponding table and declaring class.
      Parameters:
      table - table element to be used by the mapping table.
      declaringClass - the class to attach to
      Throws:
      ModelException
  • Method Details

    • getTable

      public String getTable()
      Returns the name of the table element used by this mapping table.
      Specified by:
      getTable in interface MappingTableElement
      Returns:
      the table name for this mapping table
    • setTable

      public void setTable(org.netbeans.modules.dbschema.TableElement table) throws ModelException
      Set the table element for this mapping table to the supplied table.
      Specified by:
      setTable in interface MappingTableElement
      Parameters:
      table - table element to be used by the mapping table.
      Throws:
      ModelException - if impossible
    • setName

      public void setName(String name) throws ModelException
      Override method in MappingElementImpl to set the _table variable if necessary (used for unarchiving).
      Specified by:
      setName in interface MappingElement
      Overrides:
      setName in class MappingElementImpl
      Parameters:
      name - the name
      Throws:
      ModelException - if impossible
    • isEqual

      public boolean isEqual(org.netbeans.modules.dbschema.TableElement table)
      Returns true if the table element used by this mapping table is equal to the supplied table.
      Specified by:
      isEqual in interface MappingTableElement
      Returns:
      true if table elements are equal, false otherwise.
    • getKey

      public ArrayList getKey()
      Returns the list of column names in the primary key for this mapping table.
      Specified by:
      getKey in interface MappingTableElement
      Returns:
      the names of the columns in the primary key for this mapping table
    • addKeyColumn

      public void addKeyColumn(org.netbeans.modules.dbschema.ColumnElement column) throws ModelException
      Adds a column to the primary key of columns in this mapping table. This method should only be used to manipulate the key columns of the primary table. The secondary table key columns should be manipulated using MappingReferenceKeyElement methods for pairs.
      Specified by:
      addKeyColumn in interface MappingTableElement
      Parameters:
      column - column element to be added
      Throws:
      ModelException - if impossible
    • addKeyColumnInternal

      protected void addKeyColumnInternal(org.netbeans.modules.dbschema.ColumnElement column) throws ModelException
      Adds a column to the primary key of columns in this mapping table. This method is used internally to manipulate primary key columns that have passed the null and duplicate tests in addKeyColumn and secondary table key columns when pairs are being set up and ignoring duplicates is done at the pair level.
      Parameters:
      column - column element to be added
      Throws:
      ModelException - if impossible
    • removeKeyColumn

      public void removeKeyColumn(String columnName) throws ModelException
      Removes a column from the primary key of columns in this mapping table. This method should only be used to manipulate the key columns of the primary table. The secondary table key columns should be manipulated using MappingReferenceKeyElement methods for pairs.
      Specified by:
      removeKeyColumn in interface MappingTableElement
      Parameters:
      columnName - the relative name of the column to be removed
      Throws:
      ModelException - if impossible
    • getReferencingKeys

      public ArrayList getReferencingKeys()
      Returns the list of keys (MappingReferenceKeyElements) for this mapping table. There will be keys for foreign keys and "fake" foreign keys.
      Specified by:
      getReferencingKeys in interface MappingTableElement
      Returns:
      the reference key elements for this mapping table
    • addReferencingKey

      public void addReferencingKey(MappingReferenceKeyElement referencingKey) throws ModelException
      Adds a referencing key to the list of keys in this mapping table.
      Specified by:
      addReferencingKey in interface MappingTableElement
      Parameters:
      referencingKey - referencing key element to be added
      Throws:
      ModelException - if impossible
    • removeReference

      public void removeReference(MappingTableElement table) throws ModelException
      Removes the referencing key for the supplied table element from list of keys in this mapping table.
      Specified by:
      removeReference in interface MappingTableElement
      Parameters:
      table - mapping table element for which to remove referencing keys
      Throws:
      ModelException - if impossible
    • getTableObject

      public org.netbeans.modules.dbschema.TableElement getTableObject()
      Returns the table element (TableElement) used by this mapping table. This method should only be used by the runtime.
      Returns:
      the table element for this mapping table
    • getKeyObjects

      public ArrayList getKeyObjects()
      Returns the list of columns (ColumnElements) in the primary key for this mapping table. This method should only be used by the runtime.
      Returns:
      the column elements in the primary key for this mapping table
    • setTable

      public void setTable(String table)
      Set the name of the table element used by this mapping table. This method should only be used internally and for cloning and archiving.
      Parameters:
      table - the table name for this mapping table
    • setKey

      public void setKey(ArrayList key)
      Set the list of column names in the primary key for this mapping table. This method should only be used internally and for cloning and archiving.
      Parameters:
      key - the list of names of the columns in the primary key for this mapping table
    • setReferencingKeys

      public void setReferencingKeys(ArrayList referencingKeys)
      Set the list of keys (MappingReferenceKeyElements) for this mapping table. This method should only be used internally and for cloning and archiving.
      Parameters:
      referencingKeys - the list of reference key elements for this mapping table
    • stripSchemaName

      protected void stripSchemaName()
      Boston to Pilsen conversion. This method converts the absolute db element names to relative names. This affects the name of the MappingTableElement itself and the column names stored in _keys. The method is recursively called for all MappingReferenceKeyElements attached to this MappingTableElement.