| 
WebObjects 5.2.2 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--com.webobjects.eocontrol.EOFetchSpecification
An EOFetchSpecification collects the criteria needed to select and order a group of records or enterprise objects, whether from an external repository such as a relational database or an internal store such as an EOEditingContext. An EOFetchSpecification contains these elements:
EOFetchSpecifications are most often used with the method
 objectsWithFetchSpecification, defined by EOObjectStore,
 EOEditingContext, and EODatabaseContext. EOAdaptorChannel and
 EODatabaseChannel also define methods that use EOFetchSpecifications.
| Nested Class Summary | 
| Nested classes inherited from class com.webobjects.foundation.NSCoding | 
NSCoding.Support | 
| Nested classes inherited from class com.webobjects.eocontrol.EOKeyValueArchiving | 
EOKeyValueArchiving.Awaking, EOKeyValueArchiving.FinishInitialization, EOKeyValueArchiving.Support | 
| Constructor Summary | |
EOFetchSpecification()
Creates a new EOFetchSpecification.  | 
|
EOFetchSpecification(String entityName,
                     EOQualifier qualifier,
                     NSArray sortOrderings)
Creates a new EOFetchSpecification with the arguments specified.  | 
|
EOFetchSpecification(String entityName,
                     EOQualifier qualifier,
                     NSArray sortOrderings,
                     boolean usesDistinct,
                     boolean isDeep,
                     NSDictionary hints)
Creates a new EOFetchSpecification with the arguments specified.  | 
|
| Method Summary | |
 Class | 
classForCoder()
Allows the receiver, before being encoded, to substitute a class other than its own in a coder.  | 
 Object | 
clone()
Implementation of the java.lang.Cloneable interface. | 
static Object | 
decodeObject(NSCoder coder)
(Re)creates an object based on type information and data stored in coder. | 
static Object | 
decodeWithKeyValueUnarchiver(EOKeyValueUnarchiver unarchiver)
(Re)creates an object based on information in unarchiver. | 
 void | 
encodeWithCoder(NSCoder coder)
Archives the receiver's type information and data into coder. | 
 void | 
encodeWithKeyValueArchiver(EOKeyValueArchiver archiver)
Archives the receiver's into archiver. | 
 String | 
entityName()
Returns the name of the entity to be fetched.  | 
 boolean | 
fetchesRawRows()
Returns whether the rawRowKeyPaths method returns non-null. | 
 int | 
fetchLimit()
Returns the fetch limit value which indicates the maximum number of objects to fetch.  | 
static EOFetchSpecification | 
fetchSpecificationNamed(String name,
                        String entityName)
Returns the fetch specification that the entity specified by entityName associates with the fetch specification
 name name. | 
 EOFetchSpecification | 
fetchSpecificationWithQualifierBindings(NSDictionary bindings)
Applies bindings from bindings to the receiver's qualifier if
 there is one, and returns a new fetch specification that can be used in a
 fetch. | 
 NSDictionary | 
hints()
Returns the receiver's hints, which other objects can use to alter or optimize fetch operations.  | 
 boolean | 
isDeep()
Returns true if a fetch should include sub-entities of the
 receiver's entity, false if it shouldn't. | 
 boolean | 
locksObjects()
Returns true if a fetch should result in the selected objects being
 locked in the data repository, false if it shouldn't. | 
 NSArray | 
prefetchingRelationshipKeyPaths()
Returns an array of relationship key paths that should be prefetched along with the main fetch.  | 
 boolean | 
promptsAfterFetchLimit()
Returns whether to prompt the user after the fetch limit has been reached.  | 
 EOQualifier | 
qualifier()
Returns the EOQualifier that indicates which records or objects the receiver is to fetch.  | 
 NSArray | 
rawRowKeyPaths()
Returns an array of attribute key paths that should be fetched as raw data and returned as an array of dictionaries (instead of the normal result of full objects).  | 
 boolean | 
refreshesRefetchedObjects()
Returns true if existing objects are overwritten with fetched
 values when they've been updated or changed. | 
 boolean | 
requiresAllQualifierBindingVariables()
Returns true to indicate that a missing binding will cause an
 exception to be raised during variable substitution. | 
 void | 
setEntityName(String entityName)
Sets the name of the root entity to be fetched to entityName. | 
 void | 
setFetchesRawRows(boolean fetchesRawRows)
Sets the behavior for fetching raw rows.  | 
 void | 
setFetchLimit(int fetchLimit)
Sets the fetch limit value which indicates the maximum number of objects to fetch.  | 
 void | 
setHints(NSDictionary hints)
Sets the receiver's hints to hints. | 
 void | 
setIsDeep(boolean isDeep)
Sets whether a fetch should include sub-entities of the receiver's entity.  | 
 void | 
setLocksObjects(boolean locksObjects)
Sets whether a fetch should result in the selected objects being locked in the data repository.  | 
 void | 
setPrefetchingRelationshipKeyPaths(NSArray keyPaths)
Sets an array of relationship key paths that should be prefetched along with the main fetch.  | 
 void | 
setPromptsAfterFetchLimit(boolean value)
Sets whether or not the application's message handler is notified when the fetch limit has been reached, enabling the message handler to prompt the user whether to continue to fetch more rows.  | 
 void | 
setQualifier(EOQualifier qualifier)
Sets this fetch specification's qualifier to qualifier. | 
 void | 
setRawRowKeyPaths(NSArray keyPaths)
Sets an array of attribute key paths that should be fetched as raw data and returned as an array of dictionaries (instead of the normal result of full objects).  | 
 void | 
setRefreshesRefetchedObjects(boolean refreshes)
Sets whether existing objects are overwritten with fetched values when they have been updated or changed.  | 
 void | 
setRequiresAllQualifierBindingVariables(boolean requires)
Sets the behavior when a missing binding is encountered during variable substitution.  | 
 void | 
setSortOrderings(NSArray sortOrderings)
Sets the receiver's array of EOSortOrderings to sortOrderings. | 
 void | 
setUsesDistinct(boolean usesDistinct)
Sets whether duplicate objects or records are removed after fetching.  | 
 NSArray | 
sortOrderings()
Returns the receiver's array of EOSortOrderings.  | 
 String | 
toString()
Returns a String representation of the receiver.  | 
 boolean | 
usesDistinct()
Returns true if duplicate objects or records are removed after
 fetching, false if they aren't. | 
| Methods inherited from class java.lang.Object | 
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Constructor Detail | 
public EOFetchSpecification()
setEntityName(String)
public EOFetchSpecification(String entityName,
                            EOQualifier qualifier,
                            NSArray sortOrderings,
                            boolean usesDistinct,
                            boolean isDeep,
                            NSDictionary hints)
qualifier is empty, such as an EOAndQualifier or EOOrQualifier
 whose array of elements contains zero qualifiers, this fetch specification
 will have its qualifier set to null
entityName - the name of the entity to fetchqualifier - the qualifier to use for fetchingsortOrderings - the sort orderings to use for fetchingusesDistinct - true if the fetch specification should be distinct; false otherwiseisDeep - true if the fetch specification should be deep; false otherwisehints - the hints to use for fetching
public EOFetchSpecification(String entityName,
                            EOQualifier qualifier,
                            NSArray sortOrderings)
qualifier is empty, such as an EOAndQualifier or EOOrQualifier
 whose array of elements contains zero qualifiers, this fetch specification
 will have its qualifier set to null
entityName - the name of the entity to fetchqualifier - the qualifier to use for fetchingsortOrderings - the sort orderings to use for fetching| Method Detail | 
public Class classForCoder()
classForCoder in interface NSCodingencodeWithCoder(NSCoder), 
decodeObject(NSCoder), 
NSCodingpublic Object clone()
java.lang.Cloneable interface.
clone in class Objectpublic static Object decodeObject(NSCoder coder)
coder.
coderencodeWithCoder(NSCoder coder), 
classForCoder(), 
NSCodingpublic static Object decodeWithKeyValueUnarchiver(EOKeyValueUnarchiver unarchiver)
unarchiver.
unarchiver - the key-value unarchiver with which the receiver should be decoded
unarchiverEOKeyValueArchivingpublic void encodeWithCoder(NSCoder coder)
coder.
 The receiver can then be recreated using decodeObject.  Custom
 type information can be used by overriding classForCoder.
