Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## edu.udo.cs.miningmart.m4
Interface ForeignKey

All Superinterfaces:
  Key, M4Data, M4Object

All Known Implementing Classes:
  ForeignKey

    public interface ForeignKey

extends Key

A ForeignKey models a foreign key relationship between two Columnsets. One of the Columnsets has a foreign key that refers to the primary key of the other Columnset. So each ForeignKey has a PrimaryKeyColumnset and a ForeignKeyColumnset. In both Columnsets, several Columns may be involved in the key; in this case, the ForeignKey maps each Column of the key of the PrimaryKeyColumnset to the corresponding Column of the key of the ForeignKeyColumnset. A 1:n Relation has one ForeignKey to model its links on the relational level. An n:m Relation uses TWO ForeignKeys, to model the relationship between the Columnset of the FromConcept and the cross table on the one hand, and the relationship between the Columnset of the ToConcept and the cross table on the other hand.

Version:
  $Id: ForeignKey.java,v 1.6 2006/09/27 14:59:57 euler Exp $
Author:
  Daniel Hakenjos, Timm Euler

Method Summary
`void` | `addColumnLink(Column fkColumn, Column pkColumn)` Adds a Column Link to this ForeignKey.
`ForeignKey` | `copy(Columnset newColumnSet)`
`void` | `createColumnLinksFromAttribs(java.util.Collection fromAttribs, java.util.Collection toAttribs)` Creates ColumnLinks between each given fromAttrib (must be BaseAttributes) and its corresponding toAttrib.
`java.util.Collection` | `getAllColumnLinks()` This method returns a `Collection` of `ForeignKeyLink`s.
`ForeignKeyLink` | `getFirstColumnLink()` Convenience method used by classes that assume that each ForeignKey link involves only one Column in each of the two Columnsets.
`Column` | `getForeignForPrimaryColumn(Column thePrimaryKeyColumn)` Returns the foreign key column that is associated with the given primary key column, if the latter exists in this ForeignKey.
`Columnset` | `getForeignKeyColumnset()` Getter method.
`Column` | `getPrimaryForForeignColumn(Column theForeignKeyColumn)` Returns the primary key column that is associated with the given foreign key column, if the latter exists in this ForeignKey.
`Columnset` | `getPrimaryKeyColumnset()` Getter method.
`Relation` | `getRelation()` Getter method.
`boolean` | `isColumnContainedInForeignColumns(Column theColumn)` Returns TRUE iff the given Column acts as a foreign key Column in this ForeignKey.
`boolean` | `isColumnContainedInPrimaryColumns(Column theColumn)` Returns TRUE iff the given Column acts as a primary key Column in this ForeignKey.
`void` | `removeAllColumnLinks()` Empties this ForeignKey of all Column Links.
`void` | `removeColumnLink(java.lang.String foreignKeyColumnName)` Removes a Column Link from this ForeignKey.
`void` | `removeForeignKeyColumnset()`
`void` | `removePrimaryKeyColumnset()`
`void` | `setForeignKeyColumnset(Columnset cs)` Setter method.
`void` | `setPrimaryKeyColumnset(Columnset cs)` Setter method.
`void` | `setRelation(Relation rel, boolean isFrom)` Setter method.

Methods inherited from interface edu.udo.cs.miningmart.m4.M4Data
`deleteSoon, getDocumentation, getValidName, isDirty, isWaitingForDelete, setDocumentation`

Methods inherited from interface edu.udo.cs.miningmart.m4.M4Object
`doPrint, doPrint, equals, executeBusinessSingleValueSqlRead, executeBusinessSingleValueSqlReadL, executeBusinessSqlRead, executeBusinessSqlWrite, executeM4SingleValueSqlRead, executeM4SingleValueSqlReadL, executeM4SqlRead, executeM4SqlWrite, getCasePrintObject, getId, getM4Db, getM4ObjectFromCache, getName, getNextM4SequenceValue, isNew, load, print, putM4ObjectToCache, replaceSpacesInName, setId, setName, setNotNew`

Method Detail

### getRelation

    Relation getRelation()
                         throws M4Exception

  Getter method.

  Returns:
    The Relation this Key is associated with, if any.
  Throws:
    `M4Exception`

### setRelation

    void setRelation(Relation rel,
                     boolean isFrom)
                     throws M4Exception

  Setter method.

  Parameters:
    `rel` - The Relation this ForeignKey is to be associated with
    `isFrom` - TRUE iff this ForeignKey is the fromKey of that Relation, FALSE if it is the toKey. (An n:m Relation needs both a fromKey and a toKey. A 1:n Relation needs only a fromKey.)
  Throws:
    `M4Exception`

### addColumnLink

    void addColumnLink(Column fkColumn,
                       Column pkColumn)
                       throws M4Exception

  Adds a Column Link to this ForeignKey. A ForeignKey may consist of one or more Columns in each of the two Columnsets. The Columns in the two Columnsets will be mapped to each other.

  Parameters:
    `fkColumn` - The foreign key Column to add to this ForeignKey.
    `pkColumn` - The primary key Column that is referenced by fkColumn.
  Throws:
    `M4Exception`

