<?xml version="1.0" encoding="UTF-8"?>

<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="test">
   <swimlane name="initiator"></swimlane>

   <start-state name="start">
     <task name="submit" swimlane="initiator">
        <controller>
          <variable name="reviewer" access="write,required" />
          <variable name="testNode" access="write,required" />
        </controller>
      </task>
      <transition name="" to="review">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
            <script>
               <expression>
                  function result()
                  {
                     return ("Process instance = " + executionContext.processInstance.id + ", testNode children = " + testNode.children.length);
                  }
                  result();
               </expression>
               <variable name="scriptResult" access="write"/>
            </script>
         </action>
      </transition>
      <transition name="end" to="end"/>
   </start-state>
   
   <swimlane name="reviewer">
      <assignment actor-id="#{reviewer}"></assignment>
   </swimlane>
   
   <task-node name="review">
      <event type="node-enter">
         <script>
            System.out.println("the reviewer is " + reviewer);
            System.out.println("node " + testNode.name + " contains " + testNode.children.length + " children");
            System.out.println("scriptResult = " + scriptResult);
         </script>
      </event>
      <task name="review" duedate="1 business day" blocking="true" swimlane="reviewer">
         <controller>
            <variable name="comment" access="read,write,required"></variable>
         </controller>
      </task>
      <transition name="" to="end"></transition>
   </task-node>
   
   <end-state name="end"></end-state>
   
</process-definition>