示例#1
0
 @POST
 @Consumes({MediaType.APPLICATION_JSON})
 @Produces({MediaType.APPLICATION_JSON})
 public Response executeStatementsInNewTransaction(final InputStream input) {
   try {
     TransactionHandle transactionHandle = facade.newTransactionHandle(uriScheme);
     return createdResponse(transactionHandle, executeStatements(input, transactionHandle));
   } catch (TransactionLifecycleException e) {
     return invalidTransaction(e);
   }
 }
示例#2
0
 @DELETE
 @Path("/{id}")
 @Consumes({MediaType.APPLICATION_JSON})
 public Response rollbackTransaction(@PathParam("id") final long id) {
   final TransactionHandle transactionHandle;
   try {
     transactionHandle = facade.terminate(id);
   } catch (TransactionLifecycleException e) {
     return invalidTransaction(e);
   }
   return okResponse(rollback(transactionHandle));
 }
示例#3
0
 @POST
 @Path("/{id}/commit")
 @Consumes({MediaType.APPLICATION_JSON})
 @Produces({MediaType.APPLICATION_JSON})
 public Response commitTransaction(@PathParam("id") final long id, final InputStream input) {
   final TransactionHandle transactionHandle;
   try {
     transactionHandle = facade.findTransactionHandle(id);
   } catch (TransactionLifecycleException e) {
     return invalidTransaction(e);
   }
   return okResponse(executeStatementsAndCommit(input, transactionHandle, false));
 }
示例#4
0
 @POST
 @Path("/commit")
 @Consumes({MediaType.APPLICATION_JSON})
 @Produces({MediaType.APPLICATION_JSON})
 public Response commitNewTransaction(final InputStream input) {
   final TransactionHandle transactionHandle;
   try {
     transactionHandle = facade.newTransactionHandle(uriScheme);
   } catch (TransactionLifecycleException e) {
     return invalidTransaction(e);
   }
   final StreamingOutput streamingResults =
       executeStatementsAndCommit(input, transactionHandle, true);
   return okResponse(streamingResults);
 }