cancel
Showing results for 
Search instead for 
Did you mean: 

Decision Handling Java class for Exclusive Gateway

sushantmahajan
Champ in-the-making
Champ in-the-making
Hi All,

What can be the bpmn xml equivalent for the jbpm xml  snippet below??

<decision g="182,1101,80,40" name="is-retry-required">
      <handler
         class="com.test.DecisionEvaluator" />
      <transition g="-26,-22" name="yes" to="Validate_Document_Module" />
      <transition g="-21,-22" name="no" to="Export_Module" />
   </decision>



I have tried doing it in activiti with something like

<serviceTask id='retryDecision' name='retryDecision'
         activiti:expression="#{DecisionEvaluator.retryEvaluation()}"
         activiti:resultVariable="retryRequired" />
      <sequenceFlow id="flow4" sourceRef="retryDecision"
         targetRef="is-retry-required" />
      <exclusiveGateway id="is-retry-required" name="is-retry-required"></exclusiveGateway>
      <sequenceFlow targetRef="Retry"
         sourceRef="is-retry-required">
         <conditionExpression xsi:type="tFormalExpression">${retryRequired=='yes'}
         </conditionExpression>
      </sequenceFlow>
      <sequenceFlow targetRef="End" sourceRef="is-retry-required">
         <conditionExpression xsi:type="tFormalExpression">${retryRequired=='no'}
         </conditionExpression>
      </sequenceFlow>

where "DecisionEvaluator" is class with a method "retryEvaluation" that returns either a "Yes" or "No" string.

Though the above code solves my purpose, but is too cumbersome and also there is an additional overhead of adding a few more steps in the workflow, which i am hesitant about.
1 REPLY 1

jbarrez
Star Contributor
Star Contributor
Please don't post the same question 3 times in the future …

Typical BPMN 2.0 way is to have a service task that sets a variable. Use that variable on the sequence flow after an exclusive gateway.

In the user guide http://activiti.org/userguide/index.html#bpmnJavaServiceTask, see section 'Exception Sequence Flow' , you could do something similar.