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 Relation

    java.lang.Object
      edu.udo.cs.miningmart.m4.core.M4Object
          edu.udo.cs.miningmart.m4.core.M4Data
              edu.udo.cs.miningmart.m4.core.GraphicalM4Object
                  edu.udo.cs.miningmart.m4.core.ParameterObject
                      edu.udo.cs.miningmart.m4.core.Relation

All Implemented Interfaces:
  GraphicalM4Object, M4Data, M4Object, ParameterObject, Relation, M4Table, XmlInfo, java.io.Serializable, java.lang.Comparable

    public class Relation

extends ParameterObject
implements XmlInfo, Relation

This class represents an M4 Relation object. It bundles the pointers to the ToConcept and FromConcept as well as the FromKey and ToKey.

Version:
  $Id: Relation.java,v 1.13 2006/09/27 15:00:00 euler Exp $
Author:
  Timm Euler
See Also:
  `Concept`, `Key`, Serialized Form

Field Summary
`static java.lang.String` | `ATTRIB_COLUMNSET`
`static java.lang.String` | `ATTRIB_FROM_CONCEPT`
`static java.lang.String` | `ATTRIB_FROM_KEY`
`static java.lang.String` | `ATTRIB_REL_ID`
`static java.lang.String` | `ATTRIB_REL_NAME`
`static java.lang.String` | `ATTRIB_TO_CONCEPT`
`static java.lang.String` | `ATTRIB_TO_KEY`
`static java.lang.String` | `M4_TABLE_NAME`
`static M4Info` | `m4Info` Cache for getM4Info()

Fields inherited from class edu.udo.cs.miningmart.m4.core.GraphicalM4Object
`graph2coord`

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
`Relation(DB m4Db)` Constructor for Relation.

