1 | <?php |
||
2 | |||
3 | namespace Jabe; |
||
4 | |||
5 | use Jabe\Authorization\{ |
||
6 | BatchPermissions, |
||
7 | Permissions, |
||
8 | ProcessDefinitionPermissions, |
||
9 | ProcessInstancePermissions, |
||
10 | Resources |
||
11 | }; |
||
12 | use Jabe\Batch\BatchInterface; |
||
13 | use Jabe\Exception\{ |
||
14 | NullValueException, |
||
15 | NotFoundException, |
||
16 | NotValidException |
||
17 | }; |
||
18 | use Jabe\History\HistoricProcessInstanceQueryInterface; |
||
19 | use Jabe\Migration\{ |
||
20 | MigrationPlanInterface, |
||
21 | MigrationPlanBuilderInterface, |
||
22 | MigrationPlanExecutionBuilderInterface |
||
23 | }; |
||
24 | use Jabe\Repository\{ |
||
25 | DeploymentInterface, |
||
26 | ResourceDefinitionInterface |
||
27 | }; |
||
28 | use Jabe\Runtime\{ |
||
29 | ActivityInstanceInterface, |
||
30 | ConditionEvaluationBuilderInterface, |
||
31 | EventSubscriptionQueryInterface, |
||
32 | ExecutionInterface, |
||
33 | ExecutionQueryInterface, |
||
34 | IncidentInterface, |
||
35 | IncidentQueryInterface, |
||
36 | MessageCorrelationBuilderInterface, |
||
37 | ModificationBuilderInterface, |
||
38 | NativeExecutionQueryInterface, |
||
39 | NativeProcessInstanceQueryInterface, |
||
40 | ProcessInstanceInterface, |
||
41 | ProcessInstanceModificationBuilderInterface, |
||
42 | ProcessInstanceQueryInterface, |
||
43 | ProcessInstantiationBuilderInterface, |
||
44 | RestartProcessInstanceBuilderInterface, |
||
45 | SignalEventReceivedBuilderInterface, |
||
46 | UpdateProcessInstanceSuspensionStateBuilderInterface, |
||
47 | UpdateProcessInstanceSuspensionStateSelectBuilderInterface, |
||
48 | VariableInstanceQueryInterface |
||
49 | }; |
||
50 | use Jabe\Variable\VariableMapInterface; |
||
51 | use Jabe\Variable\Value\{ |
||
52 | SerializableValueInterface, |
||
53 | TypedValueInterface |
||
54 | }; |
||
55 | |||
56 | interface RuntimeServiceInterface |
||
57 | { |
||
58 | /** |
||
59 | * Starts a new process instance in the latest version of the process definition with the given key. |
||
60 | * |
||
61 | * A business key can be provided to associate the process instance with a |
||
62 | * certain identifier that has a clear business meaning. For example in an |
||
63 | * order process, the business key could be an order id. This business key can |
||
64 | * then be used to easily look up that process instance , see |
||
65 | * ProcessInstanceQuery#processInstanceBusinessKey(String). Providing such a business |
||
66 | * key is definitely a best practice. |
||
67 | * |
||
68 | * Note that a business key MUST be unique for the given process definition WHEN you have added a |
||
69 | * database constraint for it. |
||
70 | * In this case, only Process instance from different process definition are allowed to have the |
||
71 | * same business key and the combination of processdefinitionKey-businessKey must be unique. |
||
72 | * |
||
73 | * The combination of processdefinitionKey-businessKey must be unique. |
||
74 | * |
||
75 | * @param processDefinitionKey key of process definition, cannot be null. |
||
76 | * @param variables the variables to pass, can be null. |
||
77 | * @param businessKey a key that uniquely identifies the process instance in the context of the |
||
78 | * given process definition. |
||
79 | * |
||
80 | * @throws ProcessEngineException |
||
81 | * when no process definition is deployed with the given key. |
||
82 | * @throws AuthorizationException |
||
83 | * if the user has no Permissions#CREATE permission on Resources#PROCESS_INSTANCE |
||
84 | * and no Permissions#CREATE_INSTANCE permission on Resources#PROCESS_DEFINITION. |
||
85 | */ |
||
86 | public function startProcessInstanceByKey(string $processDefinitionKey, string $businessKey = null, array $variables = []): ProcessInstanceInterface; |
||
87 | |||
88 | /** |
||
89 | * Starts a new process instance in the exactly specified version of the process definition with the given id. |
||
90 | * |
||
91 | * A business key can be provided to associate the process instance with a |
||
92 | * certain identifier that has a clear business meaning. For example in an |
||
93 | * order process, the business key could be an order id. This business key can |
||
94 | * then be used to easily look up that process instance , see |
||
95 | * ProcessInstanceQuery#processInstanceBusinessKey(String). Providing such a business |
||
96 | * key is definitely a best practice. |
||
97 | * |
||
98 | * Note that a business key MUST be unique for the given process definition WHEN you have added |
||
99 | * a database constraint for it. |
||
100 | * In this case, only Process instance from different process definition are allowed to have the |
||
101 | * same business key and the combination of processdefinitionKey-businessKey must be unique. |
||
102 | * |
||
103 | * @param processDefinitionId the id of the process definition, cannot be null. |
||
104 | * @param businessKey a key that uniquely identifies the process instance in the context of the |
||
105 | * given process definition. |
||
106 | * @param variables variables to be passed, can be null |
||
107 | * |
||
108 | * @throws ProcessEngineException |
||
109 | * when no process definition is deployed with the given key. |
||
110 | * @throws AuthorizationException |
||
111 | * if the user has no Permissions#CREATE permission on Resources#PROCESS_INSTANCE |
||
112 | * and no Permissions#CREATE_INSTANCE permission on Resources#PROCESS_DEFINITION. |
||
113 | */ |
||
114 | public function startProcessInstanceById(string $processDefinitionId, string $businessKey = null, array $variables = []): ProcessInstanceInterface; |
||
115 | |||
116 | /** |
||
117 | * <p>Signals the process engine that a message is received and starts a new |
||
118 | * ProcessInstance.</p> |
||
119 | * |
||
120 | * See {@link #startProcessInstanceByMessage(String, Map)}. In addition, this method allows |
||
121 | * specifying a business key. |
||
122 | * |
||
123 | * @param messageName |
||
124 | * the 'name' of the message as specified as an attribute on the |
||
125 | * bpmn20 {@code <message name="messageName" />} element. |
||
126 | * @param businessKey |
||
127 | * the business key which is added to the started process instance |
||
128 | * @param processVariables |
||
129 | * the 'payload' of the message. The variables are added as processes |
||
130 | * variables to the started process instance. |
||
131 | * |
||
132 | * @return ProcessInstanceInterface the ProcessInstance object representing the started process instance |
||
133 | * |
||
134 | * @throws ProcessEngineException |
||
135 | * if no subscription to a message with the given name exists |
||
136 | * @throws AuthorizationException |
||
137 | * if the user has no Permissions#CREATE permission on Resources#PROCESS_INSTANCE |
||
138 | * and no Permissions#CREATE_INSTANCE permission on Resources#PROCESS_DEFINITION. |
||
139 | * |
||
140 | * @since 5.9 |
||
141 | */ |
||
142 | public function startProcessInstanceByMessage(string $messageName, string $businessKey = null, array $processVariables = []): ProcessInstanceInterface; |
||
143 | |||
144 | /** |
||
145 | * <p>Signals the process engine that a message is received and starts a new |
||
146 | * ProcessInstance.</p> |
||
147 | * |
||
148 | * See {@link #startProcessInstanceByMessage(String, String)}. In addition, this method allows |
||
149 | * specifying the exactly version of the process definition with the given id. |
||
150 | * |
||
151 | * @param messageName |
||
152 | * the 'name' of the message as specified as an attribute on the |
||
153 | * bpmn20 {@code <message name="messageName" />} element, cannot be null. |
||
154 | * @param processDefinitionId |
||
155 | * the id of the process definition, cannot be null. |
||
156 | * @param businessKey |
||
157 | * the business key which is added to the started process instance |
||
158 | * |
||
159 | * @return ProcessInstanceInterface the ProcessInstance object representing the started process instance |
||
160 | * |
||
161 | * @throws ProcessEngineException |
||
162 | * if no subscription to a message with the given name exists for the |
||
163 | * specified version of process definition. |
||
164 | * @throws AuthorizationException |
||
165 | * if the user has no Permissions#CREATE permission on Resources#PROCESS_INSTANCE |
||
166 | * and no Permissions#CREATE_INSTANCE permission on Resources#PROCESS_DEFINITION. |
||
167 | * |
||
168 | * @since 7.3 |
||
169 | */ |
||
170 | public function startProcessInstanceByMessageAndProcessDefinitionId(string $messageName, string $processDefinitionId, string $businessKey = null, array $processVariables = []): ProcessInstanceInterface; |
||
171 | |||
172 | /** |
||
173 | * Delete an existing runtime process instances asynchronously using Batch operation. |
||
174 | * |
||
175 | * Deletion propagates upward as far as necessary. |
||
176 | * |
||
177 | * @param processInstanceIds id's of process instances to delete. |
||
0 ignored issues
–
show
Documentation
Bug
introduced
by
![]() |
|||
178 | * @param processInstanceQuery query that will be used to fetch affected process instances. |
||
179 | * @param historicProcessInstanceQuery query that will be used to fetch affected |
||
180 | * process instances based on history data. |
||
181 | * @param deleteReason reason for deleting, which will be stored in the history. Can be null. |
||
182 | * @param skipCustomListeners skips custom execution listeners when removing instances |
||
183 | * @param skipSubprocesses skips subprocesses when removing instances |
||
184 | * |
||
185 | * @throws BadUserRequestException |
||
186 | * when no process instance is found with the given queries or ids. |
||
187 | * @throws AuthorizationException |
||
188 | * If the user has no Permissions#CREATE or |
||
189 | * BatchPermissions#CREATE_BATCH_DELETE_RUNNING_PROCESS_INSTANCES permission on Resources#BATCH. |
||
190 | */ |
||
191 | public function deleteProcessInstancesAsync( |
||
192 | array $processInstanceIds, |
||
193 | ProcessInstanceQueryInterface $processInstanceQuery = null, |
||
194 | HistoricProcessInstanceQueryInterface $historicProcessInstanceQuery = null, |
||
195 | string $deleteReason = null, |
||
196 | bool $skipCustomListeners = false, |
||
197 | bool $skipSubprocesses = false |
||
198 | ): BatchInterface; |
||
199 | |||
200 | /** |
||
201 | * Delete an existing runtime process instance. |
||
202 | * |
||
203 | * Deletion propagates upward as far as necessary. |
||
204 | * |
||
205 | * @param processInstanceId id of process instance to delete, cannot be null. |
||
206 | * @param deleteReason reason for deleting, which will be stored in the history. Can be null. |
||
207 | * @param skipCustomListeners if true, only the built-in ExecutionListeners |
||
208 | * are notified with the ExecutionListener#EVENTNAME_END event. |
||
209 | * @param externallyTerminated indicator if deletion triggered from external context, for instance |
||
210 | * REST API call |
||
211 | * |
||
212 | * |
||
213 | * @throws BadUserRequestException |
||
214 | * when the processInstanceId is null. |
||
215 | * @throws NotFoundException |
||
216 | * when no process instance is found with the given processInstanceId. |
||
217 | * @throws AuthorizationException |
||
218 | * if the user has no Permissions#DELETE permission on Resources#PROCESS_INSTANCE |
||
219 | * or no Permissions#DELETE_INSTANCE permission on Resources#PROCESS_DEFINITION. |
||
220 | */ |
||
221 | public function deleteProcessInstance( |
||
222 | string $processInstanceId, |
||
223 | string $deleteReason = null, |
||
224 | bool $skipCustomListeners = false, |
||
225 | bool $skipIoMappings = false, |
||
226 | bool $externallyTerminated = false, |
||
227 | bool $skipSubprocesses = false |
||
228 | ): void; |
||
229 | |||
230 | /** |
||
231 | * Delete existing runtime process instances. |
||
232 | * |
||
233 | * Deletion propagates upward as far as necessary. |
||
234 | * |
||
235 | * @param processInstanceIds ids of process instance to delete, cannot be null. |
||
236 | * @param deleteReason reason for deleting, which will be stored in the history. Can be null. |
||
237 | * @param skipCustomListeners if true, only the built-in ExecutionListeners |
||
238 | * are notified with the ExecutionListener#EVENTNAME_END event. |
||
239 | * @param externallyTerminated indicator if deletion triggered from external context, for instance |
||
240 | * REST API call |
||
241 | * @param skipSubprocesses specifies whether subprocesses should be deleted |
||
242 | * |
||
243 | * |
||
244 | * @throws BadUserRequestException |
||
245 | * when a processInstanceId is null. |
||
246 | * @throws NotFoundException |
||
247 | * when no process instance is found with a given processInstanceId. |
||
248 | * @throws AuthorizationException |
||
249 | * if the user has no Permissions#DELETE permission on Resources#PROCESS_INSTANCE |
||
250 | * or no Permissions#DELETE_INSTANCE permission on Resources#PROCESS_DEFINITION. |
||
251 | */ |
||
252 | public function deleteProcessInstances( |
||
253 | array $processInstanceIds, |
||
254 | string $deleteReason = null, |
||
255 | bool $skipCustomListeners = false, |
||
256 | bool $externallyTerminated = false, |
||
257 | bool $skipSubprocesses = false |
||
258 | ): void; |
||
259 | |||
260 | /** |
||
261 | * Delete existing runtime process instances. |
||
262 | * |
||
263 | * Deletion propagates upward as far as necessary. |
||
264 | * |
||
265 | * Does not fail if a process instance was not found. |
||
266 | * |
||
267 | * @param processInstanceIds ids of process instance to delete, cannot be null. |
||
268 | * @param deleteReason reason for deleting, which will be stored in the history. Can be null. |
||
269 | * @param skipCustomListeners if true, only the built-in ExecutionListeners |
||
270 | * are notified with the ExecutionListener#EVENTNAME_END event. |
||
271 | * @param externallyTerminated indicator if deletion triggered from external context, for instance |
||
272 | * REST API call |
||
273 | * @param skipSubprocesses specifies whether subprocesses should be deleted |
||
274 | * |
||
275 | * |
||
276 | * @throws BadUserRequestException |
||
277 | * when a processInstanceId is null. |
||
278 | * @throws AuthorizationException |
||
279 | * if the user has no Permissions#DELETE permission on Resources#PROCESS_INSTANCE |
||
280 | * or no Permissions#DELETE_INSTANCE permission on Resources#PROCESS_DEFINITION. |
||
281 | */ |
||
282 | public function deleteProcessInstancesIfExists(array $processInstanceIds, string $deleteReason = null, bool $skipCustomListeners = false, bool $externallyTerminated = false, bool $skipSubprocesses = false): void; |
||
283 | |||
284 | /** |
||
285 | * Delete an existing runtime process instance. |
||
286 | * |
||
287 | * Deletion propagates upward as far as necessary. |
||
288 | * |
||
289 | * Does not fail if a process instance was not found. |
||
290 | * |
||
291 | * @param processInstanceId id of process instance to delete, cannot be null. |
||
292 | * @param deleteReason reason for deleting, which will be stored in the history. Can be null. |
||
293 | * @param skipCustomListeners if true, only the built-in ExecutionListeners |
||
294 | * are notified with the ExecutionListener#EVENTNAME_END event. |
||
295 | * @param externallyTerminated indicator if deletion triggered from external context, for instance |
||
296 | * REST API call |
||
297 | * @param skipIoMappings specifies whether input/output mappings for tasks should be invoked |
||
298 | * @param skipSubprocesses specifies whether subprocesses should be deleted |
||
299 | * |
||
300 | * |
||
301 | * @throws BadUserRequestException |
||
302 | * when processInstanceId is null. |
||
303 | * @throws AuthorizationException |
||
304 | * if the user has no Permissions#DELETE permission on Resources#PROCESS_INSTANCE |
||
305 | * or no Permissions#DELETE_INSTANCE permission on Resources#PROCESS_DEFINITION. |
||
306 | */ |
||
307 | public function deleteProcessInstanceIfExists(string $processInstanceId, string $deleteReason = null, bool $skipCustomListeners = false, bool $externallyTerminated = false, bool $skipIoMappings = false, bool $skipSubprocesses = false): void; |
||
308 | |||
309 | /** |
||
310 | * Finds the activity ids for all executions that are waiting in activities. |
||
311 | * This is a list because a single activity can be active multiple times. |
||
312 | * |
||
313 | * Deletion propagates upward as far as necessary. |
||
314 | * |
||
315 | * @param executionId id of the process instance or the execution, cannot be null. |
||
316 | * |
||
317 | * @throws ProcessEngineException |
||
318 | * when no execution exists with the given executionId. |
||
319 | * @throws AuthorizationException |
||
320 | * if the user has no Permissions#READ permission on Resources#PROCESS_INSTANCE |
||
321 | * or no Permissions#READ_INSTANCE permission on Resources#PROCESS_DEFINITION. |
||
322 | */ |
||
323 | public function getActiveActivityIds(string $executionId): array; |
||
324 | |||
325 | /** |
||
326 | * <p>Allows retrieving the activity instance tree for a given process instance. |
||
327 | * The activity instance tree is aligned with the concept of scope in the BPMN specification. |
||
328 | * Activities that are "on the same level of subprocess" (ie. part of the same scope, contained |
||
329 | * in the same subprocess) will have their activity instances at the same level in the tree.</p> |
||
330 | * |
||
331 | * <h2>Examples:</h2> |
||
332 | * <p><ul> |
||
333 | * <li>Process with two parallel user tasks after parallel Gateway: in the activity instance tree you |
||
334 | * will see two activity instances below the root instance, one for each user task.</li> |
||
335 | * <li>Process with two parallel Multi Instance user tasks after parallel Gateway: in the activity instance |
||
336 | * tree, all instances of both user tasks will be listed below the root activity instance. Reason: all |
||
337 | * activity instances are at the same level of subprocess.</li> |
||
338 | * <li>Usertask inside embedded subprocess: the activity instance three will have 3 levels: the root instance |
||
339 | * representing the process instance itself, below it an activity instance representing the instance of the embedded |
||
340 | * subprocess, and below this one, the activity instance representing the usertask.</li> |
||
341 | * </ul></p> |
||
342 | * |
||
343 | * <h2>Identity & Uniqueness:</h2> |
||
344 | * <p>Each activity instance is assigned a unique Id. The id is persistent, if you invoke this method multiple times, |
||
345 | * the same activity instance ids will be returned for the same activity instances. (However, there might be |
||
346 | * different executions assigned, see below)</p> |
||
347 | * |
||
348 | * <h2>Relation to Executions</h2> |
||
349 | * <p>The Execution concept in the process engine is not completely aligned with the activity |
||
350 | * instance concept because the execution tree is in general not aligned with the activity / scope concept in |
||
351 | * BPMN. In general, there is a n-1 relationship between Executions and ActivityInstances, ie. at a given |
||
352 | * point in time, an activity instance can be linked to multiple executions. In addition, it is not guaranteed |
||
353 | * that the same execution that started a given activity instance will also end it. The process engine performs |
||
354 | * several internal optimizations concerning the compacting of the execution tree which might lead to executions |
||
355 | * being reordered and pruned. This can lead to situations where a given execution starts an activity instance |
||
356 | * but another execution ends it. Another special case is the process instance: if the process instance is executing |
||
357 | * a non-scope activity (for example a user task) below the process definition scope, it will be referenced |
||
358 | * by both the root activity instance and the user task activity instance. |
||
359 | * |
||
360 | * <p><strong>If you need to interpret the state of a process instance in terms of a BPMN process model, it is usually easier to |
||
361 | * use the activity instance tree as opposed to the execution tree.</strong></p> |
||
362 | * |
||
363 | * @param processInstanceId the id of the process instance for which the activity instance tree should be constructed. |
||
364 | * |
||
365 | * @return ActivityInstanceInterface the activity instance tree for a given process instance or null if no such process instance exists. |
||
366 | * |
||
367 | * @throws ProcessEngineException |
||
368 | * if processInstanceId is 'null' or an internal error occurs. |
||
369 | * @throws AuthorizationException |
||
370 | * if the user has no Permissions#READ permission on Resources#PROCESS_INSTANCE |
||
371 | * or no Permissions#READ_INSTANCE permission on Resources#PROCESS_DEFINITION. |
||
372 | * |
||
373 | * @since 7.0 |
||
374 | */ |
||
375 | public function getActivityInstance(string $processInstanceId): ActivityInstanceInterface; |
||
376 | |||
377 | /** |
||
378 | * Sends an external trigger to an activity instance that is waiting inside the given execution. |
||
379 | * |
||
380 | * Note that you need to provide the exact execution that is waiting for the signal |
||
381 | * if the process instance contains multiple executions. |
||
382 | * |
||
383 | * @param executionId id of process instance or execution to signal, cannot be null. |
||
384 | * @param signalName name of the signal (can be null) |
||
385 | * @param signalData additional data of the signal (can be null) |
||
386 | * @param processVariables a map of process variables (can be null) |
||
387 | * |
||
388 | * @throws ProcessEngineException |
||
389 | * when no execution is found for the given executionId. |
||
390 | * @throws AuthorizationException |
||
391 | * if the user has no Permissions#UPDATE permission on Resources#PROCESS_INSTANCE |
||
392 | * or no Permissions#UPDATE_INSTANCE permission on Resources#PROCESS_DEFINITION. |
||
393 | */ |
||
394 | public function signal(string $executionId, string $signalName = null, $signalData = null, array $processVariables = []): void; |
||
395 | |||
396 | /** |
||
397 | * The variable values for all given variableNames, takes all variables into account which are visible from the given execution scope (including parent scopes). |
||
398 | * |
||
399 | * @param executionId id of process instance or execution, cannot be null. |
||
400 | * @param variableNames the collection of variable names that should be retrieved. |
||
401 | * |
||
402 | * @return array the variables or an empty map if no such variables are found. |
||
403 | * |
||
404 | * @throws ProcessEngineException |
||
405 | * when no execution is found for the given executionId. |
||
406 | * @throws AuthorizationException |
||
407 | * <li>if the user has no Permissions#READ permission on Resources#PROCESS_INSTANCE or |
||
408 | * no Permissions#READ_INSTANCE permission on Resources#PROCESS_DEFINITION</li> |
||
409 | * <li> In case {@link ProcessEngineConfiguration#enforceSpecificVariablePermission this} config is enabled and |
||
410 | * the user has no ProcessDefinitionPermisions#READ_INSTANCE_VARIABLE permission on Resources#PROCESS_DEFINITION</li> |
||
411 | */ |
||
412 | public function getVariables(string $executionId, array $variableNames = []): array; |
||
413 | |||
414 | /** |
||
415 | * The variable values for all given variableNames, takes all variables into account which are visible from the given execution scope (including parent scopes). |
||
416 | * @param executionId id of process instance or execution, cannot be null. |
||
417 | * @param variableNames the collection of variable names that should be retrieved. |
||
418 | * @param deserializeObjectValues if false, SerializableValues will not be deserialized |
||
419 | * |
||
420 | * @return VariableMapInterface the variables or an empty map if no such variables are found. |
||
421 | * |
||
422 | * @throws ProcessEngineException |
||
423 | * when no execution is found for the given executionId. |
||
424 | * @throws AuthorizationException |
||
425 | * <li>if the user has no Permissions#READ permission on Resources#PROCESS_INSTANCE or |
||
426 | * no Permissions#READ_INSTANCE permission on Resources#PROCESS_DEFINITION</li> |
||
427 | * <li> In case {@link ProcessEngineConfiguration#enforceSpecificVariablePermission this} config is enabled and |
||
428 | * the user has no ProcessDefinitionPermisions#READ_INSTANCE_VARIABLE permission on Resources#PROCESS_DEFINITION</li> |
||
429 | * |
||
430 | * @since 7.2 |
||
431 | * |
||
432 | */ |
||
433 | public function getVariablesTyped(string $executionId, array $variableNames = [], bool $deserializeValues = true): VariableMapInterface; |
||
434 | |||
435 | /** |
||
436 | * The variable values for the given variableNames only taking the given execution scope into account, not looking in outer scopes. |
||
437 | * |
||
438 | * @param executionId id of execution, cannot be null. |
||
439 | * @param variableNames the collection of variable names that should be retrieved. |
||
440 | * |
||
441 | * @return array the variables or an empty map if no such variables are found. |
||
442 | * |
||
443 | * @throws ProcessEngineException |
||
444 | * when no execution is found for the given executionId. |
||
445 | * @throws AuthorizationException |
||
446 | * <li>if the user has no Permissions#READ permission on Resources#PROCESS_INSTANCE or |
||
447 | * no Permissions#READ_INSTANCE permission on Resources#PROCESS_DEFINITION</li> |
||
448 | * <li> In case {@link ProcessEngineConfiguration#enforceSpecificVariablePermission this} config is enabled and |
||
449 | * the user has no ProcessDefinitionPermisions#READ_INSTANCE_VARIABLE permission on Resources#PROCESS_DEFINITION</li> |
||
450 | */ |
||
451 | public function getVariablesLocal(string $executionId, array $variableNames = []): array; |
||
452 | |||
453 | /** |
||
454 | * The variable values for the given variableNames only taking the given execution scope into account, not looking in outer scopes. |
||
455 | * @param executionId id of execution, cannot be null. |
||
456 | * @param variableNames the collection of variable names that should be retrieved. |
||
457 | * @param deserializeObjectValues if false, SerializableValues will not be deserialized |
||
458 | * |
||
459 | * @return VariableMapInterface the variables or an empty map if no such variables are found. |
||
460 | * |
||
461 | * @throws ProcessEngineException |
||
462 | * when no execution is found for the given executionId. |
||
463 | * @throws AuthorizationException |
||
464 | * <li>if the user has no Permissions#READ permission on Resources#PROCESS_INSTANCE or |
||
465 | * no Permissions#READ_INSTANCE permission on Resources#PROCESS_DEFINITION</li> |
||
466 | * <li> In case {@link ProcessEngineConfiguration#enforceSpecificVariablePermission this} config is enabled and |
||
467 | * the user has no ProcessDefinitionPermisions#READ_INSTANCE_VARIABLE permission on Resources#PROCESS_DEFINITION</li> |
||
468 | * |
||
469 | * @since 7.2 |
||
470 | * |
||
471 | */ |
||
472 | public function getVariablesLocalTyped(string $executionId, array $variableNames = [], bool $deserializeValues = true): VariableMapInterface; |
||
473 | |||
474 | /** |
||
475 | * The variable value. Searching for the variable is done in all scopes that are visible to the given execution (including parent scopes). |
||
476 | * Returns null when no variable value is found with the given name or when the value is set to null. |
||
477 | * |
||
478 | * @param executionId id of process instance or execution, cannot be null. |
||
479 | * @param variableName name of variable, cannot be null. |
||
480 | * |
||
481 | * @return mixed the variable value or null if the variable is undefined or the value of the variable is null. |
||
482 | * |
||
483 | * @throws ProcessEngineException |
||
484 | * when no execution is found for the given executionId. |
||
485 | * @throws AuthorizationException |
||
486 | * <li>if the user has no Permissions#READ permission on Resources#PROCESS_INSTANCE or |
||
487 | * no Permissions#READ_INSTANCE permission on Resources#PROCESS_DEFINITION</li> |
||
488 | * <li> In case {@link ProcessEngineConfiguration#enforceSpecificVariablePermission this} config is enabled and |
||
489 | * the user has no ProcessDefinitionPermisions#READ_INSTANCE_VARIABLE permission on Resources#PROCESS_DEFINITION</li> |
||
490 | */ |
||
491 | public function getVariable(string $executionId, string $variableName); |
||
492 | |||
493 | /** |
||
494 | * Returns a TypedValue for the variable. Searching for the variable is done in all scopes that are visible |
||
495 | * to the given execution (including parent scopes). Returns null when no variable value is found with the given name. |
||
496 | * |
||
497 | * @param executionId id of process instance or execution, cannot be null. |
||
498 | * @param variableName name of variable, cannot be null. |
||
499 | * @param deserializeValue if false, a SerializableValue will not be deserialized |
||
500 | * |
||
501 | * @return TypedValueInterface the variable value or null if the variable is undefined. |
||
502 | * |
||
503 | * @throws ProcessEngineException |
||
504 | * when no execution is found for the given executionId. |
||
505 | * @throws AuthorizationException |
||
506 | * <li>if the user has no Permissions#READ permission on Resources#PROCESS_INSTANCE or |
||
507 | * no Permissions#READ_INSTANCE permission on Resources#PROCESS_DEFINITION</li> |
||
508 | * <li> In case {@link ProcessEngineConfiguration#enforceSpecificVariablePermission this} config is enabled and |
||
509 | * the user has no ProcessDefinitionPermisions#READ_INSTANCE_VARIABLE permission on Resources#PROCESS_DEFINITION</li> |
||
510 | * |
||
511 | * @since 7.2 |
||
512 | * |
||
513 | */ |
||
514 | public function getVariableTyped(string $executionId, string $variableName, bool $deserializeValue = true): ?TypedValueInterface; |
||
515 | |||
516 | /** |
||
517 | * The variable value for an execution. Returns the value when the variable is set |
||
518 | * for the execution (and not searching parent scopes). Returns null when no variable value is found with the given name or when the value is set to null. |
||
519 | * |
||
520 | * @param executionId id of process instance or execution, cannot be null. |
||
521 | * @param variableName name of variable, cannot be null. |
||
522 | * |
||
523 | * @return mixed variable value or null if the variable is undefined or the value of the variable is null. |
||
524 | * |
||
525 | * @throws ProcessEngineException |
||
526 | * when no execution is found for the given executionId. |
||
527 | * @throws AuthorizationException |
||
528 | * <li>if the user has no Permissions#READ permission on Resources#PROCESS_INSTANCE or |
||
529 | * no Permissions#READ_INSTANCE permission on Resources#PROCESS_DEFINITION</li> |
||
530 | * <li> In case {@link ProcessEngineConfiguration#enforceSpecificVariablePermission this} config is enabled and |
||
531 | * the user has no ProcessDefinitionPermisions#READ_INSTANCE_VARIABLE permission on Resources#PROCESS_DEFINITION</li> |
||
532 | */ |
||
533 | public function getVariableLocal(string $executionId, string $variableName); |
||
534 | |||
535 | /** |
||
536 | * Returns a TypedValue for the variable. Searching for the variable is done in all scopes that are visible |
||
537 | * to the given execution (and not searching parent scopes). Returns null when no variable value is found with the given name. |
||
538 | * |
||
539 | * @param executionId id of process instance or execution, cannot be null. |
||
540 | * @param variableName name of variable, cannot be null. |
||
541 | * @param deserializeValue if false, a SerializableValue will not be deserialized |
||
542 | * |
||
543 | * @return TypedValueInterface the variable value or null if the variable is undefined. |
||
544 | * |
||
545 | * @throws ProcessEngineException |
||
546 | * when no execution is found for the given executionId. |
||
547 | * @throws AuthorizationException |
||
548 | * <li>if the user has no Permissions#READ permission on Resources#PROCESS_INSTANCE or |
||
549 | * no Permissions#READ_INSTANCE permission on Resources#PROCESS_DEFINITION</li> |
||
550 | * <li> In case {@link ProcessEngineConfiguration#enforceSpecificVariablePermission this} config is enabled and |
||
551 | * the user has no ProcessDefinitionPermisions#READ_INSTANCE_VARIABLE permission on Resources#PROCESS_DEFINITION</li> |
||
552 | * |
||
553 | * @since 7.2 |
||
554 | * |
||
555 | */ |
||
556 | public function getVariableLocalTyped(string $executionId, string $variableName, bool $deserializeValue = true): ?TypedValueInterface; |
||
557 | |||
558 | /** |
||
559 | * Update or create a variable for an execution. If the variable does not already exist |
||
560 | * somewhere in the execution hierarchy (i.e. the specified execution or any ancestor), |
||
561 | * it will be created in the process instance (which is the root execution). |
||
562 | * |
||
563 | * @param executionId id of process instance or execution to set variable in, cannot be null. |
||
564 | * @param variableName name of variable to set, cannot be null. |
||
565 | * @param value value to set. When null is passed, the variable is not removed, |
||
566 | * only it's value will be set to null. |
||
567 | * |
||
568 | * @throws ProcessEngineException |
||
569 | * when no execution is found for the given executionId. |
||
570 | * @throws AuthorizationException |
||
571 | * if the user has none of the following: |
||
572 | * <li>ProcessInstancePermissions#UPDATE_VARIABLE permission on Resources#PROCESS_INSTANCE</li> |
||
573 | * <li>ProcessDefinitionPermissions#UPDATE_INSTANCE_VARIABLE permission on Resources#PROCESS_DEFINITION</li> |
||
574 | * <li>Permissions#UPDATE permission on Resources#PROCESS_INSTANCE</li> |
||
575 | * <li>Permissions#UPDATE_INSTANCE permission on Resources#PROCESS_DEFINITION</li> |
||
576 | */ |
||
577 | public function setVariable(string $executionId, string $variableName, $value): void; |
||
578 | |||
579 | /** |
||
580 | * Update or create a variable for an execution (not considering parent scopes). |
||
581 | * If the variable does not already exist, it will be created in the given execution. |
||
582 | * |
||
583 | * @param executionId id of execution to set variable in, cannot be null. |
||
584 | * @param variableName name of variable to set, cannot be null. |
||
585 | * @param value value to set. When null is passed, the variable is not removed, |
||
586 | * only it's value will be set to null. |
||
587 | * |
||
588 | * @throws ProcessEngineException |
||
589 | * when no execution is found for the given executionId. |
||
590 | * @throws AuthorizationException |
||
591 | * if the user has none of the following: |
||
592 | * <li>ProcessInstancePermissions#UPDATE_VARIABLE permission on Resources#PROCESS_INSTANCE</li> |
||
593 | * <li>ProcessDefinitionPermissions#UPDATE_INSTANCE_VARIABLE permission on Resources#PROCESS_DEFINITION</li> |
||
594 | * <li>Permissions#UPDATE permission on Resources#PROCESS_INSTANCE</li> |
||
595 | * <li>Permissions#UPDATE_INSTANCE permission on Resources#PROCESS_DEFINITION</li> |
||
596 | */ |
||
597 | public function setVariableLocal(string $executionId, string $variableName, $value): void; |
||
598 | |||
599 | /** |
||
600 | * Update or create given variables for an execution (including parent scopes). If the variables are not already existing, they will be created in the process instance |
||
601 | * (which is the root execution). |
||
602 | * |
||
603 | * @param executionId id of the process instance or the execution, cannot be null. |
||
604 | * @param variables map containing name (key) and value of variables, can be null. |
||
605 | * |
||
606 | * @throws ProcessEngineException |
||
607 | * when no execution is found for the given executionId. |
||
608 | * @throws AuthorizationException |
||
609 | * if the user has none of the following: |
||
610 | * <li>ProcessInstancePermissions#UPDATE_VARIABLE permission on Resources#PROCESS_INSTANCE</li> |
||
611 | * <li>ProcessDefinitionPermissions#UPDATE_INSTANCE_VARIABLE permission on Resources#PROCESS_DEFINITION</li> |
||
612 | * <li>Permissions#UPDATE permission on Resources#PROCESS_INSTANCE</li> |
||
613 | * <li>Permissions#UPDATE_INSTANCE permission on Resources#PROCESS_DEFINITION</li> |
||
614 | */ |
||
615 | public function setVariables(string $executionId, array $variables = []): void; |
||
616 | |||
617 | /** |
||
618 | * Update or create given variables for an execution (not considering parent scopes). If the variables are not already existing, it will be created in the given execution. |
||
619 | * |
||
620 | * @param executionId id of the execution, cannot be null. |
||
621 | * @param variables map containing name (key) and value of variables, can be null. |
||
622 | * |
||
623 | * @throws ProcessEngineException |
||
624 | * when no execution is found for the given executionId. |
||
625 | * @throws AuthorizationException |
||
626 | * if the user has none of the following: |
||
627 | * <li>ProcessInstancePermissions#UPDATE_VARIABLE permission on Resources#PROCESS_INSTANCE</li> |
||
628 | * <li>ProcessDefinitionPermissions#UPDATE_INSTANCE_VARIABLE permission on Resources#PROCESS_DEFINITION</li> |
||
629 | * <li>Permissions#UPDATE permission on Resources#PROCESS_INSTANCE</li> |
||
630 | * <li>Permissions#UPDATE_INSTANCE permission on Resources#PROCESS_DEFINITION</li> |
||
631 | */ |
||
632 | public function setVariablesLocal(string $executionId, array $variables = []): void; |
||
633 | |||
634 | /** |
||
635 | * Update or create runtime process variables in the root scope of process instances. |
||
636 | * |
||
637 | * @param processInstanceIds related to the process instances the variables will be set on; cannot |
||
638 | * be {@code null} when processInstanceQuery and |
||
639 | * historicProcessInstanceQuery are {@code null}. |
||
640 | * @param processInstanceQuery to select process instances; Cannot be {@code null} when |
||
641 | * processInstanceIds and historicProcessInstanceQuery |
||
642 | * are {@code null}. |
||
643 | * @param historicProcessInstanceQuery to select process instances; Cannot be {@code null} when |
||
644 | * processInstanceIds and processInstanceQuery |
||
645 | * are {@code null}. |
||
646 | * @param variables that will be set to the root scope of the process instances |
||
647 | * |
||
648 | * @throws NullValueException <ul> |
||
649 | * <li>when {@code variables} is {@code null}</li> |
||
650 | * <li>when {@code processInstanceIds}, {@code processInstanceQuery} and |
||
651 | * {@code historicProcessInstanceQuery} are {@code null}</li> |
||
652 | * </ul> |
||
653 | * @throws BadUserRequestException <ul> |
||
654 | * <li>when {@code variables} is empty</li> |
||
655 | * <li>when no process instance ids were found</li> |
||
656 | * <li>when a transient variable is set</li> |
||
657 | * </ul> |
||
658 | * @throws ProcessEngineException when the java serialization format is prohibited |
||
659 | * @throws AuthorizationException when the user has no BatchPermissions#CREATE or |
||
660 | * BatchPermissions#CREATE_BATCH_SET_VARIABLES permission on Resources#BATCH. |
||
661 | * |
||
662 | * @return BatchInterface the batch which sets the variables asynchronously. |
||
663 | */ |
||
664 | public function setVariablesAsync( |
||
665 | array $processInstanceIds, |
||
666 | ProcessInstanceQueryInterface $processInstanceQuery = null, |
||
667 | HistoricProcessInstanceQuery $historicProcessInstanceQuery = null, |
||
668 | array $variables = [] |
||
669 | ): BatchInterface; |
||
670 | |||
671 | /** |
||
672 | * Removes a variable for an execution. |
||
673 | * |
||
674 | * @param executionId id of process instance or execution to remove variable in. |
||
675 | * @param variableName name of variable to remove. |
||
676 | * |
||
677 | * @throws ProcessEngineException |
||
678 | * when no execution is found for the given executionId. |
||
679 | * @throws AuthorizationException |
||
680 | * if the user has none of the following: |
||
681 | * <li>ProcessInstancePermissions#UPDATE_VARIABLE permission on Resources#PROCESS_INSTANCE</li> |
||
682 | * <li>ProcessDefinitionPermissions#UPDATE_INSTANCE_VARIABLE permission on Resources#PROCESS_DEFINITION</li> |
||
683 | * <li>Permissions#UPDATE permission on Resources#PROCESS_INSTANCE</li> |
||
684 | * <li>Permissions#UPDATE_INSTANCE permission on Resources#PROCESS_DEFINITION</li> |
||
685 | */ |
||
686 | public function removeVariable(string $executionId, string $variableName): void; |
||
687 | |||
688 | /** |
||
689 | * Removes a variable for an execution (not considering parent scopes). |
||
690 | * |
||
691 | * @param executionId id of execution to remove variable in. |
||
692 | * @param variableName name of variable to remove. |
||
693 | * |
||
694 | * @throws ProcessEngineException |
||
695 | * when no execution is found for the given executionId. |
||
696 | * @throws AuthorizationException |
||
697 | * if the user has none of the following: |
||
698 | * <li>ProcessInstancePermissions#UPDATE_VARIABLE permission on Resources#PROCESS_INSTANCE</li> |
||
699 | * <li>ProcessDefinitionPermissions#UPDATE_INSTANCE_VARIABLE permission on Resources#PROCESS_DEFINITION</li> |
||
700 | * <li>Permissions#UPDATE permission on Resources#PROCESS_INSTANCE</li> |
||
701 | * <li>Permissions#UPDATE_INSTANCE permission on Resources#PROCESS_DEFINITION</li> |
||
702 | */ |
||
703 | public function removeVariableLocal(string $executionId, string $variableName): void; |
||
704 | |||
705 | /** |
||
706 | * Removes variables for an execution. |
||
707 | * |
||
708 | * @param executionId id of process instance or execution to remove variable in. |
||
709 | * @param variableNames collection containing name of variables to remove. |
||
710 | * |
||
711 | * @throws ProcessEngineException |
||
712 | * when no execution is found for the given executionId. |
||
713 | * @throws AuthorizationException |
||
714 | * if the user has none of the following: |
||
715 | * <li>ProcessInstancePermissions#UPDATE_VARIABLE permission on Resources#PROCESS_INSTANCE</li> |
||
716 | * <li>ProcessDefinitionPermissions#UPDATE_INSTANCE_VARIABLE permission on Resources#PROCESS_DEFINITION</li> |
||
717 | * <li>Permissions#UPDATE permission on Resources#PROCESS_INSTANCE</li> |
||
718 | * <li>Permissions#UPDATE_INSTANCE permission on Resources#PROCESS_DEFINITION</li> |
||
719 | */ |
||
720 | public function removeVariables(string $executionId, array $variableNames = []): void; |
||
721 | |||
722 | /** |
||
723 | * Remove variables for an execution (not considering parent scopes). |
||
724 | * |
||
725 | * @param executionId id of execution to remove variable in. |
||
726 | * @param variableNames collection containing name of variables to remove. |
||
727 | * |
||
728 | * @throws ProcessEngineException |
||
729 | * when no execution is found for the given executionId. |
||
730 | * @throws AuthorizationException |
||
731 | * if the user has none of the following: |
||
732 | * <li>ProcessInstancePermissions#UPDATE_VARIABLE permission on Resources#PROCESS_INSTANCE</li> |
||
733 | * <li>ProcessDefinitionPermissions#UPDATE_INSTANCE_VARIABLE permission on Resources#PROCESS_DEFINITION</li> |
||
734 | * <li>Permissions#UPDATE permission on Resources#PROCESS_INSTANCE</li> |
||
735 | * <li>Permissions#UPDATE_INSTANCE permission on Resources#PROCESS_DEFINITION</li> |
||
736 | */ |
||
737 | public function removeVariablesLocal(string $executionId, array $variableNames = []): void; |
||
738 | |||
739 | // Queries //////////////////////////////////////////////////////// |
||
740 | |||
741 | /** Creates a new ExecutionQuery instance, |
||
742 | * that can be used to query the executions and process instances. */ |
||
743 | public function createExecutionQuery(): ExecutionQueryInterface; |
||
744 | |||
745 | /** |
||
746 | * creates a new NativeExecutionQuery to query Executions |
||
747 | * by SQL directly |
||
748 | */ |
||
749 | public function createNativeExecutionQuery(): NativeExecutionQueryInterface; |
||
750 | |||
751 | /** |
||
752 | * Creates a new ProcessInstanceQuery instance, that can be used |
||
753 | * to query process instances. |
||
754 | */ |
||
755 | public function createProcessInstanceQuery(): ProcessInstanceQueryInterface; |
||
756 | |||
757 | /** |
||
758 | * creates a new NativeProcessInstanceQuery to query ProcessInstances |
||
759 | * by SQL directly |
||
760 | */ |
||
761 | public function createNativeProcessInstanceQuery(): NativeProcessInstanceQueryInterface; |
||
762 | |||
763 | /** |
||
764 | * Creates a new IncidentQuery instance, that can be used |
||
765 | * to query incidents. |
||
766 | */ |
||
767 | public function createIncidentQuery(): IncidentQueryInterface; |
||
768 | |||
769 | /** |
||
770 | * Creates a new EventSubscriptionQuery instance, that can be used to query |
||
771 | * event subscriptions. |
||
772 | */ |
||
773 | public function createEventSubscriptionQuery(): EventSubscriptionQueryInterface; |
||
774 | |||
775 | /** |
||
776 | * Creates a new VariableInstanceQuery instance, that can be used to query |
||
777 | * variable instances. |
||
778 | */ |
||
779 | public function createVariableInstanceQuery(): VariableInstanceQueryInterface; |
||
780 | |||
781 | // Process instance state ////////////////////////////////////////// |
||
782 | |||
783 | /** |
||
784 | * <p>Suspends the process instance with the given id. This means that the |
||
785 | * execution is stopped, so the <i>token state</i> will not change. |
||
786 | * However, actions that do not change token state, like setting/removing |
||
787 | * variables, etc. will succeed.</p> |
||
788 | * |
||
789 | * <p>Tasks belonging to this process instance will also be suspended. This means |
||
790 | * that any actions influencing the tasks' lifecycles will fail, such as |
||
791 | * <ul> |
||
792 | * <li>claiming</li> |
||
793 | * <li>completing</li> |
||
794 | * <li>delegation</li> |
||
795 | * <li>changes in task assignees, owners, etc.</li> |
||
796 | * </ul> |
||
797 | * Actions that only change task properties will succeed, such as changing variables |
||
798 | * or adding comments. |
||
799 | * </p> |
||
800 | * |
||
801 | * <p>If a process instance is in state suspended, the engine will also not |
||
802 | * execute jobs (timers, messages) associated with this instance.</p> |
||
803 | * |
||
804 | * <p>If you have a process instance hierarchy, suspending |
||
805 | * one process instance from the hierarchy will not suspend other |
||
806 | * process instances from that hierarchy.</p> |
||
807 | * |
||
808 | * <p>Note: for more complex suspend commands use {@link #updateProcessInstanceSuspensionState()}.</p> |
||
809 | * |
||
810 | * @throws ProcessEngineException |
||
811 | * if no such processInstance can be found. |
||
812 | * @throws AuthorizationException |
||
813 | * if the user has none of the following: |
||
814 | * <li>ProcessInstancePermissions#SUSPEND permission on Resources#PROCESS_INSTANCE</li> |
||
815 | * <li>ProcessDefinitionPermissions#SUSPEND_INSTANCE permission on Resources#PROCESS_DEFINITION</li> |
||
816 | * <li>Permissions#UPDATE permission on Resources#PROCESS_INSTANCE</li> |
||
817 | * <li>Permissions#UPDATE_INSTANCE permission on Resources#PROCESS_DEFINITION</li> |
||
818 | */ |
||
819 | public function suspendProcessInstanceById(string $processInstanceId): void; |
||
820 | |||
821 | /** |
||
822 | * <p>Suspends the process instances with the given process definition id. |
||
823 | * This means that the execution is stopped, so the <i>token state</i> |
||
824 | * will not change. However, actions that do not change token state, like |
||
825 | * setting/removing variables, etc. will succeed.</p> |
||
826 | * |
||
827 | * <p>Tasks belonging to the suspended process instance will also be suspended. |
||
828 | * This means that any actions influencing the tasks' lifecycles will fail, such as |
||
829 | * <ul> |
||
830 | * <li>claiming</li> |
||
831 | * <li>completing</li> |
||
832 | * <li>delegation</li> |
||
833 | * <li>changes in task assignees, owners, etc.</li> |
||
834 | * </ul> |
||
835 | * Actions that only change task properties will succeed, such as changing variables |
||
836 | * or adding comments. |
||
837 | * </p> |
||
838 | * |
||
839 | * <p>If a process instance is in state suspended, the engine will also not |
||
840 | * execute jobs (timers, messages) associated with this instance.</p> |
||
841 | * |
||
842 | * <p>If you have a process instance hierarchy, suspending |
||
843 | * one process instance from the hierarchy will not suspend other |
||
844 | * process instances from that hierarchy.</p> |
||
845 | * |
||
846 | * <p>Note: for more complex suspend commands use {@link #updateProcessInstanceSuspensionState()}.</p> |
||
847 | * |
||
848 | * @throws ProcessEngineException |
||
849 | * if no such processInstance can be found. |
||
850 | * @throws AuthorizationException |
||
851 | * if the user has none of the following: |
||
852 | * <li>ProcessInstancePermissions#SUSPEND permission on Resources#PROCESS_INSTANCE</li> |
||
853 | * <li>ProcessDefinitionPermissions#SUSPEND_INSTANCE permission on Resources#PROCESS_DEFINITION</li> |
||
854 | * <li>Permissions#UPDATE permission on Resources#PROCESS_INSTANCE</li> |
||
855 | * <li>Permissions#UPDATE_INSTANCE permission on Resources#PROCESS_DEFINITION</li> |
||
856 | */ |
||
857 | public function suspendProcessInstanceByProcessDefinitionId(string $processDefinitionId): void; |
||
858 | |||
859 | /** |
||
860 | * <p>Suspends the process instances with the given process definition key. |
||
861 | * This means that the execution is stopped, so the <i>token state</i> |
||
862 | * will not change. However, actions that do not change token state, like |
||
863 | * setting/removing variables, etc. will succeed.</p> |
||
864 | * |
||
865 | * <p>Tasks belonging to the suspended process instance will also be suspended. |
||
866 | * This means that any actions influencing the tasks' lifecycles will fail, such as |
||
867 | * <ul> |
||
868 | * <li>claiming</li> |
||
869 | * <li>completing</li> |
||
870 | * <li>delegation</li> |
||
871 | * <li>changes in task assignees, owners, etc.</li> |
||
872 | * </ul> |
||
873 | * Actions that only change task properties will succeed, such as changing variables |
||
874 | * or adding comments. |
||
875 | * </p> |
||
876 | * |
||
877 | * <p>If a process instance is in state suspended, the engine will also not |
||
878 | * execute jobs (timers, messages) associated with this instance.</p> |
||
879 | * |
||
880 | * <p>If you have a process instance hierarchy, suspending |
||
881 | * one process instance from the hierarchy will not suspend other |
||
882 | * process instances from that hierarchy.</p> |
||
883 | * |
||
884 | * <p>Note: for more complex suspend commands use {@link #updateProcessInstanceSuspensionState()}.</p> |
||
885 | * |
||
886 | * @throws ProcessEngineException |
||
887 | * if no such processInstance can be found. |
||
888 | * @throws AuthorizationException |
||
889 | * if the user has none of the following: |
||
890 | * <li>ProcessInstancePermissions#SUSPEND permission on Resources#PROCESS_INSTANCE</li> |
||
891 | * <li>ProcessDefinitionPermissions#SUSPEND_INSTANCE permission on Resources#PROCESS_DEFINITION</li> |
||
892 | * <li>Permissions#UPDATE permission on Resources#PROCESS_INSTANCE</li> |
||
893 | * <li>Permissions#UPDATE_INSTANCE permission on Resources#PROCESS_DEFINITION</li> |
||
894 | */ |
||
895 | public function suspendProcessInstanceByProcessDefinitionKey(string $processDefinitionKey): void; |
||
896 | |||
897 | /** |
||
898 | * <p>Activates the process instance with the given id.</p> |
||
899 | * |
||
900 | * <p>If you have a process instance hierarchy, activating |
||
901 | * one process instance from the hierarchy will not activate other |
||
902 | * process instances from that hierarchy.</p> |
||
903 | * |
||
904 | * <p>Note: for more complex activate commands use {@link #updateProcessInstanceSuspensionState()}.</p> |
||
905 | * |
||
906 | * @throws ProcessEngineException |
||
907 | * if no such processInstance can be found. |
||
908 | * @throws AuthorizationException |
||
909 | * if the user has none of the following: |
||
910 | * <li>ProcessInstancePermissions#SUSPEND permission on Resources#PROCESS_INSTANCE</li> |
||
911 | * <li>ProcessDefinitionPermissions#SUSPEND_INSTANCE permission on Resources#PROCESS_DEFINITION</li> |
||
912 | * <li>Permissions#UPDATE permission on Resources#PROCESS_INSTANCE</li> |
||
913 | * <li>Permissions#UPDATE_INSTANCE permission on Resources#PROCESS_DEFINITION</li> |
||
914 | */ |
||
915 | public function activateProcessInstanceById(string $processInstanceId): void; |
||
916 | |||
917 | /** |
||
918 | * <p>Activates the process instance with the given process definition id.</p> |
||
919 | * |
||
920 | * <p>If you have a process instance hierarchy, activating |
||
921 | * one process instance from the hierarchy will not activate other |
||
922 | * process instances from that hierarchy.</p> |
||
923 | * |
||
924 | * <p>Note: for more complex activate commands use {@link #updateProcessInstanceSuspensionState()}.</p> |
||
925 | * |
||
926 | * @throws ProcessEngineException |
||
927 | * if the process definition id is null |
||
928 | * @throws AuthorizationException |
||
929 | * if the user has none of the following: |
||
930 | * <li>ProcessInstancePermissions#SUSPEND permission on Resources#PROCESS_INSTANCE</li> |
||
931 | * <li>ProcessDefinitionPermissions#SUSPEND_INSTANCE permission on Resources#PROCESS_DEFINITION</li> |
||
932 | * <li>Permissions#UPDATE permission on Resources#PROCESS_INSTANCE</li> |
||
933 | * <li>Permissions#UPDATE_INSTANCE permission on Resources#PROCESS_DEFINITION</li> |
||
934 | */ |
||
935 | public function activateProcessInstanceByProcessDefinitionId(string $processDefinitionId): void; |
||
936 | |||
937 | /** |
||
938 | * <p>Activates the process instance with the given process definition key.</p> |
||
939 | * |
||
940 | * <p>If you have a process instance hierarchy, activating |
||
941 | * one process instance from the hierarchy will not activate other |
||
942 | * process instances from that hierarchy.</p> |
||
943 | * |
||
944 | * <p>Note: for more complex activate commands use {@link #updateProcessInstanceSuspensionState()}.</p> |
||
945 | * |
||
946 | * @throws ProcessEngineException |
||
947 | * if the process definition id is null |
||
948 | * @throws AuthorizationException |
||
949 | * if the user has none of the following: |
||
950 | * <li>ProcessInstancePermissions#SUSPEND permission on Resources#PROCESS_INSTANCE</li> |
||
951 | * <li>ProcessDefinitionPermissions#SUSPEND_INSTANCE permission on Resources#PROCESS_DEFINITION</li> |
||
952 | * <li>Permissions#UPDATE permission on Resources#PROCESS_INSTANCE</li> |
||
953 | * <li>Permissions#UPDATE_INSTANCE permission on Resources#PROCESS_DEFINITION</li> |
||
954 | */ |
||
955 | public function activateProcessInstanceByProcessDefinitionKey(string $processDefinitionKey): void; |
||
956 | |||
957 | /** |
||
958 | * Activate or suspend process instances using a fluent builder. Specify the |
||
959 | * instances by calling one of the <i>by</i> methods, like |
||
960 | * <i>byProcessInstanceId</i>. To update the suspension state call |
||
961 | * UpdateProcessInstanceSuspensionStateBuilder#activate() or |
||
962 | * UpdateProcessInstanceSuspensionStateBuilder#suspend(). |
||
963 | * |
||
964 | * @return UpdateProcessInstanceSuspensionStateSelectBuilderInterface the builder to update the suspension state |
||
965 | */ |
||
966 | public function updateProcessInstanceSuspensionState(): UpdateProcessInstanceSuspensionStateSelectBuilderInterface; |
||
967 | |||
968 | // Events //////////////////////////////////////////////////////////////////////// |
||
969 | |||
970 | /** |
||
971 | * Notifies the process engine that a signal event of name 'signalName' has |
||
972 | * been received. This method delivers the signal to a single execution, being the |
||
973 | * execution referenced by 'executionId'. |
||
974 | * The waiting execution is notified synchronously. |
||
975 | * |
||
976 | * Note that you need to provide the exact execution that is waiting for the signal |
||
977 | * if the process instance contains multiple executions. |
||
978 | * |
||
979 | * @param signalName |
||
980 | * the name of the signal event |
||
981 | * @param executionId |
||
982 | * the id of the process instance or the execution to deliver the signal to |
||
983 | * @param processVariables |
||
984 | * a map of variables added to the execution(s) |
||
985 | * |
||
986 | * @throws ProcessEngineException |
||
987 | * if no such execution exists or if the execution |
||
988 | * has not subscribed to the signal |
||
989 | * @throws AuthorizationException |
||
990 | * if the user has no Permissions#UPDATE permission on Resources#PROCESS_INSTANCE |
||
991 | * or no Permissions#UPDATE_INSTANCE permission on Resources#PROCESS_DEFINITION. |
||
992 | */ |
||
993 | public function signalEventReceived(string $signalName, string $executionId = null, array $processVariables = []): void; |
||
994 | |||
995 | /** |
||
996 | * Notifies the process engine that a signal event has been received using a |
||
997 | * fluent builder. |
||
998 | * |
||
999 | * @param signalName |
||
1000 | * the name of the signal event |
||
1001 | * @return SignalEventReceivedBuilderInterface the fluent builder to send the signal |
||
1002 | */ |
||
1003 | public function createSignalEvent(string $signalName): SignalEventReceivedBuilderInterface; |
||
1004 | |||
1005 | /** |
||
1006 | * Notifies the process engine that a message event with the name 'messageName' has |
||
1007 | * been received and has been correlated to an execution with id 'executionId'. |
||
1008 | * |
||
1009 | * The waiting execution is notified synchronously. |
||
1010 | * |
||
1011 | * Note that you need to provide the exact execution that is waiting for the message |
||
1012 | * if the process instance contains multiple executions. |
||
1013 | * |
||
1014 | * @param messageName |
||
1015 | * the name of the message event |
||
1016 | * @param executionId |
||
1017 | * the id of the process instance or the execution to deliver the message to |
||
1018 | * @param processVariables |
||
1019 | * a map of variables added to the execution |
||
1020 | * |
||
1021 | * @throws ProcessEngineException |
||
1022 | * if no such execution exists or if the execution |
||
1023 | * has not subscribed to the signal |
||
1024 | * @throws AuthorizationException |
||
1025 | * if the user has no Permissions#UPDATE permission on Resources#PROCESS_INSTANCE |
||
1026 | * or no Permissions#UPDATE_INSTANCE permission on Resources#PROCESS_DEFINITION. |
||
1027 | */ |
||
1028 | public function messageEventReceived(string $messageName, string $executionId, array $processVariables = []): void; |
||
1029 | |||
1030 | /** |
||
1031 | * Define a complex message correlation using a fluent builder. |
||
1032 | * |
||
1033 | * @param messageName the name of the message. Corresponds to the 'name' element |
||
1034 | * of the message defined in BPMN 2.0 Xml. |
||
1035 | * Can be null to correlate by other criteria (businessKey, processInstanceId, correlationKeys) only. |
||
1036 | * |
||
1037 | * @return MessageCorrelationBuilderInterface the fluent builder for defining the message correlation. |
||
1038 | */ |
||
1039 | public function createMessageCorrelation(string $messageName): MessageCorrelationBuilderInterface; |
||
1040 | |||
1041 | /** |
||
1042 | * Correlates a message to |
||
1043 | * <ul> |
||
1044 | * <li> |
||
1045 | * an execution that is waiting for a matching message and can be correlated according |
||
1046 | * to the given correlation keys. This is typically matched against process instance variables. |
||
1047 | * The process instance it belongs to has to have the given business key. |
||
1048 | * </li> |
||
1049 | * <li> |
||
1050 | * a process definition that can be started by this message. |
||
1051 | * </li> |
||
1052 | * </ul> |
||
1053 | * and updates the process instance variables. |
||
1054 | * |
||
1055 | * Notification and instantiation happen synchronously. |
||
1056 | * |
||
1057 | * @param messageName |
||
1058 | * the name of the message event; if null, matches any event |
||
1059 | * @param businessKey |
||
1060 | * the business key of process instances to correlate against |
||
1061 | * @param correlationKeys |
||
1062 | * a map of key value pairs that are used to correlate the message to an execution |
||
1063 | * @param processVariables |
||
1064 | * a map of variables added to the execution or newly created process instance |
||
1065 | * |
||
1066 | * @throws MismatchingMessageCorrelationException |
||
1067 | * if none or more than one execution or process definition is correlated |
||
1068 | * @throws ProcessEngineException |
||
1069 | * if messageName is null and businessKey is null and correlationKeys is null |
||
1070 | * @throws AuthorizationException |
||
1071 | * if the user has no Permissions#UPDATE permission on Resources#PROCESS_INSTANCE |
||
1072 | * or no Permissions#UPDATE_INSTANCE permission on Resources#PROCESS_DEFINITION. |
||
1073 | */ |
||
1074 | public function correlateMessage(string $messageName, string $businessKey = null, array $correlationKeys = null, array $processVariables = null): void; |
||
1075 | |||
1076 | /** |
||
1077 | * Define a modification of a process instance in terms of activity cancellations |
||
1078 | * and instantiations via a fluent builder. Instructions are executed in the order they are specified. |
||
1079 | * |
||
1080 | * @param processInstanceId the process instance to modify |
||
1081 | */ |
||
1082 | public function createProcessInstanceModification(string $processInstanceId): ProcessInstanceModificationBuilderInterface; |
||
1083 | |||
1084 | /** |
||
1085 | * Returns a fluent builder to start a new process instance in the exactly |
||
1086 | * specified version of the process definition with the given id. The builder |
||
1087 | * can be used to set further properties and specify instantiation |
||
1088 | * instructions to start the instance at any set of activities in the process. |
||
1089 | * If no instantiation instructions are set then the instance start at the |
||
1090 | * default start activity. |
||
1091 | * |
||
1092 | * @param processDefinitionId |
||
1093 | * the id of the process definition, cannot be <code>null</code>. |
||
1094 | * |
||
1095 | * @return a builder to create a process instance of the definition |
||
1096 | */ |
||
1097 | public function createProcessInstanceById(string $processDefinitionId): ProcessInstantiationBuilderInterface; |
||
1098 | |||
1099 | /** |
||
1100 | * Returns a fluent builder to start a new process instance in the latest |
||
1101 | * version of the process definition with the given key. The builder can be |
||
1102 | * used to set further properties and specify instantiation instructions to |
||
1103 | * start the instance at any set of activities in the process. If no |
||
1104 | * instantiation instructions are set then the instance start at the default |
||
1105 | * start activity. |
||
1106 | * |
||
1107 | * @param processDefinitionKey |
||
1108 | * the key of the process definition, cannot be <code>null</code>. |
||
1109 | * |
||
1110 | * @return a builder to create a process instance of the definition |
||
1111 | */ |
||
1112 | public function createProcessInstanceByKey(string $processDefinitionKey): ProcessInstantiationBuilderInterface; |
||
1113 | |||
1114 | /** |
||
1115 | * Creates a migration plan to migrate process instance between different process definitions. |
||
1116 | * Returns a fluent builder that can be used to specify migration instructions and build the plan. |
||
1117 | * |
||
1118 | * @param sourceProcessDefinitionId the process definition that instances are migrated from |
||
1119 | * @param targetProcessDefinitionId the process definition that instances are migrated to |
||
1120 | * @return a fluent builder |
||
1121 | */ |
||
1122 | public function createMigrationPlan(string $sourceProcessDefinitionId, string $targetProcessDefinitionId): MigrationPlanBuilderInterface; |
||
1123 | |||
1124 | /** |
||
1125 | * Executes a migration plan for a given list of process instances. The migration can |
||
1126 | * either be executed synchronously or asynchronously. A synchronously migration |
||
1127 | * blocks the caller until the migration was completed. The migration can only be |
||
1128 | * successfully completed if all process instances can be migrated. |
||
1129 | * |
||
1130 | * If the migration is executed asynchronously a Batch is immediately returned. |
||
1131 | * The migration is then executed as jobs from the process engine and the batch can |
||
1132 | * be used to track the progress of the migration. The Batch splits the migration |
||
1133 | * in smaller chunks which will be executed independently. |
||
1134 | * |
||
1135 | * @param migrationPlan the migration plan to executed |
||
1136 | * @return a fluent builder |
||
1137 | */ |
||
1138 | public function newMigration(MigrationPlanInterface $migrationPlan): MigrationPlanExecutionBuilderInterface; |
||
1139 | |||
1140 | /** |
||
1141 | * Creates a modification of multiple process instances in terms of activity cancellations |
||
1142 | * and instantiations via a fluent builder. Returns a fluent builder that can be used to specify |
||
1143 | * modification instructions and set process instances that should be modified. |
||
1144 | * |
||
1145 | * The modification can |
||
1146 | * either be executed synchronously or asynchronously. A synchronously modification |
||
1147 | * blocks the caller until the modification was completed. The modification can only be |
||
1148 | * successfully completed if all process instances can be modified. |
||
1149 | * |
||
1150 | * If the modification is executed asynchronously a Batch is immediately returned. |
||
1151 | * The modification is then executed as jobs from the process engine and the batch can |
||
1152 | * be used to track the progress of the modification. The Batch splits the modification |
||
1153 | * in smaller chunks which will be executed independently. |
||
1154 | * |
||
1155 | * @param processDefinitionId the process definition that instances are modified of |
||
1156 | * @return a fluent builder |
||
1157 | */ |
||
1158 | |||
1159 | public function createModification(string $processDefinitionId): ModificationBuilderInterface; |
||
1160 | |||
1161 | /** |
||
1162 | * Restarts process instances that are completed or deleted with the initial or last set of variables. |
||
1163 | * |
||
1164 | * @param processDefinitionId the id of the process definition, cannot be null. |
||
1165 | * |
||
1166 | * @throws ProcessEngineException |
||
1167 | * when no process definition is deployed with the given key or a process instance is still active. |
||
1168 | * @throws AuthorizationException |
||
1169 | * if the user has not all of the following permissions |
||
1170 | * <ul> |
||
1171 | * <li>Permissions#CREATE permission on Resources#PROCESS_INSTANCE</li> |
||
1172 | * <li>Permissions#CREATE_INSTANCE permission on Resources#PROCESS_DEFINITION</li> |
||
1173 | * <li>Permissions#READ_HISTORY permission on Resources#PROCESS_DEFINITION</li> |
||
1174 | * </ul> |
||
1175 | */ |
||
1176 | public function restartProcessInstances(string $processDefinitionId): RestartProcessInstanceBuilderInterface; |
||
1177 | |||
1178 | /** |
||
1179 | * Creates an incident |
||
1180 | * |
||
1181 | * @param incidentType the type of incident, cannot be null |
||
1182 | * @param executionId execution id, cannot be null |
||
1183 | * @param configuration |
||
1184 | * @param message |
||
1185 | * |
||
1186 | * @return a new incident |
||
1187 | * |
||
1188 | * @throws AuthorizationException |
||
1189 | * if the user has no Permissions#UPDATE permission on Resources#PROCESS_INSTANCE |
||
1190 | * and no Permissions#UPDATE_INSTANCE permission on Resources#PROCESS_DEFINITION. |
||
1191 | */ |
||
1192 | public function createIncident(string $incidentType, string $executionId, string $configuration, string $message = null): IncidentInterface; |
||
1193 | |||
1194 | /** |
||
1195 | * Resolves and remove an incident |
||
1196 | * |
||
1197 | * @param incidentId the id of an incident to resolve |
||
1198 | * |
||
1199 | * @throws AuthorizationException |
||
1200 | * if the user has no Permissions#UPDATE permission on Resources#PROCESS_INSTANCE |
||
1201 | * and no Permissions#UPDATE_INSTANCE permission on Resources#PROCESS_DEFINITION. |
||
1202 | */ |
||
1203 | public function resolveIncident(string $incidentId): void; |
||
1204 | |||
1205 | /** |
||
1206 | * Set an annotation to an incident. |
||
1207 | * |
||
1208 | * @throws NotValidException when incident id is {@code null} |
||
1209 | * @throws BadUserRequestException when no incident could be found |
||
1210 | * @throws AuthorizationException |
||
1211 | * if the user has no Permissions#UPDATE permission on Resources#PROCESS_INSTANCE |
||
1212 | * and no Permissions#UPDATE_INSTANCE permission on Resources#PROCESS_DEFINITION. |
||
1213 | * |
||
1214 | * @param incidentId of the incident that the annotation is updated at |
||
1215 | * @param annotation that is set to the incident |
||
1216 | * |
||
1217 | * @since 7.15 |
||
1218 | */ |
||
1219 | public function setAnnotationForIncidentById(string $incidentId, string $annotation): void; |
||
1220 | |||
1221 | /** |
||
1222 | * Clear the annotation for an incident. |
||
1223 | * |
||
1224 | * @throws NotValidException when incident id is {@code null} |
||
1225 | * @throws BadUserRequestException when no incident could be found |
||
1226 | * @throws AuthorizationException |
||
1227 | * if the user has no Permissions#UPDATE permission on Resources#PROCESS_INSTANCE |
||
1228 | * and no Permissions#UPDATE_INSTANCE permission on Resources#PROCESS_DEFINITION. |
||
1229 | * |
||
1230 | * @param incidentId of the incident that the annotation is cleared at |
||
1231 | * |
||
1232 | * @since 7.15 |
||
1233 | */ |
||
1234 | public function clearAnnotationForIncidentById(string $incidentId): void; |
||
1235 | |||
1236 | /** |
||
1237 | * Define a complex condition evaluation using a fluent builder. |
||
1238 | * |
||
1239 | * @return ConditionEvaluationBuilderInterface the fluent builder for defining the condition evaluation. |
||
1240 | */ |
||
1241 | public function createConditionEvaluation(): ConditionEvaluationBuilderInterface; |
||
1242 | } |
||
1243 |