Copy a Noderef – either Non-Recursive or Recursive

I am replacing the CrossRepositoryCopyService().copy action since we are going from multiple repo’s to one. So I am replacing this service..

// RECURSIVE copy – but specific for multiple repo’s.
serviceRegistry.getCrossRepositoryCopyService() .copy(src, dst,new_name);


So I started by re-using the FileFolderService to copy a node from A to B. This works great, but it only copies the node & leaves all children of the source untouched (and more importantly un-copied)  => Non-recursive copy. The FileFolderService() has no recursive copy action available.

// Non-RECURSIVE copy of one node
FileInfo finf = serviceRegistry.getFileFolderService().copy(src, dst, new_name);
return finf.getNodeRef();
There are quite a lot of copy actions available in Alfresco, but this one seems quite elegant. Also the service name alone gives me some hope of giving me what i need.
Enter the CopyService()



NodeRef copy2 = serviceRegistry.getCopyService().copy(src, dst, ContentModel.ASSOC_CHILDREN, QName.createQName(new_name), true);

and since I am here now – it also has a usefull


NodeRef copy = this.copyService.copy(src, dst, ContentModel.ASSOC_CHILDREN, QName.createQName(“newname”));
Big thanks to :


getting a boolean value from a Serializable return value (returned from nodeService.getProperty(X,Y);)

So this is the easy way to get a boolean value.

When all you have is a noderef with a boolean aspect (property)

boolean started = DefaultTypeConverter.INSTANCE.booleanValue(nodeService.getProperty(noderef, INCENTROmodel.PROP_TASKPLAN_TASK_STARTED));

boolean stopped = DefaultTypeConverter.INSTANCE.booleanValue(nodeService.getProperty(noderef, INCENTROmodel.PROP_TASKPLAN_TASK_ENDED));