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.core
Class ForeignKey

    java.lang.Object
      edu.udo.cs.miningmart.m4.core.M4Object
          edu.udo.cs.miningmart.m4.core.M4Data
              edu.udo.cs.miningmart.m4.core.Key
                  edu.udo.cs.miningmart.m4.core.ForeignKey

All Implemented Interfaces:
  ForeignKey, Key, M4Data, M4Object, M4Table, XmlInfo, java.io.Serializable, java.lang.Comparable

    public class ForeignKey

extends Key
implements ForeignKey

This class implements the foreign key functionality.

Version:
  $Id: ForeignKey.java,v 1.8 2006/09/27 14:59:59 euler Exp $
Author:
  Timm Euler
See Also:
  Serialized Form

Field Summary

Fields inherited from class edu.udo.cs.miningmart.m4.core.Key
`ATTRIB_HEAD_FK_CS, ATTRIB_HEAD_ID, ATTRIB_HEAD_NAME, ATTRIB_HEAD_PK_CS, M4_TABLE_NAME, m4Info`

Fields inherited from class edu.udo.cs.miningmart.m4.core.M4Data
`myDocumentation`

Fields inherited from class edu.udo.cs.miningmart.m4.core.M4Object
`myId, myName`

Fields inherited from interface edu.udo.cs.miningmart.m4.utils.XmlInfo
`M4_XML_VERSION, TAG_COLLECTION, TAG_DOUBLE, TAG_INTEGER, TAG_LONG, TAG_M4_ID, TAG_SHORT, TAG_STRING, TAG_XML_ID`

Fields inherited from interface edu.udo.cs.miningmart.m4.utils.M4Table
`NOT_NULL`

Constructor Summary
`ForeignKey(DB m4Db)` Constructor for ForeignKeyImpl.

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.
`protected void` | `deleteLocal()` This method is called after the generic delete and can be overridden to delete related objects stored in cross-tables etc.
`java.util.Collection` | `getAllColumnLinks()` This method returns a `Collection` of `ForeignKeyLink`s.
`protected Column` | `getColumn(KeyMember km)`
`java.util.Collection` | `getDependentObjects()` This method is part of the XML-serialization and needs to be implemented by all `M4Data` sub-classes that need to be serialized.
`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.
`protected java.util.Collection` | `getObjectsInNamespace(java.lang.Class typeOfObjects)` This method returns the objects of the specified type that form a namespace in the scope of this M4Data object.
`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` | `primitiveSetForeignKeyColumnset(Columnset cs)` Primitive setter, do not use it!
`void` | `primitiveSetPrimaryKeyColumnset(Columnset cs)` Primitive setter, do not use it!
`void` | `removeAllColumnLinks()` Empties this ForeignKey of all Column Links.
`void` | `removeColumn(java.lang.String name)` Removing a Column from the Key, but not from the Columnset the Column belongs to.
`void` | `removeColumnLink(java.lang.String name)` 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.
`void` | `setRelationPrimitive(Relation r)` Primitive setter.

Methods inherited from class edu.udo.cs.miningmart.m4.core.Key
`addMember, deleteSoon, getIdAttributeName, getM4Info, getM4TableName, getMembers, getXmlInfo, print, removeAllColumns, removeAllM4References, removeMemberByForeignColumnName, removeMemberByPrimaryColumnName, removeMembers, setMembers`

Methods inherited from class edu.udo.cs.miningmart.m4.core.M4Data
`exportLocal, genericGetter, genericSetter, getDocumentation, getObjectsReferencingMe, getObjectsReferencingMe, getObjectTag, getUniqueName, getValidName, getValidName, getXmlIdTag, getXmlVersion, hasDeleteStatus, importLocal, isDirty, isWaitingForDelete, primitiveGetDocObject, primitiveSetDocObject, readFromDb, readFromDbLocal, removeDocObject, removeFromDb, removeSetFromDb, setDirty, setDocumentation, setId, setName, storeLocal, updateObjectsFromTable`

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

Methods inherited from class java.lang.Object
`clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

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`

Methods inherited from interface edu.udo.cs.miningmart.m4.utils.XmlInfo
`doPrint, doPrint, exportLocal, genericGetter, genericSetter, getObjectTag, getXmlIdTag, getXmlVersion, importLocal`

Constructor Detail

### ForeignKey

    public ForeignKey(DB m4Db)

  Constructor for ForeignKeyImpl.

  Parameters:
    `m4Db` - The DB object

Method Detail

### getObjectsInNamespace

    protected java.util.Collection getObjectsInNamespace(java.lang.Class typeOfObjects)
                                                  throws M4Exception

  Description copied from class: `M4Data`
  This method returns the objects of the specified type that form a namespace in the scope of this M4Data object. For example, a Concept's namespace for the type BaseAttribute is the Collection of all BaseAttributes for this Concept. Many M4Data objects never have a namespace, they return `null`. If a namespace could exist but doesn't, an empty Collection is returned.

  Specified by:
    `getObjectsInNamespace` in class `M4Data`
  Parameters:
    `typeOfObjects` - the type of objects that form the namespace
  Returns:
    a Collection of objects of type `typeOfObjects`, or `null`.
  Throws:
    `M4Exception`
  See Also:
    `M4Data.getObjectsInNamespace(Class)`

### getColumn

    protected Column getColumn(KeyMember km)

  See Also:
    `edu.udo.cs.miningmart.m4.Key#getColumn(KeyMember)`

### addColumnLink

    public void addColumnLink(Column fkColumn,
                              Column pkColumn)
                       throws M4Exception

  Description copied from interface: `ForeignKey`
  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.

  Specified by:
    `addColumnLink` in interface `ForeignKey`
  Parameters:
    `fkColumn` - The foreign key Column to add to this ForeignKey.
    `pkColumn` - The primary key Column that is referenced by fkColumn.
  Throws:
    `M4Exception`
  See Also:
    `miningmart.m4.ForeignKey#addColumn(Column, Column)`

### createColumnLinksFromAttribs

    public 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!

  Specified by:
    `createColumnLinksFromAttribs` in interface `ForeignKey`
  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

    public boolean isColumnContainedInForeignColumns(Column theColumn)
                                              throws M4Exception

  Description copied from interface: `ForeignKey`
  Returns TRUE iff the given Column acts as a foreign key Column in this ForeignKey.

  Specified by:
    `isColumnContainedInForeignColumns` in interface `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

  Description copied from interface: `ForeignKey`
  Returns TRUE iff the given Column acts as a primary key Column in this ForeignKey.

  Specified by:
    `isColumnContainedInPrimaryColumns` in interface `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

  Description copied from interface: `ForeignKey`
  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.

  Specified by:
    `getPrimaryForForeignColumn` in interface `ForeignKey`
  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

  Description copied from interface: `ForeignKey`
  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.

  Specified by:
    `getForeignForPrimaryColumn` in interface `ForeignKey`
  Parameters:
    `thePrimaryKeyColumn` - the given primary key column
  Returns:
    the associated foreign key column or NULL
  Throws:
    `M4Exception`

### copy

    public ForeignKey copy(Columnset newColumnSet)
                    throws M4Exception

  Specified by:
    `copy` in interface `ForeignKey`
  Throws:
    `M4Exception`
  See Also:
    `edu.udo.cs.miningmart.m4.ForeignKey#copy(ColumnSet)`

### getPrimaryKeyColumnset

    public Columnset getPrimaryKeyColumnset()
                                     throws M4Exception

  Getter method.

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

### setPrimaryKeyColumnset

    public void setPrimaryKeyColumnset(Columnset cs)
                                throws M4Exception

  Setter method.

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

### removePrimaryKeyColumnset

    public void removePrimaryKeyColumnset()
                                   throws M4Exception

  Specified by:
    `removePrimaryKeyColumnset` in interface `ForeignKey`
  Throws:
    `M4Exception`

### primitiveSetPrimaryKeyColumnset

    public void primitiveSetPrimaryKeyColumnset(Columnset cs)

  Primitive setter, do not use it!

  Specified by:
    `primitiveSetPrimaryKeyColumnset` in class `Key`

