/** * Creates new instance of QueryProcessor * * @param RequestDescription $request Description of the request submitted by client. * @param IService $service Reference to the service implementation. */ private function __construct(RequestDescription $request, IService $service) { $this->request = $request; $this->service = $service; $isSingleResult = $request->isSingleResult(); //$top, $skip, $order, $inlinecount & $count are only applicable if: //The query targets a resource collection $this->_setQueryApplicable = $request->getTargetKind() == TargetKind::RESOURCE() && !$isSingleResult; //Or it's a $count resource (although $inlinecount isn't applicable in this case..but there's a check somewhere else for this $this->_setQueryApplicable |= $request->queryType == QueryType::COUNT(); //Paging is allowed if //The request targets a resource collection //and the request isn't for a $count segment $this->_pagingApplicable = $this->request->getTargetKind() == TargetKind::RESOURCE() && !$isSingleResult && $request->queryType != QueryType::COUNT(); $targetResourceType = $this->request->getTargetResourceType(); $targetResourceSetWrapper = $this->request->getTargetResourceSetWrapper(); $this->_expandSelectApplicable = !is_null($targetResourceType) && !is_null($targetResourceSetWrapper) && $targetResourceType->getResourceTypeKind() == ResourceTypeKind::ENTITY && !$this->request->isLinkUri(); }