Documentation Archive Developer
Search
PATH Documentation > WebObjects

Table of Contents

EODatabaseDataSource


Inherits from:
com.webobjects.eocontrol.EODataSource
Implements:
Serializable
Package:
com.webobjects.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 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


Constructors
EODatabaseDataSource
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
Other
deleteObject
insertObject
dataSourceQualifiedByKey
qualifyWithRelationshipKey


Constructors



EODatabaseDataSource

public EODatabaseDataSource( com.webobjects.eocontrol.EOEditingContext anEditingContext, String anEntityName)

Creates and returns a new EODatabaseDataSource object. The new EODatabaseDataSource fetches objects into anEditingContext for the EOEntity named by anEntityName. If anEditingContext's EOObjectStoreCoordinator (EOControl) doesn't have an EODatabaseContext to service the model containing the named entity, one is created. The new data source uses a fetch specification that fetches all the entity's objects.

public EODatabaseDataSource( com.webobjects.eocontrol.EOEditingContext anEditingContext, String anEntityName, 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 EOObjectStoreCoordinator (EOControl) doesn't have an EODatabaseContext to service the model containing the named entity, one is created. The fetchSpecificationName argument is used to find the named fetch specification in the entity. If the fetchSpecificationName is not included or is null, a new fetch specification that fetches all the entity's objects is created.


Static Methods



decodeObject

public static Object decodeObject(NSCoder object)

Description forthcoming.

decodeWithKeyValueUnarchiver

public static Object decodeWithKeyValueUnarchiver(EOKeyValueUnarchiver unarchiver)

Conformance to EOKeyValueArchiving.


Instance Methods



auxiliaryQualifier

public com.webobjects.eocontrol.EOQualifier auxiliaryQualifier()

Returns the EOQualifier used to further filter the objects fetched by the receiver's EOFetchSpecification (in EOControl).

See Also: fetchSpecificationForFetch, fetchSpecification



awakeFromKeyValueUnarchiver

public void awakeFromKeyValueUnarchiver(EOKeyValueUnarchiver unarchiver)

Conformance to EOKeyValueArchiving.Awaking.

awakeFromNib

public void awakeFromNib()

Description forthcoming.

classDescriptionForObjects

public com.webobjects.eocontrol.EOClassDescription classDescriptionForObjects()

Description forthcoming.

classForCoder

public Class classForCoder()

Description forthcoming.

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.webobjects.eocontrol.EODataSource dataSourceQualifiedByKey(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(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.

editingContext

public com.webobjects.eocontrol.EOEditingContext editingContext()

Description forthcoming.

encodeWithCoder

public void encodeWithCoder(NSCoder coder)

Description forthcoming.

encodeWithKeyValueArchiver

public void encodeWithKeyValueArchiver( com.webobjects.eocontrol.EOKeyValueArchiver archiver)

Conformance to EOKeyValueArchiving.

entity

public EOEntity entity()

Returns the EOEntity from which the receiver fetches objects.

fetchObjects

public NSArray fetchObjects()

Description forthcoming.

fetchSpecification

public com.webobjects.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.webobjects.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 String fetchSpecificationName()

Returns the name of the fetch specification (or null if there is no name).

See Also: setFetchSpecificationByName



insertObject

public void insertObject(Object anObject)

Inserts anObject 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.

qualifyWithRelationshipKey

public void qualifyWithRelationshipKey( String key, 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.webobjects.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



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 qualifyWithRelationshipKey invokes this method to enable or disable fetching based on whether a master object is provided.

See Also: isFetchEnabled



setFetchSpecification

public void setFetchSpecification( com.webobjects.eocontrol.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 null.

See Also: setAuxiliaryQualifier, fetchSpecificationForFetch, setFetchSpecificationByName



setFetchSpecificationByName

public void setFetchSpecificationByName(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: fetchSpecification, fetchSpecificationName



setParentDataSourceRelationshipKey

public void setParentDataSourceRelationshipKey( com.webobjects.eocontrol.EODataSource dataSource, String key)

Description forthcoming.

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



© 2001 Apple Computer, Inc. (Last Published April 13, 2001)


Table of Contents