1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @link https://github.com/old-town/old-town-workflow |
4
|
|
|
* @author Malofeykin Andrey <[email protected]> |
5
|
|
|
*/ |
6
|
|
|
namespace OldTown\Workflow; |
7
|
|
|
|
8
|
|
|
use OldTown\Workflow\Config\ConfigurationInterface; |
9
|
|
|
use OldTown\Workflow\Query\WorkflowExpressionQuery; |
10
|
|
|
use OldTown\Workflow\Spi\StepInterface; |
11
|
|
|
use OldTown\PropertySet\PropertySetInterface; |
12
|
|
|
use OldTown\Workflow\Loader\WorkflowDescriptor; |
13
|
|
|
use OldTown\Workflow\TransientVars\TransientVarsInterface; |
14
|
|
|
use SplObjectStorage; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Interface WorkflowInterface |
18
|
|
|
* |
19
|
|
|
* @package OldTown\Workflow |
20
|
|
|
*/ |
21
|
|
|
interface WorkflowInterface |
22
|
|
|
{ |
23
|
|
|
/** |
24
|
|
|
* Возвращает коллекцию объектов описывающие состояние для текущего экземпляра workflow |
25
|
|
|
* |
26
|
|
|
* @param integer $id id экземпляра workflow |
27
|
|
|
* @return SplObjectStorage|StepInterface[] |
28
|
|
|
*/ |
29
|
|
|
public function getCurrentSteps($id); |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Возвращает состояние для текущего экземпляра workflow |
33
|
|
|
* |
34
|
|
|
* @param integer $id id экземпляра workflow |
35
|
|
|
* @return integer id текущего состояния |
36
|
|
|
*/ |
37
|
|
|
public function getEntryState($id); |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Returns a list of all steps that are completed for the given workflow instance id. |
41
|
|
|
* |
42
|
|
|
* @param integer $id The workflow instance id. |
43
|
|
|
* @return StepInterface[] a List of Steps |
44
|
|
|
*/ |
45
|
|
|
public function getHistorySteps($id); |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* Get the PropertySet for the specified workflow instance id. |
49
|
|
|
* @param integer $id The workflow instance id. |
50
|
|
|
* @return PropertySetInterface |
51
|
|
|
*/ |
52
|
|
|
public function getPropertySet($id); |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Get a collection (Strings) of currently defined permissions for the specified workflow instance. |
56
|
|
|
* @param integer $id id the workflow instance id. |
57
|
|
|
* @param TransientVarsInterface $inputs inputs The inputs to the workflow instance. |
58
|
|
|
* @return [] A List of permissions specified currently (a permission is a string name). |
|
|
|
|
59
|
|
|
*/ |
60
|
|
|
public function getSecurityPermissions($id, TransientVarsInterface $inputs = null); |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* Get the workflow descriptor for the specified workflow name. |
64
|
|
|
* |
65
|
|
|
* @param string $workflowName The workflow name. |
66
|
|
|
* @return WorkflowDescriptor |
67
|
|
|
*/ |
68
|
|
|
public function getWorkflowDescriptor($workflowName); |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* Get the name of the specified workflow instance. |
72
|
|
|
* |
73
|
|
|
* @param integer $id the workflow instance id. |
74
|
|
|
* @return string |
75
|
|
|
*/ |
76
|
|
|
public function getWorkflowName($id); |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* Проверяет имеет ли пользователь достаточно прав, что бы иниициировать вызываемый процесс |
80
|
|
|
* |
81
|
|
|
* @param string $workflowName имя workflow |
82
|
|
|
* @param integer $initialAction id начального состояния |
83
|
|
|
* @param TransientVarsInterface|null $inputs |
84
|
|
|
* |
85
|
|
|
* @return bool |
86
|
|
|
*/ |
87
|
|
|
public function canInitialize($workflowName, $initialAction, TransientVarsInterface $inputs = null); |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* Check if the state of the specified workflow instance can be changed to the new specified one. |
91
|
|
|
* @param integer $id The workflow instance id. |
92
|
|
|
* @param integer $newState The new state id. |
93
|
|
|
* @return boolean true if the state of the workflow can be modified, false otherwise. |
94
|
|
|
*/ |
95
|
|
|
public function canModifyEntryState($id, $newState); |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* Modify the state of the specified workflow instance. |
99
|
|
|
* @param integer $id The workflow instance id. |
100
|
|
|
* @param integer $newState the new state to change the workflow instance to. |
101
|
|
|
* If the new state is {@link com.opensymphony.workflow.spi.WorkflowEntry.KILLED} |
102
|
|
|
* or {@link com.opensymphony.workflow.spi.WorkflowEntry.COMPLETED} |
103
|
|
|
* then all current steps are moved to history steps. If the new state is |
104
|
|
|
*/ |
105
|
|
|
public function changeEntryState($id, $newState); |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* Perform an action on the specified workflow instance. |
109
|
|
|
* @param integer $id The workflow instance id. |
110
|
|
|
* @param integer $actionId The action id to perform (action id's are listed in the workflow descriptor). |
111
|
|
|
* @param TransientVarsInterface $inputs The inputs to the workflow instance. |
112
|
|
|
* instance's current state. |
113
|
|
|
*/ |
114
|
|
|
public function doAction($id, $actionId, TransientVarsInterface $inputs = null); |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* Executes a special trigger-function using the context of the given workflow instance id. |
118
|
|
|
* Note that this method is exposed for Quartz trigger jobs, user code should never call it. |
119
|
|
|
* @param integer $id The workflow instance id |
120
|
|
|
* @param integer $triggerId The id of the special trigger-function |
121
|
|
|
* @thrown WorkflowException |
122
|
|
|
*/ |
123
|
|
|
public function executeTriggerFunction($id, $triggerId); |
124
|
|
|
|
125
|
|
|
/** |
126
|
|
|
* Инициализация workflow. Workflow нужно иницаилизровать прежде, чем выполнять какие либо действия. |
127
|
|
|
* Workflow может быть инициализированно только один раз |
128
|
|
|
* |
129
|
|
|
* @param string $workflowName Имя workflow |
130
|
|
|
* @param integer $initialAction Имя первого шага, с которого начинается workflow |
131
|
|
|
* @param TransientVarsInterface $inputs Данные введеные пользователем |
132
|
|
|
* @return integer |
133
|
|
|
*/ |
134
|
|
|
public function initialize($workflowName, $initialAction, TransientVarsInterface $inputs = null); |
135
|
|
|
|
136
|
|
|
|
137
|
|
|
/** |
138
|
|
|
* Query the workflow store for matching instances |
139
|
|
|
* |
140
|
|
|
* @param WorkflowExpressionQuery $query |
141
|
|
|
* @return array |
142
|
|
|
*/ |
143
|
|
|
public function query(WorkflowExpressionQuery $query); |
144
|
|
|
|
145
|
|
|
|
146
|
|
|
/** |
147
|
|
|
* Получить конфигурацию workflow. Метод также проверяет была ли иницилазированн конфигурация, если нет, то |
148
|
|
|
* инициализирует ее. |
149
|
|
|
* |
150
|
|
|
* Если конфигурация не была установленна, то возвращает конфигурацию по умолчанию |
151
|
|
|
* |
152
|
|
|
* @return ConfigurationInterface Конфигурация которая была установленна |
153
|
|
|
* |
154
|
|
|
*/ |
155
|
|
|
public function getConfiguration(); |
156
|
|
|
|
157
|
|
|
/** |
158
|
|
|
* Устанавливает конфигурацию workflow |
159
|
|
|
* |
160
|
|
|
* @param ConfigurationInterface $configuration |
161
|
|
|
* |
162
|
|
|
* @return $this |
163
|
|
|
*/ |
164
|
|
|
public function setConfiguration(ConfigurationInterface $configuration); |
165
|
|
|
|
166
|
|
|
/** |
167
|
|
|
* Устанавливает резолвер |
168
|
|
|
* |
169
|
|
|
* @param TypeResolverInterface $typeResolver |
170
|
|
|
* |
171
|
|
|
* @return $this |
172
|
|
|
*/ |
173
|
|
|
public function setTypeResolver(TypeResolverInterface $typeResolver); |
174
|
|
|
|
175
|
|
|
/** |
176
|
|
|
* Возвращает резолвер |
177
|
|
|
* |
178
|
|
|
* @return TypeResolverInterface |
179
|
|
|
*/ |
180
|
|
|
public function getResolver(); |
181
|
|
|
} |
182
|
|
|
|
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.