Method Summary
`void` | `addSubRelationship(Relation relationship)`
`void` | `changeAllKeys(java.util.Collection fromConceptAttribs, java.util.Collection toConceptAttribs, java.util.Collection crossToFromKeyNames, java.util.Collection crossToToKeyNames)` Adapt the keys of this relation.
`void` | `changeCrossTable(java.lang.String newCrossTableName)` Change the cross table of this relation.
`void` | `changeFromAndToKeys(java.util.Collection fromConceptAttribs, java.util.Collection toConceptAttribs)` Adapt the keys of this relation.
`Relation` | `copy(Concept fromConcept, Concept toConcept)`
`Columnset` | `createCrossLinkColumnset(java.lang.String name, java.lang.String schema, java.lang.String type)` Creates a ColumnSet that will be connected to this Relation.
`void` | `deleteSoon()` Overwrites the superclass method because the cross link columnset must be deleted, too, if it is used only for this relation.
`java.util.Collection` | `getAllSubRelationships()`
`Columnset` | `getCrossLinkColumnSet()`
`ForeignKey` | `getFromKey()` Getter method.
`java.lang.String` | `getIdAttributeName()`
`M4Info` | `getM4Info()`
`java.lang.String` | `getM4TableName()`
`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.
`Columnset` | `getResultOfJoin()` This method creates a Columnset that represents the inner join resulting from joining the FromConcept and the ToConcept.
`java.util.Collection` | `getStepsWhereThisIsInputRelation()` Returns all Steps in the Case that use this Relation as an input.
`Relation` | `getSubRelation(java.lang.String name)`
`java.util.Collection` | `getSubRelations()`
`Relation` | `getSuperRelation()`
`Concept` | `getTheFromConcept()` Getter method.
`Concept` | `getTheToConcept()` Getter method.
`ForeignKey` | `getToKey()` Getter method.
`M4Info` | `getXmlInfo()`
`protected boolean` | `hasCoordinates()` `Relation`s have coordinates.
`boolean` | `isManyToManyRelation()` Returns true iff this Relation models an n:m relationship.
`boolean` | `isOneToManyRelation()` Returns true iff this Relation models a 1:n relationship.
`boolean` | `isRelationallyValid()` A Relationship is relationally valid, if the fromConcept, the toConcept and the fromKey exist.
`void` | `primitiveSetColumnset(Columnset cs)` Primitive setter method.
`void` | `primitiveSetFromConcept(Concept c)` Primitive setter, do not use.
`void` | `primitiveSetFromKey(ForeignKey fk)` Primitive setter.
`void` | `primitiveSetToConcept(Concept c)` Primitive setter, do not use.
`void` | `primitiveSetToKey(ForeignKey fk)` Primitive setter.
`void` | `print()` Print this M4 object's parameters.
`protected void` | `removeAllM4References()` This method needs to be implemented by all `M4Data` objects.
`void` | `removeAllSubRelationships()`
`void` | `removeCrossLinkColumnset()` Removes the ColumnSet for this Relation.
`void` | `removeFromKey()`
`void` | `removeSubRelationship(java.lang.String name)`
`void` | `removeSuperRelation()` Remove the link to the superRelationship.
`void` | `removeToKey()`
`void` | `setCrossLinkColumnSet(Columnset cs)` Setter method.
`void` | `setFromKey(ForeignKey newFromKey)` Setter method.
`void` | `setM2mKeys(ForeignKey fromFK, ForeignKey toFK)` This method is used for n:m relationships.
`void` | `setSuperRelation(Relation superRelationship)`
`void` | `setTheFromConcept(Concept c)` Setter method.
`void` | `setTheToConcept(Concept c)` Setter method.
`void` | `setToKey(ForeignKey newToKey)` Setter method.

Methods inherited from class edu.udo.cs.miningmart.m4.core.ParameterObject
`addParameterReference, getDependentObjects, getParameterReferences, removeParameterReference`

Methods inherited from class edu.udo.cs.miningmart.m4.core.GraphicalM4Object
`deleteLocal, getCoordinates, getPoint, primitiveSetCoordinates, setCoordinatesDirty, setName, setPoint, storeLocal`

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, 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.utils.XmlInfo
`doPrint, doPrint, exportLocal, genericGetter, genericSetter, getDependentObjects, getObjectTag, getXmlIdTag, getXmlVersion, importLocal`

Methods inherited from interface edu.udo.cs.miningmart.m4.ParameterObject
`addParameterReference, getParameterReferences, removeParameterReference`

Methods inherited from interface edu.udo.cs.miningmart.m4.GraphicalM4Object
`getPoint, setPoint`

Methods inherited from interface edu.udo.cs.miningmart.m4.M4Data
`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, putM4ObjectToCache, replaceSpacesInName, setId, setName, setNotNew`

Field Detail

### M4_TABLE_NAME

    public static final java.lang.String M4_TABLE_NAME

See Also:
  Constant Field Values

### ATTRIB_REL_ID

    public static final java.lang.String ATTRIB_REL_ID

See Also:
  Constant Field Values

### ATTRIB_REL_NAME

    public static final java.lang.String ATTRIB_REL_NAME

See Also:
  Constant Field Values

### ATTRIB_FROM_CONCEPT

    public static final java.lang.String ATTRIB_FROM_CONCEPT

See Also:
  Constant Field Values

### ATTRIB_TO_CONCEPT

    public static final java.lang.String ATTRIB_TO_CONCEPT

See Also:
  Constant Field Values

### ATTRIB_FROM_KEY

    public static final java.lang.String ATTRIB_FROM_KEY

See Also:
  Constant Field Values

### ATTRIB_TO_KEY

    public static final java.lang.String ATTRIB_TO_KEY

See Also:
  Constant Field Values

### ATTRIB_COLUMNSET

    public static final java.lang.String ATTRIB_COLUMNSET

See Also:
  Constant Field Values

### m4Info

    public static M4Info m4Info

  Cache for getM4Info()

Constructor Detail

### Relation

    public Relation(DB m4Db)

  Constructor for Relation.

  Parameters:
    `m4Db` -
  See Also:
    `edu.udo.cs.miningmart.m4.core.M4Data#Constructor`

Method Detail

