Inherits From:
com.apple.yellow.eocontrol.EODataSource : NSObject
Inherits From:
com.apple.yellow.eoaccess
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 named 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.
EODatabaseDataSource
()
public EODatabaseDataSource
(com.apple.yellow.eocontrol.EOEditingContext anEditingContext, java.lang.String anEntityName)
public EODatabaseDataSource
(com.apple.yellow.eocontrol.EOEditingContext anEditingContext, java.lang.String anEntityName, java.lang.String fetchSpecificationName)
Creates and returns a new EODatabaseDataSource object. The new EODatabaseDataSource fetches objects into anEditingContext for the EOEntity named by anEntityName. If anEditingContext's com.apple.yellow.eocontrol.EOObjectStoreCoordinator doesn't have an EODatabaseChannel that services the EOModel containing the named EOEntity, this method creates one. The fetchSpecificationName argument is used to find the named fetch specification in the entity. If the fetchSpecificationName is not included or is nil
, a new fetch specification will be instantiated that will fetch all objects of the entity
Instance Methods
auxiliaryQualifier
public com.apple.yellow.eocontrol.EOQualifier auxiliaryQualifier
()
Returns the EOQualifier used to further filter the objects fetched by the receiver's EOFetchSpecification (in EOControl).
See also:
setAuxiliaryQualifier
, fetchSpecificationForFetch
, fetchSpecification
databaseContext
public 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.)
dataSourceQualifiedByKey
public com.apple.yellow.eocontrol.EODataSource dataSourceQualifiedByKey
(java.lang.String key)
Returns a detail data source that provides the destination objects of the relationship named by key. The returned detail data source can be qualified by using qualifierWithKey
to set a specific master object or to change the relationship key.
deleteObject
public void deleteObject
(java.lang.Object anObject)
Deletes anObject from the data source. This method raises an exception on failure. If the receiver registers undos for the deletion, the receiver may receive a possibly redundant insertObject
call.
entity
public EOEntity entity
()
Returns the EOEntity from which the receiver fetches objects.
See also: "Constructors"
fetchSpecification
public com.apple.yellow.eocontrol.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
fetchSpecificationForFetch
public com.apple.yellow.eocontrol.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
fetchSpecificationName
public java.lang.String fetchSpecificationName
()
Returns the name of the fetch specification (or null
if there is no name).
See also:
setFetchSpecificationByName
insertObject
public void insertObject
(java.lang.Object anObject)
Inserts object into the data source.
isFetchEnabled
public boolean isFetchEnabled()
Returns true
if the receiver's fetchObjects
method actually fetches objects, false
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
qualifierBindingKeys
public 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
qualifierBindings
public 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.
See also:
setQualifierBindings
qualifyWithRelationshipKey
public void qualifyWithRelationshipKey
(java.lang.String key, java.lang.Object sourceObject)
Displays 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 null
, the receiver qualifies itself to provide no objects.
setAuxiliaryQualifier
public void setAuxiliaryQualifier
(com.apple.yellow.eocontrol.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
, auxiliaryQualifier
setFetchEnabled
public void setFetchEnabled
(boolean flag)
Controls whether the receiver can fetch. If flag is true
the receiver's fetchObjects
method actually fetches objects, if false
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
See also:
isFetchEnabled
setFetchSpecification
public void setFetchSpecification
(com.apple.yellow.eocontrol.EOFetchSpecification aFetchSpecification)
Sets the receiver's basic EOFetchSpecification to aFetchSpecification. 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 null.
See also:
setAuxiliaryQualifier
, fetchSpecificationForFetch
, fetchSpecification
,
setFetchSpecificationByName
setFetchSpecificationByName
public void setFetchSpecificationByName
(java.lang.String 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:
fetchSpecificationName
setQualifierBindings
public void 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
, qualifierBindings