AnsweredAssumed Answered

Mysterious workflow error

Question asked by pobe on Aug 2, 2007
Latest reply on Aug 8, 2007 by pobe
Im trying to create a workflow with several parallel swimlanes. The problem is that the system only follow the first transition in the forks.
Can somone please tell me what im doing wrong

/ Pontus

Processdefinition:

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

<process-definition xmlns="urn:jbpm.org:jpdl-3.2" name="sgu:workflow">

   <swimlane name="initiator"></swimlane>

   <swimlane name="projektledare">
      <assignment
         class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
         <actor>#{sgu_projektledare}</actor>
      </assignment>
   </swimlane>

   <swimlane name="verksamhetschef">
      <assignment
         class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
         <actor>#{sgu_verksamhetschef}</actor>
      </assignment>
   </swimlane>

   <swimlane name="enhetschef">
      <assignment
         class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
         <actor>#{sgu_enhetschef}</actor>
      </assignment>
   </swimlane>

   <swimlane name="beställare">
      <assignment
         class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
         <actor>#{sgu_bestallare}</actor>
      </assignment>
   </swimlane>

   <swimlane name="projektägare">
      <assignment
         class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
         <actor>#{sgu_projektagare}</actor>
      </assignment>
   </swimlane>

   <start-state name="start">
      <task name="sgu:startaProcess" swimlane="initiator" />
      <transition name="Sänd" to="Utarbeta utkast"></transition>
   </start-state>


   <task-node name="Utarbeta utkast">
      <task name="sgu:utarbetaUtkast" swimlane="projektledare" />
      <transition name="Öppna för synpunkter" to="fork1"></transition>
   </task-node>

   <fork name="fork1">
      <transition name="" to="Starta granskning"></transition>
      <transition name="" to="Granska och redigera bs"></transition>
      <transition name="" to="Granska och redigera pa"></transition>
      <transition name="" to="Granska och redigera ec"></transition>
      <transition name="" to="Granska och redigera vc"></transition>
   </fork>

   <node name="Starta granskning">
      <action class="org.alfresco.repo.workflow.jbpm.ForEachFork">
         <foreach>#{sgu_ovriga}</foreach>
         <var>reviewer</var>
      </action>
      <event type="node-enter">

      </event>
      <transition name="" to="Granska och redigera ovr"></transition>
   </node>

   <task-node name="Granska och redigera ovr">
      <task name="sgu:granskaRedigera">
         <assignment
            class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
            <actor>#{reviewer}</actor>
         </assignment>
      </task>
      <transition name="Granskning klar" to="endredigering" />
   </task-node>


   <task-node name="Granska och redigera vc">
      <task name="sgu:granskaRedigera" swimlane="verksamhetschef">
      </task>
      <transition name="Granskning klar" to="endredigering" />
   </task-node>

   <task-node name="Granska och redigera bs">
      <task name="sgu:granskaRedigera" swimlane="beställare"></task>
      <transition name="Granskning klar" to="endredigering" />
   </task-node>

   <task-node name="Granska och redigera pa">
      <task name="sgu:granskaRedigera" swimlane="projektägare"></task>
      <transition name="Granskning klar" to="endredigering" />
   </task-node>

   <task-node name="Granska och redigera ec">
      <task name="sgu:granskaRedigera" swimlane="enhetschef"></task>
      <transition name="Granskning klar" to="endredigering" />
   </task-node>

   <join name="endredigering">
      <transition to="Bearbeta synpunkter" />
   </join>


   <task-node name="Bearbeta synpunkter">
      <task name="sgu:submitParallelReviewTask"
         swimlane="projektledare" />

      <transition name="Skicka för godkännande" to="startreview" />
   </task-node>


   <node name="startreview">
      <action class="org.alfresco.repo.workflow.jbpm.ForEachFork">
         <foreach>#{sgu_ovriga}</foreach>
         <var>reviewer</var>
      </action>
      <event type="node-enter">
         <script>
            <variable name="sgu_approveCount" access="write" />
            <expression>sgu_approveCount = 0;</expression>
         </script>
      </event>
      <transition name="review" to="fork2" />
   </node>


   <fork name="fork2">
      <transition name="" to="review ovr"></transition>
      <transition name="" to="review vc"></transition>
      <transition name="" to="review bs"></transition>
      <transition name="" to="review vc"></transition>
      <transition name="" to="review pa"></transition>
   </fork>


   <task-node name="review ovr">
      <task name="wf:reviewTask">
         <assignment
            class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
            <actor>#{reviewer}</actor>
         </assignment>
      </task>
      <transition name="Ej godkänd" to="endreview" />
      <transition name="Godkänd" to="endreview">
         <script>
            <variable name="sgu_approveCount" access="read,write" />
            <expression>
               sgu_approveCount = sgu_approveCount +1;
            </expression>
         </script>
      </transition>
   </task-node>


   <task-node name="review vc">
      <task name="wf:reviewTask" swimlane="verksamhetschef"></task>
      <transition name="Ej godkänd" to="endreview" />
      <transition name="Godkänd" to="endreview">
         <script>
            <variable name="sgu_approveCount" access="read,write" />
            <expression>
               sgu_approveCount = sgu_approveCount +1;
            </expression>
         </script>
      </transition>
   </task-node>



   <task-node name="review bs">
      <task name="wf:reviewTask" swimlane="beställare"></task>
      <transition name="Ej godkänd" to="endreview" />
      <transition name="Godkänd" to="endreview">
         <script>
            <variable name="sgu_approveCount" access="read,write" />
            <expression>
               sgu_approveCount = sgu_approveCount + 1;
            </expression>
         </script>
      </transition>
   </task-node>

   <task-node name="review pa">
      <task name="wf:reviewTask" swimlane="projektägare"></task>
      <transition name="Ej godkänd" to="endreview" />
      <transition name="Godkänd" to="endreview">
         <script>
            <variable name="sgu_approveCount" access="read,write" />
            <expression>
               sgu_approveCount = sgu_approveCount +1;
            </expression>
         </script>
      </transition>
   </task-node>

   <task-node name="review ec">
      <task name="wf:reviewTask" swimlane="enhetschef">

      </task>
      <transition name="Ej godkänd" to="endreview" />
      <transition name="Godkänd" to="endreview">
         <script>
            <variable name="sgu_approveCount" access="read,write" />
            <expression>
               sgu_approveCount = sgu_approveCount +1;
            </expression>
         </script>
      </transition>
   </task-node>


   <join name="endreview">
      <transition to="isapproved" />
   </join>

   <decision name="isapproved">
      <event type="node-enter">
         <script>
            <variable name="sgu_reviewerCount" access="write" />
            <variable name="sgu_requiredPercent" access="write" />
            <variable name="sgu_actualPercent" access="write" />
            <expression>
               sgu_requiredPercent = sgu_requiredApprovePercent;
               sgu_reviewerCount = sgu_ovriga.size()+4;
               sgu_actualPercent = ((sgu_approveCount * 100) /
               sgu_reviewerCount);
            </expression>
         </script>
      </event>

      <transition name="Godkänd" to="approved">
         <condition>
            #{sgu_actualPercent >= sgu_requiredApprovePercent}
         </condition>
      </transition>
      <transition name="Ej godkänd" to="rejected" />
   </decision>

   <task-node name="approved">
      <task name="sgu:approvedParallelTask" swimlane="initiator" />
      <transition to="end" />
   </task-node>

   <task-node name="rejected">
      <task name="sgu:rejectedParallelTask" swimlane="initiator" />
      <transition to="end" />
   </task-node>


   <end-state name="end" />

