Пример #1
0
 /**
  * Constructs a new instance of 'RootProjectionNode' representing root 
  * of 'Projection Tree'
  * 
  * @param ResourceSetWrapper  $resourceSetWrapper  ResourceSetWrapper of 
  *                                                 the resource pointed 
  *                                                 by the resource path.
  * @param InternalOrderByInfo $internalOrderByInfo Details of ordering 
  *                                                 to be applied to the 
  *                                                 resource set pointed 
  *                                                 by the resource path.
  * @param int                 $skipCount           Number of resources to 
  *                                                 be skipped from the 
  *                                                 resource set pointed 
  *                                                 by the resource path.
  * @param int                 $takeCount           Number of resources to 
  *                                                 be taken from the 
  *                                                 resource set pointed 
  *                                                 by the resource path.
  * @param int                 $maxResultCount      The maximum limit 
  *                                                 configured for the 
  *                                                 resource set.
  * @param ResourceType        $baseResourceType    Resource type of the 
  *                                                 resource pointed 
  *                                                 by the resource path.
  */
 public function __construct(ResourceSetWrapper $resourceSetWrapper, $internalOrderByInfo, $skipCount, $takeCount, $maxResultCount, ResourceType $baseResourceType)
 {
     $this->_baseResourceType = $baseResourceType;
     parent::__construct(null, null, $resourceSetWrapper, $internalOrderByInfo, $skipCount, $takeCount, $maxResultCount);
 }
Пример #2
0
 /**
  * Recursive metod to build $expand and $select paths for a specified node.
  * 
  * @param string[]          &$parentPathSegments     Array of path
  *                                                        segments which leads
  *                                                        up to (including) 
  *                                                        the segment 
  *                                                        represented by 
  *                                                        $expandedProjectionNode.
  * @param string[]          &$selectionPaths         The string which
  *                                                        holds projection
  *                                                        path segment 
  *                                                        seperated by comma,
  *                                                        On return this argument
  *                                                        will be updated with 
  *                                                        the selection path
  *                                                        segments under 
  *                                                        this node. 
  * @param string[]          &$expansionPaths         The string which holds
  *                                                        expansion path segment
  *                                                        seperated by comma.
  *                                                        On return this argument
  *                                                        will be updated with 
  *                                                        the expand path
  *                                                        segments under 
  *                                                        this node. 
  * @param ExpandedProjectionNode &$expandedProjectionNode The expanded node for 
  *                                                        which expansion 
  *                                                        and selection path 
  *                                                        to be build.
  * @param boolean                &$foundSelections        On return, this 
  *                                                        argument will hold
  *                                                        true if any selection
  *                                                        defined under this node
  *                                                        false otherwise.
  * @param boolean                &$foundExpansions        On return, this 
  *                                                        argument will hold 
  *                                                        true if any expansion
  *                                                        defined under this node
  *                                                        false otherwise.
  *
  * @return void
  */
 private function _buildSelectionAndExpansionPathsForNode(&$parentPathSegments, &$selectionPaths, &$expansionPaths, ExpandedProjectionNode &$expandedProjectionNode, &$foundSelections, &$foundExpansions)
 {
     $foundSelections = false;
     $foundExpansions = false;
     $foundSelectionOnChild = false;
     $foundExpansionOnChild = false;
     $expandedChildrenNeededToBeSelected = array();
     foreach ($expandedProjectionNode->getChildNodes() as $childNode) {
         if (!$childNode instanceof ExpandedProjectionNode) {
             $foundSelections = true;
             $this->_appendSelectionOrExpandPath($selectionPaths, $parentPathSegments, $childNode->getPropertyName());
         } else {
             $foundExpansions = true;
             array_push($parentPathSegments, $childNode->getPropertyName());
             $this->_buildSelectionAndExpansionPathsForNode($parentPathSegments, $selectionPaths, $expansionPaths, $childNode, $foundSelectionOnChild, $foundExpansionOnChild);
             array_pop($parentPathSegments);
             if ($childNode->canSelectAllProperties()) {
                 if ($foundSelectionOnChild) {
                     $this->_appendSelectionOrExpandPath($selectionPaths, $parentPathSegments, $childNode->getPropertyName() . '/*');
                 } else {
                     $expandedChildrenNeededToBeSelected[] = $childNode;
                 }
             }
         }
         $foundSelections |= $foundSelectionOnChild;
         if (!$foundExpansionOnChild) {
             $this->_appendSelectionOrExpandPath($expansionPaths, $parentPathSegments, $childNode->getPropertyName());
         }
     }
     if (!$expandedProjectionNode->canSelectAllProperties() || $foundSelections) {
         foreach ($expandedChildrenNeededToBeSelected as $childToProject) {
             $this->_appendSelectionOrExpandPath($selectionPaths, $parentPathSegments, $childNode->getPropertyName());
             $foundSelections = true;
         }
     }
 }