encodeWithCoder in interface NSCodingcoder - the coder storing object type information along with an object's datadecodeObject(NSCoder), 
classForCoder(), 
NSCodingpublic void encodeWithKeyValueArchiver(EOKeyValueArchiver archiver)
archiver. The receiver can
 then be recreated using decodeWithKeyValueUnarchiver.
encodeWithKeyValueArchiver in interface EOKeyValueArchivingarchiver - the key-value archiver with which the receiver should be encodedEOKeyValueArchivingpublic String entityName()
setEntityName(String), 
isDeep()public int fetchLimit()
promptsAfterFetchLimit, the
 EODatabaseContext will either stop fetching objects when this limit is
 reached or it will ask the editing context's message handler to prompt the
 user as to whether or not it should continue fetching. Use 0 (zero) to
 indicate no fetch limit. The default is 0.
setFetchLimit(int), 
promptsAfterFetchLimit(), 
setPromptsAfterFetchLimit(boolean)
public static EOFetchSpecification fetchSpecificationNamed(String name,
                                                           String entityName)
entityName associates with the fetch specification
 name name.
name - the fetch specification nameentityName - the name of an entity for which to fetch records or objects
public EOFetchSpecification fetchSpecificationWithQualifierBindings(NSDictionary bindings)
bindings to the receiver's qualifier if
 there is one, and returns a new fetch specification that can be used in a
 fetch. The default behavior is to prune any nodes for which there are no
 bindings. You can invoke setRequiresAllQualifierBindingVariables
 with a true argument to force an exception to be raised if a
 binding is missing during variable substitution.
bindings - the bindings which are applied to the receiver's qualifier
setRequiresAllQualifierBindingVariables(boolean)public boolean fetchesRawRows()
rawRowKeyPaths method returns non-null.
true if rawRowKeyPaths returns non-null;
         false otherwiserawRowKeyPaths(), 
setFetchesRawRows(boolean)public NSDictionary hints()
setHints(NSDictionary)public boolean isDeep()
Returns true if a fetch should include sub-entities of the
 receiver's entity, false if it shouldn't. EOFetchSpecifications
 are deep by default.
For example, if you have a Person entity with two sub-entities, Employee and Customer, fetching Persons deeply also fetches all Employees and Customers matching the qualifier. Fetching Persons shallowly fetches only Persons matching the qualifier.
true if a fetch should include sub entities of the receiver's
         entity; false otherwisesetIsDeep(boolean)public boolean locksObjects()
true if a fetch should result in the selected objects being
 locked in the data repository, false if it shouldn't. The default
 is false.  Note that unnecessary locking could severely degrade
 the performance of certain repository operations.
true if a fetch should result in the selected objects being
         locked in the data repository; false otherwisesetLocksObjects(boolean)public NSArray prefetchingRelationshipKeyPaths()
setPrefetchingRelationshipKeyPaths(NSArray)public boolean promptsAfterFetchLimit()
false.
true if the user should be prompted after the fetch limit
         has been reached; false if fetching should just stop at that pointsetPromptsAfterFetchLimit(boolean), 
fetchLimit(), 
setFetchLimit(int)public EOQualifier qualifier()
setQualifier(EOQualifier)public NSArray rawRowKeyPaths()
null,
 indicating that full objects will be returned from the fetch. An empty array
 may be used to indicate that the fetch should query the entity named by the
 fetch specification using the method attributesToFetch. As long
 as the primary key attributes are included in the raw attributes, the raw
 row may be used to generate a fault for the corresponding object using
 EOEditingContext's faultForRawRow method.
setFetchesRawRows(boolean), 
setRawRowKeyPaths(NSArray), 
EOEditingContext.faultForRawRow(NSDictionary, String), 
EOEditingContext.faultForRawRow(NSDictionary, String, EOEditingContext)public boolean refreshesRefetchedObjects()
true if existing objects are overwritten with fetched
 values when they've been updated or changed. Returns false if
 existing objects aren't touched when their data is refetched (the fetched
 data is simply discarded). The default is false. Note that this
 setting does not affect relationships.
