On Fri, Apr 21, 2006 at 01:35:06PM +0300, Eugeny N Dzhurinsky wrote:
> On Fri, Apr 21, 2006 at 12:20:37PM +0200, Martin Perez wrote:
> > Take a look to the workspace.copy and session.move methods. It's just what
> > you need.
>
> Actually I'm using session.move method.
> But this method expects target node to be a *complete* path
> I mean if I need to move node 'test' from /root/node1/test to /root/node2/test
> i need to use
>
> session.move('/root/node1/test','/root/node2/test'); and not
> session.move('/root/node1/test','/root/node2'); because it will complain about
> node exists. So i need some way to append node name to path of target node.
I found possible solution:
Node root = session.getRootNode();
Node newparent = root.getNode(new_parent);
Node node = root.getNode(node_name);
log.debug("moving node - [" + node.getPath() + "] to - ["
+ newparent.getPath() + "]");
session.move(node.getPath(), newparent.getPath() + "/"
+ node.getName());
session.save();
Is it possible to avoid +"/"+ somehow?
--
Eugene N Dzhurinsky