We will implement a process with a parallel gateway by performing the following steps:
<startEvent id="sid-2BB933AE-E0AE-48D2-9ACC-B5EC35AD3687"> <extensionElements> <activiti:formProperty id="empName" name="Employee Name" type="string" required="true"></activiti:formProperty> <activiti:formProperty id="empDesignation" name="Employee Designation" type="string" required="true"></activiti:formProperty> <activiti:formProperty id="empLeaveReason" name="Leave Reason" type="string" required="true"></activiti:formProperty> <activiti:formProperty id="empLeaveDays" name="No of Days Leave " type="long" required="true"></activiti:formProperty> </extensionElements> </startEvent>
<userTask id="sid-03BC7128-4496-4027-88A9-E67D3DA63734" name="Project Manager" activiti:assignee="gonzo"> <extensionElements> <activiti:formProperty id="eName" name="Employee Name" type="string" expression="${empName}" writable="false"></activiti:formProperty> <activiti:formProperty id="eDesig" name="Employee Designation" type="string" expression="${empDesignation}" writable="false"></activiti:formProperty> <activiti:formProperty id="eLeaveReason" name="Leave Reason" type="string" expression="${empLeaveReason}" writable="false"></activiti:formProperty> <activiti:formProperty id="eLeaveDays" name="Leave Days" type="long" expression="${empLeaveDays}" writable="false"></activiti:formProperty> <activiti:formProperty id="pmDecision" name="Do You Approve ?" type="enum" required="true"> <activiti:value id="true" name="Yes"></activiti:value> <activiti:value id="false" name="No"></activiti:value> </activiti:formProperty> <activiti:formProperty id="pmComment" name="Your Comment" type="string" required="true"></activiti:formProperty> </extensionElements> </userTask> <userTask id="sid-7581049C-894E-4FF9-B861-7DF44B7229E3" name="Team Leader" activiti:assignee="fozzie"> <extensionElements> <activiti:formProperty id="eName" name="Employee Name" type="string" expression="${empName}" writable="false"></activiti:formProperty> <activiti:formProperty id="eDesig" name="Employee Designation" type="string" expression="${empDesignation}" writable="false"></activiti:formProperty> <activiti:formProperty id="eLeaveReason" name="Leave Reason" type="string" expression="${empLeaveReason}" writable="false"></activiti:formProperty> <activiti:formProperty id="eLeaveDays" name="Leave Days" type="long" expression="${empLeaveDays}" writable="false"></activiti:formProperty> <activiti:formProperty id="tlDecision" name="Do You Approve ?" type="enum" required="true"> <activiti:value id="true" name="Yes"></activiti:value> <activiti:value id="false" name="No"></activiti:value> </activiti:formProperty> <activiti:formProperty id="tlComment" name="Your Comment" type="string" required="true"></activiti:formProperty> </extensionElements> </userTask>
Team Leader
and Project Manager
tasks that are to be executed in parallel, as shown in the following code:<sequenceFlow id="flow1" sourceRef="sid-2BB933AE-E0AE-48D2-9ACC-B5EC35AD3687" targetRef="parallelgateway1"></sequenceFlow> <parallelGateway id="parallelgateway1" name="Parallel Gateway"></parallelGateway> <sequenceFlow id="flow2" sourceRef="parallelgateway1" targetRef="sid-03BC7128-4496-4027-88A9-E67D3DA63734"></sequenceFlow> <sequenceFlow id="flow3" sourceRef="parallelgateway1" targetRef="sid-7581049C-894E-4FF9-B861-7DF44B7229E3"></sequenceFlow>
Human Resource
user task where all the details from the employee, project manager, and team leader will be viewed, and based on the results of the Project Manager
and Team Leader
tasks, HR will either approve or reject the leave, as shown in the following code:<userTask id="usertask1" name="Human Resource"> <extensionElements> <activiti:formProperty id="eName" name="Employee Name" type="string" expression="${empName}" writable="false"></activiti:formProperty> <activiti:formProperty id="eDesig" name="Employee Designation" type="string" expression="${empDesignation}" writable="false"></activiti:formProperty> <activiti:formProperty id="eLeaveReason" name="Leave Reason" type="string" expression="${empLeaveReason}" writable="false"></activiti:formProperty> <activiti:formProperty id="eLeaveDays" name="Leave Days" type="long" expression="${empLeaveDays}" writable="false"></activiti:formProperty> <activiti:formProperty id="hrDecision" name="Do You Approve ?" type="enum" required="true"> <activiti:value id="true" name="Yes"></activiti:value> <activiti:value id="false" name="No"></activiti:value> </activiti:formProperty> <activiti:formProperty id="hrComment" name="Your Comment" type="string" required="true"></activiti:formProperty> <activiti:formProperty id="tlComments" name="TL Comments" type="string" expression="${tlComment}" writable="false"></activiti:formProperty> <activiti:formProperty id="pmComments" name="Project Manager Comments" type="string" expression="${pmComment}" writable="false"></activiti:formProperty> </extensionElements> </userTask>
<sequenceFlow id="flow5" sourceRef="usertask1" targetRef="sid-65043A85-6BAD-4616-AD1E-FF3FA8D64D4B"></sequenceFlow> <sequenceFlow id="flow6" sourceRef="sid-03BC7128-4496-4027-88A9-E67D3DA63734" targetRef="parallelgateway2"></sequenceFlow> <sequenceFlow id="flow7" sourceRef="sid-7581049C-894E-4FF9-B861-7DF44B7229E3" targetRef="parallelgateway2"></sequenceFlow> <sequenceFlow id="flow8" sourceRef="parallelgateway2" targetRef="usertask1"></sequenceFlow> <parallelGateway id="parallelgateway2" name="Exclusive Gateway"></parallelGateway>
gonzo
as the user, as we have assigned the Project Manager
task to him. The values added by the employee will be visible to him; now, the PM can accept or reject the leave and provide comments as shown in the following screenshot:fozzie
, as the Team Leader
task is assigned to him. Here, too, the details added by the employee will be available, as you can view in the following screenshot:kermit
, as he is assigned the Human Resource
task. In this task, the details provided by the employee as well as the comments provided by the PM and TL will be available, as shown in the following screenshot: