sample-process-models/misc/qa/forms/test-generate-markdown-table/test-generate-markdown-table.bpmn
2024-07-15 10:51:00 -04:00

111 lines
5.4 KiB
XML

<?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:spiffworkflow="http://spiffworkflow.org/bpmn/schema/1.0/core" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_96f6665" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.0.0-dev">
<bpmn:process id="Process_test_generate_markdown_table_0lw8m5k" isExecutable="true">
<bpmn:startEvent id="StartEvent_1">
<bpmn:outgoing>Flow_17db3yp</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:sequenceFlow id="Flow_17db3yp" sourceRef="StartEvent_1" targetRef="Activity_1yahpeu" />
<bpmn:endEvent id="EndEvent_1">
<bpmn:extensionElements>
<spiffworkflow:instructionsForEndUser>The process instance completed successfully.</spiffworkflow:instructionsForEndUser>
</bpmn:extensionElements>
<bpmn:incoming>Flow_0h2b7k8</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="Flow_12pkbxb" sourceRef="Activity_0qpzdpu" targetRef="Activity_0prxt64" />
<bpmn:scriptTask id="Activity_0qpzdpu" name="Script Task">
<bpmn:extensionElements>
<spiffworkflow:instructionsForEndUser />
</bpmn:extensionElements>
<bpmn:incoming>Flow_12cvwyu</bpmn:incoming>
<bpmn:outgoing>Flow_12pkbxb</bpmn:outgoing>
<bpmn:script>#define table fields
fields = [
{'property': 'name', 'label': 'Name','sanitize':True},
{'property': 'description', 'label': 'Task Description','sanitize':True},
{'property': 'date', 'label': 'Date', 'formatter':'convert_seconds_to_date_time_for_display'},
{'property': 'completed', 'label': 'Task Completed', },
{'property': 'amount', 'label': 'Amount, USD ($)'},
{'property': 'url', 'label': 'URL','sanitize':True}
];
#create record list
records = []
for x in tasks:
#create each reacod
new_record = {}
new_record["name"] = x["name"]
new_record["description"] = x["description"]
new_record["date"] = datetime.strptime(x["start_date"], '%Y-%m-%d').timestamp()
new_record["completed"] = {True: "YES", False: "NO"} [x["done"]]
new_record["amount"] = x["amount"]
new_record["url"] = x["url"]
# Add to record list
records.append(new_record)
#generate mark down table
markdown_table = generate_markdown_table(fields,records)</bpmn:script>
</bpmn:scriptTask>
<bpmn:sequenceFlow id="Flow_0h2b7k8" sourceRef="Activity_0prxt64" targetRef="EndEvent_1" />
<bpmn:manualTask id="Activity_0prxt64" name="Display Data">
<bpmn:extensionElements>
<spiffworkflow:instructionsForEndUser>{{markdown_table}}
{{delta}}</spiffworkflow:instructionsForEndUser>
</bpmn:extensionElements>
<bpmn:incoming>Flow_12pkbxb</bpmn:incoming>
<bpmn:outgoing>Flow_0h2b7k8</bpmn:outgoing>
</bpmn:manualTask>
<bpmn:sequenceFlow id="Flow_12cvwyu" sourceRef="Activity_1yahpeu" targetRef="Activity_0qpzdpu" />
<bpmn:userTask id="Activity_1yahpeu" name="User Task">
<bpmn:extensionElements>
<spiffworkflow:properties>
<spiffworkflow:property name="formJsonSchemaFilename" value="get-data-schema.json" />
<spiffworkflow:property name="formUiSchemaFilename" value="get-data-uischema.json" />
</spiffworkflow:properties>
</bpmn:extensionElements>
<bpmn:incoming>Flow_17db3yp</bpmn:incoming>
<bpmn:outgoing>Flow_12cvwyu</bpmn:outgoing>
</bpmn:userTask>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_test_generate_markdown_table_0lw8m5k">
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
<dc:Bounds x="-8" y="159" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_14za570_di" bpmnElement="EndEvent_1">
<dc:Bounds x="642" y="159" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_1dqv2uu_di" bpmnElement="Activity_0qpzdpu">
<dc:Bounds x="290" y="137" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_1dl44lp_di" bpmnElement="Activity_0prxt64">
<dc:Bounds x="460" y="137" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_18wmd9h_di" bpmnElement="Activity_1yahpeu">
<dc:Bounds x="110" y="137" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="Flow_17db3yp_di" bpmnElement="Flow_17db3yp">
<di:waypoint x="28" y="177" />
<di:waypoint x="110" y="177" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_12pkbxb_di" bpmnElement="Flow_12pkbxb">
<di:waypoint x="390" y="177" />
<di:waypoint x="460" y="177" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0h2b7k8_di" bpmnElement="Flow_0h2b7k8">
<di:waypoint x="560" y="177" />
<di:waypoint x="642" y="177" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_12cvwyu_di" bpmnElement="Flow_12cvwyu">
<di:waypoint x="210" y="177" />
<di:waypoint x="290" y="177" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>