From 740f861dfbc166c70d206b3469ed7c8a645751c7 Mon Sep 17 00:00:00 2001 From: Mathieu Baudier Date: Tue, 2 Feb 2021 14:16:07 +0100 Subject: [PATCH] Indexed name. --- org.argeo.jcr/src/org/argeo/jcr/Jcr.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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} -- 2.30.2