|
Function description |
The corresponding query API |
|
Query "Process definition" |
Processdefinitionquery Processdefinitionquery =
Processengine.getrepositoryservice ()
. Createprocessdefinitionquery (); |
|
Query "Execute Object"
(Process instance) |
Processinstancequery Processinstancequery =
Processengine.getexecutionservice ()//
. Createprocessinstancequery (); |
|
Query "Tasks" |
Taskquery taskquery =//
Processengine.gettaskservice ()//
. Createtaskquery (); |
|
Query "Execution History"
(Process instance history) |
Historyprocessinstancequery Historyprocessinstancequery =
Processengine.gethistoryservice ()
. Createhistoryprocessinstancequery (); |
|
Query "Task History" |
Historytaskquery Historytaskquery =
Processengine.gethistoryservice ()
. Createhistorytaskquery (); |
The query objects listed above are:
1. Processdefinitionquery
2. Processinstancequery
3. Taskquery
4. Historyprocessinstancequery
5. Historytaskquery
These query objects are used in a consistent manner, as follows:
1, add Filter: Call the relevant method in which the conditions can be specified. Such as:
A) Processdefinitionquery.processdefinitionkey ("Leave") is a process definition that specifies that the query key is "leave";
b) Taskquery.assignee ("Zhang San") is a task designated for "Zhang San".
2, add sorting criteria:
A) Call Xxquery.orderasc (property), which indicates the ascending order of an attribute
b) Call Xxquery.orderdesc (property), which indicates descending order by an attribute
c) Multiple ordering criteria can be specified, which means the 1th order, the 2nd order ... such as
D) Attribute names have constant definitions in their respective query objects (interfaces), such as:
I. processdefinitionquery.property_id
II. Processdefinitionquery.property_key
III. Taskquery.property_name
Iv. Taskquery.property_assignee
3, specify paging information:
A) Call method Xxquery.page (Firstresult, maxResults);
b) This is the value of the specified first and Max (that is, Query.setfirstresult () and Query.setmaxresults () in Hibernate)
c) If this method is not called, the representative is to query all records that match the criteria.
4, the query results are as follows:
A) Call method Xxquery.list (); Represents a query list
b) Call method Xxquery.uniqueresult (); Represents the only result of a query called Method Xxquery.count (); Indicates the number of records for which the query meets the criteria