PATH |
EORelationshipManipulation
(informal interface)
Implemented by:EOEnterpriseObject EOCustomObject EOGenericRecord
Package: com.webobjects.eocontrol
Interface Description
The EORelationshipManipulation interface builds on the basic EOKeyValueCoding interface to allow you to modify to-many relationship properties. EOCustomObject and EOGenericRecord provide default implementations of EORelationshipManipulation, which you rarely (if ever) need to override.
The primitive methods addObjectToPropertyWithKey and removeObjectFromPropertyWithKey add and remove single objects from to-many relationship arrays. The two other methods in the interface, addObjectToBothSidesOfRelationshipWithKey and removeObjectFromBothSidesOfRelationshipWithKey, are implemented in terms of the two primitives to handle reciprocal relationships. These methods find the inverse relationship to the one identified by the specified key (if there is such an inverse relationship) and use addObjectToPropertyWithKey and removeObjectFromPropertyWithKey to alter both relationships, whether they're to-one or to-many.
The primitive methods check first for a method you might implement, addToKey or removeFromKey, invoking that method if it's implemented, otherwise using the basic key-value coding methods to do the work. Consequently, you rarely need to provide your own implementations of EORelationshipManipulation. Rather, you can provide relationship accessors (addToKey or removeFromKey) whenever you need to implement custom business logic.
Instance Methods
addObjectToBothSidesOfRelationshipWithKey
public abstract void addObjectToBothSidesOfRelationshipWithKey( EORelationshipManipulation anObject, String key)
This method also properly handles removing this
and anObject from their previous relationship as needed. For example, if an Employee object belongs to the Research department, invoking this method with the Maintenance department removes the Employee from the Research department as well as setting the Employee's department to Maintenance.
addObjectToPropertyWithKey
public abstract void addObjectToPropertyWithKey( Object anObject, String key)
removeObjectFromBothSidesOfRelationshipWithKey
public abstract void removeObjectFromBothSidesOfRelationshipWithKey( EORelationshipManipulation anObject, String key)
null
as the value. For a to-many relationship, anObject is removed using removeObjectFromPropertyWithKey.
removeObjectFromPropertyWithKey
public abstract void removeObjectFromPropertyWithKey( Object anObject, String key)
null
.
© 2001 Apple Computer, Inc. (Last Published April 19, 2001)