I’m trying to get all possible outgoing transitions from one task.
I have the taskId and I used it in taskService to get the task. This task is defined as a userTask. I was planning to get outgoing flows from that user task, but when I try to cast the task loaded from the taskService I got a classCastException.
Task tarefa = taskService.createTaskQuery().taskId(idTarefa).singleResult();
if (tarefa instanceof UserTask) {
UserTask tarefaUsuario = (UserTask)tarefa;
List<SequenciaFluxo> fluxos = new ArrayList<>();
for(SequenceFlow sf : tarefaUsuario.getOutgoingFlows()){
SequenciaFluxo fluxo = new SequenciaFluxo(sf.getName(), sf.getConditionExpression());
fluxos.add(fluxo);
}
return fluxos;
if I try to cast to UserTask i got the error:
Cannot cast ‘org.flowable.task.service.impl.persistence.entity.TaskEntityImpl’ to ‘org.flowable.bpmn.model.UserTask’
What is the correct way to get the userTask and then get the outgoing flows?
You need to identify the process definition from the process Instance and then load the process definition XML using BPMNParser. Then you willbe able to get the UserTask and its flows. The one you are accessing is an instance of a process definition and what you are looking for is the actual process definition.
Thank you for the awsers.
I got the outgoing flows from bpmModel, but it was not what I was looking for.
I defined a process with a UserTask. I want to know what are all possible paths for the user from this task. With the sugestions I got the outgoing as a sequenceFlow, but what I want is the outgoing from the exclusiveGateway that is connected as the target of the sequenceFlow.