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

<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="wf:review">

   <swimlane name="initiator"/>

   <start-state name="start">
     <task name="wf:submitReviewTask" swimlane="initiator">
        <controller>
          <variable name="reviewer" access="write" mapped-name="wf:reviewer"/>
          <variable name="reviewduedate" access="write" mapped-name="wf:reviewDueDate"/>
          <variable name="reviewpriority" access="write" mapped-name="wf:reviewPriority"/>
          <variable name="package" access="write" mapped-name="bpm:package"/>
          <variable name="context" access="write" mapped-name="bpm:context"/>
        </controller>
      </task>
      <transition name="" to="review"/>
   </start-state>

   <swimlane name="reviewer">
      <assignment actor-id="#{reviewer.properties['cm:userName']}"/>
   </swimlane>
   
   <task-node name="review">
      <task name="wf:reviewTask" swimlane="reviewer">
         <event type="task-create">
            <script>
               taskInstance.dueDate = reviewduedate;
               taskInstance.priority = reviewpriority;
            </script>
         </event>
         <controller>
            <variable name="package" access="read,required" mapped-name="bpm:package"/>
            <variable name="context" access="read,required" mapped-name="bpm:context"/>
         </controller>
      </task>
      <transition name="reject" to="rejected"/>
      <transition name="approve" to="approved"/>
   </task-node>
   
   <task-node name="rejected">
      <task name="wf:rejectedTask" swimlane="initiator">
         <controller>
            <variable name="package" access="read,required" mapped-name="bpm:package"/>
            <variable name="context" access="read,required" mapped-name="bpm:context"/>
         </controller>
      </task>
      <transition name="" to="end"/>
   </task-node>
   
   <task-node name="approved">
      <task name="wf:approvedTask" swimlane="initiator">
         <controller>
            <variable name="package" access="read,required" mapped-name="bpm:package"/>
            <variable name="context" access="read,required" mapped-name="bpm:context"/>
         </controller>
      </task>
      <transition name="" to="end"/>
   </task-node>
   
   <end-state name="end"/>
   
</process-definition>