The following scenario simulates the first step of a business process, in which an employee fills a form and submits the leave request to the manager. You can implement this by configuring a Start Event in the BPMN Diagram.
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.If you installed the product using the installer, this is located in a place specific to your OS as shown below:
OS Home directory Mac OS /Library/WSO2/EnterpriseIntegrator/6.5.0
Windows C:\Program Files\WSO2\EnterpriseIntegrator\6.5.0\
Ubuntu /usr/lib/wso2/EnterpriseIntegrator/6.5.0
CentOS /usr/lib64/EnterpriseIntegrator/6.5.0
Select and download the relevant Enterprise Integrator tooling ZIP file depending on your operating system from here, and then extract the ZIP file.
- For more detailed installation instructions, see Installing WSO2 Integration Studio.
- For information on any error messages you get, see the troubleshooting tips given under Troubleshooting WSO2 Integration Studio.
Let's get started! This tutorial includes the following sections:
Creating a BPMN Project
You will find a BPMN editor packaged along with WSO2 Integration Studio. This BPMN editor can be used to create a BPMN artifact easily.
Before you begin:
Download and install the WSO2 Integration Studio. For more information, see Installing WSO2 Integration Studio.
- Open the WSO2 Integration Studio. In the Getting Started page, click BP Project, and then click Create New BPMN.
The Create an Activity Project wizard opens. - Enter a project name (e.g.,
LeaveProcessBPMN
) and click Next. - In the next window that appears, select any of the available referenced projects and click Finish.
Click Open Perspective in the following message that appears.
You will not get this message if you are already in the Activiti perspective. You can view the current perspective by clicking on the icon on the top panel that is marked in the following image.
Creating the BPMN Diagram
After creating the BPMN project, follow the steps below to add a BPMN diagram to it.
- Right-click on your BPMN project found on the left pane of your Integration Studio window and select New → Other.
- In the Select a Wizard dialog box that opens, expand WSO2 → BPMN, and click BPMN Diagram. Then click Next.
- Enter a file name (e.g.,
LeaveRequest.bpmn
), select theBPMNProject/src/main/resources/diagrams
directory as the parent directory, and click Next. Select a template diagram or create a new empty diagram. For this example, select No, just create an empty diagram to start editing, and click Finish.
In the Activity Explorer view, you view the BPMN diagram added under the project you specified and a new empty canvas opens along with a Palette. You can use the palette to drag and drop artifact symbols to create the desired diagram.
Click anywhere on the canvas, and click Process in the Properties tab, to change the ID, name and namespace of the process that is created once you deploy the BPMN Project.
Save both the BPMN Diagram and the BPMN Project you created.
Configuring the Start Event
To implement the leave approval process, drag a Start Event to the design canvas.
Every BPMN process should start with a Start Event and end with an End Event.
- To implement the scenario, in which the employee submits a leave application form, click Form in the Properties tab of the Start Event.
To create the application form, click New and add a new entry for each of the following fields.
id Name Type Date Pattern Readable Writable Required numberOfDays Number of days long - true true true startDate First day of holiday (dd-MM-yyyy) string dd-MM-yyyy hh:mm true true true vacationReason Reason string - true true true employeeName Name of employee string - true true true - To add an admin user as the initiator of the process, enter
admin
as the value of the Initiator field in the Main Config section of the Properties tab. - Add an End Event to the diagram and connect the Start Event to it.
- Save all the artifacts that you created.
Creating the deployable archive
- Save all the artifacts that you created in WSO2 Integration Studio.
Right click on the name of the project in the Package Explorer window, and click Create deployment artifacts.
If you do not have the Package Explorer view, click Window → Show View → Other, select Package Explorer and open it.
This creates the BAR file under the deployment folder of the project. This archive file contains of all the artifacts of your BPMN project for you to deploy it in the Business Process profile of WSO2 EI.
Deploying BPMN artifacts
After you create the deployable archive, follow the steps below to deploy them.
Start the Business Process profile of WSO2 EI.
In a web browser, open the Management Console of the Business Process profile, and log in with the default credentials (username:
admin
and password:admin
).Click Main → Manage → Processes → Add → BPMN, browse the BAR file of the BPMN Project and click Upload.
If you are unable to locate the BAR file, right click on the name of the BAR file in the Package Explorer window and click Properties to find it as shown below.
If you upload a package with an existing name, the processes in the package gets versioned. This retires all the old processes in the package and deploys the new version. Since only package-level versioning is available, the new package includes all the processes defined in the old package, even though you may only need to update a single process in that package.
Once you uploaded the artifacts successfully you can view the new processes added to the list as shown below.
If you do not view the new processes, refresh the browser or click Main → Manage → Processes → List → BPMN.
Testing the output
Follow the steps below to test the output.
- Log in to the BPMN-explorer at https://localhost:9445/bpmn-explorer using
admin
for both the username and password. - Click PROCESSES in the top menu, and click the Start option of the Leave Approval Process.
Initiate the process by filling the form and click Start.
You view the following message.