Skip to content

Instantly share code, notes, and snippets.

@menski
menski / listener.cmmn.xml
Last active August 29, 2015 14:05
CMMN Listener
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<definitions id="_7f0c94c0-2a22-445d-b4b7-4fd181e08248"
xmlns="http://www.omg.org/spec/CMMN/20131201/MODEL"
xmlns:camunda="http://camunda.org/schema/1.0/cmmn"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
targetNamespace="Examples">
<case id="case" name="Case">
<casePlanModel id="CasePlanModel_1">
@menski
menski / install-java.sh
Last active August 29, 2015 14:04
Install oracle java 7 on ubuntu
#!/bin/bash
apt-get update
apt-get install -y software-properties-common
apt-add-repository ppa:webupd8team/java
apt-get update
echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections
apt-get install -y oracle-java7-installer
@menski
menski / soapEnvelope.ftl
Created July 22, 2014 02:44
SOAP Envelope FreeMarker template
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:web="http://www.webserviceX.NET">
<soap:Header/>
<soap:Body>
<web:GetWeather>
<!--Optional:-->
<web:CityName>${city}</web:CityName>
<!--Optional:-->
<web:CountryName>${country}</web:CountryName>
</web:GetWeather>
</soap:Body>
@menski
menski / templateServiceTask.xml
Last active August 29, 2015 14:04
Example service task with a template as input parameter mapping
<bpmn2:serviceTask id="emailTask" name="Send email" camunda:class="org.camunda.bpm.examples.EmailService">
<bpmn2:extensionElements>
<camunda:inputOutput>
<camunda:inputParameter name="emailBody">
<camunda:script scriptFormat="freemarker">
<![CDATA[
Dear ${customer},
Welcome to camunda BPM ${version}. Please visit one of these links
for more information about camunda BPM:
@menski
menski / scriptingEverywhere.xml
Created July 21, 2014 07:39
Scripting everywhere in camunda BPM example
<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" 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:camunda="http://activiti.org/bpmn" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="_1KLIwBCfEeS575qdd8CgmQ" exporter="camunda modeler" exporterVersion="2.6.0" targetNamespace="http://activiti.org/bpmn">
<bpmn2:process id="scriptingEverywhere" name="Scripting Everywhere Example" isExecutable="true">
<bpmn2:startEvent id="startEvent">
<bpmn2:outgoing>flow1</bpmn2:outgoing>
</bpmn2:startEvent>
<bpmn2:sequenceFlow id="flow1" sourceRef="startEvent" targetRef="scriptTask"/>
<bpmn2:scriptTask id="scriptTask" name="Welcome Message" scriptFormat="groovy">
<bpmn2:extensionElements>
<camunda:inputOutput>
@menski
menski / bankWins.xml
Last active August 29, 2015 14:04
Inform which user task was triggered
<bpmn2:userTask id="userTaskBankWins" name="Bank Wins">
<bpmn2:extensionElements>
<camunda:taskListener event="create">
<!-- script as task listener -->
<camunda:script scriptFormat="groovy">
println "User task '$task.name' was $task.eventName"
</camunda:script>
</camunda:taskListener>
@menski
menski / flowGreaterThan3.xml
Created July 21, 2014 07:26
Decide who wins
<bpmn2:sequenceFlow id="flow3" name="Greater than 3" sourceRef="gateway" targetRef="userTaskPlayerWins">
<!-- script as sequence flow condition -->
<bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression" language="groovy">
aNumber > 3
</bpmn2:conditionExpression>
</bpmn2:sequenceFlow>
@menski
menski / exclusiveGateway.xml
Created July 21, 2014 07:22
Roll the dice
<bpmn2:exclusiveGateway id="gateway" name="Dice">
<bpmn2:extensionElements>
<camunda:executionListener event="start">
<!-- script as execution listener -->
<camunda:script scriptFormat="groovy">
aNumber = new Random().nextInt(6) + 1
println "$aNumber was diced"
execution.setVariable('aNumber', aNumber)
</camunda:script>
@menski
menski / scriptTask.xml
Created July 21, 2014 07:16
Welcome the player to the casino
<bpmn2:scriptTask id="scriptTask" name="Welcome Message" scriptFormat="groovy">
<bpmn2:extensionElements>
<camunda:inputOutput>
<camunda:inputParameter name="player">
<!-- script as input parameter -->
<camunda:script scriptFormat="groovy">
players = ["Fritz", "Heinz", "Horst", "Klaus"]
players[new Random().nextInt(players.size())]
</camunda:script>
@menski
menski / camunda-bpm-scripting-example.xml
Last active August 29, 2015 14:04
Example of scripting with camunda BPM
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:camunda="http://activiti.org/bpmn"
targetNamespace="http://camunda.org/exmaples">
<process id="testProcess" isExecutable="true">
<startEvent id="startEvent" />
<sequenceFlow id="flow1" sourceRef="startEvent" targetRef="scriptTask" />
<scriptTask id="scriptTask" scriptFormat="groovy">
<extensionElements>