Documentation Archive Developer
Search
PATH  Documentation > WebObjects 4.5 > EOControl Reference

Table of Contents

EODataSource


Inherits from:
NSObject
Conforms to:
NSObject
(NSObject)
Declared in:
EOControl/EODataSource.h




Class Description


EODataSource is an abstract class that defines a basic API for providing enterprise objects. It exists primarily as a simple means for a display group (EODisplayGroup from EOInterface or WODisplayGroup from WebObjects) or other higher-level class to access a store of objects. EODataSource defines functional implementations of very few methods; concrete subclasses, such as EODatabaseDataSource (defined in EOAccess) and EODetailDataSource, define working data sources by implementing the others. EODatabaseDataSource, for example, provides objects fetched through an EOEditingContext, while EODetailDataSource provides objects from a relationship property of a master object. For information on creating your own EODataSource subclass, see the section "Creating a Subclass" .

An EODataSource provides its objects with its fetchObjects method. insertObject: and deleteObject: add and remove individual objects, and createObject instantiates a new object. Other methods provide information about the objects, as described below.




Method Types


Accessing the objects
- fetchObjects
Inserting and deleting objects
- createObject
- insertObject:
- deleteObject:
Creating detail data sources
- dataSourceQualifiedByKey:
- qualifyWithRelationshipKey:ofObject:
Accessing the editing context
- editingContext
Accessing the class description
- classDescriptionForObjects


Instance Methods



classDescriptionForObjects

- (EOClassDescription *)classDescriptionForObjects

Implemented by subclasses to return an EOClassDescription that provides information about the objects provided by the receiver. EODataSource's implementation returns nil.

createObject

- (id)createObject

Creates a new object, inserts it in the receiver's collection of objects if appropriate, and returns the object. Returns nil if the receiver can't create the object or can't insert it. You should invoke insertObject: after this method to actually add the new object to the receiver.

As a convenience, EODataSource's implementation sends the receiver's EOClassDescription a createInstanceWithEditingContext:globalID:zone: message to create the object. If this succeeds and the receiver has an EOEditingContext, it sends the EOEditingContext an insertObject: message to register the new object with the EOEditingContext (note that this does not insert the object into the EODataSource). Subclasses that don't use EOClassDescriptions or EOEditingContexts should override this method without invoking super's implementation.

See Also: - classDescriptionForObjects, - editingContext



dataSourceQualifiedByKey:

- (EODataSource *)dataSourceQualifiedByKey:(NSString *)relationshipKey

Implemented by subclasses to return a detail EODataSource that provides the destination objects of the relationship named by relationshipKey. The detail EODataSource can be qualified using qualifyWithRelationshipKey:ofObject: to set a specific master object (or to change the relationship key). EODataSource's implementation merely raises an NSInvalidArgumentException; subclasses shouldn't invoke super's implementation.

deleteObject:

- (void)deleteObject:(id)anObject

Implemented by subclasses to delete anObject. EODataSource's implementation merely raises an NSInvalidArgumentException; subclasses shouldn't invoke super's implementation.

editingContext

- (EOEditingContext *)editingContext

Implemented by subclasses to return the receiver's EOEditingContext. EODataSource's implementation returns nil.

fetchObjects

- (NSArray *)fetchObjects

Implemented by subclasses to fetch and return the objects provided by the receiver. EODataSource's implementation returns nil.

insertObject:

- (void)insertObject:(id)object

Implemented by subclasses to insert object. EODataSource's implementation merely raises an NSInvalidArgumentException; subclasses shouldn't invoke super's implementation.

qualifyWithRelationshipKey:ofObject:

- (void)qualifyWithRelationshipKey:(NSString *)key ofObject:(id)sourceObject

Implemented by subclasses to qualify the receiver, a detail EODataSource, to display destination objects for the relationship named key belonging to sourceObject. key should be the same as the key specified in the dataSourceQualifiedByKey: message that created the receiver. If sourceObject is nil, the receiver qualifies itself to provide no objects. EODataSource's implementation merely raises an NSInvalidArgumentException; subclasses shouldn't invoke super's implementation.


Table of Contents