Package Modeling :: Module Relationship :: Class SimpleRelationship
[show private | hide private]
[frames | no frames]

Type SimpleRelationship

KeyValueCoding --+    
                 |    
        object --+    
                 |    
 XMLCapability --+    
                 |    
      Relationship --+
                     |
                    SimpleRelationship


Describes a relationship

Features added to the EOF standard API:


Method Summary
  __init__(self, aName)
Initializes a relationship.
  __eq__(self, aRelationship)
Tests whether both relationship are equal
  __str__(self)
Returns a short representation of the relationship
  addJoin(self, aJoin)
See interfaces.Relationship for details
  anyInverseRelationship(self)
If self.inverseRelationship() exists, return that one, otherwise build and return an inverse relationship for self
  checkRelationshipValidity(self)
Checks the relationship validity.
  clone(self, entity, name)
Returns a copy of the current Relationship
  componentRelationships(self)
See interfaces.Relationship for details
  definition(self)
See interfaces.Relationship for details
  destinationAttributeForSourceAttribute(self, attribute)
Returns the corresponding destination Attribute for 'attribute', i.e.
  destinationAttributes(self)
Simply returns the list of joins' destination attributes
  destinationEntity(self)
Returns the destination entity, or 'None' if the relationship has no joins yet
  destinationEntityName(self)
Return the destination entity, or None
  getXMLDOM(self, doc, parentNode, encoding)
Returns the (DOM) DocumentObject for the receiver.
  getXMLNodeName(self)
Returns string "relation".
  handleAssignementForUnboundKey(self, value, key)
See interfaces.KeyValueCoding for details
  handleTakeStoredValueForUnboundKey(self, value, key)
See interfaces.KeyValueCoding for details
  initWithXMLDOMNode(self, aNode, encoding)
Initializes a relationship with the supplied xml.dom.node.
  inverseRelationship(self)
Returns the inverse relationship in the destination entity, or None if it does not exist
  isCompound(self)
Simply indicates whether the relationship has one or more joins Returns true iff relationship has one join, false otherwise.
  isFlattened(self)
See interfaces.Relationship for details
  isSimple(self)
Indicates whether the relation holds one join.
  joins(self)
Return the whole set of joins registered in this relationship
  joinSemantic(self)
Returns the join semantic to be used for the relationship's joins
  ownsDestination(self)
Returns true if the relationship owns the destinationEntity.
  propagatesPrimaryKey(self)
Returns true if the relationship propagates PK value, false otherwise _TBD should be explained
  raiseUnappropriate(self)
  removeJoin(self, aJoin)
Removes the supplied join from the relation's join.
  setDefinition(self, definition)
See interfaces.Relationship for details
  setJoinSemantic(self, semantic)
Sets the join semantic for the underlying joins.
  setOwnsDestination(self, boolean)
Tells the receiver whether it owns its destination objects.
  setPropagatesPrimaryKey(self, aBool)
Tells the relationship whether it propagates PK value _TBD should be explained
  sourceAttributes(self)
Simply returns the list of joins' source attributes
  validateRelationship(self)
Validates the relationship against general model consistency: - relationship should have a source and a destination entity -
  validateValue(self, value, object)
Checks whether the supplied value is valid, i.e.
  xmlAttributesDict(self)
.
    Inherited from Relationship
  __ne__(self, aRelationship)
  _setSourceEntity(self, anEntity)
Sets the source entity
  comment(self)
Returns the comment field
  deleteRule(self)
Returns the delete rule applicable to this relationship.
  displayLabel(self)
Returns the display label for the relationship
  entity(self)
Return the relationship's source entity
  isClassProperty(self)
Indicates whether the attribute belongs to the class properties/fields
  isMandatory(self)
Indicates whether the relationship requires at least a destination entity to be bound.
  isNotClassProperty(self)
negation of isClassProperty
  isToMany(self)
Indicates whether the relationship has a maximum cardinality > 1.
  isToOne(self)
Indicates whether the relationship has a maximim cardinality = 1.
  multiplicityLowerBound(self)
Returns the lower bound of the relationship's multiplicity
  multiplicityUpperBound(self)
Returns the upper bound of the relationship's multiplicity.
  name(self)
Returns the relationship's name
  setComment(self, aComment)
Sets the comment field
  setDeleteRule(self, rule)
Sets the delete rule.
  setDisplayLabel(self, aLabel)
Sets the display label (string) for the relationship
  setEntity(self, anEntity)
Sets the source entity
  setIsClassProperty(self, aBool)
