1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Jabe\Impl\Json; |
4
|
|
|
|
5
|
|
|
use Jabe\Impl\{ |
6
|
|
|
QueryOperator, |
7
|
|
|
QueryOrderingProperty, |
8
|
|
|
TaskQueryImpl, |
9
|
|
|
TaskQueryVariableValue |
10
|
|
|
}; |
11
|
|
|
use Jabe\Impl\Persistence\Entity\SuspensionState; |
12
|
|
|
use Jabe\Impl\Util\JsonUtil; |
13
|
|
|
use Jabe\Task\{ |
14
|
|
|
DelegationState, |
15
|
|
|
TaskQueryInterface |
16
|
|
|
}; |
17
|
|
|
|
18
|
|
|
class JsonTaskQueryConverter extends JsonObjectConverter |
19
|
|
|
{ |
20
|
|
|
public const ID = "id"; |
21
|
|
|
public const TASK_ID = "taskId"; |
22
|
|
|
public const TASK_ID_IN = "taskIdIn"; |
23
|
|
|
public const NAME = "name"; |
24
|
|
|
public const NAME_NOT_EQUAL = "nameNotEqual"; |
25
|
|
|
public const NAME_LIKE = "nameLike"; |
26
|
|
|
public const NAME_NOT_LIKE = "nameNotLike"; |
27
|
|
|
public const DESCRIPTION = "description"; |
28
|
|
|
public const DESCRIPTION_LIKE = "descriptionLike"; |
29
|
|
|
public const PRIORITY = "priority"; |
30
|
|
|
public const MIN_PRIORITY = "minPriority"; |
31
|
|
|
public const MAX_PRIORITY = "maxPriority"; |
32
|
|
|
public const ASSIGNEE = "assignee"; |
33
|
|
|
public const ASSIGNEE_LIKE = "assigneeLike"; |
34
|
|
|
public const ASSIGNEE_IN = "assigneeIn"; |
35
|
|
|
public const ASSIGNEE_NOT_IN = "assigneeNotIn"; |
36
|
|
|
public const INVOLVED_USER = "involvedUser"; |
37
|
|
|
public const OWNER = "owner"; |
38
|
|
|
public const UNASSIGNED = "unassigned"; |
39
|
|
|
public const ASSIGNED = "assigned"; |
40
|
|
|
public const DELEGATION_STATE = "delegationState"; |
41
|
|
|
public const CANDIDATE_USER = "candidateUser"; |
42
|
|
|
public const CANDIDATE_GROUP = "candidateGroup"; |
43
|
|
|
public const CANDIDATE_GROUPS = "candidateGroups"; |
44
|
|
|
public const WITH_CANDIDATE_GROUPS = "withCandidateGroups"; |
45
|
|
|
public const WITHOUT_CANDIDATE_GROUPS = "withoutCandidateGroups"; |
46
|
|
|
public const WITH_CANDIDATE_USERS = "withCandidateUsers"; |
47
|
|
|
public const WITHOUT_CANDIDATE_USERS = "withoutCandidateUsers"; |
48
|
|
|
public const INCLUDE_ASSIGNED_TASKS = "includeAssignedTasks"; |
49
|
|
|
public const INSTANCE_ID = "instanceId"; |
50
|
|
|
public const PROCESS_INSTANCE_ID = "processInstanceId"; |
51
|
|
|
public const PROCESS_INSTANCE_ID_IN = "processInstanceIdIn"; |
52
|
|
|
public const EXECUTION_ID = "executionId"; |
53
|
|
|
public const ACTIVITY_INSTANCE_ID_IN = "activityInstanceIdIn"; |
54
|
|
|
public const CREATED = "created"; |
55
|
|
|
public const CREATED_BEFORE = "createdBefore"; |
56
|
|
|
public const CREATED_AFTER = "createdAfter"; |
57
|
|
|
public const UPDATED_AFTER = "updatedAfter"; |
58
|
|
|
public const KEY = "key"; |
59
|
|
|
public const KEYS = "keys"; |
60
|
|
|
public const KEY_LIKE = "keyLike"; |
61
|
|
|
public const PARENT_TASK_ID = "parentTaskId"; |
62
|
|
|
public const PROCESS_DEFINITION_KEY = "processDefinitionKey"; |
63
|
|
|
public const PROCESS_DEFINITION_KEYS = "processDefinitionKeys"; |
64
|
|
|
public const PROCESS_DEFINITION_ID = "processDefinitionId"; |
65
|
|
|
public const PROCESS_DEFINITION_NAME = "processDefinitionName"; |
66
|
|
|
public const PROCESS_DEFINITION_NAME_LIKE = "processDefinitionNameLike"; |
67
|
|
|
public const PROCESS_INSTANCE_BUSINESS_KEY = "processInstanceBusinessKey"; |
68
|
|
|
public const PROCESS_INSTANCE_BUSINESS_KEYS = "processInstanceBusinessKeys"; |
69
|
|
|
public const PROCESS_INSTANCE_BUSINESS_KEY_LIKE = "processInstanceBusinessKeyLike"; |
70
|
|
|
public const DUE = "due"; |
71
|
|
|
public const DUE_DATE = "dueDate"; |
72
|
|
|
public const DUE_BEFORE = "dueBefore"; |
73
|
|
|
public const DUE_AFTER = "dueAfter"; |
74
|
|
|
public const WITHOUT_DUE_DATE = "withoutDueDate"; |
75
|
|
|
public const FOLLOW_UP = "followUp"; |
76
|
|
|
public const FOLLOW_UP_DATE = "followUpDate"; |
77
|
|
|
public const FOLLOW_UP_BEFORE = "followUpBefore"; |
78
|
|
|
public const FOLLOW_UP_NULL_ACCEPTED = "followUpNullAccepted"; |
79
|
|
|
public const FOLLOW_UP_AFTER = "followUpAfter"; |
80
|
|
|
public const EXCLUDE_SUBTASKS = "excludeSubtasks"; |
81
|
|
|
/*public const CASE_DEFINITION_KEY = "caseDefinitionKey"; |
82
|
|
|
public const CASE_DEFINITION_ID = "caseDefinitionId"; |
83
|
|
|
public const CASE_DEFINITION_NAME = "caseDefinitionName"; |
84
|
|
|
public const CASE_DEFINITION_NAME_LIKE = "caseDefinitionNameLike"; |
85
|
|
|
public const CASE_INSTANCE_ID = "caseInstanceId"; |
86
|
|
|
public const CASE_INSTANCE_BUSINESS_KEY = "caseInstanceBusinessKey"; |
87
|
|
|
public const CASE_INSTANCE_BUSINESS_KEY_LIKE = "caseInstanceBusinessKeyLike"; |
88
|
|
|
public const CASE_EXECUTION_ID = "caseExecutionId";*/ |
89
|
|
|
public const ACTIVE = "active"; |
90
|
|
|
public const SUSPENDED = "suspended"; |
91
|
|
|
public const PROCESS_VARIABLES = "processVariables"; |
92
|
|
|
public const TASK_VARIABLES = "taskVariables"; |
93
|
|
|
//public const CASE_INSTANCE_VARIABLES = "caseInstanceVariables"; |
94
|
|
|
public const TENANT_IDS = "tenantIds"; |
95
|
|
|
public const WITHOUT_TENANT_ID = "withoutTenantId"; |
96
|
|
|
public const ORDERING_PROPERTIES = "orderingProperties"; |
97
|
|
|
public const OR_QUERIES = "orQueries"; |
98
|
|
|
|
99
|
|
|
//public const ORDER_BY = "orderBy"; |
100
|
|
|
|
101
|
|
|
protected static $variableValueConverter;// = new JsonTaskQueryVariableValueConverter(); |
102
|
|
|
|
103
|
|
|
public static function variableValueConverter(): JsonTaskQueryVariableValueConverter |
104
|
|
|
{ |
105
|
|
|
if (self::$variableValueConverter === null) { |
106
|
|
|
self::$variableValueConverter = new JsonTaskQueryVariableValueConverter(); |
107
|
|
|
} |
108
|
|
|
return self::$variableValueConverter; |
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
public function toJsonObject(/*TaskQueryInterface*/$object, bool $isOrQueryActive = false): ?\stdClass |
112
|
|
|
{ |
113
|
|
|
$json = JsonUtil::createObject(); |
114
|
|
|
$query = $object; |
115
|
|
|
JsonUtil::addField($json, self::TASK_ID, $query->getTaskId()); |
116
|
|
|
JsonUtil::addArrayField($json, self::TASK_ID_IN, $query->getTaskIdIn()); |
117
|
|
|
JsonUtil::addField($json, self::NAME, $query->getName()); |
118
|
|
|
JsonUtil::addField($json, self::NAME_NOT_EQUAL, $query->getNameNotEqual()); |
119
|
|
|
JsonUtil::addField($json, self::NAME_LIKE, $query->getNameLike()); |
120
|
|
|
JsonUtil::addField($json, self::NAME_NOT_LIKE, $query->getNameNotLike()); |
121
|
|
|
JsonUtil::addField($json, self::DESCRIPTION, $query->getDescription()); |
122
|
|
|
JsonUtil::addField($json, self::DESCRIPTION_LIKE, $query->getDescriptionLike()); |
123
|
|
|
JsonUtil::addField($json, self::PRIORITY, $query->getPriority()); |
124
|
|
|
JsonUtil::addField($json, self::MIN_PRIORITY, $query->getMinPriority()); |
125
|
|
|
JsonUtil::addField($json, self::MAX_PRIORITY, $query->getMaxPriority()); |
126
|
|
|
JsonUtil::addField($json, self::ASSIGNEE, $query->getAssignee()); |
127
|
|
|
|
128
|
|
|
if ($query->getAssigneeIn() !== null) { |
129
|
|
|
JsonUtil::addArrayField( |
130
|
|
|
$json, |
131
|
|
|
self::ASSIGNEE_IN, |
132
|
|
|
$query->getAssigneeIn() |
133
|
|
|
); |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
if ($query->getAssigneeNotIn() !== null) { |
137
|
|
|
JsonUtil::addArrayField( |
138
|
|
|
$json, |
139
|
|
|
self::ASSIGNEE_NOT_IN, |
140
|
|
|
$query->getAssigneeNotIn() |
141
|
|
|
); |
142
|
|
|
} |
143
|
|
|
|
144
|
|
|
JsonUtil::addField($json, self::ASSIGNEE_LIKE, $query->getAssigneeLike()); |
145
|
|
|
JsonUtil::addField($json, self::INVOLVED_USER, $query->getInvolvedUser()); |
146
|
|
|
JsonUtil::addField($json, self::OWNER, $query->getOwner()); |
147
|
|
|
JsonUtil::addDefaultField($json, self::UNASSIGNED, false, $query->isUnassigned()); |
|
|
|
|
148
|
|
|
JsonUtil::addDefaultField($json, self::ASSIGNED, false, $query->isAssigned()); |
149
|
|
|
JsonUtil::addField($json, self::DELEGATION_STATE, $query->getDelegationStateString()); |
150
|
|
|
JsonUtil::addField($json, self::CANDIDATE_USER, $query->getCandidateUser()); |
151
|
|
|
JsonUtil::addField($json, self::CANDIDATE_GROUP, $query->getCandidateGroup()); |
152
|
|
|
JsonUtil::addListField($json, self::CANDIDATE_GROUPS, $query->getCandidateGroupsInternal()); |
153
|
|
|
JsonUtil::addDefaultField($json, self::WITH_CANDIDATE_GROUPS, false, $query->isWithCandidateGroups()); |
154
|
|
|
JsonUtil::addDefaultField($json, self::WITHOUT_CANDIDATE_GROUPS, false, $query->isWithoutCandidateGroups()); |
155
|
|
|
JsonUtil::addDefaultField($json, self::WITH_CANDIDATE_USERS, false, $query->isWithCandidateUsers()); |
156
|
|
|
JsonUtil::addDefaultField($json, self::WITHOUT_CANDIDATE_USERS, false, $query->isWithoutCandidateUsers()); |
157
|
|
|
JsonUtil::addField($json, self::INCLUDE_ASSIGNED_TASKS, $query->isIncludeAssignedTasksInternal()); |
158
|
|
|
JsonUtil::addField($json, self::PROCESS_INSTANCE_ID, $query->getProcessInstanceId()); |
159
|
|
|
if ($query->getProcessInstanceIdIn() !== null) { |
160
|
|
|
JsonUtil::addArrayField($json, self::PROCESS_INSTANCE_ID_IN, $query->getProcessInstanceIdIn()); |
161
|
|
|
} |
162
|
|
|
JsonUtil::addField($json, self::EXECUTION_ID, $query->getExecutionId()); |
163
|
|
|
JsonUtil::addArrayField($json, self::ACTIVITY_INSTANCE_ID_IN, $query->getActivityInstanceIdIn()); |
164
|
|
|
JsonUtil::addDateField($json, self::CREATED, $query->getCreateTime()); |
165
|
|
|
JsonUtil::addDateField($json, self::CREATED_BEFORE, $query->getCreateTimeBefore()); |
166
|
|
|
JsonUtil::addDateField($json, self::CREATED_AFTER, $query->getCreateTimeAfter()); |
167
|
|
|
JsonUtil::addDateField($json, self::UPDATED_AFTER, $query->getUpdatedAfter()); |
168
|
|
|
JsonUtil::addField($json, self::KEY, $query->getKey()); |
169
|
|
|
JsonUtil::addArrayField($json, self::KEYS, $query->getKeys()); |
170
|
|
|
JsonUtil::addField($json, self::KEY_LIKE, $query->getKeyLike()); |
171
|
|
|
JsonUtil::addField($json, self::PARENT_TASK_ID, $query->getParentTaskId()); |
172
|
|
|
JsonUtil::addField($json, self::PROCESS_DEFINITION_KEY, $query->getProcessDefinitionKey()); |
173
|
|
|
JsonUtil::addArrayField($json, self::PROCESS_DEFINITION_KEYS, $query->getProcessDefinitionKeys()); |
174
|
|
|
JsonUtil::addField($json, self::PROCESS_DEFINITION_ID, $query->getProcessDefinitionId()); |
175
|
|
|
JsonUtil::addField($json, self::PROCESS_DEFINITION_NAME, $query->getProcessDefinitionName()); |
176
|
|
|
JsonUtil::addField($json, self::PROCESS_DEFINITION_NAME_LIKE, $query->getProcessDefinitionNameLike()); |
177
|
|
|
JsonUtil::addField($json, self::PROCESS_INSTANCE_BUSINESS_KEY, $query->getProcessInstanceBusinessKey()); |
178
|
|
|
JsonUtil::addArrayField($json, self::PROCESS_INSTANCE_BUSINESS_KEYS, $query->getProcessInstanceBusinessKeys()); |
179
|
|
|
JsonUtil::addField($json, self::PROCESS_INSTANCE_BUSINESS_KEY_LIKE, $query->getProcessInstanceBusinessKeyLike()); |
180
|
|
|
$this->addVariablesFields($json, $query->getVariables()); |
181
|
|
|
JsonUtil::addDateField($json, self::DUE, $query->getDueDate()); |
182
|
|
|
JsonUtil::addDateField($json, self::DUE_BEFORE, $query->getDueBefore()); |
183
|
|
|
JsonUtil::addDateField($json, self::DUE_AFTER, $query->getDueAfter()); |
184
|
|
|
JsonUtil::addDefaultField($json, self::WITHOUT_DUE_DATE, false, $query->isWithoutDueDate()); |
185
|
|
|
JsonUtil::addDateField($json, self::FOLLOW_UP, $query->getFollowUpDate()); |
186
|
|
|
JsonUtil::addDateField($json, self::FOLLOW_UP_BEFORE, $query->getFollowUpBefore()); |
187
|
|
|
JsonUtil::addDefaultField($json, self::FOLLOW_UP_NULL_ACCEPTED, false, $query->isFollowUpNullAccepted()); |
188
|
|
|
JsonUtil::addDateField($json, self::FOLLOW_UP_AFTER, $query->getFollowUpAfter()); |
189
|
|
|
JsonUtil::addDefaultField($json, self::EXCLUDE_SUBTASKS, false, $query->isExcludeSubtasks()); |
190
|
|
|
$this->addSuspensionStateField($json, $query->getSuspensionState()); |
191
|
|
|
JsonUtil::addField($json, self::CASE_DEFINITION_KEY, $query->getCaseDefinitionKey()); |
|
|
|
|
192
|
|
|
JsonUtil::addField($json, self::CASE_DEFINITION_ID, $query->getCaseDefinitionId()); |
|
|
|
|
193
|
|
|
JsonUtil::addField($json, self::CASE_DEFINITION_NAME, $query->getCaseDefinitionName()); |
|
|
|
|
194
|
|
|
JsonUtil::addField($json, self::CASE_DEFINITION_NAME_LIKE, $query->getCaseDefinitionNameLike()); |
|
|
|
|
195
|
|
|
//JsonUtil::addField($json, self::CASE_INSTANCE_ID, $query->getCaseInstanceId()); |
196
|
|
|
JsonUtil::addField($json, self::CASE_INSTANCE_BUSINESS_KEY, $query->getCaseInstanceBusinessKey()); |
|
|
|
|
197
|
|
|
JsonUtil::addField($json, self::CASE_INSTANCE_BUSINESS_KEY_LIKE, $query->getCaseInstanceBusinessKeyLike()); |
|
|
|
|
198
|
|
|
JsonUtil::addField($json, self::CASE_EXECUTION_ID, $query->getCaseExecutionId()); |
|
|
|
|
199
|
|
|
$this->addTenantIdFields($json, $query); |
200
|
|
|
|
201
|
|
|
if (count($query->getQueries()) > 1 && !$isOrQueryActive) { |
202
|
|
|
$orQueries = JsonUtil::createArray(); |
203
|
|
|
|
204
|
|
|
foreach ($query->getQueries() as $orQuery) { |
205
|
|
|
if ($orQuery !== null && $orQuery->isOrQueryActive()) { |
206
|
|
|
$orQueries[] = $this->toJsonObject($orQuery, true); |
207
|
|
|
} |
208
|
|
|
} |
209
|
|
|
JsonUtil::addField($json, self::OR_QUERIES, $orQueries); |
210
|
|
|
} |
211
|
|
|
|
212
|
|
|
if ($query->getOrderingProperties() !== null && !empty($query->getOrderingProperties())) { |
213
|
|
|
JsonUtil::addField( |
214
|
|
|
$json, |
215
|
|
|
self::ORDERING_PROPERTIES, |
216
|
|
|
JsonQueryOrderingPropertyConverter::arrayConverter()->toJsonArray($query->getOrderingProperties()) |
217
|
|
|
); |
218
|
|
|
} |
219
|
|
|
|
220
|
|
|
// expressions |
221
|
|
|
foreach ($query->getExpressions() as $key => $value) { |
222
|
|
|
JsonUtil::addField($json, $key . "Expression", $value); |
223
|
|
|
} |
224
|
|
|
return $json; |
225
|
|
|
} |
226
|
|
|
|
227
|
|
|
protected function addSuspensionStateField($jsonObject, SuspensionState $suspensionState = null): void |
228
|
|
|
{ |
229
|
|
|
if ($suspensionState !== null) { |
230
|
|
|
if ($suspensionState->equals(SuspensionState::active())) { |
231
|
|
|
JsonUtil::addField($jsonObject, self::ACTIVE, true); |
232
|
|
|
} elseif ($suspensionState->equals(SuspensionState::suspended())) { |
233
|
|
|
JsonUtil::addField($jsonObject, self::SUSPENDED, true); |
234
|
|
|
} |
235
|
|
|
} |
236
|
|
|
} |
237
|
|
|
|
238
|
|
|
protected function addTenantIdFields($jsonObject, TaskQueryImpl $query): void |
239
|
|
|
{ |
240
|
|
|
if ($query->getTenantIds() !== null) { |
|
|
|
|
241
|
|
|
JsonUtil::addArrayField($jsonObject, self::TENANT_IDS, $query->getTenantIds()); |
242
|
|
|
} |
243
|
|
|
if ($query->isWithoutTenantId()) { |
244
|
|
|
JsonUtil::addField($jsonObject, self::WITHOUT_TENANT_ID, true); |
245
|
|
|
} |
246
|
|
|
} |
247
|
|
|
|
248
|
|
|
protected function addVariablesFields($jsonObject, array $variables): void |
249
|
|
|
{ |
250
|
|
|
foreach ($variables as $variable) { |
251
|
|
|
if ($variable->isProcessInstanceVariable()) { |
252
|
|
|
$this->addVariable($jsonObject, self::PROCESS_VARIABLES, $variable); |
253
|
|
|
} elseif ($variable->isLocal()) { |
254
|
|
|
$this->addVariable($jsonObject, self::TASK_VARIABLES, $variable); |
255
|
|
|
} else { |
256
|
|
|
//$this->addVariable($jsonObject, self::CASE_INSTANCE_VARIABLES, $variable); |
257
|
|
|
} |
258
|
|
|
} |
259
|
|
|
} |
260
|
|
|
|
261
|
|
|
protected function addVariable($jsonObject, string $variableType, TaskQueryVariableValue $variable): void |
262
|
|
|
{ |
263
|
|
|
$variables = JsonUtil::getArray($jsonObject, $variableType); |
264
|
|
|
JsonUtil::addElement($variables, self::variableValueConverter(), $variable); |
265
|
|
|
JsonUtil::addField($jsonObject, $variableType, $variables); |
266
|
|
|
} |
267
|
|
|
|
268
|
|
|
public function toObject(\stdClass $jsonString, bool $isOrQuery = false) |
269
|
|
|
{ |
270
|
|
|
$query = new TaskQueryImpl(); |
271
|
|
|
if ($isOrQuery) { |
272
|
|
|
$query->setOrQueryActive(); |
273
|
|
|
} |
274
|
|
|
$json = $jsonString; |
275
|
|
|
if (property_exists($json, self::OR_QUERIES)) { |
276
|
|
|
foreach (JsonUtil::getArray($json, self::OR_QUERIES) as $jsonElement) { |
277
|
|
|
$query->addOrQuery($this->toObject(JsonUtil::getObject($jsonElement), true)); |
278
|
|
|
} |
279
|
|
|
} |
280
|
|
|
if (property_exists($json, self::TASK_ID)) { |
281
|
|
|
$query->taskId(JsonUtil::getString($json, self::TASK_ID)); |
282
|
|
|
} |
283
|
|
|
if (property_exists($json, self::TASK_ID_IN)) { |
284
|
|
|
$query->taskIdIn(JsonUtil::getArray($json, self::TASK_ID_IN)); |
285
|
|
|
} |
286
|
|
|
if (property_exists($json, self::NAME)) { |
287
|
|
|
$query->taskName(JsonUtil::getString($json, self::NAME)); |
288
|
|
|
} |
289
|
|
|
if (property_exists($json, self::NAME_NOT_EQUAL)) { |
290
|
|
|
$query->taskNameNotEqual(JsonUtil::getString($json, self::NAME_NOT_EQUAL)); |
291
|
|
|
} |
292
|
|
|
if (property_exists($json, self::NAME_LIKE)) { |
293
|
|
|
$query->taskNameLike(JsonUtil::getString($json, self::NAME_LIKE)); |
294
|
|
|
} |
295
|
|
|
if (property_exists($json, self::NAME_NOT_LIKE)) { |
296
|
|
|
$query->taskNameNotLike(JsonUtil::getString($json, self::NAME_NOT_LIKE)); |
297
|
|
|
} |
298
|
|
|
if (property_exists($json, self::DESCRIPTION)) { |
299
|
|
|
$query->taskDescription(JsonUtil::getString($json, self::DESCRIPTION)); |
300
|
|
|
} |
301
|
|
|
if (property_exists($json, self::DESCRIPTION_LIKE)) { |
302
|
|
|
$query->taskDescriptionLike(JsonUtil::getString($json, self::DESCRIPTION_LIKE)); |
303
|
|
|
} |
304
|
|
|
if (property_exists($json, self::PRIORITY)) { |
305
|
|
|
$query->taskPriority(JsonUtil::getInt($json, self::PRIORITY)); |
306
|
|
|
} |
307
|
|
|
if (property_exists($json, self::MIN_PRIORITY)) { |
308
|
|
|
$query->taskMinPriority(JsonUtil::getInt($json, self::MIN_PRIORITY)); |
309
|
|
|
} |
310
|
|
|
if (property_exists($json, self::MAX_PRIORITY)) { |
311
|
|
|
$query->taskMaxPriority(JsonUtil::getInt($json, self::MAX_PRIORITY)); |
312
|
|
|
} |
313
|
|
|
if (property_exists($json, self::ASSIGNEE)) { |
314
|
|
|
$query->taskAssignee(JsonUtil::getString($json, self::ASSIGNEE)); |
315
|
|
|
} |
316
|
|
|
if (property_exists($json, self::ASSIGNEE_LIKE)) { |
317
|
|
|
$query->taskAssigneeLike(JsonUtil::getString($json, self::ASSIGNEE_LIKE)); |
318
|
|
|
} |
319
|
|
|
if (property_exists($json, self::ASSIGNEE_IN)) { |
320
|
|
|
$query->taskAssigneeIn(JsonUtil::getArray($json, self::ASSIGNEE_IN)); |
321
|
|
|
} |
322
|
|
|
if (property_exists($json, self::ASSIGNEE_NOT_IN)) { |
323
|
|
|
$query->taskAssigneeNotIn(JsonUtil::getArray($json, self::ASSIGNEE_NOT_IN)); |
324
|
|
|
} |
325
|
|
|
if (property_exists($json, self::INVOLVED_USER)) { |
326
|
|
|
$query->taskInvolvedUser(JsonUtil::getString($json, self::INVOLVED_USER)); |
327
|
|
|
} |
328
|
|
|
if (property_exists($json, self::OWNER)) { |
329
|
|
|
$query->taskOwner(JsonUtil::getString($json, self::OWNER)); |
330
|
|
|
} |
331
|
|
|
if (property_exists($json, self::ASSIGNED) && JsonUtil::getBoolean($json, self::ASSIGNED)) { |
332
|
|
|
$query->taskAssigned(); |
333
|
|
|
} |
334
|
|
|
if (property_exists($json, self::UNASSIGNED) && JsonUtil::getBoolean($json, self::UNASSIGNED)) { |
335
|
|
|
$query->taskUnassigned(); |
336
|
|
|
} |
337
|
|
|
if (property_exists($json, self::DELEGATION_STATE)) { |
338
|
|
|
$query->taskDelegationState(constant("DelegationState::" . JsonUtil::getString($json, self::DELEGATION_STATE))); |
339
|
|
|
} |
340
|
|
|
if (property_exists($json, self::CANDIDATE_USER)) { |
341
|
|
|
$query->taskCandidateUser(JsonUtil::getString($json, self::CANDIDATE_USER)); |
342
|
|
|
} |
343
|
|
|
if (property_exists($json, self::CANDIDATE_GROUP)) { |
344
|
|
|
$query->taskCandidateGroup(JsonUtil::getString($json, self::CANDIDATE_GROUP)); |
345
|
|
|
} |
346
|
|
|
if (property_exists($json, self::CANDIDATE_GROUPS) && !property_exists($json, self::CANDIDATE_USER) && !property_exists($json, self::CANDIDATE_GROUP)) { |
347
|
|
|
$query->taskCandidateGroupIn(JsonUtil::getArray($json, self::CANDIDATE_GROUPS)); |
348
|
|
|
} |
349
|
|
|
if (property_exists($json, self::WITH_CANDIDATE_GROUPS) && JsonUtil::getBoolean($json, self::WITH_CANDIDATE_GROUPS)) { |
350
|
|
|
$query->withCandidateGroups(); |
351
|
|
|
} |
352
|
|
|
if (property_exists($json, self::WITHOUT_CANDIDATE_GROUPS) && JsonUtil::getBoolean($json, self::WITHOUT_CANDIDATE_GROUPS)) { |
353
|
|
|
$query->withoutCandidateGroups(); |
354
|
|
|
} |
355
|
|
|
if (property_exists($json, self::WITH_CANDIDATE_USERS) && JsonUtil::getBoolean($json, self::WITH_CANDIDATE_USERS)) { |
356
|
|
|
$query->withCandidateUsers(); |
357
|
|
|
} |
358
|
|
|
if (property_exists($json, self::WITHOUT_CANDIDATE_USERS) && JsonUtil::getBoolean($json, self::WITHOUT_CANDIDATE_USERS)) { |
359
|
|
|
$query->withoutCandidateUsers(); |
360
|
|
|
} |
361
|
|
|
if (property_exists($json, self::INCLUDE_ASSIGNED_TASKS) && JsonUtil::getBoolean($json, self::INCLUDE_ASSIGNED_TASKS)) { |
362
|
|
|
$query->includeAssignedTasksInternal(); |
363
|
|
|
} |
364
|
|
|
if (property_exists($json, self::PROCESS_INSTANCE_ID)) { |
365
|
|
|
$query->processInstanceId(JsonUtil::getString($json, self::PROCESS_INSTANCE_ID)); |
366
|
|
|
} |
367
|
|
|
if (property_exists($json, self::PROCESS_INSTANCE_ID_IN)) { |
368
|
|
|
$query->processInstanceIdIn(JsonUtil::getArray($json, self::PROCESS_INSTANCE_ID_IN)); |
369
|
|
|
} |
370
|
|
|
if (property_exists($json, self::EXECUTION_ID)) { |
371
|
|
|
$query->executionId(JsonUtil::getString($json, self::EXECUTION_ID)); |
372
|
|
|
} |
373
|
|
|
if (property_exists($json, self::ACTIVITY_INSTANCE_ID_IN)) { |
374
|
|
|
$query->activityInstanceIdIn(JsonUtil::getArray($json, self::ACTIVITY_INSTANCE_ID_IN)); |
375
|
|
|
} |
376
|
|
|
if (property_exists($json, self::CREATED)) { |
377
|
|
|
$query->taskCreatedOn((new \DateTime())->setTimestamp(JsonUtil::getLong($json, self::CREATED))->format('c')); |
378
|
|
|
} |
379
|
|
|
if (property_exists($json, self::CREATED_BEFORE)) { |
380
|
|
|
$query->taskCreatedBefore((new \DateTime())->setTimestamp(JsonUtil::getLong($json, self::CREATED_BEFORE))->format('c')); |
381
|
|
|
} |
382
|
|
|
if (property_exists($json, self::CREATED_AFTER)) { |
383
|
|
|
$query->taskCreatedAfter((new \DateTime())->setTimestamp(JsonUtil::getLong($json, self::CREATED_AFTER))->format('c')); |
384
|
|
|
} |
385
|
|
|
if (property_exists($json, self::UPDATED_AFTER)) { |
386
|
|
|
$query->taskUpdatedAfter((new \DateTime())->setTimestamp(JsonUtil::getLong($json, self::UPDATED_AFTER))->format('c')); |
|
|
|
|
387
|
|
|
} |
388
|
|
|
if (property_exists($json, self::KEY)) { |
389
|
|
|
$query->taskDefinitionKey(JsonUtil::getString($json, self::KEY)); |
390
|
|
|
} |
391
|
|
|
if (property_exists($json, self::KEYS)) { |
392
|
|
|
$query->taskDefinitionKeyIn(JsonUtil::getArray($json, self::KEYS)); |
393
|
|
|
} |
394
|
|
|
if (property_exists($json, self::KEY_LIKE)) { |
395
|
|
|
$query->taskDefinitionKeyLike(JsonUtil::getString($json, self::KEY_LIKE)); |
396
|
|
|
} |
397
|
|
|
if (property_exists($json, self::PARENT_TASK_ID)) { |
398
|
|
|
$query->taskParentTaskId(JsonUtil::getString($json, self::PARENT_TASK_ID)); |
399
|
|
|
} |
400
|
|
|
if (property_exists($json, self::PROCESS_DEFINITION_KEY)) { |
401
|
|
|
$query->processDefinitionKey(JsonUtil::getString($json, self::PROCESS_DEFINITION_KEY)); |
402
|
|
|
} |
403
|
|
|
if (property_exists($json, self::PROCESS_DEFINITION_KEYS)) { |
404
|
|
|
$query->processDefinitionKeyIn(JsonUtil::getArray($json, self::PROCESS_DEFINITION_KEYS)); |
405
|
|
|
} |
406
|
|
|
if (property_exists($json, self::PROCESS_DEFINITION_ID)) { |
407
|
|
|
$query->processDefinitionId(JsonUtil::getString($json, self::PROCESS_DEFINITION_ID)); |
408
|
|
|
} |
409
|
|
|
if (property_exists($json, self::PROCESS_DEFINITION_NAME)) { |
410
|
|
|
$query->processDefinitionName(JsonUtil::getString($json, self::PROCESS_DEFINITION_NAME)); |
411
|
|
|
} |
412
|
|
|
if (property_exists($json, self::PROCESS_DEFINITION_NAME_LIKE)) { |
413
|
|
|
$query->processDefinitionNameLike(JsonUtil::getString($json, self::PROCESS_DEFINITION_NAME_LIKE)); |
414
|
|
|
} |
415
|
|
|
if (property_exists($json, self::PROCESS_INSTANCE_BUSINESS_KEY)) { |
416
|
|
|
$query->processInstanceBusinessKey(JsonUtil::getString($json, self::PROCESS_INSTANCE_BUSINESS_KEY)); |
417
|
|
|
} |
418
|
|
|
if (property_exists($json, self::PROCESS_INSTANCE_BUSINESS_KEYS)) { |
419
|
|
|
$query->processInstanceBusinessKeyIn(JsonUtil::getArray($json, self::PROCESS_INSTANCE_BUSINESS_KEYS)); |
420
|
|
|
} |
421
|
|
|
if (property_exists($json, self::PROCESS_INSTANCE_BUSINESS_KEY_LIKE)) { |
422
|
|
|
$query->processInstanceBusinessKeyLike(JsonUtil::getString($json, self::PROCESS_INSTANCE_BUSINESS_KEY_LIKE)); |
423
|
|
|
} |
424
|
|
|
if (property_exists($json, self::TASK_VARIABLES)) { |
425
|
|
|
$this->addVariables($query, JsonUtil::getArray($json, self::TASK_VARIABLES), true, false); |
426
|
|
|
} |
427
|
|
|
if (property_exists($json, self::PROCESS_VARIABLES)) { |
428
|
|
|
$this->addVariables($query, JsonUtil::getArray($json, self::PROCESS_VARIABLES), false, true); |
429
|
|
|
} |
430
|
|
|
/*if (property_exists($json, self::CASE_INSTANCE_VARIABLES)) { |
431
|
|
|
addVariables(query, JsonUtil::getArray($json, self::CASE_INSTANCE_VARIABLES), false, false); |
432
|
|
|
}*/ |
433
|
|
|
if (property_exists($json, self::DUE)) { |
434
|
|
|
$query->dueDate((new \DateTime())->setTimestamp(JsonUtil::getLong($json, self::DUE))->format('c')); |
435
|
|
|
} |
436
|
|
|
if (property_exists($json, self::DUE_BEFORE)) { |
437
|
|
|
$query->dueBefore((new \DateTime())->setTimestamp(JsonUtil::getLong($json, self::DUE_BEFORE))->format('c')); |
438
|
|
|
} |
439
|
|
|
if (property_exists($json, self::DUE_AFTER)) { |
440
|
|
|
$query->dueAfter((new \DateTime())->setTimestamp(JsonUtil::getLong($json, self::DUE_AFTER))->format('c')); |
441
|
|
|
} |
442
|
|
|
if (property_exists($json, self::WITHOUT_DUE_DATE)) { |
443
|
|
|
$query->withoutDueDate(); |
444
|
|
|
} |
445
|
|
|
if (property_exists($json, self::FOLLOW_UP)) { |
446
|
|
|
$query->followUpDate((new \DateTime())->setTimestamp(JsonUtil::getLong($json, self::FOLLOW_UP))->format('c')); |
447
|
|
|
} |
448
|
|
|
if (property_exists($json, self::FOLLOW_UP_BEFORE)) { |
449
|
|
|
$query->followUpBefore((new \DateTime())->setTimestamp(JsonUtil::getLong($json, self::FOLLOW_UP_BEFORE))->format('c')); |
450
|
|
|
} |
451
|
|
|
if (property_exists($json, self::FOLLOW_UP_AFTER)) { |
452
|
|
|
$query->followUpAfter((new \DateTime())->setTimestamp(JsonUtil::getLong($json, self::FOLLOW_UP_AFTER))->format('c')); |
453
|
|
|
} |
454
|
|
|
if (property_exists($json, self::FOLLOW_UP_NULL_ACCEPTED)) { |
455
|
|
|
$query->setFollowUpNullAccepted(JsonUtil::getBoolean($json, self::FOLLOW_UP_NULL_ACCEPTED)); |
456
|
|
|
} |
457
|
|
|
if (property_exists($json, self::EXCLUDE_SUBTASKS) && JsonUtil::getBoolean($json, self::EXCLUDE_SUBTASKS)) { |
458
|
|
|
$query->excludeSubtasks(); |
459
|
|
|
} |
460
|
|
|
if (property_exists($json, self::SUSPENDED) && JsonUtil::getBoolean($json, self::SUSPENDED)) { |
461
|
|
|
$query->suspended(); |
462
|
|
|
} |
463
|
|
|
if (property_exists($json, self::ACTIVE) && JsonUtil::getBoolean($json, self::ACTIVE)) { |
464
|
|
|
$query->active(); |
465
|
|
|
} |
466
|
|
|
/*if (property_exists($json, self::CASE_DEFINITION_KEY)) { |
467
|
|
|
$query->caseDefinitionKey(JsonUtil::getString($json, self::CASE_DEFINITION_KEY)); |
468
|
|
|
} |
469
|
|
|
if (property_exists($json, self::CASE_DEFINITION_ID)) { |
470
|
|
|
$query->caseDefinitionId(JsonUtil::getString($json, self::CASE_DEFINITION_ID)); |
471
|
|
|
} |
472
|
|
|
if (property_exists($json, self::CASE_DEFINITION_NAME)) { |
473
|
|
|
$query->caseDefinitionName(JsonUtil::getString($json, self::CASE_DEFINITION_NAME)); |
474
|
|
|
} |
475
|
|
|
if (property_exists($json, self::CASE_DEFINITION_NAME_LIKE)) { |
476
|
|
|
$query->caseDefinitionNameLike(JsonUtil::getString($json, self::CASE_DEFINITION_NAME_LIKE)); |
477
|
|
|
} |
478
|
|
|
if (property_exists($json, self::CASE_INSTANCE_ID)) { |
479
|
|
|
$query->caseInstanceId(JsonUtil::getString($json, self::CASE_INSTANCE_ID)); |
480
|
|
|
} |
481
|
|
|
if (property_exists($json, self::CASE_INSTANCE_BUSINESS_KEY)) { |
482
|
|
|
$query->caseInstanceBusinessKey(JsonUtil::getString($json, self::CASE_INSTANCE_BUSINESS_KEY)); |
483
|
|
|
} |
484
|
|
|
if (property_exists($json, self::CASE_INSTANCE_BUSINESS_KEY_LIKE)) { |
485
|
|
|
$query->caseInstanceBusinessKeyLike(JsonUtil::getString($json, self::CASE_INSTANCE_BUSINESS_KEY_LIKE)); |
486
|
|
|
} |
487
|
|
|
if (property_exists($json, self::CASE_EXECUTION_ID)) { |
488
|
|
|
$query->caseExecutionId(JsonUtil::getString($json, self::CASE_EXECUTION_ID)); |
489
|
|
|
}*/ |
490
|
|
|
if (property_exists($json, self::TENANT_IDS)) { |
491
|
|
|
$query->tenantIdIn(JsonUtil::getArray($json, self::TENANT_IDS)); |
492
|
|
|
} |
493
|
|
|
if (property_exists($json, self::WITHOUT_TENANT_ID)) { |
494
|
|
|
$query->withoutTenantId(); |
495
|
|
|
} |
496
|
|
|
if (property_exists($json, self::ORDERING_PROPERTIES)) { |
497
|
|
|
$jsonArray = JsonUtil::getArray($json, self::ORDERING_PROPERTIES); |
498
|
|
|
$query->setOrderingProperties(JsonQueryOrderingPropertyConverter::arrayConverter()->toObject($jsonArray)); |
499
|
|
|
} |
500
|
|
|
|
501
|
|
|
// expressions |
502
|
|
|
foreach ($json as $key => $value) { |
503
|
|
|
if (str_ends_with($key, "Expression")) { |
504
|
|
|
$expression = JsonUtil::getString($json, self::key); |
|
|
|
|
505
|
|
|
$query->addExpression(substr($key, 0, strlen($key) - strlen("Expression")), $expression); |
506
|
|
|
} |
507
|
|
|
} |
508
|
|
|
|
509
|
|
|
return $query; |
510
|
|
|
} |
511
|
|
|
|
512
|
|
|
protected function addVariables(TaskQueryImpl $query, array $variables, bool $isTaskVariable, bool $isProcessVariable): void |
513
|
|
|
{ |
514
|
|
|
foreach ($variables as $variable) { |
515
|
|
|
$variableObj = JsonUtil::getObject($variable); |
516
|
|
|
$name = JsonUtil::getString($variableObj, self::NAME); |
517
|
|
|
$rawValue = JsonUtil::getRawObject($variableObj, "value"); |
|
|
|
|
518
|
|
|
$operator = constant("QueryOperator::", JsonUtil::getString($variableObj, "operator")); |
|
|
|
|
519
|
|
|
$query->addVariable($name, $rawValue, $operator, $isTaskVariable, $isProcessVariable); |
520
|
|
|
} |
521
|
|
|
} |
522
|
|
|
} |
523
|
|
|
|
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.