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