AnsweredAssumed Answered

crossRepoCopy copy issues

Question asked by rdifrango on Mar 12, 2009
Latest reply on Mar 13, 2009 by rdifrango
I am attempting to perform a crossRepoCopy 


function main()
{
   // avm://portal/-1;www;avm_webapps;ROOT;DCP_4963.JPG
   //
   var sourceName = args.sourceName;
   if (sourceName == null || sourceName.length == 0) {
      status.setCode(status.STATUS_BAD_REQUEST, "sourceName moving node");
      return;
   }
   
   var destName = args.destName;
   if (destName == null || destName.length == 0) {
      status.setCode(status.STATUS_BAD_REQUEST, "name moving node");
      return;
   }
   
   var name = args.name;
   if (name == null || name.length == 0) {
      status.setCode(status.STATUS_BAD_REQUEST, "name moving node");
      return;
   }
   
   var remove = args.remove;
   if (remove == null || remove.length == 0) {
      status.setCode(status.STATUS_BAD_REQUEST, "remove moving node");
      return;
   }
   
   var source = utils.getNodeFromString(sourceName);
   if (source == null)
   {
      status.setCode(status.STATUS_BAD_REQUEST, "remove moving node");
      return;
   }
   
   for each (property in source.properties)
   {
      logger.log("RRD : " + property);
   }
   
   var destination = roothome.childByNamePath("Company Home/" + destName);
   
   for each (property in destination.properties)
   {
      logger.log("RRD : " + property);
   }
   
   var nodeCopy = crossRepoCopy.copy(source, destination, name);
   
   // Delete the node?
   if (remove != undefined && remove == 'true')
   {
      source.remove();
   }
   
   model.node = nodeCopy;
}

main();

The parameters are as follows:

sourceName : avm://portal/-1;www;avm_webapps;ROOT;DCP_4963.JPG
destName: images
name : ronCopy.jpg
remove :  false

And the exception I get is as follows:


Caused by: org.alfresco.service.cmr.avm.AVMNotFoundException: Path /www/avm_webapps/ROOT/DCP_4963.JPG not found.
   at org.alfresco.repo.avm.AVMStoreImpl.getContentDataForRead(AVMStoreImpl.java:1452)
   at org.alfresco.repo.avm.AVMRepository.getContentDataForRead(AVMRepository.java:2514)
   at org.alfresco.repo.avm.AVMServiceImpl.getContentDataForRead(AVMServiceImpl.java:1212)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)

How can I do this?

Outcomes