cancel
Showing results for 
Search instead for 
Did you mean: 

Querying ExclusiveGateway and other gateways.

kethur
Champ in-the-making
Champ in-the-making
Hi Team,

I am not able to find an API to query the Exclusive Gateway.  For example if i want all the flows leaving from an exclusive gateway, what API call should i use?

I can see this from the bpmn xml but, i want an api which can give me the above behavior.

Thanks in advance,
Raj
3 REPLIES 3

jbarrez
Star Contributor
Star Contributor
One way is to override the ExclusiveGatewayBehavior and add your own logic:

example from the userguide:


  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);
  }

kethur
Champ in-the-making
Champ in-the-making
But I think this is for different purpose.  To use this, i have to start the process and then, until the process reaches to that task it wont get executed.  Am i right?.  It gets even harder if i have more gateways.  But my requirement is to query the gateways without going there.

By looking at the xml i can see and understand which are the flows that are coming out of the exclusive gateway.  All i need is an API which can give me the transitions.  I am not sure if this API is there in the current version or it will be done in the future versions of Activiti.

For now, my option is to write a custom parser to parse the xml to get the above thing done.  Could you let me know if there is a better way please?

Thanks,
Raj

frederikherema1
Star Contributor
Star Contributor
Try using repositoryServiceImpl.getDeployedProcessDefinition(id) and run through the activity-tree and transitions, starting at ReadonlyProcessDefinition.getInitial().
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.