cancel
Showing results for 
Search instead for 
Did you mean: 

the outgoingTransition of serviceTask

xiangyuely
Champ in-the-making
Champ in-the-making
If I define a service task,and I assign a class to this service task, this class implements the interface of ActivityBehavior,
Whether I need to assign the outgoingtransition of serviceTask in this class,it can be taken to the next task?
3 REPLIES 3

frederikherema1
Star Contributor
Star Contributor
You can use a "JavaDelegate" instead, this hides some internal flow-logic and allows you tu just execute some code as part of the process, leaving the rest in the hands of activiti. Unless, off course, you want finer-grained control, in that case:

- Can you re-phraze this part of your question, I don't really get what you're asking:
Whether I need to assign the outgoingtransition of serviceTask in this class,it can be taken to the next task?

xiangyuely
Champ in-the-making
Champ in-the-making
I mean that If i want a finer-grained control, I must assign the outgoingtransition in this class, it can be taken to the right task from assigned outgoingtransition?
the codes are as follows:
      PvmTransition pvmTransition=execution.getActivity().getOutgoingTransitions().get(0);
      execution.take(pvmTransition);

You can use a "JavaDelegate" instead, this hides some internal flow-logic and allows you tu just execute some code as part of the process, leaving the rest in the hands of activiti. Unless, off course, you want finer-grained control, in that case:

- Can you re-phraze this part of your question, I don't really get what you're asking:
Whether I need to assign the outgoingtransition of serviceTask in this class,it can be taken to the next task?

frederikherema1
Star Contributor
Star Contributor
Best approach for this is to put a exclusive gateway right after the (service)task that makes the decision where the execution should go next. This can be done setting a variable in the service task and evaluating it using conditionExpressions on the outgoing sequence flows on the gateway.