On 10.02.11 19:18, "[email protected]" <[email protected]> wrote: >But I would like to avoid reading data from one resource node and setting >it >to a new one since this requires extra time and memory. Is there a way >that >I can set the content hash of the existing document on new resource node >and >not read contents while copying?
Do you mean copying from one node to another inside the repository? For that you can use Workspace.copy: http://www.day.com/maven/jsr170/javadocs/jcr-2.0/javax/jcr/Workspace.html#c opy(java.lang.String,%20java.lang.String) >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()]; >contentBinary.getStream().read(content); > >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 >transfered >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)? http://www.day.com/maven/jsr170/javadocs/jcr-2.0/javax/jcr/Node.html#setPro perty(java.lang.String,%20javax.jcr.Binary) >or you can't remove original node if references to that node exist? Exactly. REFERENCE properties are hard-references, always enforced. Regards, Alex -- Alexander Klimetschek Developer // Adobe (Day) // Berlin - Basel
