Hi!
If I well understood I think you can copy your document if you have the id of the document and the id of the node where you want to copy your document
//Here I get the nodeRef where I want to copy the document
//In my case I store the copy in the same folder where I have my node with id psId
NodeRef parentRef = new NodeRef(Repository.getStoreRef(), psId);
ChildAssociationRef assocRef = this.nodeService.getPrimaryParent(ref);
//Then you use the CopyService to copy your document (in my case my document is contained in the node "ref") and you choose false if you copy a document and true if you want to copy a folder and all its content. Maybe there is a similar service for moving your document..
NodeRef copyRef = this.copyService.copy( ref, //source
parentRef, //destination
ContentModel.ASSOC_CONTAINS,
assocRef.getQName(),
false); //copy children
But for permission I do not know if you will have the same problem than me: I am trying to copy a node stored in my database in the same space but I do not have permissions to do it and while doing this, that fails (maybe I cannot set permission on nodes from the database maybe I should set permission on the method copy but I do not see how?):
permissionService.setPermission(ref,PermissionService.ALL_AUTHORITIES,PermissionService.ALL_PERMISSIONS,true);
And If I do not have permission set I have this error:
org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read-only mode (FlushMode.NEVER) - turn your Session into FlushMode.AUTO or remove 'readOnly' marker from transaction definition
And I get the same error while launching my operation as admin…