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.4 2006/04/11 14:10:12 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)`
`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`

Method Detail

### getRelation

    public Relation getRelation()
                         throws M4Exception

  Getter method.

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

### setRelation

    public 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

    public 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

    public 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

    public void removeAllColumnLinks()
                              throws M4Exception

  Empties this ForeignKey of all Column Links.

  Throws:
    `M4Exception`

### isColumnContainedInForeignColumns

    public 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

    public 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

    public 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

    public 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

    public 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

    public 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

    public 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

    public 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

    public 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

    public 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

    public void removeForeignKeyColumnset()
                                   throws M4Exception

  Throws:
    `M4Exception`

### removePrimaryKeyColumnset

    public void removePrimaryKeyColumnset()
                                   throws M4Exception

  Throws:
    `M4Exception`

### copy

    public 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