cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing Sequence Flow id from DelegateExcution

erwin57
Champ in-the-making
Champ in-the-making
I am currently using Activiti 5.13 version and trying to create my own expression evaluator which accepts a string expression and DelegateExecution as show below.


<sequenceFlow id="flow1" sourceRef="theStart" targetRef="theTask">
  <conditionExpression xsi:type="tFormalExpression">
    <![CDATA[${mybean.evaluate(myExpressionString,execution)}]]>
  </conditionExpression>
</sequenceFlow>



class MyBean {
   public Boolean evaluate(String expressionString, DelegateExcution execution){
              System.out.println(execution.getCurrentActivityId());
              return myEvaluator.evaluate(expressionString);
   }
}


The method prints out the exclusive gateway id instead of the sequence flow id ( "flow1"). I also have a second sequence flow which printed out the same exclusive gateway id. How do I get hold of the sequence flow id from DelegateExection?

Thanks in advance.
1 REPLY 1

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

to get sequence flow which is evaluated you should change


    while (outgoingSeqFlow == null && transitionIterator.hasNext()) {
      PvmTransition seqFlow = transitionIterator.next();
     
      Condition condition = (Condition) seqFlow.getProperty(BpmnParse.PROPERTYNAME_CONDITION);
      if ( (condition == null && (defaultSequenceFlow == null || !defaultSequenceFlow.equals(seqFlow.getId())) )
              || (condition != null && condition.evaluate(execution)) ) {
        if (log.isDebugEnabled()) {
          log.debug("Sequence flow '{}'selected as outgoing sequence flow.", seqFlow.getId());
        }
        outgoingSeqFlow = seqFlow;
      }
    }

Condition is evaluated only from execution, which does not contain information about flow to take.

Regards
Martin
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.