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