public function provider()
 {
     $v1 = Version::v1();
     $v2 = Version::v2();
     $v3 = Version::v3();
     return array(array(101, TargetKind::METADATA(), $v1, null, null, MimeTypes::MIME_APPLICATION_XML), array(102, TargetKind::METADATA(), $v1, MimeTypes::MIME_APPLICATION_XML, null, MimeTypes::MIME_APPLICATION_XML), array(103, TargetKind::METADATA(), $v1, MimeTypes::MIME_APPLICATION_ATOM, null, null), array(104, TargetKind::METADATA(), $v1, MimeTypes::MIME_APPLICATION_ATOM, ODataConstants::FORMAT_XML, MimeTypes::MIME_APPLICATION_XML), array(105, TargetKind::METADATA(), $v2, MimeTypes::MIME_APPLICATION_ATOM, ODataConstants::FORMAT_XML, MimeTypes::MIME_APPLICATION_XML), array(106, TargetKind::METADATA(), $v3, MimeTypes::MIME_APPLICATION_ATOM, ODataConstants::FORMAT_XML, MimeTypes::MIME_APPLICATION_XML), array(108, TargetKind::METADATA(), $v1, MimeTypes::MIME_APPLICATION_JSON_FULL_META, null, null), array(109, TargetKind::METADATA(), $v2, MimeTypes::MIME_APPLICATION_JSON_FULL_META, null, null), array(110, TargetKind::METADATA(), $v3, MimeTypes::MIME_APPLICATION_JSON_FULL_META, null, null), array(111, TargetKind::METADATA(), $v1, MimeTypes::MIME_APPLICATION_JSON_NO_META, null, null), array(112, TargetKind::METADATA(), $v2, MimeTypes::MIME_APPLICATION_JSON_NO_META, null, null), array(113, TargetKind::METADATA(), $v3, MimeTypes::MIME_APPLICATION_JSON_NO_META, null, null), array(114, TargetKind::METADATA(), $v1, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META, null, null), array(115, TargetKind::METADATA(), $v2, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META, null, null), array(116, TargetKind::METADATA(), $v3, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META, null, null), array(124, TargetKind::METADATA(), $v1, MimeTypes::MIME_APPLICATION_JSON_VERBOSE, null, null), array(125, TargetKind::METADATA(), $v2, MimeTypes::MIME_APPLICATION_JSON_VERBOSE, null, null), array(126, TargetKind::METADATA(), $v3, MimeTypes::MIME_APPLICATION_JSON_VERBOSE, null, null), array(201, TargetKind::SERVICE_DIRECTORY(), $v1, null, null, MimeTypes::MIME_APPLICATION_XML), array(202, TargetKind::SERVICE_DIRECTORY(), $v1, MimeTypes::MIME_APPLICATION_ATOMSERVICE, null, MimeTypes::MIME_APPLICATION_ATOMSERVICE), array(203, TargetKind::SERVICE_DIRECTORY(), $v1, MimeTypes::MIME_APPLICATION_JSON, null, MimeTypes::MIME_APPLICATION_JSON), array(204, TargetKind::SERVICE_DIRECTORY(), $v1, MimeTypes::MIME_APPLICATION_ATOM, null, null), array(205, TargetKind::SERVICE_DIRECTORY(), $v1, MimeTypes::MIME_APPLICATION_ATOM, MimeTypes::MIME_APPLICATION_JSON, MimeTypes::MIME_APPLICATION_JSON), array(206, TargetKind::SERVICE_DIRECTORY(), $v2, MimeTypes::MIME_APPLICATION_ATOM, MimeTypes::MIME_APPLICATION_JSON, MimeTypes::MIME_APPLICATION_JSON), array(207, TargetKind::SERVICE_DIRECTORY(), $v3, MimeTypes::MIME_APPLICATION_ATOM, MimeTypes::MIME_APPLICATION_JSON, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META), array(208, TargetKind::SERVICE_DIRECTORY(), $v1, MimeTypes::MIME_APPLICATION_JSON_FULL_META, null, MimeTypes::MIME_APPLICATION_JSON_FULL_META), array(209, TargetKind::SERVICE_DIRECTORY(), $v2, MimeTypes::MIME_APPLICATION_JSON_FULL_META, null, MimeTypes::MIME_APPLICATION_JSON_FULL_META), array(210, TargetKind::SERVICE_DIRECTORY(), $v3, MimeTypes::MIME_APPLICATION_JSON_FULL_META, null, MimeTypes::MIME_APPLICATION_JSON_FULL_META), array(211, TargetKind::SERVICE_DIRECTORY(), $v1, MimeTypes::MIME_APPLICATION_JSON_NO_META, null, MimeTypes::MIME_APPLICATION_JSON_NO_META), array(212, TargetKind::SERVICE_DIRECTORY(), $v2, MimeTypes::MIME_APPLICATION_JSON_NO_META, null, MimeTypes::MIME_APPLICATION_JSON_NO_META), array(213, TargetKind::SERVICE_DIRECTORY(), $v3, MimeTypes::MIME_APPLICATION_JSON_NO_META, null, MimeTypes::MIME_APPLICATION_JSON_NO_META), array(214, TargetKind::SERVICE_DIRECTORY(), $v1, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META, null, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META), array(215, TargetKind::SERVICE_DIRECTORY(), $v2, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META, null, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META), array(216, TargetKind::SERVICE_DIRECTORY(), $v3, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META, null, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META), array(224, TargetKind::SERVICE_DIRECTORY(), $v1, MimeTypes::MIME_APPLICATION_JSON_VERBOSE, null, MimeTypes::MIME_APPLICATION_JSON_VERBOSE), array(225, TargetKind::SERVICE_DIRECTORY(), $v2, MimeTypes::MIME_APPLICATION_JSON_VERBOSE, null, MimeTypes::MIME_APPLICATION_JSON_VERBOSE), array(226, TargetKind::SERVICE_DIRECTORY(), $v3, MimeTypes::MIME_APPLICATION_JSON_VERBOSE, null, MimeTypes::MIME_APPLICATION_JSON_VERBOSE), array(400, TargetKind::PRIMITIVE(), $v1, MimeTypes::MIME_APPLICATION_XML, null, MimeTypes::MIME_APPLICATION_XML), array(401, TargetKind::PRIMITIVE(), $v1, MimeTypes::MIME_TEXTXML, null, MimeTypes::MIME_TEXTXML), array(402, TargetKind::PRIMITIVE(), $v1, MimeTypes::MIME_APPLICATION_JSON, null, MimeTypes::MIME_APPLICATION_JSON), array(403, TargetKind::PRIMITIVE(), $v1, MimeTypes::MIME_APPLICATION_ATOM, null, null), array(404, TargetKind::PRIMITIVE(), $v1, MimeTypes::MIME_APPLICATION_ATOM, ODataConstants::FORMAT_XML, MimeTypes::MIME_APPLICATION_XML), array(405, TargetKind::PRIMITIVE(), $v1, MimeTypes::MIME_APPLICATION_ATOM, ODataConstants::FORMAT_JSON, MimeTypes::MIME_APPLICATION_JSON), array(406, TargetKind::PRIMITIVE(), $v2, MimeTypes::MIME_APPLICATION_ATOM, ODataConstants::FORMAT_XML, MimeTypes::MIME_APPLICATION_XML), array(407, TargetKind::PRIMITIVE(), $v2, MimeTypes::MIME_APPLICATION_ATOM, ODataConstants::FORMAT_JSON, MimeTypes::MIME_APPLICATION_JSON), array(408, TargetKind::PRIMITIVE(), $v3, MimeTypes::MIME_APPLICATION_ATOM, ODataConstants::FORMAT_XML, MimeTypes::MIME_APPLICATION_XML), array(409, TargetKind::PRIMITIVE(), $v3, MimeTypes::MIME_APPLICATION_ATOM, ODataConstants::FORMAT_JSON, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META), array(418, TargetKind::PRIMITIVE(), $v1, MimeTypes::MIME_APPLICATION_JSON_FULL_META, null, MimeTypes::MIME_APPLICATION_JSON_FULL_META), array(419, TargetKind::PRIMITIVE(), $v2, MimeTypes::MIME_APPLICATION_JSON_FULL_META, null, MimeTypes::MIME_APPLICATION_JSON_FULL_META), array(420, TargetKind::PRIMITIVE(), $v3, MimeTypes::MIME_APPLICATION_JSON_FULL_META, null, MimeTypes::MIME_APPLICATION_JSON_FULL_META), array(421, TargetKind::PRIMITIVE(), $v1, MimeTypes::MIME_APPLICATION_JSON_NO_META, null, MimeTypes::MIME_APPLICATION_JSON_NO_META), array(422, TargetKind::PRIMITIVE(), $v2, MimeTypes::MIME_APPLICATION_JSON_NO_META, null, MimeTypes::MIME_APPLICATION_JSON_NO_META), array(423, TargetKind::PRIMITIVE(), $v3, MimeTypes::MIME_APPLICATION_JSON_NO_META, null, MimeTypes::MIME_APPLICATION_JSON_NO_META), array(424, TargetKind::PRIMITIVE(), $v1, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META, null, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META), array(425, TargetKind::PRIMITIVE(), $v2, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META, null, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META), array(426, TargetKind::PRIMITIVE(), $v3, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META, null, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META), array(434, TargetKind::PRIMITIVE(), $v1, MimeTypes::MIME_APPLICATION_JSON_VERBOSE, null, MimeTypes::MIME_APPLICATION_JSON_VERBOSE), array(435, TargetKind::PRIMITIVE(), $v2, MimeTypes::MIME_APPLICATION_JSON_VERBOSE, null, MimeTypes::MIME_APPLICATION_JSON_VERBOSE), array(436, TargetKind::PRIMITIVE(), $v3, MimeTypes::MIME_APPLICATION_JSON_VERBOSE, null, MimeTypes::MIME_APPLICATION_JSON_VERBOSE), array(500, TargetKind::COMPLEX_OBJECT(), $v1, MimeTypes::MIME_APPLICATION_XML, null, MimeTypes::MIME_APPLICATION_XML), array(501, TargetKind::COMPLEX_OBJECT(), $v1, MimeTypes::MIME_TEXTXML, null, MimeTypes::MIME_TEXTXML), array(502, TargetKind::COMPLEX_OBJECT(), $v1, MimeTypes::MIME_APPLICATION_JSON, null, MimeTypes::MIME_APPLICATION_JSON), array(503, TargetKind::COMPLEX_OBJECT(), $v1, MimeTypes::MIME_APPLICATION_ATOM, null, null), array(504, TargetKind::COMPLEX_OBJECT(), $v1, MimeTypes::MIME_APPLICATION_ATOM, ODataConstants::FORMAT_XML, MimeTypes::MIME_APPLICATION_XML), array(505, TargetKind::COMPLEX_OBJECT(), $v1, MimeTypes::MIME_APPLICATION_ATOM, ODataConstants::FORMAT_JSON, MimeTypes::MIME_APPLICATION_JSON), array(506, TargetKind::COMPLEX_OBJECT(), $v2, MimeTypes::MIME_APPLICATION_ATOM, ODataConstants::FORMAT_XML, MimeTypes::MIME_APPLICATION_XML), array(507, TargetKind::COMPLEX_OBJECT(), $v2, MimeTypes::MIME_APPLICATION_ATOM, ODataConstants::FORMAT_JSON, MimeTypes::MIME_APPLICATION_JSON), array(508, TargetKind::COMPLEX_OBJECT(), $v3, MimeTypes::MIME_APPLICATION_ATOM, ODataConstants::FORMAT_XML, MimeTypes::MIME_APPLICATION_XML), array(509, TargetKind::COMPLEX_OBJECT(), $v3, MimeTypes::MIME_APPLICATION_ATOM, ODataConstants::FORMAT_JSON, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META), array(518, TargetKind::COMPLEX_OBJECT(), $v1, MimeTypes::MIME_APPLICATION_JSON_FULL_META, null, MimeTypes::MIME_APPLICATION_JSON_FULL_META), array(519, TargetKind::COMPLEX_OBJECT(), $v2, MimeTypes::MIME_APPLICATION_JSON_FULL_META, null, MimeTypes::MIME_APPLICATION_JSON_FULL_META), array(520, TargetKind::COMPLEX_OBJECT(), $v3, MimeTypes::MIME_APPLICATION_JSON_FULL_META, null, MimeTypes::MIME_APPLICATION_JSON_FULL_META), array(521, TargetKind::COMPLEX_OBJECT(), $v1, MimeTypes::MIME_APPLICATION_JSON_NO_META, null, MimeTypes::MIME_APPLICATION_JSON_NO_META), array(522, TargetKind::COMPLEX_OBJECT(), $v2, MimeTypes::MIME_APPLICATION_JSON_NO_META, null, MimeTypes::MIME_APPLICATION_JSON_NO_META), array(523, TargetKind::COMPLEX_OBJECT(), $v3, MimeTypes::MIME_APPLICATION_JSON_NO_META, null, MimeTypes::MIME_APPLICATION_JSON_NO_META), array(524, TargetKind::COMPLEX_OBJECT(), $v1, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META, null, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META), array(525, TargetKind::COMPLEX_OBJECT(), $v2, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META, null, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META), array(526, TargetKind::COMPLEX_OBJECT(), $v3, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META, null, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META), array(534, TargetKind::COMPLEX_OBJECT(), $v1, MimeTypes::MIME_APPLICATION_JSON_VERBOSE, null, MimeTypes::MIME_APPLICATION_JSON_VERBOSE), array(535, TargetKind::COMPLEX_OBJECT(), $v2, MimeTypes::MIME_APPLICATION_JSON_VERBOSE, null, MimeTypes::MIME_APPLICATION_JSON_VERBOSE), array(536, TargetKind::COMPLEX_OBJECT(), $v3, MimeTypes::MIME_APPLICATION_JSON_VERBOSE, null, MimeTypes::MIME_APPLICATION_JSON_VERBOSE), array(600, TargetKind::BAG(), $v1, MimeTypes::MIME_APPLICATION_XML, null, MimeTypes::MIME_APPLICATION_XML), array(601, TargetKind::BAG(), $v1, MimeTypes::MIME_TEXTXML, null, MimeTypes::MIME_TEXTXML), array(602, TargetKind::BAG(), $v1, MimeTypes::MIME_APPLICATION_JSON, null, MimeTypes::MIME_APPLICATION_JSON), array(603, TargetKind::BAG(), $v1, MimeTypes::MIME_APPLICATION_ATOM, null, null), array(604, TargetKind::BAG(), $v1, MimeTypes::MIME_APPLICATION_ATOM, ODataConstants::FORMAT_XML, MimeTypes::MIME_APPLICATION_XML), array(605, TargetKind::BAG(), $v1, MimeTypes::MIME_APPLICATION_ATOM, ODataConstants::FORMAT_JSON, MimeTypes::MIME_APPLICATION_JSON), array(606, TargetKind::BAG(), $v2, MimeTypes::MIME_APPLICATION_ATOM, ODataConstants::FORMAT_XML, MimeTypes::MIME_APPLICATION_XML), array(607, TargetKind::BAG(), $v2, MimeTypes::MIME_APPLICATION_ATOM, ODataConstants::FORMAT_JSON, MimeTypes::MIME_APPLICATION_JSON), array(608, TargetKind::BAG(), $v3, MimeTypes::MIME_APPLICATION_ATOM, ODataConstants::FORMAT_XML, MimeTypes::MIME_APPLICATION_XML), array(609, TargetKind::BAG(), $v3, MimeTypes::MIME_APPLICATION_ATOM, ODataConstants::FORMAT_JSON, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META), array(618, TargetKind::BAG(), $v1, MimeTypes::MIME_APPLICATION_JSON_FULL_META, null, MimeTypes::MIME_APPLICATION_JSON_FULL_META), array(619, TargetKind::BAG(), $v2, MimeTypes::MIME_APPLICATION_JSON_FULL_META, null, MimeTypes::MIME_APPLICATION_JSON_FULL_META), array(620, TargetKind::BAG(), $v3, MimeTypes::MIME_APPLICATION_JSON_FULL_META, null, MimeTypes::MIME_APPLICATION_JSON_FULL_META), array(621, TargetKind::BAG(), $v1, MimeTypes::MIME_APPLICATION_JSON_NO_META, null, MimeTypes::MIME_APPLICATION_JSON_NO_META), array(622, TargetKind::BAG(), $v2, MimeTypes::MIME_APPLICATION_JSON_NO_META, null, MimeTypes::MIME_APPLICATION_JSON_NO_META), array(623, TargetKind::BAG(), $v3, MimeTypes::MIME_APPLICATION_JSON_NO_META, null, MimeTypes::MIME_APPLICATION_JSON_NO_META), array(624, TargetKind::BAG(), $v1, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META, null, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META), array(625, TargetKind::BAG(), $v2, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META, null, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META), array(626, TargetKind::BAG(), $v3, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META, null, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META), array(634, TargetKind::BAG(), $v1, MimeTypes::MIME_APPLICATION_JSON_VERBOSE, null, MimeTypes::MIME_APPLICATION_JSON_VERBOSE), array(635, TargetKind::BAG(), $v2, MimeTypes::MIME_APPLICATION_JSON_VERBOSE, null, MimeTypes::MIME_APPLICATION_JSON_VERBOSE), array(636, TargetKind::BAG(), $v3, MimeTypes::MIME_APPLICATION_JSON_VERBOSE, null, MimeTypes::MIME_APPLICATION_JSON_VERBOSE), array(700, TargetKind::LINK(), $v1, MimeTypes::MIME_APPLICATION_XML, null, MimeTypes::MIME_APPLICATION_XML), array(701, TargetKind::LINK(), $v1, MimeTypes::MIME_TEXTXML, null, MimeTypes::MIME_TEXTXML), array(702, TargetKind::LINK(), $v1, MimeTypes::MIME_APPLICATION_JSON, null, MimeTypes::MIME_APPLICATION_JSON), array(703, TargetKind::LINK(), $v1, MimeTypes::MIME_APPLICATION_ATOM, null, null), array(704, TargetKind::LINK(), $v1, MimeTypes::MIME_APPLICATION_ATOM, ODataConstants::FORMAT_XML, MimeTypes::MIME_APPLICATION_XML), array(705, TargetKind::LINK(), $v1, MimeTypes::MIME_APPLICATION_ATOM, ODataConstants::FORMAT_JSON, MimeTypes::MIME_APPLICATION_JSON), array(706, TargetKind::LINK(), $v2, MimeTypes::MIME_APPLICATION_ATOM, ODataConstants::FORMAT_XML, MimeTypes::MIME_APPLICATION_XML), array(707, TargetKind::LINK(), $v2, MimeTypes::MIME_APPLICATION_ATOM, ODataConstants::FORMAT_JSON, MimeTypes::MIME_APPLICATION_JSON), array(708, TargetKind::LINK(), $v3, MimeTypes::MIME_APPLICATION_ATOM, ODataConstants::FORMAT_XML, MimeTypes::MIME_APPLICATION_XML), array(709, TargetKind::LINK(), $v3, MimeTypes::MIME_APPLICATION_ATOM, ODataConstants::FORMAT_JSON, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META), array(718, TargetKind::LINK(), $v1, MimeTypes::MIME_APPLICATION_JSON_FULL_META, null, MimeTypes::MIME_APPLICATION_JSON_FULL_META), array(719, TargetKind::LINK(), $v2, MimeTypes::MIME_APPLICATION_JSON_FULL_META, null, MimeTypes::MIME_APPLICATION_JSON_FULL_META), array(720, TargetKind::LINK(), $v3, MimeTypes::MIME_APPLICATION_JSON_FULL_META, null, MimeTypes::MIME_APPLICATION_JSON_FULL_META), array(721, TargetKind::LINK(), $v1, MimeTypes::MIME_APPLICATION_JSON_NO_META, null, MimeTypes::MIME_APPLICATION_JSON_NO_META), array(722, TargetKind::LINK(), $v2, MimeTypes::MIME_APPLICATION_JSON_NO_META, null, MimeTypes::MIME_APPLICATION_JSON_NO_META), array(723, TargetKind::LINK(), $v3, MimeTypes::MIME_APPLICATION_JSON_NO_META, null, MimeTypes::MIME_APPLICATION_JSON_NO_META), array(724, TargetKind::LINK(), $v1, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META, null, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META), array(725, TargetKind::LINK(), $v2, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META, null, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META), array(726, TargetKind::LINK(), $v3, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META, null, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META), array(734, TargetKind::LINK(), $v1, MimeTypes::MIME_APPLICATION_JSON_VERBOSE, null, MimeTypes::MIME_APPLICATION_JSON_VERBOSE), array(735, TargetKind::LINK(), $v2, MimeTypes::MIME_APPLICATION_JSON_VERBOSE, null, MimeTypes::MIME_APPLICATION_JSON_VERBOSE), array(736, TargetKind::LINK(), $v3, MimeTypes::MIME_APPLICATION_JSON_VERBOSE, null, MimeTypes::MIME_APPLICATION_JSON_VERBOSE), array(800, TargetKind::RESOURCE(), $v1, MimeTypes::MIME_APPLICATION_ATOM, null, MimeTypes::MIME_APPLICATION_ATOM), array(802, TargetKind::RESOURCE(), $v1, MimeTypes::MIME_APPLICATION_JSON, null, MimeTypes::MIME_APPLICATION_JSON), array(803, TargetKind::RESOURCE(), $v1, MimeTypes::MIME_APPLICATION_XML, null, null), array(804, TargetKind::RESOURCE(), $v1, MimeTypes::MIME_APPLICATION_XML, ODataConstants::FORMAT_ATOM, MimeTypes::MIME_APPLICATION_ATOM), array(805, TargetKind::RESOURCE(), $v1, MimeTypes::MIME_APPLICATION_XML, ODataConstants::FORMAT_JSON, MimeTypes::MIME_APPLICATION_JSON), array(806, TargetKind::RESOURCE(), $v2, MimeTypes::MIME_APPLICATION_XML, ODataConstants::FORMAT_ATOM, MimeTypes::MIME_APPLICATION_ATOM), array(807, TargetKind::RESOURCE(), $v2, MimeTypes::MIME_APPLICATION_XML, ODataConstants::FORMAT_JSON, MimeTypes::MIME_APPLICATION_JSON), array(808, TargetKind::RESOURCE(), $v3, MimeTypes::MIME_APPLICATION_XML, ODataConstants::FORMAT_ATOM, MimeTypes::MIME_APPLICATION_ATOM), array(809, TargetKind::RESOURCE(), $v3, MimeTypes::MIME_APPLICATION_XML, ODataConstants::FORMAT_JSON, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META), array(818, TargetKind::RESOURCE(), $v1, MimeTypes::MIME_APPLICATION_JSON_FULL_META, null, MimeTypes::MIME_APPLICATION_JSON_FULL_META), array(819, TargetKind::RESOURCE(), $v2, MimeTypes::MIME_APPLICATION_JSON_FULL_META, null, MimeTypes::MIME_APPLICATION_JSON_FULL_META), array(820, TargetKind::RESOURCE(), $v3, MimeTypes::MIME_APPLICATION_JSON_FULL_META, null, MimeTypes::MIME_APPLICATION_JSON_FULL_META), array(821, TargetKind::RESOURCE(), $v1, MimeTypes::MIME_APPLICATION_JSON_NO_META, null, MimeTypes::MIME_APPLICATION_JSON_NO_META), array(822, TargetKind::RESOURCE(), $v2, MimeTypes::MIME_APPLICATION_JSON_NO_META, null, MimeTypes::MIME_APPLICATION_JSON_NO_META), array(823, TargetKind::RESOURCE(), $v3, MimeTypes::MIME_APPLICATION_JSON_NO_META, null, MimeTypes::MIME_APPLICATION_JSON_NO_META), array(824, TargetKind::RESOURCE(), $v1, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META, null, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META), array(825, TargetKind::RESOURCE(), $v2, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META, null, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META), array(826, TargetKind::RESOURCE(), $v3, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META, null, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META), array(834, TargetKind::RESOURCE(), $v1, MimeTypes::MIME_APPLICATION_JSON_VERBOSE, null, MimeTypes::MIME_APPLICATION_JSON_VERBOSE), array(835, TargetKind::RESOURCE(), $v2, MimeTypes::MIME_APPLICATION_JSON_VERBOSE, null, MimeTypes::MIME_APPLICATION_JSON_VERBOSE), array(836, TargetKind::RESOURCE(), $v3, MimeTypes::MIME_APPLICATION_JSON_VERBOSE, null, MimeTypes::MIME_APPLICATION_JSON_VERBOSE));
 }
예제 #2
0
 /**
  * Write in specific format 
  * 
  * @param IService $service
  * @param RequestDescription $request the OData request
  * @param mixed $entityModel OData model instance
  * @param String $responseContentType Content type of the response
  * 
  */
 public static function write(IService $service, RequestDescription $request, $entityModel, $responseContentType)
 {
     $responseBody = null;
     $dataServiceVersion = $request->getResponseVersion();
     $targetKind = $request->getTargetKind();
     if ($targetKind == TargetKind::METADATA()) {
         // /$metadata
         $writer = new MetadataWriter($service->getProvidersWrapper());
         $responseBody = $writer->writeMetadata();
         $dataServiceVersion = $writer->getDataServiceVersion();
     } else {
         if ($targetKind == TargetKind::PRIMITIVE_VALUE() && $responseContentType != MimeTypes::MIME_APPLICATION_OCTETSTREAM) {
             //This second part is to exclude binary properties
             // /Customer('ALFKI')/CompanyName/$value
             // /Customers/$count
             $responseBody = utf8_encode($request->getTargetResult());
         } else {
             if ($responseContentType == MimeTypes::MIME_APPLICATION_OCTETSTREAM || $targetKind == TargetKind::MEDIA_RESOURCE()) {
                 // Binary property or media resource
                 if ($request->getTargetKind() == TargetKind::MEDIA_RESOURCE()) {
                     $result = $request->getTargetResult();
                     $streamInfo = $request->getResourceStreamInfo();
                     $provider = $service->getStreamProviderWrapper();
                     $eTag = $provider->getStreamETag($result, $streamInfo);
                     $service->getHost()->setResponseETag($eTag);
                     $responseBody = $provider->getReadStream($result, $streamInfo);
                 } else {
                     $responseBody = $request->getTargetResult();
                 }
                 if (is_null($responseContentType)) {
                     $responseContentType = MimeTypes::MIME_APPLICATION_OCTETSTREAM;
                 }
             } else {
                 $writer = $service->getODataWriterRegistry()->getWriter($request->getResponseVersion(), $responseContentType);
                 //TODO: move ot Messages
                 if (is_null($writer)) {
                     throw new \Exception("no writer can handle the request");
                 }
                 if (is_null($entityModel)) {
                     //TODO: this seems like a weird way to know that the request is for a service document..i'd think we know this some other way
                     $responseBody = $writer->writeServiceDocument($service->getProvidersWrapper())->getOutput();
                 } else {
                     $responseBody = $writer->write($entityModel)->getOutput();
                 }
             }
         }
     }
     $service->getHost()->setResponseStatusCode(HttpStatus::CODE_OK);
     $service->getHost()->setResponseContentType($responseContentType);
     $service->getHost()->setResponseVersion($dataServiceVersion->toString() . ';');
     $service->getHost()->setResponseCacheControl(ODataConstants::HTTPRESPONSE_HEADER_CACHECONTROL_NOCACHE);
     $service->getHost()->getOperationContext()->outgoingResponse()->setStream($responseBody);
 }
예제 #3
0
 /**
  * Process the request Uri and creates an instance of
  * RequestDescription from the processed uri.
  * 
  * @param IService $service        Reference to the data service instance.
  *
  * @return RequestDescription
  * 
  * @throws ODataException If any exception occurs while processing the segments
  *                        or in case of any version incompatibility.
  */
 public static function process(IService $service)
 {
     $host = $service->getHost();
     $absoluteRequestUri = $host->getAbsoluteRequestUri();
     $absoluteServiceUri = $host->getAbsoluteServiceUri();
     $requestUriSegments = array_slice($absoluteRequestUri->getSegments(), $absoluteServiceUri->getSegmentCount());
     $segments = SegmentParser::parseRequestUriSegments($requestUriSegments, $service->getProvidersWrapper(), true);
     $request = new RequestDescription($segments, $absoluteRequestUri, $service->getConfiguration()->getMaxDataServiceVersion(), $host->getRequestVersion(), $host->getRequestMaxVersion());
     $kind = $request->getTargetKind();
     if ($kind == TargetKind::METADATA() || $kind == TargetKind::BATCH() || $kind == TargetKind::SERVICE_DIRECTORY()) {
         return $request;
     }
     if ($kind == TargetKind::PRIMITIVE_VALUE() || $kind == TargetKind::MEDIA_RESOURCE()) {
         // http://odata/NW.svc/Orders/$count
         // http://odata/NW.svc/Orders(123)/Customer/CustomerID/$value
         // http://odata/NW.svc/Employees(1)/$value
         // http://odata/NW.svc/Employees(1)/ThumbNail_48X48/$value
         $request->setContainerName($segments[count($segments) - 2]->getIdentifier());
     } else {
         $request->setContainerName($request->getIdentifier());
     }
     if ($request->getIdentifier() === ODataConstants::URI_COUNT_SEGMENT) {
         if (!$service->getConfiguration()->getAcceptCountRequests()) {
             throw ODataException::createBadRequestError(Messages::configurationCountNotAccepted());
         }
         $request->queryType = QueryType::COUNT();
         // use of $count requires request DataServiceVersion
         // and MaxDataServiceVersion greater than or equal to 2.0
         $request->raiseResponseVersion(2, 0);
         $request->raiseMinVersionRequirement(2, 0);
     } else {
         if ($request->isNamedStream()) {
             $request->raiseMinVersionRequirement(3, 0);
         } else {
             if ($request->getTargetKind() == TargetKind::RESOURCE()) {
                 if (!$request->isLinkUri()) {
                     $resourceSetWrapper = $request->getTargetResourceSetWrapper();
                     //assert($resourceSetWrapper != null)
                     $hasNamedStream = $resourceSetWrapper->hasNamedStreams($service->getProvidersWrapper());
                     $hasBagProperty = $resourceSetWrapper->hasBagProperty($service->getProvidersWrapper());
                     if ($hasNamedStream || $hasBagProperty) {
                         $request->raiseResponseVersion(3, 0);
                     }
                 }
             } else {
                 if ($request->getTargetKind() == TargetKind::BAG()) {
                     $request->raiseResponseVersion(3, 0);
                 }
             }
         }
     }
     return $request;
 }
예제 #4
0
 /**
  * Gets the response format for the requested resource.
  * 
  * @param RequestDescription $request The request submitted by client and it's execution result.
  * @param UriProcessor $uriProcessor The reference to the UriProcessor.
  * @param IService $service Reference to the service implementation instance
  *
  * @return string the response content-type, a null value means the requested resource
  * is named stream and IDSSP2::getStreamContentType returned null
  * 
  * @throws ODataException, HttpHeaderFailure
  */
 public static function getResponseContentType(RequestDescription $request, UriProcessor $uriProcessor, IService $service)
 {
     // The Accept request-header field specifies media types which are acceptable for the response
     $host = $service->getHost();
     $requestAcceptText = $host->getRequestAccept();
     $requestVersion = $request->getResponseVersion();
     //if the $format header is present it overrides the accepts header
     $format = $host->getQueryStringItem(ODataConstants::HTTPQUERY_STRING_FORMAT);
     if (!is_null($format)) {
         //There's a strange edge case..if application/json is supplied and it's V3
         if ($format == MimeTypes::MIME_APPLICATION_JSON && $requestVersion == Version::v3()) {
             //then it's actual minimalmetadata
             //TODO: should this be done with the header text too?
             $format = MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META;
         }
         $requestAcceptText = ServiceHost::translateFormatToMime($requestVersion, $format);
     }
     //The response format can be dictated by the target resource kind. IE a $value will be different then expected
     //getTargetKind doesn't deal with link resources directly and this can change things
     $targetKind = $request->isLinkUri() ? TargetKind::LINK() : $request->getTargetKind();
     switch ($targetKind) {
         case TargetKind::METADATA():
             return HttpProcessUtility::selectMimeType($requestAcceptText, array(MimeTypes::MIME_APPLICATION_XML));
         case TargetKind::SERVICE_DIRECTORY():
             return HttpProcessUtility::selectMimeType($requestAcceptText, array(MimeTypes::MIME_APPLICATION_XML, MimeTypes::MIME_APPLICATION_ATOMSERVICE, MimeTypes::MIME_APPLICATION_JSON, MimeTypes::MIME_APPLICATION_JSON_FULL_META, MimeTypes::MIME_APPLICATION_JSON_NO_META, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META, MimeTypes::MIME_APPLICATION_JSON_VERBOSE));
         case TargetKind::PRIMITIVE_VALUE():
             $supportedResponseMimeTypes = array(MimeTypes::MIME_TEXTPLAIN);
             if ($request->getIdentifier() != '$count') {
                 $projectedProperty = $request->getProjectedProperty();
                 self::assert(!is_null($projectedProperty), '!is_null($projectedProperty)');
                 $type = $projectedProperty->getInstanceType();
                 self::assert(!is_null($type) && $type instanceof IType, '!is_null($type) && $type instanceof IType');
                 if ($type instanceof Binary) {
                     $supportedResponseMimeTypes = array(MimeTypes::MIME_APPLICATION_OCTETSTREAM);
                 }
             }
             return HttpProcessUtility::selectMimeType($requestAcceptText, $supportedResponseMimeTypes);
         case TargetKind::PRIMITIVE():
         case TargetKind::COMPLEX_OBJECT():
         case TargetKind::BAG():
         case TargetKind::LINK():
             return HttpProcessUtility::selectMimeType($requestAcceptText, array(MimeTypes::MIME_APPLICATION_XML, MimeTypes::MIME_TEXTXML, MimeTypes::MIME_APPLICATION_JSON, MimeTypes::MIME_APPLICATION_JSON_FULL_META, MimeTypes::MIME_APPLICATION_JSON_NO_META, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META, MimeTypes::MIME_APPLICATION_JSON_VERBOSE));
         case TargetKind::RESOURCE():
             return HttpProcessUtility::selectMimeType($requestAcceptText, array(MimeTypes::MIME_APPLICATION_ATOM, MimeTypes::MIME_APPLICATION_JSON, MimeTypes::MIME_APPLICATION_JSON_FULL_META, MimeTypes::MIME_APPLICATION_JSON_NO_META, MimeTypes::MIME_APPLICATION_JSON_MINIMAL_META, MimeTypes::MIME_APPLICATION_JSON_VERBOSE));
         case TargetKind::MEDIA_RESOURCE():
             if (!$request->isNamedStream() && !$request->getTargetResourceType()->isMediaLinkEntry()) {
                 throw ODataException::createBadRequestError(Messages::badRequestInvalidUriForMediaResource($host->getAbsoluteRequestUri()->getUrlAsString()));
             }
             $uriProcessor->execute();
             $request->setExecuted();
             // DSSW::getStreamContentType can throw error in 2 cases
             // 1. If the required stream implementation not found
             // 2. If IDSSP::getStreamContentType returns NULL for MLE
             $responseContentType = $service->getStreamProviderWrapper()->getStreamContentType($request->getTargetResult(), $request->getResourceStreamInfo());
             // Note StreamWrapper::getStreamContentType can return NULL if the requested named stream has not
             // yet been uploaded. But for an MLE if IDSSP::getStreamContentType returns NULL then StreamWrapper will throw error
             if (!is_null($responseContentType)) {
                 $responseContentType = HttpProcessUtility::selectMimeType($requestAcceptText, array($responseContentType));
             }
             return $responseContentType;
     }
     //If we got here, we just don't know what it is...
     throw new ODataException(Messages::unsupportedMediaType(), 415);
 }
예제 #5
0
 /**
  * To check if the resource path is a request for meida resource
  * 
  * @return boolean True if request is for media resource else false.
  */
 public function isMediaResource()
 {
     return $this->lastSegment->getTargetKind() == TargetKind::MEDIA_RESOURCE();
 }
예제 #6
0
 public function testCreateSegments_MLEAndNamedStream()
 {
     //Test MLE
     $segments = array("Employees('JKT')", '$value');
     $segmentDescriptors = SegmentParser::parseRequestUriSegments($segments, $this->providersWrapper);
     $this->assertEquals(count($segmentDescriptors), 2);
     $this->assertEquals($segmentDescriptors[0]->getIdentifier(), 'Employees');
     $this->assertEquals($segmentDescriptors[1]->getIdentifier(), '$value');
     $this->assertEquals($segmentDescriptors[0]->getTargetKind(), TargetKind::RESOURCE());
     $this->assertEquals($segmentDescriptors[1]->getTargetKind(), TargetKind::MEDIA_RESOURCE());
     $resourceType = $segmentDescriptors[0]->getTargetResourceType();
     $this->assertFalse(is_null($resourceType));
     $resourceType = $segmentDescriptors[1]->getTargetResourceType();
     $this->assertFalse(is_null($resourceType));
     $resourceSetWrapper = $segmentDescriptors[0]->getTargetResourceSetWrapper();
     $this->assertFalse(is_null($resourceSetWrapper));
     $resourceSetWrapper = $segmentDescriptors[1]->getTargetResourceSetWrapper();
     $this->assertTrue(is_null($resourceSetWrapper));
     $this->assertEquals($segmentDescriptors[0]->isSingleResult(), true);
     $this->assertEquals($segmentDescriptors[1]->isSingleResult(), true);
     $segments = array("Employees('JKT')", 'Manager', '$value');
     $segmentDescriptors = SegmentParser::parseRequestUriSegments($segments, $this->providersWrapper);
     $this->assertEquals(count($segmentDescriptors), 3);
     $this->assertEquals($segmentDescriptors[0]->getIdentifier(), 'Employees');
     $this->assertEquals($segmentDescriptors[1]->getIdentifier(), 'Manager');
     $this->assertEquals($segmentDescriptors[2]->getIdentifier(), '$value');
     $this->assertEquals($segmentDescriptors[0]->getTargetKind(), TargetKind::RESOURCE());
     $this->assertEquals($segmentDescriptors[1]->getTargetKind(), TargetKind::RESOURCE());
     $this->assertEquals($segmentDescriptors[2]->getTargetKind(), TargetKind::MEDIA_RESOURCE());
     $resourceType = $segmentDescriptors[0]->getTargetResourceType();
     $this->assertFalse(is_null($resourceType));
     $resourceType = $segmentDescriptors[1]->getTargetResourceType();
     $this->assertFalse(is_null($resourceType));
     $resourceType = $segmentDescriptors[2]->getTargetResourceType();
     $this->assertFalse(is_null($resourceType));
     $resourceSetWrapper = $segmentDescriptors[0]->getTargetResourceSetWrapper();
     $this->assertFalse(is_null($resourceSetWrapper));
     $resourceSetWrapper = $segmentDescriptors[1]->getTargetResourceSetWrapper();
     $this->assertFalse(is_null($resourceSetWrapper));
     $resourceSetWrapper = $segmentDescriptors[2]->getTargetResourceSetWrapper();
     $this->assertTrue(is_null($resourceSetWrapper));
     //Test Named Stream
     $segments = array("Employees('JKT')", 'TumbNail_48X48');
     $segmentDescriptors = SegmentParser::parseRequestUriSegments($segments, $this->providersWrapper);
     $this->assertEquals(count($segmentDescriptors), 2);
     $this->assertEquals($segmentDescriptors[0]->getIdentifier(), 'Employees');
     $this->assertEquals($segmentDescriptors[1]->getIdentifier(), 'TumbNail_48X48');
     $this->assertEquals($segmentDescriptors[0]->getTargetKind(), TargetKind::RESOURCE());
     $this->assertEquals($segmentDescriptors[1]->getTargetKind(), TargetKind::MEDIA_RESOURCE());
     $resourceType = $segmentDescriptors[0]->getTargetResourceType();
     $this->assertFalse(is_null($resourceType));
     $resourceType = $segmentDescriptors[1]->getTargetResourceType();
     $this->assertFalse(is_null($resourceType));
     $resourceSetWrapper = $segmentDescriptors[0]->getTargetResourceSetWrapper();
     $this->assertFalse(is_null($resourceSetWrapper));
     $resourceSetWrapper = $segmentDescriptors[1]->getTargetResourceSetWrapper();
     $this->assertTrue(is_null($resourceSetWrapper));
     //No more segments after namedstream or MLE
     $segments = array("Employees('JKT')", 'TumbNail_48X48', 'anything');
     try {
         SegmentParser::parseRequestUriSegments($segments, $this->providersWrapper);
         $this->fail('An expected ODataException for segments specifed after named stream has not been thrown');
     } catch (ODataException $exception) {
         $this->assertStringStartsWith('The request URI is not valid. The segment \'TumbNail_48X48\' must be the last segment in the', $exception->getMessage());
     }
 }
예제 #7
0
 /**
  * Execute the client submitted request against the data source.
  */
 public function execute()
 {
     $segments = $this->request->getSegments();
     foreach ($segments as $segment) {
         $requestTargetKind = $segment->getTargetKind();
         if ($segment->getTargetSource() == TargetSource::ENTITY_SET) {
             $this->handleSegmentTargetsToResourceSet($segment);
         } else {
             if ($requestTargetKind == TargetKind::RESOURCE()) {
                 if (is_null($segment->getPrevious()->getResult())) {
                     throw ODataException::createResourceNotFoundError($segment->getPrevious()->getIdentifier());
                 }
                 $this->_handleSegmentTargetsToRelatedResource($segment);
             } else {
                 if ($requestTargetKind == TargetKind::LINK()) {
                     $segment->setResult($segment->getPrevious()->getResult());
                 } else {
                     if ($segment->getIdentifier() == ODataConstants::URI_COUNT_SEGMENT) {
                         // we are done, $count will the last segment and
                         // taken care by _applyQueryOptions method
                         $segment->setResult($this->request->getCountValue());
                         break;
                     } else {
                         if ($requestTargetKind == TargetKind::MEDIA_RESOURCE()) {
                             if (is_null($segment->getPrevious()->getResult())) {
                                 throw ODataException::createResourceNotFoundError($segment->getPrevious()->getIdentifier());
                             }
                             // For MLE and Named Stream the result of last segment
                             // should be that of previous segment, this is required
                             // while retrieving content type or stream from IDSSP
                             $segment->setResult($segment->getPrevious()->getResult());
                             // we are done, as named stream property or $value on
                             // media resource will be the last segment
                             break;
                         }
                         $value = $segment->getPrevious()->getResult();
                         while (!is_null($segment)) {
                             //TODO: what exactly is this doing here?  Once a null's found it seems everything will be null
                             if (!is_null($value)) {
                                 $value = null;
                             } else {
                                 try {
                                     //see #88
                                     $property = new \ReflectionProperty($value, $segment->getIdentifier());
                                     $value = $property->getValue($value);
                                 } catch (\ReflectionException $reflectionException) {
                                     //throw ODataException::createInternalServerError(Messages::orderByParserFailedToAccessOrInitializeProperty($resourceProperty->getName(), $resourceType->getName()));
                                 }
                             }
                             $segment->setResult($value);
                             $segment = $segment->getNext();
                             if (!is_null($segment) && $segment->getIdentifier() == ODataConstants::URI_VALUE_SEGMENT) {
                                 $segment->setResult($value);
                                 $segment = $segment->getNext();
                             }
                         }
                         break;
                     }
                 }
             }
         }
         if (is_null($segment->getNext()) || $segment->getNext()->getIdentifier() == ODataConstants::URI_COUNT_SEGMENT) {
             $this->applyQueryOptions($segment);
         }
     }
     // Apply $select and $expand options to result set, this function will be always applied
     // irrespective of return value of IDSQP2::canApplyQueryOptions which means library will
     // not delegate $expand/$select operation to IDSQP2 implementation
     $this->handleExpansion();
 }
예제 #8
0
 public function __construct()
 {
     $this->_singleResult = false;
     $this->_targetKind = TargetKind::NOTHING();
     $this->_targetSource = TargetSource::NONE;
 }
예제 #9
0
 /**
  * Create SegmentDescriptor for the first segment
  * 
  * @param string $segmentIdentifier The identifier part of the first segment
  * @param string $keyPredicate The predicate part of the first segment if any else NULL
  * @param boolean $checkRights Whether to check the rights on this segment
  *
  * @return SegmentDescriptor Descriptor for the first segment
  * 
  * @throws ODataException Exception if any validation fails
  */
 private function _createFirstSegmentDescriptor($segmentIdentifier, $keyPredicate, $checkRights)
 {
     $descriptor = new SegmentDescriptor();
     $descriptor->setIdentifier($segmentIdentifier);
     if ($segmentIdentifier === ODataConstants::URI_METADATA_SEGMENT) {
         $this->_assertion(is_null($keyPredicate));
         $descriptor->setTargetKind(TargetKind::METADATA());
         return $descriptor;
     }
     if ($segmentIdentifier === ODataConstants::URI_BATCH_SEGMENT) {
         $this->_assertion(is_null($keyPredicate));
         $descriptor->setTargetKind(TargetKind::BATCH());
         return $descriptor;
     }
     if ($segmentIdentifier === ODataConstants::URI_COUNT_SEGMENT) {
         throw ODataException::createBadRequestError(Messages::segmentParserSegmentNotAllowedOnRoot(ODataConstants::URI_COUNT_SEGMENT));
     }
     if ($segmentIdentifier === ODataConstants::URI_LINK_SEGMENT) {
         throw ODataException::createBadRequestError(Messages::segmentParserSegmentNotAllowedOnRoot(ODataConstants::URI_LINK_SEGMENT));
     }
     $resourceSetWrapper = $this->providerWrapper->resolveResourceSet($segmentIdentifier);
     if ($resourceSetWrapper === null) {
         throw ODataException::createResourceNotFoundError($segmentIdentifier);
     }
     $descriptor->setTargetResourceSetWrapper($resourceSetWrapper);
     $descriptor->setTargetResourceType($resourceSetWrapper->getResourceType());
     $descriptor->setTargetSource(TargetSource::ENTITY_SET);
     $descriptor->setTargetKind(TargetKind::RESOURCE());
     if ($keyPredicate !== null) {
         $keyDescriptor = $this->_createKeyDescriptor($segmentIdentifier . '(' . $keyPredicate . ')', $resourceSetWrapper->getResourceType(), $keyPredicate);
         $descriptor->setKeyDescriptor($keyDescriptor);
         if (!$keyDescriptor->isEmpty()) {
             $descriptor->setSingleResult(true);
         }
     }
     if ($checkRights) {
         $resourceSetWrapper->checkResourceSetRightsForRead($descriptor->isSingleResult());
     }
     return $descriptor;
 }
예제 #10
0
 /**
  * Test with request uri where TargetKind is NONE. TargetKind will be
  * NONE for service directory, metadata and batch.
  */
 public function testUriProcessorWithRequestUriOfNoneTargetSourceKind()
 {
     //Request for service directory
     $hostInfo = array('AbsoluteRequestUri' => new Url('http://localhost:8083/NorthWindDataService.svc'), 'AbsoluteServiceUri' => new Url('http://localhost:8083/NorthWindDataService.svc'), 'QueryString' => null);
     $host = new ServiceHostTestFake($hostInfo);
     $dataService = new NorthWindService2();
     $dataService->setHost($host);
     $uriProcessor = $dataService->handleRequest();
     $requestDescription = $uriProcessor->getRequest();
     $this->assertEquals($requestDescription->getTargetSource(), TargetSource::NONE);
     $this->assertEquals($requestDescription->getTargetKind(), TargetKind::SERVICE_DIRECTORY());
     //Request for metadata
     $hostInfo = array('AbsoluteRequestUri' => new Url('http://localhost:8083/NorthWindDataService.svc/$metadata'), 'AbsoluteServiceUri' => new Url('http://localhost:8083/NorthWindDataService.svc'), 'QueryString' => null);
     $host = new ServiceHostTestFake($hostInfo);
     $dataService = new NorthWindService2();
     $dataService->setHost($host);
     $uriProcessor = $dataService->handleRequest();
     $requestDescription = $uriProcessor->getRequest();
     $this->assertEquals($requestDescription->getTargetSource(), TargetSource::NONE);
     $this->assertEquals($requestDescription->getTargetKind(), TargetKind::METADATA());
     //Request for batch
     $hostInfo = array('AbsoluteRequestUri' => new Url('http://localhost:8083/NorthWindDataService.svc/$batch'), 'AbsoluteServiceUri' => new Url('http://localhost:8083/NorthWindDataService.svc'), 'QueryString' => null);
     $host = new ServiceHostTestFake($hostInfo);
     $dataService = new NorthWindService2();
     $dataService->setHost($host);
     $uriProcessor = $dataService->handleRequest();
     $requestDescription = $uriProcessor->getRequest();
     $this->assertEquals($requestDescription->getTargetSource(), TargetSource::NONE);
     $this->assertEquals($requestDescription->getTargetKind(), TargetKind::BATCH());
 }
예제 #11
0
 /**
  * Process the $filter option in the request and update request decription.
  * 
  * @return void
  * 
  * @throws ODataException Throws error in the following cases:
  *                          (1) If $filter cannot be applied to the 
  *                              resource targeted by the request uri
  *                          (2) If any error occured while parsing and
  *                              translating the odata $filter expression
  *                              to expression tree
  *                          (3) If any error occured while generating
  *                              php expression from expression tree
  */
 private function _processFilter()
 {
     $filter = $this->service->getHost()->getQueryStringItem(ODataConstants::HTTPQUERY_STRING_FILTER);
     if (is_null($filter)) {
         return;
     }
     $kind = $this->request->getTargetKind();
     if (!($kind == TargetKind::RESOURCE() || $kind == TargetKind::COMPLEX_OBJECT() || $this->request->queryType == QueryType::COUNT())) {
         throw ODataException::createBadRequestError(Messages::queryProcessorQueryFilterOptionNotApplicable());
     }
     $resourceType = $this->request->getTargetResourceType();
     $expressionProvider = $this->service->getProvidersWrapper()->getExpressionProvider();
     $filterInfo = ExpressionParser2::parseExpression2($filter, $resourceType, $expressionProvider);
     $this->request->setFilterInfo($filterInfo);
 }