From: Mathieu Baudier Date: Thu, 16 Jul 2020 11:25:54 +0000 (+0200) Subject: Add workspace name shortcut. X-Git-Tag: argeo-commons-2.1.89~102 X-Git-Url: https://git.argeo.org/?p=lgpl%2Fargeo-commons.git;a=commitdiff_plain;h=89f88b7362871463a620c4a48aef98c48864e9fb Add workspace name shortcut. --- diff --git a/org.argeo.jcr/src/org/argeo/jcr/Jcr.java b/org.argeo.jcr/src/org/argeo/jcr/Jcr.java index bc609bc40..624b92b5b 100644 --- a/org.argeo.jcr/src/org/argeo/jcr/Jcr.java +++ b/org.argeo.jcr/src/org/argeo/jcr/Jcr.java @@ -20,6 +20,7 @@ import javax.jcr.Repository; import javax.jcr.RepositoryException; import javax.jcr.Session; import javax.jcr.Value; +import javax.jcr.Workspace; import javax.jcr.nodetype.NodeType; import javax.jcr.security.Privilege; import javax.jcr.version.Version; @@ -97,6 +98,15 @@ public class Jcr { } } + /** + * @see Node#getSession() + * @see Session#getWorkspace() + * @see Workspace#getName() + */ + public static String getWorkspaceName(Node node) { + return session(node).getWorkspace().getName(); + } + /** * @see Node#getIdentifier() * @throws IllegalStateException caused by {@link RepositoryException}