-
-
Save vcodx/aec4aa51c9561322c5de93d0ef566507 to your computer and use it in GitHub Desktop.
Example start event
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from SpiffWorkflow.bpmn.serializer.workflow import BpmnWorkflowSerializer | |
from SpiffWorkflow.bpmn.workflow import BpmnWorkflow | |
from SpiffWorkflow.spiff.parser.process import BpmnValidator, SpiffBpmnParser | |
from SpiffWorkflow.spiff.serializer.config import SPIFF_CONFIG | |
SERIALIZER_VERSION = "3" | |
BPMN = """<?xml version="1.0" encoding="UTF-8"?> | |
<bpmn:definitions 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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_1qnx3d3" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.0.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.17.0"> | |
<bpmn:process id="Process_YzA9iBf" isExecutable="true"> | |
<bpmn:sequenceFlow id="Flow_1trxk8d" sourceRef="StartEvent_1" targetRef="Activity_1n1t0x1" /> | |
<bpmn:endEvent id="Event_1e0ho54"> | |
<bpmn:incoming>Flow_1w46fh7</bpmn:incoming> | |
</bpmn:endEvent> | |
<bpmn:sequenceFlow id="Flow_1w46fh7" sourceRef="Activity_1n1t0x1" targetRef="Event_1e0ho54" /> | |
<bpmn:manualTask id="Activity_1n1t0x1" name="A"> | |
<bpmn:incoming>Flow_1trxk8d</bpmn:incoming> | |
<bpmn:outgoing>Flow_1w46fh7</bpmn:outgoing> | |
</bpmn:manualTask> | |
<bpmn:startEvent id="StartEvent_1"> | |
<bpmn:outgoing>Flow_1trxk8d</bpmn:outgoing> | |
</bpmn:startEvent> | |
</bpmn:process> | |
<bpmndi:BPMNDiagram id="BPMNDiagram_1"> | |
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_YzA9iBf"> | |
<bpmndi:BPMNShape id="Event_1e0ho54_di" bpmnElement="Event_1e0ho54"> | |
<dc:Bounds x="432" y="172" width="36" height="36" /> | |
</bpmndi:BPMNShape> | |
<bpmndi:BPMNShape id="Activity_02kmga4_di" bpmnElement="Activity_1n1t0x1"> | |
<dc:Bounds x="270" y="150" width="100" height="80" /> | |
</bpmndi:BPMNShape> | |
<bpmndi:BPMNShape id="Event_1hpbbha_di" bpmnElement="StartEvent_1"> | |
<dc:Bounds x="179" y="172" width="36" height="36" /> | |
</bpmndi:BPMNShape> | |
<bpmndi:BPMNEdge id="Flow_1trxk8d_di" bpmnElement="Flow_1trxk8d"> | |
<di:waypoint x="215" y="190" /> | |
<di:waypoint x="270" y="190" /> | |
</bpmndi:BPMNEdge> | |
<bpmndi:BPMNEdge id="Flow_1w46fh7_di" bpmnElement="Flow_1w46fh7"> | |
<di:waypoint x="370" y="190" /> | |
<di:waypoint x="432" y="190" /> | |
</bpmndi:BPMNEdge> | |
</bpmndi:BPMNPlane> | |
</bpmndi:BPMNDiagram> | |
</bpmn:definitions> | |
""" | |
wf_spec_converter = BpmnWorkflowSerializer.configure(SPIFF_CONFIG) | |
parser = SpiffBpmnParser(validator=BpmnValidator()) | |
serializer = BpmnWorkflowSerializer(wf_spec_converter, version=SERIALIZER_VERSION) | |
parser.add_bpmn_str(BPMN.encode("utf-8")) | |
process_id = parser.get_process_ids()[0] | |
spec = parser.get_spec(process_id) | |
workflow = BpmnWorkflow(spec) | |
print(workflow.get_dump()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment