This documentation is for WSO2 Enterprise Integrator version 6.4.0 . View documentation for the latest release.
Working with Exclusive Gateways - WSO2 Enterprise Integrator 6.4.0 - WSO2 Documentation

All docs This doc
||
Skip to end of metadata
Go to start of metadata

The following scenario simulates a simple leave approval business process, in which an employee fills a form and submits the leave request to the manager and the manager approves or rejects it. The process ends if the manager approves the request. Otherwise, if the manager rejects it, the employee will be able to resend the leave request by adjusting it. 

Before you begin,

  • Install Oracle Java SE Development Kit (JDK) version 1.8.* and set the JAVA_HOME environment variable.
  • Download the product installer from here, and run the installer.
    Let's call the installation location of your product the <EI_HOME> directory. This is located in a place specific to your OS as shown below:
    OSHome directory
    Mac OS/Library/WSO2/EnterpriseIntegrator/6.4.0
    WindowsC:\Program Files\WSO2\EnterpriseIntegrator\6.4.0\
    Ubuntu/usr/lib/wso2/EnterpriseIntegrator/6.4.0
    CentOS/usr/lib64/EnterpriseIntegrator/6.4.0
  • Select and download the relevant Enterprise Integrator tooling ZIP file depending on your operating system from here, and then extract the ZIP file. The path to this folder will be referred to as <EI_TOOLING> throughout this tutorial.

Let's get started! This tutorial includes the following sections:

Importing artifacts 

If you did not try the Working with User Tasks tutorial yet, follow the steps below to import its artifacts as you will be extending on that.

  1. Download the pre-packaged project and extract it to a preferred location. This contains the artifacts of the Working with User Tasks tutorial. 
  2. Open the WSO2 EI Tooling environment.
  3. Click File, and click Import
  4. Expand the WSO2 category, select Existing WSO2 Projects into workspace and click Next.
  5. Click Browse, select the file you extracted and upload it.  
  6. In the Package Explorer, double click on the name of the BPMN diagram to view the BPMN artifacts you imported.

Creating new artifacts

The next step of the process is defining the logic for the employee to adjust and resend the leave request if it gets rejected and for the process to end if the request gets approved. Follow the steps below to implement this logic using BPMN artifacts.

  1. Right click on the connection arrow, which connects the Review leave request User Task to the End Event and click Delete.

  2. To add a decision making notation to indicate these two actions, hover your mouse pointer over the Review leave request User Task and click on the  Exclusive Gateway icon

  3. Hover your mouse pointer over the Exclusive Gateway, and click on the arrow icon (i.e., the Create Connection option) and connect the Exclusive Gateway to the End Event.

  4. Drag and drop another User Task to the diagram.
  5. Click on the User Task, and change the value of the Name field to Adjust vacation request in the General section of the Properties tab. 


  6. Hover your mouse pointer over the Exclusive Gateway, and click on the arrow icon (i.e., the Create Connection option) and connect the Exclusive Gateway to the Adjust vacation request User Task.


  7. Hover your mouse pointer over the Adjust vacation request User Task, and click on the arrow icon (i.e., the Create Connection option) and connect the Review leave request User Task to the End Event.

Configuring the Exclusive Gateway

  1. Click on the Exclusive Gateway and enter the following details in the  General tab of the Properties tab.
      • Id:requestApprovedDecision

      • Name:Request approved?



    Now, let's add the decision logic that specifies that the process should proceed to the End Event if approved.
  2. Click on the arrow, which connects the Exclusive Gateway to the End Event and enter ${vacationApproved == 'true'} as the value for Condition in the Main config  section of the Properties tab.

    vacationApproved is the ID of the enum field you added in the Review leave request User Task.


    Now, let's add the decision logic that specifies that the process should proceed to the Adjust vacation request User Task if rejected.

  3. Click on the arrow, which connects the Exclusive Gateway to the Adjust vacation request User Task and enter ${vacationApproved == 'false'} as the value for Condiiton in the Main config  section of the Properties tab.


Configuring the Adjust vacation request User Task 

  1. Click on the Adjust vacation request User Task and set the Assignee as admin in the Main Config section of the Properties tab. 
  2. Click Form in the Properties tab of the Adjust vacation request User Task.
  3. To create the application form to resend the leave request, click New and add a new entry for each of the following fields. 

    idNameTypeDate PatternReadableWritableRequiredForm Values
    numberOfDaysNumber of dayslong-truetruetrue-
    startDateFirst day of holiday (dd-MM-yyyy)stringdd-MM-yyyy hh:mmtruetruetrue-
    vacationReasonReasonstring-truetruetrue-
    employeeNameName of employeestring-truetruetrue-
    resendRequestResend vacation request to manager?enum-truetruetrueId: true
    Name: Yes
    Id: false
    Name: No


    The properties of the Form should look like the following:

  4. Press Ctrl+S to save all the artifacts, which you created in WSO2 EI Tooling.
    The model is now complete as the necessary logic has been applied.

Deploying the artifacts

  1. For instructions on creating the deployable artifacts, see Creating the deployable archive.
  2. For instructions on deploying them, see Deploying BPMN artifacts.

Creating the user

  1. Make sure that you have started the Business Process profile of WSO2 EI.

    Open a terminal and execute the following command:

    wso2ei-6.4.0-business-process

    Go to Start Menu -> Programs -> WSO2 -> Enterprise Integrator 6.4.0 Business Process. This will open a terminal and start the business process profile.

  2. Log in to the Management Console of the Business Process profile.
  3. Click Configure → Users and Roles → Add → Add New User.
  4. Enter the below details to create a user called manager and click Next.

    Enter both the User Name and the Password as manager.


  5. In the next screen, assign the user to the admin role and click Finish.

    You view the new user you created as shown below.

Testing the output

Follow the steps below to test the output.

  1. Log in to the BPMN-explorer at https://localhost:9445/bpmn-explorer using admin for both the username and password.
  2. Click PROCESSES in the top menu, and click the Start option of the Leave Approval Process.
  3. Initiate the process by filling the form and click Start.

    You view a pop-up message upon successful process initiation.

  4. Initiate the process again by filling the form again and click Start.

    You create two tasks to test the output of both leave approval and leave rejection. 


  5. Log out and log in again using manager/manager credentials. 
  6. Click TASKS and then click MY TASKS. You view two tasks created.
  7. Click on the first task, select Approve from the drop down list and click Complete Task.

    You view the task in the TASKS → COMPLETED TASKS list. Also, you will not view any tasks created if you log out and log in again using admin/admin credentials and click TASKS → MY TASKS.
  8. Click TASKS and then click MY TASKS again, click on the second task, which is left now, select Reject from the drop down list and click Complete Task.

  9. Log out and log in again with admin/admin credentials, and click TASKS → MY TASKS
    You view the Adjust vacation request Task.

  10. Click on the Adjust vacation request Task, change the details and click Complete Task to resend the leave application. 

  11. Log out and log in again with manager/manager credentials, and click TASKS → MY TASKS
    You view another Task in TASKS → MY TASKS list, which you can approve or reject as you did before.

  • No labels