### getForeignKeyColumnset

    public Columnset getForeignKeyColumnset()
                                     throws M4Exception

  Getter method.

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

### setForeignKeyColumnset

    public void setForeignKeyColumnset(Columnset cs)
                                throws M4Exception

  Setter method.

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

### removeForeignKeyColumnset

    public void removeForeignKeyColumnset()
                                   throws M4Exception

  Specified by:
    `removeForeignKeyColumnset` in interface `ForeignKey`
  Throws:
    `M4Exception`

### primitiveSetForeignKeyColumnset

    public void primitiveSetForeignKeyColumnset(Columnset cs)

  Primitive setter, do not use it!

  Specified by:
    `primitiveSetForeignKeyColumnset` in class `Key`

### removeColumn

    public void removeColumn(java.lang.String name)
                      throws M4Exception

  Description copied from class: `Key`
  Removing a Column from the Key, but not from the Columnset the Column belongs to. In the case of ForeignKey, a Column Link is removed.

  Specified by:
    `removeColumn` in class `Key`
  Throws:
    `M4Exception`

### removeColumnLink

    public void removeColumnLink(java.lang.String name)
                          throws M4Exception

  Description copied from interface: `ForeignKey`
  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).

  Specified by:
    `removeColumnLink` in interface `ForeignKey`
  Throws:
    `M4Exception`

### removeAllColumnLinks

    public void removeAllColumnLinks()
                              throws M4Exception

  Description copied from interface: `ForeignKey`
  Empties this ForeignKey of all Column Links.

  Specified by:
    `removeAllColumnLinks` in interface `ForeignKey`
  Throws:
    `M4Exception`

### getRelation

    public Relation getRelation()
                         throws M4Exception

  Getter method.

  Specified by:
    `getRelation` in interface `ForeignKey`
  Returns:
    The Relation this Key is associated with, if any.
  Throws:
    `M4Exception`

### setRelation

    public void setRelation(Relation rel,
                            boolean isFrom)
                     throws M4Exception

  Setter method.

  Specified by:
    `setRelation` in interface `ForeignKey`
  Parameters:
    `rel` - The Relation this Key is to be associated with
    `isFrom` - TRUE iff this key is the fromKey of that Relation, FALSE if it is the toKey.
  Throws:
    `M4Exception`

### getAllColumnLinks

    public java.util.Collection getAllColumnLinks()
                                           throws M4Exception

  Description copied from interface: `ForeignKey`
  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.

  Specified by:
    `getAllColumnLinks` in interface `ForeignKey`
  Returns:
    a `Collection` of `ForeignKeyLink`s
  Throws:
    `M4Exception`

### getFirstColumnLink

    public ForeignKeyLink getFirstColumnLink()
                                      throws M4Exception

  Description copied from interface: `ForeignKey`
  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.

  Specified by:
    `getFirstColumnLink` in interface `ForeignKey`
  Returns:
    a ForeignKeyLink
  Throws:
    `M4Exception`

### setRelationPrimitive

    public void setRelationPrimitive(Relation r)

  Primitive setter. Do not use!

### getDependentObjects

    public java.util.Collection getDependentObjects()
                                             throws M4Exception

  Description copied from class: `M4Data`
  This method is part of the XML-serialization and needs to be implemented by all `M4Data` sub-classes that need to be serialized.

  Specified by:
    `getDependentObjects` in interface `XmlInfo`
  Overrides:
    `getDependentObjects` in class `Key`
  Returns:
    a `Collection` of all `M4Data` Java objects holding a foreign key reference to `this` object. This method must never return `null`.
  Throws:
    `M4Exception`
  See Also:
    `M4Data.getDependentObjects()`

### deleteLocal

    protected void deleteLocal()
                        throws M4Exception

  Description copied from class: `M4Data`
  This method is called after the generic delete and can be overridden to delete related objects stored in cross-tables etc.

  Overrides:
    `deleteLocal` in class `M4Data`
  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