EOEnterpriseObject
Implemented by:
- EOCustomObject
- EOGenericRecord
- Implements:
- EODeferredFaulting
- EOKeyValueCodingAdditions
- EOKeyValueCoding.KeyBindingCreation
- EORelationshipManipulation
- EOValidation
- EOFaulting (EODeferredFaulting)
- EOKeyValueCoding (EOKeyValueCodingAdditions)
- Package:
- com.apple.client.eocontrol
- com.apple.yellow.eocontrol
Interface Description
The EOEnterpriseObject interface identifies basic enterprise object behavior, defining methods for supporting operations common to all enterprise objects. Among these are methods for initializing instances, announcing changes, setting and retrieving property values, and performing validation of state. Some of these methods are for enterprise objects to implement or override, and some are meant to be used as defined by the Framework. Many methods are used internally by the Framework and rarely invoked by application code.
Many of the functional areas are defined in smaller, more specialized interfaces and incorporated in the over arching EOEnterpriseObject interface:
- EOKeyValueCoding defines Enterprise Objects Framework's main data transport mechanism, in which the properties of an object are accessed indirectly by name (or "key"), rather than directly through invocation of an accessor method or as instance variables.
- EOKeyValueCoding.KeyBindingCreation defines a mechanism for binding class/key pairs with a method for accessing the key, which maximizes the performance of EOKeyValueCoding.
- EOKeyValueCodingAdditions defines extensions to the basic EOKeyValueCoding interface, giving access to groups of properties and to properties across relationships.
- EORelationshipManipulation builds on the basic EOKeyValueCoding interface to allow you to modify to-many relationship properties.
- EOValidation defines the way that enterprise objects validate their values.
- EOFaulting and EODeferredFaulting define mechanisms for postponing an object's initialization until its actually needed.
The remaining methods are introduced in the EOEnterpriseObject interface itself and can be broken down into three functional groups discussed in the following sections:
You rarely need to implement the EOEnterpriseObject interface from scratch. The Framework provides default implementations of the methods in EOCustomObject and EOGenericRecord. Use EOGenericRecords to represent enterprise objects that don't require custom behavior, and create subclasses of EOCustomObject to represent enterprise objects that do. The section "Writing an Enterprise Object Class" highlights the methods that you typically provide or override in a custom enterprise object class.
Interfaces Implemented
EOKeyValueCoding
- handleQueryWithUnboundKey
- handleTakeValueForUnboundKey
- storedValueForKey
- takeStoredValueForKey
- takeValueForKey
- unableToSetNullForKey
- valueForKey
EOKeyValueCodingAdditions
- takeValueForKeyPath
- takeValuesFromDictionary
- valueForKeyPath
- valuesForKeys
EORelationshipManipulation
- addObjectToBothSidesOfRelationshipWithKey
- addObjectToPropertyWithKey
- removeObjectFromBothSidesOfRelationshipWithKey
- removeObjectFromPropertyWithKey
EOValidation
- validateForDelete
- validateForInsert
- validateForSave
- validateForUpdate
- validateValueForKey
EOFaulting
- clearFault
- faultHandler
- isFault
- turnIntoFault
- willRead
Method Types
- Initializing enterprise objects
- awakeFromFetch
- awakeFromInsertion
- Announcing changes
- willChange
- Getting an object's EOEditingContext
- editingContext
- Getting class description information
- allPropertyKeys
- attributeKeys
- classDescription
- classDescriptionForDestinationKey
- deleteRuleForRelationshipKey
- entityName
- inverseForRelationshipKey
- isToManyKey
- ownsDestinationObjectsForRelationshipKey
- toManyRelationshipKeys
- toOneRelationshipKeys
- Modifying relationships
- propagateDeleteWithEditingContext
- clearProperties
- Working with snapshots
- snapshot
- updateFromSnapshot
- Merging values
- changesFromSnapshot
- reapplyChangesFromDictionary
- Invoking behavior on the server (com.apple.client.eocontrol only)
- invokeRemoteMethod
- Getting descriptions
- eoDescription
- eoShallowDescription
- userPresentableDescription
Instance Methods
allPropertyKeys
public abstract NSArray
allPropertyKeys
()
attributeKeys
public abstract NSArray
attributeKeys
()
See Also: toOneRelationshipKeys, toManyRelationshipKeys
awakeFromFetch
public abstract void
awakeFromFetch
(EOEditingContext anEditingContext)
super
's implementation
before performing their own initialization.awakeFromInsertion
public abstract void
awakeFromInsertion
(EOEditingContext anEditingContext)
super
's
implementation before performing their own initialization.changesFromSnapshot
public abstract NSDictionary
changesFromSnapshot
(NSDictionary snapshot)
Returns a dictionary whose keys correspond to the receiver's properties with uncommitted changes relative to snapshot, and whose values are the uncommitted values. In both snapshot and the returned dictionary, where a key represents a to-many relationship, the corresponding value is an NSArray containing two other NSArrays: the first is an array of objects to be added to the relationship property, and the second is an array of objects to be removed.
See Also: reapplyChangesFromDictionary
classDescription
public abstract EOClassDescription
classDescription
()
classDescriptionForDestinationKey
public abstract EOClassDescription
classDescriptionForDestinationKey
(String key)
clearProperties
public abstract void
clearProperties
()
deleteRuleForRelationshipKey
public abstract int
deleteRuleForRelationshipKey
(String relationshipKey)
For example, an Invoice object might return DeleteRuleNullify
for
the relationship named "lineItems", since when an invoice is
deleted, its line items should be deleted as well. For more information
on the delete rules, see the method description for EOClassDescription's deleteRuleForRelationshipKey in
the class specification for EOClassDescription, the class in which
they're defined.
EOCustomObject's implementation of this method simply sends a deleteRuleForRelationshipKey message to the receiver's EOClassDescription.
See Also: propagateDeleteWithEditingContext, validateForDelete (EOValidation)
editingContext
public abstract EOEditingContext
editingContext
()
entityName
public abstract String
entityName
()
eoDescription
public abstract String
eoDescription
()
This method is useful for debugging. You can implement a toString
method
that invokes this one, and the debugger's print-object command
(po
on the command line) automatically
displays this description. You can also invoke this method directly
on the command line of the debugger.
See Also: userPresentableDescription
eoShallowDescription
public abstract String
eoShallowDescription
()
eoDescription
invokes
this method for relationship destinations to avoid infinite recursion
through cyclical relationships. EOCustomObject's implementation
simply returns a string containing the receiver's class and entity
names
.
See Also: userPresentableDescription
inverseForRelationshipKey
public abstract String
inverseForRelationshipKey
(String relationshipKey)
You might override this method for reciprocal relationships that aren't defined using the same join attributes. For example, if a Member object has a relationship to CreditCard based on the card number, but a CreditCard has a relationship to Member based on the Member's primary key, both classes need to override this method. This is how Member might implement it:
public String inverseForRelationshipKey(String relationshipKey) { if (relationshipKey.equals("creditCard")) return "member"; else return super.inverseForRelationshipKey(relationshipKey); }
invokeRemoteMethod
public abstract Object
invokeRemoteMethod
(
String methodName,
Object[] arguments)
(com.apple.client.eocontrol only) Invokes methodName using arguments. To pass an enterprise object as an argument, use its global ID. This method has the side effect of saving all the changes from the receiver's editing context all the way down to the editing context in the server session.
isToManyKey
public abstract boolean
isToManyKey
(String key)
ownsDestinationObjectsForRelationshipKey
public abstract boolean
ownsDestinationObjectsForRelationshipKey
(String key)
See Also:
deleteRuleForRelationshipKey, ownsDestination
(EOAccess'
EORelationship)
propagateDeleteWithEditingContext
public abstract void
propagateDeleteWithEditingContext
(EOEditingContext anEditingContext)
See Also: deleteRuleForRelationshipKey
reapplyChangesFromDictionary
public abstract void
reapplyChangesFromDictionary
(NSDictionary changes)
Similar to takeValuesFromDictionary, but the changes dictionary can contain arrays for to-many relationships. Where a key represents a to-many relationship, the dictionary's value is an NSArray containing two other NSArrays: the first is an array of objects to be added to the relationship property, and the second is an array of objects to be removed. EOCustomObject's implementation should be sufficient for all purposes; you shouldn't have to override this method.
See Also: changesFromSnapshot
snapshot
public abstract NSDictionary
snapshot
()
See Also: updateFromSnapshot
toManyRelationshipKeys
public abstract NSArray
toManyRelationshipKeys
()
See Also: attributeKeys, toOneRelationshipKeys
toOneRelationshipKeys
public abstract NSArray
toOneRelationshipKeys
()
See Also: attributeKeys, toManyRelationshipKeys
updateFromSnapshot
public abstract void
updateFromSnapshot
(NSDictionary aSnapshot)
See Also: snapshot
userPresentableDescription
public abstract String
userPresentableDescription
()
Returns a short (no longer than 60 characters) description of an enterprise object based on its data. EOCustomObject's implementation enumerates the object's attributeKeys and returns the values of all of its properties, separated by commas (applying the default formatter for numbers and dates).
See Also: eoDescription, eoShallowDescription
willChange
public abstract void
willChange
()
public void setRoleName(String value) { willChange(); roleName = value; }
In com.apple.client.eocontrol, this method invokes willRead.