Class CaseQuery
- Direct Known Subclasses:
CaseQuery.AggregationQuery,CaseQuery.FilterLink,CaseQuery.GroupByQuery,CaseQuery.OrderByQuery
Provides a query builder to query case data of
the current workflow context.
To execute the query use ICaseQueryExecutor.
See ivy.wf.getCaseQueryExecutor()
Example how to filter and order data:
Example how to aggregate and group data:
import ch.ivyteam.ivy.workflow.query.CaseQuery;
CaseQuery caseQuery = CaseQuery.businessCases();
List<ICase> cases = caseQuery.where().customVarCharField1().isEqual("Hello")
.and().customVarCharField2().isEqual("World")
.orderBy().name().ascending()
.executor().results();
import ch.ivyteam.ivy.workflow.query.CaseQuery;
CaseQuery caseQuery = CaseQuery.businessCases();
Recordset recordset = caseQuery.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 CaseQuery by default returns only cases of the
current workflow context.
It is not necessary to explicit filter the cases with CaseQuery.IFilterableColumns.applicationId()
as this is already implicitly done by the CaseQuery itself.
- API:
- This is a public API.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassThis class provides methods to perform aggregations on the query.static classclassProvides filter functionality forICaseclassProvides methods to group the result by certain fields.static interfaceProvides methods to perform aggregations on the query.static interfacestatic interfacestatic interfacestatic interfaceBasic filter functionality provider for a column ofICasestatic interfaceProvides aggregation functionality for custom fields ofICase.static interfaceProvides filter functionality for custom fields ofICase.static interfaceProvides grouping functionality for custom fields ofICase.static interfaceProvides ordering functionality for custom fields ofICase.static interfaceProvides filter functionality for a date column ofICasestatic interfaceProvides filter functionality forICasestatic interfaceLinks a where condition with another.static interfaceProvides filter functionality forICasestatic interfaceProvides methods to group the result by certain fields.static interfaceProvides filter functionality for an integer column ofICasestatic interfaceProvides filter functionality for a decimal number column ofICasestatic interfaceProvides methods to order the result by columns ofICase.static interfaceProvides filter functionality for columns ofICasethat can be filter by string patterns (isLike)static interfaceProvides filter functionality for a string column ofICasestatic interfaceProvides filter functionality for aWorkflowPrioritycolumn ofICaseclassProvides methods to define the direction of the sorting either ascending or descending.classProvides methods to order the result by columns ofICase. -
Method Summary
Modifier and TypeMethodDescriptionReturns an object which contains the aggregation part for this query.
It provides methods to perform aggregations on the query.static CaseQueryCreates a new query that only returns business cases.static CaseQuerycreate()Creates a new query
For performance reasons you should always preferbusinessCases()orsubCases()if you only need one of those.executor()Provides a fluent API to execute this query and fetch its results.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.static CaseQuerysubCases()Creates a new query that only returns sub cases (technical cases).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
For performance reasons you should always preferbusinessCases()orsubCases()if you only need one of those.- Returns:
- A new instance of CaseQuery
- See Also:
- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
-
businessCases
Creates a new query that only returns business cases.- Returns:
- A new instance of CaseQuery
- See Also:
- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
-
subCases
Creates a new query that only returns sub cases (technical cases).- Returns:
- A new instance of CaseQuery
- See Also:
- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
-
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 IvyScript and Java. It has the visibility NOVICE.
-
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:CaseQuery.businessCases().aggregate().sumWorkingTime().avgWorkingTime();
SELECT SUM(WorkingTime) AS SumWorkingTime, AVG(WorkingTime) AS AvgWorkingTime FROM IWA_Case
- Returns:
- aggregate query
- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
-
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:CaseQuery.businessCases().groupBy().ownerRoleId().ownerName().aggregate().countRows();
SELECT OwnerRoleId, OwnerUserId, Count(*) AS Count FROM IWA_Case GROUP BY OwnerRoleId, OwnerUserId
- Returns:
- A query group by builder to add group by statements
- See Also:
- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
-
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 IvyScript and Java. It has the visibility EXPERT.
-
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 IvyScript and Java. It has the visibility EXPERT.
-