/** * Commit a non-batch session */ public void commit() { if (!isBatchSession()) { session.commit(); } }
/** * Expire a non-batch session */ public void expire() { if (!isBatchSession()) { session.expire(); } }
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(); } }
@Override protected void addResourceHttpHeaders(final FedoraResource resource) { super.addResourceHttpHeaders(resource); if (session.isBatchSession()) { final String canonical = translator().reverse() .convert(resource) .toString() .replaceFirst("/tx:[^/]+", ""); servletResponse.addHeader(LINK, "<" + canonical + ">;rel=\"canonical\""); } addExternalContentHeaders(resource); }
/** * Create a new identifier converter within the given session with the given URI template * @param session the session * @param uriBuilder the uri builder */ public HttpResourceConverter(final HttpSession session, final UriBuilder uriBuilder) { this.session = session.getFedoraSession(); this.uriBuilder = uriBuilder; this.batch = session.isBatchSession(); this.uriTemplate = new UriTemplate(uriBuilder.toTemplate()); resetTranslationChain(); }
final boolean cacheControl) { if (session.isBatchSession()) {
final HttpSession session) { if (session.isBatchSession()) {