com.acsinet_solutions.cetia4.data
Class PagedResults<T>

java.lang.Object
  extended by com.acsinet_solutions.cetia4.data.PagingBlock
      extended by com.acsinet_solutions.cetia4.data.PagedResults<T>
All Implemented Interfaces:
java.io.Serializable

public class PagedResults<T>
extends PagingBlock

Base class for paged results. It contains the information of a fragment of a paged search, with the search filter that contains the indexes of the given fragment, and optionally the total number of results of the search.

A PagedResults object is also a PagingBlock ( an object that knows the indexes and size of the current page of information ) and also has methods that can report it's previous and next paging blocks, so it can be queried from pager-related taglibs. Derechos Reservados

Author:
Santiago Arriaga
See Also:
PagingUtils, PagerTag, Serialized Form

Constructor Summary
PagedResults(java.util.List<T> list, PagedSearchFilter filter)
          Constructor with an unknown number of results.
PagedResults(java.util.List<T> list, PagedSearchFilter filter, int totalNumberOfResults)
          Extended constructor.
 
Method Summary
 PagedSearchFilter getFilter()
          Return the inner filter with the first displayed value and block size.
 PagingBlock getFirstBlock()
          Get the first block if any.
 PagingBlock getLastBlock()
          Get the last block if any.
 java.util.List<T> getList()
          Return the not-null maybe-empty list of results.
 PagingBlock getNextBlock()
          Get the next block if any.
 java.util.List<PagingBlock> getNextBlocks()
          Get an iterator with all next blocks.
 int getNumberOfBlocks()
          Return the total number of blocks if known; -1 if unknown.
 PagingBlock getPreviousBlock()
          Get the previous block if any.
 java.util.List<PagingBlock> getPreviousBlocks()
          Get an iterator with all previous blocks.
 int getTotalNumberOfResults()
          Return the total number of results if known; -1 if unknown.
 
Methods inherited from class com.acsinet_solutions.cetia4.data.PagingBlock
getBlockIndex, getBlockNumber, getBlockSize, getFirstResultForBlock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PagedResults

public PagedResults(java.util.List<T> list,
                    PagedSearchFilter filter,
                    int totalNumberOfResults)
Extended constructor. Objects references must not change once assigned to the current object.

Parameters:
list - a not-null maybe-empty result list.
filter - a not-null filter instance, maybe with no pagination instructions
numberOfResults - The total number of results for the query if known, or -1 if not known.

PagedResults

public PagedResults(java.util.List<T> list,
                    PagedSearchFilter filter)
Constructor with an unknown number of results.

Method Detail

getFilter

public final PagedSearchFilter getFilter()
Return the inner filter with the first displayed value and block size.


getList

public final java.util.List<T> getList()
Return the not-null maybe-empty list of results.


getTotalNumberOfResults

public final int getTotalNumberOfResults()
Return the total number of results if known; -1 if unknown.


getNumberOfBlocks

public final int getNumberOfBlocks()
Return the total number of blocks if known; -1 if unknown.


getFirstBlock

public final PagingBlock getFirstBlock()
Get the first block if any. Returns null if this is the first block or if paging is not required.


getPreviousBlock

public final PagingBlock getPreviousBlock()
Get the previous block if any. Returns null if this is the first block or if paging is not required.


getPreviousBlocks

public final java.util.List<PagingBlock> getPreviousBlocks()
Get an iterator with all previous blocks.


getLastBlock

public final PagingBlock getLastBlock()
Get the last block if any. Returns null if the number of records is unknown, or if no next block or paging is not required.


getNextBlock

public final PagingBlock getNextBlock()
Get the next block if any. if total number of records is unknown, the next block is calculated from the difference of the maximum results and the returned results. Returns null if no next block or paging is not required.


getNextBlocks

public final java.util.List<PagingBlock> getNextBlocks()
Get an iterator with all next blocks.