true if existing objects are overwritten with fetched values
         when they've been updated or changed; false otherwisesetRefreshesRefetchedObjects(boolean)public boolean requiresAllQualifierBindingVariables()
true to indicate that a missing binding will cause an
 exception to be raised during variable substitution. The default value is
 false, which says to prune any nodes for which there are no bindings.
true if a missing binding should cause an exception;
         false otherwisepublic void setEntityName(String entityName)
entityName.
entityName - the name of the root entity to be fetchedisDeep(), 
entityName()public void setFetchLimit(int fetchLimit)
promptsAfterFetchLimit, the
 EODatabaseContext either stops fetching objects when this limit is reached
 or asks the editing context's message handler to prompt the user as to
 whether or not it should continue fetching. Use 0 (zero) to indicate no
 fetch limit. The default is 0.
fetchLimit - the fetch limit value which indicates the maximum number of objects to fetchfetchLimit(), 
promptsAfterFetchLimit(), 
setPromptsAfterFetchLimit(boolean)public void setFetchesRawRows(boolean fetchesRawRows)
true, the behavior
 is the same as if setRawRowKeyPaths were called with an empty array
 (which causes fetchesRawRows to return true). If set to
 false, the behavior is as if setRawRowKeyPaths were 
 called with null as the argument (which causes fetchesRawRows
 to return false). Note that if rawRowKeyPaths has already
 had a value assigned to it, using this method will overwrite that value.
fetchesRawRows - true if rawRowKeyPaths returns non-null;
        false otherwiserawRowKeyPaths(), 
fetchesRawRows()public void setHints(NSDictionary hints)
hints. Any object that uses an
 EOFetchSpecification can define its own hints that it uses to alter or
 optimize fetch operations. For example, EODatabaseContext uses a hint
 identified by the key CustomQueryExpressionHintKey.
 EODatabaseContext is the only class in the standard Enterprise Objects
 Framework that defines fetch specification hints.
hints - the receiver's hintshints(), 
EODatabaseContextpublic void setIsDeep(boolean isDeep)
Sets whether a fetch should include sub-entities of the receiver's entity.
 If flag is true, sub-entities are also fetched;
 if flag is false, they aren't. EOFetchSpecifications
 are deep by default.
For example, if you have a Person entity with two sub-entities and subclasses, Employee and Customer, fetching Persons deeply also fetches all Employees and Customers matching the qualifier. Fetching Persons shallowly fetches only Persons matching the qualifier.
isDeep - true if sub-entities should be fetched; false otherwiseisDeep()public void setLocksObjects(boolean locksObjects)
flag is true it should, if flag is
 false it shouldn't. The default is false.  Note that
 unnecessary locking could severely degrade the performance of certain repository
 operations.
locksObjects - true if the selected objects should be locked in
        the data repository; false otherwiselocksObjects()public void setPrefetchingRelationshipKeyPaths(NSArray keyPaths)
Sets an array of relationship key paths that should be prefetched along with the main fetch. For example, if fetching from a Movie entity, you might specify paths of the form: ("directors","roles.talent", "plotSummary").
Prefetching increases the initial fetch cost, but it can improve overall performance by reducing the number of round trips made to the database server. Assigning relationships to prefetch also has an effect on how a fetch specification refreshes.
Refreshing refers to existing objects being overwritten with fetched
 values. This allows the application to see changes to the database that have
 been made by someone else. Normally, when an EOFetchSpecification is set
 to refresh using setRefreshesRefetchedObjects, it only refreshes
 the objects you are fetching. For example, if you fetch employees, you do not
 also fetch the employees' departments. However, if you prefetch relationships,
 the refetch is propagated for all of the relationships specified.
