BPMN diagram export

Package provides functionality for exporting graph representation to BPMN 2.0 XML

class bpmn_python.bpmn_diagram_export.BpmnDiagramGraphExport

Class BPMNDiagramGraphExport provides methods for exporting BPMNDiagramGraph into BPMN 2.0 XML file. As a utility class, it only contains static methods. This class is meant to be used from BPMNDiagramGraph class.

staticmethod export_boundary_event_info(node_params, output_element)

Adds IntermediateCatchEvent attributes to exported XML element

Parameters:
  • node_params – dictionary with given intermediate catch event parameters,
  • output_element – object representing BPMN XML ‘intermediateCatchEvent’ element.
staticmethod export_catch_event_info(node_params, output_element)

Adds IntermediateCatchEvent attributes to exported XML element

Parameters:
  • node_params – dictionary with given intermediate catch event parameters,
  • output_element – object representing BPMN XML ‘intermediateCatchEvent’ element.
staticmethod export_child_lane_set(parent_xml_element, child_lane_set, plane_element)

Creates ‘childLaneSet’ element for exported BPMN XML file.

Parameters:
  • parent_xml_element – an XML element, parent of exported ‘childLaneSet’ element,
  • child_lane_set – dictionary with exported ‘childLaneSet’ element attributes and child elements,
  • plane_element – XML object, representing ‘plane’ element of exported BPMN 2.0 XML.
staticmethod export_complex_gateway_info(node_params, output_element)

Adds ComplexGateway node attributes to exported XML element

Parameters:
  • node_params – dictionary with given complex gateway parameters,
  • output_element – object representing BPMN XML ‘complexGateway’ element.
staticmethod export_data_object_info(bpmn_diagram, data_object_params, output_element)

Adds DataObject node attributes to exported XML element

Parameters:
  • bpmn_diagram – BPMNDiagramGraph class instantion representing a BPMN process diagram,
  • data_object_params – dictionary with given subprocess parameters,
  • output_element – object representing BPMN XML ‘subprocess’ element.
staticmethod export_definitions_element()

Creates root element (‘definitions’) for exported BPMN XML file.

Returns:definitions XML element.
staticmethod export_diagram_plane_elements(root, diagram_attributes, plane_attributes)

Creates ‘diagram’ and ‘plane’ elements for exported BPMN XML file. Returns a tuple (diagram, plane).

Parameters:
  • root – object of Element class, representing a BPMN XML root element (‘definitions’),
  • diagram_attributes – dictionary that holds attribute values for imported ‘BPMNDiagram’ element,
  • plane_attributes – dictionary that holds attribute values for imported ‘BPMNPlane’ element.
staticmethod export_event_based_gateway_info(node_params, output_element)

Adds EventBasedGateway node attributes to exported XML element

Parameters:
  • node_params – dictionary with given event based gateway parameters,
  • output_element – object representing BPMN XML ‘eventBasedGateway’ element.
staticmethod export_flow_di_data(params, plane)

Creates a new BPMNEdge XML element for given edge parameters and adds it to ‘plane’ element.

Parameters:
  • params – dictionary with edge parameters,
  • plane – object of Element class, representing BPMN XML ‘BPMNPlane’ element (root for edge DI data).
staticmethod export_flow_process_data(params, process)

Creates a new SequenceFlow XML element for given edge parameters and adds it to ‘process’ element.

Parameters:
  • params – dictionary with edge parameters,
  • process – object of Element class, representing BPMN XML ‘process’ element (root for sequence flows)
staticmethod export_inclusive_exclusive_gateway_info(node_params, output_element)

Adds InclusiveGateway or ExclusiveGateway node attributes to exported XML element

Parameters:
  • node_params – dictionary with given inclusive or exclusive gateway parameters,
  • output_element – object representing BPMN XML ‘inclusiveGateway’/’exclusive’ element.
staticmethod export_lane(parent_xml_element, lane_id, lane_attr, plane_element)

Creates ‘lane’ element for exported BPMN XML file.

