| Total Complexity | 85 |
| Total Lines | 768 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
Complex classes like Document often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use Document, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 20 | class Document extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity |
||
| 21 | { |
||
| 22 | |||
| 23 | /** |
||
| 24 | * title |
||
| 25 | * |
||
| 26 | * @var string |
||
| 27 | */ |
||
| 28 | protected $title = ''; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * authors |
||
| 32 | * |
||
| 33 | * @var string |
||
| 34 | */ |
||
| 35 | protected $authors = ''; |
||
| 36 | |||
| 37 | /** |
||
| 38 | * xmlData |
||
| 39 | * |
||
| 40 | * @var string |
||
| 41 | */ |
||
| 42 | protected $xmlData = ''; |
||
| 43 | |||
| 44 | /** |
||
| 45 | * slubInfoData |
||
| 46 | * |
||
| 47 | * @var string |
||
| 48 | */ |
||
| 49 | protected $slubInfoData = ''; |
||
| 50 | |||
| 51 | /** |
||
| 52 | * documentType |
||
| 53 | * |
||
| 54 | * @var \EWW\Dpf\Domain\Model\DocumentType |
||
| 55 | */ |
||
| 56 | protected $documentType = null; |
||
| 57 | |||
| 58 | /** |
||
| 59 | * objectIdentifier |
||
| 60 | * |
||
| 61 | * @var string |
||
| 62 | */ |
||
| 63 | protected $objectIdentifier; |
||
| 64 | |||
| 65 | /** |
||
| 66 | * reservedObjectIdentifier |
||
| 67 | * |
||
| 68 | * @var string |
||
| 69 | */ |
||
| 70 | protected $reservedObjectIdentifier; |
||
| 71 | |||
| 72 | /** |
||
| 73 | * state |
||
| 74 | * |
||
| 75 | * @var string |
||
| 76 | */ |
||
| 77 | protected $state = self::OBJECT_STATE_NEW; |
||
| 78 | |||
| 79 | /** |
||
| 80 | * transferStatus |
||
| 81 | * |
||
| 82 | * @var string |
||
| 83 | */ |
||
| 84 | protected $transferStatus; |
||
| 85 | |||
| 86 | /** |
||
| 87 | * transferDate |
||
| 88 | * |
||
| 89 | * @var integer |
||
| 90 | */ |
||
| 91 | protected $transferDate; |
||
| 92 | |||
| 93 | /** |
||
| 94 | * changed |
||
| 95 | * |
||
| 96 | * @var boolean |
||
| 97 | */ |
||
| 98 | protected $changed = false; |
||
| 99 | |||
| 100 | /** |
||
| 101 | * valid |
||
| 102 | * |
||
| 103 | * @var boolean |
||
| 104 | */ |
||
| 105 | protected $valid = false; |
||
| 106 | |||
| 107 | /** |
||
| 108 | * |
||
| 109 | * @var string $dateIssued |
||
| 110 | */ |
||
| 111 | protected $dateIssued; |
||
| 112 | |||
| 113 | /** |
||
| 114 | * |
||
| 115 | * @var string $processNumber |
||
| 116 | */ |
||
| 117 | protected $processNumber; |
||
| 118 | |||
| 119 | /** |
||
| 120 | * file |
||
| 121 | * |
||
| 122 | * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\EWW\Dpf\Domain\Model\File> |
||
| 123 | * @cascade remove |
||
| 124 | */ |
||
| 125 | protected $file = null; |
||
| 126 | |||
| 127 | const TRANSFER_ERROR = "ERROR"; |
||
| 128 | const TRANSFER_QUEUED = "QUEUED"; |
||
| 129 | const TRANSFER_SENT = "SENT"; |
||
| 130 | |||
| 131 | const OBJECT_STATE_NEW = "NEW"; |
||
| 132 | const OBJECT_STATE_ACTIVE = "ACTIVE"; |
||
| 133 | const OBJECT_STATE_INACTIVE = "INACTIVE"; |
||
| 134 | const OBJECT_STATE_DELETED = "DELETED"; |
||
| 135 | const OBJECT_STATE_LOCALLY_DELETED = "LOCALLY_DELETED"; |
||
| 136 | |||
| 137 | /** |
||
| 138 | * __construct |
||
| 139 | */ |
||
| 140 | public function __construct() |
||
| 144 | } |
||
| 145 | |||
| 146 | /** |
||
| 147 | * Initializes all ObjectStorage properties |
||
| 148 | * |
||
| 149 | * @return void |
||
| 150 | */ |
||
| 151 | protected function initStorageObjects() |
||
| 152 | { |
||
| 153 | $this->file = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); |
||
| 154 | } |
||
| 155 | |||
| 156 | /** |
||
| 157 | * Returns the title |
||
| 158 | * |
||
| 159 | * @return string $title |
||
| 160 | */ |
||
| 161 | public function getTitle() |
||
| 162 | { |
||
| 163 | return $this->title; |
||
| 164 | } |
||
| 165 | |||
| 166 | /** |
||
| 167 | * Sets the title |
||
| 168 | * |
||
| 169 | * @param string $title |
||
| 170 | * @return void |
||
| 171 | */ |
||
| 172 | public function setTitle($title) |
||
| 173 | { |
||
| 174 | $this->title = $title; |
||
| 175 | //htmlspecialchars_decode($title,ENT_QUOTES); |
||
| 176 | } |
||
| 177 | |||
| 178 | /** |
||
| 179 | * Returns the authors |
||
| 180 | * |
||
| 181 | * @return array $authors |
||
| 182 | */ |
||
| 183 | public function getAuthors() |
||
| 184 | { |
||
| 185 | return array_map('trim', explode(";", $this->authors)); |
||
| 186 | } |
||
| 187 | |||
| 188 | /** |
||
| 189 | * Sets the authors |
||
| 190 | * |
||
| 191 | * @param array $authors |
||
| 192 | * @return void |
||
| 193 | */ |
||
| 194 | public function setAuthors($authors) |
||
| 195 | { |
||
| 196 | $authors = implode("; ", $authors); |
||
| 197 | $this->authors = $authors; |
||
| 198 | } |
||
| 199 | |||
| 200 | /** |
||
| 201 | * Returns the xmlData |
||
| 202 | * |
||
| 203 | * @return string $xmlData |
||
| 204 | */ |
||
| 205 | public function getXmlData() |
||
| 206 | { |
||
| 207 | return $this->xmlData; |
||
| 208 | } |
||
| 209 | |||
| 210 | /** |
||
| 211 | * Sets the xmlData |
||
| 212 | * |
||
| 213 | * @param string $xmlData |
||
| 214 | * @return void |
||
| 215 | */ |
||
| 216 | public function setXmlData($xmlData) |
||
| 217 | { |
||
| 218 | $this->xmlData = $xmlData; |
||
| 219 | } |
||
| 220 | |||
| 221 | /** |
||
| 222 | * Returns the slubInfoData |
||
| 223 | * |
||
| 224 | * @return string $slubInfoData |
||
| 225 | */ |
||
| 226 | public function getSlubInfoData() |
||
| 227 | { |
||
| 228 | return $this->slubInfoData; |
||
| 229 | } |
||
| 230 | |||
| 231 | /** |
||
| 232 | * Sets the slubInfoData |
||
| 233 | * |
||
| 234 | * @return string $slubInfoData |
||
| 235 | */ |
||
| 236 | public function setSlubInfoData($slubInfoData) |
||
| 237 | { |
||
| 238 | $this->slubInfoData = $slubInfoData; |
||
| 239 | } |
||
| 240 | |||
| 241 | /** |
||
| 242 | * Returns the documentType |
||
| 243 | * |
||
| 244 | * @return \EWW\Dpf\Domain\Model\DocumentType $documentType |
||
| 245 | */ |
||
| 246 | public function getDocumentType() |
||
| 247 | { |
||
| 248 | return $this->documentType; |
||
| 249 | } |
||
| 250 | |||
| 251 | /** |
||
| 252 | * Sets the documentType |
||
| 253 | * |
||
| 254 | * @param \EWW\Dpf\Domain\Model\DocumentType $documentType |
||
| 255 | * @return void |
||
| 256 | */ |
||
| 257 | public function setDocumentType(\EWW\Dpf\Domain\Model\DocumentType $documentType) |
||
| 258 | { |
||
| 259 | $this->documentType = $documentType; |
||
| 260 | } |
||
| 261 | |||
| 262 | /** |
||
| 263 | * Returns the objectIdentifier |
||
| 264 | * |
||
| 265 | * @return string |
||
| 266 | */ |
||
| 267 | public function getObjectIdentifier() |
||
| 268 | { |
||
| 269 | return $this->objectIdentifier; |
||
| 270 | } |
||
| 271 | |||
| 272 | /** |
||
| 273 | * Sets the objectIdentifier |
||
| 274 | * |
||
| 275 | * @param string $objectIdentifier |
||
| 276 | * @return void |
||
| 277 | */ |
||
| 278 | public function setObjectIdentifier($objectIdentifier) |
||
| 279 | { |
||
| 280 | $this->objectIdentifier = $objectIdentifier; |
||
| 281 | } |
||
| 282 | |||
| 283 | /** |
||
| 284 | * Returns the reservedObjectIdentifier |
||
| 285 | * |
||
| 286 | * @return string |
||
| 287 | */ |
||
| 288 | public function getReservedObjectIdentifier() |
||
| 289 | { |
||
| 290 | return $this->reservedObjectIdentifier; |
||
| 291 | } |
||
| 292 | |||
| 293 | /** |
||
| 294 | * Sets the reservedObjectIdentifier |
||
| 295 | * |
||
| 296 | * @param string $reservedObjectIdentifier |
||
| 297 | * @return void |
||
| 298 | */ |
||
| 299 | public function setReservedObjectIdentifier($reservedObjectIdentifier) |
||
| 300 | { |
||
| 301 | $this->reservedObjectIdentifier = $reservedObjectIdentifier; |
||
| 302 | } |
||
| 303 | |||
| 304 | /** |
||
| 305 | * Returns the state |
||
| 306 | * |
||
| 307 | * @return string |
||
| 308 | */ |
||
| 309 | public function getState() |
||
| 310 | { |
||
| 311 | return $this->state; |
||
| 312 | } |
||
| 313 | |||
| 314 | /** |
||
| 315 | * Sets the state |
||
| 316 | * |
||
| 317 | * @param string $state |
||
| 318 | * @return void |
||
| 319 | */ |
||
| 320 | public function setState($state) |
||
| 321 | { |
||
| 322 | $this->state = $state; |
||
| 323 | } |
||
| 324 | |||
| 325 | /** |
||
| 326 | * Returns the transferStatus |
||
| 327 | * |
||
| 328 | * @return string |
||
| 329 | */ |
||
| 330 | public function getTransferStatus() |
||
| 331 | { |
||
| 332 | return $this->transferStatus; |
||
| 333 | } |
||
| 334 | |||
| 335 | /** |
||
| 336 | * Sets the transferStatus |
||
| 337 | * |
||
| 338 | * @param string |
||
| 339 | * @return void |
||
| 340 | */ |
||
| 341 | public function setTransferStatus($transferStatus) |
||
| 342 | { |
||
| 343 | $this->transferStatus = $transferStatus; |
||
| 344 | } |
||
| 345 | |||
| 346 | /** |
||
| 347 | * Returns the transferDate |
||
| 348 | * |
||
| 349 | * @return integer |
||
| 350 | */ |
||
| 351 | public function getTransferDate() |
||
| 352 | { |
||
| 353 | return $this->transferDate; |
||
| 354 | } |
||
| 355 | |||
| 356 | /** |
||
| 357 | * Sets the transferDate |
||
| 358 | * |
||
| 359 | * @param integer $transferDate |
||
| 360 | * @return void |
||
| 361 | */ |
||
| 362 | public function setTransferDate($transferDate) |
||
| 363 | { |
||
| 364 | $this->transferDate = $transferDate; |
||
| 365 | } |
||
| 366 | |||
| 367 | /** |
||
| 368 | * Returns the transferErrorCode |
||
| 369 | * |
||
| 370 | * @var integer |
||
| 371 | */ |
||
| 372 | public function getTransferErrorCode() |
||
| 373 | { |
||
| 374 | return $this->transferErrorCode; |
||
| 375 | } |
||
| 376 | |||
| 377 | /** |
||
| 378 | * Sets the transferErrorCode |
||
| 379 | * |
||
| 380 | * @param integer $transferErrorCode |
||
| 381 | * @return void |
||
| 382 | */ |
||
| 383 | public function setTransferErrorCode($transferErrorCode) |
||
| 384 | { |
||
| 385 | $this->transferErrorCode = $transferErrorCode; |
||
|
|
|||
| 386 | } |
||
| 387 | |||
| 388 | /** |
||
| 389 | * Returns the transferResponse |
||
| 390 | * |
||
| 391 | * @var string |
||
| 392 | */ |
||
| 393 | public function getTransferResponse() |
||
| 394 | { |
||
| 395 | return $this->transferResponse; |
||
| 396 | } |
||
| 397 | |||
| 398 | /** |
||
| 399 | * Sets the transferResponse |
||
| 400 | * |
||
| 401 | * @param string $transferResponse |
||
| 402 | * @return void |
||
| 403 | */ |
||
| 404 | public function setTransferResponse($transferResponse) |
||
| 407 | } |
||
| 408 | |||
| 409 | /** |
||
| 410 | * Returns the transferHttpStatus |
||
| 411 | * |
||
| 412 | * @var integer |
||
| 413 | */ |
||
| 414 | public function getTransferHttpStatus() |
||
| 415 | { |
||
| 416 | return $this->transferHttpStatus; |
||
| 417 | } |
||
| 418 | |||
| 419 | /** |
||
| 420 | * Sets the transferHttpStatus |
||
| 421 | * |
||
| 422 | * @param integer $transferHttpStatus |
||
| 423 | * @return void |
||
| 424 | */ |
||
| 425 | public function setTransferHttpStatus($transferHttpStatus) |
||
| 426 | { |
||
| 427 | $this->transferHttpStatus = $transferHttpStatus; |
||
| 428 | } |
||
| 429 | |||
| 430 | /** |
||
| 431 | * Adds a File |
||
| 432 | * |
||
| 433 | * @param \EWW\Dpf\Domain\Model\File $file |
||
| 434 | * @return void |
||
| 435 | */ |
||
| 436 | public function addFile(\EWW\Dpf\Domain\Model\File $file) |
||
| 437 | { |
||
| 438 | $this->file->attach($file); |
||
| 439 | } |
||
| 440 | |||
| 441 | /** |
||
| 442 | * Removes a File |
||
| 443 | * |
||
| 444 | * @param \EWW\Dpf\Domain\Model\File $fileToRemove The File to be removed |
||
| 445 | * @return void |
||
| 446 | */ |
||
| 447 | public function removeFile(\EWW\Dpf\Domain\Model\File $fileToRemove) |
||
| 448 | { |
||
| 449 | $this->file->detach($fileToRemove); |
||
| 450 | } |
||
| 451 | |||
| 452 | /** |
||
| 453 | * Returns the file |
||
| 454 | * |
||
| 455 | * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\EWW\Dpf\Domain\Model\File> $file |
||
| 456 | */ |
||
| 457 | public function getFile() |
||
| 458 | { |
||
| 459 | return $this->file; |
||
| 460 | } |
||
| 461 | |||
| 462 | /** |
||
| 463 | * Sets the file |
||
| 464 | * |
||
| 465 | * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\EWW\Dpf\Domain\Model\File> $file |
||
| 466 | * @return void |
||
| 467 | */ |
||
| 468 | public function setFile(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $file) |
||
| 469 | { |
||
| 470 | $this->file = $file; |
||
| 471 | } |
||
| 472 | |||
| 473 | /** |
||
| 474 | * Get File Data |
||
| 475 | * |
||
| 476 | * @return array |
||
| 477 | */ |
||
| 478 | public function getFileData() |
||
| 479 | { |
||
| 480 | |||
| 481 | $fileId = new \EWW\Dpf\Services\Transfer\FileId($this); |
||
| 482 | |||
| 483 | $files = array(); |
||
| 484 | |||
| 485 | if (is_a($this->getFile(), '\TYPO3\CMS\Extbase\Persistence\ObjectStorage')) { |
||
| 486 | foreach ($this->getFile() as $file) { |
||
| 487 | |||
| 488 | $tmpFile = array( |
||
| 489 | 'path' => $file->getLink(), |
||
| 490 | 'type' => $file->getContentType(), |
||
| 491 | 'title' => (($file->getLabel()) ? $file->getLabel() : $file->getTitle()), |
||
| 492 | 'download' => $file->getDownload(), |
||
| 493 | 'archive' => $file->getArchive(), |
||
| 494 | 'use' => '', |
||
| 495 | 'id' => null, |
||
| 496 | 'hasFLocat' => ($file->getStatus() == \EWW\Dpf\Domain\Model\File::STATUS_ADDED || |
||
| 497 | $file->getStatus() == \EWW\Dpf\Domain\Model\File::STATUS_CHANGED), |
||
| 498 | ); |
||
| 499 | |||
| 500 | $grpUSE = ($file->getDownload()) ? 'download' : 'original'; |
||
| 501 | |||
| 502 | if ($file->getStatus() == \EWW\Dpf\Domain\Model\File::STATUS_DELETED) { |
||
| 503 | $dataStreamIdentifier = $file->getDatastreamIdentifier(); |
||
| 504 | if (!empty($dataStreamIdentifier)) { |
||
| 505 | $tmpFile['id'] = $file->getDatastreamIdentifier(); |
||
| 506 | $tmpFile['use'] = 'DELETE'; |
||
| 507 | $files[$grpUSE][$file->getUid()] = $tmpFile; |
||
| 508 | } |
||
| 509 | } else { |
||
| 510 | $tmpFile['id'] = $fileId->getId($file); |
||
| 511 | $tmpFile['use'] = ($file->getArchive()) ? 'ARCHIVE' : ''; |
||
| 512 | $files[$grpUSE][$file->getUid()] = $tmpFile; |
||
| 513 | } |
||
| 514 | |||
| 515 | } |
||
| 516 | } |
||
| 517 | |||
| 518 | return $files; |
||
| 519 | |||
| 520 | } |
||
| 521 | |||
| 522 | /** |
||
| 523 | * Get Current File Data |
||
| 524 | * |
||
| 525 | * @return array |
||
| 526 | */ |
||
| 527 | public function getCurrentFileData() |
||
| 528 | { |
||
| 529 | |||
| 530 | $fileId = new \EWW\Dpf\Services\Transfer\FileId($this); |
||
| 531 | |||
| 532 | $files = array(); |
||
| 533 | |||
| 534 | if (is_a($this->getFile(), '\TYPO3\CMS\Extbase\Persistence\ObjectStorage')) { |
||
| 535 | foreach ($this->getFile() as $file) { |
||
| 536 | |||
| 537 | $tmpFile = array( |
||
| 538 | 'path' => $file->getLink(), |
||
| 539 | 'type' => $file->getContentType(), |
||
| 540 | 'title' => (($file->getLabel()) ? $file->getLabel() : $file->getTitle()), |
||
| 541 | 'download' => $file->getDownload(), |
||
| 542 | 'archive' => $file->getArchive(), |
||
| 543 | 'use' => '', |
||
| 544 | 'id' => null, |
||
| 545 | 'hasFLocat' => ($file->getStatus() == \EWW\Dpf\Domain\Model\File::STATUS_ADDED || |
||
| 546 | $file->getStatus() == \EWW\Dpf\Domain\Model\File::STATUS_CHANGED), |
||
| 547 | ); |
||
| 548 | |||
| 549 | $grpUSE = ($file->getDownload()) ? 'download' : 'original'; |
||
| 550 | |||
| 551 | if ($file->getStatus() == \EWW\Dpf\Domain\Model\File::STATUS_DELETED) { |
||
| 552 | $dataStreamIdentifier = $file->getDatastreamIdentifier(); |
||
| 553 | if (!empty($dataStreamIdentifier)) { |
||
| 554 | $tmpFile['id'] = $file->getDatastreamIdentifier(); |
||
| 555 | $tmpFile['use'] = 'DELETE'; |
||
| 556 | $files[$grpUSE][$file->getUid()] = $tmpFile; |
||
| 557 | } |
||
| 558 | } else { |
||
| 559 | $tmpFile['id'] = $fileId->getId($file); |
||
| 560 | $tmpFile['use'] = ($file->getArchive()) ? 'ARCHIVE' : ''; |
||
| 561 | $files[$grpUSE][$file->getUid()] = $tmpFile; |
||
| 562 | } |
||
| 563 | |||
| 564 | } |
||
| 565 | } |
||
| 566 | |||
| 567 | return $files; |
||
| 568 | |||
| 569 | } |
||
| 570 | |||
| 571 | /** |
||
| 572 | * Returns the changed |
||
| 573 | * |
||
| 574 | * @return boolean $changed |
||
| 575 | */ |
||
| 576 | public function getChanged() |
||
| 577 | { |
||
| 578 | return $this->changed; |
||
| 579 | } |
||
| 580 | |||
| 581 | /** |
||
| 582 | * Sets the changed |
||
| 583 | * |
||
| 584 | * @param boolean $changed |
||
| 585 | * @return void |
||
| 586 | */ |
||
| 587 | public function setChanged($changed) |
||
| 588 | { |
||
| 589 | $this->changed = $changed; |
||
| 590 | } |
||
| 591 | |||
| 592 | /** |
||
| 593 | * Returns the valid |
||
| 594 | * |
||
| 595 | * @return boolean $valid |
||
| 596 | */ |
||
| 597 | public function getValid() |
||
| 598 | { |
||
| 599 | return $this->valid; |
||
| 600 | } |
||
| 601 | |||
| 602 | /** |
||
| 603 | * Sets the valid |
||
| 604 | * |
||
| 605 | * @param boolean $valid |
||
| 606 | * @return void |
||
| 607 | */ |
||
| 608 | public function setValid($valid) |
||
| 609 | { |
||
| 610 | $this->valid = $valid; |
||
| 611 | } |
||
| 612 | |||
| 613 | /** |
||
| 614 | * Gets the Issue Date |
||
| 615 | * |
||
| 616 | * @return string |
||
| 617 | */ |
||
| 618 | public function getDateIssued() |
||
| 619 | { |
||
| 620 | return empty($this->dateIssued) ? '' : $this->dateIssued; |
||
| 621 | } |
||
| 622 | |||
| 623 | /** |
||
| 624 | * Sets the Issue Date |
||
| 625 | * |
||
| 626 | * @param string $dateIssued |
||
| 627 | * @return void |
||
| 628 | */ |
||
| 629 | public function setDateIssued($dateIssued) |
||
| 630 | { |
||
| 631 | $this->dateIssued = empty($dateIssued) ? '' : $dateIssued; |
||
| 632 | } |
||
| 633 | |||
| 634 | /** |
||
| 635 | * |
||
| 636 | * |
||
| 637 | * @return boolean |
||
| 638 | */ |
||
| 639 | public function isDeleteAllowed() |
||
| 640 | { |
||
| 641 | return ($this->state == self::OBJECT_STATE_INACTIVE || |
||
| 642 | $this->state == self::OBJECT_STATE_ACTIVE) && |
||
| 643 | !empty($this->objectIdentifier); |
||
| 644 | } |
||
| 645 | |||
| 646 | /** |
||
| 647 | * |
||
| 648 | * |
||
| 649 | * @return boolean |
||
| 650 | */ |
||
| 651 | public function isActive() |
||
| 652 | { |
||
| 653 | return $this->state == self::OBJECT_STATE_ACTIVE || |
||
| 654 | $this->state == self::OBJECT_STATE_NEW || |
||
| 655 | ($this->state != self::OBJECT_STATE_INACTIVE && |
||
| 656 | $this->state != self::OBJECT_STATE_DELETED && |
||
| 657 | $this->state != self::OBJECT_STATE_LOCALLY_DELETED); |
||
| 658 | } |
||
| 659 | |||
| 660 | /** |
||
| 661 | * |
||
| 662 | * |
||
| 663 | * @return boolean |
||
| 664 | */ |
||
| 665 | public function isActivationChangeAllowed() |
||
| 666 | { |
||
| 667 | return $this->state == self::OBJECT_STATE_INACTIVE || |
||
| 668 | $this->state == self::OBJECT_STATE_ACTIVE; |
||
| 669 | } |
||
| 670 | |||
| 671 | /** |
||
| 672 | * |
||
| 673 | * |
||
| 674 | * @return boolean |
||
| 675 | */ |
||
| 676 | public function isDeleteRemote() |
||
| 677 | { |
||
| 678 | return $this->state == self::OBJECT_STATE_LOCALLY_DELETED; |
||
| 679 | } |
||
| 680 | |||
| 681 | /** |
||
| 682 | * |
||
| 683 | * |
||
| 684 | * @return boolean |
||
| 685 | */ |
||
| 686 | public function isRestoreRemote() |
||
| 687 | { |
||
| 688 | return $this->state == self::OBJECT_STATE_DELETED; |
||
| 689 | } |
||
| 690 | |||
| 691 | /** |
||
| 692 | * |
||
| 693 | * |
||
| 694 | * @return boolean |
||
| 695 | */ |
||
| 696 | public function isActivateRemote() |
||
| 697 | { |
||
| 698 | return $this->state == self::OBJECT_STATE_INACTIVE; |
||
| 699 | } |
||
| 700 | |||
| 701 | /** |
||
| 702 | * |
||
| 703 | * |
||
| 704 | * @return boolean |
||
| 705 | */ |
||
| 706 | public function isInactivateRemote() |
||
| 707 | { |
||
| 708 | return $this->state == self::OBJECT_STATE_ACTIVE; |
||
| 709 | } |
||
| 710 | |||
| 711 | /** |
||
| 712 | * |
||
| 713 | * |
||
| 714 | * @return boolean |
||
| 715 | */ |
||
| 716 | public function isIngestRemote() |
||
| 717 | { |
||
| 718 | return ($this->state == self::OBJECT_STATE_NEW || $this->state == self::OBJECT_STATE_ACTIVE) && empty($this->objectIdentifier); |
||
| 719 | } |
||
| 720 | |||
| 721 | /** |
||
| 722 | * |
||
| 723 | * |
||
| 724 | * @return boolean |
||
| 725 | */ |
||
| 726 | public function isUpdateRemote() |
||
| 727 | { |
||
| 728 | return ($this->state == self::OBJECT_STATE_ACTIVE || $this->state == self::OBJECT_STATE_INACTIVE) && !empty($this->objectIdentifier); |
||
| 729 | } |
||
| 730 | |||
| 731 | /** |
||
| 732 | * |
||
| 733 | * |
||
| 734 | * @return boolean |
||
| 735 | */ |
||
| 736 | public function getIsNew() |
||
| 737 | { |
||
| 738 | return (!$this->changed) && (empty($this->objectIdentifier)); |
||
| 739 | } |
||
| 740 | |||
| 741 | |||
| 742 | /** |
||
| 743 | * Returns the process number |
||
| 744 | * |
||
| 745 | * @return string |
||
| 746 | */ |
||
| 747 | public function getProcessNumber() |
||
| 750 | } |
||
| 751 | |||
| 752 | /** |
||
| 753 | * Sets the process number |
||
| 754 | * |
||
| 755 | * @param string $processNumber |
||
| 756 | * @return void |
||
| 757 | */ |
||
| 758 | public function setProcessNumber($processNumber) |
||
| 759 | { |
||
| 760 | $this->processNumber = trim($processNumber); |
||
| 761 | } |
||
| 762 | |||
| 763 | |||
| 764 | /** |
||
| 765 | * Gets the submitter name of the document |
||
| 766 | * |
||
| 767 | * @return string |
||
| 768 | */ |
||
| 769 | public function getSubmitterName() |
||
| 770 | { |
||
| 771 | try { |
||
| 772 | $slub = new \EWW\Dpf\Helper\Slub($this->getSlubInfoData()); |
||
| 773 | return $slub->getSubmitterName(); |
||
| 774 | } catch (\Exception $exception) { |
||
| 775 | return ""; |
||
| 776 | } |
||
| 777 | } |
||
| 778 | |||
| 779 | /** |
||
| 780 | * Gets the qucosa urn of the document |
||
| 781 | * |
||
| 782 | * @return string |
||
| 783 | */ |
||
| 784 | public function getQucosaUrn() |
||
| 785 | { |
||
| 786 | $mods = new \EWW\Dpf\Helper\Mods($this->getXmlData()); |
||
| 787 | return $mods->getQucosaUrn(); |
||
| 788 | } |
||
| 789 | |||
| 790 | } |
||
| 791 |