/
ProcessInstanceQuery.java
426 lines (354 loc) · 16.6 KB
/
ProcessInstanceQuery.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.flowable.engine.runtime;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Set;
import org.flowable.common.engine.api.query.Query;
/**
* Allows programmatic querying of {@link ProcessInstance}s.
*
* @author Joram Barrez
* @author Tijs Rademakers
* @author Frederik Heremans
* @author Falko Menge
*/
public interface ProcessInstanceQuery extends Query<ProcessInstanceQuery, ProcessInstance> {
/** Select the process instance with the given id */
ProcessInstanceQuery processInstanceId(String processInstanceId);
/** Select process instances whose id is in the given set of ids */
ProcessInstanceQuery processInstanceIds(Set<String> processInstanceIds);
/** Select process instances with the given business key */
ProcessInstanceQuery processInstanceBusinessKey(String processInstanceBusinessKey);
/**
* Select process instance with the given business key, unique for the given process definition
*/
ProcessInstanceQuery processInstanceBusinessKey(String processInstanceBusinessKey, String processDefinitionKey);
/**
* Select process instances with a business key like the given value.
*/
ProcessInstanceQuery processInstanceBusinessKeyLike(String businessKeyLike);
/** Select process instances with the given business status */
ProcessInstanceQuery processInstanceBusinessStatus(String businessStatus);
/**
* Select process instances with a business status like the given value.
*/
ProcessInstanceQuery processInstanceBusinessStatusLike(String businessStatusLike);
/**
* Only select process instances that have the given tenant id.
*/
ProcessInstanceQuery processInstanceTenantId(String tenantId);
/**
* Only select process instances with a tenant id like the given one.
*/
ProcessInstanceQuery processInstanceTenantIdLike(String tenantIdLike);
/**
* Only select process instances that do not have a tenant id.
*/
ProcessInstanceQuery processInstanceWithoutTenantId();
/** Only select process instances whose process definition category is processDefinitionCategory. */
ProcessInstanceQuery processDefinitionCategory(String processDefinitionCategory);
/**
* Select process instances whose process definition name is processDefinitionName
*/
ProcessInstanceQuery processDefinitionName(String processDefinitionName);
/**
* Only select process instances with a certain process definition version. Particularly useful when used in combination with {@link #processDefinitionKey(String)}
*/
ProcessInstanceQuery processDefinitionVersion(Integer processDefinitionVersion);
/**
* Select the process instances which are defined by a process definition with the given key.
*/
ProcessInstanceQuery processDefinitionKey(String processDefinitionKey);
/**
* Select the process instances which are defined by process definitions with the given keys.
*/
ProcessInstanceQuery processDefinitionKeys(Set<String> processDefinitionKeys);
/**
* Select the process instances which are defined by a process definition with the given id.
*/
ProcessInstanceQuery processDefinitionId(String processDefinitionId);
/**
* Select the process instances which are defined by process definitions with the given ids.
*/
ProcessInstanceQuery processDefinitionIds(Set<String> processDefinitionIds);
/**
* Select the process instances which are defined by a process definition with the given engine version.
*/
ProcessInstanceQuery processDefinitionEngineVersion(String processDefinitionEngineVersion);
/**
* Select the process instances which are defined by a deployment with the given id.
*/
ProcessInstanceQuery deploymentId(String deploymentId);
/**
* Select the process instances which are defined by one of the given deployment ids
*/
ProcessInstanceQuery deploymentIdIn(List<String> deploymentIds);
/**
* Select the process instances which are a sub process instance of the given super process instance.
*/
ProcessInstanceQuery superProcessInstanceId(String superProcessInstanceId);
/**
* Select the process instance that have as sub process instance the given process instance. Note that there will always be maximum only <b>one</b> such process instance that can be the result of
* this query.
*/
ProcessInstanceQuery subProcessInstanceId(String subProcessInstanceId);
/**
* Exclude sub processes from the query result;
*/
ProcessInstanceQuery excludeSubprocesses(boolean excludeSubprocesses);
/**
* Select the process instances which have an active activity instance like the provided id.
*/
ProcessInstanceQuery activeActivityId(String activityId);
/**
* Select the process instances which have an active activity instance like the provided ids.
*/
ProcessInstanceQuery activeActivityIds(Set<String> activityIds);
/**
* Select the process instances with which the user with the given id is involved.
*/
ProcessInstanceQuery involvedUser(String userId);
/**
* Select the process instances with which the user with the given id and identity link type is involved.
*/
ProcessInstanceQuery involvedUser(String userId, String identityLinkType);
/**
* Select the process instances with which the group with the given id and identity link type is involved.
*/
ProcessInstanceQuery involvedGroup(String groupId, String identityLinkType);
/**
* Select the process instances with which the {@link org.flowable.idm.api.Group}s with the given ids are involved.
*/
ProcessInstanceQuery involvedGroups(Set<String> groupIds);
/**
* Only select process instances which have a global variable with the given value. The type of variable is determined based on the value, using types configured in
* {@link org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl#getVariableTypes()}. Byte-arrays and {@link Serializable} objects (which are not primitive type wrappers) are not supported.
*
* @param name
* name of the variable, cannot be null.
*/
ProcessInstanceQuery variableValueEquals(String name, Object value);
/**
* Only select process instances which have at least one global variable with the given value. The type of variable is determined based on the value, using types configured in
* {@link org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl#getVariableTypes()}. Byte-arrays and {@link Serializable} objects (which are not primitive type wrappers) are not supported.
*/
ProcessInstanceQuery variableValueEquals(Object value);
/**
* Only select process instances which have a local string variable with the given value, case insensitive.
* <p>
* This method only works if your database has encoding/collation that supports case-sensitive queries. For example, use "collate UTF-8" on MySQL and for MSSQL, select one of the case-sensitive
* Collations available (<a href="http://msdn.microsoft.com/en-us/library/ms144250(v=sql.105).aspx" >MSDN Server Collation Reference</a>).
* </p>
*
* @param name
* name of the variable, cannot be null.
* @param value
* value of the variable, cannot be null.
*/
ProcessInstanceQuery variableValueEqualsIgnoreCase(String name, String value);
/**
* Only select process instances which have a global variable with the given name, but with a different value than the passed value. Byte-arrays and {@link Serializable} objects (which are not
* primitive type wrappers) are not supported.
*
* @param name
* name of the variable, cannot be null.
*/
ProcessInstanceQuery variableValueNotEquals(String name, Object value);
/**
* Only select process instances which have a local string variable which is not the given value, case insensitive.
* <p>
* This method only works if your database has encoding/collation that supports case-sensitive queries. For example, use "collate UTF-8" on MySQL and for MSSQL, select one of the case-sensitive
* Collations available (<a href="http://msdn.microsoft.com/en-us/library/ms144250(v=sql.105).aspx" >MSDN Server Collation Reference</a>).
* </p>
*
* @param name
* name of the variable, cannot be null.
* @param value
* value of the variable, cannot be null.
*/
ProcessInstanceQuery variableValueNotEqualsIgnoreCase(String name, String value);
/**
* Only select process instances which have a variable value greater than the passed value. Booleans, Byte-arrays and {@link Serializable} objects (which are not primitive type wrappers) are not
* supported.
*
* @param name
* variable name, cannot be null.
* @param value
* variable value, cannot be null.
*/
ProcessInstanceQuery variableValueGreaterThan(String name, Object value);
/**
* Only select process instances which have a global variable value greater than or equal to the passed value. Booleans, Byte-arrays and {@link Serializable} objects (which are not primitive type
* wrappers) are not supported.
*
* @param name
* variable name, cannot be null.
* @param value
* variable value, cannot be null.
*/
ProcessInstanceQuery variableValueGreaterThanOrEqual(String name, Object value);
/**
* Only select process instances which have a global variable value less than the passed value. Booleans, Byte-arrays and {@link Serializable} objects (which are not primitive type wrappers) are
* not supported.
*
* @param name
* variable name, cannot be null.
* @param value
* variable value, cannot be null.
*/
ProcessInstanceQuery variableValueLessThan(String name, Object value);
/**
* Only select process instances which have a global variable value less than or equal to the passed value. Booleans, Byte-arrays and {@link Serializable} objects (which are not primitive type
* wrappers) are not supported.
*
* @param name
* variable name, cannot be null.
* @param value
* variable value, cannot be null.
*/
ProcessInstanceQuery variableValueLessThanOrEqual(String name, Object value);
/**
* Only select process instances which have a global variable value like the given value. This be used on string variables only.
*
* @param name
* variable name, cannot be null.
* @param value
* variable value, cannot be null. The string can include the wildcard character '%' to express like-strategy: starts with (string%), ends with (%string) or contains (%string%).
*/
ProcessInstanceQuery variableValueLike(String name, String value);
/**
* Only select process instances which have a global variable value like the given value (case insensitive). This be used on string variables only.
*
* @param name
* variable name, cannot be null.
* @param value
* variable value, cannot be null. The string can include the wildcard character '%' to express like-strategy: starts with (string%), ends with (%string) or contains (%string%).
*/
ProcessInstanceQuery variableValueLikeIgnoreCase(String name, String value);
/**
* Only select process instances which have a variable with the given name.
*
* @param name
* cannot be null.
*/
ProcessInstanceQuery variableExists(String name);
/**
* Only select process instances which does not have a variable with the given name.
*
* @param name
* cannot be null.
*/
ProcessInstanceQuery variableNotExists(String name);
/**
* Only select process instances which are suspended, either because the process instance itself is suspended or because the corresponding process definition is suspended
*/
ProcessInstanceQuery suspended();
/**
* Only select process instances which are active, which means that neither the process instance nor the corresponding process definition are suspended.
*/
ProcessInstanceQuery active();
/**
* Only select process instances with the given name.
*/
ProcessInstanceQuery processInstanceName(String name);
/**
* Only select process instances with a name like the given value.
*/
ProcessInstanceQuery processInstanceNameLike(String nameLike);
/**
* Only select process instances with a name like the given value, ignoring upper/lower case.
*/
ProcessInstanceQuery processInstanceNameLikeIgnoreCase(String nameLikeIgnoreCase);
/**
* Only select process instances with a root instance with a name like the given value.
*/
ProcessInstanceQuery processInstanceRootScopeId(String rootScopeId);
/**
* Only select process instances with the given parent process instance id.
*/
ProcessInstanceQuery processInstanceParentScopeId(String parentScopeId);
/**
* Only select process instances with the given callback id.
*/
ProcessInstanceQuery processInstanceCallbackId(String callbackId);
/**
* Only select process instances with the given callback type.
*/
ProcessInstanceQuery processInstanceCallbackType(String callbackType);
/**
* Only select process instances with the given reference id.
*/
ProcessInstanceQuery processInstanceReferenceId(String referenceId);
/**
* Only select process instances with the given callback type.
*/
ProcessInstanceQuery processInstanceReferenceType(String referenceType);
/**
* Localize process name and description to specified locale.
*/
ProcessInstanceQuery locale(String locale);
/**
* Instruct localization to fallback to more general locales including the default locale of the JVM if the specified locale is not found.
*/
ProcessInstanceQuery withLocalizationFallback();
/**
* Include process variables in the process query result
*/
ProcessInstanceQuery includeProcessVariables();
/**
* Only select process instances that failed due to an exception happening during a job execution.
*/
ProcessInstanceQuery withJobException();
/**
* Begin an OR statement. Make sure you invoke the endOr method at the end of your OR statement. Only one OR statement is allowed, for the second call to this method an exception will be thrown.
*/
ProcessInstanceQuery or();
/**
* End an OR statement. Only one OR statement is allowed, for the second call to this method an exception will be thrown.
*/
ProcessInstanceQuery endOr();
/**
* Only select process instances started before the given time
*/
ProcessInstanceQuery startedBefore(Date beforeTime);
/**
* Only select process instances started after the given time
*/
ProcessInstanceQuery startedAfter(Date afterTime);
/**
* Only select process instances started by the given user id
*/
ProcessInstanceQuery startedBy(String userId);
// ordering
// /////////////////////////////////////////////////////////////////
/** Order by id (needs to be followed by {@link #asc()} or {@link #desc()}). */
ProcessInstanceQuery orderByProcessInstanceId();
/**
* Order by process definition key (needs to be followed by {@link #asc()} or {@link #desc()}).
*/
ProcessInstanceQuery orderByProcessDefinitionKey();
/**
* Order by process definition id (needs to be followed by {@link #asc()} or {@link #desc()}).
*/
ProcessInstanceQuery orderByProcessDefinitionId();
/**
* Order by start time (needs to be followed by {@link #asc()} or {@link #desc()}).
*/
ProcessInstanceQuery orderByStartTime();
/**
* Order by tenant id (needs to be followed by {@link #asc()} or {@link #desc()}).
*/
ProcessInstanceQuery orderByTenantId();
}