- jBPM5 Tutorial
- jBPM5 - Home
- jBPM5 - Overview
- jBPM5 - Eclipse Plugin
- jBPM5 - Hello World!
- jBPM5 - Components
- jBPM5 - Workflow Components
- Draw & Validate a Workflow
- jBPM5 - Example
- jBPM5 Useful Resources
- jBPM5 - Quick Guide
- jBPM5 - Useful Resources
- jBPM5 - Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
jBPM5 - Draw & Validate a Workflow
To draw a workflow, you can use any of the components available in the palette as described in above article. All the workflow will have one start but it can have multiple end.
With the help of screenshots, I will depict you how to create a workflow.
Here, I’ve opened the blank rf or bpmn file
To add any event, select the particular event from Components Palette and drag and drop to right hand side. For example, I selected the start event and dragged it to right hand side and also a diverge gateway.
Now, one needs to connect the two components. Select the Sequence flow and connect the two components.
This way you can drag the components to the editor and use the sequence flow to join the different components. One just needs to take care that some components will have one incoming and one outgoing connection only and needs to set the sequence flow accordingly to create a meaningful flow.
One needs to set some properties as well while we draw the workflow. Will post all the properties to set here. I have just created a flow but it won't be very meaningful to look at it at first instant as I haven't set any properties in the workflow created.
As you can see above, it's a blank workflow without any description as such and one cannot make out anything from the workflow created.
However, to explain further, I have a start component and then a diverge gateway and depending on the condition of the diverge gateway, I will choose one way and execute some code in the script task and then end the workflow. So I need to set properties for the diverge gateway, then the script task and the converge gateway.
At this stage i will also show you that my workflow has some errors and later will show you once I set the properties there would be no errors in my workflow, Hence showing you how to VALIDATE the workflow created.
Tip − Remember that validator's are on under Windows → Preferences → Validation
Below screenshot shows the settings in eclipse.
As per the screenshot, you can see that there are 4 errors. The first error says script has no action and then another error is the gateway's defined have no type defined. Hence, we need to remove these errors to be able to run the workflow.
We will now set properties one by one and see the errors fading away.
Select the first gateway(diverge) and click on properties, then click on type and select the gate as per your requirement.
Once you have selected the gateway then you need to select a constraint.
Click on the circle marked red, you will see below screenshot
Click on edit and fill the details as per the screenshot −
Click on Import and import the class on which we would be performing any operation. In the screenshot, we have imported passenger POJO which we will be using in our example.
Similarly, fill the details for another constraint −
Now, click the OK button.
Again click OK. Now, select the script task and do the same process as you did for diverge gateway.
We have just added a SOP (print statement) to show the flow. Any java or mvel code can be written in the script task.
Similarly add the code for second constraint −
Finally, you need to add the gateway type for the diverge gateway.
Now, save the workflow file and go to problems view. All the problems will be resolved.
No errors in the problem view suggests that, there is no error in the workflow created. This is how a workflow is created as well as validated in jBPM.