|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Jabe\Engine\Impl; |
|
4
|
|
|
|
|
5
|
|
|
use Jabe\Engine\ProcessEngineException; |
|
6
|
|
|
use Jabe\Engine\Impl\Interceptor\{ |
|
7
|
|
|
CommandContext, |
|
8
|
|
|
CommandExecutorInterface |
|
9
|
|
|
}; |
|
10
|
|
|
use Jabe\Engine\Management\DeploymentStatisticsQueryInterface; |
|
11
|
|
|
|
|
12
|
|
|
class DeploymentStatisticsQueryImpl extends AbstractQuery implements DeploymentStatisticsQueryInterface |
|
13
|
|
|
{ |
|
14
|
|
|
protected $includeFailedJobs = false; |
|
15
|
|
|
protected $includeIncidents = false; |
|
16
|
|
|
protected $includeIncidentsForType; |
|
17
|
|
|
|
|
18
|
|
|
// for internal use |
|
19
|
|
|
protected $processInstancePermissionChecks = []; |
|
20
|
|
|
protected $jobPermissionChecks = []; |
|
21
|
|
|
protected $incidentPermissionChecks = []; |
|
22
|
|
|
|
|
23
|
|
|
public function __construct(CommandExecutorInterface $executor) |
|
24
|
|
|
{ |
|
25
|
|
|
parent::__construct($executor); |
|
26
|
|
|
} |
|
27
|
|
|
|
|
28
|
|
|
public function includeFailedJobs(): DeploymentStatisticsQueryInterface |
|
29
|
|
|
{ |
|
30
|
|
|
$this->includeFailedJobs = true; |
|
31
|
|
|
return $this; |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
public function includeIncidents(): DeploymentStatisticsQueryInterface |
|
35
|
|
|
{ |
|
36
|
|
|
$this->includeIncidents = true; |
|
37
|
|
|
return $this; |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
public function includeIncidentsForType(string $incidentType): DeploymentStatisticsQueryInterface |
|
41
|
|
|
{ |
|
42
|
|
|
$this->includeIncidentsForType = $incidentType; |
|
43
|
|
|
return $this; |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
public function executeCount(CommandContext $commandContext): int |
|
47
|
|
|
{ |
|
48
|
|
|
$this->checkQueryOk(); |
|
49
|
|
|
return |
|
50
|
|
|
$commandContext |
|
51
|
|
|
->getStatisticsManager() |
|
52
|
|
|
->getStatisticsCountGroupedByDeployment($this); |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
public function executeList(CommandContext $commandContext, Page $page): array |
|
|
|
|
|
|
56
|
|
|
{ |
|
57
|
|
|
$this->checkQueryOk(); |
|
58
|
|
|
return |
|
59
|
|
|
$commandContext |
|
60
|
|
|
->getStatisticsManager() |
|
61
|
|
|
->getStatisticsGroupedByDeployment($this, $page); |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
public function isFailedJobsToInclude(): bool |
|
65
|
|
|
{ |
|
66
|
|
|
return $this->includeFailedJobs; |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
public function isIncidentsToInclude(): bool |
|
70
|
|
|
{ |
|
71
|
|
|
return $this->includeIncidents || $this->includeIncidentsForType != null; |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
protected function checkQueryOk(): void |
|
75
|
|
|
{ |
|
76
|
|
|
parent::checkQueryOk(); |
|
77
|
|
|
if ($this->includeIncidents && $this->includeIncidentsForType != null) { |
|
78
|
|
|
throw new ProcessEngineException("Invalid query: It is not possible to use includeIncident() and includeIncidentForType() to execute one query."); |
|
79
|
|
|
} |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
// getter/setter for authorization check |
|
83
|
|
|
|
|
84
|
|
|
public function getProcessInstancePermissionChecks(): array |
|
85
|
|
|
{ |
|
86
|
|
|
return $this->processInstancePermissionChecks; |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
public function setProcessInstancePermissionChecks(array $processInstancePermissionChecks): void |
|
90
|
|
|
{ |
|
91
|
|
|
$this->processInstancePermissionChecks = $processInstancePermissionChecks; |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
public function addProcessInstancePermissionCheck(array $permissionChecks): void |
|
95
|
|
|
{ |
|
96
|
|
|
$this->processInstancePermissionChecks = array_merge($this->processInstancePermissionChecks, $permissionChecks); |
|
97
|
|
|
} |
|
98
|
|
|
|
|
99
|
|
|
public function getJobPermissionChecks(): array |
|
100
|
|
|
{ |
|
101
|
|
|
return $this->jobPermissionChecks; |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
public function setJobPermissionChecks(array $jobPermissionChecks): void |
|
105
|
|
|
{ |
|
106
|
|
|
$this->jobPermissionChecks = $jobPermissionChecks; |
|
107
|
|
|
} |
|
108
|
|
|
|
|
109
|
|
|
public function addJobPermissionCheck(array $permissionChecks): void |
|
110
|
|
|
{ |
|
111
|
|
|
$this->jobPermissionChecks = array_merge($this->jobPermissionChecks, $permissionChecks); |
|
112
|
|
|
} |
|
113
|
|
|
|
|
114
|
|
|
public function getIncidentPermissionChecks(): array |
|
115
|
|
|
{ |
|
116
|
|
|
return $this->incidentPermissionChecks; |
|
117
|
|
|
} |
|
118
|
|
|
|
|
119
|
|
|
public function setIncidentPermissionChecks(array $incidentPermissionChecks): void |
|
120
|
|
|
{ |
|
121
|
|
|
$this->incidentPermissionChecks = $incidentPermissionChecks; |
|
122
|
|
|
} |
|
123
|
|
|
|
|
124
|
|
|
public function addIncidentPermissionCheck(array $permissionChecks): void |
|
125
|
|
|
{ |
|
126
|
|
|
$this->incidentPermissionChecks = array_merge($this->incidentPermissionChecks, $permissionChecks); |
|
127
|
|
|
} |
|
128
|
|
|
} |
|
129
|
|
|
|
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