org.tynamo.hibernate
Class SearchableHibernateGridDataSource

java.lang.Object
  extended by org.tynamo.hibernate.SearchableHibernateGridDataSource
All Implemented Interfaces:
org.apache.tapestry5.grid.GridDataSource

public class SearchableHibernateGridDataSource
extends Object
implements org.apache.tapestry5.grid.GridDataSource


Constructor Summary
SearchableHibernateGridDataSource(org.hibernate.Session session, Class entityType, org.hibernate.search.FullTextQuery fullTextQuery, Map<TynamoPropertyDescriptor,SearchFilterPredicate> propertySearchFilterMap)
           
SearchableHibernateGridDataSource(org.hibernate.Session session, Class entityType, Map<TynamoPropertyDescriptor,SearchFilterPredicate> propertySearchFilterMap)
           
 
Method Summary
protected  void applyAdditionalConstraints(org.hibernate.Criteria crit)
          Invoked after the main criteria has been set up (firstResult, maxResults and any sort contraints).
 int getAvailableRows()
          Returns the total number of rows for the configured entity type.
 Class getRowType()
          Returns the entity type, as provided via the constructor.
 Object getRowValue(int index)
          Returns a row value at the given index (which must be within the range defined by the call to prepare(int, int, java.util.List) ).
 void prepare(int startIndex, int endIndex, List<org.apache.tapestry5.grid.SortConstraint> sortConstraints)
          Prepares the results, performing a query (applying the sort results, and the provided start and end index).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SearchableHibernateGridDataSource

public SearchableHibernateGridDataSource(org.hibernate.Session session,
                                         Class entityType,
                                         Map<TynamoPropertyDescriptor,SearchFilterPredicate> propertySearchFilterMap)

SearchableHibernateGridDataSource

public SearchableHibernateGridDataSource(org.hibernate.Session session,
                                         Class entityType,
                                         org.hibernate.search.FullTextQuery fullTextQuery,
                                         Map<TynamoPropertyDescriptor,SearchFilterPredicate> propertySearchFilterMap)
Method Detail

getAvailableRows

public int getAvailableRows()
Returns the total number of rows for the configured entity type.

Specified by:
getAvailableRows in interface org.apache.tapestry5.grid.GridDataSource

prepare

public void prepare(int startIndex,
                    int endIndex,
                    List<org.apache.tapestry5.grid.SortConstraint> sortConstraints)
Prepares the results, performing a query (applying the sort results, and the provided start and end index). The results can later be obtained from getRowValue(int) }.

Specified by:
prepare in interface org.apache.tapestry5.grid.GridDataSource
Parameters:
startIndex - index, from zero, of the first item to be retrieved
endIndex - index, from zero, of the last item to be retrieved
sortConstraints - zero or more constraints used to set the order of the returned values

applyAdditionalConstraints

protected void applyAdditionalConstraints(org.hibernate.Criteria crit)
Invoked after the main criteria has been set up (firstResult, maxResults and any sort contraints). This gives subclasses a chance to apply additional constraints before the list of results is obtained from the criteria. This implementation does nothing and may be overridden.


getRowValue

public Object getRowValue(int index)
Returns a row value at the given index (which must be within the range defined by the call to prepare(int, int, java.util.List) ).

Specified by:
getRowValue in interface org.apache.tapestry5.grid.GridDataSource
Parameters:
index - of object
Returns:
object at that index

getRowType

public Class getRowType()
Returns the entity type, as provided via the constructor.

Specified by:
getRowType in interface org.apache.tapestry5.grid.GridDataSource


Copyright © 2004-2013. All Rights Reserved.