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

java.lang.Object
  extended by org.eclipse.stardust.engine.api.query.Query
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
ActivityInstanceQuery, BusinessObjectQuery, DataQuery, DeployedModelQuery, DeployedRuntimeArtifactQuery, DocumentQuery, LogEntryQuery, PreferenceQuery, ProcessDefinitionQuery, ProcessInstanceQuery, UserGroupQuery, UserQuery, WorklistQuery

public abstract class Query
extends Object
implements Serializable

Basic functionality for creating query containers for complex queries.

A query consists of the following three optional parts:

Version:
$Revision$
Author:
rsauer
See Also:
Serialized Form

Constructor Summary
Query(FilterVerifier filterVerifyer)
           
 
Method Summary
 FilterAndTerm getFilter()
          Gets the top-level filter term.
 OrderCriteria getOrderCriteria()
          Gets the top-level order criteria.
<T extends EvaluationPolicy>
T
getPolicy(Class<T> policyClass)
          Extracts any set policy of the given kind.
 OrderCriteria orderBy(FilterableAttribute attribute)
          Orders the resulting elements by ascending values of the given attribute.
 OrderCriteria orderBy(FilterableAttribute attribute, boolean ascending)
          Orders the resulting elements by either ascending or descending values of the given attribute.
 OrderCriteria orderBy(OrderCriterion criterion)
          Adds a new order criterion.
 void removePolicy(Class policyClass)
          Removes any set policy of the given kind.
 void setPolicy(EvaluationPolicy policy)
          Sets the given policy.
 String toString()
           
 FilterAndTerm where(FilterCriterion filter)
          Adds the given filter criterion to the top-level filter term.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Query

public Query(FilterVerifier filterVerifyer)
Method Detail

getFilter

public final FilterAndTerm getFilter()
Gets the top-level filter term.

Returns:
The top-level AND filtert term.
See Also:
where(FilterCriterion)

where

public final FilterAndTerm where(FilterCriterion filter)
                          throws UnsupportedFilterException
Adds the given filter criterion to the top-level filter term.

Parameters:
filter - The filter criterion to be added
Returns:
The top-level AND filer-term, thus allowing for chained calls.
Throws:
UnsupportedFilterException - if the filter criterion to be added is not valid for this specific query
See Also:
getFilter()

orderBy

public final OrderCriteria orderBy(OrderCriterion criterion)
Adds a new order criterion.

Parameters:
criterion - The order criterion to add.
Returns:
The callee's order criteria, thus allowing chained calls.
See Also:
orderBy(FilterableAttribute, boolean), orderBy(FilterableAttribute)

orderBy

public final OrderCriteria orderBy(FilterableAttribute attribute)
Orders the resulting elements by ascending values of the given attribute.

Parameters:
attribute - The attribute to order by.
Returns:
The callee's order criteria, thus allowing chained calls.
See Also:
orderBy(FilterableAttribute, boolean), orderBy(OrderCriterion)

orderBy

public final OrderCriteria orderBy(FilterableAttribute attribute,
                                   boolean ascending)
Orders the resulting elements by either ascending or descending values of the given attribute.

Parameters:
attribute - The attribute to order by.
ascending - Flag indicating if ordering should be performed by either ascending or descending attribute value.
Returns:
The callee's order criteria, thus allowing chained calls.
See Also:
orderBy(FilterableAttribute), orderBy(OrderCriterion)

getOrderCriteria

public final OrderCriteria getOrderCriteria()
Gets the top-level order criteria.

Returns:
The top-level order criteria.
See Also:
orderBy(FilterableAttribute), orderBy(OrderCriterion), orderBy(FilterableAttribute, boolean)

getPolicy

public final <T extends EvaluationPolicy> T getPolicy(Class<T> policyClass)
Extracts any set policy of the given kind.

Parameters:
policyClass - The kind of policy to extract.
Returns:
The policy, or null if no such policy exists for the query.
See Also:
setPolicy(org.eclipse.stardust.engine.api.query.EvaluationPolicy), removePolicy(java.lang.Class)

setPolicy

public final void setPolicy(EvaluationPolicy policy)
Sets the given policy.

There always exists at most one policy per policy class. Thus an existing policy of the same class is overwritten.

Parameters:
policy - The policy to be set.
See Also:
getPolicy(java.lang.Class), removePolicy(java.lang.Class)

removePolicy

public final void removePolicy(Class policyClass)
Removes any set policy of the given kind.

Parameters:
policyClass - The kind of policy to be removed from the query.
See Also:
getPolicy(java.lang.Class), setPolicy(org.eclipse.stardust.engine.api.query.EvaluationPolicy)

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2017 Eclipse Stardust. All Rights Reserved.