ERXBatchingDisplayGroup< T > Class Reference

Inherits er::extensions::appserver::ERXDisplayGroup<T>.

Collaboration diagram for ERXBatchingDisplayGroup< T >:

Collaboration graph
[legend]

List of all members.

Classes

class  FakeArray

Public Member Functions

int batchCount ()
NSArray< T > displayedObjects ()
 ERXBatchingDisplayGroup ()
Object fetch ()
NSArray< T > filteredObjects ()
boolean hasMultipleBatches ()
boolean isRawRowsForCustomQueries ()
NSArray< StringprefetchingRelationshipKeyPaths ()
int rowCount ()
Object selectFilteredObjects ()
void setCurrentBatchIndex (int index)
void setDataSource (EODataSource eodatasource)
void setNumberOfObjectsPerBatch (int count)
void setObjectArray (NSArray objects)
void setPrefetchingRelationshipKeyPaths (NSArray< String > prefetchingRelationshipKeyPaths)
void setQualifier (EOQualifier aEoqualifier)
void setRawRowsForCustomQueries (boolean rawRowsForCustomQueries)
void setRowCount (int rowCount)
void setShouldRememberRowCount (boolean shouldRememberRowCount)
void setSortOrderings (NSArray nsarray)
boolean shouldRememberRowCount ()
void updateDisplayedObjects ()

Static Public Member Functions

static Object decodeWithKeyValueUnarchiver (EOKeyValueUnarchiver unarchiver)

Protected Member Functions

EOFetchSpecification fetchSpecification ()
boolean isBatching ()
NSArray< T > objectsInRange (int start, int end)
void refetch ()
void refetchIfNecessary ()
void updateBatchCount ()

Protected Attributes

int _batchCount
NSArray< T > _displayedObjects
Boolean _isBatching
NSArray< String_prefetchingRelationshipKeyPaths
int _rowCount = -1
boolean _shouldRememberRowCount = true

Private Member Functions

 ERXBatchingDisplayGroup (EOKeyValueUnarchiver unarchiver)

Private Attributes

boolean _rawRowsForCustomQueries = true

Static Private Attributes

static final Logger log = Logger.getLogger(ERXBatchingDisplayGroup.class)


Detailed Description

Extends 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.

Author:
dt first version

ak gross hacks, made functional and usable.


Constructor & Destructor Documentation

ERXBatchingDisplayGroup (  ) 

Creates a new ERXBatchingDisplayGroup.

ERXBatchingDisplayGroup ( EOKeyValueUnarchiver  unarchiver  )  [private]

Creates a new ERXBatchingDisplayGroup from an unarchiver.

Parameters:
unarchiver the unarchiver to construct this display group with


Member Function Documentation

int batchCount (  ) 

Overridden to return the pre-calculated number of batches

static Object decodeWithKeyValueUnarchiver ( EOKeyValueUnarchiver  unarchiver  )  [static]

Decodes an ERXBatchingDisplayGroup from the given unarchiver.

Parameters:
unarchiver the unarchiver to construct this display group with
Returns:
the corresponding batching display group

NSArray<T> displayedObjects (  ) 

Overridden method in order to fetch -only- the rows that are needed. This is different to the editors methods because a WODisplayGroup would always fetch from the start until the end of the objects from the fetch limit.

Returns:
the objects that should be diplayed.

Object fetch (  ) 

Overridden to fetch only within displayed limits.

EOFetchSpecification fetchSpecification (  )  [protected]

Utility to get the fetch spec 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(). See http://issues.objectstyle.org/jira/browse/WONDER-381

boolean isBatching (  )  [protected]

Determines if batching is possible.

Returns:
true if dataSource is an instance of EODatabaseDataSource

boolean isRawRowsForCustomQueries (  ) 

Returns whether or not fetch specification with custom queries should use raw rows.

Returns:
whether or not fetch specification with custom queries should use raw rows

NSArray<T> objectsInRange ( int  start,
int  end 
) [protected]

Utility to fetch the object in a given range.

Parameters:
start 
end 

NSArray<String> prefetchingRelationshipKeyPaths (  ) 

Returns the prefetching key paths overriding those in the underlying fetch spec.

Returns:
the prefetching key paths overriding those in the underlying fetch spec

void refetch (  )  [protected]

Utility that does the actual fetching, if a qualifier() is set, it adds it to the dataSource() fetch qualifier.

void refetchIfNecessary (  )  [protected]

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. Note that this makes sense only when there are only a "few" objects in the list.

void setCurrentBatchIndex ( int  index  ) 

Overriden to clear out our array of fetched objects.

void setDataSource ( EODataSource  eodatasource  ) 

Overridden to set the isBatching flag to true if we have an EODatabaseDataSource.

void setNumberOfObjectsPerBatch ( int  count  ) 

Overriden to clear out our array of fetched objects.

void setObjectArray ( NSArray  objects  ) 

Overridden to update the batch count.

void setPrefetchingRelationshipKeyPaths ( NSArray< String prefetchingRelationshipKeyPaths  ) 

Sets the prefetching key paths to override those in the underlying fetch spec.

Parameters:
prefetchingRelationshipKeyPaths the prefetching key paths to override those in the underlying fetch spec

void setQualifier ( EOQualifier  aEoqualifier  ) 

Overridden to trigger a refetch.

void setRawRowsForCustomQueries ( boolean  rawRowsForCustomQueries  ) 

Sets whether or not fetch specification with custom queries should use raw rows. Defaults to true for backwards compatibility.

Parameters:
rawRowsForCustomQueries 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). If you guess too low, you will never get more than what you set, but if you guess too high, it will adjust. Call with -1 to have the rows counted again.

Parameters:
rowCount the number of rows of results

void setShouldRememberRowCount ( boolean  shouldRememberRowCount  ) 

Set to 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.

Parameters:
shouldRememberRowCount the shouldRememberRowCount to set

void setSortOrderings ( NSArray  nsarray  ) 

Overridden to preserve the selected objects.

boolean shouldRememberRowCount (  ) 

Returns:
true if the rowCount() should be remembered after being determined or false if rowCount() should be re-calculated when the batch changes

void updateBatchCount (  )  [protected]

void updateDisplayedObjects (  ) 


Member Data Documentation

int _batchCount [protected]

total number of batches

NSArray<T> _displayedObjects [protected]

cache for the displayed objects

Boolean _isBatching [protected]

cache batching flag

boolean _rawRowsForCustomQueries = true [private]

int _rowCount = -1 [protected]

boolean _shouldRememberRowCount = true [protected]

final Logger log = Logger.getLogger(ERXBatchingDisplayGroup.class) [static, private]

Logging support


The documentation for this class was generated from the following file:

Generated on Sat May 26 06:43:03 2012 for Project Wonder by  doxygen 1.5.8