What is the purpose of Lanes?

I want to understand the use cases of Pool and Lane in particular. Is it only there for a better logical display of the process or has some functional use as well?

For instance, can I fetch all user tasks in a lane and assign a user to it, fetch tasks from another lane and assign another user?

@Avakash_Kumbhar

  • Swimlanes represent participants of a business process.
  • A swimlane may contains flow objects that are performed by that lane (participant).
  • Swim lanes within a pool show the activities and flows for a certain role or participant, defining who is accountable for what parts of the process.
  • Swimlanes just adds an extra level of clarity about who does what to process flowcharts.

So that taskservice doesn’t return the usertasks directly which is associated with the specific lanes. One other option could be, parsing entire bpmn model instance and collect task definition key of that lane and then search using taskDefinitionKey like below:

// parse bpmn process model and extract taskDefinitionKeys to query active tasks for a swimlane
public void getTaskItemsForLanes(String processDefinitionKey, String[] taskDefinitionKeys) {
	List<Task> taskList = taskService.createTaskQuery().processDefinitionKey(processDefinitionKey)
			.taskDefinitionKeyIn(taskDefinitionKeys).active().list();
	taskList.forEach(task -> task.setAssignee("adminUser"));
}

Best practices of modelling lanes and assignments:


BPMN Swimlanes should always display the names of the ROLES that people assume by participating in the processes.


When I checked the XML of the bpmn file, I can see that all tasks are listed under the respective lanes.

image

Is there any possible way to get a list of these tasks without having to parse the XML file itself? May be some methods on BpmnModelInstance or repositoryService?