API: retrieve name of a gateway default transition

Hello,

I have designed a workflow with an exclusive gateway with one conditional transition and the mandatory default one. In the designer the 'name' attribute is populated.

When I retrieve the transitions from the API, for the conditional transition, the name defined in the designer is the condition name (gateway.transition.condition.name). But for the default transition, no condition is defined so I cannot figure out how to retrieve the name defined in the designer.

Is there a way to retrieve the name of the default transition ?

Thanks in advance

Hi,

You can do that through the DesignProcessDefinition API. The getFlowElementContainer() method returns all the flow elements (activities, gateways, events and transitions for a particular process).

best

Hi,

I tried using this DesignProcessDefinition API but no way to retrieve the displayName defined in designer for the transitions.

Here is the code I tried, I can't figure out what I am doing wrong :

private void example(long processDefinitionId, long gatewayId) throws Exception {
    FlowElementContainerDefinition elementContainer = processAPI.get().getDesignProcessDefinition(processDefinitionId).getFlowElementContainer();
    FlowNodeDefinition gatewayDefinition = elementContainer.getFlowNode(gatewayId);
    TransitionDefinition transitionDefinition = elementContainer.getTransitions().stream().filter(tr -> tr.getId() == gatewayDefinition.getDefaultTransition().getId()).findAny().orElse(null);
    System.out.println("Gateway[" + gatewayDefinition.getName() + "].defaultTransition[" + transitionDefinition.getName() + "]");
}

First, TransitionDefinition.getName() is deprecated

Second, the output of TransitionDefinition.getName() is a technical name like <sourceId> -> <targetId>

Thanks for your help