Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.seam.framework
Class Query<T,E>

    java.lang.Object
      org.jboss.seam.framework.Controller
          org.jboss.seam.framework.PersistenceController<T>
              org.jboss.seam.framework.Query<T,E>

All Implemented Interfaces:
  Serializable

Direct Known Subclasses:
  EntityQuery, HibernateEntityQuery

    public abstract class Query<T,E>

extends PersistenceController<T>

Base class for components which manage a query result set. This class may be reused by either configuration or extension, and may be bound directly to a view, or accessed by some intermediate Seam component.

Author:
  Gavin King
See Also:
  Serialized Form

Constructor Summary
`Query()`

Method Summary
`protected void` | `clearDataModel()`
`protected void` | `evaluateAllParameters()`
`void` | `first()` Move the result set cursor to the beginning of the first page
`protected String` | `getCountEjbql()` Return the ejbql to used in a count query (for calculating number of results)
`javax.faces.model.DataModel` | `getDataModel()` Wrap the result set in a JSF `DataModel` Delegates to `DataModels.getDataModel(Query)`
`E` | `getDataModelSelection()` Get the selected row of the JSF `DataModel`
`int` | `getDataModelSelectionIndex()` Get the index of the selected row of the JSF `DataModel`
`String` | `getEjbql()`
`Integer` | `getFirstResult()` Returns the index of the first result of the current page
`Long` | `getLastFirstResult()` Get the index of the first result of the last page
`Integer` | `getMaxResults()` The page size
`int` | `getNextFirstResult()` Get the index of the first result of the next page
`String` | `getOrder()` The order of the query
`Integer` | `getPageCount()` Get the total number of pages
`int` | `getPreviousFirstResult()` Get the index of the first result of the previous page
`protected List<Expressions.ValueExpression>` | `getQueryParameters()`
`protected List<Object>` | `getQueryParameterValues()`
`protected String` | `getRenderedEjbql()`
`protected List<Expressions.ValueExpression>` | `getRestrictionParameters()`
`protected List<Object>` | `getRestrictionParameterValues()`
`List<String>` | `getRestrictions()` List of restrictions to apply to the query.
`abstract Long` | `getResultCount()`
`abstract List<E>` | `getResultList()`
`abstract E` | `getSingleResult()`
`protected boolean` | `isAnyParameterDirty()`
`abstract boolean` | `isNextExists()` Returns true if next page exists
`boolean` | `isPreviousExists()` Returns true if the previous page exists
`protected boolean` | `isRestrictionParameterSet(Object parameterValue)`
`void` | `last()` Move the result set cursor to the beginning of the last page
`void` | `next()` Move the result set cursor to the beginning of the next page
`protected void` | `parseEjbql()`
`void` | `previous()` Move the result set cursor to the beginning of the previous page
`void` | `refresh()`
`void` | `setEjbql(String ejbql)` Set the ejbql to use.
`void` | `setFirstResult(Integer firstResult)` Set the index at which the page to display should start
`void` | `setMaxResults(Integer maxResults)`
`void` | `setOrder(String order)`
`protected void` | `setQueryParameterValues(List<Object> queryParameterValues)`
`protected void` | `setRestrictionParameterValues(List<Object> restrictionParameterValues)`
`void` | `setRestrictions(List<String> restrictions)` Calling setRestrictions causes the restrictions to be reparsed and the query refreshed
`protected List<E>` | `truncResultList(List<E> results)`
`void` | `validate()`

Methods inherited from class org.jboss.seam.framework.PersistenceController
`getPersistenceContext, getPersistenceContextName, setPersistenceContext`

Methods inherited from class org.jboss.seam.framework.Controller
`addCookie, addFacesMessage, addFacesMessageFromResourceBundle, debug, debug, error, error, failValidation, fatal, fatal, getApplicationContext, getBusinessProcessContext, getComponentInstance, getComponentInstance, getConversation, getConversationContext, getCookie, getEventContext, getEvents, getFacesContext, getFacesMessages, getIdentity, getLog, getMessages, getMethodContext, getPageContext, getRedirect, getSessionContext, getValidator, getValidator, info, info, interpolate, invalidateSession, isTransactionMarkedRollback, raiseAsynchronousEvent, raiseEvent, raiseTransactionSuccessEvent, render, sendHttpError, sendHttpError, trace, trace, validationFailed, validationSucceeded, warn, warn`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Query

    public Query()

