|
WebObjects 5.4.2 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.webobjects.eocontrol.EODataSource com.webobjects.eocontrol.EODetailDataSource
public class 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.
EODetailDataSource.fetchObjects()
,
EODetailDataSource.insertObject(Object anObject)
,
EODetailDataSource.deleteObject(Object anObject)
,
EODetailDataSource.qualifyWithRelationshipKey(String relationshipKey, Object masterObject)
,
Serialized FormNested Class Summary |
---|
Nested classes/interfaces inherited from interface 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 detailKeyPath)
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 objectEODetailDataSource.masterObject()
,
EODetailDataSource.detailKey()
,
EODetailDataSource.qualifyWithRelationshipKey( String relationshipKey , Object masterObject)
,
EODetailDataSource.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 relationshipEODetailDataSource.masterDataSource()
Method Detail |
---|
public static Object decodeWithKeyValueUnarchiver(EOKeyValueUnarchiver unarchiver)
EOKeyValueArchiving
.
unarchiver
-
public void encodeWithKeyValueArchiver(EOKeyValueArchiver archiver)
EOKeyValueArchiving
.
encodeWithKeyValueArchiver
in interface EOKeyValueArchiving
archiver
- EOKeyValueArchiver
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 objectEODetailDataSource.fetchObjects()
,
EODetailDataSource.detailKey()
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 inserted
exception
- if there's no master object or no detail keysetpublic 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 deleted
exception
- if there's no master object or no detail key setpublic EOEditingContext editingContext()
null
if there is not one
editingContext
in class EODataSource
public EOClassDescription classDescriptionForObjects()
classDescriptionForObjects
in class EODataSource
public EODataSource masterDataSource()
EODetailDataSource.detailKey()
,
EODetailDataSource.EODetailDataSource(EOClassDescription masterClassDescription, String key)
public void setMasterClassDescription(EOClassDescription master)
master
as the EOClassDescription for the receiver's master object.
master
- EOClassDescription for the receiver's master objectEODetailDataSource.masterClassDescription()
public EOClassDescription masterClassDescription()
EOClassDescription
of the receiver's master objectEODetailDataSource.setMasterClassDescription(EOClassDescription master)
,
EODetailDataSource.EODetailDataSource(EOClassDescription masterClassDescription, String key)
public String detailKey()
null
if it has not been set yetEODetailDataSource.qualifyWithRelationshipKey(String relationshipKey, Object masterObject)
public void setDetailKey(String detailKeyPath)
detailKeyPath
- used to qualify the master-detail relationship of the datasourcepublic Object masterObject()
EODetailDataSource.detailKey()
,
EODetailDataSource.qualifyWithRelationshipKey( String relationshipKey, Object masterObject)
public EODataSource dataSourceQualifiedByKey(String key)
dataSourceQualifiedByKey
in class EODataSource
key
- relationship key that is the destination object of the relationship
EODataSource.qualifyWithRelationshipKey(String key, Object sourceObject)
|
Last updated June 2008 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |