WebObjects 5.4.2

com.webobjects.eocontrol
Class EODataSource

java.lang.Object
  extended by com.webobjects.eocontrol.EODataSource
Direct Known Subclasses:
EOArrayDataSource, EODatabaseDataSource, EODetailDataSource, EODistributedDataSource

public abstract class EODataSource
extends Object

EODataSource is an abstract class that defines a basic API for providing enterprise objects. It exists primarily as a simple means for a display group (EODisplayGroup from EOInterface or WODisplayGroup from WebObjects) or other higher level class to access a store of objects. EODataSource defines functional implementations of concrete subclasses, such as EODatabaseDataSource (defined in com.webobjects.eoaccess) and EODetailDataSource, which define working data sources by implementing the others. EODatabaseDataSource, for example, provides objects fetched through an EOEditingContext, while EODetailDataSource provides objects from a relationship property of a master object.

An EODataSource provides its objects with its fetchObjects method. insertObject and deleteObject add and remove individual objects, while createObject instantiates new objects. Other methods provide information about the objects.

See EODataSourceConcepts for more information.

See Also:
EODataSource.fetchObjects(), EODataSource.insertObject(Object eo), EODataSource.deleteObject(Object eo), EODataSource.createObject()

Constructor Summary
EODataSource()
           
 
Method Summary
 EOClassDescription classDescriptionForObjects()
          Implemented by subclasses to return an EOClassDescription that provides information about the objects provided by the receiver.
 Object createObject()
          Creates a new object, inserts it in the receiver's collection of objects if appropriate, and returns the object.
abstract  EODataSource dataSourceQualifiedByKey(String key)
          Implemented by subclasses to provide the destination objects of a relationship.
abstract  void deleteObject(Object eo)
          Implemented by subclasses to delete an object.
 EOEditingContext editingContext()
          Implemented by subclasses to return the receiver's EOEditingContext.
 NSArray fetchObjects()
          Implemented by subclasses to fetch and return the objects provided by the receiver.
abstract  void insertObject(Object eo)
          Implemented by subclasses to insert objects.
abstract  void qualifyWithRelationshipKey(String key, Object sourceObject)
          Implemented by subclasses to qualify the receiver, a detailed EODataSource, to display destination objects for a relationship.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EODataSource

public EODataSource()
Method Detail

createObject

public Object createObject()
Creates a new object, inserts it in the receiver's collection of objects if appropriate, and returns the object. Returns null if the receiver can't create the object or can't insert it. You should invoke insertObject after this method to actually add the new object to the receiver.

As a convenience, EODataSource's implementation sends the receiver's EOClassDescription a createInstanceWithEditingContext message to create the object. If this succeeds and the receiver has an EOEditingContext, it sends the EOEditingContext an insertObject message to register the new object with the EOEditingContext (note that this does not insert the object into the EODataSource). Subclasses that don't use EOClassDescriptions or EOEditingContexts should override this method without invoking the superclass's implementation.

Returns:
null if the receiver can't create the object or can't insert it, otherwise returns the object
See Also:
EODataSource.insertObject(Object object), EOClassDescription.createInstanceWithEditingContext( EOEditingContext editingContext, EOGlobalID globalID), EODataSource.classDescriptionForObjects(), EODataSource.editingContext()

insertObject

public abstract void insertObject(Object eo)
Implemented by subclasses to insert objects.

Parameters:
eo - the object to be inserted
Throws:
exception - on EODataSource's implementation

deleteObject

public abstract void deleteObject(Object eo)
Implemented by subclasses to delete an object. EODataSource's implementation merely throws an exception. Subclasses shouldn't invoke the superclass's implementation.

Parameters:
eo - the object to be deleted
Throws:
exception - on EODataSource's implementation

fetchObjects

public NSArray fetchObjects()
Implemented by subclasses to fetch and return the objects provided by the receiver.

Returns:
objects provided when implemented by subclasses, null when implemented by EODataSource

editingContext

public EOEditingContext editingContext()
Implemented by subclasses to return the receiver's EOEditingContext.

Returns:
receiver's EOEditingContext when implemented by subclasses, null when implemented by EODataSource

classDescriptionForObjects

public EOClassDescription classDescriptionForObjects()
Implemented by subclasses to return an EOClassDescription that provides information about the objects provided by the receiver.

Returns:
subclasses return an EOClassDescription EODataSource returns null

dataSourceQualifiedByKey

public abstract EODataSource dataSourceQualifiedByKey(String key)
Implemented by subclasses to provide the destination objects of a relationship. The detail EODataSource can be qualified using qualifyWithRelationshipKey to set a specific master object or to change the relationship key.

Parameters:
key - the relationship key
Returns:
a detail EODataSource
Throws:
exception - on EODataSource's implementation.
See Also:
EODataSource.qualifyWithRelationshipKey( String key, Object sourceObject)

qualifyWithRelationshipKey

public abstract void qualifyWithRelationshipKey(String key,
                                                Object sourceObject)
Implemented by subclasses to qualify the receiver, a detailed EODataSource, to display destination objects for a relationship. The key should be the same as the key specified in the dataSourceQualifiedByKey message that created the receiver. If source object is null, the receiver qualifies itself to provide no objects.

Parameters:
key - names the relationship the objects is to be displayed with
sourceObject - destination objects belongs to this
Throws:
exception - on EODataSource's implementation.
See Also:
EODataSource.dataSourceQualifiedByKey(String key)

Last updated June 2008

Copyright © 2000-2008 Apple Inc.