org.eclipse.stardust.engine.api.query
Class SubsetPolicy

java.lang.Object
  extended by org.eclipse.stardust.engine.api.query.SubsetPolicy
All Implemented Interfaces:
Serializable, EvaluationPolicy

public final class SubsetPolicy
extends Object
implements EvaluationPolicy

Evaluation Policy for specifying retrieval of only a subset of found data.

Version:
$Revision$
Author:
rsauer
See Also:
Query.setPolicy(org.eclipse.stardust.engine.api.query.EvaluationPolicy), Serialized Form

Field Summary
static SubsetPolicy COUNT_ONLY
          Predefined policy indicating an counting only subset.
static SubsetPolicy UNRESTRICTED
          Predefined policy indicating an unrestricted subset.
 
Constructor Summary
SubsetPolicy(int maxSize)
          Same as SubsetPolicy(int, boolean) with evaluateTotalCount set to false.
SubsetPolicy(int maxSize, boolean evaluateTotalCount)
          Same as SubsetPolicy(int, int, boolean) with skippedEntries set to 0.
SubsetPolicy(int maxSize, int skippedEntries)
          Same as SubsetPolicy(int, int, boolean) with evaluateTotalCount set to false.
SubsetPolicy(int maxSize, int skippedEntries, boolean evaluateTotalCount)
          Initializes a new subset policy with the explicit values given.
 
Method Summary
 int getMaxSize()
          Gets the maximum number of items to be included in a query result.
 int getSkippedEntries()
          Gets the number of initial items to be skipped before putting items to the query result.
 boolean isEvaluatingTotalCount()
          Indicates if the query result should additionally contain the total number of items available, disregarding any result set size restriction.
static SubsetPolicy nextChunk(SubsetPolicy subset)
          Creates a new subset policy for retrieving the chunk of data following the one specified by the given subset.
static SubsetPolicy previousChunk(SubsetPolicy subset)
          Creates a new subset policy for retrieving the chunk of data before the one specified by the given subset.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNRESTRICTED

public static final SubsetPolicy UNRESTRICTED
Predefined policy indicating an unrestricted subset. Implicitly includes evaluation of the total item count, as all available items are fetched.


COUNT_ONLY

public static final SubsetPolicy COUNT_ONLY
Predefined policy indicating an counting only subset. No items are fetched but total count is evaluated.

Constructor Detail

SubsetPolicy

public SubsetPolicy(int maxSize)
Same as SubsetPolicy(int, boolean) with evaluateTotalCount set to false.

Parameters:
maxSize - The maximum number of items to be retrieved.

SubsetPolicy

public SubsetPolicy(int maxSize,
                    boolean evaluateTotalCount)
Same as SubsetPolicy(int, int, boolean) with skippedEntries set to 0.

Parameters:
maxSize - The maximum number of items to be retrieved.
evaluateTotalCount - A flag indicating if the total number of items satisfying the query is to be evaluated or not.

SubsetPolicy

public SubsetPolicy(int maxSize,
                    int skippedEntries)
Same as SubsetPolicy(int, int, boolean) with evaluateTotalCount set to false.

Parameters:
maxSize - The maximum number of items to be retrieved.
skippedEntries - The number of initial entries to be skipped before putting items to the query result. Must not be less than 0.
Throws:
org.eclipse.stardust.common.error.PublicException - if skippedEntries is less than 0

SubsetPolicy

public SubsetPolicy(int maxSize,
                    int skippedEntries,
                    boolean evaluateTotalCount)
Initializes a new subset policy with the explicit values given.

Parameters:
maxSize - The maximum number of items to be retrieved.
skippedEntries - The number of initial entries to be skipped before putting items to the query result. Must not be less than 0.
evaluateTotalCount - A flag indicating if the total number of items satisfying the query is to be evaluated or not.
Throws:
org.eclipse.stardust.common.error.PublicException - if skippedEntries is less than 0
Method Detail

nextChunk

public static final SubsetPolicy nextChunk(SubsetPolicy subset)
Creates a new subset policy for retrieving the chunk of data following the one specified by the given subset.

This chunk is defined as follows:

Parameters:
subset - The subset specification to find the next chunk for.
Returns:
The requested subset policy, or null if the given subset was null.
See Also:
previousChunk(org.eclipse.stardust.engine.api.query.SubsetPolicy)

previousChunk

public static final SubsetPolicy previousChunk(SubsetPolicy subset)
Creates a new subset policy for retrieving the chunk of data before the one specified by the given subset.

This chunk is defined as follows:

Parameters:
subset - The subset specification to find the previous chunk for.
Returns:
The requested subset policy, or null if the given subset was null.
See Also:
nextChunk(org.eclipse.stardust.engine.api.query.SubsetPolicy)

getMaxSize

public final int getMaxSize()
Gets the maximum number of items to be included in a query result.

Returns:
The maximum item number

getSkippedEntries

public final int getSkippedEntries()
Gets the number of initial items to be skipped before putting items to the query result. Allows for paging of query results.

Returns:
The number of items to be skipped

isEvaluatingTotalCount

public boolean isEvaluatingTotalCount()
Indicates if the query result should additionally contain the total number of items available, disregarding any result set size restriction. Allows for calculating the total number of pages needed when using subsets for query result paging.

Returns:
true if the total number of items should be evaluated, false if not.


Copyright © 2017 Eclipse Stardust. All Rights Reserved.