keyPaths - an array of relationship key paths to be prefetchedprefetchingRelationshipKeyPaths(), 
setRefreshesRefetchedObjects(boolean)public void setPromptsAfterFetchLimit(boolean value)
value is
 false, or if the application has no message handler, fetching
 stops after fetchLimit rows have been fetched. The default is
 false.
 Note that only the EOInterface layer provides a built-in message handler
 implementation. Standard WebObjects applications must set the message handler
 directly and implement editingContextShouldContinueFetching
 to prompt the user in an appropriate form in order to make use of this feature.
value - true if the user should be prompted after the fetch limit
        has been reached; false if fetching should just stop at that pointfetchLimit(), 
setFetchLimit(int), 
promptsAfterFetchLimit(), 
EOEditingContext.MessageHandler.editingContextShouldContinueFetching(EOEditingContext context, int count, int originalLimit, EOObjectStore objectStore)public void setQualifier(EOQualifier qualifier)
qualifier.
 If qualifier is empty, such as an EOAndQualifier or EOOrQualifier
 whose array of elements contains zero qualifiers, this fetch specification
 will have its qualifier set to null
qualifier - the qualifierqualifier()public void setRawRowKeyPaths(NSArray keyPaths)
null,
 indicating that full objects will be returned from the fetch. An empty array
 may be used to indicate that the fetch should query the entity named by the
 fetch specification using the method attributesToFetch. As long
 as the primary key attributes are included in the raw attributes, the raw
 row may be used to generate a fault for the corresponding object using
 EOEditingContext's faultForRawRow method.
keyPaths - an array of attribute key paths to be fetched as raw datarawRowKeyPaths(), 
setFetchesRawRows(boolean), 
EOEditingContext.faultForRawRow(NSDictionary, String), 
EOEditingContext.faultForRawRow(NSDictionary, String, EOEditingContext)public void setRefreshesRefetchedObjects(boolean refreshes)
Sets whether existing objects are overwritten with fetched values when they
 have been updated or changed. If refreshes is true,
 they are; if refreshes is false, they aren't (the
 fetched data is simply discarded). The default is false.
For example, suppose that an employee object is fetched and then refetched, without changing the employee between fetches. In this case you want to refresh the employee when you refetch it because another application might have updated the object since the first fetch. To keep the employee in sync with the employee data in the external repository you would need to replace the employee's outdated values with the new ones. On the other hand, if you have to fetch the employee, change it, and then refetch it, you would not want to refresh the employee. If you are to refresh it whether or not another application had changed the employee you would lose the changes that you have made to the object.
You can get finer grain control on an EODatabaseContext's refreshing behavior
 in the EOControl layer than you can with an EOFetchSpecification by using the
 delegate method databaseContextShouldUpdateCurrentSnapshot.
refreshes - true if existing objects are overwritten with fetched
        values; false otherwiserefreshesRefetchedObjects(), 
EODatabaseContext, 
EODatabaseContext.Delegatepublic void setRequiresAllQualifierBindingVariables(boolean requires)
requires is true, then a missing
 binding will cause an exception to be raised during variable substitution.
 The default value is false, which says to prune any nodes for
 which there are no bindings.
requires - true if a missing binding should cause an exception;
        false otherwisepublic void setSortOrderings(NSArray sortOrderings)
sortOrderings.
 When a fetch is performed with the receiver, the results are sorted by
 applying each EOSortOrdering in the array (serially in
 lowest-array-index-first order).
sortOrderings - the array of EOSortOrderingssortOrderings()public void setUsesDistinct(boolean usesDistinct)
flag is true they are removed (that is, proper sets
 are returned). If flag is false they aren't (multisets
 are returned). EOFetchSpecifications by default don't use distinct.
usesDistinct - true if duplicate objects or records should be removed;
        false otherwiseusesDistinct()public NSArray sortOrderings()
setSortOrderings(NSArray)public String toString()
toString in class Objectpublic boolean usesDistinct()
true if duplicate objects or records are removed after
 fetching, false if they aren't. EOFetchSpecifications by default
 don't use distinct (that is, they return multisets).
true if duplicate objects or records are removed; false otherwisesetUsesDistinct(boolean)
  | 
Last updated Mon Oct 13 15:42:52 PDT 2003. | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||