1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Jabe\Impl; |
4
|
|
|
|
5
|
|
|
use Doctrine\DBAL\Connection; |
6
|
|
|
use Jabe\Application\{ |
7
|
|
|
ProcessApplicationReferenceInterface, |
8
|
|
|
ProcessApplicationRegistrationInterface |
9
|
|
|
}; |
10
|
|
|
use Jabe\{ |
11
|
|
|
ManagementServiceInterface, |
12
|
|
|
ProcessEngineConfiguration |
13
|
|
|
}; |
14
|
|
|
use Jabe\Batch\{ |
15
|
|
|
BatchInterface, |
16
|
|
|
BatchQueryInterface, |
17
|
|
|
BatchStatisticsQueryInterface |
18
|
|
|
}; |
19
|
|
|
use Jabe\History\HistoricProcessInstanceQueryInterface; |
20
|
|
|
use Jabe\Impl\Batch\{ |
21
|
|
|
BatchQueryImpl, |
22
|
|
|
BatchStatisticsQueryImpl, |
23
|
|
|
DeleteBatchCmd |
24
|
|
|
}; |
25
|
|
|
use Jabe\Impl\Cfg\ProcessEngineConfigurationImpl; |
26
|
|
|
use Jabe\Impl\Cmd\{ |
27
|
|
|
ActivateBatchCmd, |
28
|
|
|
DeleteJobCmd, |
29
|
|
|
DeleteLicenseKeyCmd, |
30
|
|
|
DeleteMetricsCmd, |
31
|
|
|
DeletePropertyCmd, |
32
|
|
|
DeleteTaskMetricsCmd, |
33
|
|
|
GetHistoryLevelCmd, |
34
|
|
|
GetJobExceptionStacktraceCmd, |
35
|
|
|
GetLicenseKeyCmd, |
36
|
|
|
GetProcessApplicationForDeploymentCmd, |
37
|
|
|
GetPropertiesCmd, |
38
|
|
|
GetTableCountCmd, |
39
|
|
|
GetTableMetaDataCmd, |
40
|
|
|
GetTableNameCmd, |
41
|
|
|
GetTelemetryDataCmd, |
42
|
|
|
GetUniqueTaskWorkerCountCmd, |
43
|
|
|
IsTelemetryEnabledCmd, |
44
|
|
|
PurgeDatabaseAndCacheCmd, |
45
|
|
|
RecalculateJobDuedateCmd, |
46
|
|
|
RegisterDeploymentCmd, |
47
|
|
|
RegisterProcessApplicationCmd, |
48
|
|
|
ReportDbMetricsCmd, |
49
|
|
|
SetJobDefinitionPriorityCmd, |
50
|
|
|
SetJobDuedateCmd, |
51
|
|
|
SetJobPriorityCmd, |
52
|
|
|
SetJobRetriesCmd, |
53
|
|
|
SetJobsRetriesBatchCmd, |
54
|
|
|
SetJobsRetriesCmd, |
55
|
|
|
SetLicenseKeyCmd, |
56
|
|
|
SetPropertyCmd, |
57
|
|
|
SuspendBatchCmd, |
58
|
|
|
TelemetryConfigureCmd, |
59
|
|
|
UnregisterDeploymentCmd, |
60
|
|
|
UnregisterProcessApplicationCmd |
61
|
|
|
}; |
62
|
|
|
use Jabe\Impl\Context\Context; |
63
|
|
|
use Jabe\Impl\Db\Sql\{ |
64
|
|
|
DbSqlSession, |
65
|
|
|
DbSqlSessionFactory |
66
|
|
|
}; |
67
|
|
|
use Jabe\Impl\Interceptor\{ |
68
|
|
|
CommandInterface, |
69
|
|
|
CommandContext |
70
|
|
|
}; |
71
|
|
|
use Jabe\Impl\JobExecutor\ExecuteJobHelper; |
72
|
|
|
use Jabe\Impl\Management\{ |
73
|
|
|
PurgeReport, |
74
|
|
|
UpdateJobDefinitionSuspensionStateBuilderImpl, |
75
|
|
|
UpdateJobSuspensionStateBuilderImpl |
76
|
|
|
}; |
77
|
|
|
use Jabe\Impl\Metrics\{ |
78
|
|
|
MetricsQueryImpl, |
79
|
|
|
MetricsRegistry |
80
|
|
|
}; |
81
|
|
|
use Jabe\Impl\Telemetry\Dto\LicenseKeyDataImpl; |
82
|
|
|
use Jabe\Management\{ |
83
|
|
|
ActivityStatisticsQueryInterface, |
84
|
|
|
DeploymentStatisticsQueryInterface, |
85
|
|
|
JobDefinitionQueryInterface, |
86
|
|
|
MetricsQueryInterface, |
87
|
|
|
ProcessDefinitionStatisticsQueryInterface, |
88
|
|
|
SchemaLogQueryInterface, |
89
|
|
|
TableMetaData, |
90
|
|
|
TablePageQueryInterface, |
91
|
|
|
UpdateJobDefinitionSuspensionStateSelectBuilderInterface, |
92
|
|
|
UpdateJobSuspensionStateSelectBuilderInterface |
93
|
|
|
}; |
94
|
|
|
use Jabe\Runtime\{ |
95
|
|
|
JobQueryInterface, |
96
|
|
|
ProcessInstanceQueryInterface |
97
|
|
|
}; |
98
|
|
|
use Jabe\Telemetry\TelemetryDataInterface; |
99
|
|
|
|
100
|
|
|
class ManagementServiceImpl extends ServiceImpl implements ManagementServiceInterface |
101
|
|
|
{ |
102
|
|
|
protected $processEngineConfiguration; |
103
|
|
|
|
104
|
|
|
public function __construct(ProcessEngineConfiguration $processEngineConfiguration) |
105
|
|
|
{ |
106
|
|
|
$this->processEngineConfiguration = $processEngineConfiguration; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
public function registerProcessApplication(string $deploymentId, ProcessApplicationReferenceInterface $reference): ProcessApplicationRegistrationInterface |
110
|
|
|
{ |
111
|
|
|
return $this->commandExecutor->execute(new RegisterProcessApplicationCmd($deploymentId, $reference)); |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
public function unregisterProcessApplication($deploymentIds, bool $removeProcessesFromCache): void |
115
|
|
|
{ |
116
|
|
|
$this->commandExecutor->execute(new UnregisterProcessApplicationCmd($deploymentIds, $removeProcessesFromCache)); |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
public function getProcessApplicationForDeployment(string $deploymentId): string |
120
|
|
|
{ |
121
|
|
|
return $this->commandExecutor->execute(new GetProcessApplicationForDeploymentCmd($deploymentId)); |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
public function getTableCount(): array |
125
|
|
|
{ |
126
|
|
|
return $this->commandExecutor->execute(new GetTableCountCmd()); |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
public function getTableName(string $activitiEntityClass): string |
130
|
|
|
{ |
131
|
|
|
return $this->commandExecutor->execute(new GetTableNameCmd($activitiEntityClass)); |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
public function getTableMetaData(string $tableName): TableMetaData |
135
|
|
|
{ |
136
|
|
|
return $this->commandExecutor->execute(new GetTableMetaDataCmd($tableName)); |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
public function executeJob(string $jobId): void |
140
|
|
|
{ |
141
|
|
|
ExecuteJobHelper::executeJob($jobId, $this->commandExecutor); |
|
|
|
|
142
|
|
|
} |
143
|
|
|
|
144
|
|
|
public function deleteJob(string $jobId): void |
145
|
|
|
{ |
146
|
|
|
$this->commandExecutor->execute(new DeleteJobCmd($jobId)); |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
public function setJobRetries($jobIds, int $retries): void |
150
|
|
|
{ |
151
|
|
|
$this->commandExecutor->execute(new SetJobsRetriesCmd($jobIds, $retries)); |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
public function setJobRetriesAsync($ids, $queryOrRetries, $historicQueryOrRetries = null, $retries = null): BatchInterface |
155
|
|
|
{ |
156
|
|
|
if ($historicQueryOrRetries instanceof HistoricProcessInstanceQueryInterface) { |
157
|
|
|
return $this->commandExecutor->execute( |
158
|
|
|
new SetJobsRetriesByProcessBatchCmd($ids, $queryOrRetries, $historicQueryOrRetries, $retries) |
159
|
|
|
); |
160
|
|
|
} elseif ($queryOrRetries instanceof ProcessInstanceQueryInterface && $retries === null) { |
161
|
|
|
return $this->commandExecutor->execute( |
162
|
|
|
new SetJobsRetriesByProcessBatchCmd($ids, $queryOrRetries, null, $historicQueryOrRetries) |
163
|
|
|
); |
164
|
|
|
} elseif ($ids instanceof JobQueryInterface) { |
165
|
|
|
return $this->commandExecutor->execute(new SetJobsRetriesBatchCmd(null, $ids, $queryOrRetries)); |
|
|
|
|
166
|
|
|
} elseif (is_array($ids)) { |
167
|
|
|
return $this->commandExecutor->execute(new SetJobsRetriesBatchCmd($ids, null, $queryOrRetries)); |
|
|
|
|
168
|
|
|
} |
|
|
|
|
169
|
|
|
} |
170
|
|
|
|
171
|
|
|
public function setJobRetriesByJobDefinitionId(string $jobDefinitionId, int $retries): void |
172
|
|
|
{ |
173
|
|
|
$this->commandExecutor->execute(new SetJobRetriesCmd(null, $jobDefinitionId, $retries)); |
174
|
|
|
} |
175
|
|
|
|
176
|
|
|
public function setJobDuedate(string $jobId, string $newDuedate, bool $cascade = false): void |
177
|
|
|
{ |
178
|
|
|
$this->commandExecutor->execute(new SetJobDuedateCmd($jobId, $newDuedate, $cascade)); |
179
|
|
|
} |
180
|
|
|
|
181
|
|
|
public function recalculateJobDuedate(string $jobId, bool $creationDateBased): void |
182
|
|
|
{ |
183
|
|
|
$this->commandExecutor->execute(new RecalculateJobDuedateCmd($jobId, $creationDateBased)); |
184
|
|
|
} |
185
|
|
|
|
186
|
|
|
public function setJobPriority(string $jobId, int $priority): void |
187
|
|
|
{ |
188
|
|
|
$this->commandExecutor->execute(new SetJobPriorityCmd($jobId, $priority)); |
189
|
|
|
} |
190
|
|
|
|
191
|
|
|
public function createTablePageQuery(): TablePageQueryInterface |
192
|
|
|
{ |
193
|
|
|
return new TablePageQueryImpl($this->commandExecutor); |
194
|
|
|
} |
195
|
|
|
|
196
|
|
|
public function createJobQuery(): JobQueryInterface |
197
|
|
|
{ |
198
|
|
|
return new JobQueryImpl($this->commandExecutor); |
199
|
|
|
} |
200
|
|
|
|
201
|
|
|
public function createJobDefinitionQuery(): JobDefinitionQueryInterface |
202
|
|
|
{ |
203
|
|
|
return new JobDefinitionQueryImpl($this->commandExecutor); |
204
|
|
|
} |
205
|
|
|
|
206
|
|
|
public function getJobExceptionStacktrace(string $jobId): string |
207
|
|
|
{ |
208
|
|
|
return $this->commandExecutor->execute(new GetJobExceptionStacktraceCmd($jobId)); |
209
|
|
|
} |
210
|
|
|
|
211
|
|
|
public function getProperties(): array |
212
|
|
|
{ |
213
|
|
|
return $this->commandExecutor->execute(new GetPropertiesCmd()); |
214
|
|
|
} |
215
|
|
|
|
216
|
|
|
public function setProperty(string $name, string $value): void |
217
|
|
|
{ |
218
|
|
|
$this->commandExecutor->execute(new SetPropertyCmd($name, $value)); |
219
|
|
|
} |
220
|
|
|
|
221
|
|
|
public function deleteProperty(string $name): void |
222
|
|
|
{ |
223
|
|
|
$this->commandExecutor->execute(new DeletePropertyCmd($name)); |
224
|
|
|
} |
225
|
|
|
|
226
|
|
|
public function setLicenseKey(string $licenseKey): void |
227
|
|
|
{ |
228
|
|
|
$this->commandExecutor->execute(new SetLicenseKeyCmd($licenseKey)); |
229
|
|
|
} |
230
|
|
|
|
231
|
|
|
public function getLicenseKey(): string |
232
|
|
|
{ |
233
|
|
|
return $this->commandExecutor->execute(new GetLicenseKeyCmd()); |
234
|
|
|
} |
235
|
|
|
|
236
|
|
|
public function deleteLicenseKey(): void |
237
|
|
|
{ |
238
|
|
|
$this->commandExecutor->execute(new DeleteLicenseKeyCmd(true)); |
239
|
|
|
} |
240
|
|
|
|
241
|
|
|
public function databaseSchemaUpgrade(Connection $connection, string $catalog, string $schema): string |
242
|
|
|
{ |
243
|
|
|
return $this->commandExecutor->execute(new DbSchemaUpgradeCmd($connection, $catalog, $schema)); |
244
|
|
|
} |
245
|
|
|
|
246
|
|
|
/** |
247
|
|
|
* Purges the database and the deployment cache. |
248
|
|
|
*/ |
249
|
|
|
public function purge(): PurgeReport |
250
|
|
|
{ |
251
|
|
|
return $this->commandExecutor->execute(new PurgeDatabaseAndCacheCmd()); |
252
|
|
|
} |
253
|
|
|
|
254
|
|
|
public function createProcessDefinitionStatisticsQuery(): ProcessDefinitionStatisticsQueryInterface |
255
|
|
|
{ |
256
|
|
|
return new ProcessDefinitionStatisticsQueryImpl($this->commandExecutor); |
257
|
|
|
} |
258
|
|
|
|
259
|
|
|
public function createActivityStatisticsQuery(string $processDefinitionId): ActivityStatisticsQueryInterface |
260
|
|
|
{ |
261
|
|
|
return new ActivityStatisticsQueryImpl($processDefinitionId, $this->commandExecutor); |
262
|
|
|
} |
263
|
|
|
|
264
|
|
|
public function createDeploymentStatisticsQuery(): DeploymentStatisticsQueryInterface |
265
|
|
|
{ |
266
|
|
|
return new DeploymentStatisticsQueryImpl($this->commandExecutor); |
267
|
|
|
} |
268
|
|
|
|
269
|
|
|
public function getRegisteredDeployments(): array |
270
|
|
|
{ |
271
|
|
|
return $this->commandExecutor->execute(new GetRegisteredDeploymentsCmd()); |
272
|
|
|
} |
273
|
|
|
|
274
|
|
|
public function registerDeploymentForJobExecutor(string $deploymentId): void |
275
|
|
|
{ |
276
|
|
|
$this->commandExecutor->execute(new RegisterDeploymentCmd($deploymentId)); |
277
|
|
|
} |
278
|
|
|
|
279
|
|
|
public function unregisterDeploymentForJobExecutor(string $deploymentId): void |
280
|
|
|
{ |
281
|
|
|
$this->commandExecutor->execute(new UnregisterDeploymentCmd($deploymentId)); |
282
|
|
|
} |
283
|
|
|
|
284
|
|
|
public function activateJobDefinitionById(string $jobDefinitionId, bool $activateJobs = false, string $activationDate = null): void |
285
|
|
|
{ |
286
|
|
|
if (!$activateJobs && $activationDate === null) { |
287
|
|
|
$this->updateJobDefinitionSuspensionState() |
288
|
|
|
->byJobDefinitionId($jobDefinitionId) |
289
|
|
|
->activate(); |
290
|
|
|
} elseif ($activationDate === null) { |
291
|
|
|
$this->updateJobDefinitionSuspensionState() |
292
|
|
|
->byJobDefinitionId($jobDefinitionId) |
293
|
|
|
->includeJobs($activateJobs) |
294
|
|
|
->activate(); |
295
|
|
|
} else { |
296
|
|
|
$this->updateJobDefinitionSuspensionState() |
297
|
|
|
->byJobDefinitionId($jobDefinitionId) |
298
|
|
|
->includeJobs($activateJobs) |
299
|
|
|
->executionDate($activationDate) |
300
|
|
|
->activate(); |
301
|
|
|
} |
302
|
|
|
} |
303
|
|
|
|
304
|
|
|
public function suspendJobDefinitionById(string $jobDefinitionId, bool $suspendJobs = false, string $suspensionDate = null): void |
305
|
|
|
{ |
306
|
|
|
if (!$suspendJobs && $suspensionDate === null) { |
307
|
|
|
$this->updateJobDefinitionSuspensionState() |
308
|
|
|
->byJobDefinitionId($jobDefinitionId) |
309
|
|
|
->suspend(); |
310
|
|
|
} elseif ($suspensionDate === null) { |
311
|
|
|
$this->updateJobDefinitionSuspensionState() |
312
|
|
|
->byJobDefinitionId($jobDefinitionId) |
313
|
|
|
->includeJobs($suspendJobs) |
314
|
|
|
->suspend(); |
315
|
|
|
} else { |
316
|
|
|
$this->updateJobDefinitionSuspensionState() |
317
|
|
|
->byJobDefinitionId($jobDefinitionId) |
318
|
|
|
->includeJobs($suspendJobs) |
319
|
|
|
->executionDate($suspensionDate) |
320
|
|
|
->suspend(); |
321
|
|
|
} |
322
|
|
|
} |
323
|
|
|
|
324
|
|
|
public function activateJobDefinitionByProcessDefinitionId(string $processDefinitionId, bool $activateJobs = false, string $activationDate = null): void |
325
|
|
|
{ |
326
|
|
|
if (!$activateJobs && $activationDate === null) { |
327
|
|
|
$this->updateJobDefinitionSuspensionState() |
328
|
|
|
->byProcessDefinitionId($processDefinitionId) |
329
|
|
|
->activate(); |
330
|
|
|
} elseif ($activationDate === null) { |
331
|
|
|
$this->updateJobDefinitionSuspensionState() |
332
|
|
|
->byProcessDefinitionId($processDefinitionId) |
333
|
|
|
->includeJobs($activateJobs) |
334
|
|
|
->activate(); |
335
|
|
|
} else { |
336
|
|
|
$this->updateJobDefinitionSuspensionState() |
337
|
|
|
->byProcessDefinitionId($processDefinitionId) |
338
|
|
|
->includeJobs($activateJobs) |
339
|
|
|
->executionDate($activationDate) |
340
|
|
|
->activate(); |
341
|
|
|
} |
342
|
|
|
} |
343
|
|
|
|
344
|
|
|
public function suspendJobDefinitionByProcessDefinitionId(string $processDefinitionId, bool $suspendJobs = false, string $suspensionDate = null): void |
345
|
|
|
{ |
346
|
|
|
if (!$suspendJobs && $suspensionDate === null) { |
347
|
|
|
$this->updateJobDefinitionSuspensionState() |
348
|
|
|
->byProcessDefinitionId($processDefinitionId) |
349
|
|
|
->suspend(); |
350
|
|
|
} elseif ($suspensionDate === null) { |
351
|
|
|
$this->updateJobDefinitionSuspensionState() |
352
|
|
|
->byProcessDefinitionId($processDefinitionId) |
353
|
|
|
->includeJobs($suspendJobs) |
354
|
|
|
->suspend(); |
355
|
|
|
} else { |
356
|
|
|
$this->updateJobDefinitionSuspensionState() |
357
|
|
|
->byProcessDefinitionId($processDefinitionId) |
358
|
|
|
->includeJobs($suspendJobs) |
359
|
|
|
->executionDate($suspensionDate) |
360
|
|
|
->suspend(); |
361
|
|
|
} |
362
|
|
|
} |
363
|
|
|
|
364
|
|
|
public function activateJobDefinitionByProcessDefinitionKey(string $processDefinitionKey, bool $activateJobs = false, string $activationDate = null): void |
365
|
|
|
{ |
366
|
|
|
if (!$activateJobs && $activationDate === null) { |
367
|
|
|
$this->updateJobDefinitionSuspensionState() |
368
|
|
|
->byProcessDefinitionKey($processDefinitionKey) |
369
|
|
|
->activate(); |
370
|
|
|
} elseif ($activationDate === null) { |
371
|
|
|
$this->updateJobDefinitionSuspensionState() |
372
|
|
|
->byProcessDefinitionKey($processDefinitionKey) |
373
|
|
|
->includeJobs($activateJobs) |
374
|
|
|
->activate(); |
375
|
|
|
} else { |
376
|
|
|
$this->updateJobDefinitionSuspensionState() |
377
|
|
|
->byProcessDefinitionKey($processDefinitionKey) |
378
|
|
|
->includeJobs($activateJobs) |
379
|
|
|
->executionDate($activationDate) |
380
|
|
|
->activate(); |
381
|
|
|
} |
382
|
|
|
} |
383
|
|
|
|
384
|
|
|
public function suspendJobDefinitionByProcessDefinitionKey(string $processDefinitionKey, bool $suspendJobs = false, string $suspensionDate = null): void |
385
|
|
|
{ |
386
|
|
|
if (!$suspendJobs && $suspensionDate === null) { |
387
|
|
|
$this->updateJobDefinitionSuspensionState() |
388
|
|
|
->byProcessDefinitionKey($processDefinitionKey) |
389
|
|
|
->suspend(); |
390
|
|
|
} elseif ($suspensionDate === null) { |
391
|
|
|
$this->updateJobDefinitionSuspensionState() |
392
|
|
|
->byProcessDefinitionKey($processDefinitionKey) |
393
|
|
|
->includeJobs($suspendJobs) |
394
|
|
|
->suspend(); |
395
|
|
|
} else { |
396
|
|
|
$this->updateJobDefinitionSuspensionState() |
397
|
|
|
->byProcessDefinitionKey($processDefinitionKey) |
398
|
|
|
->includeJobs($suspendJobs) |
399
|
|
|
->executionDate($suspensionDate) |
400
|
|
|
->suspend(); |
401
|
|
|
} |
402
|
|
|
} |
403
|
|
|
|
404
|
|
|
public function updateJobDefinitionSuspensionState(): UpdateJobDefinitionSuspensionStateSelectBuilderInterface |
405
|
|
|
{ |
406
|
|
|
return new UpdateJobDefinitionSuspensionStateBuilderImpl($this->commandExecutor); |
407
|
|
|
} |
408
|
|
|
|
409
|
|
|
public function activateJobById(string $jobId): void |
410
|
|
|
{ |
411
|
|
|
$this->updateJobSuspensionState() |
412
|
|
|
->byJobId(jobId) |
|
|
|
|
413
|
|
|
->activate(); |
414
|
|
|
} |
415
|
|
|
|
416
|
|
|
public function activateJobByProcessInstanceId(string $processInstanceId): void |
417
|
|
|
{ |
418
|
|
|
$this->updateJobSuspensionState() |
419
|
|
|
->byProcessInstanceId($processInstanceId) |
420
|
|
|
->activate(); |
421
|
|
|
} |
422
|
|
|
|
423
|
|
|
public function activateJobByJobDefinitionId(string $jobDefinitionId): void |
424
|
|
|
{ |
425
|
|
|
$this->updateJobSuspensionState() |
426
|
|
|
->byJobDefinitionId($jobDefinitionId) |
427
|
|
|
->activate(); |
428
|
|
|
} |
429
|
|
|
|
430
|
|
|
public function activateJobByProcessDefinitionId(string $processDefinitionId): void |
431
|
|
|
{ |
432
|
|
|
$this->updateJobSuspensionState() |
433
|
|
|
->byProcessDefinitionId($processDefinitionId) |
434
|
|
|
->activate(); |
435
|
|
|
} |
436
|
|
|
|
437
|
|
|
public function activateJobByProcessDefinitionKey(string $processDefinitionKey): void |
438
|
|
|
{ |
439
|
|
|
$this->updateJobSuspensionState() |
440
|
|
|
->byProcessDefinitionKey($processDefinitionKey) |
441
|
|
|
->activate(); |
442
|
|
|
} |
443
|
|
|
|
444
|
|
|
public function suspendJobById(string $jobId): void |
445
|
|
|
{ |
446
|
|
|
$this->updateJobSuspensionState() |
447
|
|
|
->byJobId($jobId) |
448
|
|
|
->suspend(); |
449
|
|
|
} |
450
|
|
|
|
451
|
|
|
public function suspendJobByJobDefinitionId(string $jobDefinitionId): void |
452
|
|
|
{ |
453
|
|
|
$this->updateJobSuspensionState() |
454
|
|
|
->byJobDefinitionId($jobDefinitionId) |
455
|
|
|
->suspend(); |
456
|
|
|
} |
457
|
|
|
|
458
|
|
|
public function suspendJobByProcessInstanceId(string $processInstanceId): void |
459
|
|
|
{ |
460
|
|
|
$this->updateJobSuspensionState() |
461
|
|
|
->byProcessInstanceId($processInstanceId) |
462
|
|
|
->suspend(); |
463
|
|
|
} |
464
|
|
|
|
465
|
|
|
public function suspendJobByProcessDefinitionId(string $processDefinitionId): void |
466
|
|
|
{ |
467
|
|
|
$this->updateJobSuspensionState() |
468
|
|
|
->byProcessDefinitionId($processDefinitionId) |
469
|
|
|
->suspend(); |
470
|
|
|
} |
471
|
|
|
|
472
|
|
|
public function suspendJobByProcessDefinitionKey(string $processDefinitionKey): void |
473
|
|
|
{ |
474
|
|
|
$this->updateJobSuspensionState() |
475
|
|
|
->byProcessDefinitionKey($processDefinitionKey) |
476
|
|
|
->suspend(); |
477
|
|
|
} |
478
|
|
|
|
479
|
|
|
public function updateJobSuspensionState(): UpdateJobSuspensionStateSelectBuilderInterface |
480
|
|
|
{ |
481
|
|
|
return new UpdateJobSuspensionStateBuilderImpl($this->commandExecutor); |
482
|
|
|
} |
483
|
|
|
|
484
|
|
|
public function getHistoryLevel(): int |
485
|
|
|
{ |
486
|
|
|
return $this->commandExecutor->execute(new GetHistoryLevelCmd()); |
487
|
|
|
} |
488
|
|
|
|
489
|
|
|
public function createMetricsQuery(): MetricsQueryInterface |
490
|
|
|
{ |
491
|
|
|
return new MetricsQueryImpl($this->commandExecutor); |
492
|
|
|
} |
493
|
|
|
|
494
|
|
|
public function deleteMetrics(string $timestamp = null, string $reporter = null): void |
495
|
|
|
{ |
496
|
|
|
$this->commandExecutor->execute(new DeleteMetricsCmd($timestamp, $reporter)); |
497
|
|
|
} |
498
|
|
|
|
499
|
|
|
public function reportDbMetricsNow(): void |
500
|
|
|
{ |
501
|
|
|
$this->commandExecutor->execute(new ReportDbMetricsCmd()); |
502
|
|
|
} |
503
|
|
|
|
504
|
|
|
public function getUniqueTaskWorkerCount(string $startTime, string $endTime): int |
505
|
|
|
{ |
506
|
|
|
return $this->commandExecutor->execute(new GetUniqueTaskWorkerCountCmd($startTime, $endTime)); |
507
|
|
|
} |
508
|
|
|
|
509
|
|
|
public function deleteTaskMetrics(string $timestamp): void |
510
|
|
|
{ |
511
|
|
|
$this->commandExecutor->execute(new DeleteTaskMetricsCmd($timestamp)); |
512
|
|
|
} |
513
|
|
|
|
514
|
|
|
public function setOverridingJobPriorityForJobDefinition(string $jobDefinitionId, int $priority, bool $cascade = false): void |
515
|
|
|
{ |
516
|
|
|
$this->commandExecutor->execute(new SetJobDefinitionPriorityCmd($jobDefinitionId, $priority, $cascade)); |
517
|
|
|
} |
518
|
|
|
|
519
|
|
|
public function clearOverridingJobPriorityForJobDefinition(string $jobDefinitionId): void |
520
|
|
|
{ |
521
|
|
|
$this->commandExecutor->execute(new SetJobDefinitionPriorityCmd($jobDefinitionId, null, false)); |
522
|
|
|
} |
523
|
|
|
|
524
|
|
|
public function createBatchQuery(): BatchQueryInterface |
525
|
|
|
{ |
526
|
|
|
return new BatchQueryImpl($this->commandExecutor); |
527
|
|
|
} |
528
|
|
|
|
529
|
|
|
public function deleteBatch(string $batchId, bool $cascade): void |
530
|
|
|
{ |
531
|
|
|
$this->commandExecutor->execute(new DeleteBatchCmd($batchId, $cascade)); |
532
|
|
|
} |
533
|
|
|
|
534
|
|
|
public function suspendBatchById(string $batchId): void |
535
|
|
|
{ |
536
|
|
|
$this->commandExecutor->execute(new SuspendBatchCmd($batchId)); |
537
|
|
|
} |
538
|
|
|
|
539
|
|
|
public function activateBatchById(string $batchId): void |
540
|
|
|
{ |
541
|
|
|
$this->commandExecutor->execute(new ActivateBatchCmd($batchId)); |
542
|
|
|
} |
543
|
|
|
|
544
|
|
|
public function createBatchStatisticsQuery(): BatchStatisticsQueryInterface |
545
|
|
|
{ |
546
|
|
|
return new BatchStatisticsQueryImpl($this->commandExecutor); |
547
|
|
|
} |
548
|
|
|
|
549
|
|
|
public function createSchemaLogQuery(): SchemaLogQueryInterface |
550
|
|
|
{ |
551
|
|
|
return new SchemaLogQueryImpl($this->commandExecutor); |
552
|
|
|
} |
553
|
|
|
|
554
|
|
|
public function toggleTelemetry(bool $enabled): void |
555
|
|
|
{ |
556
|
|
|
$this->commandExecutor->execute(new TelemetryConfigureCmd($enabled)); |
557
|
|
|
} |
558
|
|
|
|
559
|
|
|
public function isTelemetryEnabled(): bool |
560
|
|
|
{ |
561
|
|
|
return $this->commandExecutor->execute(new IsTelemetryEnabledCmd()); |
562
|
|
|
} |
563
|
|
|
|
564
|
|
|
public function getTelemetryData(): TelemetryDataInterface |
565
|
|
|
{ |
566
|
|
|
return $this->commandExecutor->execute(new GetTelemetryDataCmd()); |
567
|
|
|
} |
568
|
|
|
|
569
|
|
|
/** |
570
|
|
|
* Adds the web application name to the telemetry data of the engine. |
571
|
|
|
* |
572
|
|
|
* @param webapp |
573
|
|
|
* the web application that is used with the engine |
574
|
|
|
* @return whether the web application was successfully added or not |
575
|
|
|
*/ |
576
|
|
|
public function addWebappToTelemetry(string $webapp): bool |
577
|
|
|
{ |
578
|
|
|
$telemetryRegistry = $this->processEngineConfiguration->getTelemetryRegistry(); |
579
|
|
|
if ($telemetryRegistry !== null) { |
580
|
|
|
$telemetryRegistry->addWebapp($webapp); |
581
|
|
|
return true; |
|
|
|
|
582
|
|
|
} |
583
|
|
|
return false; |
|
|
|
|
584
|
|
|
} |
585
|
|
|
|
586
|
|
|
/** |
587
|
|
|
* Adds the application server information to the telemetry data of the engine. |
588
|
|
|
* |
589
|
|
|
* @param appServerInfo |
590
|
|
|
* a String containing information about the application server |
591
|
|
|
*/ |
592
|
|
|
public function addApplicationServerInfoToTelemetry(string $appServerInfo): void |
593
|
|
|
{ |
594
|
|
|
$telemetryRegistry = $this->processEngineConfiguration->getTelemetryRegistry(); |
595
|
|
|
if ($telemetryRegistry !== null) { |
596
|
|
|
$telemetryRegistry->setApplicationServer($appServerInfo); |
|
|
|
|
597
|
|
|
} |
598
|
|
|
} |
599
|
|
|
|
600
|
|
|
/** |
601
|
|
|
* Sets license key information to the telemetry data of the engine. |
602
|
|
|
* |
603
|
|
|
* @param licenseKeyData |
604
|
|
|
* a data object containing various pieces of information |
605
|
|
|
* about the installed license |
606
|
|
|
*/ |
607
|
|
|
public function setLicenseKeyForTelemetry(LicenseKeyDataImpl $licenseKeyData): void |
608
|
|
|
{ |
609
|
|
|
$telemetryRegistry = $this->processEngineConfiguration->getTelemetryRegistry(); |
610
|
|
|
if ($telemetryRegistry !== null) { |
611
|
|
|
$telemetryRegistry->setLicenseKey($licenseKeyData); |
612
|
|
|
} |
613
|
|
|
} |
614
|
|
|
|
615
|
|
|
public function getLicenseKeyFromTelemetry(): LicenseKeyDataImpl |
616
|
|
|
{ |
617
|
|
|
$telemetryRegistry = $this->processEngineConfiguration->getTelemetryRegistry(); |
618
|
|
|
if ($telemetryRegistry !== null) { |
619
|
|
|
return $telemetryRegistry->getLicenseKey(); |
|
|
|
|
620
|
|
|
} |
621
|
|
|
return null; |
|
|
|
|
622
|
|
|
} |
623
|
|
|
|
624
|
|
|
public function clearTelemetryData(): void |
625
|
|
|
{ |
626
|
|
|
$telemetryRegistry = $this->processEngineConfiguration->getTelemetryRegistry(); |
627
|
|
|
if ($telemetryRegistry !== null) { |
628
|
|
|
$telemetryRegistry->clear(); |
629
|
|
|
} |
630
|
|
|
$metricsRegistry = $this->processEngineConfiguration->getMetricsRegistry(); |
|
|
|
|
631
|
|
|
if ($metricsRegistry !== null) { |
632
|
|
|
$metricsRegistry->clearTelemetryMetrics(); |
633
|
|
|
} |
634
|
|
|
$this->deleteMetrics(null); |
635
|
|
|
} |
636
|
|
|
} |
637
|
|
|
|
This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.