PATH Documentation > WebObjects

Table of Contents

EODetailDataSource


Inherits from:
EODataSource
Implements:
EOKeyValueArchiving
Serializable
Package:
com.webobjects.eocontrol


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 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


Constructors
EODetailDataSource
Qualifying instances
qualifyWithRelationshipKey
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


Constructors



EODetailDataSource

public EODetailDataSource( EOClassDescription masterClassDescription, String relationshipKey)

Creates and returns a new EODetailDataSource object. The new data source's masterObject is associated with masterClassDescription, and relationshipKey is assigned to the new data source's detailKey. The constructor invokes qualifyWithRelationshipKey specifying relationshipKey as the relationship key and null as the object.

See Also: masterClassDescription

public EODetailDataSource( EODataSource masterDataSource, String relationshipKey)

Creates and returns a new EODetailDataSource object. The new data source provides destination objects for the relationship named by relationshipKey from a masterObject in masterDataSource.

See Also: masterDataSource




Static Methods



decodeWithKeyValueUnarchiver

public static Object decodeWithKeyValueUnarchiver(EOKeyValueUnarchiver unarchiver)

Conformance to EOKeyValueArchiving.


Instance Methods



classDescriptionForObjects

public EOClassDescription classDescriptionForObjects()

Description forthcoming.

dataSourceQualifierByKey

public EODataSource dataSourceQualifiedByKey(String aKey)

Description forthcoming.

deleteObject

public void deleteObject(Object anObject)

Sends a removeObjectFromPropertyWithKey message (defined in the EORelationshipManipulation interface) to the master object with anObject and the receiver's detail key as the arguments. Throws an exception if there's no master object or no detail key set.

detailKey

public String detailKey()

Returns the name of the relationship for which the receiver provides objects, as provided to the constructor when the receiver was createdor as set in qualifyWithRelationshipKey. If none has been set yet, returns null.

editingContext

public EOEditingContext editingContext()

Returns the EOEditingContext of the master object, or null if there isn't one.

encodeWithKeyValueUnarchiver

public void encodeWithKeyValueUnarchiver(EOKeyValueUnarchiver unarchiver)

Conformance to EOKeyValueArchiving.

fetchObjects

public NSArray fetchObjects()

Sends valueForKey (defined in the NSKeyValueCoding interface) 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.

insertObject

public void insertObject(Object anObject)

Sends an addObjectToBothSidesOfRelationshipWithKey message (defined in the EORelationshipManipulation interface) to the master object with anObject and the receiver's detail key as the arguments. Throws an exception if there's no master object or no detail key set.

masterClassDescription

public EOClassDescription masterClassDescription()

Returns the EOClassDescription of the receiver's master object.

See Also: setMasterClassDescription, EODetailDataSource constructor



masterDataSource

public EODataSource masterDataSource()

Returns the receiver's master data source.

See Also: detailKey, EODetailDataSource constructor



masterObject

public Object masterObject()

Returns the object in the master data source for which the receiver provides objects. You can change this with a qualifyWithRelationshipKey message.

See Also: detailKey



qualifyWithRelationshipKey

public void qualifyWithRelationshipKey( String relationshipKey, Object masterObject)

Configures the receiver to provide objects based on the relationship of masterObject named by relationshipKey. relationshipKey can be different from the one provided to the constructor, which changes the relationship the receiver operates on. If masterObject is null, this method causes the receiver to return an empty array when sent a fetchObjects message.

See Also: detailKey



setDetailKey

public void setDetailKey(String detailKey)

Description forthcoming.

setMasterClassDescription

public void setMasterClassDescription(EOClassDescription classDescription)

Assigns classDescription as the EOClassDescription for the receiver's master object.

See Also: masterClassDescription



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


Table of Contents