jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peeter Piegaze <peeter.pieg...@gmail.com>
Subject Re: Node.orderBefore(String,String)
Date Wed, 15 Dec 2004 09:47:38 GMT
> Why does orderBefore take two String arguments.
> Until I miss something this can/will only work if you have the full node name
> like
> parentNode.orderBefore("tst:case[2]","tst:case[3]");
> Getting the full node name is not straight foreward because getName() only
> returns the name without position. It is necessary to retrieve the path and
> grep the substring with the name+position.

yes, you have to take the last segment of the abspath of each child node,
which is rather inelegant, I grant.

> Three issues came up doing so:
> 1) There is room for improvement in the spec. Why isn't there a method which
> accepts UUIDs or Nodes or whatever?

No doubt there is room for improvement. Keep in mind that we have
tried to strike a balance between providing useful methods and keeping
the API a reasonable size. So we have tended to avoid the inclusion of
things that we judge to be "convenience methods" or simple helper
methods, that is, methods that are relatively trivial to write and
that the application can provide.

Whether this particular example merits a new method or two is a valid
question,  the spec is still not final...so your suggestions are
appreciated, especially if you find a common use case that we have
overlooked...which perhaps this is.

> 2) It's better to not have same name siblings (so the name is sufficient to
> distinguish them).

This may be true. After all, you are not *required* to use SNS ;-)
BTW, SNS was introduced initially for easy mapping from arbitrary XML
structures (since in XML you can have multiple same-name elements at
the same level in the heirarchy).


View raw message