Class TaskQuery
- Direct Known Subclasses:
TaskQuery.AggregationQuery
,TaskQuery.FilterLink
,TaskQuery.GroupByQuery
,TaskQuery.OrderByQuery
Provides a query builder to query task
data of the current
workflow context
.
To execute the query use
ITaskQueryExecutor
. See
ivy.wf.getTaskQueryExecutor()
Example how to filter and order data:
Example how to aggregate and group data:
import ch.ivyteam.ivy.workflow.query.TaskQuery;
TaskQuery taskQuery = TaskQuery.create();
List<ITask> tasks = taskQuery.where().customVarCharField1().isEqual("Hello")
.and().customVarCharField2().isEqual("World")
.orderBy().name().ascending();
.executor().results();
import ch.ivyteam.ivy.workflow.query.TaskQuery;
TaskQuery taskQuery = TaskQuery.create();
Recordset recordset = taskQuery.aggregate().sumCustomDecimalField1()
.groupBy().customVarCharField1()
.executor().recordset();
recordset.getField(0, 0); // Sum of the group
recordset.getField(0, 1); // Name of the group
Note, that a TaskQuery by default returns only tasks of the
current workflow
context
. It is not necessary to explicit filter the tasks with
TaskQuery.IFilterableColumns.applicationId()
as this is already implicitly done
by the TaskQuery itself.
- API:
- This is a public API.
-
Nested Class Summary
Modifier and TypeClassDescriptionclass
This class provides methods to perform aggregations on the query.static class
Links a where condition with another.class
class
static interface
Provides methods to perform aggregations on the query.static interface
Provides filter functionality for a boolean column ofITask
static interface
static interface
static interface
Basic filter functionality provider for a column ofITask
(package private) static interface
Provides aggregation functionality for custom fields ofITask
.static interface
Provides filter functionality for custom fields ofITask
.static interface
Provides grouping functionality for custom fields ofITask
.static interface
Provides ordering functionality for custom fields ofITask
.static interface
Provides filter functionality for a date column ofITask
static interface
Provides filter functionality forITask
static interface
Links a where condition with another.static interface
Provides filter functionality forITask
static interface
Provides methods to group the result by certain fields.static interface
Provides filter functionality for an integer column ofITask
static interface
Provides filter functionality for a decimal number column ofITask
static interface
Provides methods to order the result by columns ofITask
.static interface
Provides filter functionality for columns ofITask
that can be filter by string patterns (isLike)static interface
Provides filter functionality for a string column ofITask
static interface
Provides filter functionality for aTaskBusinessState
column ofITask
static interface
static interface
static interface
Provides filter functionality for aWorkflowPriority
column ofITask
class
Provides methods to define the direction of the sorting either ascending or descending.class
Provides methods to order the result by columns ofITask
. -
Method Summary
Modifier and TypeMethodDescriptionReturns an object which contains the aggregation part for this query.
It provides methods to perform aggregations on the query.asJson()
Deprecated.static TaskQuery
create()
Creates a new queryexecutor()
Provides a fluent API to execute this query and fetch its results.static TaskQuery
Deprecated.Do not serialize and deserializeTaskQuery
.groupBy()
Returns an object which contains the group by part for this query.
It provides methods to group the result by certain fields.orderBy()
Returns an object which contains the order by part for this query.
It provides methods to order the result by certain columns.<T> T
Deprecated.where()
Returns an object which contains the where part for this query.
It provides methods to filter the result by certain columns.
-
Method Details
-
create
Creates a new query- Returns:
- A new instance of TaskQuery
- API:
- This public API is available in Java.
-
fromJson
Deprecated.Do not serialize and deserializeTaskQuery
. There is no guarantee that the serialized form is compatible with each version of ivy.Creates a new query based on the given JSON. SeeTaskQuery
for an example.- Parameters:
json
- the serialized TaskQuery, generated byasJson()
- Returns:
- A new instance of TaskQuery
- API:
- This public API is available in Java.
-
executor
Provides a fluent API to execute this query and fetch its results.
- Returns:
- fluent API to execute this query.
- API:
- This public API is available in Java.
-
aggregate
Returns an object which contains the aggregation part for this query.
It provides methods to perform aggregations on the query. For each aggregation a column is added to the result set.Example:
Corresponds to SQL:TaskQuery.create().aggregate().sumWorkingTime().avgWorkingTime();
SELECT SUM(WorkingTime) AS SumWorkingTime, AVG(WorkingTime) AS AvgWorkingTime FROM IWA_Task
- Returns:
- aggregate query
- API:
- This public API is available in Java.
-
groupBy
Returns an object which contains the group by part for this query.
It provides methods to group the result by certain fields.Example:
Corresponds to SQL:TaskQuery.create().groupBy().activatorUserId().priority().aggregate().countRows();
SELECT ActivatorUserId, Priority, Count(*) AS Count FROM IWA_Task GROUP BY ActivatorUserId, Priority
- Returns:
- A query group by builder to add group by statements
- See Also:
- API:
- This public API is available in Java.
-
orderBy
Returns an object which contains the order by part for this query.
It provides methods to order the result by certain columns.- Returns:
- An order by query builder to add order by statements
- API:
- This public API is available in Java.
-
where
Returns an object which contains the where part for this query.
It provides methods to filter the result by certain columns.- Returns:
- An filter query builder to add where statements
- API:
- This public API is available in Java.
-
asJson
Deprecated.Do not serialize and deserializeQuery
. There is no guarantee that the serialized form is compatible with each version of ivy.This method allows to serialize a query as json and to deserialize the query by calling the corresponding fromJson(String) on the specific query.This allows to store the query in a database or send it over the wire to execute it at a later time or on a remote engine.
Note, that NOT all methods supports de-/serialization proper. When using database related parameters like a User or Role the method with the username or the rolename has to be used, in order to evaluate the correct user or role on execution.
- Returns:
- the query as json
- API:
- This public API is available in Java.
-
toType
Deprecated.- API:
- This public API is available in Java.
-
Query
.