Parameters:
  • parent_xml_element – an XML element, parent of exported ‘lane’ element,
  • lane_id – string object. ID of exported lane element,
  • lane_attr – dictionary with lane element attributes,
  • plane_element – XML object, representing ‘plane’ element of exported BPMN 2.0 XML.
staticmethod export_lane_set(process, lane_set, plane_element)

Creates ‘laneSet’ element for exported BPMN XML file.

Parameters:
  • process – an XML element (‘process’), from exported BPMN 2.0 document,
  • lane_set – dictionary with exported ‘laneSet’ element attributes and child elements,
  • plane_element – XML object, representing ‘plane’ element of exported BPMN 2.0 XML.
staticmethod export_node_data(bpmn_diagram, process_id, params, process)

Creates a new XML element (depends on node type) for given node parameters and adds it to ‘process’ element.

Parameters:
  • bpmn_diagram – BPMNDiagramGraph class instantion representing a BPMN process diagram,
  • process_id – string representing ID of given flow node,
  • params – dictionary with node parameters,
  • process – object of Element class, representing BPMN XML ‘process’ element (root for nodes).
staticmethod export_node_di_data(node_id, params, plane)

Creates a new BPMNShape XML element for given node parameters and adds it to ‘plane’ element.

Parameters:
  • node_id – string representing ID of given flow node,
  • params – dictionary with node parameters,
  • plane – object of Element class, representing BPMN XML ‘BPMNPlane’ element (root for node DI data).
staticmethod export_parallel_gateway_info(node_params, output_element)

Adds parallel gateway node attributes to exported XML element

Parameters:
  • node_params – dictionary with given parallel gateway parameters,
  • output_element – object representing BPMN XML ‘parallelGateway’ element.
staticmethod export_process_element(definitions, process_id, process_attributes_dictionary)

Creates process element for exported BPMN XML file.

Parameters:
  • process_id – string object. ID of exported process element,
  • definitions – an XML element (‘definitions’), root element of BPMN 2.0 document
  • process_attributes_dictionary – dictionary that holds attribute values of ‘process’ element
Returns:

process XML element

staticmethod export_start_event_info(node_params, output_element)

Adds StartEvent attributes to exported XML element

Parameters:
  • node_params – dictionary with given intermediate catch event parameters,
  • output_element – object representing BPMN XML ‘intermediateCatchEvent’ element.
staticmethod export_subprocess_info(bpmn_diagram, subprocess_params, output_element)

Adds Subprocess node attributes to exported XML element

Parameters:
  • bpmn_diagram – BPMNDiagramGraph class instantion representing a BPMN process diagram,
  • subprocess_params – dictionary with given subprocess parameters,
  • output_element – object representing BPMN XML ‘subprocess’ element.
staticmethod export_task_info(node_params, output_element)

Adds Task node attributes to exported XML element

Parameters:
  • node_params – dictionary with given task parameters,
  • output_element – object representing BPMN XML ‘task’ element.
staticmethod export_throw_event_info(node_params, output_element)

Adds EndEvent or IntermediateThrowingEvent attributes to exported XML element

Parameters:
  • node_params – dictionary with given intermediate throw event parameters,
  • output_element – object representing BPMN XML ‘intermediateThrowEvent’ element.
staticmethod export_xml_file(directory, filename, bpmn_diagram)

Exports diagram inner graph to BPMN 2.0 XML file (with Diagram Interchange data).

Parameters:
  • directory – string representing output directory,
  • filename – string representing output file name,
  • bpmn_diagram – BPMNDiagramGraph class instantion representing a BPMN process diagram.
staticmethod export_xml_file_no_di(directory, filename, bpmn_diagram)

Exports diagram inner graph to BPMN 2.0 XML file (without Diagram Interchange data).

Parameters:
  • directory – string representing output directory,
  • filename – string representing output file name,
  • bpmn_diagram – BPMNDiagramGraph class instance representing a BPMN process diagram.
staticmethod indent(elem, level=0)

Helper function, adds indentation to XML output.

Parameters:
  • elem – object of Element class, representing element to which method adds intendation,
  • level – current level of intendation.