From: Mathieu Baudier Date: Mon, 26 Oct 2020 09:41:51 +0000 (+0100) Subject: Add Jcr utilities. X-Git-Tag: argeo-commons-2.1.89~54 X-Git-Url: https://git.argeo.org/?p=lgpl%2Fargeo-commons.git;a=commitdiff_plain;h=110c8771cda70be5bb6458281d025dc3d9d3919e Add Jcr utilities. --- diff --git a/org.argeo.jcr/src/org/argeo/jcr/Jcr.java b/org.argeo.jcr/src/org/argeo/jcr/Jcr.java index 0f6059c7f..3ee235f62 100644 --- a/org.argeo.jcr/src/org/argeo/jcr/Jcr.java +++ b/org.argeo.jcr/src/org/argeo/jcr/Jcr.java @@ -385,6 +385,15 @@ public class Jcr { } } + /** Retrieves the root node related to this session. */ + public static Node getRootNode(Session session) { + try { + return session.getRootNode(); + } catch (RepositoryException e) { + throw new IllegalStateException("Cannot get root node for " + session, e); + } + } + /** * Saves the {@link Session} related to this node. Note that all other unrelated * modifications in this session will also be saved.