In your case I'd suggest the FileFolderService.copy method.
It's quite easy to use, just the provide the source NodeRef, the Parent target NodeRef and the new name.
Question
I have an Alfresco app and I create some nested Spaces, and now I want to copy some content on the last space to another one.
At the moment I'm searching the nodeRefs of the children spaces, and then I'm creating it in the new places but when I arrive to content I don't know how to copy it or copy his data to create in the destination space.
This is a little diagram to show what I want to do:
OriginalFolder
|______OriginalSubFolder
|_________OriginalContent
And now want to do this
DestinationFolder
|______Copy of OriginalSubFolder
|_______Copy of OriginalContent
At now I only can clone the "OriginalSubFolder" listing the Alfresco's nodeRef
and copying all of their properties.
Maybe, the code of createContent can help
I tried with:
fileInfo = getFileFolderService().copy(childNodeRef, nodeContenidoNuevo, nombreContenido);
But don't copy the content (an image in this case). When I click in the content Alfresco show this:
Contenido del nodo, faltante:
nodo: workspace://SpacesStore/72951dc4-f59a-4389-b020-6b2eef8cd9d3
lector: null
Sírvase contactar al administrador del sistema.
PD: Sorry, I know my English is pathetic...
Solution
In your case I'd suggest the FileFolderService.copy method.
It's quite easy to use, just the provide the source NodeRef, the Parent target NodeRef and the new name.