### getM4TableName

    public java.lang.String getM4TableName()

  Specified by:
    `getM4TableName` in interface `M4Table`
  See Also:
    `M4Table.getM4TableName()`

### getIdAttributeName

    public java.lang.String getIdAttributeName()

  Specified by:
    `getIdAttributeName` in interface `M4Table`
  See Also:
    `M4Table.getIdAttributeName()`

### getM4Info

    public M4Info getM4Info()

  Specified by:
    `getM4Info` in interface `M4Table`
  See Also:
    `M4Table.getM4Info()`

### getXmlInfo

    public M4Info getXmlInfo()

  Specified by:
    `getXmlInfo` in interface `XmlInfo`
  Returns:
    a `M4Info` object with the information of all XML fields of `this` object.
  See Also:
    `XmlInfo.getXmlInfo()`

### print

    public void print()

  Description copied from class: `M4Object`
  Print this M4 object's parameters. Must be implemented by all subclasses.

  Specified by:
    `print` in interface `M4Object`
  Overrides:
    `print` in class `GraphicalM4Object`
  See Also:
    `Parameter.print()`

### 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)`

### setTheToConcept

    public void setTheToConcept(Concept c)
                         throws M4Exception

  Setter method.

  Specified by:
    `setTheToConcept` in interface `Relation`
  Parameters:
    `c` - the new value
  Throws:
    `M4Exception`

### getTheToConcept

    public Concept getTheToConcept()

  Getter method.

  Specified by:
    `getTheToConcept` in interface `Relation`
  Returns:
    the value

### setTheFromConcept

    public void setTheFromConcept(Concept c)
                           throws M4Exception

  Setter method.

  Specified by:
    `setTheFromConcept` in interface `Relation`
  Parameters:
    `c` - the new value
  Throws:
    `M4Exception`

### getTheFromConcept

    public Concept getTheFromConcept()

  Getter method.

  Specified by:
    `getTheFromConcept` in interface `Relation`
  Returns:
    the value

### setToKey

    public void setToKey(ForeignKey newToKey)
                  throws M4Exception

  Setter method.

  Specified by:
    `setToKey` in interface `Relation`
  Parameters:
    `newToKey` - the new toKey
  Throws:
    `M4Exception`

### primitiveSetToKey

    public void primitiveSetToKey(ForeignKey fk)

  Primitive setter. Do not use!

### getToKey

    public ForeignKey getToKey()

  Getter method.

  Specified by:
    `getToKey` in interface `Relation`
  Returns:
    the value

### setFromKey

    public void setFromKey(ForeignKey newFromKey)
                    throws M4Exception

  Setter method.

  Specified by:
    `setFromKey` in interface `Relation`
  Parameters:
    `newFromKey` - the new FromKey
  Throws:
    `M4Exception`

### primitiveSetFromKey

    public void primitiveSetFromKey(ForeignKey fk)

  Primitive setter. Do not use!

### getFromKey

    public ForeignKey getFromKey()

  Getter method.

  Specified by:
    `getFromKey` in interface `Relation`
  Returns:
    the value

### getCrossLinkColumnSet

    public Columnset getCrossLinkColumnSet()

  Specified by:
    `getCrossLinkColumnSet` in interface `Relation`
  Returns:
    The Columnset that realizes this relation if it is an n:m relation. For 1:n relations, null is returned.

### setCrossLinkColumnSet

    public void setCrossLinkColumnSet(Columnset cs)
                               throws M4Exception

  Setter method.

  Specified by:
    `setCrossLinkColumnSet` in interface `Relation`
  Parameters:
    `cs` - The new cross columnset for the n:m relation.
  Throws:
    `M4Exception`

### changeCrossTable

    public void changeCrossTable(java.lang.String newCrossTableName)
                          throws M4Exception

  Change the cross table of this relation. If there is no columnset yet that represents the table with the given name, such a columnset is created.

  Specified by:
    `changeCrossTable` in interface `Relation`
  Parameters:
    `newCrossTableName` -
  Throws:
    `M4Exception`

