cancel
Showing results for 
Search instead for 
Did you mean: 

Call custom java code to decide which sequence flow is taken next

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

Is there a provision in activiti to call custom java code to evaluate the transition for a gateway. I want to call a java method that decides and returns which transition has to be taken next.
I had a similar usecase earlier with JBPM,   where decision handler did it for me. 
2 REPLIES 2

cocojack42
Champ in-the-making
Champ in-the-making
Does this help you: http://forums.activiti.org/content/catch-java-servicetask-exceptions-using-erroreventdefinition

<java>
public class ThrowsExceptionBehavior implements ActivityBehavior {

  public void execute(ActivityExecution execution) throws Exception {
    String var = (String) execution.getVariable("var");

    PvmTransition transition = null;
    try {
      executeLogic(var);
      transition = execution.getActivity().findOutgoingTransition("no-exception");
    } catch (Exception e) {
      transition = execution.getActivity().findOutgoingTransition("exception");
    }
    execution.take(transition);
  }

}
</java>

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

You can use spring beans or expressions.
(org.activiti.engine.test.bpmn.gateway.ExclusiveGatewayTest).

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.