Class JPAODataBatchProcessor

java.lang.Object
com.sap.olingo.jpa.processor.core.api.JPAODataBatchProcessor
All Implemented Interfaces:
org.apache.olingo.server.api.processor.BatchProcessor, org.apache.olingo.server.api.processor.Processor

public final class JPAODataBatchProcessor extends Object implements org.apache.olingo.server.api.processor.BatchProcessor
Author:
Oliver Grande
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    init​(org.apache.olingo.server.api.OData odata, org.apache.olingo.server.api.ServiceMetadata serviceMetadata)
     
    void
    processBatch​(org.apache.olingo.server.api.batch.BatchFacade facade, org.apache.olingo.server.api.ODataRequest request, org.apache.olingo.server.api.ODataResponse response)
     
    org.apache.olingo.server.api.deserializer.batch.ODataResponsePart
    processChangeSet​(org.apache.olingo.server.api.batch.BatchFacade facade, List<org.apache.olingo.server.api.ODataRequest> requests)
    Processing one change set of a $batch request.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • init

      public void init(org.apache.olingo.server.api.OData odata, org.apache.olingo.server.api.ServiceMetadata serviceMetadata)
      Specified by:
      init in interface org.apache.olingo.server.api.processor.Processor
    • processBatch

      public void processBatch(org.apache.olingo.server.api.batch.BatchFacade facade, org.apache.olingo.server.api.ODataRequest request, org.apache.olingo.server.api.ODataResponse response) throws org.apache.olingo.server.api.ODataApplicationException, org.apache.olingo.server.api.ODataLibraryException
      Specified by:
      processBatch in interface org.apache.olingo.server.api.processor.BatchProcessor
      Throws:
      org.apache.olingo.server.api.ODataApplicationException
      org.apache.olingo.server.api.ODataLibraryException
    • processChangeSet

      public org.apache.olingo.server.api.deserializer.batch.ODataResponsePart processChangeSet(org.apache.olingo.server.api.batch.BatchFacade facade, List<org.apache.olingo.server.api.ODataRequest> requests) throws org.apache.olingo.server.api.ODataApplicationException, org.apache.olingo.server.api.ODataLibraryException
      Processing one change set of a $batch request.

      OData Version 4.0 Part 1: Protocol Plus Errata 02 11.7.4 Responding to a Batch Request states:
      All operations in a change set represent a single change unit so a service MUST successfully process and apply all the requests in the change set or else apply none of them. It is up to the service implementation to define rollback semantics to undo any requests within a change set that may have been applied before another request in that same change set failed and thereby apply this all-or-nothing requirement. The service MAY execute the requests within a change set in any order and MAY return the responses to the individual requests in any order. The service MUST include the Content-ID header in each response with the same value that the client specified in the corresponding request, so clients can correlate requests and responses.

      This requires that the batch processor can create transactions. To do so it takes an instance of JPAODataTransactionFactory from the request context and requests a new transaction. In case this is not possible a exception with http status code 501 Not Implemented will be raised.

      Specified by:
      processChangeSet in interface org.apache.olingo.server.api.processor.BatchProcessor
      Throws:
      org.apache.olingo.server.api.ODataApplicationException
      org.apache.olingo.server.api.ODataLibraryException