PATH
Documentation > WebObjects 4.5 >
EOControl Reference
- Inherits
from:
- EODataSource
- NSObject
- Conforms to:
- NSObject
- (NSObject)
Declared in: - EOControl/EODetailDataSource.h
Class Description
EODetailDataSource defines a data source for use in master-detail
configurations, where operations in the detail data source are applied
directly to properties of a master object. EODetailDataSource implements
the standard fetchObjects, insertObject:,
and deleteObject: methods
to operate on a relationship property of its master object, so it
works for any concrete subclass of EODataSource, including another
EODetailDataSource (for a chain of three master and detail data
sources).
To set up an EODetailDataSource programmatically, you typically
create it by sending a dataSourceQualifiedByKey: message
to the master data source, then establish the master object with
a qualifyWithRelationshipKey:ofObject: message.
The latter method records the name of a relationship for a particular
object to resolve in fetchObjects and to
modify in insertObject:, and deleteObject:. These
three methods then manipulate the relationship property of the master
object to perform the operations requested. See the individual method
descriptions for more information.
Method Types
- Creating instances
- - initWithMasterClassDescription:detailKey:
- - initWithMasterDataSource:detailKey:
- Qualifying instances
- - qualifyWithRelationshipKey:ofObject:
- Examining instances
- - masterDataSource
- - detailKey
- - masterObject
- Accessing the master
class description
- - masterClassDescription
- - setMasterClassDescription:
- Accessing the objects
- - fetchObjects
- Inserting and deleting
objects
- - insertObject:
- - deleteObject:
- Accessing the master
editing context
- - editingContext
Instance Methods
- (void)deleteObject:(id)anObject
Sends a removeObject:fromPropertyWithKey: message
(defined in the EORelationshipManipulation informal
protocol) to the master object with anObject and
the receiver's detail key as the arguments. Raises an NSInternalInconsistencyException if
there's no master object or no detail key set.
- (NSString *)detailKey
Returns the name of the relationship for which
the receiver provides objects, as provided to initWithMasterDataSource:detailKey: or
as set in qualifyWithRelationshipKey:ofObject:.
If none has been set yet, returns nil.
- (EOEditingContext *)editingContext
Returns the EOEditingContext of the master object,
or nil if there isn't one.
- (NSArray *)fetchObjects
Sends valueForKey: (defined in the EOKeyValueCoding informal
protocol) to the master object with the receiver's detail key
as the argument, constructs an array for the returned object or
objects, and returns it. Returns an empty array if there's no
master object, or returns an array containing the master object itself
if no detail key is set.
- initWithMasterClassDescription:(EOClassDescription
*)masterClassDescription detailKey:(NSString
*)relationshipKey
Initializes a newly allocated EODetailDataSource
to provide objects based on a relationship of objects in the master
object associated with masterClassDescription.
Invokes qualifyWithRelationshipKey:ofObject: with relationshipKey specified
as the relationship key and nil specified as the object. The receiver
initially has no master object selected; to select one, use qualifyWithRelationshipKey:ofObject:.
This is the designated initializer for the EODetailDataSource class.
Returns self.See
Also: - masterClassDescription, - detailKey
- (id)initWithMasterDataSource:(EODataSource
*)masterDataSource
detailKey:(NSString *)relationshipKey
Initializes a newly allocated EODetailDataSource
to provide objects based on a relationship of objects in masterDataSource named
by relationshipKey. Invokes initWithMasterClassDescription:detailKey: with
nil specified for the class description and relationshipKey specified
as the detail key. The receiver initially has no master object selected;
to select one, use qualifyWithRelationshipKey:ofObject:. Returns self.See
Also: - masterDataSource, - detailKey
- (void)insertObject:(id)anObject
Sends an addObject:toBothSidesOfRelationshipWithKey: message
(defined in the EORelationshipManipulation informal
protocol) to the master object with anObject and
the receiver's detail key as the arguments. Raises an NSInternalInconsistencyException if
there's no master object or no detail key set.
- (EOClassDescription *)masterClassDescription
Returns the EOClassDescription of the receiver's
master object.See Also: - setMasterClassDescription:, - initWithMasterClassDescription:detailKey:
- (EODataSource *)masterDataSource
Returns the receiver's master data source.See
Also: - detailKey, - initWithMasterDataSource:detailKey:
- (id)masterObject
Returns the object in the master data source
for which the receiver provides objects. You can change this with
a qualifyWithRelationshipKey:ofObject: message.See
Also: - detailKey
- (void)qualifyWithRelationshipKey:(NSString
*)relationshipKey
ofObject:(id)masterObject
Configures the receiver to provide objects based
on the relationship of masterObject named
by relationshipKey. relationshipKey can
be different from the one used with initWithMasterDataSource:detailKey:,
which changes the relationship the receiver operates on. If masterObject is nil,
this method causes the receiver to return an empty array when sent
a fetchObjects message.See
Also: - detailKey
- (void)setMasterClassDescription:(EOClassDescription
*)classDescription
Assigns classDescription as
the EOClassDescription for the receiver's master object.See
Also: - masterClassDescription