JBoss.orgCommunity Documentation

Chapter 4. BPMN 2.0

4.1. Business Process Model and Notation (BPMN) 2.0 specification
4.2. Examples
4.3. Supported elements / attributes
The primary goal of BPMN is to provide a notation that is readily understandable by all business users,
from the business analysts that create the initial drafts of the processes, to the technical developers
responsible for implementing the technology that will perform those processes, and finally, to the
business people who will manage and monitor those processes."

The Business Process Model and Notation (BPMN) 2.0 specification is an OMG specification that not only defines a standard on how to graphically represent a business process (like BPMN 1.x), but now also includes execution semantics for the elements defined, and an XML format on how to store (and share) process definitions.

jBPM5 allows you to execute processes defined using the BPMN 2.0 XML format. That means that you can all the different jBPM5 components to model, execute, manage and monitor your business processes using the BPMN 2.0 format for specifying your executable business processes. Actually, the full BPMN 2.0 specification also includes details on how to represent things like choreographies and and collaboration. The jBPM project however focuses on that part of the specification that can be used to specify executable processes.

jBPM5 does not implement all elements and attributes as defined in the BPMN 2.0 specification. We do however support a significant subset, including the most common node types that can be used inside executable processes. This includes (almost) all elements and attributes as defined in the "Common Executable" subclass of the BPMN 2.0 specification, extended with some additional elements and attributes we believe are valuable in that context as well. The full set of elements and attributes that are supported can be found below, but it includes elements like:

For example, consider the following "Hello World" BPMN 2.0 process, which does nothing more that writing out a "Hello World" statement when the process is started.

An executable version of this process expressed using BPMN 2.0 XML would look something like this:


<?xml version="1.0" encoding="UTF-8"?> 
<definitions id="Definition"
             targetNamespace="http://www.example.org/MinimalExample"
             typeLanguage="http://www.java.com/javaTypes"
             expressionLanguage="http://www.mvel.org/2.0"
             xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
             xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
             xs:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"
             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.HelloWorld" name="Hello World" >

    <!-- nodes -->
    <startEvent id="_1" name="StartProcess" />
    <scriptTask id="_2" name="Hello" >
      <script>System.out.println("Hello World");</script>
    </scriptTask>
    <endEvent id="_3" name="EndProcess" >
        <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="Minimal" >
      <bpmndi:BPMNShape bpmnElement="_1" >
        <dc:Bounds x="15" y="91" width="48" height="48" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="_2" >
        <dc:Bounds x="95" y="88" width="83" height="48" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="_3" >
        <dc:Bounds x="258" y="86" width="48" height="48" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="_1-_2" >
        <di:waypoint x="39" y="115" />
        <di:waypoint x="75" y="46" />
        <di:waypoint x="136" y="112" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="_2-_3" >
        <di:waypoint x="136" y="112" />
        <di:waypoint x="240" y="240" />
        <di:waypoint x="282" y="110" />
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>

</definitions>

To create your own process using BPMN 2.0 format, you can

The following code fragment shows you how to load a BPMN2 process into your knowledge base ...

private static KnowledgeBase createKnowledgeBase() throws Exception {

  KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
  kbuilder.add(ResourceFactory.newClassPathResource("sample.bpmn2"), ResourceType.BPMN2);
  return kbuilder.newKnowledgeBase();
}

... and how to execute this process ...

KnowledgeBase kbase = createKnowledgeBase();

StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
ksession.startProcess("com.sample.HelloWorld");

The BPMN 2.0 specification defines the attributes and semantics of each of the node types (and other elements).

The jbpm-bpmn2 module contains a lot of junit tests for each of the different node types. These test processes can also serve as simple examples: they don't really represent an entire real life business processes but can definitely be used to show how specific features can be used. For example, the following figures shows the flow chart of a few of those examples. The entire list can be found in the src/main/resources folder for the jbpm-bpmn2 module like here.

Table 4.1. Keywords

ElementSupported attributesSupported elementsExtension attributes
definitions rootElement BPMNDiagram 
processprocessType isExecutable name idproperty laneSet flowElementpackageName
sequenceFlowsourceRef targetRef isImmediate name idconditionExpressionbendpoints
interfacename idoperation 
operationname idinMessageRef 
laneSet lane 
lanename idflowNodeRef 
    
Events   
startEventname iddataOutput dataOutputAssociation outputSet eventDefinitionx y width height
endEventname iddataInput dataInputAssociation inputSet eventDefinitionx y width height
intermediateCatchEventname iddataOutput dataOutputAssociation outputSet eventDefinitionx y width height
intermediateThrowEventname iddataInput dataInputAssociation inputSet eventDefinitionx y width height
boundaryEventcancelActivity attachedToRef name ideventDefinitionx y width height
terminateEventDefinition   
cancelEventDefinition   
compensateEventDefinitionactivityRefdocumentation extensionElements 
conditionalEventDefinition condition 
errorEventDefinitionerrorRef  
errorerrorCode id  
escalationEventDefinitionescalationRef  
escalationescalationCode id  
messageEventDefinitionmessageRef  
messageitemRef id  
signalEventDefinitionsignalRef  
timerEventDefinition timeCycle 
    
Activities   
taskname idioSpecification dataInputAssociation dataOutputAssociationtaskName x y width height
scriptTaskscriptFormat name idscriptx y width height
script text[mixed content] 
userTaskname idioSpecification dataInputAssociation dataOutputAssociation resourceRolex y width height
potentialOwner resourceAssignmentExpression 
resourceAssignmentExpression expression 
businessRuleTaskname id x y width height ruleFlowGroup
manualTaskname id x y width height
sendTaskmessageRef name idioSpecification dataInputAssociationx y width height
receiveTaskmessageRef name idioSpecification dataOutputAssociationx y width height
serviceTaskoperationRef name idioSpecification dataInputAssociation dataOutputAssociationx y width height
subProcessname idflowElement property loopCharacteristicsx y width height
adHocSubProcesscancelRemainingInstances name idcompletionCondition flowElement propertyx y width height
callActivitycalledElement name idioSpecification dataInputAssociation dataOutputAssociationx y width height waitForCompletion independent
multiInstanceLoopCharacteristics loopDataInputRef inputDataItem 
    
Gateways   
parallelGatewaygatewayDirection name id x y width height
eventBasedGatewaygatewayDirection name id x y width height
exclusiveGatewaydefault gatewayDirection name id x y width height
inclusiveGatewaydefault gatewayDirection name id x y width height
    
Data   
propertyitemSubjectRef id  
dataObjectitemSubjectRef id  
itemDefinitionstructureRef id  
ioSpecification dataInput dataOutput inputSet outputSet 
dataInputname id  
dataInputAssociation sourceRef targetRef assignment 
dataOutputname id  
dataOutputAssociation sourceRef targetRef assignment 
inputSet dataInputRefs 
outputSet dataOutputRefs 
assignment from to 
formalExpressionlanguagetext[mixed content] 
    
BPMNDI   
BPMNDiagram BPMNPlane 
BPMNPlanebpmnElementBPMNEdge BPMNShape 
BPMNShapebpmnElementBounds 
BPMNEdgebpmnElementwaypoint 
Boundsx y width height  
waypointx y