|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Jabe\Impl\Cmd; |
|
4
|
|
|
|
|
5
|
|
|
use Jabe\History\UserOperationLogEntryInterface; |
|
6
|
|
|
use Jabe\Impl\Interceptor\{ |
|
7
|
|
|
CommandInterface, |
|
8
|
|
|
CommandContext |
|
9
|
|
|
}; |
|
10
|
|
|
use Jabe\Impl\Persistence\Entity\{ |
|
11
|
|
|
ProcessDefinitionManager, |
|
12
|
|
|
PropertyChange, |
|
13
|
|
|
UserOperationLogManager |
|
14
|
|
|
}; |
|
15
|
|
|
use Jabe\Impl\Util\EnsureUtil; |
|
16
|
|
|
|
|
17
|
|
|
abstract class AbstractDeleteProcessDefinitionCmd implements CommandInterface, \Serializable |
|
18
|
|
|
{ |
|
19
|
|
|
protected $cascade; |
|
20
|
|
|
protected $skipCustomListeners; |
|
21
|
|
|
protected $skipIoMappings; |
|
22
|
|
|
|
|
23
|
|
|
public function serialize() |
|
24
|
|
|
{ |
|
25
|
|
|
return json_encode([ |
|
26
|
|
|
'cascade' => $this->cascade, |
|
27
|
|
|
'skipCustomListeners' => $this->skipCustomListeners, |
|
28
|
|
|
'skipIoMappings' => $this->skipIoMappings |
|
29
|
|
|
]); |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
public function unserialize($data) |
|
33
|
|
|
{ |
|
34
|
|
|
$json = json_decode($data); |
|
35
|
|
|
$this->cascade = $json->cascade; |
|
36
|
|
|
$this->skipCustomListeners = $json->skipCustomListeners; |
|
37
|
|
|
$this->skipIoMappings = $json->skipIoMappings; |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
protected function deleteProcessDefinitionCmd(CommandContext $commandContext, string $processDefinitionId, bool $cascade, bool $skipCustomListeners, bool $skipIoMappings): void |
|
|
|
|
|
|
41
|
|
|
{ |
|
42
|
|
|
EnsureUtil::ensureNotNull("processDefinitionId", $processDefinitionId); |
|
43
|
|
|
|
|
44
|
|
|
$processDefinition = $commandContext->getProcessDefinitionManager() |
|
45
|
|
|
->findLatestProcessDefinitionById($processDefinitionId); |
|
46
|
|
|
EnsureUtil::ensureNotNull( |
|
47
|
|
|
"No process definition found with id '" . $processDefinitionId . "'", |
|
48
|
|
|
"processDefinition", |
|
49
|
|
|
$processDefinition |
|
50
|
|
|
); |
|
51
|
|
|
|
|
52
|
|
|
$commandCheckers = $commandContext->getProcessEngineConfiguration()->getCommandCheckers(); |
|
|
|
|
|
|
53
|
|
|
foreach ($commandCheckers as $checker) { |
|
54
|
|
|
$checker->checkDeleteProcessDefinitionById($processDefinitionId); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
$userOperationLogManager = $commandContext->getOperationLogManager(); |
|
58
|
|
|
$userOperationLogManager->logProcessDefinitionOperation( |
|
59
|
|
|
UserOperationLogEntryInterface::OPERATION_TYPE_DELETE, |
|
60
|
|
|
$processDefinitionId, |
|
61
|
|
|
$processDefinition->getKey(), |
|
62
|
|
|
new PropertyChange("cascade", false, $cascade) |
|
63
|
|
|
); |
|
64
|
|
|
|
|
65
|
|
|
$definitionManager = $commandContext->getProcessDefinitionManager(); |
|
66
|
|
|
$definitionManager->deleteProcessDefinition($processDefinition, $processDefinitionId, $cascade, $cascade, $this->skipCustomListeners, $this->skipIoMappings); |
|
67
|
|
|
} |
|
68
|
|
|
} |
|
69
|
|
|
|
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.