X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.jcr%2Fsrc%2Forg%2Fargeo%2Fjcr%2FJcr.java;h=31077737e8e7e789335e263409b2279d190b1b27;hb=740f861dfbc166c70d206b3469ed7c8a645751c7;hp=1ed7469f1d5516bb0c8cf2ad8c2ac0b086dd1a86;hpb=563e3bf057cbb917096f34c9d365127660558588;p=lgpl%2Fargeo-commons.git 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}