1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Jabe\Engine\Impl\Cmd; |
4
|
|
|
|
5
|
|
|
use Jabe\Engine\Exception\NotFoundException; |
6
|
|
|
use Jabe\Engine\History\UserOperationLogEntryInterface; |
7
|
|
|
use Jabe\Engine\Impl\Interceptor\{ |
8
|
|
|
CommandInterface, |
9
|
|
|
CommandContext |
10
|
|
|
}; |
11
|
|
|
use Jabe\Engine\Impl\Persistence\Entity\{ |
12
|
|
|
JobEntity, |
13
|
|
|
PropertyChange |
14
|
|
|
}; |
15
|
|
|
use Jabe\Engine\Impl\Util\EnsureUtil; |
16
|
|
|
|
17
|
|
|
class SetJobPriorityCmd implements CommandInterface |
18
|
|
|
{ |
19
|
|
|
public const JOB_PRIORITY_PROPERTY = "priority"; |
20
|
|
|
protected $jobId; |
21
|
|
|
protected $priority; |
22
|
|
|
|
23
|
|
|
public function __construct(string $jobId, int $priority) |
24
|
|
|
{ |
25
|
|
|
$this->jobId = $jobId; |
26
|
|
|
$this->priority = $priority; |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
public function execute(CommandContext $commandContext) |
30
|
|
|
{ |
31
|
|
|
EnsureUtil::ensureNotNull("job id must not be null", "jobId", $this->jobId); |
32
|
|
|
|
33
|
|
|
$job = $commandContext->getJobManager()->findJobById($this->jobId); |
34
|
|
|
EnsureUtil::ensureNotNull("No job found with id '" . $this->jobId . "'", "job", $job); |
35
|
|
|
|
36
|
|
|
foreach ($commandContext->getProcessEngineConfiguration()->getCommandCheckers() as $checker) { |
|
|
|
|
37
|
|
|
$checker->checkUpdateJob($job); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
$currentPriority = $job->getPriority(); |
|
|
|
|
41
|
|
|
$job->setPriority($this->priority); |
42
|
|
|
|
43
|
|
|
//$this->createOpLogEntry($commandContext, $currentPriority, $job); |
44
|
|
|
|
45
|
|
|
return null; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/*protected function createOpLogEntry(CommandContext $commandContext, int $previousPriority, JobEntity $job): void |
49
|
|
|
{ |
50
|
|
|
$propertyChange = new PropertyChange(self::JOB_PRIORITY_PROPERTY, $previousPriority, $job->getPriority()); |
51
|
|
|
$commandContext |
52
|
|
|
->getOperationLogManager() |
53
|
|
|
->logJobOperation( |
54
|
|
|
UserOperationLogEntryInterface::OPERATION_TYPE_SET_PRIORITY, |
55
|
|
|
$job->getId(), |
56
|
|
|
$job->getJobDefinitionId(), |
57
|
|
|
$job->getProcessInstanceId(), |
58
|
|
|
$job->getProcessDefinitionId(), |
59
|
|
|
$job->getProcessDefinitionKey(), |
60
|
|
|
[$propertyChange] |
61
|
|
|
); |
62
|
|
|
}*/ |
63
|
|
|
} |
64
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.