项目场景:
最近在项目中使用到了Activiti工作流,需要编辑Test.bpmn流程图。
问题描述
但是拿到Test.bpmn文件之后选择直接打开发现全是代码,不是直观的图形界面。
<?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:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.activiti.org/test" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
<process id="Test" name="我的测试流程" isExecutable="true" isClosed="false" processType="None">
<userTask id="ECThreeManagerApproval" name="三级经理审批" activiti:assignee="${staffId}">
<extensionElements>
<activiti:taskListener event="create" delegateExpression="#{ElectronicChannelCreateTaskListener}"></activiti:taskListener>
<activiti:taskListener event="complete" delegateExpression="#{ElectronicChannelCompleteTaskListener}"></activiti:taskListener>
</extensionElements>
</userTask>
<userTask id="ECDemandInterfacePersonAssign" name="二级经理审批" activiti:assignee="${staffId}">
<extensionElements>
<activiti:taskListener event="create" delegateExpression="#{ElectronicChannelCreateTaskListener}"></activiti:taskListener>
<activiti:taskListener event="complete" delegateExpression="#{ElectronicChannelCompleteTaskListener}"></activiti:taskListener>
</extensionElements>
</userTask>
<endEvent id="ECEnd" name="结束">
<extensionElements>
<activiti:executionListener event="end" delegateExpression="#{ElectronicChannelEndTaskListener}"></activiti:executionListener>
</extensionElements>
</endEvent>
<sequenceFlow id="flow12" sourceRef="ECThreeManagerApproval" targetRef="ECDemandInterfacePersonAssign">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${verify=='ECDemandInterfacePersonAssign'}]]></conditionExpression>
</sequenceFlow>
<startEvent id="ECStart" name="开始"></startEvent>
<userTask id="ECResponsibleManDistribute" name="三级经理审批">
<extensionElements>
<activiti:taskListener event="create" delegateExpression="#{ElectronicChannelCreateTaskListener}"></activiti:taskListener>
<activiti:taskListener event="complete" delegateExpression="#{ElectronicChannelCompleteTaskListener}"></activiti:taskListener>
</extensionElements>
</userTask>
<sequenceFlow id="flow18" sourceRef="ECDemandInterfacePersonAssign" targetRef="ECResponsibleManDistribute">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${verify=='ECResponsibleManDistribute'}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="flow21" sourceRef="ECStart" targetRef="ECThreeManagerApproval">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${verify=='ECThreeManagerApproval'}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="flow25" sourceRef="ECResponsibleManDistribute" targetRef="ECEnd">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${verify=='ECEnd'}]]></conditionExpression>
</sequenceFlow>
<userTask id="ECDemandProposerClose" name="发起人关闭工单">
<extensionElements>
<activiti:taskListener event="create" delegateExpression="#{ElectronicChannelCreateTaskListener}"></activiti:taskListener>
<activiti:taskListener event="complete" delegateExpression="#{ElectronicChannelCompleteTaskListener}"></activiti:taskListener>
</extensionElements>
</userTask>
<sequenceFlow id="flow26" sourceRef="ECThreeManagerApproval" targetRef="ECDemandProposerClose">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${verify=='ECDemandProposerClose'}]]></conditionExpression>
</sequenceFlow>
<endEvent id="ECRejectEnd" name="驳回结束">
<extensionElements>
<activiti:executionListener event="end" delegateExpression="#{ElectronicChannelEndTaskListener}"></activiti:executionListener>
</extensionElements>
</endEvent>
<sequenceFlow id="flow27" sourceRef="ECDemandProposerClose" targetRef="ECRejectEnd">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${verify=='ECRejectEnd'}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="flow28" sourceRef="ECResponsibleManDistribute" targetRef="ECDemandProposerClose">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${verify=='ECDemandProposerClose'}]]></conditionExpression>
</sequenceFlow>
</process>
<bpmndi:BPMNDiagram id="BPMNDiagram_Test">
<bpmndi:BPMNPlane bpmnElement="Test" id="BPMNPlane_Test">
<bpmndi:BPMNShape bpmnElement="ECThreeManagerApproval" id="BPMNShape_ECThreeManagerApproval">
<omgdc:Bounds height="65.0" width="145.0" x="410.0" y="185.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="ECDemandInterfacePersonAssign" id="BPMNShape_ECDemandInterfacePersonAssign">
<omgdc:Bounds height="71.0" width="131.0" x="630.0" y="182.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="ECEnd" id="BPMNShape_ECEnd">
<omgdc:Bounds height="35.0" width="35.0" x="1100.0" y="200.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="ECStart" id="BPMNShape_ECStart">
<omgdc:Bounds height="35.0" width="35.0" x="290.0" y="200.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="ECResponsibleManDistribute" id="BPMNShape_ECResponsibleManDistribute">
<omgdc:Bounds height="66.0" width="121.0" x="840.0" y="185.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="ECDemandProposerClose" id="BPMNShape_ECDemandProposerClose">
<omgdc:Bounds height="55.0" width="145.0" x="410.0" y="80.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="ECRejectEnd" id="BPMNShape_ECRejectEnd">
<omgdc:Bounds height="35.0" width="35.0" x="465.0" y="0.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="flow12" id="BPMNEdge_flow12">
<omgdi:waypoint x="555.0" y="217.0"></omgdi:waypoint>
<omgdi:waypoint x="630.0" y="217.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow18" id="BPMNEdge_flow18">
<omgdi:waypoint x="761.0" y="217.0"></omgdi:waypoint>
<omgdi:waypoint x="840.0" y="218.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow21" id="BPMNEdge_flow21">
<omgdi:waypoint x="325.0" y="217.0"></omgdi:waypoint>
<omgdi:waypoint x="410.0" y="217.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow25" id="BPMNEdge_flow25">
<omgdi:waypoint x="961.0" y="218.0"></omgdi:waypoint>
<omgdi:waypoint x="1100.0" y="217.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow26" id="BPMNEdge_flow26">
<omgdi:waypoint x="482.0" y="185.0"></omgdi:waypoint>
<omgdi:waypoint x="482.0" y="135.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow27" id="BPMNEdge_flow27">
<omgdi:waypoint x="482.0" y="80.0"></omgdi:waypoint>
<omgdi:waypoint x="482.0" y="35.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow28" id="BPMNEdge_flow28">
<omgdi:waypoint x="900.0" y="185.0"></omgdi:waypoint>
<omgdi:waypoint x="900.0" y="107.0"></omgdi:waypoint>
<omgdi:waypoint x="555.0" y="107.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>
原因分析:
经过研究发现BPMN文件如果没有相应软件或者编辑器直接打开的话会显示其源码,通过查阅资料得知此类工具也比较多,在此仅跟大家分享一下其中一种方案:使用Eclipse打开BPMN文件。
解决方案:
1.在电脑上安装Eclipse工具(不再详细介绍)
2.安装好Eclipse工具之后,只需要安装Activiti BPMN 2.0 designer插件就可以了
具体操作步骤如下:
在Eclipse的菜单中打开
help -> install new software…:
单击add:
Name: Activiti BPMN 2.0 designer
Location: http://activiti.org/designer/update/
点击OK
最终效果:
安装好Activiti插件之后再把Test.bpmn复制到Eclipse中来打开,就可以看到图形界面啦~