### removeColumnLink

    void removeColumnLink(java.lang.String foreignKeyColumnName)
                          throws M4Exception

  Removes a Column Link from this ForeignKey. The name is used to refer the Column of the foreign key Columnset, but the corresponding Column of the primary key Columnset is also removed from this ForeignKey (all Columns remain in their Columnsets, of course).

  Throws:
    `M4Exception`

### removeAllColumnLinks

    void removeAllColumnLinks()
                              throws M4Exception

  Empties this ForeignKey of all Column Links.

  Throws:
    `M4Exception`

### createColumnLinksFromAttribs

    void createColumnLinksFromAttribs(java.util.Collection fromAttribs,
                                      java.util.Collection toAttribs)
                                      throws M4Exception

  Creates ColumnLinks between each given fromAttrib (must be BaseAttributes) and its corresponding toAttrib. If the given Attributes have no columns, empty links are created!

  Parameters:
    `fromAttribs` - A collection of BaseAttributes, ordered to match the BaseAttributes in 'toAttribs'
    `toAttribs` - A collection of BaseAttributes ordered so that each BaseAttribute is mapped to the BaseAttribute in 'fromAttribs' at the same position
  Throws:
    `M4Exception`

### isColumnContainedInForeignColumns

    boolean isColumnContainedInForeignColumns(Column theColumn)
                                              throws M4Exception

  Returns TRUE iff the given Column acts as a foreign key Column in this ForeignKey.

  Parameters:
    `theColumn` - the given Column
  Returns:
    true iff it is a foreign key column
  Throws:
    `M4Exception`

### isColumnContainedInPrimaryColumns

    boolean isColumnContainedInPrimaryColumns(Column theColumn)
                                              throws M4Exception

  Returns TRUE iff the given Column acts as a primary key Column in this ForeignKey.

  Parameters:
    `theColumn` - the given Column
  Returns:
    true iff it is a primary key column
  Throws:
    `M4Exception`

### getPrimaryForForeignColumn

    Column getPrimaryForForeignColumn(Column theForeignKeyColumn)
                                      throws M4Exception

  Returns the primary key column that is associated with the given foreign key column, if the latter exists in this ForeignKey. Otherwise NULL is returned.

  Parameters:
    `theForeignKeyColumn` - the given foreign key column
  Returns:
    the associated primary key column or NULL
  Throws:
    `M4Exception`

### getForeignForPrimaryColumn

    Column getForeignForPrimaryColumn(Column thePrimaryKeyColumn)
                                      throws M4Exception

  Returns the foreign key column that is associated with the given primary key column, if the latter exists in this ForeignKey. Otherwise NULL is returned.

  Parameters:
    `thePrimaryKeyColumn` - the given primary key column
  Returns:
    the associated foreign key column or NULL
  Throws:
    `M4Exception`

### getPrimaryKeyColumnset

    Columnset getPrimaryKeyColumnset()
                                     throws M4Exception

  Getter method.

  Specified by:
    `getPrimaryKeyColumnset` in interface `Key`
  Returns:
    The columnset of the primary key of this ForeignKey
  Throws:
    `M4Exception`

### setPrimaryKeyColumnset

    void setPrimaryKeyColumnset(Columnset cs)
                                throws M4Exception

  Setter method.

  Specified by:
    `setPrimaryKeyColumnset` in interface `Key`
  Parameters:
    `cs` - The new columnset of the primary key of this ForeignKey
  Throws:
    `M4Exception`

### getForeignKeyColumnset

    Columnset getForeignKeyColumnset()
                                     throws M4Exception

  Getter method.

  Specified by:
    `getForeignKeyColumnset` in interface `Key`
  Returns:
    The columnset of the foreign key of this ForeignKey
  Throws:
    `M4Exception`

### setForeignKeyColumnset

    void setForeignKeyColumnset(Columnset cs)
                                throws M4Exception

  Setter method.

  Specified by:
    `setForeignKeyColumnset` in interface `Key`
  Parameters:
    `cs` - The new columnset of the foreign key of this ForeignKey
  Throws:
    `M4Exception`

### getAllColumnLinks

    java.util.Collection getAllColumnLinks()
                                           throws M4Exception

  This method returns a `Collection` of `ForeignKeyLink`s. Each `ForeignKeyLink` links one Column of the foreign Columnset to the corresponding Column of the primary Columnset.

  Returns:
    a `Collection` of `ForeignKeyLink`s
  Throws:
    `M4Exception`

### getFirstColumnLink

    ForeignKeyLink getFirstColumnLink()
                                      throws M4Exception

  Convenience method used by classes that assume that each ForeignKey link involves only one Column in each of the two Columnsets. This method simply returns the first link in the hope that there is only one.

  Returns:
    a ForeignKeyLink
  Throws:
    `M4Exception`

### removeForeignKeyColumnset

    void removeForeignKeyColumnset()
                                   throws M4Exception

  Throws:
    `M4Exception`

### removePrimaryKeyColumnset

    void removePrimaryKeyColumnset()
                                   throws M4Exception

  Throws:
    `M4Exception`

### copy

    ForeignKey copy(Columnset newColumnSet)
                    throws M4Exception

  Throws:
    `M4Exception`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2005