@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); } }
@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)); }
@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)); }
@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); }