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