SPT Object Database API

com.sptci.prevayler.query
Class FetchByIndices<P extends Collection<PrevalentObject>,S extends PrevalentSystem>

java.lang.Object
  extended by com.sptci.prevayler.query.AbstractQuery<P,S>
      extended by com.sptci.prevayler.query.FetchByIndices<P,S>
All Implemented Interfaces:
Query

public class FetchByIndices<P extends Collection<PrevalentObject>,S extends PrevalentSystem>
extends AbstractQuery<P,S>

A query used to fetch prevalent instances by the specified indexed fields.

© Copyright 2008 Sans Pareil Technologies, Inc.

Version:
$Id: FetchByIndices.java 22 2008-11-24 19:04:25Z sptrakesh $
Author:
Rakesh Vidyadharan 2008-07-19

Nested Class Summary
static class FetchByIndices.AggregationType
          An enumeration used to indicate whether the query results should represent a union or intersection.
 
Field Summary
private  Map<String,?> parameters
          The map of parameters to use to filter the prevalent instances.
private  FetchByIndices.AggregationType resultType
          The aggregation type to use for the results of the query.
private  Class type
          The type of the prevalent object that is to be queried.
 
Constructor Summary
FetchByIndices(Class type, Map<String,?> parameters, FetchByIndices.AggregationType resultType)
          Create a new instance of the query with the specified values.
 
Method Summary
protected  P query(S system, Date timestamp)
          Execute the query on the prevalent system and return the collection of
 
Methods inherited from class com.sptci.prevayler.query.AbstractQuery
query
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

type

private final Class type
The type of the prevalent object that is to be queried.


parameters

private final Map<String,?> parameters
The map of parameters to use to filter the prevalent instances.


resultType

private final FetchByIndices.AggregationType resultType
The aggregation type to use for the results of the query.

Constructor Detail

FetchByIndices

public FetchByIndices(Class type,
                      Map<String,?> parameters,
                      FetchByIndices.AggregationType resultType)
Create a new instance of the query with the specified values.

Parameters:
type - The type to use for the query.
parameters - The map of fields in the prevalent class to use to fetch matching objects.
resultType - The aggregation type to use for the results.
Method Detail

query

protected P query(S system,
                  Date timestamp)
                                               throws PrevalentException
Execute the query on the prevalent system and return the collection of

Specified by:
query in class AbstractQuery<P extends Collection<PrevalentObject>,S extends PrevalentSystem>
Parameters:
system - The prevalent system that is to be acted upon.
timestamp - The timestamp for the query.
Returns:
The collection of prevalent objects matching the specified indexed field.
Throws:
PrevalentException - If errors are encountered while querying the system.
See Also:
PrevalentSystem.fetchUnion(Class, java.util.Map), PrevalentSystem.fetchIntersection(Class, java.util.Map)

SPT Object Database API