Package Modeling :: Package interfaces :: Module RelationshipManipulation :: Class RelationshipManipulationInterface
[show private | hide private]
[frames | no frames]

Class RelationshipManipulationInterface

               Base --+    
                      |    
KeyValueCodingInterface --+
                          |
                         RelationshipManipulationInterface

Known Subclasses:
DatabaseObjectInterface

The RelationshipManipulation interface defines all methods needed to manipulates relationships defined in a Model (see Model, Entity, Relationship and ClassDescription).

Its behaviour is similar to KeyValueCoding except that it does only handle keys mapped to relationships in the receivers' class descriptions.

Implemented by: mix-in class RelationshipManipulation


Method Summary
  addObjectToBothSidesOfRelationshipWithKey(self, anObject, aKey)
Adds object to the corresponding relationship, and adds 'self' to 'anObject' 's inverse relationship, if it exists.
  addObjectToPropertyWithKey(self, anObject, aKey)
Depending on the relationship, the method performs the foowing steps:
  classDescription(self)
Returns the class description for the receiver.
  removeObjectFromBothSidesOfRelationshipWithKey(self, anObject, aKey)
Simply returns if anObject is None ('n issues a log at warning level)
  removeObjectFromPropertyWithKey(self, anObject, aKey)
Depending on the relationship, the method performs the following steps:
    Inherited from KeyValueCodingInterface
  handleQueryWithUnboundKey(self, key)
Raises AttributeError.
  handleTakeStoredValueForUnboundKey(self, value, key)
Raises AttributeError.
  handleTakeValueForUnboundKey(self, value, key)
Raises AttributeError.
  setStoredValueForKey(self, value, key)
DEPERECATED -- An alias for 'takeStoredValueForKey()'
  setValueForKey(self, value, key)
DEPERECATED -- An alias for 'takeValueForKey()'
  setValueForKeyPath(self, value, keypath)
DEPERECATED -- An alias for 'takeValueForKey()'
  storedValueForKey(self, key)
order: _getKey(), _key(), key, _key, getKey(), key() Might be overriden to perform additional transformations before returning the object
  takeStoredValueForKey(self, value, key)
order: _setKey(), _key, key, setKey() Might be overriden to perform additional transformations before returning the object
  takeStoredValuesFromDictionary(self, dictionary)
Invokes takeStoredValueForKey() for each key, value in the dictionary.
  takeValueForKey(self, value, key)
order: setKey(), _setKey(), key, _key Might be overriden to perform additional transformations before returning the object
  takeValueForKeyPath(self, value, key)
  takeValuesFromDictionary(self, dictionary)
Invokes takeValueForKey() for each key, value in the dictionary.
  valueForKey(self, key)
order: getKey(), key(), _getKey(), _key(), key, _key Might be overriden to perform additional transformations before returning the object
  valuesForKeys(self, keys)
Returns the list of values assigned to attributes specified in keys.

Method Details

addObjectToBothSidesOfRelationshipWithKey(self, anObject, aKey)

Adds object to the corresponding relationship, and adds 'self' to 'anObject' 's inverse relationship, if it exists.

Raises TypeError if 'aKey' cannot be found among the relationships of the receivers' class description.

addObjectToPropertyWithKey(self, anObject, aKey)

Depending on the relationship, the method performs the foowing steps:

toOne relationship -- simply sets the property using KeyValueCoding.takeValueForKey

toMany relationships -- tries to add 'anObject' with method 'addTo<Key>', or directly access the underlying set using KeyValueCoding.valueForKey(), adds 'anObject' to that set and sets it back in 'anObject' with 'KeyValueCoding.takeValueForKey()'.

classDescription(self)

Returns the class description for the receiver. This is the only method for which RelationshipManipulation does not define any default implementation ; it is usually implemented by objects implementing the DatabaseObject interface, such as CustomObject subclasses

removeObjectFromBothSidesOfRelationshipWithKey(self, anObject, aKey)

Simply returns if anObject is None ('n issues a log at warning level)

removeObjectFromPropertyWithKey(self, anObject, aKey)

Depending on the relationship, the method performs the following steps:

toOne relationship -- simply removes the property using 'KeyValueCoding.takeValueForKey(null)'

toMany relationships -- tries to remove 'anObject' with method 'addTo<Key>', or directly access the underlying set using 'KeyValueCoding.valueForKey()', removes 'anObject' to that set and sets it back in 'anObject' with 'KeyValueCoding.takeValueForKey()'.

Method raise 'ValueError' if relationship 'aKey' cannot be found, or if 'anObject' is not set for that key.


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