How to get Flowable process Information at run time


#1

I have a Flowable process in my spring boot project. Is there any way I can get list of all the task that are involved in my process as I am unable to get process modeler or UI of .bpmn20.xml file

Is there any way to get the complete list of .bpmn20.xml file
OR
meta data of that process.


#2

Hi @sagaraa

You can try this rough and ready code:

final List<FlowElement> userTasks = repositoryService.getBpmnModel(<your_process_id>)
            .getMainProcess()
            .getFlowElements()
            .stream()
            .filter(UserTask.class::isInstance)
            .collect(Collectors.toList());

It finds user tasks inside main process.


#3

I believe that there is better way to fetch user tasks, but I don’t know it :slight_smile:


#4

Hi, Thanks for quick reply
Actually I am looking for all task(including user, http service) which gets executed or which will be executed

In my example every task is getting executed except “THIS SHOULD NOT APPEAR”,
So, I want a list of all tasks except “THIS SHOULD NOT APPEAR”


#5

Also excluding sequenceflow


#6

@rgorzkowski
I found a temporary solution, I got the result by directly interacting with the database, Table ACT_HI_ACTINST contains we have to use the proper processDefinition Id,

select ACT_NAME_ from dbo.ACT_HI_ACTINST where PROC_DEF_ID_=processDefinitionId

Is there API call for the same.


#7

@sagaraa you can query on all executed activities (user task, service task etc) by going through the HistoricActivityInstanceQuery. This can be created via the HistoryService#createHistoricActivityInstanceQuery().

If you want to get all possible tasks you will have to use the BpmnModel. Have a look at the reply from @rgorzkowski How to get Flowable process Information at run time