Method Detail

### getResultList

    public abstract List<E> getResultList()

### getSingleResult

    public abstract E getSingleResult()

### getResultCount

    public abstract Long getResultCount()

### validate

    @Create
    public void validate()

### getDataModel

    @Transactional
    public javax.faces.model.DataModel getDataModel()

  Wrap the result set in a JSF `DataModel` Delegates to `DataModels.getDataModel(Query)`

### getDataModelSelection

    public E getDataModelSelection()

  Get the selected row of the JSF `DataModel`

### getDataModelSelectionIndex

    public int getDataModelSelectionIndex()

  Get the index of the selected row of the JSF `DataModel`

### refresh

    public void refresh()

### last

    @Transactional
    public void last()

  Move the result set cursor to the beginning of the last page

### next

    public void next()

  Move the result set cursor to the beginning of the next page

### previous

    public void previous()

  Move the result set cursor to the beginning of the previous page

### first

    public void first()

  Move the result set cursor to the beginning of the first page

### clearDataModel

    protected void clearDataModel()

### getLastFirstResult

    @Transactional
    public Long getLastFirstResult()

  Get the index of the first result of the last page

### getNextFirstResult

    public int getNextFirstResult()

  Get the index of the first result of the next page

### getPreviousFirstResult

    public int getPreviousFirstResult()

  Get the index of the first result of the previous page

### getPageCount

    @Transactional
    public Integer getPageCount()

  Get the total number of pages

### parseEjbql

    protected void parseEjbql()

### getRenderedEjbql

    protected String getRenderedEjbql()

### isRestrictionParameterSet

    protected boolean isRestrictionParameterSet(Object parameterValue)

### getCountEjbql

    protected String getCountEjbql()

  Return the ejbql to used in a count query (for calculating number of results)

  Returns:
    String The ejbql query

### getEjbql

    public String getEjbql()

### setEjbql

    public void setEjbql(String ejbql)

  Set the ejbql to use. Calling this causes the ejbql to be reparsed and the query to be refreshed

### getFirstResult

    public Integer getFirstResult()

  Returns the index of the first result of the current page

### isPreviousExists

    public boolean isPreviousExists()

  Returns true if the previous page exists

### isNextExists

    public abstract boolean isNextExists()

  Returns true if next page exists

### setFirstResult

    public void setFirstResult(Integer firstResult)

  Set the index at which the page to display should start

### getMaxResults

    public Integer getMaxResults()

  The page size

### setMaxResults

    public void setMaxResults(Integer maxResults)

### getRestrictions

    public List<String> getRestrictions()

  List of restrictions to apply to the query. For a query such as 'from Foo f' a restriction could be 'f.bar = #{foo.bar}'

### setRestrictions

    public void setRestrictions(List<String> restrictions)

  Calling setRestrictions causes the restrictions to be reparsed and the query refreshed

### getOrder

    public String getOrder()

  The order of the query

### setOrder

    public void setOrder(String order)

### getQueryParameters

    protected List<Expressions.ValueExpression> getQueryParameters()

### getRestrictionParameters

    protected List<Expressions.ValueExpression> getRestrictionParameters()

### evaluateAllParameters

    protected void evaluateAllParameters()

### isAnyParameterDirty

    protected boolean isAnyParameterDirty()

### getQueryParameterValues

    protected List<Object> getQueryParameterValues()

### setQueryParameterValues

    protected void setQueryParameterValues(List<Object> queryParameterValues)

### getRestrictionParameterValues

    protected List<Object> getRestrictionParameterValues()

### setRestrictionParameterValues

    protected void setRestrictionParameterValues(List<Object> restrictionParameterValues)

### truncResultList

    protected List<E> truncResultList(List<E> results)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD