| Total Complexity | 92 |
| Total Lines | 574 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
Complex classes like ProcessDefinitionQueryImpl 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 ProcessDefinitionQueryImpl, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 32 | class ProcessDefinitionQueryImpl extends AbstractQuery implements ProcessDefinitionQueryInterface |
||
| 33 | { |
||
| 34 | protected $id; |
||
| 35 | protected $ids = []; |
||
| 36 | protected $category; |
||
| 37 | protected $categoryLike; |
||
| 38 | protected $name; |
||
| 39 | protected $nameLike; |
||
| 40 | protected $deploymentId; |
||
| 41 | protected $deployedAfter; |
||
| 42 | protected $deployedAt; |
||
| 43 | protected $key; |
||
| 44 | protected $keys = []; |
||
| 45 | protected $keyLike; |
||
| 46 | protected $resourceName; |
||
| 47 | protected $resourceNameLike; |
||
| 48 | protected $version; |
||
| 49 | protected $latest = false; |
||
| 50 | protected $suspensionState; |
||
| 51 | protected $authorizationUserId; |
||
| 52 | protected $cachedCandidateGroups = []; |
||
| 53 | protected $procDefId; |
||
| 54 | protected $incidentType; |
||
| 55 | protected $incidentId; |
||
| 56 | protected $incidentMessage; |
||
| 57 | protected $incidentMessageLike; |
||
| 58 | |||
| 59 | protected $eventSubscriptionName; |
||
| 60 | protected $eventSubscriptionType; |
||
| 61 | |||
| 62 | protected $isTenantIdSet = false; |
||
| 63 | protected $tenantIds = []; |
||
| 64 | protected $includeDefinitionsWithoutTenantId = false; |
||
| 65 | |||
| 66 | protected $isVersionTagSet = false; |
||
| 67 | protected $versionTag; |
||
| 68 | protected $versionTagLike; |
||
| 69 | |||
| 70 | protected $isStartableInTasklist = false; |
||
| 71 | protected $isNotStartableInTasklist = false; |
||
| 72 | protected $startablePermissionCheck = false; |
||
| 73 | // for internal use |
||
| 74 | protected $processDefinitionCreatePermissionChecks = []; |
||
| 75 | private $shouldJoinDeploymentTable = false; |
||
| 76 | |||
| 77 | public function __construct(CommandExecutorInterface $commandExecutor = null) |
||
| 78 | { |
||
| 79 | parent::__construct($commandExecutor); |
||
| 80 | } |
||
| 81 | |||
| 82 | public function processDefinitionId(string $processDefinitionId): ProcessDefinitionQueryImpl |
||
| 83 | { |
||
| 84 | $this->id = $processDefinitionId; |
||
| 85 | return $this; |
||
| 86 | } |
||
| 87 | |||
| 88 | public function processDefinitionIdIn(array $ids): ProcessDefinitionQueryImpl |
||
| 89 | { |
||
| 90 | $this->ids = $ids; |
||
| 91 | return $this; |
||
| 92 | } |
||
| 93 | |||
| 94 | public function processDefinitionCategory(string $category): ProcessDefinitionQueryImpl |
||
| 95 | { |
||
| 96 | EnsureUtil::ensureNotNull("category", "category", $category); |
||
| 97 | $this->category = $category; |
||
| 98 | return $this; |
||
| 99 | } |
||
| 100 | |||
| 101 | public function processDefinitionCategoryLike(string $categoryLike): ProcessDefinitionQueryImpl |
||
| 102 | { |
||
| 103 | EnsureUtil::ensureNotNull("categoryLike", "categoryLike", $categoryLike); |
||
| 104 | $this->categoryLike = $categoryLike; |
||
| 105 | return $this; |
||
| 106 | } |
||
| 107 | |||
| 108 | public function processDefinitionName(string $name): ProcessDefinitionQueryImpl |
||
| 109 | { |
||
| 110 | EnsureUtil::ensureNotNull("name", "name", $name); |
||
| 111 | $this->name = $name; |
||
| 112 | return $this; |
||
| 113 | } |
||
| 114 | |||
| 115 | public function processDefinitionNameLike(string $nameLike): ProcessDefinitionQueryImpl |
||
| 116 | { |
||
| 117 | EnsureUtil::ensureNotNull("nameLike", "nameLike", $nameLike); |
||
| 118 | $this->nameLike = $nameLike; |
||
| 119 | return $this; |
||
| 120 | } |
||
| 121 | |||
| 122 | public function deploymentId(string $deploymentId): ProcessDefinitionQueryImpl |
||
| 123 | { |
||
| 124 | EnsureUtil::ensureNotNull("deploymentId", "deploymentId", $deploymentId); |
||
| 125 | $this->deploymentId = $deploymentId; |
||
| 126 | return $this; |
||
| 127 | } |
||
| 128 | |||
| 129 | public function deployedAfter(string $deployedAfter): ProcessDefinitionQueryImpl |
||
| 130 | { |
||
| 131 | EnsureUtil::ensureNotNull("deployedAfter", "deployedAfter", $deployedAfter); |
||
| 132 | $this->shouldJoinDeploymentTable = true; |
||
| 133 | $this->deployedAfter = $deployedAfter; |
||
| 134 | return $this; |
||
| 135 | } |
||
| 136 | |||
| 137 | public function deployedAt(string $deployedAt): ProcessDefinitionQueryImpl |
||
| 138 | { |
||
| 139 | EnsureUtil::ensureNotNull("deployedAt", "deployedAt", $deployedAt); |
||
| 140 | $this->shouldJoinDeploymentTable = true; |
||
| 141 | $this->deployedAt = $deployedAt; |
||
| 142 | return $this; |
||
| 143 | } |
||
| 144 | |||
| 145 | public function processDefinitionKey(string $key): ProcessDefinitionQueryImpl |
||
| 146 | { |
||
| 147 | EnsureUtil::ensureNotNull("key", "key", $key); |
||
| 148 | $this->key = $key; |
||
| 149 | return $this; |
||
| 150 | } |
||
| 151 | |||
| 152 | public function processDefinitionKeysIn(array $keys): ProcessDefinitionQueryImpl |
||
| 153 | { |
||
| 154 | EnsureUtil::ensureNotNull("keys", "keys", $keys); |
||
| 155 | $this->keys = $keys; |
||
| 156 | return $this; |
||
| 157 | } |
||
| 158 | |||
| 159 | public function processDefinitionKeyLike(string $keyLike): ProcessDefinitionQueryImpl |
||
| 160 | { |
||
| 161 | EnsureUtil::ensureNotNull("keyLike", "keyLike", $keyLike); |
||
| 162 | $this->keyLike = $keyLike; |
||
| 163 | return $this; |
||
| 164 | } |
||
| 165 | |||
| 166 | public function processDefinitionResourceName(string $resourceName): ProcessDefinitionQueryImpl |
||
| 167 | { |
||
| 168 | EnsureUtil::ensureNotNull("resourceName", "resourceName", $resourceName); |
||
| 169 | $this->resourceName = $resourceName; |
||
| 170 | return $this; |
||
| 171 | } |
||
| 172 | |||
| 173 | public function processDefinitionResourceNameLike(string $resourceNameLike): ProcessDefinitionQueryImpl |
||
| 174 | { |
||
| 175 | EnsureUtil::ensureNotNull("resourceNameLike", "resourceNameLike", $resourceNameLike); |
||
| 176 | $this->resourceNameLike = $resourceNameLike; |
||
| 177 | return $this; |
||
| 178 | } |
||
| 179 | |||
| 180 | public function processDefinitionVersion(int $version): ProcessDefinitionQueryImpl |
||
| 181 | { |
||
| 182 | EnsureUtil::ensureNotNull("version", "version", $version); |
||
| 183 | EnsureUtil::ensurePositive("The process definition version must be positive", "version", intval($version)); |
||
| 184 | $this->version = $version; |
||
| 185 | return $this; |
||
| 186 | } |
||
| 187 | |||
| 188 | public function latestVersion(): ProcessDefinitionQueryImpl |
||
| 189 | { |
||
| 190 | $this->latest = true; |
||
| 191 | return $this; |
||
| 192 | } |
||
| 193 | |||
| 194 | public function active(): ProcessDefinitionQueryInterface |
||
| 195 | { |
||
| 196 | $this->suspensionState = SuspensionState::active(); |
||
| 197 | return $this; |
||
| 198 | } |
||
| 199 | |||
| 200 | public function suspended(): ProcessDefinitionQueryInterface |
||
| 201 | { |
||
| 202 | $this->suspensionState = SuspensionState::suspended(); |
||
| 203 | return $this; |
||
| 204 | } |
||
| 205 | |||
| 206 | public function messageEventSubscription(string $messageName): ProcessDefinitionQueryInterface |
||
| 207 | { |
||
| 208 | return $this->eventSubscription(EventType::message(), $messageName); |
||
| 209 | } |
||
| 210 | |||
| 211 | public function messageEventSubscriptionName(string $messageName): ProcessDefinitionQueryInterface |
||
| 212 | { |
||
| 213 | return $this->eventSubscription(EventType::message(), $messageName); |
||
| 214 | } |
||
| 215 | |||
| 216 | public function processDefinitionStarter(string $procDefId): ProcessDefinitionQueryInterface |
||
| 217 | { |
||
| 218 | $this->procDefId = $procDefId; |
||
| 219 | return $this; |
||
| 220 | } |
||
| 221 | |||
| 222 | public function eventSubscription(EventType $eventType, string $eventName): ProcessDefinitionQueryInterface |
||
| 223 | { |
||
| 224 | EnsureUtil::ensureNotNull("event type", "eventType", $eventType); |
||
| 225 | EnsureUtil::ensureNotNull("event name", "eventName", $eventName); |
||
| 226 | $this->eventSubscriptionType = $eventType->name(); |
||
| 227 | $this->eventSubscriptionName = $eventName; |
||
| 228 | return $this; |
||
| 229 | } |
||
| 230 | |||
| 231 | public function incidentType(string $incidentType): ProcessDefinitionQueryInterface |
||
| 232 | { |
||
| 233 | EnsureUtil::ensureNotNull("incident type", "incidentType", $incidentType); |
||
| 234 | $this->incidentType = $incidentType; |
||
| 235 | return $this; |
||
| 236 | } |
||
| 237 | |||
| 238 | public function incidentId(string $incidentId): ProcessDefinitionQueryInterface |
||
| 239 | { |
||
| 240 | EnsureUtil::ensureNotNull("incident id", "incidentId", $incidentId); |
||
| 241 | $this->incidentId = $incidentId; |
||
| 242 | return $this; |
||
| 243 | } |
||
| 244 | |||
| 245 | public function incidentMessage(string $incidentMessage): ProcessDefinitionQueryInterface |
||
| 246 | { |
||
| 247 | EnsureUtil::ensureNotNull("incident message", "incidentMessage", $incidentMessage); |
||
| 248 | $this->incidentMessage = $incidentMessage; |
||
| 249 | return $this; |
||
| 250 | } |
||
| 251 | |||
| 252 | public function incidentMessageLike(string $incidentMessageLike): ProcessDefinitionQueryInterface |
||
| 253 | { |
||
| 254 | EnsureUtil::ensureNotNull("incident messageLike", "incidentMessageLike", $incidentMessageLike); |
||
| 255 | $this->incidentMessageLike = $incidentMessageLike; |
||
| 256 | return $this; |
||
| 257 | } |
||
| 258 | |||
| 259 | protected function hasExcludingConditions(): bool |
||
| 260 | { |
||
| 261 | return parent::hasExcludingConditions() || CompareUtil::elementIsNotContainedInArray($this->id, $this->ids); |
||
|
|
|||
| 262 | } |
||
| 263 | |||
| 264 | public function tenantIdIn(array $tenantIds): ProcessDefinitionQueryImpl |
||
| 265 | { |
||
| 266 | EnsureUtil::ensureNotNull("tenantIds", "tenantIds", $tenantIds); |
||
| 267 | $this->tenantIds = $tenantIds; |
||
| 268 | $this->isTenantIdSet = true; |
||
| 269 | return $this; |
||
| 270 | } |
||
| 271 | |||
| 272 | public function withoutTenantId(): ProcessDefinitionQueryInterface |
||
| 273 | { |
||
| 274 | $this->isTenantIdSet = true; |
||
| 275 | $this->tenantIds = null; |
||
| 276 | return $this; |
||
| 277 | } |
||
| 278 | |||
| 279 | public function includeProcessDefinitionsWithoutTenantId(): ProcessDefinitionQueryInterface |
||
| 280 | { |
||
| 281 | $this->includeDefinitionsWithoutTenantId = true; |
||
| 282 | return $this; |
||
| 283 | } |
||
| 284 | |||
| 285 | public function versionTag(string $versionTag): ProcessDefinitionQueryInterface |
||
| 286 | { |
||
| 287 | EnsureUtil::ensureNotNull("versionTag", "versionTag", $versionTag); |
||
| 288 | $this->versionTag = $versionTag; |
||
| 289 | $this->isVersionTagSet = true; |
||
| 290 | |||
| 291 | return $this; |
||
| 292 | } |
||
| 293 | |||
| 294 | public function versionTagLike(string $versionTagLike): ProcessDefinitionQueryInterface |
||
| 295 | { |
||
| 296 | EnsureUtil::ensureNotNull("versionTagLike", "versionTagLike", $versionTagLike); |
||
| 297 | $this->versionTagLike = $versionTagLike; |
||
| 298 | return $this; |
||
| 299 | } |
||
| 300 | |||
| 301 | public function withoutVersionTag(): ProcessDefinitionQueryInterface |
||
| 302 | { |
||
| 303 | $this->isVersionTagSet = true; |
||
| 304 | $this->versionTag = null; |
||
| 305 | return $this; |
||
| 306 | } |
||
| 307 | |||
| 308 | public function startableInTasklist(): ProcessDefinitionQueryInterface |
||
| 309 | { |
||
| 310 | $this->isStartableInTasklist = true; |
||
| 311 | return $this; |
||
| 312 | } |
||
| 313 | |||
| 314 | public function notStartableInTasklist(): ProcessDefinitionQueryInterface |
||
| 315 | { |
||
| 316 | $this->isNotStartableInTasklist = true; |
||
| 317 | return $this; |
||
| 318 | } |
||
| 319 | |||
| 320 | public function startablePermissionCheck(): ProcessDefinitionQueryInterface |
||
| 321 | { |
||
| 322 | $this->startablePermissionCheck = true; |
||
| 323 | return $this; |
||
| 324 | } |
||
| 325 | |||
| 326 | //sorting //////////////////////////////////////////// |
||
| 327 | |||
| 328 | public function orderByDeploymentId(): ProcessDefinitionQueryInterface |
||
| 329 | { |
||
| 330 | return $this->orderBy(ProcessDefinitionQueryProperty::deploymentId()); |
||
| 331 | } |
||
| 332 | |||
| 333 | public function orderByDeploymentTime(): ProcessDefinitionQueryInterface |
||
| 337 | } |
||
| 338 | |||
| 339 | public function orderByProcessDefinitionKey(): ProcessDefinitionQueryInterface |
||
| 340 | { |
||
| 341 | return $this->orderBy(ProcessDefinitionQueryProperty::processDefinitionKey()); |
||
| 342 | } |
||
| 343 | |||
| 344 | public function orderByProcessDefinitionCategory(): ProcessDefinitionQueryInterface |
||
| 345 | { |
||
| 346 | return $this->orderBy(ProcessDefinitionQueryProperty::processDefinitionCategory()); |
||
| 347 | } |
||
| 348 | |||
| 349 | public function orderByProcessDefinitionId(): ProcessDefinitionQueryInterface |
||
| 350 | { |
||
| 351 | return $this->orderBy(ProcessDefinitionQueryProperty::processDefinitionId()); |
||
| 352 | } |
||
| 353 | |||
| 354 | public function orderByProcessDefinitionVersion(): ProcessDefinitionQueryInterface |
||
| 355 | { |
||
| 356 | return $this->orderBy(ProcessDefinitionQueryProperty::processDefinitionVersion()); |
||
| 357 | } |
||
| 358 | |||
| 359 | public function orderByProcessDefinitionName(): ProcessDefinitionQueryInterface |
||
| 360 | { |
||
| 361 | return $this->orderBy(ProcessDefinitionQueryProperty::processDefinitionName()); |
||
| 362 | } |
||
| 363 | |||
| 364 | public function orderByTenantId(): ProcessDefinitionQueryInterface |
||
| 365 | { |
||
| 366 | return $this->orderBy(ProcessDefinitionQueryProperty::tenantId()); |
||
| 367 | } |
||
| 368 | |||
| 369 | public function orderByVersionTag(): ProcessDefinitionQueryInterface |
||
| 370 | { |
||
| 371 | return $this->orderBy(ProcessDefinitionQueryProperty::versionTag()); |
||
| 372 | } |
||
| 373 | |||
| 374 | //results //////////////////////////////////////////// |
||
| 375 | |||
| 376 | public function executeCount(CommandContext $commandContext): int |
||
| 377 | { |
||
| 378 | $this->checkQueryOk(); |
||
| 379 | // fetch candidate groups |
||
| 380 | $this->getCandidateGroups(); |
||
| 381 | return $commandContext |
||
| 382 | ->getProcessDefinitionManager() |
||
| 383 | ->findProcessDefinitionCountByQueryCriteria($this); |
||
| 384 | } |
||
| 385 | |||
| 386 | public function executeList(CommandContext $commandContext, Page $page): array |
||
| 387 | { |
||
| 388 | $this->checkQueryOk(); |
||
| 389 | // fetch candidate groups |
||
| 390 | $this->getCandidateGroups(); |
||
| 391 | $list = $commandContext |
||
| 392 | ->getProcessDefinitionManager() |
||
| 393 | ->findProcessDefinitionsByQueryCriteria($this, $page); |
||
| 394 | |||
| 395 | $shouldQueryAddBpmnModelInstancesToCache = |
||
| 396 | $commandContext->getProcessEngineConfiguration()->getEnableFetchProcessDefinitionDescription(); |
||
| 397 | if ($this->shouldQueryAddBpmnModelInstancesToCache) { |
||
| 398 | $this->addProcessDefinitionToCacheAndRetrieveDocumentation($list); |
||
| 399 | } |
||
| 400 | |||
| 401 | return $list; |
||
| 402 | } |
||
| 403 | |||
| 404 | protected function addProcessDefinitionToCacheAndRetrieveDocumentation(array $list): void |
||
| 405 | { |
||
| 406 | foreach ($this->list as $processDefinition) { |
||
| 407 | $bpmnModelInstance = Context::getProcessEngineConfiguration() |
||
| 408 | ->getDeploymentCache() |
||
| 409 | ->findBpmnModelInstanceForProcessDefinition($processDefinition); |
||
| 410 | |||
| 411 | $processElement = $bpmnModelInstance->getModelElementById($processDefinition->getKey()); |
||
| 412 | if ($processElement !== null) { |
||
| 413 | $documentations = $processElement->getChildElementsByType(DocumentationInterface::class); |
||
| 414 | $docStrings = []; |
||
| 415 | foreach ($documentations as $documentation) { |
||
| 416 | $docStrings[] = $documentation->getTextContent(); |
||
| 417 | } |
||
| 418 | |||
| 419 | $processDefinitionEntity = $processDefinition; |
||
| 420 | $processDefinitionEntity->setProperty(BpmnParse::PROPERTYNAME_DOCUMENTATION, BpmnParse::parseDocumentation($docStrings)); |
||
| 421 | } |
||
| 422 | } |
||
| 423 | } |
||
| 424 | |||
| 425 | public function checkQueryOk(): void |
||
| 426 | { |
||
| 427 | parent::checkQueryOk(); |
||
| 428 | |||
| 429 | if ($this->latest && ( ($this->id !== null) || ($this->version !== null) || ($this->deploymentId !== null))) { |
||
| 430 | throw new ProcessEngineException("Calling latest() can only be used in combination with key(String) and keyLike(String) or name(String) and nameLike(String)"); |
||
| 431 | } |
||
| 432 | } |
||
| 433 | |||
| 434 | //getters //////////////////////////////////////////// |
||
| 435 | |||
| 436 | public function getDeploymentId(): string |
||
| 437 | { |
||
| 438 | return $this->deploymentId; |
||
| 439 | } |
||
| 440 | |||
| 441 | public function getDeployedAfter(): string |
||
| 442 | { |
||
| 443 | return $this->deployedAfter; |
||
| 444 | } |
||
| 445 | |||
| 446 | public function getDeployedAt(): string |
||
| 447 | { |
||
| 448 | return $this->deployedAt; |
||
| 449 | } |
||
| 450 | |||
| 451 | public function getId(): string |
||
| 452 | { |
||
| 453 | return $this->id; |
||
| 454 | } |
||
| 455 | |||
| 456 | public function getIds(): array |
||
| 457 | { |
||
| 458 | return $this->ids; |
||
| 459 | } |
||
| 460 | |||
| 461 | public function getName(): string |
||
| 462 | { |
||
| 463 | return $this->name; |
||
| 464 | } |
||
| 465 | |||
| 466 | public function getNameLike(): string |
||
| 467 | { |
||
| 468 | return $this->nameLike; |
||
| 469 | } |
||
| 470 | |||
| 471 | public function getKey(): string |
||
| 472 | { |
||
| 473 | return $this->key; |
||
| 474 | } |
||
| 475 | |||
| 476 | public function getKeyLike(): string |
||
| 477 | { |
||
| 478 | return $this->keyLike; |
||
| 479 | } |
||
| 480 | |||
| 481 | public function getVersion(): int |
||
| 482 | { |
||
| 483 | return $this->version; |
||
| 484 | } |
||
| 485 | |||
| 486 | public function isLatest(): bool |
||
| 487 | { |
||
| 488 | return $this->latest; |
||
| 489 | } |
||
| 490 | |||
| 491 | public function getCategory(): string |
||
| 492 | { |
||
| 493 | return $this->category; |
||
| 494 | } |
||
| 495 | |||
| 496 | public function getCategoryLike(): string |
||
| 497 | { |
||
| 498 | return $this->categoryLike; |
||
| 499 | } |
||
| 500 | |||
| 501 | public function getResourceName(): string |
||
| 502 | { |
||
| 503 | return $this->resourceName; |
||
| 504 | } |
||
| 505 | |||
| 506 | public function getResourceNameLike(): string |
||
| 507 | { |
||
| 508 | return $this->resourceNameLike; |
||
| 509 | } |
||
| 510 | |||
| 511 | public function getSuspensionState(): SuspensionState |
||
| 512 | { |
||
| 513 | return $this->suspensionState; |
||
| 514 | } |
||
| 515 | |||
| 516 | public function setSuspensionState(SuspensionState $suspensionState): void |
||
| 517 | { |
||
| 518 | $this->suspensionState = $suspensionState; |
||
| 519 | } |
||
| 520 | |||
| 521 | public function getIncidentId(): string |
||
| 522 | { |
||
| 523 | return $this->incidentId; |
||
| 524 | } |
||
| 525 | |||
| 526 | public function getIncidentType(): string |
||
| 527 | { |
||
| 528 | return $this->incidentType; |
||
| 529 | } |
||
| 530 | |||
| 531 | public function getIncidentMessage(): string |
||
| 532 | { |
||
| 533 | return $this->incidentMessage; |
||
| 534 | } |
||
| 535 | |||
| 536 | public function getIncidentMessageLike(): string |
||
| 539 | } |
||
| 540 | |||
| 541 | public function getVersionTag(): string |
||
| 542 | { |
||
| 543 | return $this->versionTag; |
||
| 544 | } |
||
| 545 | |||
| 546 | public function isStartableInTasklist(): bool |
||
| 547 | { |
||
| 548 | return $this->isStartableInTasklist; |
||
| 549 | } |
||
| 550 | |||
| 551 | public function isNotStartableInTasklist(): bool |
||
| 552 | { |
||
| 553 | return $this->isNotStartableInTasklist; |
||
| 554 | } |
||
| 555 | |||
| 556 | public function isStartablePermissionCheck(): bool |
||
| 557 | { |
||
| 558 | return $this->startablePermissionCheck; |
||
| 559 | } |
||
| 560 | |||
| 561 | public function setProcessDefinitionCreatePermissionChecks(array $processDefinitionCreatePermissionChecks): void |
||
| 562 | { |
||
| 563 | $this->processDefinitionCreatePermissionChecks = $processDefinitionCreatePermissionChecks; |
||
| 564 | } |
||
| 565 | |||
| 566 | public function getProcessDefinitionCreatePermissionChecks(): array |
||
| 567 | { |
||
| 568 | return $this->processDefinitionCreatePermissionChecks; |
||
| 569 | } |
||
| 570 | |||
| 571 | public function isShouldJoinDeploymentTable(): bool |
||
| 572 | { |
||
| 573 | return $this->shouldJoinDeploymentTable; |
||
| 574 | } |
||
| 575 | |||
| 576 | public function addProcessDefinitionCreatePermissionCheck(CompositePermissionCheck $processDefinitionCreatePermissionCheck): void |
||
| 577 | { |
||
| 578 | $this->processDefinitionCreatePermissionChecks = array_merge($this->processDefinitionCreatePermissionChecks, $processDefinitionCreatePermissionCheck->getAllPermissionChecks()); |
||
| 579 | } |
||
| 580 | |||
| 581 | public function getCandidateGroups(): array |
||
| 582 | { |
||
| 583 | if (!empty($this->cachedCandidateGroups)) { |
||
| 584 | return $this->cachedCandidateGroups; |
||
| 585 | } |
||
| 586 | |||
| 587 | if ($this->authorizationUserId !== null) { |
||
| 588 | $groups = Context::getCommandContext() |
||
| 589 | ->getReadOnlyIdentityProvider() |
||
| 590 | ->createGroupQuery() |
||
| 591 | ->groupMember($this->authorizationUserId) |
||
| 592 | ->list(); |
||
| 593 | $this->cachedCandidateGroups = array_map(function ($group) { |
||
| 594 | return $group->getId(); |
||
| 595 | }, $groups); |
||
| 596 | } |
||
| 597 | |||
| 598 | return $this->cachedCandidateGroups; |
||
| 599 | } |
||
| 600 | |||
| 601 | public function startableByUser(string $userId): ProcessDefinitionQueryImpl |
||
| 606 | } |
||
| 607 | } |
||
| 608 |