1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl; |
4
|
|
|
|
5
|
|
|
use AlgoWeb\ODataMetadata\IsOK; |
6
|
|
|
use AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\IsOKTraits\TParameterTypeSemanticsTrait; |
7
|
|
|
use AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\IsOKTraits\TSimpleIdentifierTrait; |
8
|
|
|
use AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\IsOKTraits\TUndottedIdentifierTrait; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* Class representing TFunctionType |
12
|
|
|
* |
13
|
|
|
* |
14
|
|
|
* XSD Type: TFunction |
15
|
|
|
*/ |
16
|
|
|
class TFunctionType extends IsOK |
17
|
|
|
{ |
18
|
|
|
use TUndottedIdentifierTrait, TSimpleIdentifierTrait, TParameterTypeSemanticsTrait; |
19
|
|
|
/** |
20
|
|
|
* @property string $name |
21
|
|
|
*/ |
22
|
|
|
private $name = null; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TFunctionReturnTypeType[] $returnType |
26
|
|
|
*/ |
27
|
|
|
private $returnType = []; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @property boolean $aggregate |
31
|
|
|
*/ |
32
|
|
|
private $aggregate = null; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @property boolean $builtIn |
36
|
|
|
*/ |
37
|
|
|
private $builtIn = null; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @property string $storeFunctionName |
41
|
|
|
*/ |
42
|
|
|
private $storeFunctionName = null; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @property boolean $niladicFunction |
46
|
|
|
*/ |
47
|
|
|
private $niladicFunction = null; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @property boolean $isComposable |
51
|
|
|
*/ |
52
|
|
|
private $isComposable = null; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @property string $parameterTypeSemantics |
56
|
|
|
*/ |
57
|
|
|
private $parameterTypeSemantics = "AllowImplicitConversion"; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @property string $schema |
61
|
|
|
*/ |
62
|
|
|
private $schema = null; |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TDocumentationType $documentation |
66
|
|
|
*/ |
67
|
|
|
private $documentation = null; |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @property \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TParameterType[] $parameter |
71
|
|
|
*/ |
72
|
|
|
private $parameter = []; |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* @property string[] $commandText |
76
|
|
|
*/ |
77
|
|
|
private $commandText = []; |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* Gets as name |
81
|
|
|
* |
82
|
|
|
* @return string |
83
|
|
|
*/ |
84
|
|
|
public function getName() |
85
|
|
|
{ |
86
|
|
|
return $this->name; |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* Sets a new name |
91
|
|
|
* |
92
|
|
|
* @param string $name |
93
|
|
|
* @return self |
94
|
|
|
*/ |
95
|
|
|
public function setName($name) |
96
|
|
|
{ |
97
|
|
|
$this->name = $name; |
98
|
|
|
return $this; |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* Adds as returnType |
103
|
|
|
* |
104
|
|
|
* @return self |
105
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TFunctionReturnTypeType $returnType |
106
|
|
|
*/ |
107
|
|
|
public function addToReturnType(TFunctionReturnTypeType $returnType) |
108
|
|
|
{ |
109
|
|
|
$this->returnType[] = $returnType; |
110
|
|
|
return $this; |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* isset returnType |
115
|
|
|
* |
116
|
|
|
* @param scalar $index |
117
|
|
|
* @return boolean |
118
|
|
|
*/ |
119
|
|
|
public function issetReturnType($index) |
120
|
|
|
{ |
121
|
|
|
return isset($this->returnType[$index]); |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* unset returnType |
126
|
|
|
* |
127
|
|
|
* @param scalar $index |
128
|
|
|
* @return void |
129
|
|
|
*/ |
130
|
|
|
public function unsetReturnType($index) |
131
|
|
|
{ |
132
|
|
|
unset($this->returnType[$index]); |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
/** |
136
|
|
|
* Gets as returnType |
137
|
|
|
* |
138
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TFunctionReturnTypeType[] |
139
|
|
|
*/ |
140
|
|
|
public function getReturnType() |
141
|
|
|
{ |
142
|
|
|
return $this->returnType; |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
/** |
146
|
|
|
* Sets a new returnType |
147
|
|
|
* |
148
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TFunctionReturnTypeType[] $returnType |
149
|
|
|
* @return self |
150
|
|
|
*/ |
151
|
|
|
public function setReturnType(array $returnType) |
152
|
|
|
{ |
153
|
|
|
$this->returnType = $returnType; |
154
|
|
|
return $this; |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
/** |
158
|
|
|
* Gets as aggregate |
159
|
|
|
* |
160
|
|
|
* @return boolean |
161
|
|
|
*/ |
162
|
|
|
public function getAggregate() |
163
|
|
|
{ |
164
|
|
|
return $this->aggregate; |
165
|
|
|
} |
166
|
|
|
|
167
|
|
|
/** |
168
|
|
|
* Sets a new aggregate |
169
|
|
|
* |
170
|
|
|
* @param boolean $aggregate |
171
|
|
|
* @return self |
172
|
|
|
*/ |
173
|
|
|
public function setAggregate($aggregate) |
174
|
|
|
{ |
175
|
|
|
$this->aggregate = $aggregate; |
176
|
|
|
return $this; |
177
|
|
|
} |
178
|
|
|
|
179
|
|
|
/** |
180
|
|
|
* Gets as builtIn |
181
|
|
|
* |
182
|
|
|
* @return boolean |
183
|
|
|
*/ |
184
|
|
|
public function getBuiltIn() |
185
|
|
|
{ |
186
|
|
|
return $this->builtIn; |
187
|
|
|
} |
188
|
|
|
|
189
|
|
|
/** |
190
|
|
|
* Sets a new builtIn |
191
|
|
|
* |
192
|
|
|
* @param boolean $builtIn |
193
|
|
|
* @return self |
194
|
|
|
*/ |
195
|
|
|
public function setBuiltIn($builtIn) |
196
|
|
|
{ |
197
|
|
|
$this->builtIn = $builtIn; |
198
|
|
|
return $this; |
199
|
|
|
} |
200
|
|
|
|
201
|
|
|
/** |
202
|
|
|
* Gets as storeFunctionName |
203
|
|
|
* |
204
|
|
|
* @return string |
205
|
|
|
*/ |
206
|
|
|
public function getStoreFunctionName() |
207
|
|
|
{ |
208
|
|
|
return $this->storeFunctionName; |
209
|
|
|
} |
210
|
|
|
|
211
|
|
|
/** |
212
|
|
|
* Sets a new storeFunctionName |
213
|
|
|
* |
214
|
|
|
* @param string $storeFunctionName |
215
|
|
|
* @return self |
216
|
|
|
*/ |
217
|
|
|
public function setStoreFunctionName($storeFunctionName) |
218
|
|
|
{ |
219
|
|
|
$this->storeFunctionName = $storeFunctionName; |
220
|
|
|
return $this; |
221
|
|
|
} |
222
|
|
|
|
223
|
|
|
/** |
224
|
|
|
* Gets as niladicFunction |
225
|
|
|
* |
226
|
|
|
* @return boolean |
227
|
|
|
*/ |
228
|
|
|
public function getNiladicFunction() |
229
|
|
|
{ |
230
|
|
|
return $this->niladicFunction; |
231
|
|
|
} |
232
|
|
|
|
233
|
|
|
/** |
234
|
|
|
* Sets a new niladicFunction |
235
|
|
|
* |
236
|
|
|
* @param boolean $niladicFunction |
237
|
|
|
* @return self |
238
|
|
|
*/ |
239
|
|
|
public function setNiladicFunction($niladicFunction) |
240
|
|
|
{ |
241
|
|
|
$this->niladicFunction = $niladicFunction; |
242
|
|
|
return $this; |
243
|
|
|
} |
244
|
|
|
|
245
|
|
|
/** |
246
|
|
|
* Gets as isComposable |
247
|
|
|
* |
248
|
|
|
* @return boolean |
249
|
|
|
*/ |
250
|
|
|
public function getIsComposable() |
251
|
|
|
{ |
252
|
|
|
return $this->isComposable; |
253
|
|
|
} |
254
|
|
|
|
255
|
|
|
/** |
256
|
|
|
* Sets a new isComposable |
257
|
|
|
* |
258
|
|
|
* @param boolean $isComposable |
259
|
|
|
* @return self |
260
|
|
|
*/ |
261
|
|
|
public function setIsComposable($isComposable) |
262
|
|
|
{ |
263
|
|
|
$this->isComposable = $isComposable; |
264
|
|
|
return $this; |
265
|
|
|
} |
266
|
|
|
|
267
|
|
|
/** |
268
|
|
|
* Gets as parameterTypeSemantics |
269
|
|
|
* |
270
|
|
|
* @return string |
271
|
|
|
*/ |
272
|
|
|
public function getParameterTypeSemantics() |
273
|
|
|
{ |
274
|
|
|
return $this->parameterTypeSemantics; |
275
|
|
|
} |
276
|
|
|
|
277
|
|
|
/** |
278
|
|
|
* Sets a new parameterTypeSemantics |
279
|
|
|
* |
280
|
|
|
* @param string $parameterTypeSemantics |
281
|
|
|
* @return self |
282
|
|
|
*/ |
283
|
|
|
public function setParameterTypeSemantics($parameterTypeSemantics) |
284
|
|
|
{ |
285
|
|
|
$this->parameterTypeSemantics = $parameterTypeSemantics; |
286
|
|
|
return $this; |
287
|
|
|
} |
288
|
|
|
|
289
|
|
|
/** |
290
|
|
|
* Gets as schema |
291
|
|
|
* |
292
|
|
|
* @return string |
293
|
|
|
*/ |
294
|
|
|
public function getSchema() |
295
|
|
|
{ |
296
|
|
|
return $this->schema; |
297
|
|
|
} |
298
|
|
|
|
299
|
|
|
/** |
300
|
|
|
* Sets a new schema |
301
|
|
|
* |
302
|
|
|
* @param string $schema |
303
|
|
|
* @return self |
304
|
|
|
*/ |
305
|
|
|
public function setSchema($schema) |
306
|
|
|
{ |
307
|
|
|
$this->schema = $schema; |
308
|
|
|
return $this; |
309
|
|
|
} |
310
|
|
|
|
311
|
|
|
/** |
312
|
|
|
* Gets as documentation |
313
|
|
|
* |
314
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TDocumentationType |
315
|
|
|
*/ |
316
|
|
|
public function getDocumentation() |
317
|
|
|
{ |
318
|
|
|
return $this->documentation; |
319
|
|
|
} |
320
|
|
|
|
321
|
|
|
/** |
322
|
|
|
* Sets a new documentation |
323
|
|
|
* |
324
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TDocumentationType $documentation |
325
|
|
|
* @return self |
326
|
|
|
*/ |
327
|
|
|
public function setDocumentation(TDocumentationType $documentation) |
328
|
|
|
{ |
329
|
|
|
$this->documentation = $documentation; |
330
|
|
|
return $this; |
331
|
|
|
} |
332
|
|
|
|
333
|
|
|
/** |
334
|
|
|
* Adds as parameter |
335
|
|
|
* |
336
|
|
|
* @return self |
337
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TParameterType $parameter |
338
|
|
|
*/ |
339
|
|
|
public function addToParameter(TParameterType $parameter) |
340
|
|
|
{ |
341
|
|
|
$this->parameter[] = $parameter; |
342
|
|
|
return $this; |
343
|
|
|
} |
344
|
|
|
|
345
|
|
|
/** |
346
|
|
|
* isset parameter |
347
|
|
|
* |
348
|
|
|
* @param scalar $index |
349
|
|
|
* @return boolean |
350
|
|
|
*/ |
351
|
|
|
public function issetParameter($index) |
352
|
|
|
{ |
353
|
|
|
return isset($this->parameter[$index]); |
354
|
|
|
} |
355
|
|
|
|
356
|
|
|
/** |
357
|
|
|
* unset parameter |
358
|
|
|
* |
359
|
|
|
* @param scalar $index |
360
|
|
|
* @return void |
361
|
|
|
*/ |
362
|
|
|
public function unsetParameter($index) |
363
|
|
|
{ |
364
|
|
|
unset($this->parameter[$index]); |
365
|
|
|
} |
366
|
|
|
|
367
|
|
|
/** |
368
|
|
|
* Gets as parameter |
369
|
|
|
* |
370
|
|
|
* @return \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TParameterType[] |
371
|
|
|
*/ |
372
|
|
|
public function getParameter() |
373
|
|
|
{ |
374
|
|
|
return $this->parameter; |
375
|
|
|
} |
376
|
|
|
|
377
|
|
|
/** |
378
|
|
|
* Sets a new parameter |
379
|
|
|
* |
380
|
|
|
* @param \AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TParameterType[] $parameter |
381
|
|
|
* @return self |
382
|
|
|
*/ |
383
|
|
|
public function setParameter(array $parameter) |
384
|
|
|
{ |
385
|
|
|
$this->parameter = $parameter; |
386
|
|
|
return $this; |
387
|
|
|
} |
388
|
|
|
|
389
|
|
|
/** |
390
|
|
|
* Adds as commandText |
391
|
|
|
* |
392
|
|
|
* @return self |
393
|
|
|
* @param string $commandText |
394
|
|
|
*/ |
395
|
|
|
public function addToCommandText($commandText) |
396
|
|
|
{ |
397
|
|
|
$this->commandText[] = $commandText; |
398
|
|
|
return $this; |
399
|
|
|
} |
400
|
|
|
|
401
|
|
|
/** |
402
|
|
|
* isset commandText |
403
|
|
|
* |
404
|
|
|
* @param scalar $index |
405
|
|
|
* @return boolean |
406
|
|
|
*/ |
407
|
|
|
public function issetCommandText($index) |
408
|
|
|
{ |
409
|
|
|
return isset($this->commandText[$index]); |
410
|
|
|
} |
411
|
|
|
|
412
|
|
|
/** |
413
|
|
|
* unset commandText |
414
|
|
|
* |
415
|
|
|
* @param scalar $index |
416
|
|
|
* @return void |
417
|
|
|
*/ |
418
|
|
|
public function unsetCommandText($index) |
419
|
|
|
{ |
420
|
|
|
unset($this->commandText[$index]); |
421
|
|
|
} |
422
|
|
|
|
423
|
|
|
/** |
424
|
|
|
* Gets as commandText |
425
|
|
|
* |
426
|
|
|
* @return string[] |
427
|
|
|
*/ |
428
|
|
|
public function getCommandText() |
429
|
|
|
{ |
430
|
|
|
return $this->commandText; |
431
|
|
|
} |
432
|
|
|
|
433
|
|
|
/** |
434
|
|
|
* Sets a new commandText |
435
|
|
|
* |
436
|
|
|
* @param string $commandText |
437
|
|
|
* @return self |
438
|
|
|
*/ |
439
|
|
|
public function setCommandText(array $commandText) |
440
|
|
|
{ |
441
|
|
|
$this->commandText = $commandText; |
442
|
|
|
return $this; |
443
|
|
|
} |
444
|
|
|
|
445
|
|
|
public function isOK(&$msg = null) |
446
|
|
|
{ |
447
|
|
|
if (!$this->isStringNotNullOrEmpty($this->name)) { |
448
|
|
|
$msg = "Name cannot be null or empty"; |
449
|
|
|
return false; |
450
|
|
|
} |
451
|
|
|
if (null != $this->storeFunctionName && !$this->isStringNotNullOrEmpty($this->storeFunctionName)) { |
452
|
|
|
$msg = "Store function name cannot be empty"; |
453
|
|
|
return false; |
454
|
|
|
} |
455
|
|
|
if (null != $this->parameterTypeSemantics && !$this->isStringNotNullOrEmpty($this->parameterTypeSemantics)) { |
456
|
|
|
$msg = "Parameter type semantics cannot be empty"; |
457
|
|
|
return false; |
458
|
|
|
} |
459
|
|
|
if (null != $this->schema && !$this->isStringNotNullOrEmpty($this->schema)) { |
460
|
|
|
$msg = "Schema cannot be empty"; |
461
|
|
|
return false; |
462
|
|
|
} |
463
|
|
|
if (null != $this->commandText && !$this->isStringNotNullOrEmpty($this->commandText)) { |
464
|
|
|
$msg = "Command text cannot be empty"; |
465
|
|
|
return false; |
466
|
|
|
} |
467
|
|
|
if (null != $this->name && !$this->isTUndottedIdentifierValid($this->name)) { |
468
|
|
|
$msg = "Name must be a valid TUndottedIdentifier"; |
469
|
|
|
return false; |
470
|
|
|
} |
471
|
|
|
if (null != $this->schema && !$this->isTSimpleIdentifierValid($this->schema)) { |
472
|
|
|
$msg = "Schema must be a valid TSimpleIdentifier"; |
473
|
|
|
return false; |
474
|
|
|
} |
475
|
|
|
if (null != $this->parameterTypeSemantics |
476
|
|
|
&& !$this->isTParameterTypeSemanticsValid($this->parameterTypeSemantics)) { |
477
|
|
|
$msg = "Parameter type semantics must be a valid TParameterTypeSemantics"; |
478
|
|
|
return false; |
479
|
|
|
} |
480
|
|
|
if (!$this->isObjectNullOrOK($this->documentation, $msg)) { |
481
|
|
|
return false; |
482
|
|
|
} |
483
|
|
|
if (!$this->isValidArrayOK( |
484
|
|
|
$this->parameter, |
485
|
|
|
'\AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TParameterType', |
486
|
|
|
$msg |
487
|
|
|
)) { |
488
|
|
|
return false; |
489
|
|
|
} |
490
|
|
|
if (!$this->isValidArrayOK( |
491
|
|
|
$this->returnType, |
492
|
|
|
'\AlgoWeb\ODataMetadata\MetadataV3\edm\ssdl\TFunctionReturnTypeType', |
493
|
|
|
$msg |
494
|
|
|
)) { |
495
|
|
|
return false; |
496
|
|
|
} |
497
|
|
|
|
498
|
|
|
return true; |
499
|
|
|
} |
500
|
|
|
} |
501
|
|
|
|