cancel
Showing results for 
Search instead for 
Did you mean: 

Get a list of Possible flows while I am at a gateway?

himanshudewan
Champ in-the-making
Champ in-the-making
Hi

I am new to Activity and am trying to integrate it with a web-application. I was going through the APIs and the DB to figure out if there was a way to get a list of possible conditional flows from a gateway or a task (say which has been coupled with a boundary event of some sort)? In other words, what all paths are possible from a given task along with the conditions that one needs to satisfy in order to take that possible path?

I tried searching for this question on the forum but could not find the right topic. In case it has already been answered can you please point me to the source.

Thanks in advance

Himanshu
4 REPLIES 4

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Himanshu,

You can have a look in activiti sources. e.g. org.activiti.engine.impl.bpmn.behavior.ExclusiveGatewayActivityBehavior#leave which transition is taken.


    Iterator<PvmTransition> transitionIterator = execution.getActivity().getOutgoingTransitions().iterator();

Look into source code to find answer for the second part of your question (events).


Regards
Martin

himanshudewan
Champ in-the-making
Champ in-the-making
Thanks for helping out Martin.

I went through the source code and have deduced that in order to get the outgoing transactions I need to obtain the PvmActivity object associated with that execution/Activity and then query for the possible outgoing transactions. I can obain the PvmActivity object from the PvmProcessInstance API which gives me the PvmExecution object which then gives me the required PvmAvtivity object.

Going through all the APIs, I had to read a bit about PVMs. (Wasn't aware about it earlier. So thanks again) I have still not found any comprehensive sources to understand what they exactly are. From what I have learnt, they are the basic implementation of the Activiti; treating every process as a simple state machine. The processEngine uses this PVM to build upon a BP execution framework. Can you also give a brief, simple-worded explanation on PVMs in your own way? Their context with respect to Activiti? Would changing something at the PVM level in a process be reflected in the DB or at the higher layers? Any good sources to understand the structure of Activiti and its PVM.

I find that documentation on PVM APIs is very less; also there is hardly any mention about them in the userguide or the Activiti in Action book. Here is hoping the Activiti team looks into it Smiley Happy

trademak
Star Contributor
Star Contributor
Hi,

The PVM is really for internal usage and you shouldn't need it.
You can get a BpmnModel instance via the RepositoryService and lookup the activity or gateway.
With the FlowElement Java instance you can get the outgoing sequence flows and the next element connected to each sequence flow.

Best regards,

himanshudewan
Champ in-the-making
Champ in-the-making
Thanks for the answer trademark. Sorry for the late reply.

You saved me a lot of headache Smiley Happy
I will try out the API you pointed out today.