It creates and configure a pager that allows the user to manage a query in a collection as pages. The query is defined in a filter that, together with the size of the page, are constructor parameters. Once the pager is configured, public and private methods of broker.cloudPersistence.* are used to obtain the resulting pages.

CONSTRUCTOR

PageFetcher(filter: Filter, pageSize: Integer)

It configures the instance to be created with the collection of the query of the filter and the size of the page we want.

Arguments  
filter Filter: filter that will be obtained by the collection.
pageSize     Integer: page size.
Return  
PageFetcher New instance.

PUBLIC METHODS

Integer collectionSize()

It returns the total number of objects that were obtained in the query using the configured filter.

Return  
Integer Number of elements.

Integer pages()

It returns the number of pages. They are calculated by dividing the size of the collection that was obtained in the query using the filter configured by the size of the page at the moment of creating the instance of the pager.

Return  
Integer Number of pages.