@Override public Response toResponse(final TombstoneException e) { debugException(this, e, LOGGER); final Response.ResponseBuilder response = status(GONE) .entity(e.getMessage()); if (e.getURI() != null) { response.link(e.getURI(), "hasTombstone"); } return response.type(TEXT_PLAIN_TYPE).build(); } }
/** * Get the FedoraResource for the resource at the external path * @param externalPath the external path * @return the fedora resource at the external path */ @VisibleForTesting public FedoraResource getResourceFromPath(final String externalPath) { final Resource resource = translator().toDomain(externalPath); final FedoraResource fedoraResource = translator().convert(resource); if (fedoraResource instanceof Tombstone) { final String resourceURI = TRAILING_SLASH_REGEX.matcher(resource.getURI()).replaceAll(""); throw new TombstoneException(fedoraResource, resourceURI + "/fcr:tombstone"); } return fedoraResource; }
final Node preexistingNode = getClosestExistingAncestor(jcrSession, path); if (TombstoneImpl.hasMixin(preexistingNode)) { throw new TombstoneException(new TombstoneImpl(preexistingNode));
protected Node findOrCreateNode(final FedoraSession session, final String path, final String finalNodeType) throws RepositoryException { final Session jcrSession = getJcrSession(session); final Node preexistingNode = getClosestExistingAncestor(jcrSession, path); if (TombstoneImpl.hasMixin(preexistingNode)) { throw new TombstoneException(new TombstoneImpl(preexistingNode)); } final Node node = jcrTools.findOrCreateNode(jcrSession, path, NT_FOLDER, finalNodeType); if (node.isNew()) { tagHierarchyWithPairtreeMixin(preexistingNode, node); } return node; }