Passed
Pull Request — master (#195)
by
unknown
09:41 queued 02:26
created

MetadataObject::getValidation()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
namespace EWW\Dpf\Domain\Model;
3
4
/*
5
 * This file is part of the TYPO3 CMS project.
6
 *
7
 * It is free software; you can redistribute it and/or modify it under
8
 * the terms of the GNU General Public License, either version 2
9
 * of the License, or any later version.
10
 *
11
 * For the full copyright and license information, please read the
12
 * LICENSE.txt file that was distributed with this source code.
13
 *
14
 * The TYPO3 project - inspiring people to share!
15
 */
16
17
/**
18
 * MetadataObject
19
 */
20
class MetadataObject extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity implements MetadataMandatoryInterface
21
{
22
23
    /**
24
     * name
25
     *
26
     * @var string
27
     */
28
    protected $name = '';
29
30
    /**
31
     * displayName
32
     *
33
     * @var string
34
     */
35
    protected $displayName = '';
36
37
    /**
38
     * maxIteration
39
     *
40
     * @var integer
41
     */
42
    protected $maxIteration = 0;
43
44
    /**
45
     * mandatory
46
     *
47
     * @var string
48
     */
49
    protected $mandatory = '';
50
51
    /**
52
     * mapping
53
     *
54
     * @var string
55
     */
56
    protected $mapping = '';
57
58
    /**
59
     * inputField
60
     *
61
     * @var integer
62
     */
63
    protected $inputField = 0;
64
65
    /**
66
     * @var string
67
     */
68
    protected $objectType = '';
69
    /**
70
     * depositLicense
71
     *
72
     * @var int
73
     */
74
    protected $depositLicense = '';
75
76
    /**
77
     * JSON mapping
78
     *
79
     * @var string
80
     */
81
    protected $jsonMapping = '';
82
83
    const input    = 0;
84
    const textarea = 1;
85
    const select   = 2;
86
    const checkbox = 3;
87
    const hidden   = 4;
88
    const INPUTDROPDOWN = 100;
89
90
    const INPUT_DATA_TYPE_REGEXP = "REGEXP";
91
    const INPUT_DATA_TYPE_DATE   = "DATE";
92
93
    /**
94
     * dataType
95
     *
96
     * @var string
97
     */
98
    protected $dataType;
99
100
    /**
101
     * modsExtension
102
     *
103
     * @var boolean
104
     */
105
    protected $modsExtension = false;
106
107
    /**
108
     * inputOptionList
109
     *
110
     * @var \EWW\Dpf\Domain\Model\InputOptionList
111
     */
112
    protected $inputOptionList = null;
113
114
    /**
115
     * fillOutService
116
     *
117
     * @var string
118
     */
119
    protected $fillOutService = '';
120
121
    const FILL_OUT_SERVICE_URN = 'urn';
122
    const FILL_OUT_SERVICE_GND = 'gnd';
123
124
    /**
125
     * @var string
126
     */
127
    protected $gndFieldUid = '';
128
129
    /**
130
     * accessRestrictionRoles
131
     *
132
     * @var string
133
     */
134
    protected $accessRestrictionRoles = '';
135
136
    /**
137
     * consent
138
     *
139
     * @var boolean
140
     */
141
    protected $consent;
142
143
    /**
144
     * defaultValue
145
     *
146
     * @var string
147
     */
148
    protected $defaultValue;
149
150
    /**
151
     * validation
152
     *
153
     * @var string
154
     */
155
    protected $validation = '';
156
157
    /**
158
     * max input length
159
     *
160
     * @var integer
161
     */
162
    protected $maxInputLength = 0;
163
164
    /**
165
     * Embargo field option
166
     *
167
     * @var boolean
168
     */
169
    protected $embargo;
170
171
    /**
172
     * fis mapping
173
     *
174
     * @var string
175
     */
176
    protected $fisPersonMapping = '';
177
178
    /**
179
     * fis mapping
180
     *
181
     * @var string
182
     */
183
    protected $fisOrganisationMapping = '';
184
185
    /**
186
     * gnd mapping
187
     *
188
     * @var string
189
     */
190
    protected $gndPersonMapping = '';
191
192
    /**
193
     * gnd mapping
194
     *
195
     * @var string
196
     */
197
    protected $gndOrganisationMapping = '';
198
199
    /**
200
     * ror mapping
201
     *
202
     * @var string
203
     */
204
    protected $rorMapping = '';
205
206
    /**
207
     * zdb mapping
208
     *
209
     * @var string
210
     */
211
    protected $zdbMapping = '';
212
213
    /**
214
     * unpaywall mapping
215
     * @var string
216
     */
217
    protected $unpaywallMapping = '';
218
219
    /**
220
     * orcid person mapping
221
     * @var string
222
     */
223
    protected $orcidPersonMapping = '';
224
225
    /**
226
     * Returns the name
227
     *
228
     * @return string $name
229
     */
230
    public function getName()
231
    {
232
        return $this->name;
233
    }
234
235
    /**
236
     * Sets the name
237
     *
238
     * @param string $name
239
     * @return void
240
     */
241
    public function setName($name)
242
    {
243
        $this->name = $name;
244
    }
245
246
    /**
247
     * Returns the displayName
248
     *
249
     * @return string $displayName
250
     */
251
    public function getDisplayName()
252
    {
253
        return $this->displayName;
254
    }
255
256
    /**
257
     * Sets the displayName
258
     *
259
     * @param string $displayName
260
     * @return void
261
     */
262
    public function setDisplayName($displayName)
263
    {
264
        $this->displayName = $displayName;
265
    }
266
267
    /**
268
     * Returns the maxIteration
269
     *
270
     * @return integer $maxIteration
271
     */
272
    public function getMaxIteration()
273
    {
274
        return $this->maxIteration;
275
    }
276
277
    /**
278
     * Sets the maxIteration
279
     *
280
     * @param integer $maxIteration
281
     * @return void
282
     */
283
    public function setMaxIteration($maxIteration)
284
    {
285
        $this->maxIteration = $maxIteration;
286
    }
287
288
    /**
289
     * Returns the mandatory
290
     *
291
     * @return string $mandatory
292
     */
293
    public function getMandatory()
294
    {
295
        return $this->mandatory;
296
    }
297
298
    /**
299
     * Sets the mandatory
300
     *
301
     * @param string $mandatory
302
     * @return void
303
     */
304
    public function setMandatory($mandatory)
305
    {
306
        $this->mandatory = $mandatory;
307
    }
308
309
    /**
310
     * Returns the modsExtension
311
     *
312
     * @return boolean $modsExtension
313
     */
314
    public function getModsExtension()
315
    {
316
        return $this->modsExtension;
317
    }
318
319
    /**
320
     * Sets the modsExtension
321
     *
322
     * @param boolean $modsExtension
323
     * @return void
324
     */
325
    public function setModsExtension($modsExtension)
326
    {
327
        $this->modsExtension = $modsExtension;
328
    }
329
330
    /**
331
     * Returns the boolean state of modsExtension
332
     *
333
     * @return boolean
334
     */
335
    public function isModsExtension()
336
    {
337
        return $this->modsExtension;
338
    }
339
340
    /**
341
     * Returns the mapping
342
     *
343
     * @return string $mapping
344
     */
345
    public function getMapping()
346
    {
347
        return $this->mapping;
348
    }
349
350
    /**
351
     * Sets the mapping
352
     *
353
     * @param string $mapping
354
     * @return void
355
     */
356
    public function setMapping($mapping)
357
    {
358
        $this->mapping = $mapping;
359
    }
360
361
    /**
362
     * Returns the relative mapping
363
     *
364
     * @return string $relativeMapping
365
     */
366
    public function getRelativeMapping()
367
    {
368
        return trim($this->mapping, " /");
369
    }
370
371
    /**
372
     * Returns the inputField
373
     *
374
     * @return integer $inputField
375
     */
376
    public function getInputField()
377
    {
378
        return $this->inputField;
379
    }
380
381
    /**
382
     * Sets the inputField
383
     *
384
     * @param integer $inputField
385
     * @return void
386
     */
387
    public function setInputField($inputField)
388
    {
389
        $this->inputField = $inputField;
390
    }
391
392
    /**
393
     * Returns always NULL because an Object never has children.
394
     *
395
     * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\EWW\Dpf\Domain\Model\MetadataObject> $metadataObject
396
     */
397
    public function getChildren()
398
    {
399
        return null;
400
    }
401
402
    /**
403
     * Returns the inputOptionList
404
     *
405
     * @return \EWW\Dpf\Domain\Model\InputOptionList $inputOptionList
406
     */
407
    public function getInputOptionList()
408
    {
409
        return $this->inputOptionList;
410
    }
411
412
    /**
413
     * Sets the inputOptionList
414
     *
415
     * @param \EWW\Dpf\Domain\Model\InputOptionList $inputOptionList
416
     * @return void
417
     */
418
    public function setInputOptionList(\EWW\Dpf\Domain\Model\InputOptionList $inputOptionList)
419
    {
420
        $this->inputOptionList = $inputOptionList;
421
    }
422
423
    /**
424
     * Returns the fillOutService
425
     *
426
     * @return string $fillOutService
427
     */
428
    public function getFillOutService()
429
    {
430
        return $this->fillOutService;
431
    }
432
433
    /**
434
     * Sets the fillOutService
435
     *
436
     * @param string $fillOutService
437
     * @return void
438
     */
439
    public function setFillOutService($fillOutService)
440
    {
441
        $this->fillOutService = $fillOutService;
442
    }
443
444
    /**
445
     * Returns the accessRestrictionRoles
446
     *
447
     * @return array $accessRestrictionRoles
448
     */
449
    public function getAccessRestrictionRoles()
450
    {
451
        if ($this->accessRestrictionRoles) {
452
            return array_map('trim', explode(',', $this->accessRestrictionRoles));
453
        } else {
454
            return array();
455
        }
456
    }
457
458
    /**
459
     * Sets the accessRestrictionRoles
460
     *
461
     * @param array $accessRestrictionRoles
462
     * @return void
463
     */
464
    public function setAccessRestrictionRoles($accessRestrictionRoles)
465
    {
466
        $this->accessRestrictionRoles = implode(',', $accessRestrictionRoles);
467
    }
468
469
    /**
470
     * Returns the consent
471
     *
472
     * @return boolean $consent
473
     */
474
    public function getConsent()
475
    {
476
        return $this->consent;
477
    }
478
479
    /**
480
     * Sets the consent
481
     *
482
     * @param boolean $consent
483
     * @return void
484
     */
485
    public function setConsent($consent)
486
    {
487
        $this->consent = $consent;
488
    }
489
490
    /**
491
     * Returns the defaultValue
492
     *
493
     * @return string $defaultValue
494
     */
495
    public function getDefaultValue()
496
    {
497
        return $this->defaultValue;
498
    }
499
500
    /**
501
     * Sets the defaultValue
502
     *
503
     * @param string $defaultValue
504
     * @return void
505
     */
506
    public function setDefaultValue($defaultValue)
507
    {
508
        $this->defaultValue = $defaultValue;
509
    }
510
511
    /**
512
     * Returns the validation
513
     *
514
     * @return string $validation
515
     */
516
    public function getValidation()
517
    {
518
        return $this->validation;
519
    }
520
521
    /**
522
     * Sets the validation
523
     *
524
     * @param string $validation
525
     * @return void
526
     */
527
    public function setValidation($validation)
528
    {
529
        $this->validation = $validation;
530
    }
531
532
    /**
533
     * Returns the dataType
534
     *
535
     * @return string $dataType
536
     */
537
    public function getDataType()
538
    {
539
        return $this->dataType;
540
    }
541
542
    /**
543
     * Sets the dataType
544
     *
545
     * @param string $dataType
546
     * @return void
547
     */
548
    public function setDataType($dataType)
549
    {
550
        $this->dataType = $dataType;
551
    }
552
553
    /**
554
     * @return string
555
     */
556
    public function getGndFieldUid()
557
    {
558
        return $this->gndFieldUid;
559
    }
560
561
    /**
562
     * @param string $gndFieldUid
563
     */
564
    public function setGndFieldUid($gndFieldUid)
565
    {
566
        $this->gndFieldUid = $gndFieldUid;
567
    }
568
569
    /**
570
     * @return integer
571
     */
572
    public function getMaxInputLength()
573
    {
574
        if ($this->maxInputLength == 0) {
575
            if ($this->inputField == self::input) {
576
                return 255;
577
            } else {
578
                return 2048;
579
            }
580
        } else {
581
            return $this->maxInputLength;
582
        }
583
    }
584
585
    /**
586
     * @return integer
587
     */
588
    public function setMaxInputLength($maxInputLength)
589
    {
590
        $this->maxInputLength = $maxInputLength;
591
    }
592
593
    /**
594
     * @return bool
595
     */
596
    public function getEmbargo(): bool
597
    {
598
        return $this->embargo;
599
    }
600
601
    /**
602
     * @param bool $embargo
603
     */
604
    public function setEmbargo(bool $embargo)
605
    {
606
        $this->embargo = $embargo;
607
    }
608
609
    /**
610
     * @return string
611
     */
612
    public function getFisPersonMapping(): string
613
    {
614
        return $this->fisPersonMapping;
615
    }
616
617
    /**
618
     * @param string $fisPersonMapping
619
     */
620
    public function setFisPersonMapping(string $fisPersonMapping): void
621
    {
622
        $this->fisPersonMapping = $fisPersonMapping;
623
    }
624
625
    /**
626
     * @return string
627
     */
628
    public function getFisOrganisationMapping(): string
629
    {
630
        return $this->fisOrganisationMapping;
631
    }
632
633
    /**
634
     * @param string $fisOrganisationMapping
635
     */
636
    public function setFisOrganisationMapping(string $fisOrganisationMapping): void
637
    {
638
        $this->fisOrganisationMapping = $fisOrganisationMapping;
639
    }
640
641
    /**
642
     * @return string
643
     */
644
    public function getRorMapping(): string
645
    {
646
        return $this->rorMapping;
647
    }
648
649
    /**
650
     * @param string $rorMapping
651
     */
652
    public function setRorMapping(string $rorMapping)
653
    {
654
        $this->rorMapping = $rorMapping;
655
    }
656
657
    /**
658
     * @return string
659
     */
660
    public function getZdbMapping(): string
661
    {
662
        return $this->zdbMapping;
663
    }
664
665
    /**
666
     * @param string $zdbMapping
667
     */
668
    public function setZdbMapping(string $zdbMapping): void
669
    {
670
        $this->zdbMapping = $zdbMapping;
671
    }
672
673
    /**
674
     * @return string
675
     */
676
    public function getUnpaywallMapping(): string
677
    {
678
        return $this->unpaywallMapping;
679
    }
680
681
    /**
682
     * @param string $unpaywallMapping
683
     */
684
    public function setUnpaywallMapping(string $unpaywallMapping): void
685
    {
686
        $this->unpaywallMapping = $unpaywallMapping;
687
    }
688
689
    /**
690
     * @return string
691
     */
692
    public function getObjectType(): string
693
    {
694
        return $this->objectType;
695
    }
696
    /**
697
     * Gets the jsonMapping
698
     *
699
     * @return string
700
     */
701
    public function getJsonMapping(): string
702
    {
703
        return $this->jsonMapping;
704
    }
705
706
    /**
707
     * Sets the jsonMapping
708
     *
709
     * @param string $jsonMapping
710
     */
711
    public function setJsonMapping(string $jsonMapping): void
712
    {
713
        $this->jsonMapping = $jsonMapping;
714
    }
715
    /**
716
     * @param string $objectType
717
     */
718
    public function setObjectType(string $objectType): void
719
    {
720
        $this->objectType = $objectType;
721
    }
722
723
    /**
724
     * @return string
725
     */
726
    public function getGndPersonMapping(): string
727
    {
728
        return $this->gndPersonMapping;
729
    }
730
731
    /**
732
     * @param string $gndPersonMapping
733
     */
734
    public function setGndPersonMapping(string $gndPersonMapping): void
735
    {
736
        $this->gndPersonMapping = $gndPersonMapping;
737
    }
738
739
    /**
740
     * @return string
741
     */
742
    public function getGndOrganisationMapping(): string
743
    {
744
        return $this->gndOrganisationMapping;
745
    }
746
747
    /**
748
     * @param string $gndOrganisationMapping
749
     */
750
    public function setGndOrganisationMapping(string $gndOrganisationMapping): void
751
    {
752
        $this->gndOrganisationMapping = $gndOrganisationMapping;
753
    }
754
755
    /**
756
     * @return string
757
     */
758
    public function getOrcidPersonMapping(): string
759
    {
760
        return $this->orcidPersonMapping;
761
    }
762
763
    /**
764
     * @param string $orcidPersonMapping
765
     */
766
    public function setOrcidPersonMapping(string $orcidPersonMapping): void
767
    {
768
        $this->orcidPersonMapping = $orcidPersonMapping;
769
    }
770
771
772
    /**
773
     * @return int
774
     */
775
    public function getDepositLicense(): int
776
    {
777
        return $this->depositLicense;
778
    }
779
780
    /**
781
     * @param int $depositLicense
782
     */
783
    public function setDepositLicense($depositLicense): void
784
    {
785
        $this->depositLicense = $depositLicense;
786
    }
787
}
788