|
1
|
|
|
<?php |
|
2
|
|
|
namespace Dkd\PhpCmis\DataObjects; |
|
3
|
|
|
|
|
4
|
|
|
/* |
|
5
|
|
|
* This file is part of php-cmis-client. |
|
6
|
|
|
* |
|
7
|
|
|
* (c) Sascha Egerer <[email protected]> |
|
8
|
|
|
* |
|
9
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
10
|
|
|
* file that was distributed with this source code. |
|
11
|
|
|
*/ |
|
12
|
|
|
|
|
13
|
|
|
use Dkd\PhpCmis\Definitions\PropertyDefinitionInterface; |
|
14
|
|
|
use Dkd\PhpCmis\Definitions\TypeDefinitionInterface; |
|
15
|
|
|
use Dkd\PhpCmis\Definitions\TypeMutabilityInterface; |
|
16
|
|
|
use Dkd\PhpCmis\Enum\BaseTypeId; |
|
17
|
|
|
use Dkd\PhpCmis\Exception\CmisInvalidArgumentException; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* Abstract type definition data implementation. |
|
21
|
|
|
*/ |
|
22
|
|
|
abstract class AbstractTypeDefinition extends AbstractExtensionData implements TypeDefinitionInterface |
|
23
|
|
|
{ |
|
24
|
|
|
/** |
|
25
|
|
|
* @var string |
|
26
|
|
|
*/ |
|
27
|
|
|
protected $id; |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* @var string |
|
31
|
|
|
*/ |
|
32
|
|
|
protected $localName; |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* @var string |
|
36
|
|
|
*/ |
|
37
|
|
|
protected $localNamespace; |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* @var string |
|
41
|
|
|
*/ |
|
42
|
|
|
protected $queryName; |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* @var string |
|
46
|
|
|
*/ |
|
47
|
|
|
protected $displayName; |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* @var string |
|
51
|
|
|
*/ |
|
52
|
|
|
protected $description; |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* @var BaseTypeId |
|
56
|
|
|
*/ |
|
57
|
|
|
protected $baseTypeId; |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* @var string |
|
61
|
|
|
*/ |
|
62
|
|
|
protected $parentTypeId; |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* @var boolean|null |
|
66
|
|
|
*/ |
|
67
|
|
|
protected $isCreatable; |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* @var boolean|null |
|
71
|
|
|
*/ |
|
72
|
|
|
protected $isFileable; |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* @var boolean|null |
|
76
|
|
|
*/ |
|
77
|
|
|
protected $isQueryable; |
|
78
|
|
|
|
|
79
|
|
|
/** |
|
80
|
|
|
* @var boolean|null |
|
81
|
|
|
*/ |
|
82
|
|
|
protected $isIncludedInSupertypeQuery; |
|
83
|
|
|
|
|
84
|
|
|
/** |
|
85
|
|
|
* @var boolean|null |
|
86
|
|
|
*/ |
|
87
|
|
|
protected $isFulltextIndexed; |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* @var boolean|null |
|
91
|
|
|
*/ |
|
92
|
|
|
protected $isControllableAcl; |
|
93
|
|
|
|
|
94
|
|
|
/** |
|
95
|
|
|
* @var boolean|null |
|
96
|
|
|
*/ |
|
97
|
|
|
protected $isControllablePolicy; |
|
98
|
|
|
|
|
99
|
|
|
/** |
|
100
|
|
|
* @var PropertyDefinitionInterface[] |
|
101
|
|
|
*/ |
|
102
|
|
|
protected $propertyDefinitions = []; |
|
103
|
|
|
|
|
104
|
|
|
/** |
|
105
|
|
|
* @var TypeMutabilityInterface |
|
106
|
|
|
*/ |
|
107
|
|
|
protected $typeMutability; |
|
108
|
|
|
|
|
109
|
|
|
/** |
|
110
|
|
|
* @param string $id The type definition id |
|
111
|
|
|
* @throws CmisInvalidArgumentException Exception is thrown if an empty <code>$id</code> is given |
|
112
|
|
|
*/ |
|
113
|
242 |
|
public function __construct($id) |
|
114
|
|
|
{ |
|
115
|
242 |
|
if (empty($id)) { |
|
116
|
|
|
throw new CmisInvalidArgumentException('Id must not be empty!'); |
|
117
|
|
|
} |
|
118
|
242 |
|
$this->setId($id); |
|
119
|
242 |
|
} |
|
120
|
|
|
|
|
121
|
|
|
/** |
|
122
|
|
|
* Returns the type ID. |
|
123
|
|
|
* |
|
124
|
|
|
* @return string |
|
125
|
|
|
*/ |
|
126
|
27 |
|
public function getId() |
|
127
|
|
|
{ |
|
128
|
27 |
|
return $this->id; |
|
129
|
|
|
} |
|
130
|
|
|
|
|
131
|
|
|
/** |
|
132
|
|
|
* @param string $id |
|
133
|
|
|
*/ |
|
134
|
242 |
|
public function setId($id) |
|
135
|
|
|
{ |
|
136
|
242 |
|
$this->id = $this->castValueToSimpleType('string', $id); |
|
137
|
242 |
|
} |
|
138
|
|
|
|
|
139
|
|
|
/** |
|
140
|
|
|
* Returns the local name. |
|
141
|
|
|
* |
|
142
|
|
|
* @return string |
|
143
|
|
|
*/ |
|
144
|
29 |
|
public function getLocalName() |
|
145
|
|
|
{ |
|
146
|
29 |
|
return $this->localName; |
|
147
|
|
|
} |
|
148
|
|
|
|
|
149
|
|
|
/** |
|
150
|
|
|
* @param string $localName |
|
151
|
|
|
*/ |
|
152
|
36 |
|
public function setLocalName($localName) |
|
153
|
|
|
{ |
|
154
|
36 |
|
$this->localName = $this->castValueToSimpleType('string', $localName); |
|
155
|
36 |
|
} |
|
156
|
|
|
|
|
157
|
|
|
/** |
|
158
|
|
|
* Returns the local namespace. |
|
159
|
|
|
* |
|
160
|
|
|
* @return string |
|
161
|
|
|
*/ |
|
162
|
29 |
|
public function getLocalNamespace() |
|
163
|
|
|
{ |
|
164
|
29 |
|
return $this->localNamespace; |
|
165
|
|
|
} |
|
166
|
|
|
|
|
167
|
|
|
/** |
|
168
|
|
|
* @param string $localNamespace |
|
169
|
|
|
*/ |
|
170
|
36 |
|
public function setLocalNamespace($localNamespace) |
|
171
|
|
|
{ |
|
172
|
36 |
|
$this->localNamespace = $this->castValueToSimpleType('string', $localNamespace, true); |
|
173
|
36 |
|
} |
|
174
|
|
|
|
|
175
|
|
|
/** |
|
176
|
|
|
* Returns the query name |
|
177
|
|
|
* |
|
178
|
|
|
* @return string |
|
179
|
|
|
*/ |
|
180
|
33 |
|
public function getQueryName() |
|
181
|
|
|
{ |
|
182
|
33 |
|
return $this->queryName; |
|
183
|
|
|
} |
|
184
|
|
|
|
|
185
|
|
|
/** |
|
186
|
|
|
* @param string $queryName |
|
187
|
|
|
*/ |
|
188
|
36 |
|
public function setQueryName($queryName) |
|
189
|
|
|
{ |
|
190
|
36 |
|
$this->queryName = $this->castValueToSimpleType('string', $queryName); |
|
191
|
36 |
|
} |
|
192
|
|
|
|
|
193
|
|
|
/** |
|
194
|
|
|
* Returns the display name. |
|
195
|
|
|
* |
|
196
|
|
|
* @return string |
|
197
|
|
|
*/ |
|
198
|
29 |
|
public function getDisplayName() |
|
199
|
|
|
{ |
|
200
|
29 |
|
return $this->displayName; |
|
201
|
|
|
} |
|
202
|
|
|
|
|
203
|
|
|
/** |
|
204
|
|
|
* @param string $displayName |
|
205
|
|
|
*/ |
|
206
|
36 |
|
public function setDisplayName($displayName) |
|
207
|
|
|
{ |
|
208
|
36 |
|
$this->displayName = $this->castValueToSimpleType('string', $displayName); |
|
209
|
36 |
|
} |
|
210
|
|
|
|
|
211
|
|
|
/** |
|
212
|
|
|
* Returns the property description. |
|
213
|
|
|
* |
|
214
|
|
|
* @return string |
|
215
|
|
|
*/ |
|
216
|
29 |
|
public function getDescription() |
|
217
|
|
|
{ |
|
218
|
29 |
|
return $this->description; |
|
219
|
|
|
} |
|
220
|
|
|
|
|
221
|
|
|
/** |
|
222
|
|
|
* @param string $description |
|
223
|
|
|
*/ |
|
224
|
36 |
|
public function setDescription($description) |
|
225
|
|
|
{ |
|
226
|
36 |
|
$this->description = $this->castValueToSimpleType('string', $description); |
|
227
|
36 |
|
} |
|
228
|
|
|
|
|
229
|
|
|
/** |
|
230
|
|
|
* Returns the base object type ID. |
|
231
|
|
|
* |
|
232
|
|
|
* @return BaseTypeId |
|
233
|
|
|
*/ |
|
234
|
23 |
|
public function getBaseTypeId() |
|
235
|
|
|
{ |
|
236
|
23 |
|
return $this->baseTypeId; |
|
237
|
|
|
} |
|
238
|
|
|
|
|
239
|
|
|
/** |
|
240
|
|
|
* @param BaseTypeId $baseTypeId |
|
241
|
|
|
*/ |
|
242
|
3 |
|
public function setBaseTypeId(BaseTypeId $baseTypeId) |
|
243
|
|
|
{ |
|
244
|
3 |
|
$this->baseTypeId = $baseTypeId; |
|
245
|
3 |
|
} |
|
246
|
|
|
|
|
247
|
|
|
/** |
|
248
|
|
|
* Returns the parent type ID. |
|
249
|
|
|
* |
|
250
|
|
|
* @return string |
|
251
|
|
|
*/ |
|
252
|
29 |
|
public function getParentTypeId() |
|
253
|
|
|
{ |
|
254
|
29 |
|
return $this->parentTypeId; |
|
255
|
|
|
} |
|
256
|
|
|
|
|
257
|
|
|
/** |
|
258
|
|
|
* @param string $parentTypeId |
|
259
|
|
|
*/ |
|
260
|
36 |
|
public function setParentTypeId($parentTypeId) |
|
261
|
|
|
{ |
|
262
|
36 |
|
$this->parentTypeId = $this->castValueToSimpleType('string', $parentTypeId, true); |
|
263
|
36 |
|
} |
|
264
|
|
|
|
|
265
|
|
|
/** |
|
266
|
|
|
* Returns if an object of this type can be created. |
|
267
|
|
|
* |
|
268
|
|
|
* @return boolean |
|
269
|
|
|
*/ |
|
270
|
30 |
|
public function isCreatable() |
|
271
|
|
|
{ |
|
272
|
30 |
|
return $this->isCreatable; |
|
273
|
|
|
} |
|
274
|
|
|
|
|
275
|
|
|
/** |
|
276
|
|
|
* @param boolean $isCreatable |
|
277
|
|
|
*/ |
|
278
|
38 |
|
public function setIsCreatable($isCreatable) |
|
279
|
|
|
{ |
|
280
|
38 |
|
$this->isCreatable = $this->castValueToSimpleType('boolean', $isCreatable, true); |
|
281
|
38 |
|
} |
|
282
|
|
|
|
|
283
|
|
|
/** |
|
284
|
|
|
* Returns if an object of this type can be filed. |
|
285
|
|
|
* |
|
286
|
|
|
* @return boolean |
|
287
|
|
|
*/ |
|
288
|
30 |
|
public function isFileable() |
|
289
|
|
|
{ |
|
290
|
30 |
|
return $this->isFileable; |
|
291
|
|
|
} |
|
292
|
|
|
|
|
293
|
|
|
/** |
|
294
|
|
|
* @param boolean $isFileable |
|
295
|
|
|
*/ |
|
296
|
38 |
|
public function setIsFileable($isFileable) |
|
297
|
|
|
{ |
|
298
|
38 |
|
$this->isFileable = $this->castValueToSimpleType('boolean', $isFileable, true); |
|
299
|
38 |
|
} |
|
300
|
|
|
|
|
301
|
|
|
/** |
|
302
|
|
|
* Returns if this type is queryable. |
|
303
|
|
|
* |
|
304
|
|
|
* @return boolean |
|
305
|
|
|
*/ |
|
306
|
30 |
|
public function isQueryable() |
|
307
|
|
|
{ |
|
308
|
30 |
|
return $this->isQueryable; |
|
309
|
|
|
} |
|
310
|
|
|
|
|
311
|
|
|
/** |
|
312
|
|
|
* @param boolean $isQueryable |
|
313
|
|
|
*/ |
|
314
|
38 |
|
public function setIsQueryable($isQueryable) |
|
315
|
|
|
{ |
|
316
|
38 |
|
$this->isQueryable = $this->castValueToSimpleType('boolean', $isQueryable, true); |
|
317
|
38 |
|
} |
|
318
|
|
|
|
|
319
|
|
|
/** |
|
320
|
|
|
* Returns if this type is included in queries that query the super type. |
|
321
|
|
|
* |
|
322
|
|
|
* @return boolean |
|
323
|
|
|
*/ |
|
324
|
30 |
|
public function isIncludedInSupertypeQuery() |
|
325
|
|
|
{ |
|
326
|
30 |
|
return $this->isIncludedInSupertypeQuery; |
|
327
|
|
|
} |
|
328
|
|
|
|
|
329
|
|
|
/** |
|
330
|
|
|
* @param boolean $isIncludedInSupertypeQuery |
|
331
|
|
|
*/ |
|
332
|
38 |
|
public function setIsIncludedInSupertypeQuery($isIncludedInSupertypeQuery) |
|
333
|
|
|
{ |
|
334
|
38 |
|
$this->isIncludedInSupertypeQuery = $this->castValueToSimpleType('boolean', $isIncludedInSupertypeQuery, true); |
|
335
|
38 |
|
} |
|
336
|
|
|
|
|
337
|
|
|
/** |
|
338
|
|
|
* Returns if this type is full text indexed. |
|
339
|
|
|
* |
|
340
|
|
|
* @return boolean |
|
341
|
|
|
*/ |
|
342
|
30 |
|
public function isFulltextIndexed() |
|
343
|
|
|
{ |
|
344
|
30 |
|
return $this->isFulltextIndexed; |
|
345
|
|
|
} |
|
346
|
|
|
|
|
347
|
|
|
/** |
|
348
|
|
|
* Sets if this type is full text indexed. |
|
349
|
|
|
* |
|
350
|
|
|
* @param boolean $isFulltextIndexed |
|
351
|
|
|
*/ |
|
352
|
38 |
|
public function setIsFulltextIndexed($isFulltextIndexed) |
|
353
|
|
|
{ |
|
354
|
38 |
|
$this->isFulltextIndexed = $this->castValueToSimpleType('boolean', $isFulltextIndexed, true); |
|
355
|
38 |
|
} |
|
356
|
|
|
|
|
357
|
|
|
/** |
|
358
|
|
|
* @return boolean |
|
359
|
|
|
*/ |
|
360
|
30 |
|
public function isControllableAcl() |
|
361
|
|
|
{ |
|
362
|
30 |
|
return $this->isControllableAcl; |
|
363
|
|
|
} |
|
364
|
|
|
|
|
365
|
|
|
/** |
|
366
|
|
|
* @param boolean $isControllableAcl |
|
367
|
|
|
*/ |
|
368
|
38 |
|
public function setIsControllableAcl($isControllableAcl) |
|
369
|
|
|
{ |
|
370
|
38 |
|
$this->isControllableAcl = $this->castValueToSimpleType('boolean', $isControllableAcl, true); |
|
371
|
38 |
|
} |
|
372
|
|
|
|
|
373
|
|
|
/** |
|
374
|
|
|
* Returns if objects of this type are controllable by policies. |
|
375
|
|
|
*/ |
|
376
|
30 |
|
public function isControllablePolicy() |
|
377
|
|
|
{ |
|
378
|
30 |
|
return $this->isControllablePolicy; |
|
379
|
|
|
} |
|
380
|
|
|
|
|
381
|
|
|
/** |
|
382
|
|
|
* @param boolean $isControllablePolicy |
|
383
|
|
|
*/ |
|
384
|
38 |
|
public function setIsControllablePolicy($isControllablePolicy) |
|
385
|
|
|
{ |
|
386
|
38 |
|
$this->isControllablePolicy = $this->castValueToSimpleType('boolean', $isControllablePolicy, true); |
|
387
|
38 |
|
} |
|
388
|
|
|
|
|
389
|
|
|
/** |
|
390
|
|
|
* Returns the property definitions for the given id of this type. |
|
391
|
|
|
* |
|
392
|
|
|
* @param string $id id of the property |
|
393
|
|
|
* @return PropertyDefinitionInterface|null the property definition |
|
394
|
|
|
*/ |
|
395
|
2 |
|
public function getPropertyDefinition($id) |
|
396
|
|
|
{ |
|
397
|
2 |
|
return (isset($this->propertyDefinitions[$id]) ? $this->propertyDefinitions[$id] : null); |
|
398
|
|
|
} |
|
399
|
|
|
|
|
400
|
|
|
/** |
|
401
|
|
|
* Returns the property definitions of this type. |
|
402
|
|
|
* |
|
403
|
|
|
* @return PropertyDefinitionInterface[] the property definitions |
|
404
|
|
|
*/ |
|
405
|
23 |
|
public function getPropertyDefinitions() |
|
406
|
|
|
{ |
|
407
|
23 |
|
return $this->propertyDefinitions; |
|
408
|
|
|
} |
|
409
|
|
|
|
|
410
|
|
|
/** |
|
411
|
|
|
* @param PropertyDefinitionInterface[] $propertyDefinitions |
|
412
|
|
|
*/ |
|
413
|
24 |
|
public function setPropertyDefinitions(array $propertyDefinitions) |
|
414
|
|
|
{ |
|
415
|
24 |
|
foreach ($propertyDefinitions as $propertyDefinition) { |
|
416
|
3 |
|
$this->addPropertyDefinition($propertyDefinition); |
|
417
|
24 |
|
} |
|
418
|
24 |
|
} |
|
419
|
|
|
|
|
420
|
|
|
/** |
|
421
|
|
|
* @param PropertyDefinitionInterface $propertyDefinition |
|
422
|
|
|
*/ |
|
423
|
4 |
|
public function addPropertyDefinition(PropertyDefinitionInterface $propertyDefinition) |
|
424
|
|
|
{ |
|
425
|
4 |
|
$this->propertyDefinitions[$propertyDefinition->getId()] = $propertyDefinition; |
|
426
|
4 |
|
} |
|
427
|
|
|
|
|
428
|
|
|
/** |
|
429
|
|
|
* Returns type mutability flags. |
|
430
|
|
|
* |
|
431
|
|
|
* @return TypeMutabilityInterface |
|
432
|
|
|
*/ |
|
433
|
23 |
|
public function getTypeMutability() |
|
434
|
|
|
{ |
|
435
|
23 |
|
return $this->typeMutability; |
|
436
|
|
|
} |
|
437
|
|
|
|
|
438
|
|
|
/** |
|
439
|
|
|
* @param TypeMutabilityInterface $typeMutability |
|
440
|
|
|
*/ |
|
441
|
3 |
|
public function setTypeMutability(TypeMutabilityInterface $typeMutability) |
|
442
|
|
|
{ |
|
443
|
3 |
|
$this->typeMutability = $typeMutability; |
|
444
|
3 |
|
} |
|
445
|
|
|
} |
|
446
|
|
|
|