Hi guys,
Thanks very much for your replies and sorry for delay in replying - went for a short holidays …
Right - it would make sense - it is synchronous process.
It might be slightly now off topic but here is what I try to achieve:
1) I have my own wrapper around JavaDelegate - it's purpose is to implement a progress handling so on my UI when particular activiti (JavaDelegate) is running I get a progress bar which is updated now and then.
2) Of course I don't want to limit process definition to include only JavaDelegates. So I also want to display information about how many
activities there are defined in a process, how many of them have already run (so I can see how many left to run) and what is the current activiti name running.
So far what I have done to achieve it is that I have my own service layer which starts the process and it implements the ActivitiEventListener.
On PROCESS_STARTED I do:
<code>
List<String> completedTasks = new ArrayList<String>();
runtimeService.setVariable(event.getExecutionId(), "completed-tasks", completedTasks);
</code>
and on ACTIVITI_COMPLETED I do:
<code>
List<String> tasks = (List<String>) runtimeService.getVariable(event.getExecutionId(), "completed-tasks");
if (ActivitiActivityEvent.class.isAssignableFrom(event.getClass())) {
ActivitiActivityEvent activitiEvent = (ActivitiActivityEvent) event;
tasks.add(activitiEvent.getActivityName());
}
</code>
So here is my problem:
1) The process can be asynchronous so my assumption (have not verified it yet) is that event.getExecutionId() will be different for each activity ?
In that case - is there a way to get the "most parent" id of the process which would be the BPMN execution ID ?
2) A process defined in BPMN file can be set to be synchronous - so it seems I cannot use the execution query as it will be empty …
The bottom line is - how do I get at any point the number of activities in a process with ability to say which ones have already completed ?
Many thanks for your input - much appreciated.
Adrian