### changeAllKeys

    public void changeAllKeys(java.util.Collection fromConceptAttribs,
                              java.util.Collection toConceptAttribs,
                              java.util.Collection crossToFromKeyNames,
                              java.util.Collection crossToToKeyNames)
                       throws M4Exception

  Adapt the keys of this relation. Create them if they do not exist yet. Only call this method for many-to-many relations.

  Specified by:
    `changeAllKeys` in interface `Relation`
  Parameters:
    `fromConceptAttribs` -
    `toConceptAttribs` -
    `crossToFromKeyNames` -
    `crossToToKeyNames` -
  Throws:
    `M4Exception`

### changeFromAndToKeys

    public void changeFromAndToKeys(java.util.Collection fromConceptAttribs,
                                    java.util.Collection toConceptAttribs)
                             throws M4Exception

  Adapt the keys of this relation. Create them if they do not exist yet. Only call this method for one-to-many relations.

  Specified by:
    `changeFromAndToKeys` in interface `Relation`
  Parameters:
    `fromConceptAttribs` -
    `toConceptAttribs` -
  Throws:
    `M4Exception`

### removeCrossLinkColumnset

    public void removeCrossLinkColumnset()
                                  throws M4Exception

  Description copied from interface: `Relation`
  Removes the ColumnSet for this Relation. It is also removed from the M4 Schema.

  Specified by:
    `removeCrossLinkColumnset` in interface `Relation`
  Throws:
    `M4Exception`
  See Also:
    `miningmart.m4.Relationship#removeColumnSet()`

### createCrossLinkColumnset

    public Columnset createCrossLinkColumnset(java.lang.String name,
                                              java.lang.String schema,
                                              java.lang.String type)
                                       throws M4Exception

  Description copied from interface: `Relation`
  Creates a ColumnSet that will be connected to this Relation. The name of the ColumnSet must be unique for this Relation.

  Specified by:
    `createCrossLinkColumnset` in interface `Relation`
  Parameters:
    `name` - The name for the new ColumnSet.
  Returns:
    The new ColumnSet object.
  Throws:
    `M4Exception` - when an error occurs during creation of the object.
  See Also:
    `miningmart.m4.Relationship#createColumnSet(String, String, String)`

### isOneToManyRelation

    public boolean isOneToManyRelation()

  Description copied from interface: `Relation`
  Returns true iff this Relation models a 1:n relationship.

  Specified by:
    `isOneToManyRelation` in interface `Relation`

### isManyToManyRelation

    public boolean isManyToManyRelation()

  Description copied from interface: `Relation`
  Returns true iff this Relation models an n:m relationship.

  Specified by:
    `isManyToManyRelation` in interface `Relation`

### getResultOfJoin

    public Columnset getResultOfJoin()
                              throws M4Exception

  Description copied from interface: `Relation`
  This method creates a Columnset that represents the inner join resulting from joining the FromConcept and the ToConcept. The M4 Columns are also created. However, the view corresponding to the new Columnset is not created in the database.

  Specified by:
    `getResultOfJoin` in interface `Relation`
  Returns:
    a Columnset
  Throws:
    `M4Exception`
  See Also:
    `Relation.getResultOfJoin()`

### setM2mKeys

    public void setM2mKeys(ForeignKey fromFK,
                           ForeignKey toFK)
                    throws M4Exception

  This method is used for n:m relationships.

  Specified by:
    `setM2mKeys` in interface `Relation`
  Parameters:
    `fromFK` - The foreignKey corresponding to the FromConcept.
    `toFK` - The foreignKey corresponding to the ToConcept.
  Throws:
    `M4Exception`
  See Also:
    `Relation.setM2mKeys(ForeignKey, ForeignKey)`

### primitiveSetColumnset

    public void primitiveSetColumnset(Columnset cs)

  Primitive setter method. Do not use!

### primitiveSetFromConcept

    public void primitiveSetFromConcept(Concept c)

  Primitive setter, do not use.

  Parameters:
    `c` - the `Concept` to be set

