Skip to content

Instantly share code, notes, and snippets.

@ieugen
Created August 12, 2015 19:49
Show Gist options
  • Save ieugen/a3e66d4ff85db0eb6c9a to your computer and use it in GitHub Desktop.
Save ieugen/a3e66d4ff85db0eb6c9a to your computer and use it in GitHub Desktop.
bpmn test
var bpmn = require("bpmn");
console.log("Start process")
bpmn.createUnmanagedProcess(__dirname + "/bpmn/simpleRegistration.bpmn", function(err, myProcess) {
console.log(err)
// we start the process
myProcess.triggerEvent("Start_registration");
});
{
"name": "gpec",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www"
},
"dependencies": {
"babel": "^5.8.21",
"body-parser": "~1.12.4",
"bpmn": "^0.2.2",
"cookie-parser": "~1.3.5",
"debug": "~2.2.0",
"express": "~4.12.4",
"jade": "~1.9.2",
"morgan": "~1.5.3",
"mysql": "^2.8.0",
"newforms": "^0.12.1",
"pg": "^4.4.1",
"pg-hstore": "^2.3.2",
"react": "^0.13.3",
"sequelize": "^3.5.1",
"serve-favicon": "~2.2.1"
}
}
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn="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" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="Definitions_1" exporter="camunda modeler" exporterVersion="2.7.0" targetNamespace="http://bpmn.io/schema/bpmn">
<bpmn:process id="GpecRegistrationProcess" name="GpecRegistrationProcess" isExecutable="false">
<bpmn:startEvent id="StartEvent_1" name="Start registration">
<bpmn:outgoing>SequenceFlow_0q9rdbz</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:sequenceFlow id="SequenceFlow_0q9rdbz" sourceRef="StartEvent_1" targetRef="ScriptTask_0ifzw6d"/>
<bpmn:sequenceFlow id="SequenceFlow_1r73efg" sourceRef="ScriptTask_0ifzw6d" targetRef="hasPaymentBeenMade"/>
<bpmn:endEvent id="EndEvent_0di4adj" name="End registration">
<bpmn:incoming>SequenceFlow_0ewdh0r</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="SequenceFlow_0ewdh0r" sourceRef="sendTicketsTask" targetRef="EndEvent_0di4adj"/>
<bpmn:exclusiveGateway id="hasPaymentBeenMade" name="Has payment been made?" default="sendTicketsFlow">
<bpmn:incoming>SequenceFlow_1r73efg</bpmn:incoming>
<bpmn:outgoing>confirmPaymentFlow</bpmn:outgoing>
<bpmn:outgoing>sendTicketsFlow</bpmn:outgoing>
</bpmn:exclusiveGateway>
<bpmn:sequenceFlow id="SequenceFlow_136kv07" sourceRef="confirmPayment" targetRef="sendTicketsTask"/>
<bpmn:scriptTask id="ScriptTask_0ifzw6d" name="Send invoice">
<bpmn:incoming>SequenceFlow_0q9rdbz</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1r73efg</bpmn:outgoing>
</bpmn:scriptTask>
<bpmn:scriptTask id="sendTicketsTask" name="Send tickets">
<bpmn:incoming>SequenceFlow_136kv07</bpmn:incoming>
<bpmn:incoming>sendTicketsFlow</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0ewdh0r</bpmn:outgoing>
</bpmn:scriptTask>
<bpmn:sequenceFlow id="confirmPaymentFlow" name="No" sourceRef="hasPaymentBeenMade" targetRef="confirmPayment"/>
<bpmn:userTask id="confirmPayment" name="Confirm payment">
<bpmn:incoming>confirmPaymentFlow</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_136kv07</bpmn:outgoing>
</bpmn:userTask>
<bpmn:sequenceFlow id="sendTicketsFlow" name="Yes" sourceRef="hasPaymentBeenMade" targetRef="sendTicketsTask"/>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="GpecRegistrationProcess">
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
<dc:Bounds height="36.0" width="36.0" x="135.0" y="137.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="20.0" width="90.0" x="108.0" y="173.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0q9rdbz_di" bpmnElement="SequenceFlow_0q9rdbz">
<di:waypoint xsi:type="dc:Point" x="171.0" y="155.0"/>
<di:waypoint xsi:type="dc:Point" x="284.0" y="155.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="20.0" width="90.0" x="278.5" y="145.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1r73efg_di" bpmnElement="SequenceFlow_1r73efg">
<di:waypoint xsi:type="dc:Point" x="384.0" y="155.0"/>
<di:waypoint xsi:type="dc:Point" x="458.0" y="155.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="20.0" width="90.0" x="474.5" y="145.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="EndEvent_0di4adj_di" bpmnElement="EndEvent_0di4adj">
<dc:Bounds height="36.0" width="36.0" x="1006.0" y="137.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="20.0" width="90.0" x="979.0" y="173.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0ewdh0r_di" bpmnElement="SequenceFlow_0ewdh0r">
<di:waypoint xsi:type="dc:Point" x="913.0" y="155.0"/>
<di:waypoint xsi:type="dc:Point" x="1006.0" y="155.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="20.0" width="90.0" x="704.5" y="145.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ExclusiveGateway_08lucl8_di" bpmnElement="hasPaymentBeenMade" isMarkerVisible="true">
<dc:Bounds height="50.0" width="50.0" x="458.0" y="130.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="20.0" width="90.0" x="438.0" y="180.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_136kv07_di" bpmnElement="SequenceFlow_136kv07">
<di:waypoint xsi:type="dc:Point" x="725.0" y="308.0"/>
<di:waypoint xsi:type="dc:Point" x="863.0" y="308.0"/>
<di:waypoint xsi:type="dc:Point" x="863.0" y="195.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="20.0" width="90.0" x="490.0" y="145.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ScriptTask_0ifzw6d_di" bpmnElement="ScriptTask_0ifzw6d">
<dc:Bounds height="80.0" width="100.0" x="284.0" y="115.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_01xbt0u_di" bpmnElement="sendTicketsTask">
<dc:Bounds height="80.0" width="100.0" x="813.0" y="115.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0wtphjq_di" bpmnElement="confirmPaymentFlow">
<di:waypoint xsi:type="dc:Point" x="483.0" y="180.0"/>
<di:waypoint xsi:type="dc:Point" x="483.0" y="308.0"/>
<di:waypoint xsi:type="dc:Point" x="625.0" y="308.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="20.0" width="90.0" x="438.0" y="224.5"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="UserTask_1czwexo_di" bpmnElement="confirmPayment">
<dc:Bounds height="80.0" width="100.0" x="625.0" y="268.418"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0bneves_di" bpmnElement="sendTicketsFlow">
<di:waypoint xsi:type="dc:Point" x="508.0" y="155.0"/>
<di:waypoint xsi:type="dc:Point" x="813.0" y="155.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="20.0" width="90.0" x="615.5" y="145.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
exports.Start_registration = function(data, done){
console.log('Start registration');
done();
}
exports.End_registration = function(data, done){
console.log('Start registration');
done();
}
exports.Send_invoice = function(data, done){
console.log('Send invoice');
done();
}
exports.Send_tickets = function(data, done){
console.log('Send tickets');
done();
}
exports.Has_payment_been_made = function(data, done) {
console.log('Has payment been made?');
done(data);
}
exports.Has_payment_been_made_$ok = function(data) {
console.log('Ok: Has payment been made?');
return false;
}
exports.Has_payment_been_made_$nok = function(data) {
console.log('NOK: Has payment been made?');
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment