private List<ExplorerTreePath> getPathsToRemove(final Integer nodeId) {
        return JooqUtil.contextResult(explorerDbConnProvider, context -> context
                        .selectFrom(p)
                        .where(p.DESCENDANT.in(context
                                .select(p1.DESCENDANT)
                                .from(p1)
                                .where(p1.ANCESTOR.eq(nodeId))))
                        .fetch())
                .map(ExplorerTreeDaoImpl::mapExplorerPathRecord);
    }
Get the root node containing a particular node, or the node itself if it is a root node.
stroom-explorer/stroom-explorer-impl-db/src/main/java/stroom/explorer/impl/db/ExplorerTreeDaoImpl.java