Interface MappingReferenceKeyElement

All Superinterfaces:
org.netbeans.modules.dbschema.ColumnPairElementHolder, Comparable, MappingElement, MappingElementProperties, MappingMemberElement, org.netbeans.modules.dbschema.ReferenceKey
All Known Implementing Classes:
MappingReferenceKeyElementImpl

public interface MappingReferenceKeyElement extends MappingMemberElement, org.netbeans.modules.dbschema.ReferenceKey
This is an element which represents a relationship between two tables (primary and secondary). It should not be used for relationship fields (MappingRelationshipElement has its own set of pairs). It can be thought of as a "fake foreign key" meaning it designates the column pairs used to join the primary table with a secondary table. It is analagous to a foreign key and may in fact contain identical pairs as the foreign key, but this is not a requirement. The foreign key may define a different set of pairs or may not exist at all. Although any set of pairs is legal, the user should be careful to define pairs which represent a logical relationship between the two tables. The relationship should be set up as follows: First, set a primary table for the mapping class. Doing this sets up a "fake primary key" for the associated mapping table element. Next, add a secondary table and set up the pairs which establish the connection on the returned reference key object. This sets up whatever "fake primary key" information is necessary on the secondary table's mapping table, establishes the primary to secondary relationship via the reference keys, and puts the pair information into the "fake foreign key".
Version:
%I%
Author:
Mark Munro, Rochelle Raccah
  • Method Details

    • getTable

      Returns the mapping table element for this referencing key.
      Returns:
      the meta data table for this referencing key
    • setTable

      void setTable(MappingTableElement table) throws ModelException
      Set the mapping table for this referencing key to the supplied table.
      Parameters:
      table - mapping table element to be used with this key.
      Throws:
      ModelException - if impossible
    • getColumnPairNames

      ArrayList getColumnPairNames()
      Returns the list of relative column pair names in this referencing key.
      Returns:
      the names of the column pairs in this referencing key
    • removeColumnPair

      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.
      Parameters:
      pairName - the relative name of the column pair to remove
      Throws:
      ModelException - if impossible
    • removeColumnPairs

      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.
      Parameters:
      pairNames - the relative names of the column pairs to remove
      Throws:
      ModelException - if impossible
    • addColumnPair

      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
      Parameters:
      pair - the pair to add
      Throws:
      ModelException - if impossible
    • addColumnPairs

      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
      Parameters:
      pairs - the column pairs to add
      Throws:
      ModelException - if impossible
    • removeColumnPair

      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
      Parameters:
      pair - the column pair to remove
      Throws:
      ModelException - if impossible
    • removeColumnPairs

      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
      Parameters:
      pairs - the column pairs to remove
      Throws:
      ModelException - if impossible
    • setColumnPairs

      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
      Parameters:
      pairs - the new column pairs
      Throws:
      ModelException - if impossible