SPT Object Database API

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

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

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

The query used to retrieve prevalent objects of the specified type in the range specified. This is used to retrieve paginated view of the prevalent objects stored in the prevalent system.

Version:
$Id: FetchRange.java 22 2008-11-24 19:04:25Z sptrakesh $
Author:
Rakesh Vidyadharan 2008-05-27
See Also:

© Copyright 2008 Sans Pareil Technologies, Inc.


Field Summary
private  Class cls
          The type of prevalent objects to retrieve.
private  long end
          The ending index (exclusive) of the range to which to fetch objects.
private  long start
          The starting index (inclusive) of the range from which to fetch objects.
 
Constructor Summary
FetchRange(Class cls, long start, long end)
          Create a new instance of the query for the specified parameters.
 
Method Summary
protected  Collection<P> query(S system, Date timestamp)
          Execute the query on the prevalent system and return the prevalent objects that fall in the specified range.
 
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

cls

private final Class cls
The type of prevalent objects to retrieve.


start

private final long start
The starting index (inclusive) of the range from which to fetch objects.


end

private final long end
The ending index (exclusive) of the range to which to fetch objects.

Constructor Detail

FetchRange

public FetchRange(Class cls,
                  long start,
                  long end)
Create a new instance of the query for the specified parameters.

Parameters:
cls - The cls value to use.
start - The start value to use.
end - The end value to use.
Method Detail

query

protected Collection<P> query(S system,
                              Date timestamp)
                                               throws PrevalentException
Execute the query on the prevalent system and return the prevalent objects that fall in the specified range.

Specified by:
query in class AbstractQuery<Collection<P extends 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 in the specified range. Return an empty collection if no objects are in the range.
Throws:
PrevalentException - If errors are encountered while fetching the required prevalent objects.

SPT Object Database API