cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing Flow id or name from DelegateExecution

plehal
Champ in-the-making
Champ in-the-making
How do I get Flow id or name from DelegateExecution object if I am listening on a flow/transition? There does not seem to be any method inside the listener which provides access to these attributes either directly or indirectly through access to RuntimeService etc.

I know I can add fields to the flow and then access them via listeners. But, I should be able to find flow id etc. without resorting to fields.


Can someone provide some info, please?
5 REPLIES 5

gant
Champ in-the-making
Champ in-the-making
Hi,

I think, the execution passed into your notify() method implements DelegateExecution and this interfaces defines the methods you need.

Regards,
michael

plehal
Champ in-the-making
Champ in-the-making
The DelegateExecution does not seem to have any method which provides access to flow  name etc. If you know some trick to do it, please, provide some details.

gant
Champ in-the-making
Champ in-the-making

String processDefinitionName = repositoryService.createProcessDefinitionQuery().processDefinitionId(runtimeService.createProcessInstanceQuery().processInstanceId(execution.getProcessInstanceId).getProcessDefinitionId()).getName();

plehal
Champ in-the-making
Champ in-the-making
How do you get repositoryService or any service for that matter from DelegateExecution because at that time only object that is passed to the method is DelegateExecution?

gant
Champ in-the-making
Champ in-the-making
This should help: http://www.activiti.org/userguide/index.html#apiEngine

ProcessEngines.getDefaultProcessEngine() will initialize and build a process engine the first time it is called and afterwards always return the same process engine.