|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Jabe\Engine\Impl; |
|
4
|
|
|
|
|
5
|
|
|
use Jabe\Engine\ProcessEngineException; |
|
6
|
|
|
use Jabe\Engine\History\HistoricActivityInstanceQueryInterface; |
|
7
|
|
|
use Jabe\Engine\Impl\Interceptor\{ |
|
8
|
|
|
CommandContext, |
|
9
|
|
|
CommandExecutorInterface |
|
10
|
|
|
}; |
|
11
|
|
|
use Jabe\Engine\Impl\Pvm\Runtime\ActivityInstanceState; |
|
12
|
|
|
use Jabe\Engine\Impl\Util\{ |
|
13
|
|
|
CompareUtil, |
|
|
|
|
|
|
14
|
|
|
EnsureUtil |
|
|
|
|
|
|
15
|
|
|
}; |
|
16
|
|
|
|
|
17
|
|
|
class HistoricActivityInstanceQueryImpl extends AbstractQuery implements HistoricActivityInstanceQueryInterface |
|
18
|
|
|
{ |
|
19
|
|
|
protected $activityInstanceId; |
|
20
|
|
|
protected $processInstanceId; |
|
21
|
|
|
protected $executionId; |
|
22
|
|
|
protected $processDefinitionId; |
|
23
|
|
|
protected $activityId; |
|
24
|
|
|
protected $activityName; |
|
25
|
|
|
protected $activityNameLike; |
|
26
|
|
|
protected $activityType; |
|
27
|
|
|
protected $assignee; |
|
28
|
|
|
protected $finished; |
|
29
|
|
|
protected $unfinished; |
|
30
|
|
|
protected $startedBefore; |
|
31
|
|
|
protected $startedAfter; |
|
32
|
|
|
protected $finishedBefore; |
|
33
|
|
|
protected $finishedAfter; |
|
34
|
|
|
protected $activityInstanceState; |
|
35
|
|
|
protected $tenantIds = []; |
|
36
|
|
|
protected $isTenantIdSet; |
|
37
|
|
|
|
|
38
|
|
|
public function __construct(CommandExecutor $commandExecutor = null) |
|
|
|
|
|
|
39
|
|
|
{ |
|
40
|
|
|
parent::__construct($commandExecutor); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
public function executeCount(CommandContext $commandContext): int |
|
44
|
|
|
{ |
|
45
|
|
|
$this->checkQueryOk(); |
|
46
|
|
|
return $commandContext |
|
47
|
|
|
->getHistoricActivityInstanceManager() |
|
48
|
|
|
->findHistoricActivityInstanceCountByQueryCriteria($this); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
public function executeList(CommandContext $commandContext, Page $page): array |
|
|
|
|
|
|
52
|
|
|
{ |
|
53
|
|
|
$this->checkQueryOk(); |
|
54
|
|
|
return $commandContext |
|
55
|
|
|
->getHistoricActivityInstanceManager() |
|
56
|
|
|
->findHistoricActivityInstancesByQueryCriteria($this, $page); |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
public function processInstanceId(string $processInstanceId): HistoricActivityInstanceQueryImpl |
|
60
|
|
|
{ |
|
61
|
|
|
$this->processInstanceId = $processInstanceId; |
|
62
|
|
|
return $this; |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
public function executionId(string $executionId): HistoricActivityInstanceQueryImpl |
|
66
|
|
|
{ |
|
67
|
|
|
$this->executionId = $executionId; |
|
68
|
|
|
return $this; |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
public function processDefinitionId(string $processDefinitionId): HistoricActivityInstanceQueryImpl |
|
72
|
|
|
{ |
|
73
|
|
|
$this->processDefinitionId = $processDefinitionId; |
|
74
|
|
|
return $this; |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
public function activityId(string $activityId): HistoricActivityInstanceQueryImpl |
|
78
|
|
|
{ |
|
79
|
|
|
$this->activityId = $activityId; |
|
80
|
|
|
return $this; |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
public function activityName(string $activityName): HistoricActivityInstanceQueryImpl |
|
84
|
|
|
{ |
|
85
|
|
|
$this->activityName = $activityName; |
|
86
|
|
|
return $this; |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
public function activityNameLike(string $activityNameLike): HistoricActivityInstanceQueryImpl |
|
90
|
|
|
{ |
|
91
|
|
|
$this->activityNameLike = $activityNameLike; |
|
92
|
|
|
return $this; |
|
93
|
|
|
} |
|
94
|
|
|
|
|
95
|
|
|
public function activityType(string $activityType): HistoricActivityInstanceQueryImpl |
|
96
|
|
|
{ |
|
97
|
|
|
$this->activityType = $activityType; |
|
98
|
|
|
return $this; |
|
99
|
|
|
} |
|
100
|
|
|
|
|
101
|
|
|
public function taskAssignee(string $assignee): HistoricActivityInstanceQueryImpl |
|
102
|
|
|
{ |
|
103
|
|
|
$this->assignee = $assignee; |
|
104
|
|
|
return $this; |
|
105
|
|
|
} |
|
106
|
|
|
|
|
107
|
|
|
public function finished(): HistoricActivityInstanceQueryImpl |
|
108
|
|
|
{ |
|
109
|
|
|
$this->finished = true; |
|
110
|
|
|
return $this; |
|
111
|
|
|
} |
|
112
|
|
|
|
|
113
|
|
|
public function unfinished(): HistoricActivityInstanceQueryImpl |
|
114
|
|
|
{ |
|
115
|
|
|
$this->unfinished = true; |
|
116
|
|
|
return $this; |
|
117
|
|
|
} |
|
118
|
|
|
|
|
119
|
|
|
public function completeScope(): HistoricActivityInstanceQueryImpl |
|
120
|
|
|
{ |
|
121
|
|
|
if ($this->activityInstanceState != null) { |
|
122
|
|
|
throw new ProcessEngineException("Already querying for activity instance state <" . $this->activityInstanceState . ">"); |
|
123
|
|
|
} |
|
124
|
|
|
|
|
125
|
|
|
$this->activityInstanceState = ActivityInstanceState::scopeComplete(); |
|
126
|
|
|
return $this; |
|
127
|
|
|
} |
|
128
|
|
|
|
|
129
|
|
|
public function canceled(): HistoricActivityInstanceQueryImpl |
|
130
|
|
|
{ |
|
131
|
|
|
if ($this->activityInstanceState != null) { |
|
132
|
|
|
throw new ProcessEngineException("Already querying for activity instance state <" . $activityInstanceState . ">"); |
|
|
|
|
|
|
133
|
|
|
} |
|
134
|
|
|
$this->activityInstanceState = ActivityInstanceState::canceled(); |
|
135
|
|
|
return $this; |
|
136
|
|
|
} |
|
137
|
|
|
|
|
138
|
|
|
public function startedAfter(string $date): HistoricActivityInstanceQueryImpl |
|
139
|
|
|
{ |
|
140
|
|
|
$this->startedAfter = $date; |
|
141
|
|
|
return $this; |
|
142
|
|
|
} |
|
143
|
|
|
|
|
144
|
|
|
public function startedBefore(string $date): HistoricActivityInstanceQueryImpl |
|
145
|
|
|
{ |
|
146
|
|
|
$this->startedBefore = $date; |
|
147
|
|
|
return $this; |
|
148
|
|
|
} |
|
149
|
|
|
|
|
150
|
|
|
public function finishedAfter(string $date): HistoricActivityInstanceQueryImpl |
|
151
|
|
|
{ |
|
152
|
|
|
$this->finishedAfter = $date; |
|
153
|
|
|
return $this; |
|
154
|
|
|
} |
|
155
|
|
|
|
|
156
|
|
|
public function finishedBefore(string $date): HistoricActivityInstanceQueryImpl |
|
157
|
|
|
{ |
|
158
|
|
|
$this->finishedBefore = $date; |
|
159
|
|
|
return $this; |
|
160
|
|
|
} |
|
161
|
|
|
|
|
162
|
|
|
public function tenantIdIn(array $tenantIds): HistoricActivityInstanceQueryInterface |
|
163
|
|
|
{ |
|
164
|
|
|
EnsureUtil::ensureNotNull("tenantIds", "tenantIds", $tenantIds); |
|
165
|
|
|
$this->tenantIds = $tenantIds; |
|
166
|
|
|
$this->isTenantIdSet = true; |
|
167
|
|
|
return $this; |
|
168
|
|
|
} |
|
169
|
|
|
|
|
170
|
|
|
public function withoutTenantId(): HistoricActivityInstanceQueryInterface |
|
171
|
|
|
{ |
|
172
|
|
|
$this->tenantIds = null; |
|
173
|
|
|
$this->isTenantIdSet = true; |
|
174
|
|
|
return $this; |
|
175
|
|
|
} |
|
176
|
|
|
|
|
177
|
|
|
protected function hasExcludingConditions(): bool |
|
178
|
|
|
{ |
|
179
|
|
|
return parent::hasExcludingConditions() |
|
180
|
|
|
|| CompareUtil::areNotInAscendingOrder($this->startedAfter, $this->startedBefore) |
|
181
|
|
|
|| CompareUtil::areNotInAscendingOrder($this->finishedAfter, $this->finishedBefore); |
|
182
|
|
|
} |
|
183
|
|
|
|
|
184
|
|
|
// ordering ///////////////////////////////////////////////////////////////// |
|
185
|
|
|
|
|
186
|
|
|
public function orderByHistoricActivityInstanceDuration(): HistoricActivityInstanceQueryImpl |
|
187
|
|
|
{ |
|
188
|
|
|
$this->orderBy(HistoricActivityInstanceQueryProperty::duration()); |
|
189
|
|
|
return $this; |
|
190
|
|
|
} |
|
191
|
|
|
|
|
192
|
|
|
public function orderByHistoricActivityInstanceEndTime(): HistoricActivityInstanceQueryImpl |
|
193
|
|
|
{ |
|
194
|
|
|
$this->orderBy(HistoricActivityInstanceQueryProperty::end()); |
|
195
|
|
|
return $this; |
|
196
|
|
|
} |
|
197
|
|
|
|
|
198
|
|
|
public function orderByExecutionId(): HistoricActivityInstanceQueryImpl |
|
199
|
|
|
{ |
|
200
|
|
|
$this->orderBy(HistoricActivityInstanceQueryProperty::executionId()); |
|
201
|
|
|
return $this; |
|
202
|
|
|
} |
|
203
|
|
|
|
|
204
|
|
|
public function orderByHistoricActivityInstanceId(): HistoricActivityInstanceQueryImpl |
|
205
|
|
|
{ |
|
206
|
|
|
$this->orderBy(HistoricActivityInstanceQueryProperty::historicActivityInstanceId()); |
|
207
|
|
|
return $this; |
|
208
|
|
|
} |
|
209
|
|
|
|
|
210
|
|
|
public function orderByProcessDefinitionId(): HistoricActivityInstanceQueryImpl |
|
211
|
|
|
{ |
|
212
|
|
|
$this->orderBy(HistoricActivityInstanceQueryProperty::processDefinitionId()); |
|
213
|
|
|
return $this; |
|
214
|
|
|
} |
|
215
|
|
|
|
|
216
|
|
|
public function orderByProcessInstanceId(): HistoricActivityInstanceQueryImpl |
|
217
|
|
|
{ |
|
218
|
|
|
$this->orderBy(HistoricActivityInstanceQueryProperty::processInstanceId()); |
|
219
|
|
|
return $this; |
|
220
|
|
|
} |
|
221
|
|
|
|
|
222
|
|
|
public function orderByHistoricActivityInstanceStartTime(): HistoricActivityInstanceQueryImpl |
|
223
|
|
|
{ |
|
224
|
|
|
$this->orderBy(HistoricActivityInstanceQueryProperty::start()); |
|
225
|
|
|
return $this; |
|
226
|
|
|
} |
|
227
|
|
|
|
|
228
|
|
|
public function orderByActivityId(): HistoricActivityInstanceQueryInterface |
|
229
|
|
|
{ |
|
230
|
|
|
$this->orderBy(HistoricActivityInstanceQueryProperty::activityId()); |
|
231
|
|
|
return $this; |
|
232
|
|
|
} |
|
233
|
|
|
|
|
234
|
|
|
public function orderByActivityName(): HistoricActivityInstanceQueryImpl |
|
235
|
|
|
{ |
|
236
|
|
|
$this->orderBy(HistoricActivityInstanceQueryProperty::activityName()); |
|
237
|
|
|
return $this; |
|
238
|
|
|
} |
|
239
|
|
|
|
|
240
|
|
|
public function orderByActivityType(): HistoricActivityInstanceQueryImpl |
|
241
|
|
|
{ |
|
242
|
|
|
$this->orderBy(HistoricActivityInstanceQueryProperty::activityType()); |
|
243
|
|
|
return $this; |
|
244
|
|
|
} |
|
245
|
|
|
|
|
246
|
|
|
public function orderPartiallyByOccurrence(): HistoricActivityInstanceQueryInterface |
|
247
|
|
|
{ |
|
248
|
|
|
$this->orderBy(HistoricActivityInstanceQueryProperty::sequenceCounter()); |
|
249
|
|
|
return $this; |
|
250
|
|
|
} |
|
251
|
|
|
|
|
252
|
|
|
public function orderByTenantId(): HistoricActivityInstanceQueryInterface |
|
253
|
|
|
{ |
|
254
|
|
|
return orderBy(HistoricActivityInstanceQueryProperty::tenantId()); |
|
|
|
|
|
|
255
|
|
|
} |
|
256
|
|
|
|
|
257
|
|
|
public function activityInstanceId(string $activityInstanceId): HistoricActivityInstanceQueryImpl |
|
258
|
|
|
{ |
|
259
|
|
|
$this->activityInstanceId = $activityInstanceId; |
|
260
|
|
|
return $this; |
|
261
|
|
|
} |
|
262
|
|
|
|
|
263
|
|
|
// getters and setters ////////////////////////////////////////////////////// |
|
264
|
|
|
|
|
265
|
|
|
public function getProcessInstanceId(): string |
|
266
|
|
|
{ |
|
267
|
|
|
return $this->processInstanceId; |
|
268
|
|
|
} |
|
269
|
|
|
|
|
270
|
|
|
public function getExecutionId(): string |
|
271
|
|
|
{ |
|
272
|
|
|
return $this->executionId; |
|
273
|
|
|
} |
|
274
|
|
|
|
|
275
|
|
|
public function getProcessDefinitionId(): string |
|
276
|
|
|
{ |
|
277
|
|
|
return $this->processDefinitionId; |
|
278
|
|
|
} |
|
279
|
|
|
|
|
280
|
|
|
public function getActivityId(): string |
|
281
|
|
|
{ |
|
282
|
|
|
return $this->activityId; |
|
283
|
|
|
} |
|
284
|
|
|
|
|
285
|
|
|
public function getActivityName(): string |
|
286
|
|
|
{ |
|
287
|
|
|
return $this->activityName; |
|
288
|
|
|
} |
|
289
|
|
|
|
|
290
|
|
|
public function getActivityType(): string |
|
291
|
|
|
{ |
|
292
|
|
|
return $this->activityType; |
|
293
|
|
|
} |
|
294
|
|
|
|
|
295
|
|
|
public function getAssignee(): string |
|
296
|
|
|
{ |
|
297
|
|
|
return $this->assignee; |
|
298
|
|
|
} |
|
299
|
|
|
|
|
300
|
|
|
public function isFinished(): bool |
|
301
|
|
|
{ |
|
302
|
|
|
return $this->finished; |
|
303
|
|
|
} |
|
304
|
|
|
|
|
305
|
|
|
public function isUnfinished(): bool |
|
306
|
|
|
{ |
|
307
|
|
|
return $this->unfinished; |
|
308
|
|
|
} |
|
309
|
|
|
|
|
310
|
|
|
public function getActivityInstanceId(): string |
|
311
|
|
|
{ |
|
312
|
|
|
return $this->activityInstanceId; |
|
313
|
|
|
} |
|
314
|
|
|
|
|
315
|
|
|
public function getStartedAfter(): string |
|
316
|
|
|
{ |
|
317
|
|
|
return $this->startedAfter; |
|
318
|
|
|
} |
|
319
|
|
|
|
|
320
|
|
|
public function getStartedBefore(): string |
|
321
|
|
|
{ |
|
322
|
|
|
return $this->startedBefore; |
|
323
|
|
|
} |
|
324
|
|
|
|
|
325
|
|
|
public function getFinishedAfter(): string |
|
326
|
|
|
{ |
|
327
|
|
|
return $this->finishedAfter; |
|
328
|
|
|
} |
|
329
|
|
|
|
|
330
|
|
|
public function getFinishedBefore(): string |
|
331
|
|
|
{ |
|
332
|
|
|
return $this->finishedBefore; |
|
333
|
|
|
} |
|
334
|
|
|
|
|
335
|
|
|
public function getActivityInstanceState(): ActivityInstanceState |
|
336
|
|
|
{ |
|
337
|
|
|
return $this->activityInstanceState; |
|
338
|
|
|
} |
|
339
|
|
|
|
|
340
|
|
|
public function isTenantIdSet(): bool |
|
341
|
|
|
{ |
|
342
|
|
|
return $this->isTenantIdSet; |
|
343
|
|
|
} |
|
344
|
|
|
} |
|
345
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths