@Test public void dispatch() throws Exception { checkDispatch(ODataHttpMethod.GET, UriType.URI0, "readServiceDocument"); checkDispatch(ODataHttpMethod.GET, UriType.URI1, "readEntitySet"); checkDispatch(ODataHttpMethod.POST, UriType.URI1, "createEntity"); checkDispatch(ODataHttpMethod.GET, UriType.URI2, "readEntity"); checkDispatch(ODataHttpMethod.PUT, UriType.URI2, "updateEntity"); checkDispatch(ODataHttpMethod.DELETE, UriType.URI2, "deleteEntity"); checkDispatch(ODataHttpMethod.PATCH, UriType.URI2, "updateEntity"); checkDispatch(ODataHttpMethod.MERGE, UriType.URI2, "updateEntity"); checkDispatch(ODataHttpMethod.GET, UriType.URI3, "readEntityComplexProperty"); checkDispatch(ODataHttpMethod.PUT, UriType.URI3, "updateEntityComplexProperty"); checkDispatch(ODataHttpMethod.PATCH, UriType.URI3, "updateEntityComplexProperty"); checkDispatch(ODataHttpMethod.MERGE, UriType.URI3, "updateEntityComplexProperty"); checkDispatch(ODataHttpMethod.GET, UriType.URI4, "readEntitySimpleProperty"); checkDispatch(ODataHttpMethod.PUT, UriType.URI4, "updateEntitySimpleProperty"); checkDispatch(ODataHttpMethod.PATCH, UriType.URI4, "updateEntitySimpleProperty"); checkDispatch(ODataHttpMethod.MERGE, UriType.URI4, "updateEntitySimpleProperty"); checkDispatch(ODataHttpMethod.GET, UriType.URI4, true, "readEntitySimplePropertyValue"); checkDispatch(ODataHttpMethod.PUT, UriType.URI4, true, "updateEntitySimplePropertyValue"); checkDispatch(ODataHttpMethod.DELETE, UriType.URI4, true, "deleteEntitySimplePropertyValue"); checkDispatch(ODataHttpMethod.PATCH, UriType.URI4, true, "updateEntitySimplePropertyValue"); checkDispatch(ODataHttpMethod.MERGE, UriType.URI4, true, "updateEntitySimplePropertyValue"); checkDispatch(ODataHttpMethod.GET, UriType.URI5, "readEntitySimpleProperty"); checkDispatch(ODataHttpMethod.PUT, UriType.URI5, "updateEntitySimpleProperty"); checkDispatch(ODataHttpMethod.PATCH, UriType.URI5, "updateEntitySimpleProperty"); checkDispatch(ODataHttpMethod.MERGE, UriType.URI5, "updateEntitySimpleProperty"); checkDispatch(ODataHttpMethod.GET, UriType.URI5, true, "readEntitySimplePropertyValue"); checkDispatch(ODataHttpMethod.PUT, UriType.URI5, true, "updateEntitySimplePropertyValue"); checkDispatch(ODataHttpMethod.DELETE, UriType.URI5, true, "deleteEntitySimplePropertyValue"); checkDispatch(ODataHttpMethod.PATCH, UriType.URI5, true, "updateEntitySimplePropertyValue"); checkDispatch(ODataHttpMethod.MERGE, UriType.URI5, true, "updateEntitySimplePropertyValue"); checkDispatch(ODataHttpMethod.GET, UriType.URI6A, "readEntity"); checkDispatch(ODataHttpMethod.GET, UriType.URI6B, "readEntitySet"); checkDispatch(ODataHttpMethod.POST, UriType.URI6B, "createEntity"); checkDispatch(ODataHttpMethod.GET, UriType.URI7A, "readEntityLink"); checkDispatch(ODataHttpMethod.PUT, UriType.URI7A, "updateEntityLink"); checkDispatch(ODataHttpMethod.DELETE, UriType.URI7A, "deleteEntityLink"); checkDispatch(ODataHttpMethod.PATCH, UriType.URI7A, "updateEntityLink"); checkDispatch(ODataHttpMethod.MERGE, UriType.URI7A, "updateEntityLink"); checkDispatch(ODataHttpMethod.GET, UriType.URI7B, "readEntityLinks"); checkDispatch(ODataHttpMethod.POST, UriType.URI7B, "createEntityLink"); checkDispatch(ODataHttpMethod.GET, UriType.URI8, "readMetadata"); checkDispatch(ODataHttpMethod.POST, UriType.URI9, "executeBatch"); checkDispatch(ODataHttpMethod.GET, UriType.URI10, "executeFunctionImport"); checkDispatch(ODataHttpMethod.GET, UriType.URI11, "executeFunctionImport"); checkDispatch(ODataHttpMethod.GET, UriType.URI12, "executeFunctionImport"); checkDispatch(ODataHttpMethod.GET, UriType.URI13, "executeFunctionImport"); checkDispatch(ODataHttpMethod.GET, UriType.URI14, "executeFunctionImport"); checkDispatch(ODataHttpMethod.GET, UriType.URI14, true, "executeFunctionImportValue"); checkDispatch(ODataHttpMethod.GET, UriType.URI15, "countEntitySet"); checkDispatch(ODataHttpMethod.GET, UriType.URI16, "existsEntity"); checkDispatch(ODataHttpMethod.GET, UriType.URI17, "readEntityMedia"); checkDispatch(ODataHttpMethod.PUT, UriType.URI17, "updateEntityMedia"); checkDispatch(ODataHttpMethod.DELETE, UriType.URI17, "deleteEntityMedia"); checkDispatch(ODataHttpMethod.GET, UriType.URI50A, "existsEntityLink"); checkDispatch(ODataHttpMethod.GET, UriType.URI50B, "countEntityLinks"); }
public ODataResponse dispatch(final ODataHttpMethod method, final UriInfoImpl uriInfo, final InputStream content, final String requestContentType, final String contentType) throws ODataException { switch (uriInfo.getUriType()) { case URI0: if (method == ODataHttpMethod.GET) { return service.getServiceDocumentProcessor().readServiceDocument(uriInfo, contentType); } else { throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI1: case URI6B: switch (method) { case GET: return service.getEntitySetProcessor().readEntitySet(uriInfo, contentType); case POST: return service.getEntitySetProcessor().createEntity(uriInfo, content, requestContentType, contentType); default: throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI2: switch (method) { case GET: return service.getEntityProcessor().readEntity(uriInfo, contentType); case PUT: return service.getEntityProcessor().updateEntity(uriInfo, content, requestContentType, false, contentType); case PATCH: case MERGE: return service.getEntityProcessor().updateEntity(uriInfo, content, requestContentType, true, contentType); case DELETE: return service.getEntityProcessor().deleteEntity(uriInfo, contentType); default: throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI3: switch (method) { case GET: return service.getEntityComplexPropertyProcessor().readEntityComplexProperty(uriInfo, contentType); case PUT: return service.getEntityComplexPropertyProcessor().updateEntityComplexProperty(uriInfo, content, requestContentType, false, contentType); case PATCH: case MERGE: return service.getEntityComplexPropertyProcessor().updateEntityComplexProperty(uriInfo, content, requestContentType, true, contentType); default: throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI4: case URI5: switch (method) { case GET: if (uriInfo.isValue()) { return service.getEntitySimplePropertyValueProcessor().readEntitySimplePropertyValue(uriInfo, contentType); } else { return service.getEntitySimplePropertyProcessor().readEntitySimpleProperty(uriInfo, contentType); } case PUT: case PATCH: case MERGE: if (uriInfo.isValue()) { return service.getEntitySimplePropertyValueProcessor().updateEntitySimplePropertyValue(uriInfo, content, requestContentType, contentType); } else { return service.getEntitySimplePropertyProcessor().updateEntitySimpleProperty(uriInfo, content, requestContentType, contentType); } case DELETE: if (uriInfo.isValue()) { return service.getEntitySimplePropertyValueProcessor().deleteEntitySimplePropertyValue(uriInfo, contentType); } else { throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } default: throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI6A: switch (method) { case GET: return service.getEntityProcessor().readEntity(uriInfo, contentType); case PUT: case PATCH: case MERGE: case DELETE: throw new ODataBadRequestException(ODataBadRequestException.NOTSUPPORTED); default: throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI7A: switch (method) { case GET: return service.getEntityLinkProcessor().readEntityLink(uriInfo, contentType); case PUT: case PATCH: case MERGE: return service.getEntityLinkProcessor().updateEntityLink(uriInfo, content, requestContentType, contentType); case DELETE: return service.getEntityLinkProcessor().deleteEntityLink(uriInfo, contentType); default: throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI7B: switch (method) { case GET: return service.getEntityLinksProcessor().readEntityLinks(uriInfo, contentType); case POST: return service.getEntityLinksProcessor().createEntityLink(uriInfo, content, requestContentType, contentType); default: throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI8: if (method == ODataHttpMethod.GET) { return service.getMetadataProcessor().readMetadata(uriInfo, contentType); } else { throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI9: if (method == ODataHttpMethod.POST) { BatchHandler handler = new BatchHandlerImpl(serviceFactory, service); return service.getBatchProcessor().executeBatch(handler, requestContentType, content); } else { throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI10: case URI11: case URI12: case URI13: return service.getFunctionImportProcessor().executeFunctionImport(uriInfo, contentType); case URI14: if (uriInfo.isValue()) { return service.getFunctionImportValueProcessor().executeFunctionImportValue(uriInfo, contentType); } else { return service.getFunctionImportProcessor().executeFunctionImport(uriInfo, contentType); } case URI15: if (method == ODataHttpMethod.GET) { return service.getEntitySetProcessor().countEntitySet(uriInfo, contentType); } else { throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI16: if (method == ODataHttpMethod.GET) { return service.getEntityProcessor().existsEntity(uriInfo, contentType); } else { throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI17: switch (method) { case GET: return service.getEntityMediaProcessor().readEntityMedia(uriInfo, contentType); case PUT: return service.getEntityMediaProcessor().updateEntityMedia(uriInfo, content, requestContentType, contentType); case DELETE: return service.getEntityMediaProcessor().deleteEntityMedia(uriInfo, contentType); default: throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI50A: if (method == ODataHttpMethod.GET) { return service.getEntityLinkProcessor().existsEntityLink(uriInfo, contentType); } else { throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI50B: if (method == ODataHttpMethod.GET) { return service.getEntityLinksProcessor().countEntityLinks(uriInfo, contentType); } else { throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } default: throw new ODataRuntimeException("Unknown or not implemented URI type: " + uriInfo.getUriType()); } }
Dispatcher { public ODataResponse dispatch(final ODataHttpMethod method, final UriInfoImpl uriInfo, final InputStream content, final String requestContentType, final String contentType) throws ODataException { switch (uriInfo.getUriType()) { case URI0: if (method == ODataHttpMethod.GET) { return service.getServiceDocumentProcessor().readServiceDocument(uriInfo, contentType); } else { throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI1: case URI6B: switch (method) { case GET: return service.getEntitySetProcessor().readEntitySet(uriInfo, contentType); case POST: return service.getEntitySetProcessor().createEntity(uriInfo, content, requestContentType, contentType); default: throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI2: switch (method) { case GET: return service.getEntityProcessor().readEntity(uriInfo, contentType); case PUT: return service.getEntityProcessor().updateEntity(uriInfo, content, requestContentType, false, contentType); case PATCH: case MERGE: return service.getEntityProcessor().updateEntity(uriInfo, content, requestContentType, true, contentType); case DELETE: return service.getEntityProcessor().deleteEntity(uriInfo, contentType); default: throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI3: switch (method) { case GET: return service.getEntityComplexPropertyProcessor().readEntityComplexProperty(uriInfo, contentType); case PUT: return service.getEntityComplexPropertyProcessor().updateEntityComplexProperty(uriInfo, content, requestContentType, false, contentType); case PATCH: case MERGE: return service.getEntityComplexPropertyProcessor().updateEntityComplexProperty(uriInfo, content, requestContentType, true, contentType); default: throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI4: case URI5: switch (method) { case GET: if (uriInfo.isValue()) { return service.getEntitySimplePropertyValueProcessor().readEntitySimplePropertyValue(uriInfo, contentType); } else { return service.getEntitySimplePropertyProcessor().readEntitySimpleProperty(uriInfo, contentType); } case PUT: case PATCH: case MERGE: if (uriInfo.isValue()) { return service.getEntitySimplePropertyValueProcessor().updateEntitySimplePropertyValue(uriInfo, content, requestContentType, contentType); } else { return service.getEntitySimplePropertyProcessor().updateEntitySimpleProperty(uriInfo, content, requestContentType, contentType); } case DELETE: if (uriInfo.isValue()) { return service.getEntitySimplePropertyValueProcessor().deleteEntitySimplePropertyValue(uriInfo, contentType); } else { throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } default: throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI6A: switch (method) { case GET: return service.getEntityProcessor().readEntity(uriInfo, contentType); case PUT: case PATCH: case MERGE: case DELETE: throw new ODataBadRequestException(ODataBadRequestException.NOTSUPPORTED); default: throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI7A: switch (method) { case GET: return service.getEntityLinkProcessor().readEntityLink(uriInfo, contentType); case PUT: case PATCH: case MERGE: return service.getEntityLinkProcessor().updateEntityLink(uriInfo, content, requestContentType, contentType); case DELETE: return service.getEntityLinkProcessor().deleteEntityLink(uriInfo, contentType); default: throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI7B: switch (method) { case GET: return service.getEntityLinksProcessor().readEntityLinks(uriInfo, contentType); case POST: return service.getEntityLinksProcessor().createEntityLink(uriInfo, content, requestContentType, contentType); default: throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI8: if (method == ODataHttpMethod.GET) { return service.getMetadataProcessor().readMetadata(uriInfo, contentType); } else { throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI9: if (method == ODataHttpMethod.POST) { BatchHandler handler = new BatchHandlerImpl(serviceFactory, service); return service.getBatchProcessor().executeBatch(handler, requestContentType, content); } else { throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI10: case URI11: case URI12: case URI13: return service.getFunctionImportProcessor().executeFunctionImport(uriInfo, contentType); case URI14: if (uriInfo.isValue()) { return service.getFunctionImportValueProcessor().executeFunctionImportValue(uriInfo, contentType); } else { return service.getFunctionImportProcessor().executeFunctionImport(uriInfo, contentType); } case URI15: if (method == ODataHttpMethod.GET) { return service.getEntitySetProcessor().countEntitySet(uriInfo, contentType); } else { throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI16: if (method == ODataHttpMethod.GET) { return service.getEntityProcessor().existsEntity(uriInfo, contentType); } else { throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI17: switch (method) { case GET: return service.getEntityMediaProcessor().readEntityMedia(uriInfo, contentType); case PUT: return service.getEntityMediaProcessor().updateEntityMedia(uriInfo, content, requestContentType, contentType); case DELETE: return service.getEntityMediaProcessor().deleteEntityMedia(uriInfo, contentType); default: throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI50A: if (method == ODataHttpMethod.GET) { return service.getEntityLinkProcessor().existsEntityLink(uriInfo, contentType); } else { throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI50B: if (method == ODataHttpMethod.GET) { return service.getEntityLinksProcessor().countEntityLinks(uriInfo, contentType); } else { throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } default: throw new ODataRuntimeException("Unknown or not implemented URI type: " + uriInfo.getUriType()); } } }
Dispatcher { public ODataResponse dispatch(final ODataHttpMethod method, final UriInfoImpl uriInfo, final InputStream content, final String requestContentType, final String contentType) throws ODataException { switch (uriInfo.getUriType()) { case URI0: if (method == ODataHttpMethod.GET) { return service.getServiceDocumentProcessor().readServiceDocument(uriInfo, contentType); } else { throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI1: case URI6B: switch (method) { case GET: return service.getEntitySetProcessor().readEntitySet(uriInfo, contentType); case POST: return service.getEntitySetProcessor().createEntity(uriInfo, content, requestContentType, contentType); default: throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI2: switch (method) { case GET: return service.getEntityProcessor().readEntity(uriInfo, contentType); case PUT: return service.getEntityProcessor().updateEntity(uriInfo, content, requestContentType, false, contentType); case PATCH: case MERGE: return service.getEntityProcessor().updateEntity(uriInfo, content, requestContentType, true, contentType); case DELETE: return service.getEntityProcessor().deleteEntity(uriInfo, contentType); default: throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI3: switch (method) { case GET: return service.getEntityComplexPropertyProcessor().readEntityComplexProperty(uriInfo, contentType); case PUT: return service.getEntityComplexPropertyProcessor().updateEntityComplexProperty(uriInfo, content, requestContentType, false, contentType); case PATCH: case MERGE: return service.getEntityComplexPropertyProcessor().updateEntityComplexProperty(uriInfo, content, requestContentType, true, contentType); default: throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI4: case URI5: switch (method) { case GET: if (uriInfo.isValue()) { return service.getEntitySimplePropertyValueProcessor().readEntitySimplePropertyValue(uriInfo, contentType); } else { return service.getEntitySimplePropertyProcessor().readEntitySimpleProperty(uriInfo, contentType); } case PUT: case PATCH: case MERGE: if (uriInfo.isValue()) { return service.getEntitySimplePropertyValueProcessor().updateEntitySimplePropertyValue(uriInfo, content, requestContentType, contentType); } else { return service.getEntitySimplePropertyProcessor().updateEntitySimpleProperty(uriInfo, content, requestContentType, contentType); } case DELETE: if (uriInfo.isValue()) { return service.getEntitySimplePropertyValueProcessor().deleteEntitySimplePropertyValue(uriInfo, contentType); } else { throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } default: throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI6A: switch (method) { case GET: return service.getEntityProcessor().readEntity(uriInfo, contentType); case PUT: case PATCH: case MERGE: case DELETE: throw new ODataBadRequestException(ODataBadRequestException.NOTSUPPORTED); default: throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI7A: switch (method) { case GET: return service.getEntityLinkProcessor().readEntityLink(uriInfo, contentType); case PUT: case PATCH: case MERGE: return service.getEntityLinkProcessor().updateEntityLink(uriInfo, content, requestContentType, contentType); case DELETE: return service.getEntityLinkProcessor().deleteEntityLink(uriInfo, contentType); default: throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI7B: switch (method) { case GET: return service.getEntityLinksProcessor().readEntityLinks(uriInfo, contentType); case POST: return service.getEntityLinksProcessor().createEntityLink(uriInfo, content, requestContentType, contentType); default: throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI8: if (method == ODataHttpMethod.GET) { return service.getMetadataProcessor().readMetadata(uriInfo, contentType); } else { throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI9: if (method == ODataHttpMethod.POST) { BatchHandler handler = new BatchHandlerImpl(serviceFactory, service); return service.getBatchProcessor().executeBatch(handler, requestContentType, content); } else { throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI10: case URI11: case URI12: case URI13: return service.getFunctionImportProcessor().executeFunctionImport(uriInfo, contentType); case URI14: if (uriInfo.isValue()) { return service.getFunctionImportValueProcessor().executeFunctionImportValue(uriInfo, contentType); } else { return service.getFunctionImportProcessor().executeFunctionImport(uriInfo, contentType); } case URI15: if (method == ODataHttpMethod.GET) { return service.getEntitySetProcessor().countEntitySet(uriInfo, contentType); } else { throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI16: if (method == ODataHttpMethod.GET) { return service.getEntityProcessor().existsEntity(uriInfo, contentType); } else { throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI17: switch (method) { case GET: return service.getEntityMediaProcessor().readEntityMedia(uriInfo, contentType); case PUT: return service.getEntityMediaProcessor().updateEntityMedia(uriInfo, content, requestContentType, contentType); case DELETE: return service.getEntityMediaProcessor().deleteEntityMedia(uriInfo, contentType); default: throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI50A: if (method == ODataHttpMethod.GET) { return service.getEntityLinkProcessor().existsEntityLink(uriInfo, contentType); } else { throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI50B: if (method == ODataHttpMethod.GET) { return service.getEntityLinksProcessor().countEntityLinks(uriInfo, contentType); } else { throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } default: throw new ODataRuntimeException("Unknown or not implemented URI type: " + uriInfo.getUriType()); } } Dispatcher(final ODataServiceFactory serviceFactory, final ODataService service); }
Dispatcher { public ODataResponse dispatch(final ODataHttpMethod method, final UriInfoImpl uriInfo, final InputStream content, final String requestContentType, final String contentType) throws ODataException { switch (uriInfo.getUriType()) { case URI0: if (method == ODataHttpMethod.GET) { return service.getServiceDocumentProcessor().readServiceDocument(uriInfo, contentType); } else { throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI1: case URI6B: switch (method) { case GET: return service.getEntitySetProcessor().readEntitySet(uriInfo, contentType); case POST: return service.getEntitySetProcessor().createEntity(uriInfo, content, requestContentType, contentType); default: throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI2: switch (method) { case GET: return service.getEntityProcessor().readEntity(uriInfo, contentType); case PUT: return service.getEntityProcessor().updateEntity(uriInfo, content, requestContentType, false, contentType); case PATCH: case MERGE: return service.getEntityProcessor().updateEntity(uriInfo, content, requestContentType, true, contentType); case DELETE: return service.getEntityProcessor().deleteEntity(uriInfo, contentType); default: throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI3: switch (method) { case GET: return service.getEntityComplexPropertyProcessor().readEntityComplexProperty(uriInfo, contentType); case PUT: return service.getEntityComplexPropertyProcessor().updateEntityComplexProperty(uriInfo, content, requestContentType, false, contentType); case PATCH: case MERGE: return service.getEntityComplexPropertyProcessor().updateEntityComplexProperty(uriInfo, content, requestContentType, true, contentType); default: throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI4: case URI5: switch (method) { case GET: if (uriInfo.isValue()) { return service.getEntitySimplePropertyValueProcessor().readEntitySimplePropertyValue(uriInfo, contentType); } else { return service.getEntitySimplePropertyProcessor().readEntitySimpleProperty(uriInfo, contentType); } case PUT: case PATCH: case MERGE: if (uriInfo.isValue()) { return service.getEntitySimplePropertyValueProcessor().updateEntitySimplePropertyValue(uriInfo, content, requestContentType, contentType); } else { return service.getEntitySimplePropertyProcessor().updateEntitySimpleProperty(uriInfo, content, requestContentType, contentType); } case DELETE: if (uriInfo.isValue()) { return service.getEntitySimplePropertyValueProcessor().deleteEntitySimplePropertyValue(uriInfo, contentType); } else { throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } default: throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI6A: switch (method) { case GET: return service.getEntityProcessor().readEntity(uriInfo, contentType); case PUT: case PATCH: case MERGE: case DELETE: throw new ODataBadRequestException(ODataBadRequestException.NOTSUPPORTED); default: throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI7A: switch (method) { case GET: return service.getEntityLinkProcessor().readEntityLink(uriInfo, contentType); case PUT: case PATCH: case MERGE: return service.getEntityLinkProcessor().updateEntityLink(uriInfo, content, requestContentType, contentType); case DELETE: return service.getEntityLinkProcessor().deleteEntityLink(uriInfo, contentType); default: throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI7B: switch (method) { case GET: return service.getEntityLinksProcessor().readEntityLinks(uriInfo, contentType); case POST: return service.getEntityLinksProcessor().createEntityLink(uriInfo, content, requestContentType, contentType); default: throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI8: if (method == ODataHttpMethod.GET) { return service.getMetadataProcessor().readMetadata(uriInfo, contentType); } else { throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI9: if (method == ODataHttpMethod.POST) { BatchHandler handler = new BatchHandlerImpl(serviceFactory, service); return service.getBatchProcessor().executeBatch(handler, requestContentType, content); } else { throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI10: case URI11: case URI12: case URI13: return service.getFunctionImportProcessor().executeFunctionImport(uriInfo, contentType); case URI14: if (uriInfo.isValue()) { return service.getFunctionImportValueProcessor().executeFunctionImportValue(uriInfo, contentType); } else { return service.getFunctionImportProcessor().executeFunctionImport(uriInfo, contentType); } case URI15: if (method == ODataHttpMethod.GET) { return service.getEntitySetProcessor().countEntitySet(uriInfo, contentType); } else { throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI16: if (method == ODataHttpMethod.GET) { return service.getEntityProcessor().existsEntity(uriInfo, contentType); } else { throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI17: switch (method) { case GET: return service.getEntityMediaProcessor().readEntityMedia(uriInfo, contentType); case PUT: return service.getEntityMediaProcessor().updateEntityMedia(uriInfo, content, requestContentType, contentType); case DELETE: return service.getEntityMediaProcessor().deleteEntityMedia(uriInfo, contentType); default: throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI50A: if (method == ODataHttpMethod.GET) { return service.getEntityLinkProcessor().existsEntityLink(uriInfo, contentType); } else { throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI50B: if (method == ODataHttpMethod.GET) { return service.getEntityLinksProcessor().countEntityLinks(uriInfo, contentType); } else { throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } default: throw new ODataRuntimeException("Unknown or not implemented URI type: " + uriInfo.getUriType()); } } Dispatcher(final ODataServiceFactory serviceFactory, final ODataService service); ODataResponse dispatch(final ODataHttpMethod method, final UriInfoImpl uriInfo, final InputStream content,
      final String requestContentType, final String contentType); }
Dispatcher { public ODataResponse dispatch(final ODataHttpMethod method, final UriInfoImpl uriInfo, final InputStream content, final String requestContentType, final String contentType) throws ODataException { switch (uriInfo.getUriType()) { case URI0: if (method == ODataHttpMethod.GET) { return service.getServiceDocumentProcessor().readServiceDocument(uriInfo, contentType); } else { throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI1: case URI6B: switch (method) { case GET: return service.getEntitySetProcessor().readEntitySet(uriInfo, contentType); case POST: return service.getEntitySetProcessor().createEntity(uriInfo, content, requestContentType, contentType); default: throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI2: switch (method) { case GET: return service.getEntityProcessor().readEntity(uriInfo, contentType); case PUT: return service.getEntityProcessor().updateEntity(uriInfo, content, requestContentType, false, contentType); case PATCH: case MERGE: return service.getEntityProcessor().updateEntity(uriInfo, content, requestContentType, true, contentType); case DELETE: return service.getEntityProcessor().deleteEntity(uriInfo, contentType); default: throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI3: switch (method) { case GET: return service.getEntityComplexPropertyProcessor().readEntityComplexProperty(uriInfo, contentType); case PUT: return service.getEntityComplexPropertyProcessor().updateEntityComplexProperty(uriInfo, content, requestContentType, false, contentType); case PATCH: case MERGE: return service.getEntityComplexPropertyProcessor().updateEntityComplexProperty(uriInfo, content, requestContentType, true, contentType); default: throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI4: case URI5: switch (method) { case GET: if (uriInfo.isValue()) { return service.getEntitySimplePropertyValueProcessor().readEntitySimplePropertyValue(uriInfo, contentType); } else { return service.getEntitySimplePropertyProcessor().readEntitySimpleProperty(uriInfo, contentType); } case PUT: case PATCH: case MERGE: if (uriInfo.isValue()) { return service.getEntitySimplePropertyValueProcessor().updateEntitySimplePropertyValue(uriInfo, content, requestContentType, contentType); } else { return service.getEntitySimplePropertyProcessor().updateEntitySimpleProperty(uriInfo, content, requestContentType, contentType); } case DELETE: if (uriInfo.isValue()) { return service.getEntitySimplePropertyValueProcessor().deleteEntitySimplePropertyValue(uriInfo, contentType); } else { throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } default: throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI6A: switch (method) { case GET: return service.getEntityProcessor().readEntity(uriInfo, contentType); case PUT: case PATCH: case MERGE: case DELETE: throw new ODataBadRequestException(ODataBadRequestException.NOTSUPPORTED); default: throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI7A: switch (method) { case GET: return service.getEntityLinkProcessor().readEntityLink(uriInfo, contentType); case PUT: case PATCH: case MERGE: return service.getEntityLinkProcessor().updateEntityLink(uriInfo, content, requestContentType, contentType); case DELETE: return service.getEntityLinkProcessor().deleteEntityLink(uriInfo, contentType); default: throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI7B: switch (method) { case GET: return service.getEntityLinksProcessor().readEntityLinks(uriInfo, contentType); case POST: return service.getEntityLinksProcessor().createEntityLink(uriInfo, content, requestContentType, contentType); default: throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI8: if (method == ODataHttpMethod.GET) { return service.getMetadataProcessor().readMetadata(uriInfo, contentType); } else { throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI9: if (method == ODataHttpMethod.POST) { BatchHandler handler = new BatchHandlerImpl(serviceFactory, service); return service.getBatchProcessor().executeBatch(handler, requestContentType, content); } else { throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI10: case URI11: case URI12: case URI13: return service.getFunctionImportProcessor().executeFunctionImport(uriInfo, contentType); case URI14: if (uriInfo.isValue()) { return service.getFunctionImportValueProcessor().executeFunctionImportValue(uriInfo, contentType); } else { return service.getFunctionImportProcessor().executeFunctionImport(uriInfo, contentType); } case URI15: if (method == ODataHttpMethod.GET) { return service.getEntitySetProcessor().countEntitySet(uriInfo, contentType); } else { throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI16: if (method == ODataHttpMethod.GET) { return service.getEntityProcessor().existsEntity(uriInfo, contentType); } else { throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI17: switch (method) { case GET: return service.getEntityMediaProcessor().readEntityMedia(uriInfo, contentType); case PUT: return service.getEntityMediaProcessor().updateEntityMedia(uriInfo, content, requestContentType, contentType); case DELETE: return service.getEntityMediaProcessor().deleteEntityMedia(uriInfo, contentType); default: throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI50A: if (method == ODataHttpMethod.GET) { return service.getEntityLinkProcessor().existsEntityLink(uriInfo, contentType); } else { throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } case URI50B: if (method == ODataHttpMethod.GET) { return service.getEntityLinksProcessor().countEntityLinks(uriInfo, contentType); } else { throw new ODataMethodNotAllowedException(ODataMethodNotAllowedException.DISPATCH); } default: throw new ODataRuntimeException("Unknown or not implemented URI type: " + uriInfo.getUriType()); } } Dispatcher(final ODataServiceFactory serviceFactory, final ODataService service); ODataResponse dispatch(final ODataHttpMethod method, final UriInfoImpl uriInfo, final InputStream content,
      final String requestContentType, final String contentType);  }