Re: Copy a node from oak run console?

2015-02-12 Thread Andrei Dulvac
Hi, Thanks all for the responses, it's much clearer now. You can use NodeBuilder#setChildNode(String, NodeState) to efficiently > copy a node. > That's what I did. But I had to recursively do that for all children nodes of the source. Which is not a big deal. > > Note however, that this method d

Re: Copy a node from oak run console?

2015-02-12 Thread Michael Dürig
On 11.2.15 4:29 , Andrei Dulvac wrote: Not a biggie, but it's odd that doesn't exist on the NodeBuilder or something. You can use NodeBuilder#setChildNode(String, NodeState) to efficiently copy a node. Under the hood this method uses value sharing to save space and time. Note however, tha

Re: Copy a node from oak run console?

2015-02-11 Thread Chetan Mehrotra
On Wed, Feb 11, 2015 at 8:59 PM, Andrei Dulvac wrote: > Not a biggie, but it's odd that doesn't exist on the NodeBuilder or > something. NodeBuilder API was meant to model the Tree access and has just the required set of operations to enable our usecases and was not meant to model the JCR Node/Pr

Re: Copy a node from oak run console?

2015-02-11 Thread Andrei Dulvac
Hi Chetan, Just how I thought. But I hoped there would be a way to get a JCR Session. What I was trying to do is copy a node (NodeState) with all its properties and children. Using the oak API, I had to roll my own and recursively call copy. Not a biggie, but it's odd that doesn't exist on the Nod

Re: Copy a node from oak run console?

2015-02-11 Thread Chetan Mehrotra
oak-run console is only meant to initialize a Oak ContentSession (which differs from a JCR Session!) and does not initializes a full feldged JCR session. So you cannot perform operations via JCR API. The console is mostly meant to perform low level debugging and manipulation of data. What are you

Copy a node from oak run console?

2015-02-11 Thread Andrei Dulvac
Hi devs, I'm curious of the easiest way to copy a jcr node using the oak run groovy console. I know that's easily achievable from the workspace by using the path and using the jcr Session: session.getWorkspace().copy("/path/src", "/path/dst/"); But from the oak run groovy console, all I have to