In this guide, we will discuss about processes of jBPM. JBPM process can be easily understand with the help of BPMN.
What is BPMN 2.0?
- It stands for Business Process Model and Notation.
- It is based on OMG (Object Management Group) specification.
- It is similar to flowchart diagram.
- Its primary goal is to provide a notation that is readily understandable by all business users i.e. from the business analysts, to the technical person and finally, to the business users who manage and monitor those processes.
- It does not only define a standard on how to graphically represent a business process but also includes execution of semantic for the element defined and an XML format to store process definition.
- BPMN consists of different types of nodes that are connected with each other using sequence flows. BPMN consists of three different types of nodes. They are:
- Events: Start event, End events and intermediate events.
- Activities: Script task, User task, Service task, Business Rule task etc.
- Gateways: Divergent Gateway, Convergent Gateway
Process Creation
There are three methods available to create a process:
- Using the graphical BPMN2 editor
- Defining Process using XML
- By directly creating a process using the process API.
Using the Graphical BPMN2 Editor
BPMN2 is an Eclipse plugin. It provides an editor which allows us to create a process by using drag and drop option. After creating a node using drag and drop option we can edit its properties.
To open the BPMN editor in jBPM project, Right-click the directory where we want to keep our process and Select New, then click on file, give the file name and save it with .bpmn extension. This will open up the process editor which shows in the below screen.
In this editor, we can create a process by adding node which represents the business logic that we want to specify in our Business process.
Defining Process Using XML
We can also specify the processes using BPMN2.0 XML directly. The syntax of these XML processes is defined by using the BPMN2.0 XML schema definition. The process XML file consist of two parts: The upper part and the lower part.
The upper part has the definition of the different nodes and their properties and the lower part has all graphical information. The process XML consists of only one element.
Example: Here, we create a process that contains a start event, a script task which print “Hello World” and an end event.
<?xml version="1.0" encoding="UTF-8"?> <definitions id="Definition" targetNamespace="http://www.jboss.org/drools" typeLanguage="http://www.java.com/javaTypes" expressionLanguage="http://www.mvel.org/2.0" xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"Rule Task xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" xmlns:g="http://www.jboss.org/drools/flow/gpd" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:tns="http://www.jboss.org/drools"> <process processType="Private" isExecutable="true" id="com.sample.hello" name="Hello Process" > <!-- nodes --> <startEvent id="_1" name="Start" /> <scriptTask id="_2" name="Hello" > <script>System.out.println("Hello World");</script> </scriptTask> <endEvent id="_3" name="End" > <terminateEventDefinition/> </endEvent> <!-- connections --> <sequenceFlow id="_1-_2" sourceRef="_1" targetRef="_2" /> <sequenceFlow id="_2-_3" sourceRef="_2" targetRef="_3" /> </process> <bpmndi:BPMNDiagram> <bpmndi:BPMNPlane bpmnElement="com.sample.hello" > <bpmndi:BPMNShape bpmnElement="_1" > <dc:Bounds x="16" y="16" width="48" height="48" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="_2" > <dc:Bounds x="96" y="16" width="80" height="48" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="_3" > <dc:Bounds x="208" y="16" width="48" height="48" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge bpmnElement="_1-_2" > <di:waypoint x="40" y="40" /> <di:waypoint x="136" y="40" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="_2-_3" > <di:waypoint x="136" y="40" /> <di:waypoint x="232" y="40" /> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </definitions>
Next Topic : Click Here