Class MappingReferenceKeyElementImpl

All Implemented Interfaces:
MappingElement, MappingElementProperties, MappingMemberElement, MappingReferenceKeyElement, Comparable, org.netbeans.modules.dbschema.ColumnPairElementHolder, org.netbeans.modules.dbschema.ReferenceKey

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

    • MappingReferenceKeyElementImpl

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

      public MappingReferenceKeyElementImpl(String name)
      Creates new MappingReferenceKeyElementImpl with the corresponding name
      Parameters:
      name - the name of the element
    • MappingReferenceKeyElementImpl

      public MappingReferenceKeyElementImpl(MappingTableElement table) throws ModelException
      Creates new MappingReferenceKeyElementImpl with a corresponding mapping table.
      Parameters:
      table - mapping table element to be used with this key.
      Throws:
      ModelException
  • Method Details

    • getKeyName

      public String getKeyName()
      Get the name of this element.
      Specified by:
      getKeyName in interface org.netbeans.modules.dbschema.ReferenceKey
      Returns:
      the name
    • setKeyName

      public void setKeyName(String name) throws ModelException
      Set the name of this element.
      Specified by:
      setKeyName in interface org.netbeans.modules.dbschema.ReferenceKey
      Parameters:
      name - the name
      Throws:
      ModelException - if impossible
    • getTable

      public MappingTableElement getTable()
      Returns the mapping table element for this referencing key.
      Specified by:
      getTable in interface MappingReferenceKeyElement
      Returns:
      the meta data table for this referencing key
    • setTable

      public void setTable(MappingTableElement table) throws ModelException
      Set the mapping table for this referencing key to the supplied table.
      Specified by:
      setTable in interface MappingReferenceKeyElement
      Parameters:
      table - mapping table element to be used with this key.
      Throws:
      ModelException - if impossible
    • getDeclaringTable

      public org.netbeans.modules.dbschema.TableElement getDeclaringTable()
      Get the declaring table. This method is provided as part of the implementation of the ReferenceKey interface but should only be used when a ReferenceKey object is used or by the runtime.
      Specified by:
      getDeclaringTable in interface org.netbeans.modules.dbschema.ReferenceKey
      Returns:
      the table that owns this reference key element, or null if the element is not attached to any table
    • setDeclaringTable

      public void setDeclaringTable(org.netbeans.modules.dbschema.TableElement tableElement)
      Set the mapping table for this referencing key to the mapping table based on the name of the supplied table. This method is provided as part of the implementation of the ReferenceKey interface but should only be used when a ReferenceKey object is used or by the runtime.
      Specified by:
      setDeclaringTable in interface org.netbeans.modules.dbschema.ReferenceKey
      Parameters:
      tableElement - mapping table element to be used with this key.
    • getReferencedTable

      public org.netbeans.modules.dbschema.TableElement getReferencedTable()
      Get the referenced table of the reference key. This method is provided as part of the implementation of the ReferenceKey interface but should only be used when a ReferenceKey object is used or by the runtime.
      Specified by:
      getReferencedTable in interface org.netbeans.modules.dbschema.ReferenceKey
      Returns:
      the referenced table
    • getColumnPairNames

      public ArrayList getColumnPairNames()
      Returns the list of relative column pair names in this referencing key.
      Specified by:
      getColumnPairNames in interface MappingReferenceKeyElement
      Returns:
      the names of the column pairs in this referencing key
    • getLocalColumns

      public org.netbeans.modules.dbschema.ColumnElement[] getLocalColumns()
      Get all local columns in this reference key. This method is provided as part of the implementation of the ReferenceKey interface but should only be used when a ReferenceKey object is used or by the runtime.
      Specified by:
      getLocalColumns in interface org.netbeans.modules.dbschema.ReferenceKey
      Returns:
      the columns
    • getReferencedColumns

      public org.netbeans.modules.dbschema.ColumnElement[] getReferencedColumns()
      Get all referenced columns in this reference key. This method is provided as part of the implementation of the ReferenceKey interface but should only be used when a ReferenceKey object is used or by the runtime.
      Specified by:
      getReferencedColumns in interface org.netbeans.modules.dbschema.ReferenceKey
      Returns:
      the columns
    • removeColumnPair

      public void removeColumnPair(String pairName) throws ModelException
      Remove a column pair from the holder. This method can be used to remove a pair by name when it cannot be resolved to an actual pair.
      Specified by:
      removeColumnPair in interface MappingReferenceKeyElement
      Parameters:
      pairName - the relative name of the column pair to remove
      Throws:
      ModelException - if impossible
    • removeColumnPairs

      public void removeColumnPairs(ArrayList pairNames) throws ModelException
      Remove some column pairs from the holder. This method can be used to remove pairs by name when they cannot be resolved to actual pairs.
      Specified by:
      removeColumnPairs in interface MappingReferenceKeyElement
      Parameters:
      pairNames - the relative names of the column pairs to remove
      Throws:
      ModelException - if impossible
    • addColumnPair

      public void addColumnPair(org.netbeans.modules.dbschema.ColumnPairElement pair) throws ModelException
      Add a new column pair to the holder.
      Specified by:
      addColumnPair in interface org.netbeans.modules.dbschema.ColumnPairElementHolder
      Specified by:
      addColumnPair in interface MappingReferenceKeyElement
      Parameters:
      pair - the pair to add
      Throws:
      ModelException - if impossible
    • addColumnPairs

      public void addColumnPairs(org.netbeans.modules.dbschema.ColumnPairElement[] pairs) throws ModelException
      Add some new column pairs to the holder.
      Specified by:
      addColumnPairs in interface org.netbeans.modules.dbschema.ColumnPairElementHolder
      Specified by:
      addColumnPairs in interface MappingReferenceKeyElement
      Parameters:
      pairs - the column pairs to add
      Throws:
      ModelException - if impossible
    • removeColumnPair

      public void removeColumnPair(org.netbeans.modules.dbschema.ColumnPairElement pair) throws ModelException
      Remove a column pair from the holder.
      Specified by:
      removeColumnPair in interface org.netbeans.modules.dbschema.ColumnPairElementHolder
      Specified by:
      removeColumnPair in interface MappingReferenceKeyElement
      Parameters:
      pair - the column pair to remove
      Throws:
      ModelException - if impossible
    • removeColumnPairs

      public void removeColumnPairs(org.netbeans.modules.dbschema.ColumnPairElement[] pairs) throws ModelException
      Remove some column pairs from the holder.
      Specified by:
      removeColumnPairs in interface org.netbeans.modules.dbschema.ColumnPairElementHolder
      Specified by:
      removeColumnPairs in interface MappingReferenceKeyElement
      Parameters:
      pairs - the column pairs to remove
      Throws:
      ModelException - if impossible
    • setColumnPairs

      public void setColumnPairs(org.netbeans.modules.dbschema.ColumnPairElement[] pairs) throws ModelException
      Set the column pairs for this holder. Previous column pairs are removed.
      Specified by:
      setColumnPairs in interface org.netbeans.modules.dbschema.ColumnPairElementHolder
      Specified by:
      setColumnPairs in interface MappingReferenceKeyElement
      Parameters:
      pairs - the new column pairs
      Throws:
      ModelException - if impossible
    • getColumnPairs

      public org.netbeans.modules.dbschema.ColumnPairElement[] getColumnPairs()
      Get all column pairs in this holder.
      Specified by:
      getColumnPairs in interface org.netbeans.modules.dbschema.ColumnPairElementHolder
      Returns:
      the column pairs
    • getColumnPair

      public org.netbeans.modules.dbschema.ColumnPairElement getColumnPair(org.netbeans.modules.dbschema.DBIdentifier name)
      Find a column pair by name.
      Specified by:
      getColumnPair in interface org.netbeans.modules.dbschema.ColumnPairElementHolder
      Parameters:
      name - the name of the column pair for which to look
      Returns:
      the column pair or null if not found
    • setReferencingKey

      public void setReferencingKey(ArrayList referencingKey)
      Set the list of of key column names in this referencing key. This method should only be used internally and for cloning and archiving.
      Parameters:
      referencingKey - the list of names of the columns in this referencing key
    • stripSchemaName

      protected void stripSchemaName()
      Boston to Pilsen conversion. This method converts the name of this MappingReferenceKeyElement and the absolute column names stored in _referencingKey to relative names.