@@ 635-689 (lines=55) @@ | ||
632 | * @return ObjectDataInterface|null Returns object of type ObjectDataInterface or <code>null</code> |
|
633 | * if the repository response was empty |
|
634 | */ |
|
635 | public function getObject( |
|
636 | $repositoryId, |
|
637 | $objectId, |
|
638 | $filter = null, |
|
639 | $includeAllowableActions = false, |
|
640 | IncludeRelationships $includeRelationships = null, |
|
641 | $renditionFilter = Constants::RENDITION_NONE, |
|
642 | $includePolicyIds = false, |
|
643 | $includeAcl = false, |
|
644 | ExtensionDataInterface $extension = null |
|
645 | ) { |
|
646 | $cacheKey = $this->createCacheKey( |
|
647 | $objectId, |
|
648 | array( |
|
649 | $repositoryId, |
|
650 | $filter, |
|
651 | $includeAllowableActions, |
|
652 | $includeRelationships, |
|
653 | $renditionFilter, |
|
654 | $includePolicyIds, |
|
655 | $includeAcl, |
|
656 | $extension, |
|
657 | $this->getSuccinct() |
|
658 | ) |
|
659 | ); |
|
660 | if ($this->isCached($cacheKey)) { |
|
661 | return $this->getCached($cacheKey); |
|
662 | } |
|
663 | $url = $this->getObjectUrl($repositoryId, $objectId, Constants::SELECTOR_OBJECT); |
|
664 | $url->getQuery()->modify( |
|
665 | array( |
|
666 | Constants::PARAM_ALLOWABLE_ACTIONS => $includeAllowableActions ? 'true' : 'false', |
|
667 | Constants::PARAM_RENDITION_FILTER => $renditionFilter, |
|
668 | Constants::PARAM_POLICY_IDS => $includePolicyIds ? 'true' : 'false', |
|
669 | Constants::PARAM_ACL => $includeAcl ? 'true' : 'false', |
|
670 | Constants::PARAM_SUCCINCT => $this->getSuccinct() ? 'true' : 'false', |
|
671 | Constants::PARAM_DATETIME_FORMAT => (string) $this->getDateTimeFormat() |
|
672 | ) |
|
673 | ); |
|
674 | ||
675 | if (!empty($filter)) { |
|
676 | $url->getQuery()->modify(array(Constants::PARAM_FILTER => (string) $filter)); |
|
677 | } |
|
678 | ||
679 | if ($includeRelationships !== null) { |
|
680 | $url->getQuery()->modify(array(Constants::PARAM_RELATIONSHIPS => (string) $includeRelationships)); |
|
681 | } |
|
682 | ||
683 | $responseData = (array) \json_decode($this->read($url)->getBody(), true); |
|
684 | ||
685 | return $this->cache( |
|
686 | $cacheKey, |
|
687 | $this->getJsonConverter()->convertObject($responseData) |
|
688 | ); |
|
689 | } |
|
690 | ||
691 | /** |
|
692 | * Gets the specified information for the object specified by path. |
|
@@ 712-767 (lines=56) @@ | ||
709 | * @return ObjectDataInterface|null Returns object of type <code>ObjectDataInterface</code> or <code>null</code> |
|
710 | * if the repository response was empty |
|
711 | */ |
|
712 | public function getObjectByPath( |
|
713 | $repositoryId, |
|
714 | $path, |
|
715 | $filter = null, |
|
716 | $includeAllowableActions = false, |
|
717 | IncludeRelationships $includeRelationships = null, |
|
718 | $renditionFilter = Constants::RENDITION_NONE, |
|
719 | $includePolicyIds = false, |
|
720 | $includeAcl = false, |
|
721 | ExtensionDataInterface $extension = null |
|
722 | ) { |
|
723 | $cacheKey = $this->createCacheKey( |
|
724 | $path, |
|
725 | array( |
|
726 | $repositoryId, |
|
727 | $filter, |
|
728 | $includeAllowableActions, |
|
729 | $includeRelationships, |
|
730 | $renditionFilter, |
|
731 | $includePolicyIds, |
|
732 | $includeAcl, |
|
733 | $extension, |
|
734 | $this->getSuccinct() |
|
735 | ) |
|
736 | ); |
|
737 | if ($this->isCached($cacheKey)) { |
|
738 | return $this->getCached($cacheKey); |
|
739 | } |
|
740 | ||
741 | $url = $this->getPathUrl($repositoryId, $path, Constants::SELECTOR_OBJECT); |
|
742 | $url->getQuery()->modify( |
|
743 | array( |
|
744 | Constants::PARAM_ALLOWABLE_ACTIONS => $includeAllowableActions ? 'true' : 'false', |
|
745 | Constants::PARAM_RENDITION_FILTER => $renditionFilter, |
|
746 | Constants::PARAM_POLICY_IDS => $includePolicyIds ? 'true' : 'false', |
|
747 | Constants::PARAM_ACL => $includeAcl ? 'true' : 'false', |
|
748 | Constants::PARAM_SUCCINCT => $this->getSuccinct() ? 'true' : 'false', |
|
749 | Constants::PARAM_DATETIME_FORMAT => (string) $this->getDateTimeFormat() |
|
750 | ) |
|
751 | ); |
|
752 | ||
753 | if (!empty($filter)) { |
|
754 | $url->getQuery()->modify(array(Constants::PARAM_FILTER => (string) $filter)); |
|
755 | } |
|
756 | ||
757 | if ($includeRelationships !== null) { |
|
758 | $url->getQuery()->modify(array(Constants::PARAM_RELATIONSHIPS => (string) $includeRelationships)); |
|
759 | } |
|
760 | ||
761 | $responseData = (array) \json_decode($this->read($url)->getBody(), true); |
|
762 | ||
763 | return $this->cache( |
|
764 | $cacheKey, |
|
765 | $this->getJsonConverter()->convertObject($responseData) |
|
766 | ); |
|
767 | } |
|
768 | ||
769 | /** |
|
770 | * Gets the list of properties for an object. |