Tells the receiver whether it belongs to the class properties/fields
  setIsMandatory(self, aBool)
Tells the relationship whether it is mandatory.
  setMultiplicity(self, lowerBound, upperBound)
Sets the lower and upper bounds for the relationship's multiplicity.
  setMultiplicityLowerBound(self, lowerBound)
Sets the lower bound of the relationship's multiplicity Parameter lowerBound must be an positive integer.
  setMultiplicityUpperBound(self, upperBound)
Sets the upper bound of the relationship's multiplicity.
  setName(self, aName)
Sets the relationship's name
  sourceEntity(self)
Return the relationship's source entity
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __repr__(x)
x.__repr__() <==> repr(x)
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
    Inherited from XMLCapability
  xmlAttributeType(self, attributeName)
  xmlGetAttribute(self, attributeName)
  xmlSetAttribute(self, attributeName)
    Inherited from KeyValueCoding
  handleQueryWithUnboundKey(self, key)
See interfaces.KeyValueCoding for details
  setStoredValueForKey(self, value, key)
DEPRECATED -- alias for 'takeStoredValueForKey()'
  setValueForKey(self, value, key)
DEPRECATED -- alias for takeValueForKey()
  setValueForKeyPath(self, value, keypath)
DEPRECATED -- alias for takeValueForKeyPath()
  storedValueForKey(self, key)
See interfaces.KeyValueCoding for details
  takeStoredValueForKey(self, value, key)
See interfaces.KeyValueCoding for details
  takeStoredValuesFromDictionary(self, dictionary)
See interfaces.KeyValueCoding for details
  takeValueForKey(self, value, key)
See interfaces.KeyValueCoding for details
  takeValueForKeyPath(self, value, key)
See interfaces.KeyValueCoding for details
  takeValuesFromDictionary(self, dictionary)
See interfaces.KeyValueCoding for details
  valueForKey(self, key)
See interfaces.KeyValueCoding for details
  valueForKeyPath(self, keypath)
See interfaces.KeyValueCoding for details
  valuesForKeys(self, keys)
See interfaces.KeyValueCoding for details

