org.iternine.jeppetto.dao
Interface QueryModelDAO<T,ID>

Type Parameters:
T - Persistent Class
ID - ID type for the persistent class.
All Superinterfaces:
GenericDAO<T,ID>

public interface QueryModelDAO<T,ID>
extends GenericDAO<T,ID>

The QueryModelDAO interface defines an extension to the GenericDAO functionality that offers significantly more richness around the representation of queries to retrieve a specific object or a list of zero or more items that match the given QueryModel.


Method Summary
 Condition buildCondition(String conditionField, ConditionType conditionType, Iterator argsIterator)
          Construct a Condition object given the passed in arguments.
 Projection buildProjection(String projectionField, ProjectionType projectionType, Iterator argsIterator)
          Construct a Projection object given the passed in arguments.
 void deleteUsingQueryModel(QueryModel queryModel)
          Delete objects of type T that correspond to the QueryModel.
 T findUniqueUsingQueryModel(QueryModel queryModel)
          Find an object T that satisfies the QueryModel.
 Iterable<T> findUsingQueryModel(QueryModel queryModel)
          Find objects of type T that correspond to the QueryModel.
 Object projectUsingQueryModel(QueryModel queryModel)
          Use the QueryModel to narrow a set of results, then perform the specified projection.
 ReferenceSet<T> referenceUsingQueryModel(QueryModel queryModel)
           
 
Methods inherited from interface org.iternine.jeppetto.dao.GenericDAO
delete, deleteById, deleteByIds, findAll, findById, findByIds, flush, referenceByIds, save, updateReferences
 

Method Detail

findUniqueUsingQueryModel

T findUniqueUsingQueryModel(QueryModel queryModel)
                            throws NoSuchItemException,
                                   TooManyItemsException,
                                   JeppettoException
Find an object T that satisfies the QueryModel.

Parameters:
queryModel - that contains criteria to match
Returns:
Object that satisfies the query model
Throws:
NoSuchItemException - if the object identified by the queryModel is not found
TooManyItemsException - if more than one object identified by the queryModel is found
JeppettoException - if any other failure occurs

findUsingQueryModel

Iterable<T> findUsingQueryModel(QueryModel queryModel)
                                throws JeppettoException
Find objects of type T that correspond to the QueryModel.

Parameters:
queryModel - that contains criteria that will be true of the results
Returns:
Iterable of T
Throws:
JeppettoException - if any underlying failure occurs

projectUsingQueryModel

Object projectUsingQueryModel(QueryModel queryModel)
                              throws JeppettoException
Use the QueryModel to narrow a set of results, then perform the specified projection.

Parameters:
queryModel - that contains criteria that will be used
Returns:
result of the projection - exact type depends on the projection specified
Throws:
JeppettoException - if any underlying failure occurs

deleteUsingQueryModel

void deleteUsingQueryModel(QueryModel queryModel)
                           throws JeppettoException
Delete objects of type T that correspond to the QueryModel.

Parameters:
queryModel - that contains criteria of items to delete
Throws:
JeppettoException - if any underlying failure occurs

referenceUsingQueryModel

ReferenceSet<T> referenceUsingQueryModel(QueryModel queryModel)
                                         throws JeppettoException
Throws:
JeppettoException

buildCondition

Condition buildCondition(String conditionField,
                         ConditionType conditionType,
                         Iterator argsIterator)
Construct a Condition object given the passed in arguments. This is used to build up the resulting QueryModel that will ultimately be passed back to the one of the find/project methods above.

Parameters:
conditionField - the field upon which the Condition should be made
conditionType - the type of Condition object to construct
argsIterator - an Iterator that may contain values used during the construction of the Condition
Returns:
corresponding Condition object

buildProjection

Projection buildProjection(String projectionField,
                           ProjectionType projectionType,
                           Iterator argsIterator)
Construct a Projection object given the passed in arguments. This is used to build up the resulting QueryModel that will ultimately be passed back to the projectUsingQueryModel() method.

Parameters:
projectionField - the field upon which the Projection should be made
projectionType - the type of Projection object to construct
argsIterator - an Iterator that may contain values used during the construction of the Projection
Returns:
corresponding Projection object


Copyright © 2012. All Rights Reserved.