
Public Member Functions | |
| int | batchCount () |
| int | batchSize () |
| NSArray | batchWithIndex (int index) |
| NSArray | batchWithRange (NSRange requestedRange) |
| int | count () |
| int | currentBatchIndex () |
| int | currentObjectFetchCount () |
| EOEditingContext | editingContext () |
| ERXFetchSpecificationBatchIterator (EOFetchSpecification fetchSpecification, NSArray pkeys, EOEditingContext ec, int batchSize) | |
| ERXFetchSpecificationBatchIterator (EOFetchSpecification fetchSpecification, EOEditingContext ec, int batchSize) | |
| ERXFetchSpecificationBatchIterator (EOFetchSpecification fetchSpecification, EOEditingContext ec) | |
| ERXFetchSpecificationBatchIterator (EOFetchSpecification fetchSpecification) | |
| boolean | filtersBatches () |
| boolean | hasMoreElements () |
| boolean | hasNext () |
| boolean | hasNextBatch () |
| Object | next () |
| NSArray | nextBatch () |
| Object | nextElement () |
| void | remove () |
| void | reset () |
| void | setBatchSize (int batchSize) |
| void | setEditingContext (EOEditingContext ec) |
| void | setFiltersBatches (boolean newValue) |
Static Public Attributes | |
| static final int | DefaultBatchSize = 250 |
| static final Logger | log = Logger.getLogger(ERXFetchSpecificationBatchIterator.class) |
Protected Member Functions | |
| NSArray | _fetchNextBatch () |
| boolean | _hasMoreToFetch () |
| EOFetchSpecification | batchFetchSpecificationForQualifier (EOQualifier qualifier) |
| NSArray | primaryKeys () |
Protected Attributes | |
| int | batchSize |
| NSMutableArray | cachedBatch |
| int | currentObjectFetchCount |
| EOEditingContext | editingContext |
| EOFetchSpecification | fetchSpecification |
| String | primaryKeyAttributeName |
| NSArray | primaryKeys |
| boolean | shouldFilterBatches |
Private Member Functions | |
| NSRange | _rangeForBatchIndex (int index) |
| NSRange | _rangeForOffset (int start) |
| ERXFetchSpecificationBatchIterator | ( | EOFetchSpecification | fetchSpecification | ) |
Constructs a fetch specification iterator for a given fetch specification with the default batch size. Note you will have to set an editingContext on the iterator before calling the nextBatch method.
| fetchSpecification | to iterate through |
| ERXFetchSpecificationBatchIterator | ( | EOFetchSpecification | fetchSpecification, | |
| EOEditingContext | ec | |||
| ) |
Constructs a fetch specification iterator for a given fetch specification with the default batch size. All objects will be fetched from the given editing context. Note that you can switch out different editing contexts between calls to nextBatch
| fetchSpecification | to iterate through | |
| ec | editing context to fetch against |
| ERXFetchSpecificationBatchIterator | ( | EOFetchSpecification | fetchSpecification, | |
| EOEditingContext | ec, | |||
| int | batchSize | |||
| ) |
Constructs a fetch specification iterator for a given fetch specification and a batch size. All objects will be fetched from the given editing context. Note that you can switch out different editing contexts between calls to nextBatch
| fetchSpecification | to iterate through | |
| ec | editing context to fetch against | |
| batchSize | number of objects to fetch in a given batch |
| ERXFetchSpecificationBatchIterator | ( | EOFetchSpecification | fetchSpecification, | |
| NSArray | pkeys, | |||
| EOEditingContext | ec, | |||
| int | batchSize | |||
| ) |
Constructs a fetch specification iterator for a fetch specification, an optional set of pre-fetched primary keys and a batch size. All objects will be fetched from the given editing context. Note that you can switch out different editing contexts between calls to nextBatch.
Note: if no ec is supplied a new one is initialized.
| fetchSpecification | to iterate through | |
| pkeys | primary keys to iterate through | |
| ec | editing context to fetch against | |
| batchSize | number of objects to fetch in a given batch |
| NSArray _fetchNextBatch | ( | ) | [protected] |
Fetches the next batch unconditionally. Subclasses can override this rather than nextBatch(), to get automatic support for the Iterator and Enumeration interfaces.
| boolean _hasMoreToFetch | ( | ) | [protected] |
| NSRange _rangeForBatchIndex | ( | int | index | ) | [private] |
| NSRange _rangeForOffset | ( | int | start | ) | [private] |
| int batchCount | ( | ) |
Gets the number of batches for a given iterator.
| EOFetchSpecification batchFetchSpecificationForQualifier | ( | EOQualifier | qualifier | ) | [protected] |
| int batchSize | ( | ) |
Gets the batch size.
| NSArray batchWithIndex | ( | int | index | ) |
Returns the batch corresponding to the given index, that is, the batch beginning at batchSize() * index. Note that if the batch size has been changed after fetching, the batches return by nextBatch() may not line up with the batches returned by this method.
Calling this method does not affect the position of the iterator.
| index | index of batch to retrieve |
| NSArray batchWithRange | ( | NSRange | requestedRange | ) |
Returns the batch corresponding to the given range.
If the supplied range does not fall within the available range, the results returned correspond to the intersection of the two.
If no items are found, the supplied range does not intersect the available range, or the supplied range has length zero, then an empty array is returned.
Calling this method does not affect the position of the iterator.
| requestedRange | range of batch to retrieve |
| int count | ( | ) |
Gets the number of objects.
| int currentBatchIndex | ( | ) |
Gets the current batch index.
| int currentObjectFetchCount | ( | ) |
Gets the current number of objects fetched thus far.
| EOEditingContext editingContext | ( | ) |
Gets the currently set editing context.
| boolean filtersBatches | ( | ) |
If true, each batch will be filtered based on the original qualifier.
| boolean hasMoreElements | ( | ) |
Implementation of the Enumeration interface
| boolean hasNext | ( | ) |
Implementation of the Iterator interface
| boolean hasNextBatch | ( | ) |
Determines if the iterator has another batch.
| Object next | ( | ) |
Implementation of the Iterator interface
| NSArray nextBatch | ( | ) |
Gets the next batch of enterprise objects for the given fetch specification. Note that the editing context that is set will be used to fetch against. You can swap out a different editing context before calling this method to reduce memory consumption. (However, if you are mixing calls to this method with calls to next() or nextElement(), this method may return a partial batch of already-cached objects, in the editing context which was in place at the time they were fetched.)
| Object nextElement | ( | ) |
Implementation of the Enumeration interface
| NSArray primaryKeys | ( | ) | [protected] |
Method used to fetch the primary keys of the objects for the given fetch specification. Note the sort orderings for the fetch specification are respected.
| void remove | ( | ) |
Implementation of the Iterator interface
| void reset | ( | ) |
Resets the batch iterator so it will refetch its primary keys again.
| void setBatchSize | ( | int | batchSize | ) |
Sets the batch size.
| batchSize | to be set. |
| void setEditingContext | ( | EOEditingContext | ec | ) |
Sets the editing context used to fetch objects against. It is perfectly fine to change editing contexts between fetching the next batch.
| ec | editing context used to fetch against |
| void setFiltersBatches | ( | boolean | newValue | ) |
If set to true, each batch fetched will be filtered based on the qualifier attached to the original fetch specification. The is useful to cover the case in which the objects may have changed in important ways between the time their primary keys were retrieved and the time they were fetched. Note that when filtering is on, empty arrays may be returned from nextBatch(), and null may be returned from next() and nextElement().
Note that not all qualifiers can be applied in-memory, so this should not bet set to true if such a qualifier is being used.
Defaults to false.
| newValue | whether batches should be re-filtered |
int batchSize [protected] |
holds the selected batch size
NSMutableArray cachedBatch [protected] |
holds array of fetched but not-yet-returned objects; used by the Iterator and Enumeration interfaces
int currentObjectFetchCount [protected] |
holds the number of objects fetched
final int DefaultBatchSize = 250 [static] |
holds the default batch size, any bigger than this an Oracle has a fit
EOEditingContext editingContext [protected] |
holds a reference to the selected editing context
EOFetchSpecification fetchSpecification [protected] |
holds a reference to the fetch spec to iterate over
final Logger log = Logger.getLogger(ERXFetchSpecificationBatchIterator.class) [static] |
logging support
String primaryKeyAttributeName [protected] |
holds the name of the primary key attribute corresponding to the entity being iterated over
NSArray primaryKeys [protected] |
holds an array of primary key values to iterate through
boolean shouldFilterBatches [protected] |
determines whether we should re-apply the original qualifier to each batch of objects fetched
1.5.8