I would like to know if it is possible to change the control flow of a process during execution.
For example in the following process:
It is possible to jump form "Service Task 2" directly to "User Task 4" or maybe going back to "User Task 1"?
I read in documentation about ActivityBehavior class that can be invoked from a Java Service Task and there is stated that there is the possibility to change control flow of the process, but how can I do that?
I didn't find anything about how that can be done and I am also wondering if it is possible doing such a thing only from a Java Service Task or there is the possibility (always using the example) to go, for example, from "User Task 1" directly to "User Task 4" and then maybe going back to "Service Task 2" (?).
So my question is more in general: is there the possibility to change control flow in some way with Activiti?
I thank in advance everyone that will answer to my question.
It is possible but one needs to be very careful. Every execution has an activityId associated with it, you can update the activity Id of an execution and the task will effectively move from one step to another. Where this can become complex is the data dependencies associated with the process. If you skip a step, then perhaps the data enrichment associated with that step doesnt happen, then if a subsequent step relies on this data being populated you will get a failure.
Going backward in a process can cause the same sort of problem, as forms or services that are called assume a current state and jumping around breaks that paradigm.
The entire reason for having a defined process is to enforce specific paths of execution. If you need to move between different states, then model your process accordingly (i.e. not in a straight line),
If I would like to modify anyways the activityId associated with the execution (even if it is a bad practice), how can I do that? I mean, it can only be done from an ActivityBehavior class or also from my main class?
Also, if it is possible to do it from the main class, how can I access the execution variable associated with the current process?
In both cases, which method I should call on the execution variable?
I apologize if I am asking too many questions, but I'm a novice with Activiti.