jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Klimetschek <aklim...@adobe.com>
Subject Re: copying content from one resource node to another
Date Fri, 11 Feb 2011 12:48:05 GMT
On 10.02.11 19:18, "kazim_ssuet@yahoo.com" <kazim_ssuet@yahoo.com> wrote:
>But I would like to avoid reading data from one resource node and setting
>to a new one since this requires extra time and memory. Is there a way
>I can set the content hash of the existing document on new resource node
>not read contents while copying?

Do you mean copying from one node to another inside the repository? For
that you can use Workspace.copy:


>Basically I would like to avoid this peice of code:
>Property contentProperty = fromNode.getProperty(JcrConstants.JCR_DATA);
>Binary contentBinary = contentProperty.getBinary();
>byte content[]=new byte[(int)contentBinary.getSize()];
>Instead I would like to somehow get pointer to existing content and set it
>to new resource node, Since there might be 100s of document being
>from one entity to another, which would be costly in terms of time and
>memory to do it this way.

Why don't you simply use setProperty("jcr:data", binary)?


>or you can't remove original node if references to that node exist?

Exactly. REFERENCE properties are hard-references, always enforced.


Alexander Klimetschek
Developer // Adobe (Day) // Berlin - Basel

View raw message