Indexed name.
authorMathieu Baudier <mbaudier@argeo.org>
Tue, 2 Feb 2021 13:16:07 +0000 (14:16 +0100)
committerMathieu Baudier <mbaudier@argeo.org>
Tue, 2 Feb 2021 13:16:07 +0000 (14:16 +0100)
org.argeo.jcr/src/org/argeo/jcr/Jcr.java

index 1ed7469f1d5516bb0c8cf2ad8c2ac0b086dd1a86..31077737e8e7e789335e263409b2279d190b1b27 100644 (file)
@@ -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}