T
- data type of the displaygroup's objectspublic class ERXBatchingDisplayGroup<T> extends ERXDisplayGroup<T>
WODisplayGroup
in order to provide real batching. This is
done by adding database specific code to the select statement from the
EOFetchSpecification
from the WODisplayGroup
's
EODataSource
which must be an EODatabaseDataSource
.
If used with other datasources, it reverts to the default behaviour.Modifier and Type | Class and Description |
---|---|
static class |
ERXBatchingDisplayGroup.FakeArray
Dummy array class that is used to provide a certain number of entries.
|
WODisplayGroup.Delegate
com.webobjects.foundation.NSKeyValueCoding._BooleanFieldBinding, com.webobjects.foundation.NSKeyValueCoding._BooleanMethodBinding, com.webobjects.foundation.NSKeyValueCoding._FieldBinding, com.webobjects.foundation.NSKeyValueCoding._ForwardingBinding, com.webobjects.foundation.NSKeyValueCoding._KeyBinding, com.webobjects.foundation.NSKeyValueCoding._KeyBindingCreation, com.webobjects.foundation.NSKeyValueCoding._MethodBinding, com.webobjects.foundation.NSKeyValueCoding._NumberFieldBinding, com.webobjects.foundation.NSKeyValueCoding._NumberMethodBinding, com.webobjects.foundation.NSKeyValueCoding._ReflectionKeyBindingCreation, com.webobjects.foundation.NSKeyValueCoding.DefaultImplementation, com.webobjects.foundation.NSKeyValueCoding.ErrorHandling, com.webobjects.foundation.NSKeyValueCoding.MapImplementation, com.webobjects.foundation.NSKeyValueCoding.Null<T>, com.webobjects.foundation.NSKeyValueCoding.UnknownKeyException, com.webobjects.foundation.NSKeyValueCoding.Utility, com.webobjects.foundation.NSKeyValueCoding.ValueAccessor
com.webobjects.eocontrol.EOKeyValueArchiving._NullValueSupport, com.webobjects.eocontrol.EOKeyValueArchiving._NumberSupport, com.webobjects.eocontrol.EOKeyValueArchiving._TimestampSupport, com.webobjects.eocontrol.EOKeyValueArchiving.Awaking, com.webobjects.eocontrol.EOKeyValueArchiving.FinishInitialization, com.webobjects.eocontrol.EOKeyValueArchiving.Support
Modifier and Type | Field and Description |
---|---|
protected int |
_batchCount
total number of batches
|
protected NSArray<T> |
_displayedObjects
cache for the displayed objects
|
protected Boolean |
_isBatching
cache batching flag
|
protected NSArray<String> |
_prefetchingRelationshipKeyPaths |
protected int |
_rowCount |
protected boolean |
_shouldRememberRowCount |
DisplayGroupWillFetchNotification
Constructor and Description |
---|
ERXBatchingDisplayGroup()
Creates a new ERXBatchingDisplayGroup.
|
Modifier and Type | Method and Description |
---|---|
int |
batchCount()
Overridden to return the pre-calculated number of batches.
|
static Object |
decodeWithKeyValueUnarchiver(com.webobjects.eocontrol.EOKeyValueUnarchiver unarchiver)
Decodes an ERXBatchingDisplayGroup from the given unarchiver.
|
NSArray<T> |
displayedObjects()
Overridden method in order to fetch -only- the rows that are needed.
|
Object |
fetch()
Overridden to fetch only within displayed limits.
|
protected com.webobjects.eocontrol.EOFetchSpecification |
fetchSpecification()
Utility to get the fetch specification from the datasource and the filter
qualifier.
|
NSArray<T> |
filteredObjects()
Overridden to return allObjects() when batching, as we can't qualify in memory.
|
boolean |
hasMultipleBatches()
Overridden to refetchIfNecessary() first to ensure we get a correct result in cases
where this is called before displayedObjects().
|
protected boolean |
isBatching()
Determines if batching is possible.
|
boolean |
isRawRowsForCustomQueries()
Returns whether or not fetch specification with custom queries should use raw rows.
|
protected NSArray<T> |
objectsInRange(int start,
int end)
Utility to fetch the object in a given range.
|
NSArray<String> |
prefetchingRelationshipKeyPaths()
Returns the prefetching key paths overriding those in the underlying fetch spec.
|
protected void |
refetch()
Utility that does the actual fetching, if a qualifier() is set, it adds
it to the dataSource() fetch qualifier.
|
protected void |
refetchIfNecessary()
If we're batching and the displayed objects have not been fetched,
do a refetch() of them.
|
int |
rowCount()
Utility to get at the number of rows when batching.
|
Object |
selectFilteredObjects()
Selects the visible objects, overridden to fetch all objects.
|
void |
setCurrentBatchIndex(int index)
Overridden to clear out our array of fetched objects.
|
void |
setDataSource(com.webobjects.eocontrol.EODataSource datasource)
Overridden to set the isBatching flag to
true if we have an
EODatabaseDataSource. |
void |
setNumberOfObjectsPerBatch(int count)
Overridden to clear out our array of fetched objects.
|
void |
setObjectArray(NSArray objects)
Overridden to update the batch count.
|
void |
setPrefetchingRelationshipKeyPaths(ERXKey<?>... prefetchingRelationshipKeyPaths)
Sets the prefetching key paths to override those in the underlying fetch spec.
|
void |
setPrefetchingRelationshipKeyPaths(NSArray<String> prefetchingRelationshipKeyPaths)
Sets the prefetching key paths to override those in the underlying fetch spec.
|
void |
setQualifier(com.webobjects.eocontrol.EOQualifier qualifier)
Overridden to trigger a refetch.
|
void |
setRawRowsForCustomQueries(boolean rawRowsForCustomQueries)
Sets whether or not fetch specification with custom queries should use raw rows.
|
void |
setRowCount(int rowCount)
Override the number of rows of results (if you can
provide a better estimate than the default behavior).
|
void |
setShouldRememberRowCount(boolean shouldRememberRowCount)
Set to
true to retain the rowCount() after it is determined once for a particular
qualifier. |
void |
setSortOrderings(NSArray<com.webobjects.eocontrol.EOSortOrdering> sortOrderings)
Overridden to preserve the selected objects.
|
boolean |
shouldRememberRowCount() |
protected void |
updateBatchCount() |
void |
updateDisplayedObjects() |
addToSelection, addToSelection, allObjects, allQualifierOperators, clearExtraQualifiers, displayNextBatch, displayPreviousBatch, indexOfFirstDisplayedObject, indexOfLastDisplayedObject, qualifierForKey, qualifierFromQueryValues, removeFromSelection, removeFromSelection, selectedObject, selectedObjects, setQualifierForKey, setSelectedObjects, setSelectionIndexes, sortedObjects, sortOrderings
_beginObserverNotification, _deleteObject, _insertObjectAtIndex, _lastObserverNotified, awakeFromKeyValueUnarchiver, clearSelection, currentBatchIndex, dataSource, defaultStringMatchFormat, defaultStringMatchOperator, delegate, delete, deleteObjectAtIndex, deleteSelection, detailKey, displayBatchContainingSelectedObject, dispose, editingContextPresentErrorMessage, encodeWithCoder, encodeWithKeyValueArchiver, endEditing, fetchesOnLoad, finishInitialization, globalDefaultForValidatesChangesImmediately, globalDefaultStringMatchFormat, globalDefaultStringMatchOperator, handleQueryWithUnboundKey, handleTakeValueForUnboundKey, hasDetailDataSource, initWithCoder, inQueryMode, insert, insertedObjectDefaultValues, insertNewObjectAtIndex, insertObjectAtIndex, localKeys, masterObject, numberOfObjectsPerBatch, objectsChangedInEditingContext, objectsInvalidatedInEditingContext, qualifier, qualifyDataSource, qualifyDisplayGroup, queryBindings, queryMatch, queryMax, queryMin, queryOperator, redisplay, relationalQualifierOperators, selectionIndexes, selectNext, selectObject, selectObjectsIdenticalTo, selectObjectsIdenticalToSelectFirstOnNoMatch, selectPrevious, selectsFirstObjectAfterFetch, setDefaultStringMatchFormat, setDefaultStringMatchOperator, setDelegate, setDetailKey, setFetchesOnLoad, setGlobalDefaultForValidatesChangesImmediately, setGlobalDefaultStringMatchFormat, setGlobalDefaultStringMatchOperator, setInQueryMode, setInsertedObjectDefaultValues, setLocalKeys, setMasterObject, setSelectedObject, setSelectsFirstObjectAfterFetch, setValidatesChangesImmediately, stringQualifierOperators, takeValueForKey, toString, unableToSetNullForKey, undoManager, validatesChangesImmediately, valueForKey, willChange
protected int _batchCount
protected Boolean _isBatching
protected int _rowCount
protected boolean _shouldRememberRowCount
public ERXBatchingDisplayGroup()
public void setRawRowsForCustomQueries(boolean rawRowsForCustomQueries)
rawRowsForCustomQueries
- whether or not fetch specification with custom queries should use raw rowspublic boolean isRawRowsForCustomQueries()
public static Object decodeWithKeyValueUnarchiver(com.webobjects.eocontrol.EOKeyValueUnarchiver unarchiver)
unarchiver
- the unarchiver to construct this display group withprotected void refetchIfNecessary()
protected boolean isBatching()
true
if dataSource is an instance of EODatabaseDataSourcepublic void setDataSource(com.webobjects.eocontrol.EODataSource datasource)
true
if we have an
EODatabaseDataSource.setDataSource
in class ERXDisplayGroup<T>
datasource
- the EODataSource to usepublic int batchCount()
batchCount
in class WODisplayGroup
public void setCurrentBatchIndex(int index)
setCurrentBatchIndex
in class WODisplayGroup
index
- the index of the batch to displaypublic void setNumberOfObjectsPerBatch(int count)
setNumberOfObjectsPerBatch
in class ERXDisplayGroup<T>
count
- the maximum number of objects to display per batchpublic NSArray<T> displayedObjects()
WODisplayGroup
would always fetch from the start until the end of the objects from the
fetch limit.displayedObjects
in class ERXDisplayGroup<T>
public boolean hasMultipleBatches()
hasMultipleBatches
in class WODisplayGroup
true
if batchCount is greater than 1, false
otherwisepublic NSArray<T> filteredObjects()
filteredObjects
in class ERXDisplayGroup<T>
public void setQualifier(com.webobjects.eocontrol.EOQualifier qualifier)
setQualifier
in class ERXDisplayGroup<T>
qualifier
- the qualifier for the display grouppublic void setSortOrderings(NSArray<com.webobjects.eocontrol.EOSortOrdering> sortOrderings)
setSortOrderings
in class ERXDisplayGroup<T>
sortOrderings
- the proposed EOSortOrdering objectspublic void setPrefetchingRelationshipKeyPaths(NSArray<String> prefetchingRelationshipKeyPaths)
prefetchingRelationshipKeyPaths
- the prefetching key paths to override those in the underlying fetch specpublic void setPrefetchingRelationshipKeyPaths(ERXKey<?>... prefetchingRelationshipKeyPaths)
prefetchingRelationshipKeyPaths
- the prefetching key paths to override those in the underlying fetch specpublic NSArray<String> prefetchingRelationshipKeyPaths()
protected com.webobjects.eocontrol.EOFetchSpecification fetchSpecification()
public int rowCount()
public void setRowCount(int rowCount)
rowCount
- the number of rows of resultspublic boolean shouldRememberRowCount()
true
if the rowCount() should be remembered after being determined
or false
if rowCount() should be re-calculated when the batch changespublic void setShouldRememberRowCount(boolean shouldRememberRowCount)
true
to retain the rowCount() after it is determined once for a particular
qualifier. Set to false
to have rowCount() re-calculated when the batch changes.
The default is true
.shouldRememberRowCount
- the shouldRememberRowCount to setprotected NSArray<T> objectsInRange(int start, int end)
start
- start index of the rangeend
- end index of the rangeprotected void refetch()
protected void updateBatchCount()
public void setObjectArray(NSArray objects)
setObjectArray
in class WODisplayGroup
objects
- the object array to setpublic Object fetch()
fetch
in class ERXDisplayGroup<T>
null
to force the page to reloadpublic void updateDisplayedObjects()
updateDisplayedObjects
in class WODisplayGroup
public Object selectFilteredObjects()
selectFilteredObjects
in class ERXDisplayGroup<T>
null
to force the page to reloadCopyright © 2002 – 2020 Project Wonder.