Java Code Examples for org.apache.olingo.odata2.api.ep.EntityProvider#writeBatchResponse()

The following examples show how to use org.apache.olingo.odata2.api.ep.EntityProvider#writeBatchResponse() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ODataJPADefaultProcessor.java    From olingo-odata2 with Apache License 2.0 6 votes vote down vote up
@Override
public ODataResponse executeBatch(final BatchHandler handler, final String contentType, final InputStream content)
    throws ODataException {
  try {
    oDataJPAContext.setODataContext(getContext());

    ODataResponse batchResponse;
    List<BatchResponsePart> batchResponseParts = new ArrayList<BatchResponsePart>();
    PathInfo pathInfo = getContext().getPathInfo();
    EntityProviderBatchProperties batchProperties = EntityProviderBatchProperties.init().pathInfo(pathInfo).build();
    List<BatchRequestPart> batchParts = EntityProvider.parseBatchRequest(contentType, content, batchProperties);

    for (BatchRequestPart batchPart : batchParts) {
      batchResponseParts.add(handler.handleBatchPart(batchPart));
    }
    batchResponse = EntityProvider.writeBatchResponse(batchResponseParts);
    return batchResponse;
  } finally {
    close(true);
  }
}
 
Example 2
Source File: ListsProcessor.java    From olingo-odata2 with Apache License 2.0 5 votes vote down vote up
@Override
public ODataResponse executeBatch(final BatchHandler handler, final String contentType, final InputStream content)
    throws ODataException {
  ODataResponse batchResponse;
  List<BatchResponsePart> batchResponseParts = new ArrayList<BatchResponsePart>();
  PathInfo pathInfo = getContext().getPathInfo();
  EntityProviderBatchProperties batchProperties = EntityProviderBatchProperties.init().pathInfo(pathInfo).build();
  List<BatchRequestPart> batchParts = EntityProvider.parseBatchRequest(contentType, content, batchProperties);
  for (BatchRequestPart batchPart : batchParts) {
    batchResponseParts.add(handler.handleBatchPart(batchPart));
  }
  batchResponse = EntityProvider.writeBatchResponse(batchResponseParts);
  return batchResponse;
}
 
Example 3
Source File: ListsProcessor.java    From olingo-odata2 with Apache License 2.0 5 votes vote down vote up
@Override
public ODataResponse executeBatch(final BatchHandler handler, final String contentType, final InputStream content)
    throws ODataException {
  ODataResponse batchResponse;
  List<BatchResponsePart> batchResponseParts = new ArrayList<BatchResponsePart>();
  PathInfo pathInfo = getContext().getPathInfo();
  EntityProviderBatchProperties batchProperties = EntityProviderBatchProperties.init().pathInfo(pathInfo).build();
  List<BatchRequestPart> batchParts = EntityProvider.parseBatchRequest(contentType, content, batchProperties);
  for (BatchRequestPart batchPart : batchParts) {
    batchResponseParts.add(handler.handleBatchPart(batchPart));
  }
  batchResponse = EntityProvider.writeBatchResponse(batchResponseParts);
  return batchResponse;
}