Class Variable Summary
tuple __implements__ = (<class Modeling.interfaces.Relationshi...
    Inherited from Relationship
str _comment = ''
int _isClassProperty = 1                                                                     

Method Details

__init__(self, aName='')
(Constructor)

Initializes a relationship. A name must be provided.

Default value is a non-flattened, to-one relationship with no joins, deleteRule: Nullify, joinSemantic: INNER_JOIN,

Overrides:
Modeling.Relationship.Relationship.__init__

__eq__(self, aRelationship)
(Equality operator)

Tests whether both relationship are equal

__str__(self)
(Informal representation operator)

Returns a short representation of the relationship
Overrides:
__builtin__.object.__str__

addJoin(self, aJoin)

See interfaces.Relationship for details

anyInverseRelationship(self)

If self.inverseRelationship() exists, return that one, otherwise build and return an inverse relationship for self

See also: inverseRelationship()

checkRelationshipValidity(self)

Checks the relationship validity. This includes the following tests: - cardinality > 0 - len(joins) > 0 - name - source and destinationEntity are not None - joins' sources are identical (idem for destinations) Raises the relation is invalid.

clone(self, entity, name=None)

Returns a copy of the current Relationship

Parameter:

entity -- the entity in which the relationship should be inserted

name -- optional. If provided the clone gets that name, otherwise defaults to 'self.name()'.

See also: Entity.clone()

componentRelationships(self)

See interfaces.Relationship for details

definition(self)

See interfaces.Relationship for details

destinationAttributeForSourceAttribute(self, attribute)

Returns the corresponding destination Attribute for 'attribute', i.e. the destinationAttribute of the relationship's join which has 'attribute' as the source attribute.

Raises ValueError if 'attribute' is not a source attribute of any join defined in the Relationship.

destinationAttributes(self)

Simply returns the list of joins' destination attributes

destinationEntity(self)

Returns the destination entity, or 'None' if the relationship has no joins yet

destinationEntityName(self)

Return the destination entity, or None

getXMLDOM(self, doc=None, parentNode=None, encoding='iso-8859-1')

Returns the (DOM) DocumentObject for the receiver.

Parameters 'doc' and 'parentDoc' should be both omitted or supplied. If they are omitted, a new DocumentObject is created. If they are supplied, elements are added to the parentNode.

Returns: the (possibly new) DocumentObject.

Overrides:
Modeling.Relationship.Relationship.getXMLDOM

getXMLNodeName(self)

Returns string "relation". See interfaces.XMLCapability for details
Overrides:
Modeling.Relationship.Relationship.getXMLNodeName

handleAssignementForUnboundKey(self, value, key)

See interfaces.KeyValueCoding for details
Overrides:
Modeling.KeyValueCoding.KeyValueCoding.handleAssignementForUnboundKey (inherited documentation)

handleTakeStoredValueForUnboundKey(self, value, key)

See interfaces.KeyValueCoding for details
Overrides:
Modeling.KeyValueCoding.KeyValueCoding.handleAssignementForUnboundKey (inherited documentation)

initWithXMLDOMNode(self, aNode, encoding='iso-8859-1')

Initializes a relationship with the supplied xml.dom.node.
Overrides:
Modeling.Relationship.Relationship.initWithXMLDOMNode

inverseRelationship(self)

Returns the inverse relationship in the destination entity, or None if it does not exist

Note: the inverseRelationship() is not idempotent, i.e. rel.inverseRelationship().inverseRelationship() does not necessarily returns self. It returns self if and only if the relationship's entity has no parent entity, or if the relationship is not an inherited property (none of the parent entities defines the relationship).

See also: anyInverseRelationship()

isCompound(self)

Simply indicates whether the relationship has one or more joins Returns true iff relationship has one join, false otherwise. Raises if relationship has no joins.

isFlattened(self)

See interfaces.Relationship for details

isSimple(self)

Indicates whether the relation holds one join. Note that this method return also 'true' when the relationship is invalid (i.e. it holds no joins)

joins(self)

Return the whole set of joins registered in this relationship

joinSemantic(self)

Returns the join semantic to be used for the relationship's joins

Return value is one of the module's constant INNER_JOIN, FULL_OUTER_JOIN, RIGHT_OUTER_JOIN, LEFT_OUTER_JOIN

ownsDestination(self)

Returns true if the relationship owns the destinationEntity. See also: setOwnsDestination() When a relationship owns its destination, the related entity object cannot exist without the source object. Thus, as a side-effect, this sets the delete rule to 'cascade'.

propagatesPrimaryKey(self)

Returns true if the relationship propagates PK value, false otherwise _TBD should be explained

raiseUnappropriate(self)

removeJoin(self, aJoin)

Removes the supplied join from the relation's join. Parameter 'aJoin' must be a 'Join' instance. Raises 'ValueError' if 'aJoin' cannot be found.

setDefinition(self, definition)

See interfaces.Relationship for details

setJoinSemantic(self, semantic)

Sets the join semantic for the underlying joins.

Parameter:

semantic -- one of the module's constant INNER_JOIN, FULL_OUTER_JOIN,
RIGHT_OUTER_JOIN, LEFT_OUTER_JOIN

setOwnsDestination(self, boolean)

Tells the receiver whether it owns its destination objects.

When a relationship owns its destination, the related object(s) cannot exist without the source object.

setPropagatesPrimaryKey(self, aBool)

Tells the relationship whether it propagates PK value _TBD should be explained

sourceAttributes(self)

Simply returns the list of joins' source attributes

validateRelationship(self)

Validates the relationship against general model consistency: - relationship should have a source and a destination entity -

validateValue(self, value, object=None)

Checks whether the supplied value is valid, i.e. the following tests are made:

  1. if value is a fault (returns true for isFault()), it immediately returns. This means that a faulted object is NOT triggered/its values are not fetched for validation purpose: a fault is considered to be okay wrt. to the validation rules.
  2. value cannot be void ('value is None' is true) if the relationship is mandatory
  3. 'value' matches the multiplicity bounds
  4. Value's entity is the relationship's destination entity (same for 'value' 's items if 'value' is a tuple)

Parameter 'value' is required, and 'object' is optional --it is only used to make the error message clearer in case of failure.

Silently returns if it succeeds.

In case of failure, it raises 'Modeling.Validation.ValidationException' ; in this case, exception's value ('sys.exc_info[1]') consists in a set of lines, describing line per line the different tests which failed.

xmlAttributesDict(self)

.
Overrides:
Modeling.Relationship.Relationship.xmlAttributesDict

Class Variable Details

__implements__

Type:
tuple
Value:
(<class Modeling.interfaces.Relationship.RelationshipInterface at 0xb7\
612e0c>,
 <class Modeling.interfaces.XMLCapability.XMLCapabilityInterface at 0x\
b7612e9c>)                                                             

Generated by Epydoc 2.1 on Sat Mar 4 13:36:21 2006 http://epydoc.sf.net