@@ 612-666 (lines=55) @@ | ||
609 | * @return ObjectDataInterface|null Returns object of type ObjectDataInterface or <code>null</code> |
|
610 | * if the repository response was empty |
|
611 | */ |
|
612 | public function getObject( |
|
613 | $repositoryId, |
|
614 | $objectId, |
|
615 | $filter = null, |
|
616 | $includeAllowableActions = false, |
|
617 | IncludeRelationships $includeRelationships = null, |
|
618 | $renditionFilter = Constants::RENDITION_NONE, |
|
619 | $includePolicyIds = false, |
|
620 | $includeAcl = false, |
|
621 | ExtensionDataInterface $extension = null |
|
622 | ) { |
|
623 | $cacheKey = $this->createCacheKey( |
|
624 | $objectId, |
|
625 | [ |
|
626 | $repositoryId, |
|
627 | $filter, |
|
628 | $includeAllowableActions, |
|
629 | $includeRelationships, |
|
630 | $renditionFilter, |
|
631 | $includePolicyIds, |
|
632 | $includeAcl, |
|
633 | $extension, |
|
634 | $this->getSuccinct() |
|
635 | ] |
|
636 | ); |
|
637 | if ($this->isCached($cacheKey)) { |
|
638 | return $this->getCached($cacheKey); |
|
639 | } |
|
640 | $url = $this->getObjectUrl($repositoryId, $objectId, Constants::SELECTOR_OBJECT); |
|
641 | $url->getQuery()->modify( |
|
642 | [ |
|
643 | Constants::PARAM_ALLOWABLE_ACTIONS => $includeAllowableActions ? 'true' : 'false', |
|
644 | Constants::PARAM_RENDITION_FILTER => $renditionFilter, |
|
645 | Constants::PARAM_POLICY_IDS => $includePolicyIds ? 'true' : 'false', |
|
646 | Constants::PARAM_ACL => $includeAcl ? 'true' : 'false', |
|
647 | Constants::PARAM_SUCCINCT => $this->getSuccinct() ? 'true' : 'false', |
|
648 | Constants::PARAM_DATETIME_FORMAT => (string) $this->getDateTimeFormat() |
|
649 | ] |
|
650 | ); |
|
651 | ||
652 | if (!empty($filter)) { |
|
653 | $url->getQuery()->modify([Constants::PARAM_FILTER => (string) $filter]); |
|
654 | } |
|
655 | ||
656 | if ($includeRelationships !== null) { |
|
657 | $url->getQuery()->modify([Constants::PARAM_RELATIONSHIPS => (string) $includeRelationships]); |
|
658 | } |
|
659 | ||
660 | $responseData = (array) $this->readJson($url); |
|
661 | ||
662 | return $this->cache( |
|
663 | $cacheKey, |
|
664 | $this->getJsonConverter()->convertObject($responseData) |
|
665 | ); |
|
666 | } |
|
667 | ||
668 | /** |
|
669 | * Gets the specified information for the object specified by path. |
|
@@ 689-744 (lines=56) @@ | ||
686 | * @return ObjectDataInterface|null Returns object of type <code>ObjectDataInterface</code> or <code>null</code> |
|
687 | * if the repository response was empty |
|
688 | */ |
|
689 | public function getObjectByPath( |
|
690 | $repositoryId, |
|
691 | $path, |
|
692 | $filter = null, |
|
693 | $includeAllowableActions = false, |
|
694 | IncludeRelationships $includeRelationships = null, |
|
695 | $renditionFilter = Constants::RENDITION_NONE, |
|
696 | $includePolicyIds = false, |
|
697 | $includeAcl = false, |
|
698 | ExtensionDataInterface $extension = null |
|
699 | ) { |
|
700 | $cacheKey = $this->createCacheKey( |
|
701 | $path, |
|
702 | [ |
|
703 | $repositoryId, |
|
704 | $filter, |
|
705 | $includeAllowableActions, |
|
706 | $includeRelationships, |
|
707 | $renditionFilter, |
|
708 | $includePolicyIds, |
|
709 | $includeAcl, |
|
710 | $extension, |
|
711 | $this->getSuccinct() |
|
712 | ] |
|
713 | ); |
|
714 | if ($this->isCached($cacheKey)) { |
|
715 | return $this->getCached($cacheKey); |
|
716 | } |
|
717 | ||
718 | $url = $this->getPathUrl($repositoryId, $path, Constants::SELECTOR_OBJECT); |
|
719 | $url->getQuery()->modify( |
|
720 | [ |
|
721 | Constants::PARAM_ALLOWABLE_ACTIONS => $includeAllowableActions ? 'true' : 'false', |
|
722 | Constants::PARAM_RENDITION_FILTER => $renditionFilter, |
|
723 | Constants::PARAM_POLICY_IDS => $includePolicyIds ? 'true' : 'false', |
|
724 | Constants::PARAM_ACL => $includeAcl ? 'true' : 'false', |
|
725 | Constants::PARAM_SUCCINCT => $this->getSuccinct() ? 'true' : 'false', |
|
726 | Constants::PARAM_DATETIME_FORMAT => (string) $this->getDateTimeFormat() |
|
727 | ] |
|
728 | ); |
|
729 | ||
730 | if (!empty($filter)) { |
|
731 | $url->getQuery()->modify([Constants::PARAM_FILTER => (string) $filter]); |
|
732 | } |
|
733 | ||
734 | if ($includeRelationships !== null) { |
|
735 | $url->getQuery()->modify([Constants::PARAM_RELATIONSHIPS => (string) $includeRelationships]); |
|
736 | } |
|
737 | ||
738 | $responseData = (array) $this->readJson($url); |
|
739 | ||
740 | return $this->cache( |
|
741 | $cacheKey, |
|
742 | $this->getJsonConverter()->convertObject($responseData) |
|
743 | ); |
|
744 | } |
|
745 | ||
746 | /** |
|
747 | * Gets the list of properties for an object. |