</process-definition>

task model

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

<model name="sgu:workflowmodel"
   xmlns="http://www.alfresco.org/model/dictionary/1.0">

   <imports>
      <import uri="http://www.alfresco.org/model/bpm/1.0"
         prefix="bpm" />
      <import uri="http://www.alfresco.org/model/dictionary/1.0"
         prefix="d" />
      <import uri="http://www.alfresco.org/model/content/1.0"
         prefix="cm" />
   </imports>


   <namespaces>
      <namespace uri="sgu" prefix="sgu" />
   </namespaces>

   <types>
      <type name="sgu:startaProcess">
         <parent>bpm:startTask</parent>
         <mandatory-aspects>
            <aspect>sgu:projektledare</aspect>
         </mandatory-aspects>
      </type>

      <type name="sgu:utarbetaUtkast">
         <parent>bpm:workflowTask</parent>
         <overrides>
            <property name="bpm:packageItemActionGroup">
               <default>edit_package_item_actions</default>
            </property>
         </overrides>
         <mandatory-aspects>
            <aspect>sgu:verksamhetschef</aspect>
            <aspect>sgu:enhetschef</aspect>
            <aspect>sgu:projektagare</aspect>
            <aspect>sgu:bestallare</aspect>
            <aspect>sgu:ovriga</aspect>
         </mandatory-aspects>
      </type>
      
      <type name="sgu:reviewTask">
         <parent>bpm:workflowTask</parent>
      </type>


      <type name="sgu:granskaRedigera">
         <parent>bpm:workflowTask</parent>
         <overrides>
            <property name="bpm:packageItemActionGroup">
               <default>edit_package_item_actions</default>
            </property>
         </overrides>
      </type>

      <type name="sgu:rejectedParallelTask">
         <parent>bpm:workflowTask</parent>
         <mandatory-aspects>
            <aspect>sgu:parallelReviewStats</aspect>
         </mandatory-aspects>
      </type>

      <type name="sgu:approvedParallelTask">
         <parent>bpm:workflowTask</parent>
         <mandatory-aspects>
            <aspect>sgu:parallelReviewStats</aspect>
         </mandatory-aspects>
      </type>

      <type name="sgu:submitParallelReviewTask">
         <parent>sgu:submitConcurrentReviewTask</parent>
         <mandatory-aspects>
            <aspect>sgu:verksamhetschef</aspect>
            <aspect>sgu:enhetschef</aspect>
            <aspect>sgu:projektagare</aspect>
            <aspect>sgu:bestallare</aspect>
            <aspect>sgu:ovriga</aspect>
         </mandatory-aspects>
      </type>

      <type name="sgu:submitConcurrentReviewTask">
         <parent>bpm:startTask</parent>
         <properties>
            <property name="sgu:requiredApprovePercent">
               <type>d:int</type>
               <mandatory>true</mandatory>
               <default>50</default>
               <constraints>
                  <constraint type="MINMAX">
                     <parameter name="minValue">
                        <value>1</value>
                     </parameter>
                     <parameter name="maxValue">
                        <value>100</value>
                     </parameter>
                  </constraint>
               </constraints>
            </property>
         </properties>
      </type>

   </types>

   <aspects>

      <aspect name="sgu:ovriga">
         <associations>

            <association name="sgu:ovriga">
               <source>
                  <mandatory>false</mandatory>
                  <many>false</many>
               </source>
               <target>
                  <class>cm:person</class>
                  <mandatory>true</mandatory>
                  <many>true</many>
               </target>
            </association>

         </associations>
      </aspect>

      <aspect name="sgu:enhetschef">
         <associations>

            <association name="sgu:enhetschef">
               <source>
                  <mandatory>false</mandatory>
                  <many>false</many>
               </source>
               <target>
                  <class>cm:person</class>
                  <mandatory>true</mandatory>
                  <many>false</many>
               </target>
            </association>

         </associations>
      </aspect>

      <aspect name="sgu:bestallare">
         <associations>

            <association name="sgu:bestallare">
               <source>
                  <mandatory>false</mandatory>
                  <many>false</many>
               </source>
               <target>
                  <class>cm:person</class>
                  <mandatory>true</mandatory>
                  <many>false</many>
               </target>
            </association>

         </associations>
      </aspect>

      <aspect name="sgu:projektagare">
         <associations>

            <association name="sgu:projektagare">
               <source>
                  <mandatory>false</mandatory>
                  <many>false</many>
               </source>
               <target>
                  <class>cm:person</class>
                  <mandatory>true</mandatory>
                  <many>false</many>
               </target>
            </association>

         </associations>
      </aspect>

      <aspect name="sgu:projektledare">
         <associations>

            <association name="sgu:projektledare">
               <source>
                  <mandatory>false</mandatory>
                  <many>false</many>
               </source>
               <target>
                  <class>cm:person</class>
                  <mandatory>true</mandatory>
                  <many>false</many>
               </target>
            </association>

         </associations>
      </aspect>

      <aspect name="sgu:verksamhetschef">
         <associations>

            <association name="sgu:verksamhetschef">
               <source>
                  <mandatory>false</mandatory>
                  <many>false</many>
               </source>
               <target>
                  <class>cm:person</class>
                  <mandatory>true</mandatory>
                  <many>false</many>
               </target>
            </association>

         </associations>
      </aspect>

      <aspect name="sgu:parallelReviewStats">
         <properties>
            <property name="sgu:reviewerCount">
               <type>d:int</type>
            </property>
            <property name="sgu:requiredPercent">
               <type>d:int</type>
            </property>
            <property name="sgu:approveCount">
               <type>d:int</type>
            </property>
            <property name="sgu:actualPercent">
               <type>d:int</type>
            </property>
         </properties>
      </aspect>

   </aspects>

</model>

Outcomes