From: Mathieu Baudier Date: Tue, 2 Feb 2021 13:16:07 +0000 (+0100) Subject: Indexed name. X-Git-Tag: argeo-commons-2.1.91~5 X-Git-Url: https://git.argeo.org/?p=lgpl%2Fargeo-commons.git;a=commitdiff_plain;h=740f861dfbc166c70d206b3469ed7c8a645751c7 Indexed name. --- diff --git a/org.argeo.jcr/src/org/argeo/jcr/Jcr.java b/org.argeo.jcr/src/org/argeo/jcr/Jcr.java index 1ed7469f1..31077737e 100644 --- a/org.argeo.jcr/src/org/argeo/jcr/Jcr.java +++ b/org.argeo.jcr/src/org/argeo/jcr/Jcr.java @@ -203,6 +203,21 @@ public class Jcr { } } + /** + * Returns the node name with its current index (useful for re-ordering). + * + * @see Node#getName() + * @see Node#getIndex() + * @throws JcrException caused by {@link RepositoryException} + */ + public static String getIndexedName(Node node) { + try { + return node.getName() + "[" + node.getIndex() + "]"; + } catch (RepositoryException e) { + throw new JcrException("Cannot get name of " + node, e); + } + } + /** * @see Node#getProperty(String) * @throws JcrException caused by {@link RepositoryException}