AnsweredAssumed Answered

Adding an aspect that is both optional and mandatory

Question asked by evolmark on May 10, 2007
I have a task that need to send content either to a group of reviewers or to the editors for final processing.

Editors are associated using a <pooledactors> tag,  reviewers are part of a heterogenous group selected using something similar to bpm_assignees, my version is called swwf_assignees wich has been declared as optional

THE PROBLEM I need to solve
I need to validate that if the SendToReviewers transition is called that at least one reviewer was selected


<task-node name="produce">
      <task name="swwf:produceTask" swimlane="producers"></task>
      <transition name="reject" to="returnToInitiator" />
      <transition name="sendToReviewers" to="validateIfThereAreReviewers" />
      <transition name="sendToProofing" to="proof" />

   <task-node name="returnToInitiator">
      <task name="swwf:returnToInitiator" swimlane="initiator"></task>

   <swimlane name="reviewers" />

   <decision name="validateIfThereAreReviewers">
      <event type="node-enter">
            <variable name="swwf_reviewerCnt" access="write" />
               swwf_reviewerCnt = swwf_assignees.size();

      <transition name="reviewersNotProvided" to="produce">
      <transition name="reviewersProvided" to="startReview">
         <condition>#{swwf_reviewerCnt > 0 }</condition>

   <node name="startReview">
      <action class="org.alfresco.repo.workflow.jbpm.ForEachFork">
      <transition name="" to="review" />

   <task-node name="review">
      <task name="swwf:reviewTask">
      <transition name="finished" to="produce" />

This throws an error when nobody is selected in reviewers, swwf_assignees seems to be undefined.

    exception during evaluation of script expression
    Sourced file: inline evaluation of: ``swwf_reviewerCnt = swwf_assignees.size();'' : Attempt to resolve method: size() on undefined variable or….
Any recomended approach to solve the problem
Can I ask if a variable is un/defined
how to handle exceptions