|
WebObjects 5.2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.webobjects.eocontrol.EODataSource | +--com.webobjects.eocontrol.EODetailDataSource
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. It works for any concrete subclass of EODataSource,
including another EODetailDataSource in a chain of master and
detail data sources.
To set up an EODetailDataSource programmatically, you can 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.
fetchObjects()
,
insertObject(Object anObject)
,
deleteObject(Object anObject)
,
qualifyWithRelationshipKey(String relationshipKey, Object masterObject)
, Serialized FormInner classes inherited from class com.webobjects.eocontrol.EOKeyValueArchiving |
EOKeyValueArchiving.Awaking, EOKeyValueArchiving.FinishInitialization, EOKeyValueArchiving.Support |
Constructor Summary | |
EODetailDataSource(EOClassDescription masterClassDescription,
String key)
Creates and returns a new EODetailDataSource object. |
|
EODetailDataSource(EODataSource masterDataSource,
String key)
Creates and returns a new EODetailDataSource object. |
Method Summary | |
EOClassDescription |
classDescriptionForObjects()
Returns the class description for the detail object if a detail key is defined, otherwise returns the master class description |
EODataSource |
dataSourceQualifiedByKey(String key)
Creates an EODetailDataSource for key. |
static Object |
decodeWithKeyValueUnarchiver(EOKeyValueUnarchiver unarchiver)
Provides conformance to EOKeyValueArchiving . |
void |
deleteObject(Object eo)
Sends a removeObjectFromBothSidesOfRelationshipWithKey message
to the master object using detailKey . |
String |
detailKey()
Gets the detail key of the receiver, which names the relationship for which the receiver provides objects to its master object. |
EOEditingContext |
editingContext()
Returns the editing context of the master data source, or null if there is not one |
void |
encodeWithKeyValueArchiver(EOKeyValueArchiver archiver)
Provides conformance to EOKeyValueArchiving . |
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. |
void |
insertObject(Object eo)
Sends an addObjectToBothSidesOfRelationshipWithKey message
to the master object. |
EOClassDescription |
masterClassDescription()
Gets the EOClassDescription for the receiver's master object. |
EODataSource |
masterDataSource()
Gets the master data source for the receiver. |
Object |
masterObject()
Returns the master object of the receiver. |
void |
qualifyWithRelationshipKey(String key,
Object sourceObject)
Configures the receiver to provide objects based on the relationship of sourceObject named by key . |
void |
setDetailKey(String detailKey)
Sets the detail key of the receiver, which names the relationship for which the receiver provides objects to its master object. |
void |
setMasterClassDescription(EOClassDescription master)
Assigns master as the EOClassDescription for
the receiver's master object. |
Methods inherited from class com.webobjects.eocontrol.EODataSource |
createObject |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public EODetailDataSource(EOClassDescription masterClassDescription, String key)
masterObject
is associated with
masterClassDescription
, and key
is assigned to the new data
source's detailKey
. The constructor invokes
qualifyWithRelationshipKey
specifying key
as the relationship key and null
as the object.masterClassDescription
- class description for the master objectkey
- keypath defining relationship on the master objectmasterObject()
,
detailKey()
,
qualifyWithRelationshipKey( String relationshipKey
, Object masterObject)
,
masterClassDescription()
public EODetailDataSource(EODataSource masterDataSource, String key)
EODetailDataSource
object. The new data
source provides destination objects for the relationship named by a
key
from a masterObject
in masterDataSource
.masterDataSource
- provider of the master objectskey
- the String giving the new relationshipmasterDataSource()
Method Detail |
public EOClassDescription classDescriptionForObjects()
classDescriptionForObjects
in class EODataSource
public EODataSource dataSourceQualifiedByKey(String key)
dataSourceQualifiedByKey
in class EODataSource
key
- relationship key that is the
destination object of the relationshipEODataSource.qualifyWithRelationshipKey(String key,
Object sourceObject)
public static Object decodeWithKeyValueUnarchiver(EOKeyValueUnarchiver unarchiver)
EOKeyValueArchiving
.unarchiver
- public void deleteObject(Object eo)
removeObjectFromBothSidesOfRelationshipWithKey
message
to the master object using detailKey
. Throws an IllegalStateException if there is no master object or no
detail key set.deleteObject
in class EODataSource
eo
- object to be deletedexception
- if there's no master object or no detail key setpublic String detailKey()
null
if it has not been set yetqualifyWithRelationshipKey(String relationshipKey, Object masterObject)
public EOEditingContext editingContext()
null
if there is not oneeditingContext
in class EODataSource
public void encodeWithKeyValueArchiver(EOKeyValueArchiver archiver)
EOKeyValueArchiving
.encodeWithKeyValueArchiver
in interface EOKeyValueArchiving
archiver
- public NSArray fetchObjects()
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.fetchObjects
in class EODataSource
public void insertObject(Object eo)
addObjectToBothSidesOfRelationshipWithKey
message
to the master object.insertObject
in class EODataSource
eo
- object to be insertedexception
- if there's no master object or no detail keysetpublic EOClassDescription masterClassDescription()
EOClassDescription
of the receiver's master objectsetMasterClassDescription(EOClassDescription master)
,
EODetailDataSource(EOClassDescription masterClassDescription, String key)
public EODataSource masterDataSource()
detailKey()
,
EODetailDataSource(EOClassDescription masterClassDescription, String key)
public Object masterObject()
detailKey()
,
qualifyWithRelationshipKey( String relationshipKey, Object masterObject)
public void qualifyWithRelationshipKey(String key, Object sourceObject)
sourceObject
named by key
. Relationship key can be
different from the one provided to the constructor, which changes
the relationship the receiver operates on. If sourceObject
is null
this method causes the receiver to return an empty array
when sent a fetchObjects
message.qualifyWithRelationshipKey
in class EODataSource
key
- relationship keysourceObject
- the source objectfetchObjects()
,
detailKey()
public void setDetailKey(String detailKey)
keypath
- used to qualify the master-detail relationship of the datasourcepublic void setMasterClassDescription(EOClassDescription master)
master
as the EOClassDescription for
the receiver's master object.master
- EOClassDescription for the receiver's master objectmasterClassDescription()
|
Last updated Fri Feb 21 13:15:00 PST 2003. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |