AnsweredAssumed Answered

Move files workflow

Question asked by msvoren on Oct 21, 2008
Latest reply on Dec 2, 2008 by msvoren
Hi.
I need to create workflow which will be initiated with rules. Workflow simply needs to move document to another folder. I need little help. Here is what I have so far:

MODEL:

<model name="owf:MoveData" xmlns="http://www.alfresco.org/model/dictionary/1.0">
<imports>
   <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
   <import uri="http://www.alfresco.org/model/bpm/1.0" prefix="bpm"/>
   <import uri="www.alfresco.org/model/workflow/1.0" prefix="wf" />
   <import uri="www.alfresco.org/model/content/1.0" prefix="cm" />
</imports>

<namespaces>    <namespace uri="oawf" prefix="owf"/> </namespaces>

<types>
   <type name="owf:startMove">
      <parent>bpm:startTask</parent>
   <properties>
           <property name="owf:whereTo">
      <title>Destination</title>
      <type>d:text</type>
           </property>
        </properties>
   </type>
</types>
</model>

PROCESS DEF:

<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="owf:moveFiles">
   <swimlane name="initiator"/>
   <start-state name="start">
      <task name="owf:startMove" swimlane="initiator"/>
      <transition name="" to="end">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
      <runas>admin</runas>
           <script>
      var dest = companyhome.childByNamePath("Dest");
      document.move(dest);
           </script>
         </action>
      </transition>
   </start-state>
<end-state name="end"/>
</process-definition>


Rule script which i execute when file comes to folder:

          var workflow = actions.create("start-workflow");
          workflow.parameters.workflowName = "jbpm$owf:moveFiles"; 
          workflow.execute(document);

When executed, i get:

org.alfresco.scripts.ScriptException: Failed to execute script 'workspace://SpacesStore/a8a9950c-939c-11dd-9e2e-5be0a253008d': Failed to execute script 'workspace://SpacesStore/a8a9950c-939c-11dd-9e2e-5be0a253008d': Wrapped org.springframework.orm.hibernate3.HibernateSystemException: null index column for collection: org.jbpm.graph.def.ProcessDefinition.definitions; nested exception is org.hibernate.HibernateException: null index column for collection: org.jbpm.graph.def.ProcessDefinition.definitions (AlfrescoScript#3)
What am I doing wrong? Thanks

Outcomes