PATH
Documentation > WebObjects 4.5 >
EOAccess Reference
Inherits
from: EODataSource (EOControl) : NSObject
Conforms to: NSObject
(NSObject)
Declared in: EOAccess/EODatabaseDataSource.h
Class Description
EODatabaseDataSource is a concrete subclass of EODataSource
(defined in EOControl) that fetches objects based on an EOModel,
using an EODatabaseContext that services the data source's EOEditingContext
(defined in EOControl). An EODatabaseDataSource can be set up to
fetch all objects for its root entity, to fetch objects matching
a particular EOFetchSpecification, and to further filter its fetching
with an auxiliary qualifier.
EODatabaseDataSource implements all the functionality defined
by EODataSource: In addition to fetching objects, it can insert
and delete them (provided the entity isn't read-only). See the EODataSource
class specification for more information on these topics.
As with other data sources, EODatabaseDataSource can also
provide a detail data source. The most significant consequence of
using an master-detail configuration is that the detail operates
directly on the master's object graph. The EODetailDataSource
has a master object and a detail key through which
the detail data source accesses the its objects. The master object
is simply the object that's selected in the master display group,
and the detail key is the name of a relationship property in the
master object. When the detail display group asks its data source
to fetch, the EODetailDataSource simply gets the value for the relationship
property identified by the detail key from its master object and
returns it. When you add and remove objects from the detail, you're
directly modifying the master's relationship array. In fact, you
can think of EODetailDataSource as an interface to its master object's
relationship property.
Method Types
- Creating instances
- - initWithEditingContext:entityName:
- - initWithEditingContext:entityName:
- Accessing selection criteria
- - auxiliaryQualifier
- - fetchSpecification
- - fetchSpecificationForFetch
- - fetchSpecificationName
- - setAuxiliaryQualifier:
- - setFetchSpecification:
- - setFetchSpecificationByName:
- Accessing objects used
for fetching
- - entity
- - databaseContext
- Enabling fetching
- - setFetchEnabled:
- - isFetchEnabled
- Accessing qualifier bindings
- - qualifierBindingKeys
- - qualifierBindings
- - setQualifierBindings:
Instance Methods
- (EOQualifier *)auxiliaryQualifier
Returns the EOQualifier used to further filter
the objects fetched by the receiver's EOFetchSpecification (in
EOControl). See Also: - fetchSpecificationForFetch, - fetchSpecification
- (EODatabaseContext *)databaseContext
Returns the EODatabaseContext that the receiver
uses to access the external database. This is either the root EOObjectStore
for the receiver's EOEditingContext, or if the root is an EOCooperatingObjectStore, it's
the EODatabaseContext under that EOCooperatingObjectStore that services
the EOModel containing the EOEntity for the receiver. (EOObjectStore,
EOEditingContext, and EOCooperatingObjectStore are all defined in
EOControl.)
- (EOEntity *)entity
Returns the EOEntity from which the receiver
fetches objects.
- (EOFetchSpecification *)fetchSpecification
Returns the receiver's basic EOFetchSpecification.
Its EOQualifier is conjoined with the receiver's auxiliary EOQualifier
when the receiver fetches objects. The sender of this message can
alter the EOFetchSpecification directly, or replace it using setFetchSpecification:.See
Also: fetchSpecificationForFetch, auxiliaryQualifier
- (EOFetchSpecification *)fetchSpecificationForFetch
Returns a copy of the EOFetchSpecification that
the receiver uses to fetch. This is constructed by conjoining the
EOQualifier of the receiver's EOFetchSpecification with its auxiliary
EOQualifier. Modifying the returned EOFetchSpecification doesn't
affect the receiver's fetching behavior; use setFetchSpecification: and setAuxiliaryQualifier: for that purpose.See
Also: - fetchSpecification, - auxiliaryQualifier
- (NSString *)fetchSpecificationName
Returns the name of the fetch specification
(or nil if there is no name).See Also: - setFetchSpecificationByName:
- (id)initWithEditingContext:(EOEditingContext
*)anEditingContext
entityName:(NSString *)anEntityName
Initializes a newly allocated EODatabaseDataSource
to fetch objects into anEditingContext for
the EOEntity named by anEntityName.
This method checks anEditingContext's
EOObjectStoreCoordinator for an EODatabaseChannel that services
the EOModel containing the named EOEntity. If none exists, this
method creates one. This method works by calling initWithEditingContext:entityName: and specifying nil for
the fetchSpecificationName.
- (id)initWithEditingContext:(EOEditingContext
*)anEditingContext
entityName:(NSString *)anEntityName
fetchSpecificationName:(NSString
*)fetchSpecificationName
Initializes a newly allocated EODatabaseDataSource
to fetch objects into anEditingContext for
the EOEntity named by anEntityName.
This method checks anEditingContext's
EOObjectStoreCoordinator for an EODatabaseChannel that services
the EOModel containing the named EOEntity. If none exists, this
method creates one. The fetchSpecificationName argument
is used to find the named fetch specification in the entity. If
the fetchSpecificationName is nil,
a new fetch specification will be instantiated that will fetch all
objects of the entity. This is the primitive initializer. Returns self.
- (BOOL)isFetchEnabled
Returns YES if the receiver's fetchObjects method
actually fetches objects, NO if it returns an empty array without
fetching. Fetching is typically disabled in a master-peer configuration
when no object is selected in the master.See
Also: - setFetchEnabled:
- (NSArray *)qualifierBindingKeys
Returns an array of strings which is a union
of the binding keys from the fetch specification's qualifier and
the data source's auxiliary qualifier.See
Also: - setQualifierBindings:
- (NSDictionary *)qualifierBindings
Returns a set of bindings that will be used
for variable replacement on the fetch specification's qualifier and
the auxiliary qualifier before the fetch is executed.
- (void)setAuxiliaryQualifier:(EOQualifier
*)aQualifier
Sets the receiver's auxiliary qualifier to aQualifier.
The auxiliary qualifier usually adds conditions to the primary qualifier
and is useful for narrowing the scope of a data source without altering
its primary qualifier. This is especially useful for setting a qualifier
on a qualified peer data source, since a peer's primary qualifiers
specifies the matching criteria for the relationship it fetches
for. For more information on auxiliary qualifiers, see "Creating
a Master-Peer Configuration" in the "WebObjects Programming
Topics." See Also: - fetchSpecificationForFetch, - fetchSpecification
- (void)setFetchEnabled:(BOOL)flag
Controls whether the receiver can fetch. If flag is YES the
receiver's fetchObjects method actually fetches
objects, if NO it returns an empty array without fetching. Fetching
is typically disabled in a master-peer configuration when no object
is selected in the master. For example, EODatabaseDataSource's
implementation of qualifyWithRelationshipKey:ofObject: invokes
this method to enable or disable fetching based on whether a master
object is provided.See Also: - isFetchEnabled
- (void)setFetchSpecification:(EOFetchSpecification
*)fetchSpec
Sets the receiver's basic EOFetchSpecification
to fetchSpec. Its EOQualifier is
conjoined with the receiver's auxiliary EOQualifier when the receiver
fetches objects. This method also sets the name of the fetch specification
to nil.See Also: - setAuxiliaryQualifier:, - fetchSpecificationForFetch, - setFetchSpecificationByName:
- (void)setFetchSpecificationByName:(NSString
*)fetchSpecificationName
Sets the fetchSpecificationName as
given, and sets the fetch specification (used when supplying objects)
to the named fetch specification of the entity that was used to
initialize the data source. This method is an alternative to setFetchSpecification:.See
Also: - fetchSpecification, - fetchSpecificationName
- (NSDictionary *)setQualifierBindings:(NSDictionary
*)bindings
Sets a set of bindings that will be used for
variable replacement on the fetch specification's qualifier and the
auxiliary qualifier before the fetch is executed.See
Also: - qualifierBindingKeys