### primitiveSetToConcept

    public void primitiveSetToConcept(Concept c)

  Primitive setter, do not use.

  Parameters:
    `c` - the `Concept` to be set

### removeAllM4References

    protected void removeAllM4References()
                                  throws M4Exception

  Description copied from class: `M4Data`
  This method needs to be implemented by all `M4Data` objects. It has to remove all references to other `M4Object`s.

  Overrides:
    `removeAllM4References` in class `ParameterObject`
  Throws:
    `M4Exception`
  See Also:
    `M4Data.removeAllM4References()`

### deleteSoon

    public void deleteSoon()
                    throws M4Exception

  Overwrites the superclass method because the cross link columnset must be deleted, too, if it is used only for this relation.

  Specified by:
    `deleteSoon` in interface `M4Data`
  Overrides:
    `deleteSoon` in class `GraphicalM4Object`
  Throws:
    `M4Exception`

### hasCoordinates

    protected boolean hasCoordinates()

  `Relation`s have coordinates.

  Specified by:
    `hasCoordinates` in class `GraphicalM4Object`

### isRelationallyValid

    public boolean isRelationallyValid()

  A Relationship is relationally valid, if the fromConcept, the toConcept and the fromKey exist. For an n:m Relationship, the cross table columnset and the toKey must exist in addition. FromConcept and ToConcept must be of type DB.

  Specified by:
    `isRelationallyValid` in interface `Relation`
  See Also:
    `miningmart.m4.Relationship#isRelationallyValid()`

### copy

    public Relation copy(Concept fromConcept,
                         Concept toConcept)
                  throws M4Exception

  Specified by:
    `copy` in interface `Relation`
  Throws:
    `M4Exception`
  See Also:
    `Relation.copy(Concept, Concept)`

### getStepsWhereThisIsInputRelation

    public java.util.Collection getStepsWhereThisIsInputRelation()
                                                          throws M4Exception

  Returns all Steps in the Case that use this Relation as an input.

  Specified by:
    `getStepsWhereThisIsInputRelation` in interface `Relation`
  Returns:
    a Collection of Steps
  Throws:
    `M4Exception`

### removeFromKey

    public void removeFromKey()
                       throws M4Exception

  Specified by:
    `removeFromKey` in interface `Relation`
  Throws:
    `M4Exception`
  See Also:
    `Relation.removeFromKey()`

### removeToKey

    public void removeToKey()
                     throws M4Exception

  Specified by:
    `removeToKey` in interface `Relation`
  Throws:
    `M4Exception`
  See Also:
    `Relation.removeToKey()`

### getSubRelations

    public java.util.Collection getSubRelations()

  Specified by:
    `getSubRelations` in interface `Relation`

### getSuperRelation

    public Relation getSuperRelation()

  Specified by:
    `getSuperRelation` in interface `Relation`

### setSuperRelation

    public void setSuperRelation(Relation superRelationship)
                          throws M4Exception

  Specified by:
    `setSuperRelation` in interface `Relation`
  Throws:
    `M4Exception`

### removeSuperRelation

    public void removeSuperRelation()
                             throws M4Exception

  Remove the link to the superRelationship. The superRelationship itself is not removed.

  Specified by:
    `removeSuperRelation` in interface `Relation`
  Throws:
    `M4Exception`

### addSubRelationship

    public void addSubRelationship(Relation relationship)
                            throws M4Exception

  Specified by:
    `addSubRelationship` in interface `Relation`
  Throws:
    `M4Exception`

### getSubRelation

    public Relation getSubRelation(java.lang.String name)

  Specified by:
    `getSubRelation` in interface `Relation`

### getAllSubRelationships

    public java.util.Collection getAllSubRelationships()

  Specified by:
    `getAllSubRelationships` in interface `Relation`

### removeSubRelationship

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

  Specified by:
    `removeSubRelationship` in interface `Relation`
  Throws:
    `M4Exception`

### removeAllSubRelationships

    public void removeAllSubRelationships()
                                   throws M4Exception

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