Show Table of Contents
Chapter 11. Working with Processes
11.1. BPMN 2.0 Notation
11.1.1. Business Process Model and Notation (BPMN) 2.0 Specification
The Business Process Model and Notation (BPMN) 2.0 specification defines a standard for graphically representing a business process; it includes execution semantics for the defined elements and an XML format to store and share process definitions.
The table below shows the supported elements of the BPMN 2.0 specification and includes some additional elements and attributes.
Table 11.1. BPMN 2.0 Supported Elements and Attributes
| Element | Supported attributes | Supported elements | Extension attributes | Extension elements |
|---|---|---|---|---|
| definitions | rootElement BPMNDiagram | |||
| process | processType isExecutable name id | property laneSet flowElement | packageName adHoc version | import global |
| sequenceFlow | sourceRef targetRef isImmediate name id | conditionExpression | priority | |
| interface | name id | operation | ||
| operation | name id | inMessageRef | ||
| laneSet | lane | |||
| lane | name id | flowNodeRef | ||
| import* | name | |||
| global* | identifier type | |||
| Events | ||||
| startEvent | name id | dataOutput dataOutputAssociation outputSet eventDefinition | x y width height | |
| endEvent | name id | dataInput dataInputAssociation inputSet eventDefinition | x y width height | |
| intermediateCatchEvent | name id | dataOutput dataOutputAssociation outputSet eventDefinition | x y width height | |
| intermediateThrowEvent | name id | dataInput dataInputAssociation inputSet eventDefinition | x y width height | |
| boundaryEvent | cancelActivity attachedToRef name id | eventDefinition | x y width height | |
| terminateEventDefinition | ||||
| compensateEventDefinition | activityRef | documentation extensionElements | ||
| conditionalEventDefinition | condition | |||
| errorEventDefinition | errorRef | |||
| error | errorCode id | |||
| escalationEventDefinition | escalationRef | |||
| escalation | escalationCode id | |||
| messageEventDefinition | messageRef | |||
| message | itemRef id | |||
| signalEventDefinition | signalRef | |||
| timerEventDefinition | timeCycle timeDuration | |||
| Activities | ||||
| task | name id | ioSpecification dataInputAssociation dataOutputAssociation | taskName x y width height | |
| scriptTask | scriptFormat name id | script | x y width height | |
| script | text[mixed content] | |||
| userTask | name id | ioSpecification dataInputAssociation dataOutputAssociation resourceRole | x y width height | onEntry-script onExit-script |
| potentialOwner | resourceAssignmentExpression | |||
| resourceAssignmentExpression | expression | |||
| businessRuleTask | name id | x y width height ruleFlowGroup | onEntry-script onExit-script | |
| manualTask | name id | x y width height | onEntry-script onExit-script | |
| sendTask | messageRef name id | ioSpecification dataInputAssociation | x y width height | onEntry-script onExit-script |
| receiveTask | messageRef name id | ioSpecification dataOutputAssociation | x y width height | onEntry-script onExit-script |
| serviceTask | operationRef name id | ioSpecification dataInputAssociation dataOutputAssociation | x y width height | onEntry-script onExit-script |
| subProcess | name id | flowElement property loopCharacteristics | x y width height | |
| adHocSubProcess | cancelRemainingInstances name id | completionCondition flowElement property | x y width height | |
| callActivity | calledElement name id | ioSpecification dataInputAssociation dataOutputAssociation | x y width height waitForCompletion independent | onEntry-script onExit-script |
| multiInstanceLoopCharacteristics | loopDataInputRef inputDataItem | |||
| onEntry-script* | scriptFormat | script | ||
| onExit-script* | scriptFormat | script | ||
| Gateways | ||||
| parallelGateway | gatewayDirection name id | x y width height | ||
| eventBasedGateway | gatewayDirection name id | x y width height | ||
| exclusiveGateway | default gatewayDirection name id | x y width height | ||
| inclusiveGateway | default gatewayDirection name id | x y width height | ||
| Data | ||||
| property | itemSubjectRef id | |||
| dataObject | itemSubjectRef id | |||
| itemDefinition | structureRef id | |||
| ioSpecification | dataInput dataOutput inputSet outputSet | |||
| dataInput | name id | |||
| dataInputAssociation | sourceRef targetRef assignment | |||
| dataOutput | name id | |||
| dataOutputAssociation | sourceRef targetRef assignment | |||
| inputSet | dataInputRefs | |||
| outputSet | dataOutputRefs | |||
| assignment | from to | |||
| formalExpression | language | text[mixed content] | ||
| BPMNDI | ||||
| BPMNDiagram | BPMNPlane | |||
| BPMNPlane | bpmnElement | BPMNEdge BPMNShape | ||
| BPMNShape | bpmnElement | Bounds | ||
| BPMNEdge | bpmnElement | waypoint | ||
| Bounds | x y width height | |||
| waypoint | x y | |||
11.1.2. BPMN 2.0 Process Example
Here is a BPMN 2.0 process that prints out a "Hello World" statement when the process is started:
<?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>11.1.3. Supported Elements and Attributes in BPMN 2.0 Specification
JBoss BPM Suite 6 does not implement all elements and attributes as defined in the BPMN 2.0 specification. However, we do support significant node types that you can use 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:
- Flow objects
- Events
- Start Event (None, Conditional, Signal, Message, Timer)
- End Event (None, Terminate, Error, Escalation, Signal, Message, Compensation)
- Intermediate Catch Event (Signal, Timer, Conditional, Message)
- Intermediate Throw Event (None, Signal, Escalation, Message, Compensation)
- Non-interrupting Boundary Event (Escalation, Signal, Timer, Conditional, Message)
- Interrupting Boundary Event (Escalation, Error, Signal, Timer, Conditional, Message, Compensation)
- Activities
- Script Task
- Task
- Service Task
- User Task
- Business Rule Task
- Manual Task
- Send Task
- Receive Task
- Reusable Sub-Process (Call Activity)
- Embedded Sub-Process
- Event Sub-Process
- Ad-Hoc Sub-Process
- Data-Object
- Gateways
- Diverging
- Exclusive
- Inclusive
- Parallel
- Event-Based
- Converging
- Exclusive
- Inclusive
- Parallel
- Lanes
- Data
- Java type language
- Process properties
- Embedded Sub-Process properties
- Activity properties
- Connecting objects
- Sequence flow
11.1.4. Loading and Executing a BPMN2 Process Into Repository
The following example shows how you can load a BPMN2 process into your knowledge base:
import org.kie.api.KieServices;
import org.kie.api.builder.KieRepository;
import org.kie.api.builder.KieFileSystem;
import org.kie.api.builder.KieBuilder;
import org.kie.api.runtime.KieContainer;
import org.kie.api.KieBase;
...
KieServices kServices = KieServices.Factory.get();
KieRepository kRepository = kServices.getRepository();
KieFileSystem kFileSystem = kServices.newKieFileSystem();
kFileSystem.write(ResourceFactory.newClassPathResource("MyProcess.bpmn"));
KieBuilder kBuilder = kServices.newKieBuilder(kFileSystem);
kBuilder.buildAll();
KieContainer kContainer = kServices.newKieContainer(kRepository.getDefaultReleaseId());
KieBase kBase = kContainer.getKieBase();
Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.