org.loom.paged
Class PagedListCriteriaImpl

java.lang.Object
  extended by org.loom.paged.AbstractPagedContainer
      extended by org.loom.paged.PagedListCriteriaImpl
All Implemented Interfaces:
PagedContainer, PagedListCriteria

public class PagedListCriteriaImpl
extends AbstractPagedContainer
implements PagedListCriteria

Criteria of a requested page


Field Summary
 
Fields inherited from class org.loom.paged.AbstractPagedContainer
id
 
Fields inherited from interface org.loom.paged.PagedContainer
DEFAULT_PAGE_SIZE
 
Constructor Summary
PagedListCriteriaImpl()
           
 
Method Summary
 java.lang.String addOrderBy(java.lang.String query)
          Adds the order by parameter to a query.
 PagedListCriteriaImpl addParameter(java.lang.Object paramValue)
          Add a parameter to the query
 boolean calculateTotal()
           
 java.lang.String getOrderedQuery()
           
 java.util.List<java.lang.Object> getParameters()
           
 boolean isCalculateTotal()
           
 void setCalculateTotal(boolean calculateTotal)
           
 PagedListCriteriaImpl setId(java.lang.String id)
           
 PagedListCriteriaImpl setQuery(java.lang.String query, java.lang.Object... params)
          Set the query to be executed, and any additional parameter as well.
 
Methods inherited from class org.loom.paged.AbstractPagedContainer
getId, getPageIndex, getPageSize, getRecordIndex, getSortOrder, getSortProperty, setPageIndex, setPageSize, setSortOrder, setSortProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.loom.paged.PagedListCriteria
setPageSize
 
Methods inherited from interface org.loom.paged.PagedContainer
getId, getPageIndex, getPageSize, getRecordIndex, getSortOrder, getSortProperty
 

Constructor Detail

PagedListCriteriaImpl

public PagedListCriteriaImpl()
Method Detail

addParameter

public PagedListCriteriaImpl addParameter(java.lang.Object paramValue)
Add a parameter to the query

Specified by:
addParameter in interface PagedListCriteria
Parameters:
paramValue - the value of the parameter

getOrderedQuery

public java.lang.String getOrderedQuery()
Specified by:
getOrderedQuery in interface PagedListCriteria
Returns:
the user-specified query, after adding the ORDER BY clause specified by sortProperty and sortOrder

setQuery

public PagedListCriteriaImpl setQuery(java.lang.String query,
                                      java.lang.Object... params)
Set the query to be executed, and any additional parameter as well. The params can also be set latter by invoking addParameter()

Specified by:
setQuery in interface PagedListCriteria
Parameters:
query - the JPA query to execute
params - the parameters to add to the query, in the expected order

addOrderBy

public java.lang.String addOrderBy(java.lang.String query)
Adds the order by parameter to a query. If there is already an order by, prepends the current order to the one included in the query

Specified by:
addOrderBy in interface PagedListCriteria

calculateTotal

public boolean calculateTotal()
Specified by:
calculateTotal in interface PagedListCriteria
Returns:
true if the total should be calculated

isCalculateTotal

public boolean isCalculateTotal()
Specified by:
isCalculateTotal in interface PagedListCriteria

setCalculateTotal

public void setCalculateTotal(boolean calculateTotal)

getParameters

public java.util.List<java.lang.Object> getParameters()
Specified by:
getParameters in interface PagedListCriteria

setId

public PagedListCriteriaImpl setId(java.lang.String id)
Overrides:
setId in class AbstractPagedContainer