Total Complexity | 484 |
Total Lines | 2401 |
Duplicated Lines | 0 % |
Changes | 0 |
Complex classes like TaskQueryImpl often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use TaskQueryImpl, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
27 | class TaskQueryImpl extends AbstractQuery implements TaskQueryInterface |
||
28 | { |
||
29 | /* |
||
30 | * When adding a property filter that supports Tasklist filters, |
||
31 | * the following classes need to be modified: |
||
32 | * |
||
33 | * <ol> |
||
34 | * <li> |
||
35 | * Update the {@code TaskQuery} interface; |
||
36 | * </li> |
||
37 | * <li> |
||
38 | * Implement the new property filter and getters/setters in {@code TaskQueryImpl}; |
||
39 | * </li> |
||
40 | * <li> |
||
41 | * Add the new property filter in the engine-rest {@code TaskQueryDto} class; |
||
42 | * </li> |
||
43 | * <li> |
||
44 | * Use the new filter in the engine-rest {@code TaskQueryDto#applyFilters} method. |
||
45 | * The method is used to provide Task filtering through the Rest API endpoint; |
||
46 | * </li> |
||
47 | * <li> |
||
48 | * Initialize the new property filter in the engine-rest |
||
49 | * {@code TaskQueryDto#fromQuery} method; The method is used to create a {@code TaskQueryDto} |
||
50 | * from a serialized ("saved") Task query. This is used in Tasklist filters; |
||
51 | * </li> |
||
52 | * <li> |
||
53 | * Add the property to the {@code JsonTaskQueryConverter} class, and make sure |
||
54 | * it is included in the {@code JsonTaskQueryConverter#toJsonObject} and |
||
55 | * {@code JsonTaskQueryConverter#toObject} methods. This is used to serialize/deserialize |
||
56 | * Task queries for Tasklist filter usage. |
||
57 | * </li> |
||
58 | * <li> |
||
59 | * Tests need to be added in: {@code TaskQueryTest} for Java API coverage, |
||
60 | * {@code TaskRestServiceQueryTest} for Rest API coverage and |
||
61 | * {@code FilterTaskQueryTest} for Tasklist filter coverage. |
||
62 | * </li> |
||
63 | * </ol> |
||
64 | */ |
||
65 | |||
66 | protected $taskId; |
||
67 | protected $taskIdIn = []; |
||
68 | protected $name; |
||
69 | protected $nameNotEqual; |
||
70 | protected $nameLike; |
||
71 | protected $nameNotLike; |
||
72 | protected $description; |
||
73 | protected $descriptionLike; |
||
74 | protected $priority; |
||
75 | protected $minPriority; |
||
76 | protected $maxPriority; |
||
77 | protected $assignee; |
||
78 | protected $assigneeLike; |
||
79 | protected $assigneeIn; |
||
80 | protected $assigneeNotIn; |
||
81 | protected $involvedUser; |
||
82 | protected $owner; |
||
83 | protected $unassigned; |
||
84 | protected $assigned; |
||
85 | protected $noDelegationState = false; |
||
86 | protected $delegationState; |
||
87 | protected $candidateUser; |
||
88 | protected $candidateGroup; |
||
89 | protected $candidateGroups; |
||
90 | protected $withCandidateGroups; |
||
91 | protected $withoutCandidateGroups; |
||
92 | protected $withCandidateUsers; |
||
93 | protected $withoutCandidateUsers; |
||
94 | protected $includeAssignedTasks; |
||
95 | protected $processInstanceId; |
||
96 | protected $processInstanceIdIn = []; |
||
97 | protected $executionId; |
||
98 | protected $activityInstanceIdIn = []; |
||
99 | protected $createTime; |
||
100 | protected $createTimeBefore; |
||
101 | protected $createTimeAfter; |
||
102 | protected $key; |
||
103 | protected $keyLike; |
||
104 | protected $taskDefinitionKeys = []; |
||
105 | protected $processDefinitionKey; |
||
106 | protected $processDefinitionKeys = []; |
||
107 | protected $processDefinitionId; |
||
108 | protected $processDefinitionName; |
||
109 | protected $processDefinitionNameLike; |
||
110 | protected $processInstanceBusinessKey; |
||
111 | protected $processInstanceBusinessKeys = []; |
||
112 | protected $processInstanceBusinessKeyLike; |
||
113 | protected $variables = []; |
||
114 | protected $dueDate; |
||
115 | protected $dueBefore; |
||
116 | protected $dueAfter; |
||
117 | protected $followUpDate; |
||
118 | protected $followUpBefore; |
||
119 | protected $followUpNullAccepted = false; |
||
120 | protected $followUpAfter; |
||
121 | protected $excludeSubtasks = false; |
||
122 | protected $suspensionState; |
||
123 | protected $initializeFormKeys = false; |
||
124 | protected $taskNameCaseInsensitive = false; |
||
125 | |||
126 | protected $variableNamesIgnoreCase; |
||
127 | protected $variableValuesIgnoreCase; |
||
128 | |||
129 | protected $parentTaskId; |
||
130 | protected $isWithoutTenantId = false; |
||
131 | protected $isWithoutDueDate = false; |
||
132 | |||
133 | protected $tenantIds = []; |
||
134 | // case management ///////////////////////////// |
||
135 | /*protected String caseDefinitionKey; |
||
136 | protected String caseDefinitionId; |
||
137 | protected String caseDefinitionName; |
||
138 | protected String caseDefinitionNameLike; |
||
139 | protected String caseInstanceId; |
||
140 | protected String caseInstanceBusinessKey; |
||
141 | protected String caseInstanceBusinessKeyLike; |
||
142 | protected String caseExecutionId;*/ |
||
143 | |||
144 | protected $cachedCandidateGroups = []; |
||
145 | protected $cachedUserGroups = []; |
||
146 | |||
147 | // or query ///////////////////////////// |
||
148 | protected $queries; |
||
149 | protected $isOrQueryActive = false; |
||
150 | |||
151 | public function __construct(CommandExecutorInterface $commandExecutor = null) |
||
152 | { |
||
153 | parent::__construct($commandExecutor); |
||
154 | $this->queries = [$this]; |
||
155 | } |
||
156 | |||
157 | public function taskId(string $taskId): TaskQueryImpl |
||
158 | { |
||
159 | EnsureUtil::ensureNotNull("Task id", "taskId", $taskId); |
||
160 | $this->taskId = $taskId; |
||
161 | return $this; |
||
162 | } |
||
163 | |||
164 | public function taskIdIn(array $taskIds): TaskQueryImpl |
||
165 | { |
||
166 | EnsureUtil::ensureNotNull("taskIds", "taskIds", $taskIds); |
||
167 | $this->taskIdIn = $taskIds; |
||
168 | return $this; |
||
169 | } |
||
170 | |||
171 | public function taskName(string $name): TaskQueryImpl |
||
172 | { |
||
173 | $this->name = $name; |
||
174 | return $this; |
||
175 | } |
||
176 | |||
177 | public function taskNameLike(string $nameLike): TaskQueryImpl |
||
178 | { |
||
179 | EnsureUtil::ensureNotNull("Task nameLike", "nameLike", $nameLike); |
||
180 | $this->nameLike = $nameLike; |
||
181 | return $this; |
||
182 | } |
||
183 | |||
184 | public function taskDescription(string $description): TaskQueryImpl |
||
185 | { |
||
186 | EnsureUtil::ensureNotNull("Description", "description", $description); |
||
187 | $this->description = $description; |
||
188 | return $this; |
||
189 | } |
||
190 | |||
191 | public function taskDescriptionLike(string $descriptionLike): TaskQueryInterface |
||
192 | { |
||
193 | EnsureUtil::ensureNotNull("Task descriptionLike", "descriptionLike", $descriptionLike); |
||
194 | $this->descriptionLike = $descriptionLike; |
||
195 | return $this; |
||
196 | } |
||
197 | |||
198 | public function taskPriority(int $priority): TaskQueryInterface |
||
199 | { |
||
200 | EnsureUtil::ensureNotNull("Priority", "priority", $priority); |
||
201 | $this->priority = $priority; |
||
202 | return $this; |
||
203 | } |
||
204 | |||
205 | public function taskMinPriority(int $minPriority): TaskQueryInterface |
||
206 | { |
||
207 | EnsureUtil::ensureNotNull("Min Priority", $minPriority); |
||
208 | $this->minPriority = $minPriority; |
||
209 | return $this; |
||
210 | } |
||
211 | |||
212 | public function taskMaxPriority(int $maxPriority): TaskQueryInterface |
||
213 | { |
||
214 | EnsureUtil::ensureNotNull("Max Priority", $maxPriority); |
||
215 | $this->maxPriority = $maxPriority; |
||
216 | return $this; |
||
217 | } |
||
218 | |||
219 | public function taskAssignee(string $assignee): TaskQueryImpl |
||
220 | { |
||
221 | EnsureUtil::ensureNotNull("Assignee", $assignee); |
||
222 | $this->assignee = $assignee; |
||
223 | unset($this->expressions["taskAssignee"]); |
||
224 | return $this; |
||
225 | } |
||
226 | |||
227 | public function taskAssigneeExpression(string $assigneeExpression): TaskQueryInterface |
||
228 | { |
||
229 | EnsureUtil::ensureNotNull("Assignee expression", "assigneeExpression", $assigneeExpression); |
||
230 | $this->expressions["taskAssignee"] = $assigneeExpression; |
||
231 | return $this; |
||
232 | } |
||
233 | |||
234 | public function taskAssigneeLike(string $assignee): TaskQueryInterface |
||
235 | { |
||
236 | EnsureUtil::ensureNotNull("Assignee", "assignee", $assignee); |
||
237 | $this->assigneeLike = $assignee; |
||
238 | unset($this->expressions["taskAssigneeLike"]); |
||
239 | return $this; |
||
240 | } |
||
241 | |||
242 | public function taskAssigneeLikeExpression(string $assigneeLikeExpression): TaskQueryInterface |
||
243 | { |
||
244 | EnsureUtil::ensureNotNull("Assignee like expression", "assigneeLikeExpression", $assigneeLikeExpression); |
||
245 | $this->expressions["taskAssigneeLike"] = $assigneeLikeExpression; |
||
246 | return $this; |
||
247 | } |
||
248 | |||
249 | public function taskAssigneeIn(array $assignees): TaskQueryInterface |
||
250 | { |
||
251 | EnsureUtil::ensureNotNull("Assignees", "assignees", $assignees); |
||
252 | $assigneeIn = []; |
||
|
|||
253 | $assigneeIn = $assignees; |
||
254 | |||
255 | $this->assigneeIn = $assigneeIn; |
||
256 | unset($this->expressions["taskAssigneeIn"]); |
||
257 | |||
258 | return $this; |
||
259 | } |
||
260 | |||
261 | public function taskAssigneeNotIn(array $assignees): TaskQueryInterface |
||
262 | { |
||
263 | EnsureUtil::ensureNotNull("Assignees", "assignees", $assignees); |
||
264 | |||
265 | $assigneeNotIn = []; |
||
266 | $this->assigneeNotIn = $assignees; |
||
267 | |||
268 | $this->assigneeNotIn = $assigneeNotIn; |
||
269 | unset($this->expressions["taskAssigneeNotIn"]); |
||
270 | |||
271 | return $this; |
||
272 | } |
||
273 | |||
274 | public function taskOwner(string $owner): TaskQueryImpl |
||
275 | { |
||
276 | EnsureUtil::ensureNotNull("Owner", "owner", $owner); |
||
277 | $this->owner = $owner; |
||
278 | unset($this->expressions["taskOwner"]); |
||
279 | return $this; |
||
280 | } |
||
281 | |||
282 | public function taskOwnerExpression(string $ownerExpression): TaskQueryInterface |
||
283 | { |
||
284 | EnsureUtil::ensureNotNull("Owner expression", "ownerExpression", $ownerExpression); |
||
285 | $this->expressions["taskOwner"] = $ownerExpression; |
||
286 | return $this; |
||
287 | } |
||
288 | |||
289 | public function taskUnassigned(): TaskQueryInterface |
||
290 | { |
||
291 | $this->unassigned = true; |
||
292 | return $this; |
||
293 | } |
||
294 | |||
295 | public function taskAssigned(): TaskQueryInterface |
||
296 | { |
||
297 | $this->assigned = true; |
||
298 | return $this; |
||
299 | } |
||
300 | |||
301 | public function taskDelegationState(string $delegationState): TaskQueryInterface |
||
302 | { |
||
303 | if ($delegationState === null) { |
||
304 | $this->noDelegationState = true; |
||
305 | } else { |
||
306 | $this->delegationState = $delegationState; |
||
307 | } |
||
308 | return $this; |
||
309 | } |
||
310 | |||
311 | public function taskCandidateUser(string $candidateUser): TaskQueryImpl |
||
325 | } |
||
326 | |||
327 | public function taskCandidateUserExpression(string $candidateUserExpression): TaskQueryInterface |
||
328 | { |
||
329 | EnsureUtil::ensureNotNull("Candidate user expression", "candidateUserExpression", $candidateUserExpression); |
||
330 | |||
331 | if ($this->candidateGroup !== null || array_key_exists("taskCandidateGroup", $this->expressions)) { |
||
332 | throw new ProcessEngineException("Invalid query usage: cannot set both candidateUser and candidateGroup"); |
||
333 | } |
||
334 | if (!empty($this->candidateGroups) || array_key_exists("taskCandidateGroupIn", $this->expressions)) { |
||
335 | throw new ProcessEngineException("Invalid query usage: cannot set both candidateUser and candidateGroupIn"); |
||
336 | } |
||
337 | |||
338 | $this->expressions["taskCandidateUser"] = $candidateUserExpression; |
||
339 | return $this; |
||
340 | } |
||
341 | |||
342 | public function taskInvolvedUser(string $involvedUser): TaskQueryImpl |
||
343 | { |
||
344 | EnsureUtil::ensureNotNull("Involved user", "involvedUser", $involvedUser); |
||
345 | $this->involvedUser = $involvedUser; |
||
346 | unset($this->expressions["taskInvolvedUser"]); |
||
347 | return $this; |
||
348 | } |
||
349 | |||
350 | public function taskInvolvedUserExpression(string $involvedUserExpression): TaskQueryInterface |
||
351 | { |
||
352 | EnsureUtil::ensureNotNull("Involved user expression", "involvedUserExpression", $involvedUserExpression); |
||
353 | $this->expressions["taskInvolvedUser"] = $involvedUserExpression; |
||
354 | return $this; |
||
355 | } |
||
356 | |||
357 | public function withCandidateGroups(): TaskQueryInterface |
||
358 | { |
||
359 | if ($this->isOrQueryActive) { |
||
360 | throw new ProcessEngineException("Invalid query usage: cannot set withCandidateGroups() within 'or' query"); |
||
361 | } |
||
362 | |||
363 | $this->withCandidateGroups = true; |
||
364 | return $this; |
||
365 | } |
||
366 | |||
367 | public function withoutCandidateGroups(): TaskQueryInterface |
||
375 | } |
||
376 | |||
377 | public function withCandidateUsers(): TaskQueryInterface |
||
378 | { |
||
379 | if ($this->isOrQueryActive) { |
||
380 | throw new ProcessEngineException("Invalid query usage: cannot set withCandidateUsers() within 'or' query"); |
||
381 | } |
||
382 | $this->withCandidateUsers = true; |
||
383 | return $this; |
||
384 | } |
||
385 | |||
386 | public function withoutCandidateUsers(): TaskQueryInterface |
||
387 | { |
||
388 | if ($this->isOrQueryActive) { |
||
389 | throw new ProcessEngineException("Invalid query usage: cannot set withoutCandidateUsers() within 'or' query"); |
||
390 | } |
||
391 | $this->withoutCandidateUsers = true; |
||
392 | return $this; |
||
393 | } |
||
394 | |||
395 | public function taskCandidateGroup(string $candidateGroup): TaskQueryImpl |
||
396 | { |
||
397 | EnsureUtil::ensureNotNull("Candidate group", "candidateGroup", $candidateGroup); |
||
398 | |||
399 | if (!$this->isOrQueryActive) { |
||
400 | if ($this->candidateUser !== null || array_key_exists("taskCandidateUser", $this->expressions)) { |
||
401 | throw new ProcessEngineException("Invalid query usage: cannot set both candidateGroup and candidateUser"); |
||
402 | } |
||
403 | } |
||
404 | |||
405 | $this->candidateGroup = candidateGroup; |
||
406 | unset($this->expressions["taskCandidateGroup"]); |
||
407 | return $this; |
||
408 | } |
||
409 | |||
410 | public function taskCandidateGroupExpression(string $candidateGroupExpression): TaskQueryInterface |
||
411 | { |
||
412 | EnsureUtil::ensureNotNull("Candidate group expression", "candidateGroupExpression", $candidateGroupExpression); |
||
413 | |||
414 | if (!$this->isOrQueryActive) { |
||
415 | if ($this->candidateUser !== null || array_key_exists("taskCandidateUser", $this->expressions)) { |
||
416 | throw new ProcessEngineException("Invalid query usage: cannot set both candidateGroup and candidateUser"); |
||
417 | } |
||
418 | } |
||
419 | |||
420 | $this->expressions["taskCandidateGroup"] = $candidateGroupExpression; |
||
421 | return $this; |
||
422 | } |
||
423 | |||
424 | public function taskCandidateGroupIn(array $candidateGroups): TaskQueryInterface |
||
425 | { |
||
426 | EnsureUtil::ensureNotEmpty("Candidate group list", "candidateGroups", $candidateGroups); |
||
427 | |||
428 | if (!$this->isOrQueryActive) { |
||
429 | if ($this->candidateUser !== null || array_key_exists("taskCandidateUser", $this->expressions)) { |
||
430 | throw new ProcessEngineException("Invalid query usage: cannot set both candidateGroupIn and candidateUser"); |
||
431 | } |
||
432 | } |
||
433 | |||
434 | $this->candidateGroups = $candidateGroups; |
||
435 | unset($this->expressions["taskCandidateGroupIn"]); |
||
436 | return $this; |
||
437 | } |
||
438 | |||
439 | public function taskCandidateGroupInExpression(string $candidateGroupsExpression): TaskQueryInterface |
||
440 | { |
||
441 | EnsureUtil::ensureNotEmpty("Candidate group list expression", "candidateGroupsExpression", $candidateGroupsExpression); |
||
442 | |||
443 | if (!$this->isOrQueryActive) { |
||
444 | if ($this->candidateUser !== null || array_key_exists("taskCandidateUser", $this->expressions)) { |
||
445 | throw new ProcessEngineException("Invalid query usage: cannot set both candidateGroupIn and candidateUser"); |
||
446 | } |
||
447 | } |
||
448 | |||
449 | $this->expressions["taskCandidateGroupIn"] = $candidateGroupsExpression; |
||
450 | return $this; |
||
451 | } |
||
452 | |||
453 | public function includeAssignedTasks(): TaskQueryInterface |
||
454 | { |
||
455 | if ( |
||
456 | $this->candidateUser === null && |
||
457 | $this->candidateGroup === null && |
||
458 | $this->candidateGroups === null && |
||
459 | !$this->isWithCandidateGroups() && |
||
460 | !$this->isWithoutCandidateGroups() && |
||
461 | !$this->isWithCandidateUsers() && |
||
462 | !$this->isWithoutCandidateUsers() && |
||
463 | !array_key_exists("taskCandidateUser", $this->expressions) && |
||
464 | !array_key_exists("taskCandidateGroup", $this->expressions) && |
||
465 | !array_key_exists("taskCandidateGroupIn", $this->expressions) |
||
466 | ) { |
||
467 | throw new ProcessEngineException("Invalid query usage: candidateUser, candidateGroup, candidateGroupIn, withCandidateGroups, withoutCandidateGroups, withCandidateUsers, withoutCandidateUsers has to be called before 'includeAssignedTasks'."); |
||
468 | } |
||
469 | |||
470 | $this->includeAssignedTasks = true; |
||
471 | return $this; |
||
472 | } |
||
473 | |||
474 | public function includeAssignedTasksInternal(): TaskQueryInterface |
||
475 | { |
||
476 | $this->includeAssignedTasks = true; |
||
477 | return $this; |
||
478 | } |
||
479 | |||
480 | public function processInstanceId(string $processInstanceId): TaskQueryImpl |
||
481 | { |
||
482 | $this->processInstanceId = $processInstanceId; |
||
483 | return $this; |
||
484 | } |
||
485 | |||
486 | public function processInstanceIdIn(array $processInstanceIds): TaskQueryInterface |
||
487 | { |
||
488 | $this->processInstanceIdIn = $processInstanceIds; |
||
489 | return $this; |
||
490 | } |
||
491 | |||
492 | public function processInstanceBusinessKey(string $processInstanceBusinessKey): TaskQueryImpl |
||
493 | { |
||
494 | $this->processInstanceBusinessKey = $processInstanceBusinessKey; |
||
495 | unset($this->expressions["processInstanceBusinessKey"]); |
||
496 | return $this; |
||
497 | } |
||
498 | |||
499 | public function processInstanceBusinessKeyExpression(string $processInstanceBusinessKeyExpression): TaskQueryInterface |
||
500 | { |
||
501 | EnsureUtil::ensureNotNull("processInstanceBusinessKey expression", "processInstanceBusinessKeyExpression", $processInstanceBusinessKeyExpression); |
||
502 | $this->expressions["processInstanceBusinessKey"] = $processInstanceBusinessKeyExpression; |
||
503 | return $this; |
||
504 | } |
||
505 | |||
506 | public function processInstanceBusinessKeyIn(array $processInstanceBusinessKeys): TaskQueryInterface |
||
507 | { |
||
508 | $this->processInstanceBusinessKeys = $processInstanceBusinessKeys; |
||
509 | return $this; |
||
510 | } |
||
511 | |||
512 | public function processInstanceBusinessKeyLike(string $processInstanceBusinessKey): TaskQueryInterface |
||
513 | { |
||
514 | $this->processInstanceBusinessKeyLike = $processInstanceBusinessKey; |
||
515 | unset($this->expressions["processInstanceBusinessKeyLike"]); |
||
516 | return $this; |
||
517 | } |
||
518 | |||
519 | public function processInstanceBusinessKeyLikeExpression(string $processInstanceBusinessKeyLikeExpression): TaskQueryInterface |
||
520 | { |
||
521 | EnsureUtil::ensureNotNull("processInstanceBusinessKeyLike expression", "processInstanceBusinessKeyLikeExpression", $processInstanceBusinessKeyLikeExpression); |
||
522 | $this->expressions["processInstanceBusinessKeyLike"] = $processInstanceBusinessKeyLikeExpression; |
||
523 | return $this; |
||
524 | } |
||
525 | |||
526 | public function executionId(string $executionId): TaskQueryImpl |
||
527 | { |
||
528 | $this->executionId = $executionId; |
||
529 | return $this; |
||
530 | } |
||
531 | |||
532 | public function activityInstanceIdIn(array $activityInstanceIds): TaskQueryInterface |
||
533 | { |
||
534 | $this->activityInstanceIdIn = $activityInstanceIds; |
||
535 | return $this; |
||
536 | } |
||
537 | |||
538 | public function tenantIdIn(array $tenantIds): TaskQueryInterface |
||
539 | { |
||
540 | EnsureUtil::ensureNotNull("tenantIds", "tenantIds", $tenantIds); |
||
541 | |||
542 | // The tenantIdIn filter can't be used in an AND query with |
||
543 | // the withoutTenantId filter. They can be combined in an OR query |
||
544 | if (!$this->isOrQueryActive) { |
||
545 | if ($this->isWithoutTenantId) { |
||
546 | throw new ProcessEngineException("Invalid query usage: cannot set both tenantIdIn and withoutTenantId filters."); |
||
547 | } |
||
548 | } |
||
549 | |||
550 | $this->tenantIds = $tenantIds; |
||
551 | return $this; |
||
552 | } |
||
553 | |||
554 | public function withoutTenantId(): TaskQueryInterface |
||
555 | { |
||
556 | // The tenantIdIn filter can't be used in an AND query with |
||
557 | // the withoutTenantId filter. They can be combined in an OR query |
||
558 | if (!$this->isOrQueryActive) { |
||
559 | if (!empty($this->tenantIds) && count($this->tenantIds) > 0) { |
||
560 | throw new ProcessEngineException("Invalid query usage: cannot set both tenantIdIn and withoutTenantId filters."); |
||
561 | } |
||
562 | } |
||
563 | |||
564 | $this->isWithoutTenantId = true; |
||
565 | return $this; |
||
566 | } |
||
567 | |||
568 | public function taskCreatedOn(string $createTime): TaskQueryImpl |
||
569 | { |
||
570 | $this->createTime = $createTime; |
||
571 | unset($this->expressions["taskCreatedOn"]); |
||
572 | return $this; |
||
573 | } |
||
574 | |||
575 | public function taskCreatedOnExpression(string $createTimeExpression): TaskQueryInterface |
||
576 | { |
||
577 | $this->expressions["taskCreatedOn"] = $createTimeExpression; |
||
578 | return $this; |
||
579 | } |
||
580 | |||
581 | public function taskCreatedBefore(string $before): TaskQueryInterface |
||
582 | { |
||
583 | $this->createTimeBefore = $before; |
||
584 | unset($this->expressions["taskCreatedBefore"]); |
||
585 | return $this; |
||
586 | } |
||
587 | |||
588 | public function taskCreatedBeforeExpression(string $beforeExpression): TaskQueryInterface |
||
589 | { |
||
590 | $this->expressions["taskCreatedBefore"] = $beforeExpression; |
||
591 | return $this; |
||
592 | } |
||
593 | |||
594 | public function taskCreatedAfter(string $after): TaskQueryInterface |
||
595 | { |
||
596 | $this->createTimeAfter = $after; |
||
597 | unset($this->expressions["taskCreatedAfter"]); |
||
598 | return $this; |
||
599 | } |
||
600 | |||
601 | public function taskCreatedAfterExpression(string $afterExpression): TaskQueryInterface |
||
602 | { |
||
603 | $this->expressions["taskCreatedAfter"] = $afterExpression; |
||
604 | return $this; |
||
605 | } |
||
606 | |||
607 | public function taskDefinitionKey(string $key): TaskQueryInterface |
||
608 | { |
||
609 | $this->key = $key; |
||
610 | return $this; |
||
611 | } |
||
612 | |||
613 | public function taskDefinitionKeyLike(string $keyLike): TaskQueryInterface |
||
614 | { |
||
615 | $this->keyLike = $keyLike; |
||
616 | return $this; |
||
617 | } |
||
618 | |||
619 | public function taskDefinitionKeyIn(array $taskDefinitionKeys): TaskQueryInterface |
||
620 | { |
||
621 | $this->taskDefinitionKeys = $taskDefinitionKeys; |
||
622 | return $this; |
||
623 | } |
||
624 | |||
625 | public function taskParentTaskId(string $taskParentTaskId): TaskQueryInterface |
||
626 | { |
||
627 | $this->parentTaskId = $taskParentTaskId; |
||
628 | return $this; |
||
629 | } |
||
630 | |||
631 | /* |
||
632 | public TaskQuery caseInstanceId(string $caseInstanceId) { |
||
633 | EnsureUtil::ensureNotNull("caseInstanceId", caseInstanceId); |
||
634 | $this->caseInstanceId = caseInstanceId; |
||
635 | return $this; |
||
636 | } |
||
637 | |||
638 | public TaskQuery caseInstanceBusinessKey(string $caseInstanceBusinessKey) { |
||
639 | EnsureUtil::ensureNotNull("caseInstanceBusinessKey", caseInstanceBusinessKey); |
||
640 | $this->caseInstanceBusinessKey = caseInstanceBusinessKey; |
||
641 | return $this; |
||
642 | } |
||
643 | |||
644 | public TaskQuery caseInstanceBusinessKeyLike(string $caseInstanceBusinessKeyLike) { |
||
645 | EnsureUtil::ensureNotNull("caseInstanceBusinessKeyLike", caseInstanceBusinessKeyLike); |
||
646 | $this->caseInstanceBusinessKeyLike = caseInstanceBusinessKeyLike; |
||
647 | return $this; |
||
648 | } |
||
649 | |||
650 | public TaskQuery caseExecutionId(string $caseExecutionId) { |
||
651 | EnsureUtil::ensureNotNull("caseExecutionId", caseExecutionId); |
||
652 | $this->caseExecutionId = caseExecutionId; |
||
653 | return $this; |
||
654 | } |
||
655 | |||
656 | public TaskQuery caseDefinitionId(string $caseDefinitionId) { |
||
657 | EnsureUtil::ensureNotNull("caseDefinitionId", caseDefinitionId); |
||
658 | $this->caseDefinitionId = caseDefinitionId; |
||
659 | return $this; |
||
660 | } |
||
661 | |||
662 | public TaskQuery caseDefinitionKey(string $caseDefinitionKey) { |
||
663 | EnsureUtil::ensureNotNull("caseDefinitionKey", caseDefinitionKey); |
||
664 | $this->caseDefinitionKey = caseDefinitionKey; |
||
665 | return $this; |
||
666 | } |
||
667 | |||
668 | public TaskQuery caseDefinitionName(string $caseDefinitionName) { |
||
669 | EnsureUtil::ensureNotNull("caseDefinitionName", caseDefinitionName); |
||
670 | $this->caseDefinitionName = caseDefinitionName; |
||
671 | return $this; |
||
672 | } |
||
673 | |||
674 | public TaskQuery caseDefinitionNameLike(string $caseDefinitionNameLike) { |
||
675 | EnsureUtil::ensureNotNull("caseDefinitionNameLike", caseDefinitionNameLike); |
||
676 | $this->caseDefinitionNameLike = caseDefinitionNameLike; |
||
677 | return $this; |
||
678 | }*/ |
||
679 | |||
680 | public function taskVariableValueEquals(string $variableName, $variableValue): TaskQueryInterface |
||
681 | { |
||
682 | $this->addVariable($variableName, $variableValue, QueryOperator::EQUALS, true, false); |
||
683 | return $this; |
||
684 | } |
||
685 | |||
686 | public function taskVariableValueNotEquals(string $variableName, $variableValue): TaskQueryInterface |
||
687 | { |
||
688 | $this->addVariable($variableName, $variableValue, QueryOperator::NOT_EQUALS, true, false); |
||
689 | return $this; |
||
690 | } |
||
691 | |||
692 | public function taskVariableValueLike(string $variableName, string $variableValue): TaskQueryInterface |
||
693 | { |
||
694 | $this->addVariable($variableName, $variableValue, QueryOperator::LIKE, true, false); |
||
695 | return $this; |
||
696 | } |
||
697 | |||
698 | public function taskVariableValueGreaterThan(string $variableName, $variableValue): TaskQueryInterface |
||
699 | { |
||
700 | $this->addVariable($variableName, $variableValue, QueryOperator::GREATER_THAN, true, false); |
||
701 | return $this; |
||
702 | } |
||
703 | |||
704 | public function taskVariableValueGreaterThanOrEquals(string $variableName, $variableValue): TaskQueryInterface |
||
705 | { |
||
706 | $this->addVariable($variableName, $variableValue, QueryOperator::GREATER_THAN_OR_EQUAL, true, false); |
||
707 | return $this; |
||
708 | } |
||
709 | |||
710 | public function taskVariableValueLessThan(string $variableName, $variableValue): TaskQueryInterface |
||
711 | { |
||
712 | $this->addVariable($variableName, $variableValue, QueryOperator::LESS_THAN, true, false); |
||
713 | return $this; |
||
714 | } |
||
715 | |||
716 | public function taskVariableValueLessThanOrEquals(string $variableName, $variableValue): TaskQueryInterface |
||
717 | { |
||
718 | $this->addVariable($variableName, $variableValue, QueryOperator::LESS_THAN_OR_EQUAL, true, false); |
||
719 | return $this; |
||
720 | } |
||
721 | |||
722 | public function processVariableValueEquals(string $variableName, $variableValue): TaskQueryInterface |
||
723 | { |
||
724 | $this->addVariable($variableName, $variableValue, QueryOperator::EQUALS, false, true); |
||
725 | return $this; |
||
726 | } |
||
727 | |||
728 | public function processVariableValueNotEquals(string $variableName, $variableValue): TaskQueryInterface |
||
729 | { |
||
730 | $this->addVariable($variableName, $variableValue, QueryOperator::NOT_EQUALS, false, true); |
||
731 | return $this; |
||
732 | } |
||
733 | |||
734 | public function processVariableValueLike(string $variableName, string $variableValue): TaskQueryInterface |
||
735 | { |
||
736 | $this->addVariable($variableName, $variableValue, QueryOperator::LIKE, false, true); |
||
737 | return $this; |
||
738 | } |
||
739 | |||
740 | public function processVariableValueNotLike(string $variableName, string $variableValue): TaskQueryInterface |
||
741 | { |
||
742 | $this->addVariable($variableName, $variableValue, QueryOperator::NOT_LIKE, false, true); |
||
743 | return $this; |
||
744 | } |
||
745 | |||
746 | public function processVariableValueGreaterThan(string $variableName, $variableValue): TaskQueryInterface |
||
747 | { |
||
748 | $this->addVariable($variableName, $variableValue, QueryOperator::GREATER_THAN, false, true); |
||
749 | return $this; |
||
750 | } |
||
751 | |||
752 | public function processVariableValueGreaterThanOrEquals(string $variableName, $variableValue): TaskQueryInterface |
||
753 | { |
||
754 | $this->addVariable($variableName, $variableValue, QueryOperator::GREATER_THAN_OR_EQUAL, false, true); |
||
755 | return $this; |
||
756 | } |
||
757 | |||
758 | public function processVariableValueLessThan(string $variableName, $variableValue): TaskQueryInterface |
||
759 | { |
||
760 | $this->addVariable($variableName, $variableValue, QueryOperator::LESS_THAN, false, true); |
||
761 | return $this; |
||
762 | } |
||
763 | |||
764 | public function processVariableValueLessThanOrEquals(string $variableName, $variableValue): TaskQueryInterface |
||
765 | { |
||
766 | $this->addVariable($variableName, $variableValue, QueryOperator::LESS_THAN_OR_EQUAL, false, true); |
||
767 | return $this; |
||
768 | } |
||
769 | |||
770 | /*public function caseInstanceVariableValueEquals(string $variableName, $variableValue): TaskQueryInterface |
||
771 | { |
||
772 | $this->addVariable($variableName, $variableValue, QueryOperator::EQUALS, false, false); |
||
773 | return $this; |
||
774 | } |
||
775 | |||
776 | public function caseInstanceVariableValueNotEquals(string $variableName, $variableValue): TaskQueryInterface |
||
777 | { |
||
778 | $this->addVariable($variableName, $variableValue, QueryOperator::NOT_EQUALS, false, false); |
||
779 | return $this; |
||
780 | } |
||
781 | |||
782 | public function caseInstanceVariableValueLike(string $variableName, string $variableValue): TaskQueryInterface |
||
783 | { |
||
784 | $this->addVariable($variableName, $variableValue, QueryOperator::LIKE, false, false); |
||
785 | return $this; |
||
786 | } |
||
787 | |||
788 | public function caseInstanceVariableValueNotLike(string $variableName, string $variableValue): TaskQueryInterface |
||
789 | { |
||
790 | $this->addVariable($variableName, $variableValue, QueryOperator::NOT_LIKE, false, false); |
||
791 | return $this; |
||
792 | } |
||
793 | |||
794 | public function caseInstanceVariableValueGreaterThan(string $variableName, $variableValue): TaskQueryInterface |
||
795 | { |
||
796 | $this->addVariable($variableName, $variableValue, QueryOperator::GREATER_THAN, false, false); |
||
797 | return $this; |
||
798 | } |
||
799 | |||
800 | public function caseInstanceVariableValueGreaterThanOrEquals(string $variableName, $variableValue): TaskQueryInterface |
||
801 | { |
||
802 | $this->addVariable($variableName, $variableValue, QueryOperator::GREATER_THAN_OR_EQUAL, false, false); |
||
803 | return $this; |
||
804 | } |
||
805 | |||
806 | public function caseInstanceVariableValueLessThan(string $variableName, $variableValue): TaskQueryInterface |
||
807 | { |
||
808 | $this->addVariable($variableName, $variableValue, QueryOperator::LESS_THAN, false, false); |
||
809 | return $this; |
||
810 | } |
||
811 | |||
812 | public function caseInstanceVariableValueLessThanOrEquals(string $variableName, $variableValue): TaskQueryInterface |
||
813 | { |
||
814 | $this->addVariable($variableName, $variableValue, QueryOperator::LESS_THAN_OR_EQUAL, false, false); |
||
815 | return $this; |
||
816 | }*/ |
||
817 | |||
818 | public function processDefinitionKey(string $processDefinitionKey): TaskQueryInterface |
||
819 | { |
||
820 | $this->processDefinitionKey = $processDefinitionKey; |
||
821 | return $this; |
||
822 | } |
||
823 | |||
824 | public function processDefinitionKeyIn(array $processDefinitionKeys): TaskQueryInterface |
||
825 | { |
||
826 | $this->processDefinitionKeys = $processDefinitionKeys; |
||
827 | return $this; |
||
828 | } |
||
829 | |||
830 | public function processDefinitionId(string $processDefinitionId): TaskQueryInterface |
||
831 | { |
||
832 | $this->processDefinitionId = $processDefinitionId; |
||
833 | return $this; |
||
834 | } |
||
835 | |||
836 | public function processDefinitionName(string $processDefinitionName): TaskQueryInterface |
||
837 | { |
||
838 | $this->processDefinitionName = $processDefinitionName; |
||
839 | return $this; |
||
840 | } |
||
841 | |||
842 | public function processDefinitionNameLike(string $processDefinitionName): TaskQueryInterface |
||
843 | { |
||
844 | $this->processDefinitionNameLike = $processDefinitionName; |
||
845 | return $this; |
||
846 | } |
||
847 | |||
848 | public function dueDate(string $dueDate): TaskQueryInterface |
||
849 | { |
||
850 | // The dueDate filter can't be used in an AND query with |
||
851 | // the withoutDueDate filter. They can be combined in an OR query |
||
852 | if (!$this->isOrQueryActive) { |
||
853 | if ($this->isWithoutDueDate) { |
||
854 | throw new ProcessEngineException("Invalid query usage: cannot set both dueDate and withoutDueDate filters."); |
||
855 | } |
||
856 | } |
||
857 | |||
858 | $this->dueDate = $dueDate; |
||
859 | unset($this->expressions["dueDate"]); |
||
860 | return $this; |
||
861 | } |
||
862 | |||
863 | public function dueDateExpression(string $dueDateExpression): TaskQueryInterface |
||
864 | { |
||
865 | // The dueDateExpression filter can't be used in an AND query with |
||
866 | // the withoutDueDate filter. They can be combined in an OR query |
||
867 | if (!$this->isOrQueryActive) { |
||
868 | if ($this->isWithoutDueDate) { |
||
869 | throw new ProcessEngineException("Invalid query usage: cannot set both dueDateExpression and withoutDueDate filters."); |
||
870 | } |
||
871 | } |
||
872 | |||
873 | $this->expressions["dueDate"] = $dueDateExpression; |
||
874 | return $this; |
||
875 | } |
||
876 | |||
877 | public function dueBefore(string $dueBefore): TaskQueryInterface |
||
878 | { |
||
879 | // The dueBefore filter can't be used in an AND query with |
||
880 | // the withoutDueDate filter. They can be combined in an OR query |
||
881 | if (!$this->isOrQueryActive) { |
||
882 | if ($this->isWithoutDueDate) { |
||
883 | throw new ProcessEngineException("Invalid query usage: cannot set both dueBefore and withoutDueDate filters."); |
||
884 | } |
||
885 | } |
||
886 | |||
887 | $this->dueBefore = $dueBefore; |
||
888 | unset($this->expressions["dueBefore"]); |
||
889 | return $this; |
||
890 | } |
||
891 | |||
892 | public function dueBeforeExpression(string $dueDate): TaskQueryInterface |
||
893 | { |
||
894 | // The dueBeforeExpression filter can't be used in an AND query with |
||
895 | // the withoutDueDate filter. They can be combined in an OR query |
||
896 | if (!$this->isOrQueryActive) { |
||
897 | if ($this->isWithoutDueDate) { |
||
898 | throw new ProcessEngineException("Invalid query usage: cannot set both dueBeforeExpression and withoutDueDate filters."); |
||
899 | } |
||
900 | } |
||
901 | |||
902 | $this->expressions["dueBefore"] = $dueDate; |
||
903 | return $this; |
||
904 | } |
||
905 | |||
906 | public function dueAfter(string $dueAfter): TaskQueryInterface |
||
907 | { |
||
908 | // The dueAfter filter can't be used in an AND query with |
||
909 | // the withoutDueDate filter. They can be combined in an OR query |
||
910 | if (!$this->isOrQueryActive) { |
||
911 | if ($this->isWithoutDueDate) { |
||
912 | throw new ProcessEngineException("Invalid query usage: cannot set both dueAfter and withoutDueDate filters."); |
||
913 | } |
||
914 | } |
||
915 | |||
916 | $this->dueAfter = $dueAfter; |
||
917 | unset($this->expressions["dueAfter"]); |
||
918 | return $this; |
||
919 | } |
||
920 | |||
921 | public function dueAfterExpression(string $dueDateExpression): TaskQueryInterface |
||
922 | { |
||
923 | // The dueAfterExpression filter can't be used in an AND query with |
||
924 | // the withoutDueDate filter. They can be combined in an OR query |
||
925 | if (!$this->isOrQueryActive) { |
||
926 | if ($this->isWithoutDueDate) { |
||
927 | throw new ProcessEngineException("Invalid query usage: cannot set both dueAfterExpression and withoutDueDate filters."); |
||
928 | } |
||
929 | } |
||
930 | |||
931 | $this->expressions["dueAfter"] = $dueDateExpression; |
||
932 | return $this; |
||
933 | } |
||
934 | |||
935 | public function withoutDueDate(): TaskQueryInterface |
||
936 | { |
||
937 | // The due date filters can't be used in an AND query with |
||
938 | // the withoutDueDate filter. They can be combined in an OR query |
||
939 | if (!$this->isOrQueryActive) { |
||
940 | if ( |
||
941 | $this->dueAfter !== null || |
||
942 | $this->dueBefore !== null || |
||
943 | $this->dueDate !== null || |
||
944 | array_key_exists("dueDate", $this->expressions) || |
||
945 | array_key_exists("dueBefore", $this->expressions) || |
||
946 | array_key_exists("dueAfter", $this->expressions) |
||
947 | ) { |
||
948 | throw new ProcessEngineException("Invalid query usage: cannot set both due date (equal to, before, or after) and withoutDueDate filters."); |
||
949 | } |
||
950 | } |
||
951 | |||
952 | $this->isWithoutDueDate = true; |
||
953 | return $this; |
||
954 | } |
||
955 | |||
956 | public function followUpDate(string $followUpDate): TaskQueryInterface |
||
957 | { |
||
958 | $this->followUpDate = $followUpDate; |
||
959 | unset($this->expressions["followUpDate"]); |
||
960 | return $this; |
||
961 | } |
||
962 | |||
963 | public function followUpDateExpression(string $followUpDateExpression): TaskQueryInterface |
||
964 | { |
||
965 | $this->expressions["followUpDate"] = $followUpDateExpression; |
||
966 | return $this; |
||
967 | } |
||
968 | |||
969 | public function followUpBefore(string $followUpBefore): TaskQueryInterface |
||
970 | { |
||
971 | $this->followUpBefore = $followUpBefore; |
||
972 | $this->followUpNullAccepted = false; |
||
973 | unset($this->expressions["followUpBefore"]); |
||
974 | return $this; |
||
975 | } |
||
976 | |||
977 | public function followUpBeforeExpression(string $followUpBeforeExpression): TaskQueryInterface |
||
978 | { |
||
979 | $this->followUpNullAccepted = false; |
||
980 | $this->expressions["followUpBefore"] = $followUpBeforeExpression; |
||
981 | return $this; |
||
982 | } |
||
983 | |||
984 | public function followUpBeforeOrNotExistent(string $followUpDate): TaskQueryInterface |
||
985 | { |
||
986 | $this->followUpBefore = $followUpDate; |
||
987 | $this->followUpNullAccepted = true; |
||
988 | unset($this->expressions["followUpBeforeOrNotExistent"]); |
||
989 | return $this; |
||
990 | } |
||
991 | |||
992 | public function followUpBeforeOrNotExistentExpression(string $followUpDateExpression): TaskQueryInterface |
||
993 | { |
||
994 | $this->expressions["followUpBeforeOrNotExistent"] = $followUpDateExpression; |
||
995 | $this->followUpNullAccepted = true; |
||
996 | return $this; |
||
997 | } |
||
998 | |||
999 | public function setFollowUpNullAccepted(bool $followUpNullAccepted): void |
||
1000 | { |
||
1001 | $this->followUpNullAccepted = $followUpNullAccepted; |
||
1002 | } |
||
1003 | |||
1004 | public function followUpAfter(string $followUpAfter): TaskQueryInterface |
||
1005 | { |
||
1006 | $this->followUpAfter = $followUpAfter; |
||
1007 | unset($this->expressions["followUpAfter"]); |
||
1008 | return $this; |
||
1009 | } |
||
1010 | |||
1011 | public function followUpAfterExpression(string $followUpAfterExpression): TaskQueryInterface |
||
1012 | { |
||
1013 | $this->expressions["followUpAfter"] = $followUpAfterExpression; |
||
1014 | return $this; |
||
1015 | } |
||
1016 | |||
1017 | public function excludeSubtasks(): TaskQueryInterface |
||
1018 | { |
||
1019 | $this->excludeSubtasks = true; |
||
1020 | return $this; |
||
1021 | } |
||
1022 | |||
1023 | public function active(): TaskQueryInterface |
||
1024 | { |
||
1025 | $this->suspensionState = SuspensionState::active(); |
||
1026 | return $this; |
||
1027 | } |
||
1028 | |||
1029 | public function suspended(): TaskQueryInterface |
||
1030 | { |
||
1031 | $this->suspensionState = SuspensionState::suspended(); |
||
1032 | return $this; |
||
1033 | } |
||
1034 | |||
1035 | public function initializeFormKeys(): TaskQueryInterface |
||
1036 | { |
||
1037 | if ($this->isOrQueryActive) { |
||
1038 | throw new ProcessEngineException("Invalid query usage: cannot set initializeFormKeys() within 'or' query"); |
||
1039 | } |
||
1040 | |||
1041 | $this->initializeFormKeys = true; |
||
1042 | return $this; |
||
1043 | } |
||
1044 | |||
1045 | public function taskNameCaseInsensitive(): TaskQueryInterface |
||
1046 | { |
||
1047 | $this->taskNameCaseInsensitive = true; |
||
1048 | return $this; |
||
1049 | } |
||
1050 | |||
1051 | protected function hasExcludingConditions(): bool |
||
1052 | { |
||
1053 | return parent::hasExcludingConditions() |
||
1054 | || CompareUtil::areNotInAscendingOrder($this->minPriority, $this->priority, $this->maxPriority) |
||
1055 | || CompareUtil::areNotInAscendingOrder($this->dueAfter, $this->dueDate, $this->dueBefore) |
||
1056 | || CompareUtil::areNotInAscendingOrder($this->followUpAfter, $this->followUpDate, $this->followUpBefore) |
||
1057 | || CompareUtil::areNotInAscendingOrder($this->createTimeAfter, $this->createTime, $this->createTimeBefore) |
||
1058 | || CompareUtil::elementIsNotContainedInArray($this->key, $this->taskDefinitionKeys) |
||
1059 | || CompareUtil::elementIsNotContainedInArray($this->processDefinitionKey, $this->processDefinitionKeys) |
||
1060 | || CompareUtil::elementIsNotContainedInArray($this->processInstanceBusinessKey, $this->processInstanceBusinessKeys); |
||
1061 | } |
||
1062 | |||
1063 | public function getCandidateGroups(): array |
||
1064 | { |
||
1065 | if (!empty($this->cachedCandidateGroups)) { |
||
1066 | return $this->cachedCandidateGroups; |
||
1067 | } |
||
1068 | |||
1069 | if ($this->candidateGroup !== null && !empty($this->candidateGroups)) { |
||
1070 | $this->cachedCandidateGroups = $this->candidateGroups; |
||
1071 | if (!$this->isOrQueryActive) { |
||
1072 | // get intersection of candidateGroups and candidateGroup |
||
1073 | $this->cachedCandidateGroups = array_intersect($this->cachedCandidateGroups, [$this->candidateGroup]); |
||
1074 | } else { |
||
1075 | // get union of candidateGroups and candidateGroup |
||
1076 | if (!in_array($this->candidateGroup, $this->candidateGroups)) { |
||
1077 | $this->cachedCandidateGroups[] = $this->candidateGroup; |
||
1078 | } |
||
1079 | } |
||
1080 | } elseif ($this->candidateGroup !== null) { |
||
1081 | $this->cachedCandidateGroups = [$this->candidateGroup]; |
||
1082 | } elseif (!empty($this->candidateGroups)) { |
||
1083 | $this->cachedCandidateGroups = $this->candidateGroups; |
||
1084 | } |
||
1085 | |||
1086 | if ($this->candidateUser !== null) { |
||
1087 | $groupsForCandidateUser = $this->getGroupsForCandidateUser($this->candidateUser); |
||
1088 | |||
1089 | if (empty($this->cachedCandidateGroups)) { |
||
1090 | $this->cachedCandidateGroups = $groupsForCandidateUser; |
||
1091 | } else { |
||
1092 | foreach ($groupsForCandidateUser as $group) { |
||
1093 | if (!in_array($group, $this->cachedCandidateGroups)) { |
||
1094 | $this->cachedCandidateGroups[] = $group; |
||
1095 | } |
||
1096 | } |
||
1097 | } |
||
1098 | } |
||
1099 | |||
1100 | return $this->cachedCandidateGroups; |
||
1101 | } |
||
1102 | |||
1103 | public function isWithCandidateGroups(): bool |
||
1104 | { |
||
1105 | if ($this->withCandidateGroups === null) { |
||
1106 | return false; |
||
1107 | } else { |
||
1108 | return $this->withCandidateGroups; |
||
1109 | } |
||
1110 | } |
||
1111 | |||
1112 | public function isWithCandidateUsers(): bool |
||
1113 | { |
||
1114 | if ($this->withCandidateUsers === null) { |
||
1115 | return false; |
||
1116 | } else { |
||
1117 | return $this->withCandidateUsers; |
||
1118 | } |
||
1119 | } |
||
1120 | |||
1121 | public function isWithCandidateGroupsInternal(): bool |
||
1122 | { |
||
1123 | return $this->withCandidateGroups; |
||
1124 | } |
||
1125 | |||
1126 | public function isWithoutCandidateGroups(): bool |
||
1127 | { |
||
1128 | if ($this->withoutCandidateGroups === null) { |
||
1129 | return false; |
||
1130 | } else { |
||
1131 | return $this->withoutCandidateGroups; |
||
1132 | } |
||
1133 | } |
||
1134 | |||
1135 | public function isWithoutCandidateUsers(): bool |
||
1136 | { |
||
1137 | if ($this->withoutCandidateUsers === null) { |
||
1138 | return false; |
||
1139 | } else { |
||
1140 | return $this->withoutCandidateUsers; |
||
1141 | } |
||
1142 | } |
||
1143 | |||
1144 | public function isWithoutCandidateGroupsInternal(): bool |
||
1145 | { |
||
1146 | return $this->withoutCandidateGroups; |
||
1147 | } |
||
1148 | |||
1149 | public function getCandidateGroupsInternal(): array |
||
1150 | { |
||
1151 | return $this->candidateGroups; |
||
1152 | } |
||
1153 | |||
1154 | protected function getGroupsForCandidateUser(string $candidateUser): array |
||
1155 | { |
||
1156 | $cachedUserGroups = $this->getCachedUserGroups(); |
||
1157 | if (array_key_exists($candidateUser, $cachedUserGroups)) { |
||
1158 | return $cachedUserGroups[$candidateUser]; |
||
1159 | } |
||
1160 | |||
1161 | $groups = Context::getCommandContext() |
||
1162 | ->getReadOnlyIdentityProvider() |
||
1163 | ->createGroupQuery() |
||
1164 | ->groupMember($candidateUser) |
||
1165 | ->list(); |
||
1166 | |||
1167 | $groupIds = []; |
||
1168 | foreach ($groups as $group) { |
||
1169 | $groupIds[] = $group->getId(); |
||
1170 | } |
||
1171 | |||
1172 | $this->setCachedUserGroup($candidateUser, $groupIds); |
||
1173 | |||
1174 | return $groupIds; |
||
1175 | } |
||
1176 | |||
1177 | protected function getCachedUserGroups(): array |
||
1178 | { |
||
1179 | // store and retrieve cached user groups always from the first query |
||
1180 | if ($this->queries[0]->cachedUserGroups === null) { |
||
1181 | $this->queries[0]->cachedUserGroups = []; |
||
1182 | } |
||
1183 | return $this->queries[0]->cachedUserGroups; |
||
1184 | } |
||
1185 | |||
1186 | protected function setCachedUserGroup(string $candidateUser, array $groupIds): void |
||
1187 | { |
||
1188 | $this->getCachedUserGroups(); |
||
1189 | $this->queries[0]->cachedUserGroups[$candidateUser] = $groupIds; |
||
1190 | } |
||
1191 | |||
1192 | protected function ensureOrExpressionsEvaluated(): void |
||
1193 | { |
||
1194 | // skips first query as it has already been evaluated |
||
1195 | for ($i = 1; $i < count($this->queries); $i += 1) { |
||
1196 | $this->queries[$i]->validate(); |
||
1197 | $this->queries[$i]->evaluateExpressions(); |
||
1198 | } |
||
1199 | } |
||
1200 | |||
1201 | protected function ensureVariablesInitialized(): void |
||
1202 | { |
||
1203 | $processEngineConfiguration = Context::getProcessEngineConfiguration(); |
||
1204 | $variableSerializers = $processEngineConfiguration->getVariableSerializers(); |
||
1205 | $dbType = $processEngineConfiguration->getDatabaseType(); |
||
1206 | foreach ($this->variables as $var) { |
||
1207 | $var->initialize($variableSerializers, $dbType); |
||
1208 | } |
||
1209 | |||
1210 | if (!empty($this->queries)) { |
||
1211 | foreach ($this->queries as $orQuery) { |
||
1212 | foreach ($orQuery->variables as $var) { |
||
1213 | $var->initialize($variableSerializers, $dbType); |
||
1214 | } |
||
1215 | } |
||
1216 | } |
||
1217 | } |
||
1218 | |||
1219 | public function addVariable($name, $value = null, string $operator = null, bool $isTaskVariable = null, bool $isProcessInstanceVariable = null): void |
||
1220 | { |
||
1221 | if ($name instanceof TaskQueryVariableValue) { |
||
1222 | $this->variables[] = $name; |
||
1223 | } else { |
||
1224 | EnsureUtil::ensureNotNull("name", "name", $name); |
||
1225 | |||
1226 | if ($value === null || $this->isBoolean($value)) { |
||
1227 | // Null-values and booleans can only be used in EQUALS and NOT_EQUALS |
||
1228 | switch ($operator) { |
||
1229 | case QueryOperator::GREATER_THAN: |
||
1230 | throw new ProcessEngineException("Booleans and null cannot be used in 'greater than' condition"); |
||
1231 | case QueryOperator::LESS_THAN: |
||
1232 | throw new ProcessEngineException("Booleans and null cannot be used in 'less than' condition"); |
||
1233 | case QueryOperator::GREATER_THAN_OR_EQUAL: |
||
1234 | throw new ProcessEngineException("Booleans and null cannot be used in 'greater than or equal' condition"); |
||
1235 | case QueryOperator::LESS_THAN_OR_EQUAL: |
||
1236 | throw new ProcessEngineException("Booleans and null cannot be used in 'less than or equal' condition"); |
||
1237 | case QueryOperator::LIKE: |
||
1238 | throw new ProcessEngineException("Booleans and null cannot be used in 'like' condition"); |
||
1239 | case QueryOperator::NOT_LIKE: |
||
1240 | throw new ProcessEngineException("Booleans and null cannot be used in 'not like' condition"); |
||
1241 | default: |
||
1242 | break; |
||
1243 | } |
||
1244 | } |
||
1245 | |||
1246 | $shouldMatchVariableValuesIgnoreCase = $variableValuesIgnoreCase == true && $value !== null && is_string($value); |
||
1247 | $this->addVariable(new TaskQueryVariableValue($name, $value, $operator, $isTaskVariable, $isProcessInstanceVariable, $this->variableNamesIgnoreCase == true, $shouldMatchVariableValuesIgnoreCase)); |
||
1248 | } |
||
1249 | } |
||
1250 | |||
1251 | private function isBoolean($value = null): bool |
||
1252 | { |
||
1253 | if ($value === null) { |
||
1254 | return false; |
||
1255 | } |
||
1256 | return is_bool($value) || strtolower($value) == "true" || strtolower($value) == "false"; |
||
1257 | } |
||
1258 | |||
1259 | //ordering //////////////////////////////////////////////////////////////// |
||
1260 | |||
1261 | public function orderByTaskId(): TaskQueryInterface |
||
1262 | { |
||
1263 | if ($this->isOrQueryActive) { |
||
1264 | throw new ProcessEngineException("Invalid query usage: cannot set orderByTaskId() within 'or' query"); |
||
1265 | } |
||
1266 | |||
1267 | return $this->orderBy(TaskQueryProperty::taskId()); |
||
1268 | } |
||
1269 | |||
1270 | public function orderByTaskName(): TaskQueryInterface |
||
1271 | { |
||
1272 | if ($this->isOrQueryActive) { |
||
1273 | throw new ProcessEngineException("Invalid query usage: cannot set orderByTaskName() within 'or' query"); |
||
1274 | } |
||
1275 | |||
1276 | return $this->orderBy(TaskQueryProperty::name()); |
||
1277 | } |
||
1278 | |||
1279 | public function orderByTaskNameCaseInsensitive(): TaskQueryInterface |
||
1280 | { |
||
1281 | if ($this->isOrQueryActive) { |
||
1282 | throw new ProcessEngineException("Invalid query usage: cannot set orderByTaskNameCaseInsensitive() within 'or' query"); |
||
1283 | } |
||
1284 | |||
1285 | $this->taskNameCaseInsensitive(); |
||
1286 | return $this->orderBy(TaskQueryProperty::nameCaseInsensitive()); |
||
1287 | } |
||
1288 | |||
1289 | public function orderByTaskDescription(): TaskQueryInterface |
||
1290 | { |
||
1291 | if ($this->isOrQueryActive) { |
||
1292 | throw new ProcessEngineException("Invalid query usage: cannot set orderByTaskDescription() within 'or' query"); |
||
1293 | } |
||
1294 | |||
1295 | return $this->orderBy(TaskQueryProperty::description()); |
||
1296 | } |
||
1297 | |||
1298 | public function orderByTaskPriority(): TaskQueryInterface |
||
1299 | { |
||
1300 | if ($this->isOrQueryActive) { |
||
1301 | throw new ProcessEngineException("Invalid query usage: cannot set orderByTaskPriority() within 'or' query"); |
||
1302 | } |
||
1303 | |||
1304 | return $this->orderBy(TaskQueryProperty::priority()); |
||
1305 | } |
||
1306 | |||
1307 | public function orderByProcessInstanceId(): TaskQueryInterface |
||
1308 | { |
||
1309 | if ($this->isOrQueryActive) { |
||
1310 | throw new ProcessEngineException("Invalid query usage: cannot set orderByProcessInstanceId() within 'or' query"); |
||
1311 | } |
||
1312 | |||
1313 | return $this->orderBy(TaskQueryProperty::processInstanceId()); |
||
1314 | } |
||
1315 | |||
1316 | /*public function orderByCaseInstanceId(): TaskQueryInterface |
||
1317 | { |
||
1318 | if ($this->isOrQueryActive) { |
||
1319 | throw new ProcessEngineException("Invalid query usage: cannot set orderByCaseInstanceId() within 'or' query"); |
||
1320 | } |
||
1321 | |||
1322 | return $this->orderBy(TaskQueryProperty::caseInstanceId()); |
||
1323 | }*/ |
||
1324 | |||
1325 | public function orderByExecutionId(): TaskQueryInterface |
||
1326 | { |
||
1327 | if ($this->isOrQueryActive) { |
||
1328 | throw new ProcessEngineException("Invalid query usage: cannot set orderByExecutionId() within 'or' query"); |
||
1329 | } |
||
1330 | |||
1331 | return $this->orderBy(TaskQueryProperty::executionId()); |
||
1332 | } |
||
1333 | |||
1334 | public function orderByTenantId(): TaskQueryInterface |
||
1335 | { |
||
1336 | if ($this->isOrQueryActive) { |
||
1337 | throw new ProcessEngineException("Invalid query usage: cannot set orderByTenantId() within 'or' query"); |
||
1338 | } |
||
1339 | |||
1340 | return $this->orderBy(TaskQueryProperty::tenantId()); |
||
1341 | } |
||
1342 | |||
1343 | public function orderByCaseExecutionId(): TaskQueryInterface |
||
1344 | { |
||
1345 | if ($this->isOrQueryActive) { |
||
1346 | throw new ProcessEngineException("Invalid query usage: cannot set orderByCaseExecutionId() within 'or' query"); |
||
1347 | } |
||
1348 | |||
1349 | return $this->orderBy(TaskQueryProperty::caseExecutionId()); |
||
1350 | } |
||
1351 | |||
1352 | public function orderByTaskAssignee(): TaskQueryInterface |
||
1353 | { |
||
1354 | if ($this->isOrQueryActive) { |
||
1355 | throw new ProcessEngineException("Invalid query usage: cannot set orderByTaskAssignee() within 'or' query"); |
||
1356 | } |
||
1357 | |||
1358 | return $this->orderBy(TaskQueryProperty::assignee()); |
||
1359 | } |
||
1360 | |||
1361 | public function orderByTaskCreateTime(): TaskQueryInterface |
||
1362 | { |
||
1363 | if ($this->isOrQueryActive) { |
||
1364 | throw new ProcessEngineException("Invalid query usage: cannot set orderByTaskCreateTime() within 'or' query"); |
||
1365 | } |
||
1366 | |||
1367 | return $this->orderBy(TaskQueryProperty::createTime()); |
||
1368 | } |
||
1369 | |||
1370 | public function orderByDueDate(): TaskQueryInterface |
||
1371 | { |
||
1372 | if ($this->isOrQueryActive) { |
||
1373 | throw new ProcessEngineException("Invalid query usage: cannot set orderByDueDate() within 'or' query"); |
||
1374 | } |
||
1375 | |||
1376 | return $this->orderBy(TaskQueryProperty::dueDate()); |
||
1377 | } |
||
1378 | |||
1379 | public function orderByFollowUpDate(): TaskQueryInterface |
||
1380 | { |
||
1381 | if ($this->isOrQueryActive) { |
||
1382 | throw new ProcessEngineException("Invalid query usage: cannot set orderByFollowUpDate() within 'or' query"); |
||
1383 | } |
||
1384 | |||
1385 | return $this->orderBy(TaskQueryProperty::followUpDate()); |
||
1386 | } |
||
1387 | |||
1388 | public function orderByProcessVariable(string $variableName, ValueTypeInterface $valueType): TaskQueryInterface |
||
1389 | { |
||
1390 | if ($this->isOrQueryActive) { |
||
1391 | throw new ProcessEngineException("Invalid query usage: cannot set orderByProcessVariable() within 'or' query"); |
||
1392 | } |
||
1393 | |||
1394 | EnsureUtil::ensureNotNull("variableName", "variableName", $variableName); |
||
1395 | EnsureUtil::ensureNotNull("valueType", "valueType", $valueType); |
||
1396 | |||
1397 | $this->orderBy(VariableOrderProperty::forProcessInstanceVariable($variableName, $valueType)); |
||
1398 | return $this; |
||
1399 | } |
||
1400 | |||
1401 | public function orderByExecutionVariable(string $variableName, ValueTypeInterface $valueType): TaskQueryInterface |
||
1402 | { |
||
1403 | if ($this->isOrQueryActive) { |
||
1404 | throw new ProcessEngineException("Invalid query usage: cannot set orderByExecutionVariable() within 'or' query"); |
||
1405 | } |
||
1406 | |||
1407 | EnsureUtil::ensureNotNull("variableName", "variableName", $variableName); |
||
1408 | EnsureUtil::ensureNotNull("valueType", "valueType", $valueType); |
||
1409 | |||
1410 | $this->orderBy(VariableOrderProperty::forExecutionVariable($variableName, $valueType)); |
||
1411 | return $this; |
||
1412 | } |
||
1413 | |||
1414 | public function orderByTaskVariable(string $variableName, ValueTypeInterface $valueType): TaskQueryInterface |
||
1415 | { |
||
1416 | if ($this->isOrQueryActive) { |
||
1417 | throw new ProcessEngineException("Invalid query usage: cannot set orderByTaskVariable() within 'or' query"); |
||
1418 | } |
||
1419 | |||
1420 | EnsureUtil::ensureNotNull("variableName", "variableName", $variableName); |
||
1421 | EnsureUtil::ensureNotNull("valueType", "valueType", $valueType); |
||
1422 | |||
1423 | $this->orderBy(VariableOrderProperty::forTaskVariable($variableName, $valueType)); |
||
1424 | return $this; |
||
1425 | } |
||
1426 | |||
1427 | public function orderByCaseExecutionVariable(string $variableName, ValueTypeInterface $valueType): TaskQueryInterface |
||
1428 | { |
||
1429 | if ($this->isOrQueryActive) { |
||
1430 | throw new ProcessEngineException("Invalid query usage: cannot set orderByCaseExecutionVariable() within 'or' query"); |
||
1431 | } |
||
1432 | |||
1433 | EnsureUtil::ensureNotNull("variableName", "variableName", $variableName); |
||
1434 | EnsureUtil::ensureNotNull("valueType", "valueType", $valueType); |
||
1435 | |||
1436 | $this->orderBy(VariableOrderProperty::forCaseExecutionVariable($variableName, $valueType)); |
||
1437 | return $this; |
||
1438 | } |
||
1439 | |||
1440 | public function orderByCaseInstanceVariable(string $variableName, ValueTypeInterface $valueType): TaskQueryInterface |
||
1441 | { |
||
1442 | if ($this->isOrQueryActive) { |
||
1443 | throw new ProcessEngineException("Invalid query usage: cannot set orderByCaseInstanceVariable() within 'or' query"); |
||
1444 | } |
||
1445 | |||
1446 | EnsureUtil::ensureNotNull("variableName", "variableName", $variableName); |
||
1447 | EnsureUtil::ensureNotNull("valueType", "valueType", $valueType); |
||
1448 | |||
1449 | $this->orderBy(VariableOrderProperty::forCaseInstanceVariable($variableName, $valueType)); |
||
1450 | return $this; |
||
1451 | } |
||
1452 | |||
1453 | //results //////////////////////////////////////////////////////////////// |
||
1454 | |||
1455 | public function executeList(CommandContext $commandContext, Page $page): array |
||
1456 | { |
||
1457 | $this->ensureOrExpressionsEvaluated(); |
||
1458 | $this->ensureVariablesInitialized(); |
||
1459 | $this->checkQueryOk(); |
||
1460 | |||
1461 | $this->resetCachedCandidateGroups(); |
||
1462 | |||
1463 | //check if candidateGroup and candidateGroups intersect |
||
1464 | if ($this->getCandidateGroup() !== null && $this->getCandidateGroupsInternal() !== null && empty($this->getCandidateGroups())) { |
||
1465 | return []; |
||
1466 | } |
||
1467 | |||
1468 | $this->decideAuthorizationJoinType($commandContext); |
||
1469 | |||
1470 | $taskList = $commandContext |
||
1471 | ->getTaskManager() |
||
1472 | ->findTasksByQueryCriteria($this); |
||
1473 | |||
1474 | if ($this->initializeFormKeys) { |
||
1475 | foreach ($taskList as $task) { |
||
1476 | // initialize the form keys of the tasks |
||
1477 | $task->initializeFormKey(); |
||
1478 | } |
||
1479 | } |
||
1480 | |||
1481 | return $taskList; |
||
1482 | } |
||
1483 | |||
1484 | public function executeCount(CommandContext $commandContext): int |
||
1485 | { |
||
1486 | $this->ensureOrExpressionsEvaluated(); |
||
1487 | $this->ensureVariablesInitialized(); |
||
1488 | $this->checkQueryOk(); |
||
1489 | |||
1490 | $this->resetCachedCandidateGroups(); |
||
1491 | |||
1492 | //check if candidateGroup and candidateGroups intersect |
||
1493 | if ($this->getCandidateGroup() !== null && $this->getCandidateGroupsInternal() !== null && empty($this->getCandidateGroups())) { |
||
1494 | return 0; |
||
1495 | } |
||
1496 | |||
1497 | $this->decideAuthorizationJoinType($commandContext); |
||
1498 | |||
1499 | return $commandContext |
||
1500 | ->getTaskManager() |
||
1501 | ->findTaskCountByQueryCriteria($this); |
||
1502 | } |
||
1503 | |||
1504 | protected function decideAuthorizationJoinType(CommandContext $commandContext): void |
||
1505 | { |
||
1506 | //$cmmnEnabled = commandContext->getProcessEngineConfiguration()->isCmmnEnabled(); |
||
1507 | $cmmnEnabled = false; |
||
1508 | $this->authCheck->setUseLeftJoin($cmmnEnabled); |
||
1509 | } |
||
1510 | |||
1511 | protected function resetCachedCandidateGroups(): void |
||
1512 | { |
||
1513 | $this->cachedCandidateGroups = null; |
||
1514 | for ($i = 1; $i < count($this->queries); $i += 1) { |
||
1515 | $this->queries[$i]->cachedCandidateGroups = null; |
||
1516 | } |
||
1517 | } |
||
1518 | |||
1519 | //getters //////////////////////////////////////////////////////////////// |
||
1520 | |||
1521 | public function getName(): string |
||
1522 | { |
||
1523 | return $this->name; |
||
1524 | } |
||
1525 | |||
1526 | public function getNameNotEqual(): string |
||
1527 | { |
||
1528 | return $this->nameNotEqual; |
||
1529 | } |
||
1530 | |||
1531 | public function getNameLike(): string |
||
1532 | { |
||
1533 | return $this->nameLike; |
||
1534 | } |
||
1535 | |||
1536 | public function getNameNotLike(): string |
||
1537 | { |
||
1538 | return $this->nameNotLike; |
||
1539 | } |
||
1540 | |||
1541 | public function getAssignee(): string |
||
1542 | { |
||
1543 | return $this->assignee; |
||
1544 | } |
||
1545 | |||
1546 | public function getAssigneeLike(): string |
||
1547 | { |
||
1548 | return $this->assigneeLike; |
||
1549 | } |
||
1550 | |||
1551 | public function getAssigneeIn(): array |
||
1552 | { |
||
1553 | return $this->assigneeIn; |
||
1554 | } |
||
1555 | |||
1556 | public function getAssigneeNotIn(): array |
||
1557 | { |
||
1558 | return $this->assigneeNotIn; |
||
1559 | } |
||
1560 | |||
1561 | public function getInvolvedUser(): string |
||
1562 | { |
||
1563 | return $this->involvedUser; |
||
1564 | } |
||
1565 | |||
1566 | public function getOwner(): string |
||
1567 | { |
||
1568 | return $this->owner; |
||
1569 | } |
||
1570 | |||
1571 | public function isAssigned(): bool |
||
1572 | { |
||
1573 | if ($this->assigned === null) { |
||
1574 | return false; |
||
1575 | } else { |
||
1576 | return $this->assigned; |
||
1577 | } |
||
1578 | } |
||
1579 | |||
1580 | public function isAssignedInternal(): bool |
||
1581 | { |
||
1582 | return $this->assigned; |
||
1583 | } |
||
1584 | |||
1585 | public function isUnassigned(): bool |
||
1586 | { |
||
1587 | if ($this->unassigned === null) { |
||
1588 | return false; |
||
1589 | } else { |
||
1590 | return $this->unassigned; |
||
1591 | } |
||
1592 | } |
||
1593 | |||
1594 | public function isUnassignedInternal(): bool |
||
1595 | { |
||
1596 | return $this->unassigned; |
||
1597 | } |
||
1598 | |||
1599 | public function getDelegationState(): string |
||
1600 | { |
||
1601 | return $this->delegationState; |
||
1602 | } |
||
1603 | |||
1604 | public function isNoDelegationState(): bool |
||
1605 | { |
||
1606 | return $this->noDelegationState; |
||
1607 | } |
||
1608 | |||
1609 | public function getDelegationStateString(): ?string |
||
1610 | { |
||
1611 | return $this->delegationState; |
||
1612 | } |
||
1613 | |||
1614 | public function getCandidateUser(): string |
||
1615 | { |
||
1616 | return $this->candidateUser; |
||
1617 | } |
||
1618 | |||
1619 | public function getCandidateGroup(): string |
||
1620 | { |
||
1621 | return $this->candidateGroup; |
||
1622 | } |
||
1623 | |||
1624 | public function isIncludeAssignedTasks(): bool |
||
1625 | { |
||
1626 | return !empty($this->includeAssignedTasks) ? $this->includeAssignedTasks : false; |
||
1627 | } |
||
1628 | |||
1629 | public function isIncludeAssignedTasksInternal(): bool |
||
1630 | { |
||
1631 | return $this->includeAssignedTasks; |
||
1632 | } |
||
1633 | |||
1634 | public function getProcessInstanceId(): string |
||
1635 | { |
||
1636 | return $this->processInstanceId; |
||
1637 | } |
||
1638 | |||
1639 | public function getProcessInstanceIdIn(): array |
||
1640 | { |
||
1641 | return $this->processInstanceIdIn; |
||
1642 | } |
||
1643 | |||
1644 | public function getExecutionId(): string |
||
1647 | } |
||
1648 | |||
1649 | public function getActivityInstanceIdIn(): array |
||
1650 | { |
||
1651 | return $this->activityInstanceIdIn; |
||
1652 | } |
||
1653 | |||
1654 | public function getTenantIds(): array |
||
1655 | { |
||
1656 | return $this->tenantIds; |
||
1657 | } |
||
1658 | |||
1659 | public function getTaskId(): string |
||
1660 | { |
||
1661 | return $this->taskId; |
||
1662 | } |
||
1663 | |||
1664 | public function getTaskIdIn(): array |
||
1665 | { |
||
1666 | return $this->taskIdIn; |
||
1667 | } |
||
1668 | |||
1669 | public function getDescription(): string |
||
1670 | { |
||
1671 | return $this->description; |
||
1672 | } |
||
1673 | |||
1674 | public function getDescriptionLike(): string |
||
1675 | { |
||
1676 | return $this->descriptionLike; |
||
1677 | } |
||
1678 | |||
1679 | public function getPriority(): int |
||
1680 | { |
||
1681 | return $this->priority; |
||
1682 | } |
||
1683 | |||
1684 | public function getMinPriority(): int |
||
1685 | { |
||
1686 | return $this->minPriority; |
||
1687 | } |
||
1688 | |||
1689 | public function getMaxPriority(): int |
||
1690 | { |
||
1691 | return $this->maxPriority; |
||
1692 | } |
||
1693 | |||
1694 | public function getCreateTime(): string |
||
1695 | { |
||
1696 | return $this->createTime; |
||
1697 | } |
||
1698 | |||
1699 | public function getCreateTimeBefore(): string |
||
1700 | { |
||
1701 | return $this->createTimeBefore; |
||
1702 | } |
||
1703 | |||
1704 | public function getCreateTimeAfter(): string |
||
1705 | { |
||
1706 | return $this->createTimeAfter; |
||
1707 | } |
||
1708 | |||
1709 | public function getKey(): string |
||
1710 | { |
||
1711 | return $this->key; |
||
1712 | } |
||
1713 | |||
1714 | public function getKeys(): array |
||
1715 | { |
||
1716 | return $this->taskDefinitionKeys; |
||
1717 | } |
||
1718 | |||
1719 | public function getKeyLike(): string |
||
1720 | { |
||
1721 | return $this->keyLike; |
||
1722 | } |
||
1723 | |||
1724 | public function getParentTaskId(): string |
||
1725 | { |
||
1726 | return $this->parentTaskId; |
||
1727 | } |
||
1728 | |||
1729 | public function getVariables(): array |
||
1730 | { |
||
1731 | return $this->variables; |
||
1732 | } |
||
1733 | |||
1734 | public function getProcessDefinitionKey(): string |
||
1735 | { |
||
1736 | return $this->processDefinitionKey; |
||
1737 | } |
||
1738 | |||
1739 | public function getProcessDefinitionKeys(): array |
||
1740 | { |
||
1741 | return $this->processDefinitionKeys; |
||
1742 | } |
||
1743 | |||
1744 | public function getProcessDefinitionId(): string |
||
1745 | { |
||
1746 | return $this->processDefinitionId; |
||
1747 | } |
||
1748 | |||
1749 | public function getProcessDefinitionName(): string |
||
1750 | { |
||
1751 | return $this->processDefinitionName; |
||
1752 | } |
||
1753 | |||
1754 | public function getProcessDefinitionNameLike(): string |
||
1755 | { |
||
1756 | return $this->processDefinitionNameLike; |
||
1757 | } |
||
1758 | |||
1759 | public function getProcessInstanceBusinessKey(): string |
||
1760 | { |
||
1761 | return $this->processInstanceBusinessKey; |
||
1762 | } |
||
1763 | |||
1764 | public function getProcessInstanceBusinessKeys(): array |
||
1765 | { |
||
1766 | return $this->processInstanceBusinessKeys; |
||
1767 | } |
||
1768 | |||
1769 | public function getProcessInstanceBusinessKeyLike(): string |
||
1770 | { |
||
1771 | return $this->processInstanceBusinessKeyLike; |
||
1772 | } |
||
1773 | |||
1774 | public function getDueDate(): string |
||
1775 | { |
||
1776 | return $this->dueDate; |
||
1777 | } |
||
1778 | |||
1779 | public function getDueBefore(): string |
||
1780 | { |
||
1781 | return $this->dueBefore; |
||
1782 | } |
||
1783 | |||
1784 | public function getDueAfter(): string |
||
1785 | { |
||
1786 | return $this->dueAfter; |
||
1787 | } |
||
1788 | |||
1789 | public function getFollowUpDate(): string |
||
1792 | } |
||
1793 | |||
1794 | public function getFollowUpBefore(): string |
||
1795 | { |
||
1796 | return $this->followUpBefore; |
||
1797 | } |
||
1798 | |||
1799 | public function getFollowUpAfter(): string |
||
1800 | { |
||
1801 | return $this->followUpAfter; |
||
1802 | } |
||
1803 | |||
1804 | public function isExcludeSubtasks(): bool |
||
1805 | { |
||
1806 | return $this->excludeSubtasks; |
||
1807 | } |
||
1808 | |||
1809 | public function getSuspensionState(): string |
||
1810 | { |
||
1811 | return $this->suspensionState; |
||
1812 | } |
||
1813 | |||
1814 | /*public String getCaseInstanceId() { |
||
1815 | return caseInstanceId; |
||
1816 | } |
||
1817 | |||
1818 | public String getCaseInstanceBusinessKey() { |
||
1819 | return caseInstanceBusinessKey; |
||
1820 | } |
||
1821 | |||
1822 | public String getCaseInstanceBusinessKeyLike() { |
||
1823 | return caseInstanceBusinessKeyLike; |
||
1824 | } |
||
1825 | |||
1826 | public String getCaseExecutionId() { |
||
1827 | return caseExecutionId; |
||
1828 | } |
||
1829 | |||
1830 | public String getCaseDefinitionId() { |
||
1831 | return caseDefinitionId; |
||
1832 | } |
||
1833 | |||
1834 | public String getCaseDefinitionKey() { |
||
1835 | return caseDefinitionKey; |
||
1836 | } |
||
1837 | |||
1838 | public String getCaseDefinitionName() { |
||
1839 | return caseDefinitionName; |
||
1840 | }*/ |
||
1841 | |||
1842 | /*public function getCaseDefinitionNameLike(): string |
||
1843 | { |
||
1844 | return $this->caseDefinitionNameLike; |
||
1845 | }*/ |
||
1846 | |||
1847 | public function isInitializeFormKeys(): bool |
||
1848 | { |
||
1849 | return $this->initializeFormKeys; |
||
1850 | } |
||
1851 | |||
1852 | public function isTaskNameCaseInsensitive(): bool |
||
1853 | { |
||
1854 | return $this->taskNameCaseInsensitive; |
||
1855 | } |
||
1856 | |||
1857 | public function isWithoutTenantId(): bool |
||
1858 | { |
||
1859 | return $this->isWithoutTenantId; |
||
1860 | } |
||
1861 | |||
1862 | public function isWithoutDueDate(): bool |
||
1863 | { |
||
1864 | return $this->isWithoutDueDate; |
||
1865 | } |
||
1866 | |||
1867 | public function getTaskDefinitionKeys(): array |
||
1868 | { |
||
1869 | return $this->taskDefinitionKeys; |
||
1870 | } |
||
1871 | |||
1872 | public function getIsTenantIdSet(): bool |
||
1873 | { |
||
1874 | return $this->isWithoutTenantId; |
||
1875 | } |
||
1876 | |||
1877 | public function isVariableNamesIgnoreCase(): bool |
||
1878 | { |
||
1879 | return $this->variableNamesIgnoreCase; |
||
1880 | } |
||
1881 | |||
1882 | public function isVariableValuesIgnoreCase(): bool |
||
1883 | { |
||
1884 | return $this->variableValuesIgnoreCase; |
||
1885 | } |
||
1886 | |||
1887 | public function getQueries(): array |
||
1888 | { |
||
1889 | return $this->queries; |
||
1890 | } |
||
1891 | |||
1892 | public function isOrQueryActive(): bool |
||
1893 | { |
||
1894 | return $this->isOrQueryActive; |
||
1895 | } |
||
1896 | |||
1897 | public function addOrQuery(TaskQueryImpl $orQuery): void |
||
1898 | { |
||
1899 | $orQuery->isOrQueryActive = true; |
||
1900 | $this->queries[] = $orQuery; |
||
1901 | } |
||
1902 | |||
1903 | public function setOrQueryActive(): void |
||
1904 | { |
||
1905 | $this->isOrQueryActive = true; |
||
1906 | } |
||
1907 | |||
1908 | public function extend(TaskQueryInterface $extending): TaskQueryInterface |
||
1909 | { |
||
1910 | $extendingQuery = $extending; |
||
1911 | $extendedQuery = new TaskQueryImpl(); |
||
1912 | |||
1913 | // only add the base query's validators to the new query; |
||
1914 | // this is because the extending query's validators may not be applicable to the base |
||
1915 | // query and should therefore be executed before extending the query |
||
1916 | $extendedQuery->validators = $this->validators; |
||
1917 | |||
1918 | if ($extendingQuery->getName() !== null) { |
||
1919 | $extendedQuery->taskName($extendingQuery->getName()); |
||
1920 | } elseif ($this->getName() !== null) { |
||
1921 | $extendedQuery->taskName($this->getName()); |
||
1922 | } |
||
1923 | |||
1924 | if ($extendingQuery->getNameLike() !== null) { |
||
1925 | $extendedQuery->taskNameLike($extendingQuery->getNameLike()); |
||
1926 | } elseif ($this->getNameLike() !== null) { |
||
1927 | $extendedQuery->taskNameLike($this->getNameLike()); |
||
1928 | } |
||
1929 | |||
1930 | if ($extendingQuery->getNameNotEqual() !== null) { |
||
1931 | $extendedQuery->taskNameNotEqual($extendingQuery->getNameNotEqual()); |
||
1932 | } elseif ($this->getNameNotEqual() !== null) { |
||
1933 | $extendedQuery->taskNameNotEqual($this->getNameNotEqual()); |
||
1934 | } |
||
1935 | |||
1936 | if ($extendingQuery->getNameNotLike() !== null) { |
||
1937 | $extendedQuery->taskNameNotLike($extendingQuery->getNameNotLike()); |
||
1938 | } elseif ($this->getNameNotLike() !== null) { |
||
1939 | $extendedQuery->taskNameNotLike($this->getNameNotLike()); |
||
1940 | } |
||
1941 | |||
1942 | if ($extendingQuery->getAssignee() !== null) { |
||
1943 | $extendedQuery->taskAssignee($extendingQuery->getAssignee()); |
||
1944 | } elseif ($this->getAssignee() !== null) { |
||
1945 | $extendedQuery->taskAssignee($this->getAssignee()); |
||
1946 | } |
||
1947 | |||
1948 | if ($extendingQuery->getAssigneeLike() !== null) { |
||
1949 | $extendedQuery->taskAssigneeLike($extendingQuery->getAssigneeLike()); |
||
1950 | } elseif ($this->getAssigneeLike() !== null) { |
||
1951 | $extendedQuery->taskAssigneeLike($this->getAssigneeLike()); |
||
1952 | } |
||
1953 | |||
1954 | if ($extendingQuery->getAssigneeIn() !== null) { |
||
1955 | $extendedQuery->taskAssigneeIn($extendingQuery->getAssigneeIn()); |
||
1956 | } elseif ($this->getAssigneeIn() !== null) { |
||
1957 | $extendedQuery->taskAssigneeIn($this->getAssigneeIn()); |
||
1958 | } |
||
1959 | if ($extendingQuery->getAssigneeNotIn() !== null) { |
||
1960 | $extendedQuery->taskAssigneeNotIn($extendingQuery->getAssigneeNotIn()); |
||
1961 | } elseif ($this->getAssigneeNotIn() !== null) { |
||
1962 | $extendedQuery->taskAssigneeNotIn($this->getAssigneeNotIn()); |
||
1963 | } |
||
1964 | |||
1965 | if ($extendingQuery->getInvolvedUser() !== null) { |
||
1966 | $extendedQuery->taskInvolvedUser($extendingQuery->getInvolvedUser()); |
||
1967 | } elseif ($this->getInvolvedUser() !== null) { |
||
1968 | $extendedQuery->taskInvolvedUser($this->getInvolvedUser()); |
||
1969 | } |
||
1970 | |||
1971 | if ($extendingQuery->getOwner() !== null) { |
||
1972 | $extendedQuery->taskOwner($extendingQuery->getOwner()); |
||
1973 | } elseif ($this->getOwner() !== null) { |
||
1974 | $extendedQuery->taskOwner($this->getOwner()); |
||
1975 | } |
||
1976 | |||
1977 | if ($extendingQuery->isAssigned() || $this->isAssigned()) { |
||
1978 | $extendedQuery->taskAssigned(); |
||
1979 | } |
||
1980 | |||
1981 | if ($extendingQuery->isUnassigned() || $this->isUnassigned()) { |
||
1982 | $extendedQuery->taskUnassigned(); |
||
1983 | } |
||
1984 | |||
1985 | if ($extendingQuery->getDelegationState() !== null) { |
||
1986 | $extendedQuery->taskDelegationState($extendingQuery->getDelegationState()); |
||
1987 | } elseif ($this->getDelegationState() !== null) { |
||
1988 | $extendedQuery->taskDelegationState($this->getDelegationState()); |
||
1989 | } |
||
1990 | |||
1991 | if ($extendingQuery->getCandidateUser() !== null) { |
||
1992 | $extendedQuery->taskCandidateUser($extendingQuery->getCandidateUser()); |
||
1993 | } elseif ($this->getCandidateUser() !== null) { |
||
1994 | $extendedQuery->taskCandidateUser($this->getCandidateUser()); |
||
1995 | } |
||
1996 | |||
1997 | if ($extendingQuery->getCandidateGroup() !== null) { |
||
1998 | $extendedQuery->taskCandidateGroup($extendingQuery->getCandidateGroup()); |
||
1999 | } elseif ($this->getCandidateGroup() !== null) { |
||
2000 | $extendedQuery->taskCandidateGroup($this->getCandidateGroup()); |
||
2001 | } |
||
2002 | |||
2003 | if ($extendingQuery->isWithCandidateGroups() || $this->isWithCandidateGroups()) { |
||
2004 | $extendedQuery->withCandidateGroups(); |
||
2005 | } |
||
2006 | |||
2007 | if ($extendingQuery->isWithCandidateUsers() || $this->isWithCandidateUsers()) { |
||
2008 | $extendedQuery->withCandidateUsers(); |
||
2009 | } |
||
2010 | |||
2011 | if ($extendingQuery->isWithoutCandidateGroups() || $this->isWithoutCandidateGroups()) { |
||
2012 | $extendedQuery->withoutCandidateGroups(); |
||
2013 | } |
||
2014 | |||
2015 | if ($extendingQuery->isWithoutCandidateUsers() || $this->isWithoutCandidateUsers()) { |
||
2016 | $extendedQuery->withoutCandidateUsers(); |
||
2017 | } |
||
2018 | |||
2019 | if ($extendingQuery->getCandidateGroupsInternal() !== null) { |
||
2020 | $extendedQuery->taskCandidateGroupIn($extendingQuery->getCandidateGroupsInternal()); |
||
2021 | } elseif ($this->getCandidateGroupsInternal() !== null) { |
||
2022 | $extendedQuery->taskCandidateGroupIn($this->getCandidateGroupsInternal()); |
||
2023 | } |
||
2024 | |||
2025 | if ($extendingQuery->getProcessInstanceId() !== null) { |
||
2026 | $extendedQuery->processInstanceId($extendingQuery->getProcessInstanceId()); |
||
2027 | } elseif ($this->getProcessInstanceId() !== null) { |
||
2028 | $extendedQuery->processInstanceId($this->getProcessInstanceId()); |
||
2029 | } |
||
2030 | |||
2031 | if ($extendingQuery->getProcessInstanceIdIn() !== null) { |
||
2032 | $extendedQuery->processInstanceIdIn($extendingQuery->getProcessInstanceIdIn()); |
||
2033 | } elseif ($this->processInstanceIdIn() !== null) { |
||
2034 | $extendedQuery->processInstanceIdIn($this->getProcessInstanceIdIn()); |
||
2035 | } |
||
2036 | |||
2037 | if ($extendingQuery->getExecutionId() !== null) { |
||
2038 | $extendedQuery->executionId($extendingQuery->getExecutionId()); |
||
2039 | } elseif ($this->getExecutionId() !== null) { |
||
2040 | $extendedQuery->executionId($this->getExecutionId()); |
||
2041 | } |
||
2042 | |||
2043 | if ($extendingQuery->getActivityInstanceIdIn() !== null) { |
||
2044 | $extendedQuery->activityInstanceIdIn($extendingQuery->getActivityInstanceIdIn()); |
||
2045 | } elseif ($this->getActivityInstanceIdIn() !== null) { |
||
2046 | $extendedQuery->activityInstanceIdIn($this->getActivityInstanceIdIn()); |
||
2047 | } |
||
2048 | |||
2049 | if ($extendingQuery->getTaskId() !== null) { |
||
2050 | $extendedQuery->taskId($extendingQuery->getTaskId()); |
||
2051 | } elseif ($this->getTaskId() !== null) { |
||
2052 | $extendedQuery->taskId($this->getTaskId()); |
||
2053 | } |
||
2054 | |||
2055 | if ($extendingQuery->getTaskIdIn() !== null) { |
||
2056 | $extendedQuery->taskIdIn($extendingQuery->getTaskIdIn()); |
||
2057 | } elseif ($this->getTaskIdIn() !== null) { |
||
2058 | $extendedQuery->taskIdIn($this->getTaskIdIn()); |
||
2059 | } |
||
2060 | |||
2061 | if ($extendingQuery->getDescription() !== null) { |
||
2062 | $extendedQuery->taskDescription($extendingQuery->getDescription()); |
||
2063 | } elseif ($this->getDescription() !== null) { |
||
2064 | $extendedQuery->taskDescription($this->getDescription()); |
||
2065 | } |
||
2066 | |||
2067 | if ($extendingQuery->getDescriptionLike() !== null) { |
||
2068 | $extendedQuery->taskDescriptionLike($extendingQuery->getDescriptionLike()); |
||
2069 | } elseif ($this->getDescriptionLike() !== null) { |
||
2070 | $extendedQuery->taskDescriptionLike($this->getDescriptionLike()); |
||
2071 | } |
||
2072 | |||
2073 | if ($extendingQuery->getPriority() !== null) { |
||
2074 | $extendedQuery->taskPriority($extendingQuery->getPriority()); |
||
2075 | } elseif ($this->getPriority() !== null) { |
||
2076 | $extendedQuery->taskPriority($this->getPriority()); |
||
2077 | } |
||
2078 | |||
2079 | if ($extendingQuery->getMinPriority() !== null) { |
||
2080 | $extendedQuery->taskMinPriority($extendingQuery->getMinPriority()); |
||
2081 | } elseif ($this->getMinPriority() !== null) { |
||
2082 | $extendedQuery->taskMinPriority($this->getMinPriority()); |
||
2083 | } |
||
2084 | |||
2085 | if ($extendingQuery->getMaxPriority() !== null) { |
||
2086 | $extendedQuery->taskMaxPriority($extendingQuery->getMaxPriority()); |
||
2087 | } elseif ($this->getMaxPriority() !== null) { |
||
2088 | $extendedQuery->taskMaxPriority($this->getMaxPriority()); |
||
2089 | } |
||
2090 | |||
2091 | if ($extendingQuery->getCreateTime() !== null) { |
||
2092 | $extendedQuery->taskCreatedOn($extendingQuery->getCreateTime()); |
||
2093 | } elseif ($this->getCreateTime() !== null) { |
||
2094 | $extendedQuery->taskCreatedOn($this->getCreateTime()); |
||
2095 | } |
||
2096 | |||
2097 | if ($extendingQuery->getCreateTimeBefore() !== null) { |
||
2098 | $extendedQuery->taskCreatedBefore($extendingQuery->getCreateTimeBefore()); |
||
2099 | } elseif ($this->getCreateTimeBefore() !== null) { |
||
2100 | $extendedQuery->taskCreatedBefore($this->getCreateTimeBefore()); |
||
2101 | } |
||
2102 | |||
2103 | if ($extendingQuery->getCreateTimeAfter() !== null) { |
||
2104 | $extendedQuery->taskCreatedAfter($extendingQuery->getCreateTimeAfter()); |
||
2105 | } elseif ($this->getCreateTimeAfter() !== null) { |
||
2106 | $extendedQuery->taskCreatedAfter($this->getCreateTimeAfter()); |
||
2107 | } |
||
2108 | |||
2109 | if ($extendingQuery->getKey() !== null) { |
||
2110 | $extendedQuery->taskDefinitionKey($extendingQuery->getKey()); |
||
2111 | } elseif ($this->getKey() !== null) { |
||
2112 | $extendedQuery->taskDefinitionKey($this->getKey()); |
||
2113 | } |
||
2114 | |||
2115 | if ($extendingQuery->getKeyLike() !== null) { |
||
2116 | $extendedQuery->taskDefinitionKeyLike($extendingQuery->getKeyLike()); |
||
2117 | } elseif ($this->getKeyLike() !== null) { |
||
2118 | $extendedQuery->taskDefinitionKeyLike($this->getKeyLike()); |
||
2119 | } |
||
2120 | |||
2121 | if ($extendingQuery->getKeys() !== null) { |
||
2122 | $extendedQuery->taskDefinitionKeyIn($extendingQuery->getKeys()); |
||
2123 | } elseif ($this->getKeys() !== null) { |
||
2124 | $extendedQuery->taskDefinitionKeyIn($this->getKeys()); |
||
2125 | } |
||
2126 | |||
2127 | if ($extendingQuery->getParentTaskId() !== null) { |
||
2128 | $extendedQuery->taskParentTaskId($extendingQuery->getParentTaskId()); |
||
2129 | } elseif ($this->getParentTaskId() !== null) { |
||
2130 | $extendedQuery->taskParentTaskId($this->getParentTaskId()); |
||
2131 | } |
||
2132 | |||
2133 | if ($extendingQuery->getProcessDefinitionKey() !== null) { |
||
2134 | $extendedQuery->processDefinitionKey($extendingQuery->getProcessDefinitionKey()); |
||
2135 | } elseif ($this->getProcessDefinitionKey() !== null) { |
||
2136 | $extendedQuery->processDefinitionKey($this->getProcessDefinitionKey()); |
||
2137 | } |
||
2138 | |||
2139 | if ($extendingQuery->getProcessDefinitionKeys() !== null) { |
||
2140 | $extendedQuery->processDefinitionKeyIn($extendingQuery->getProcessDefinitionKeys()); |
||
2141 | } elseif ($this->getProcessDefinitionKeys() !== null) { |
||
2142 | $extendedQuery->processDefinitionKeyIn($this->getProcessDefinitionKeys()); |
||
2143 | } |
||
2144 | |||
2145 | if ($extendingQuery->getProcessDefinitionId() !== null) { |
||
2146 | $extendedQuery->processDefinitionId($extendingQuery->getProcessDefinitionId()); |
||
2147 | } elseif ($this->getProcessDefinitionId() !== null) { |
||
2148 | $extendedQuery->processDefinitionId($this->getProcessDefinitionId()); |
||
2149 | } |
||
2150 | |||
2151 | if ($extendingQuery->getProcessDefinitionName() !== null) { |
||
2152 | $extendedQuery->processDefinitionName($extendingQuery->getProcessDefinitionName()); |
||
2153 | } elseif ($this->getProcessDefinitionName() !== null) { |
||
2154 | $extendedQuery->processDefinitionName($this->getProcessDefinitionName()); |
||
2155 | } |
||
2156 | |||
2157 | if ($extendingQuery->getProcessDefinitionNameLike() !== null) { |
||
2158 | $extendedQuery->processDefinitionNameLike($extendingQuery->getProcessDefinitionNameLike()); |
||
2159 | } elseif ($this->getProcessDefinitionNameLike() !== null) { |
||
2160 | $extendedQuery->processDefinitionNameLike($this->getProcessDefinitionNameLike()); |
||
2161 | } |
||
2162 | |||
2163 | if ($extendingQuery->getProcessInstanceBusinessKey() !== null) { |
||
2164 | $extendedQuery->processInstanceBusinessKey($extendingQuery->getProcessInstanceBusinessKey()); |
||
2165 | } elseif ($this->getProcessInstanceBusinessKey() !== null) { |
||
2166 | $extendedQuery->processInstanceBusinessKey($this->getProcessInstanceBusinessKey()); |
||
2167 | } |
||
2168 | |||
2169 | if ($extendingQuery->getProcessInstanceBusinessKeyLike() !== null) { |
||
2170 | $extendedQuery->processInstanceBusinessKeyLike($extendingQuery->getProcessInstanceBusinessKeyLike()); |
||
2171 | } elseif ($this->getProcessInstanceBusinessKeyLike() !== null) { |
||
2172 | $extendedQuery->processInstanceBusinessKeyLike($this->getProcessInstanceBusinessKeyLike()); |
||
2173 | } |
||
2174 | |||
2175 | if ($extendingQuery->getDueDate() !== null) { |
||
2176 | $extendedQuery->dueDate($extendingQuery->getDueDate()); |
||
2177 | } elseif ($this->getDueDate() !== null) { |
||
2178 | $extendedQuery->dueDate($this->getDueDate()); |
||
2179 | } |
||
2180 | |||
2181 | if ($extendingQuery->getDueBefore() !== null) { |
||
2182 | $extendedQuery->dueBefore($extendingQuery->getDueBefore()); |
||
2183 | } elseif ($this->getDueBefore() !== null) { |
||
2184 | $extendedQuery->dueBefore($this->getDueBefore()); |
||
2185 | } |
||
2186 | |||
2187 | if ($extendingQuery->getDueAfter() !== null) { |
||
2188 | $extendedQuery->dueAfter($extendingQuery->getDueAfter()); |
||
2189 | } elseif ($this->getDueAfter() !== null) { |
||
2190 | $extendedQuery->dueAfter($this->getDueAfter()); |
||
2191 | } |
||
2192 | |||
2193 | if ($extendingQuery->isWithoutDueDate() || $this->isWithoutDueDate()) { |
||
2194 | $extendedQuery->withoutDueDate(); |
||
2195 | } |
||
2196 | |||
2197 | if ($extendingQuery->getFollowUpDate() !== null) { |
||
2198 | $extendedQuery->followUpDate($extendingQuery->getFollowUpDate()); |
||
2199 | } elseif ($this->getFollowUpDate() !== null) { |
||
2200 | $extendedQuery->followUpDate($this->getFollowUpDate()); |
||
2201 | } |
||
2202 | |||
2203 | if ($extendingQuery->getFollowUpBefore() !== null) { |
||
2204 | $extendedQuery->followUpBefore($extendingQuery->getFollowUpBefore()); |
||
2205 | } elseif ($this->getFollowUpBefore() !== null) { |
||
2206 | $extendedQuery->followUpBefore($this->getFollowUpBefore()); |
||
2207 | } |
||
2208 | |||
2209 | if ($extendingQuery->getFollowUpAfter() !== null) { |
||
2210 | $extendedQuery->followUpAfter($extendingQuery->getFollowUpAfter()); |
||
2211 | } elseif ($this->getFollowUpAfter() !== null) { |
||
2212 | $extendedQuery->followUpAfter($this->getFollowUpAfter()); |
||
2213 | } |
||
2214 | |||
2215 | if ($extendingQuery->isFollowUpNullAccepted() || $this->isFollowUpNullAccepted()) { |
||
2216 | $extendedQuery->setFollowUpNullAccepted(true); |
||
2217 | } |
||
2218 | |||
2219 | if ($extendingQuery->isExcludeSubtasks() || $this->isExcludeSubtasks()) { |
||
2220 | $extendedQuery->excludeSubtasks(); |
||
2221 | } |
||
2222 | |||
2223 | if ($extendingQuery->getSuspensionState() !== null) { |
||
2224 | if ($extendingQuery->getSuspensionState() == SuspensionState::active()) { |
||
2225 | $extendedQuery->active(); |
||
2226 | } elseif ($extendingQuery->getSuspensionState() == SuspensionState::suspended()) { |
||
2227 | $extendedQuery->suspended(); |
||
2228 | } |
||
2229 | } elseif ($this->getSuspensionState() !== null) { |
||
2230 | if ($this->getSuspensionState() == SuspensionState::active()) { |
||
2231 | $extendedQuery->active(); |
||
2232 | } elseif ($this->getSuspensionState() == SuspensionState::suspended()) { |
||
2233 | $extendedQuery->suspended(); |
||
2234 | } |
||
2235 | } |
||
2236 | |||
2237 | /*if ($extendingQuery->getCaseInstanceId() !== null) { |
||
2238 | $extendedQuery.caseInstanceId($extendingQuery->getCaseInstanceId()); |
||
2239 | } |
||
2240 | elseif ($this->getCaseInstanceId() !== null) { |
||
2241 | $extendedQuery.caseInstanceId($this->getCaseInstanceId()); |
||
2242 | } |
||
2243 | |||
2244 | if ($extendingQuery->getCaseInstanceBusinessKey() !== null) { |
||
2245 | $extendedQuery.caseInstanceBusinessKey($extendingQuery->getCaseInstanceBusinessKey()); |
||
2246 | } |
||
2247 | elseif ($this->getCaseInstanceBusinessKey() !== null) { |
||
2248 | $extendedQuery.caseInstanceBusinessKey($this->getCaseInstanceBusinessKey()); |
||
2249 | } |
||
2250 | |||
2251 | if (extendingQuery->getCaseInstanceBusinessKeyLike() !== null) { |
||
2252 | extendedQuery.caseInstanceBusinessKeyLike(extendingQuery->getCaseInstanceBusinessKeyLike()); |
||
2253 | } |
||
2254 | elseif ($this->getCaseInstanceBusinessKeyLike() !== null) { |
||
2255 | extendedQuery.caseInstanceBusinessKeyLike($this->getCaseInstanceBusinessKeyLike()); |
||
2256 | } |
||
2257 | |||
2258 | if (extendingQuery->getCaseExecutionId() !== null) { |
||
2259 | extendedQuery.caseExecutionId(extendingQuery->getCaseExecutionId()); |
||
2260 | } |
||
2261 | elseif ($this->getCaseExecutionId() !== null) { |
||
2262 | extendedQuery.caseExecutionId($this->getCaseExecutionId()); |
||
2263 | } |
||
2264 | |||
2265 | if (extendingQuery->getCaseDefinitionId() !== null) { |
||
2266 | extendedQuery.caseDefinitionId(extendingQuery->getCaseDefinitionId()); |
||
2267 | } |
||
2268 | elseif ($this->getCaseDefinitionId() !== null) { |
||
2269 | extendedQuery.caseDefinitionId($this->getCaseDefinitionId()); |
||
2270 | } |
||
2271 | |||
2272 | if (extendingQuery->getCaseDefinitionKey() !== null) { |
||
2273 | extendedQuery.caseDefinitionKey(extendingQuery->getCaseDefinitionKey()); |
||
2274 | } |
||
2275 | elseif ($this->getCaseDefinitionKey() !== null) { |
||
2276 | extendedQuery.caseDefinitionKey($this->getCaseDefinitionKey()); |
||
2277 | } |
||
2278 | |||
2279 | if (extendingQuery->getCaseDefinitionName() !== null) { |
||
2280 | extendedQuery.caseDefinitionName(extendingQuery->getCaseDefinitionName()); |
||
2281 | } |
||
2282 | elseif ($this->getCaseDefinitionName() !== null) { |
||
2283 | extendedQuery.caseDefinitionName($this->getCaseDefinitionName()); |
||
2284 | } |
||
2285 | |||
2286 | if (extendingQuery->getCaseDefinitionNameLike() !== null) { |
||
2287 | extendedQuery.caseDefinitionNameLike(extendingQuery->getCaseDefinitionNameLike()); |
||
2288 | } |
||
2289 | elseif ($this->getCaseDefinitionNameLike() !== null) { |
||
2290 | extendedQuery.caseDefinitionNameLike($this->getCaseDefinitionNameLike()); |
||
2291 | }*/ |
||
2292 | |||
2293 | if ($extendingQuery->isInitializeFormKeys() || $this->isInitializeFormKeys()) { |
||
2294 | $extendedQuery->initializeFormKeys(); |
||
2295 | } |
||
2296 | |||
2297 | if ($extendingQuery->isTaskNameCaseInsensitive() || $this->isTaskNameCaseInsensitive()) { |
||
2298 | $extendedQuery->taskNameCaseInsensitive(); |
||
2299 | } |
||
2300 | |||
2301 | if ($extendingQuery->getTenantIds() !== null) { |
||
2302 | $extendedQuery->tenantIdIn($extendingQuery->getTenantIds()); |
||
2303 | } elseif ($this->getTenantIds() !== null) { |
||
2304 | $extendedQuery->tenantIdIn($this->getTenantIds()); |
||
2305 | } |
||
2306 | |||
2307 | if ($extendingQuery->isWithoutTenantId() || $this->isWithoutTenantId()) { |
||
2308 | $extendedQuery->withoutTenantId(); |
||
2309 | } |
||
2310 | |||
2311 | // merge variables |
||
2312 | $this->mergeVariables($extendedQuery, $extendingQuery); |
||
2313 | |||
2314 | // merge expressions |
||
2315 | $this->mergeExpressions($extendedQuery, $extendingQuery); |
||
2316 | |||
2317 | // include taskAssigned tasks has to be set after expression as it asserts on already set |
||
2318 | // candidate properties which could be expressions |
||
2319 | if ($extendingQuery->isIncludeAssignedTasks() || $this->isIncludeAssignedTasks()) { |
||
2320 | $extendedQuery->includeAssignedTasks(); |
||
2321 | } |
||
2322 | |||
2323 | $this->mergeOrdering($extendedQuery, $extendingQuery); |
||
2324 | |||
2325 | $extendedQuery->queries = [$extendedQuery]; |
||
2326 | |||
2327 | if (count($this->queries) > 1) { |
||
2328 | unset($this->queries[0]); |
||
2329 | $extendedQuery->queries = array_merge($extendedQuery->queries, $this->queries); |
||
2330 | } |
||
2331 | |||
2332 | if (count($extendingQuery->queries) > 1) { |
||
2333 | unset($extendingQuery->queries[0]); |
||
2334 | $extendedQuery->queries = array_merge($extendedQuery->queries, $extendingQuery->queries); |
||
2335 | } |
||
2336 | |||
2337 | return $extendedQuery; |
||
2338 | } |
||
2339 | |||
2340 | /** |
||
2341 | * Simple implementation of variable merging. Variables are only overridden if they have the same name and are |
||
2342 | * in the same scope (ie are process instance, task or case execution variables). |
||
2343 | */ |
||
2344 | protected function mergeVariables(TaskQueryImpl $extendedQuery, TaskQueryImpl $extendingQuery): void |
||
2345 | { |
||
2346 | $extendingVariables = $extendingQuery->getVariables(); |
||
2347 | |||
2348 | $extendingVariablesComparable = []; |
||
2349 | |||
2350 | // set extending variables and save names for comparison of original variables |
||
2351 | foreach ($extendingVariables as $extendingVariable) { |
||
2352 | $extendedQuery->addVariable($extendingVariable); |
||
2353 | $extendingVariablesComparable[] = new TaskQueryVariableValueComparable($extendingVariable); |
||
2354 | } |
||
2355 | |||
2356 | foreach ($this->getVariables() as $originalVariable) { |
||
2357 | if (!in_array(new TaskQueryVariableValueComparable($originalVariable), $extendingVariablesComparable)) { |
||
2358 | $extendedQuery->addVariable($originalVariable); |
||
2359 | } |
||
2360 | } |
||
2361 | } |
||
2362 | |||
2363 | public function isFollowUpNullAccepted(): bool |
||
2364 | { |
||
2365 | return $this->followUpNullAccepted; |
||
2366 | } |
||
2367 | |||
2368 | public function taskNameNotEqual(string $name): TaskQueryInterface |
||
2369 | { |
||
2370 | $this->nameNotEqual = $name; |
||
2371 | return $this; |
||
2372 | } |
||
2373 | |||
2374 | public function taskNameNotLike(string $nameNotLike): TaskQueryInterface |
||
2375 | { |
||
2376 | EnsureUtil::ensureNotNull("Task nameNotLike", "nameNotLike", $nameNotLike); |
||
2377 | $this->nameNotLike = $nameNotLike; |
||
2378 | return $this; |
||
2379 | } |
||
2380 | |||
2381 | /** |
||
2382 | * @return bool true if the query is not supposed to find CMMN or standalone tasks |
||
2383 | */ |
||
2384 | public function isQueryForProcessTasksOnly(): bool |
||
2385 | { |
||
2386 | $engineConfiguration = Context::getProcessEngineConfiguration(); |
||
2387 | return !$engineConfiguration->isStandaloneTasksEnabled();//!engineConfiguration->isCmmnEnabled() && |
||
2388 | } |
||
2389 | |||
2390 | public function or(): TaskQueryInterface |
||
2401 | } |
||
2402 | |||
2403 | public function endOr(): TaskQueryInterface |
||
2404 | { |
||
2405 | if (!empty($this->queries) && $this != $this->queries[count($this->queries) - 1]) { |
||
2406 | throw new ProcessEngineException("Invalid query usage: cannot set endOr() before or()"); |
||
2407 | } |
||
2408 | |||
2409 | return $this->queries[0]; |
||
2410 | } |
||
2411 | |||
2412 | public function matchVariableNamesIgnoreCase(): TaskQueryInterface |
||
2419 | } |
||
2420 | |||
2421 | public function matchVariableValuesIgnoreCase(): TaskQueryInterface |
||
2422 | { |
||
2423 | $this->variableValuesIgnoreCase = true; |
||
2424 | foreach ($this->variables as $variable) { |
||
2425 | $variable->setVariableValueIgnoreCase(true); |
||
2426 | } |
||
2427 | return $this; |
||
2428 | } |
||
2429 | } |
||
2430 |