private Response finalizeTransaction(@PathParam("path") final String externalPath, final String username, final boolean commit) { final String path = toPath(translator(), externalPath); if (!path.equals("/")) { return status(BAD_REQUEST).build(); } if (!session.isBatchSession()) { LOGGER.debug("cannot finalize an empty tx id {} at path {}", session.getId(), path); return status(BAD_REQUEST).build(); } if (commit) { LOGGER.debug("commiting transaction {} at path {}", session.getId(), path); batchService.commit(session.getId(), username); } else { LOGGER.debug("rolling back transaction {} at path {}", session.getId(), path); batchService.abort(session.getId(), username); } return noContent().build(); } }
public Response createTransaction(@PathParam("path") final String externalPath) throws URISyntaxException { if (batchService.exists(session.getId(), getUserPrincipal())) { LOGGER.debug("renewing transaction {}", session.getId()); batchService.refresh(session.getId(), getUserPrincipal()); final Response.ResponseBuilder res = noContent(); session.getFedoraSession().getExpires().ifPresent(expires -> { LOGGER.info("Created transaction '{}'", session.getId()); new URI(translator().toDomain("/tx:" + session.getId()).toString())); session.getFedoraSession().getExpires().ifPresent(expires -> { res.expires(from(expires));