org.hdpagination.web.jsf.util
Class PaginateQueryUtils

java.lang.Object
  extended by org.hdpagination.web.jsf.util.PaginateQueryUtils

public class PaginateQueryUtils
extends java.lang.Object

This help class is responsible for calling the corresponding QueryTemplate to execute pagination query and save the search results in specified scope.

Since:
1.1
Author:
Liangfeng Ren

Constructor Summary
PaginateQueryUtils(javax.faces.context.FacesContext context, PaginateDefinition definition)
           
 
Method Summary
 int findPageSize()
          Get page size (number of records per page)
 boolean isSearchResultEmpty()
          Check if the search result (saved in specified scope: 'request' | 'session' | 'application') is empty.
 void paginateQueryWithoutCount(QueryCallback callback, int pageNo, int pageSize)
          run the query to get the result; save the result in corresponding scope
 int processPaginateQuery(QueryCallback callback, int pageNo, int pageSize)
          run the query to get the result; count the number of total records; save the result in corresponding scope
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PaginateQueryUtils

public PaginateQueryUtils(javax.faces.context.FacesContext context,
                          PaginateDefinition definition)
Method Detail

findPageSize

public int findPageSize()
Get page size (number of records per page)

Returns:

processPaginateQuery

public int processPaginateQuery(QueryCallback callback,
                                int pageNo,
                                int pageSize)
run the query to get the result; count the number of total records; save the result in corresponding scope

Parameters:
callback -
pageNo -
pageSize -
Returns:
number to total records

paginateQueryWithoutCount

public void paginateQueryWithoutCount(QueryCallback callback,
                                      int pageNo,
                                      int pageSize)
run the query to get the result; save the result in corresponding scope

Parameters:
callback -
pageNo -
pageSize -

isSearchResultEmpty

public boolean isSearchResultEmpty()
Check if the search result (saved in specified scope: 'request' | 'session' | 'application') is empty. This method is called by the subclasses of PaginateRenderer to determine if the pagination UI component should be rendered or not. Pagination UI component will not be rendered if this method returned true.

Returns:
return true if search result(java.util.List) is null or the size > 0


Copyright © 2008 HDPagination All Rights Reserved.