|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* (c) Kitodo. Key to digital objects e.V. <[email protected]> |
|
5
|
|
|
* |
|
6
|
|
|
* This file is part of the Kitodo and TYPO3 projects. |
|
7
|
|
|
* |
|
8
|
|
|
* @license GNU General Public License version 3 or later. |
|
9
|
|
|
* For the full copyright and license information, please read the |
|
10
|
|
|
* LICENSE.txt file that was distributed with this source code. |
|
11
|
|
|
*/ |
|
12
|
|
|
|
|
13
|
|
|
namespace Kitodo\Dlf\Domain\Model; |
|
14
|
|
|
|
|
15
|
|
|
use TYPO3\CMS\Extbase\Annotation as Extbase; |
|
16
|
|
|
use TYPO3\CMS\Extbase\Persistence\ObjectStorage; |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* Domain model of the 'Metadata'. |
|
20
|
|
|
* |
|
21
|
|
|
* @package TYPO3 |
|
22
|
|
|
* @subpackage dlf |
|
23
|
|
|
* @access public |
|
24
|
|
|
*/ |
|
25
|
|
|
class Metadata extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity |
|
26
|
|
|
{ |
|
27
|
|
|
/** |
|
28
|
|
|
* @var \Kitodo\Dlf\Domain\Model\Metadata |
|
29
|
|
|
*/ |
|
30
|
|
|
protected $l18nParent; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* @var int |
|
34
|
|
|
*/ |
|
35
|
|
|
protected $sorting; |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* @var string |
|
39
|
|
|
*/ |
|
40
|
|
|
protected $label; |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* @var string |
|
44
|
|
|
*/ |
|
45
|
|
|
protected $indexName; |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Kitodo\Dlf\Domain\Model\MetadataFormat> |
|
49
|
|
|
* @Extbase\ORM\Lazy |
|
50
|
|
|
* @Extbase\ORM\Cascade("remove") |
|
51
|
|
|
*/ |
|
52
|
|
|
protected $format; |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* @var string |
|
56
|
|
|
*/ |
|
57
|
|
|
protected $defaultValue; |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* @var string |
|
61
|
|
|
*/ |
|
62
|
|
|
protected $wrap; |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* @var int |
|
66
|
|
|
*/ |
|
67
|
|
|
protected $indexTokenized; |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* @var int |
|
71
|
|
|
*/ |
|
72
|
|
|
protected $indexStored; |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* @var int |
|
76
|
|
|
*/ |
|
77
|
|
|
protected $indexIndexed; |
|
78
|
|
|
|
|
79
|
|
|
/** |
|
80
|
|
|
* @var float |
|
81
|
|
|
*/ |
|
82
|
|
|
protected $indexBoost; |
|
83
|
|
|
|
|
84
|
|
|
/** |
|
85
|
|
|
* @var int |
|
86
|
|
|
*/ |
|
87
|
|
|
protected $isSortable; |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* @var int |
|
91
|
|
|
*/ |
|
92
|
|
|
protected $isFacet; |
|
93
|
|
|
|
|
94
|
|
|
/** |
|
95
|
|
|
* @var int |
|
96
|
|
|
*/ |
|
97
|
|
|
protected $isListed; |
|
98
|
|
|
|
|
99
|
|
|
/** |
|
100
|
|
|
* @var int |
|
101
|
|
|
*/ |
|
102
|
|
|
protected $indexAutocomplete; |
|
103
|
|
|
|
|
104
|
|
|
/** |
|
105
|
|
|
* @var int |
|
106
|
|
|
*/ |
|
107
|
|
|
protected $status; |
|
108
|
|
|
|
|
109
|
|
|
/** |
|
110
|
|
|
* constructor |
|
111
|
|
|
*/ |
|
112
|
|
|
public function __construct() |
|
113
|
|
|
{ |
|
114
|
|
|
// Do not remove the next line: It would break the functionality |
|
115
|
|
|
$this->initStorageObjects(); |
|
116
|
|
|
} |
|
117
|
|
|
|
|
118
|
|
|
protected function initStorageObjects() |
|
119
|
|
|
{ |
|
120
|
|
|
$this->format = new ObjectStorage(); |
|
121
|
|
|
} |
|
122
|
|
|
|
|
123
|
|
|
/** |
|
124
|
|
|
* @return \Kitodo\Dlf\Domain\Model\Metadata |
|
125
|
|
|
*/ |
|
126
|
|
|
public function getL18nParent(): Metadata |
|
127
|
|
|
{ |
|
128
|
|
|
return $this->l18nParent; |
|
129
|
|
|
} |
|
130
|
|
|
|
|
131
|
|
|
/** |
|
132
|
|
|
* @param int $l18nParent |
|
133
|
|
|
*/ |
|
134
|
|
|
public function setL18nParent(Metadata $l18nParent): void |
|
135
|
|
|
{ |
|
136
|
|
|
$this->l18nParent = $l18nParent; |
|
137
|
|
|
} |
|
138
|
|
|
|
|
139
|
|
|
/** |
|
140
|
|
|
* @return int |
|
141
|
|
|
*/ |
|
142
|
|
|
public function getSorting(): int |
|
143
|
|
|
{ |
|
144
|
|
|
return $this->sorting; |
|
145
|
|
|
} |
|
146
|
|
|
|
|
147
|
|
|
/** |
|
148
|
|
|
* @param int $sorting |
|
149
|
|
|
*/ |
|
150
|
|
|
public function setSorting(int $sorting): void |
|
151
|
|
|
{ |
|
152
|
|
|
$this->sorting = $sorting; |
|
153
|
|
|
} |
|
154
|
|
|
|
|
155
|
|
|
/** |
|
156
|
|
|
* @return string |
|
157
|
|
|
*/ |
|
158
|
|
|
public function getLabel(): string |
|
159
|
|
|
{ |
|
160
|
|
|
return $this->label; |
|
161
|
|
|
} |
|
162
|
|
|
|
|
163
|
|
|
/** |
|
164
|
|
|
* @param string $label |
|
165
|
|
|
*/ |
|
166
|
|
|
public function setLabel(string $label): void |
|
167
|
|
|
{ |
|
168
|
|
|
$this->label = $label; |
|
169
|
|
|
} |
|
170
|
|
|
|
|
171
|
|
|
/** |
|
172
|
|
|
* @return string |
|
173
|
|
|
*/ |
|
174
|
|
|
public function getIndexName(): string |
|
175
|
|
|
{ |
|
176
|
|
|
return $this->indexName; |
|
177
|
|
|
} |
|
178
|
|
|
|
|
179
|
|
|
/** |
|
180
|
|
|
* @param string $indexName |
|
181
|
|
|
*/ |
|
182
|
|
|
public function setIndexName(string $indexName): void |
|
183
|
|
|
{ |
|
184
|
|
|
$this->indexName = $indexName; |
|
185
|
|
|
} |
|
186
|
|
|
|
|
187
|
|
|
/** |
|
188
|
|
|
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Kitodo\Dlf\Domain\Model\MetadataFormat> $format |
|
189
|
|
|
*/ |
|
190
|
|
|
public function getFormat() |
|
191
|
|
|
{ |
|
192
|
|
|
return $this->format; |
|
193
|
|
|
} |
|
194
|
|
|
|
|
195
|
|
|
/** |
|
196
|
|
|
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Kitodo\Dlf\Domain\Model\MetadataFormat> $format |
|
197
|
|
|
*/ |
|
198
|
|
|
public function setFormat(ObjectStorage $format): void |
|
199
|
|
|
{ |
|
200
|
|
|
$this->format = $format; |
|
201
|
|
|
} |
|
202
|
|
|
|
|
203
|
|
|
/** |
|
204
|
|
|
* Adds a Format |
|
205
|
|
|
* |
|
206
|
|
|
* @param \Kitodo\Dlf\Domain\Model\MetadataFormat $format |
|
207
|
|
|
* |
|
208
|
|
|
* @return void |
|
209
|
|
|
*/ |
|
210
|
|
|
public function addFormat(MetadataFormat $format) |
|
211
|
|
|
{ |
|
212
|
|
|
$this->format->attach($format); |
|
213
|
|
|
} |
|
214
|
|
|
|
|
215
|
|
|
/** |
|
216
|
|
|
* Removes a Format |
|
217
|
|
|
* |
|
218
|
|
|
* @param \Kitodo\Dlf\Domain\Model\MetadataFormat $formatToRemove |
|
219
|
|
|
* |
|
220
|
|
|
* @return void |
|
221
|
|
|
*/ |
|
222
|
|
|
public function removeFormat(MetadataFormat $formatToRemove) |
|
223
|
|
|
{ |
|
224
|
|
|
$this->format->detach($formatToRemove); |
|
225
|
|
|
} |
|
226
|
|
|
|
|
227
|
|
|
/** |
|
228
|
|
|
* @return string |
|
229
|
|
|
*/ |
|
230
|
|
|
public function getDefaultValue(): string |
|
231
|
|
|
{ |
|
232
|
|
|
return $this->defaultValue; |
|
233
|
|
|
} |
|
234
|
|
|
|
|
235
|
|
|
/** |
|
236
|
|
|
* @param string $defaultValue |
|
237
|
|
|
*/ |
|
238
|
|
|
public function setDefaultValue(string $defaultValue): void |
|
239
|
|
|
{ |
|
240
|
|
|
$this->defaultValue = $defaultValue; |
|
241
|
|
|
} |
|
242
|
|
|
|
|
243
|
|
|
/** |
|
244
|
|
|
* @return string |
|
245
|
|
|
*/ |
|
246
|
|
|
public function getWrap(): string |
|
247
|
|
|
{ |
|
248
|
|
|
return $this->wrap; |
|
249
|
|
|
} |
|
250
|
|
|
|
|
251
|
|
|
/** |
|
252
|
|
|
* @param string $wrap |
|
253
|
|
|
*/ |
|
254
|
|
|
public function setWrap(string $wrap): void |
|
255
|
|
|
{ |
|
256
|
|
|
$this->wrap = $wrap; |
|
257
|
|
|
} |
|
258
|
|
|
|
|
259
|
|
|
/** |
|
260
|
|
|
* @return int |
|
261
|
|
|
*/ |
|
262
|
|
|
public function getIndexTokenized(): int |
|
263
|
|
|
{ |
|
264
|
|
|
return $this->indexTokenized; |
|
265
|
|
|
} |
|
266
|
|
|
|
|
267
|
|
|
/** |
|
268
|
|
|
* @param int $indexTokenized |
|
269
|
|
|
*/ |
|
270
|
|
|
public function setIndexTokenized(int $indexTokenized): void |
|
271
|
|
|
{ |
|
272
|
|
|
$this->indexTokenized = $indexTokenized; |
|
273
|
|
|
} |
|
274
|
|
|
|
|
275
|
|
|
/** |
|
276
|
|
|
* @return int |
|
277
|
|
|
*/ |
|
278
|
|
|
public function getIndexStored(): int |
|
279
|
|
|
{ |
|
280
|
|
|
return $this->indexStored; |
|
281
|
|
|
} |
|
282
|
|
|
|
|
283
|
|
|
/** |
|
284
|
|
|
* @param int $indexStored |
|
285
|
|
|
*/ |
|
286
|
|
|
public function setIndexStored(int $indexStored): void |
|
287
|
|
|
{ |
|
288
|
|
|
$this->indexStored = $indexStored; |
|
289
|
|
|
} |
|
290
|
|
|
|
|
291
|
|
|
/** |
|
292
|
|
|
* @return int |
|
293
|
|
|
*/ |
|
294
|
|
|
public function getIndexIndexed(): int |
|
295
|
|
|
{ |
|
296
|
|
|
return $this->indexIndexed; |
|
297
|
|
|
} |
|
298
|
|
|
|
|
299
|
|
|
/** |
|
300
|
|
|
* @param int $indexIndexed |
|
301
|
|
|
*/ |
|
302
|
|
|
public function setIndexIndexed(int $indexIndexed): void |
|
303
|
|
|
{ |
|
304
|
|
|
$this->indexIndexed = $indexIndexed; |
|
305
|
|
|
} |
|
306
|
|
|
|
|
307
|
|
|
/** |
|
308
|
|
|
* @return float |
|
309
|
|
|
*/ |
|
310
|
|
|
public function getIndexBoost(): float |
|
311
|
|
|
{ |
|
312
|
|
|
return $this->indexBoost; |
|
313
|
|
|
} |
|
314
|
|
|
|
|
315
|
|
|
/** |
|
316
|
|
|
* @param float $indexBoost |
|
317
|
|
|
*/ |
|
318
|
|
|
public function setIndexBoost(float $indexBoost): void |
|
319
|
|
|
{ |
|
320
|
|
|
$this->indexBoost = $indexBoost; |
|
321
|
|
|
} |
|
322
|
|
|
|
|
323
|
|
|
/** |
|
324
|
|
|
* @return int |
|
325
|
|
|
*/ |
|
326
|
|
|
public function getIsSortable(): int |
|
327
|
|
|
{ |
|
328
|
|
|
return $this->isSortable; |
|
329
|
|
|
} |
|
330
|
|
|
|
|
331
|
|
|
/** |
|
332
|
|
|
* @param int $isSortable |
|
333
|
|
|
*/ |
|
334
|
|
|
public function setIsSortable(int $isSortable): void |
|
335
|
|
|
{ |
|
336
|
|
|
$this->isSortable = $isSortable; |
|
337
|
|
|
} |
|
338
|
|
|
|
|
339
|
|
|
/** |
|
340
|
|
|
* @return int |
|
341
|
|
|
*/ |
|
342
|
|
|
public function getIsFacet(): int |
|
343
|
|
|
{ |
|
344
|
|
|
return $this->isFacet; |
|
345
|
|
|
} |
|
346
|
|
|
|
|
347
|
|
|
/** |
|
348
|
|
|
* @param int $isFacet |
|
349
|
|
|
*/ |
|
350
|
|
|
public function setIsFacet(int $isFacet): void |
|
351
|
|
|
{ |
|
352
|
|
|
$this->isFacet = $isFacet; |
|
353
|
|
|
} |
|
354
|
|
|
|
|
355
|
|
|
/** |
|
356
|
|
|
* @return int |
|
357
|
|
|
*/ |
|
358
|
|
|
public function getIsListed(): int |
|
359
|
|
|
{ |
|
360
|
|
|
return $this->isListed; |
|
361
|
|
|
} |
|
362
|
|
|
|
|
363
|
|
|
/** |
|
364
|
|
|
* @param int $isListed |
|
365
|
|
|
*/ |
|
366
|
|
|
public function setIsListed(int $isListed): void |
|
367
|
|
|
{ |
|
368
|
|
|
$this->isListed = $isListed; |
|
369
|
|
|
} |
|
370
|
|
|
|
|
371
|
|
|
/** |
|
372
|
|
|
* @return int |
|
373
|
|
|
*/ |
|
374
|
|
|
public function getIndexAutocomplete(): int |
|
375
|
|
|
{ |
|
376
|
|
|
return $this->indexAutocomplete; |
|
377
|
|
|
} |
|
378
|
|
|
|
|
379
|
|
|
/** |
|
380
|
|
|
* @param int $indexAutocomplete |
|
381
|
|
|
*/ |
|
382
|
|
|
public function setIndexAutocomplete(int $indexAutocomplete): void |
|
383
|
|
|
{ |
|
384
|
|
|
$this->indexAutocomplete = $indexAutocomplete; |
|
385
|
|
|
} |
|
386
|
|
|
|
|
387
|
|
|
/** |
|
388
|
|
|
* @return int |
|
389
|
|
|
*/ |
|
390
|
|
|
public function getStatus(): int |
|
391
|
|
|
{ |
|
392
|
|
|
return $this->status; |
|
393
|
|
|
} |
|
394
|
|
|
|
|
395
|
|
|
/** |
|
396
|
|
|
* @param int $status |
|
397
|
|
|
*/ |
|
398
|
|
|
public function setStatus(int $status): void |
|
399
|
|
|
{ |
|
400
|
|
|
$this->status = $status; |
|
401
|
|
|
} |
|
402
|
|
|
|
|
403
|
|
|
} |
|
404
|
|
|
|