AnsweredAssumed Answered

cross repo copy

Question asked by naveenkumar on Sep 10, 2007
Latest reply on Sep 11, 2007 by naveenkumar
Hi all,
    For my application i need to copy the xml content outside of the web project, for this i wrote a javacript in process definition.xml file. When i use this able to copy inside the web project, when i try to copy outside getting error.

Here is my Script:

var properties =;
var rssin = companyhome.childByNamePath("Projects/DML/RssIn");
logger.log("destfreenews" +rssin);      
var args = new Array(1);
args["store"] = avm.stores;               
logger.log("avmStores" +args["store"]);
  { var storeRootNode = avm.lookupStoreRoot(args["store"][0].id);
    logger.log("store root node" +storeRootNode);
    logger.log("store name" +args["store"][0].name);            
    if (storeRootNode != null)
    { var path = storeRootNode.path + "/ROOT/User Guide.doc";
      var node = avm.lookupNode(path);
      var path1 = storeRootNode.path + "/ROOT/Software/Programming languages";
      var node1 = avm.lookupNode(path1);
      logger.log("node" +node);
      logger.log("node path" +node.path);
      var copy=crossRepoCopy.copy(node,node1,"NAME OF THE CONTENT");//to copy inside web project
      var copy1=crossRepoCopy.copy(node,rssin,"NAME OF THE CONTENT");// to copy outside web project.

My console:

17:56:02,593 DEBUG [org.alfresco.repo.jscript.ScriptNode] Executing xpath: *[@cm:name=$cm:name0]/*[@cm:name=$cm:name1]/*[@cm:name=$cm:name2]
17:56:02,656 DEBUG [org.alfresco.repo.jscript.ScriptLogger] destfreenewsNode Type: {}folder, Node Aspects: [{}auditable, {}uifacets, {}referenceable, {}rules]
17:56:03,531 DEBUG [org.alfresco.repo.jscript.ScriptLogger] avmStores[Ljava.lang.Object;@1d0fa14
17:56:03,703 DEBUG [org.alfresco.repo.jscript.ScriptLogger] store root nodeAVM Path: DmlCognizant–admin:/www/avm_webapps
Node Type: {}avmlayeredfolder
Node Properties: 11
Node Aspects: [{}auditable, {}referenceable]
17:56:03,703 DEBUG [org.alfresco.repo.jscript.ScriptLogger] store nameDmlCognizant–admin
17:56:03,703 DEBUG [org.alfresco.repo.jscript.ScriptLogger] NaN
17:56:04,312 DEBUG [org.alfresco.repo.jscript.ScriptLogger] nodeAVM Path: DmlCognizant–admin:/www/avm_webapps/ROOT/User Guide.doc
Node Type: {}avmplaincontent
Node Properties: 13
Node Aspects: [{}titled, {}auditable, {}referenceable]
17:56:04,312 DEBUG [org.alfresco.repo.jscript.ScriptLogger] node pathDmlCognizant–admin:/www/avm_webapps/ROOT/User Guide.doc
17:56:07,687 DEBUG [org.alfresco.repo.jscript.ScriptLogger] AVM Path: DmlCognizant–admin:/www/avm_webapps/ROOT/Software/Programming languages/NAME OF THE CONTENT
Node Type: {}avmplaincontent
Node Properties: 13
Node Aspects: [{}titled, {}auditable, {}referenceable]
17:56:10,968 DEBUG [org.alfresco.repo.jscript.ScriptNode] Executing xpath: *[@cm:name=$cm:name0]
17:56:10,984 DEBUG [org.alfresco.repo.jscript.ScriptLogger]
17:56:11,000 DEBUG [org.alfresco.repo.jscript.RhinoScriptProcessor] Time to execute script: 8438ms
17:56:11,000 ERROR [org.jbpm.graph.def.GraphElement] action threw exception: Failed to execute supplied script: Failed to execute supplied script: TypeError: Cannot call method "save" of null (AlfrescoScript#1)
org.alfresco.service.cmr.repository.ScriptException: Failed to execute supplied script: Failed to execute supplied script: TypeError: Cannot call method "save" of null (AlfrescoScript#1)
   at org.alfresco.repo.processor.ScriptServiceImpl.executeScriptString(
   at org.alfresco.repo.processor.ScriptServiceImpl.executeScriptString(
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(
   at java.lang.reflect.Method.invoke(
   at– Getting error.
Copy1 have nothing.. can anyone tell me why?? Did anyone try to move the content out of web project??

For my application i need to create xml content,so i used web projects. I thought using JCR rmi to get the content directly from the staging sand box I found its not possible. Then i planned to copy the content out of web project.I need few more to clarify.

When author creates a content inside his sandbox, and he started the workflow.During approval process i need to get some information about the content under workflow  through java script
1)name of the content
2)path or Location of the content.
3)Expiration date property

how to get these informations??

Please anyone help me..