首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > XML SOAP >

Activiti学习文件10(xml格式的字符串发布流程)

2012-10-16 
Activiti学习资料10(xml格式的字符串发布流程)Activiti发布 jbpm4的开发成员tom离开了jboss后,加入afresco

Activiti学习资料10(xml格式的字符串发布流程)

Activiti发布

 jbpm4的开发成员tom离开了jboss后,加入afresco公司,并且才有activiti5的项目,这开源项目继承了jbpm4的所有优点,同时将其发扬光大,相对jbpm4,activiti5改进了储多我们国内开发人员关心的问题,如:

  • 流程代办
  • 在线流程设计器
  • 流程嵌入式部署
  • 流程独立部署
  • 动流程节点
  • 自由流程
  • 支持了bpmn2的标准
  • 支持规则引擎


         activiti 5 底层上的api跟jbpm4的api相似程序也达60%以上,特别是service提供的接口,都是在jbpm4上提供扩展,大大方便了jbpm4的开发人员,这也是tom的先明之处,毕竟jbpm原来打的品牌效应不可否认的,把原来的jbpm4积累的人气再次带至activiti5上,这也将是该项目能够断续前进的重要保障。


         尽管activiti5目前发展趋势前途光明,但其也有不足的地方,其前端的的表现总是存在不足,如在线流程设计器,目前eclipse插件生成的bpmn20.xml文件则不行,而官方提供的activiti-modler设计器,扩展及实现均面临困难,并且对浏览器的要求让它在国内的项目实施总会面临技术难度。

     

           宏天estbpm3则又是一个基于activiti5的产品,并且公司也有打算断续原来的产品销售模式,对企业开放源代码,而原来的设计器通过改进后,则可以直接支持activiti5的流程设计的需要,如:

     

     

    设计器按设计器生成一份文档格式,通过系统中提供的xslt转化文档,完成转化后,生成bpmn20的格式文档,该文档可被activiti5直接识别。


    Activiti学习文件10(xml格式的字符串发布流程)
     

    其设计器及转化效果如下所示:


    Activiti学习文件10(xml格式的字符串发布流程)
     

     

    发布后,通过activiti5的api生成的流程图如下所示:

     


    Activiti学习文件10(xml格式的字符串发布流程)
     

     

     

    设计器原生成的文档格式:

    Java代码  Activiti学习文件10(xml格式的字符串发布流程)
    1. <diagram xmlns:bg="bpm.graphic" xmlns:ciied="com.hotent.bpm.editor"  
    2.     xmlns:fg="flash.geom">  
    3.     <bg:Task id="task1" height="50" user="true" width="90" x="230"  
    4.         y="110">  
    5.         <label>用户任务1</label>  
    6.         <ports>  
    7.             <ciied:Port id="port1" clipOnShape="true" movable="false" />  
    8.             <ciied:Port id="port2" x="0" />  
    9.             <ciied:Port id="port3" y="1" />  
    10.             <ciied:Port id="port4" clipOnShape="true" movable="false">  
    11.                 <id>CENTER</id>  
    12.             </ciied:Port>  
    13.         </ports>  
    14.     </bg:Task>  
    15.     <bg:StartEvent id="startEvent1" height="46" width="31" x="60"  
    16.         y="119.5">  
    17.         <label>开始</label>  
    18.         <ports>  
    19.             <ciied:Port id="port5" clipOnShape="true" movable="false" />  
    20.             <ciied:Port id="port6" x="1" />  
    21.             <ciied:Port id="port7" clipOnShape="true" movable="false">  
    22.                 <id>CENTER</id>  
    23.             </ciied:Port>  
    24.         </ports>  
    25.     </bg:StartEvent>  
    26.     <bg:SubProcess id="subProcess1" automaticGraphLayout="false"  
    27.         expandedHeight="210" expandedWidth="570" height="210" width="570" x="360"  
    28.         y="230">  
    29.         <label>子流程</label>  
    30.         <ports>  
    31.             <ciied:Port id="port8" clipOnShape="true" movable="false" />  
    32.             <ciied:Port id="port9" x="0" />  
    33.             <ciied:Port id="port10" y="0" />  
    34.             <ciied:Port id="port11" clipOnShape="true" movable="false">  
    35.                 <id>CENTER</id>  
    36.             </ciied:Port>  
    37.             <ciied:Port id="port12" horizontalOffset="-5" y="1">  
    38.                 <id>BOTTOM</id>  
    39.             </ciied:Port>  
    40.             <ciied:Port id="port13" horizontalOffset="5" y="1">  
    41.                 <id>BOTTOM</id>  
    42.             </ciied:Port>  
    43.         </ports>  
    44.         <bg:Task id="task2" height="50" user="true" width="90" x="180"  
    45.             y="53">  
    46.             <label>用户任务2</label>  
    47.             <ports>  
    48.                 <ciied:Port id="port14" clipOnShape="true" movable="false" />  
    49.                 <ciied:Port id="port15" x="0" />  
    50.                 <ciied:Port id="port16" x="1" />  
    51.                 <ciied:Port id="port17" clipOnShape="true" movable="false">  
    52.                     <id>CENTER</id>  
    53.                 </ciied:Port>  
    54.             </ports>  
    55.         </bg:Task>  
    56.         <bg:StartEvent id="startEvent2" height="46" width="32"  
    57.             x="29" y="62.5">  
    58.             <label>开始2</label>  
    59.             <ports>  
    60.                 <ciied:Port id="port18" clipOnShape="true" movable="false" />  
    61.                 <ciied:Port id="port19" x="1" />  
    62.                 <ciied:Port id="port20" clipOnShape="true" movable="false">  
    63.                     <id>CENTER</id>  
    64.                 </ciied:Port>  
    65.             </ports>  
    66.         </bg:StartEvent>  
    67.         <bg:SequenceFlow id="sequenceFlow1" endPort="port15"  
    68.             startPort="port19">  
    69.             <fallbackEndPoint>  
    70.                 <fg:Point id="point1" x="198" y="58" />  
    71.             </fallbackEndPoint>  
    72.             <fallbackStartPoint>  
    73.                 <fg:Point id="point2" />  
    74.             </fallbackStartPoint>  
    75.             <label></label>  
    76.         </bg:SequenceFlow>  
    77.         <bg:EndEvent id="endEvent1" height="49" width="34" x="380"  
    78.             y="61">  
    79.             <label>结束2</label>  
    80.             <ports>  
    81.                 <ciied:Port id="port21" clipOnShape="true" movable="false" />  
    82.                 <ciied:Port id="port22" x="0" />  
    83.                 <ciied:Port id="port23" clipOnShape="true" movable="false">  
    84.                     <id>CENTER</id>  
    85.                 </ciied:Port>  
    86.             </ports>  
    87.         </bg:EndEvent>  
    88.         <bg:SequenceFlow id="sequenceFlow2" endPort="port22"  
    89.             startPort="port16">  
    90.             <fallbackEndPoint>  
    91.                 <fg:Point id="point3" x="364" y="68" />  
    92.             </fallbackEndPoint>  
    93.             <fallbackStartPoint>  
    94.                 <fg:Point id="point4" />  
    95.             </fallbackStartPoint>  
    96.             <label></label>  
    97.         </bg:SequenceFlow>  
    98.     </bg:SubProcess>  
    99.     <bg:EndEvent id="endEvent2" height="49" width="34" x="740"  
    100.         y="120">  
    101.         <label>结束1</label>  
    102.         <ports>  
    103.             <ciied:Port id="port24" clipOnShape="true" movable="false" />  
    104.             <ciied:Port id="port25" x="0" />  
    105.             <ciied:Port id="port26" clipOnShape="true" movable="false">  
    106.                 <id>CENTER</id>  
    107.             </ciied:Port>  
    108.         </ports>  
    109.     </bg:EndEvent>  
    110.     <bg:SequenceFlow id="sequenceFlow3" endPort="port2"  
    111.         startPort="port6">  
    112.         <fallbackEndPoint>  
    113.             <fg:Point id="point5" x="237" y="125" />  
    114.         </fallbackEndPoint>  
    115.         <fallbackStartPoint>  
    116.             <fg:Point id="point6" />  
    117.         </fallbackStartPoint>  
    118.         <label></label>  
    119.     </bg:SequenceFlow>  
    120.     <bg:SequenceFlow id="sequenceFlow4" endPort="port9"  
    121.         startPort="port3">  
    122.         <fallbackEndPoint>  
    123.             <fg:Point id="point7" x="396" y="461" />  
    124.         </fallbackEndPoint>  
    125.         <fallbackStartPoint>  
    126.             <fg:Point id="point8" />  
    127.         </fallbackStartPoint>  
    128.         <label></label>  
    129.     </bg:SequenceFlow>  
    130.     <bg:SequenceFlow id="sequenceFlow5" endPort="port25"  
    131.         startPort="port10">  
    132.         <fallbackEndPoint>  
    133.             <fg:Point id="point9" x="674" y="191" />  
    134.         </fallbackEndPoint>  
    135.         <fallbackStartPoint>  
    136.             <fg:Point id="point10" />  
    137.         </fallbackStartPoint>  
    138.         <label></label>  
    139.     </bg:SequenceFlow>  
    140.     <bg:Task id="task3" height="50" user="true" width="90" x="440"  
    141.         y="520">  
    142.         <label>用户任务3</label>  
    143.         <ports>  
    144.             <ciied:Port id="port27" clipOnShape="true" movable="false">  
    145.                 <id>CENTER</id>  
    146.             </ciied:Port>  
    147.             <ciied:Port id="port28" y="0">  
    148.                 <id>TOP</id>  
    149.             </ciied:Port>  
    150.             <ciied:Port id="port29" y="1">  
    151.                 <id>BOTTOM</id>  
    152.             </ciied:Port>  
    153.         </ports>  
    154.     </bg:Task>  
    155.     <bg:SequenceFlow id="sequenceFlow6" endPort="port28"  
    156.         startPort="port12">  
    157.         <fallbackEndPoint>  
    158.             <fg:Point id="point11" x="623" y="568" />  
    159.         </fallbackEndPoint>  
    160.         <fallbackStartPoint>  
    161.             <fg:Point id="point12" />  
    162.         </fallbackStartPoint>  
    163.         <label></label>  
    164.     </bg:SequenceFlow>  
    165.     <bg:Task id="task4" height="50" user="true" width="90" x="750"  
    166.         y="520">  
    167.         <label>用户任务4</label>  
    168.         <ports>  
    169.             <ciied:Port id="port30" clipOnShape="true" movable="false">  
    170.                 <id>CENTER</id>  
    171.             </ciied:Port>  
    172.             <ciied:Port id="port31" y="0">  
    173.                 <id>TOP</id>  
    174.             </ciied:Port>  
    175.             <ciied:Port id="port32" y="1">  
    176.                 <id>BOTTOM</id>  
    177.             </ciied:Port>  
    178.         </ports>  
    179.     </bg:Task>  
    180.     <bg:SequenceFlow id="sequenceFlow7" endPort="port31"  
    181.         startPort="port13">  
    182.         <fallbackEndPoint>  
    183.             <fg:Point id="point13" x="760" y="536" />  
    184.         </fallbackEndPoint>  
    185.         <fallbackStartPoint>  
    186.             <fg:Point id="point14" />  
    187.         </fallbackStartPoint>  
    188.         <label></label>  
    189.     </bg:SequenceFlow>  
    190.     <bg:EndEvent id="endEvent3" height="49" width="34" x="620"  
    191.         y="630">  
    192.         <label>结束3</label>  
    193.         <ports>  
    194.             <ciied:Port id="port33" clipOnShape="true" movable="false">  
    195.                 <id>CENTER</id>  
    196.             </ciied:Port>  
    197.             <ciied:Port id="port34" x="1">  
    198.                 <id>RIGHT</id>  
    199.             </ciied:Port>  
    200.             <ciied:Port id="port35" x="0">  
    201.                 <id>LEFT</id>  
    202.             </ciied:Port>  
    203.         </ports>  
    204.     </bg:EndEvent>  
    205.     <bg:SequenceFlow id="sequenceFlow8" endPort="port35"  
    206.         startPort="port29">  
    207.         <fallbackEndPoint>  
    208.             <fg:Point id="point15" x="632" y="653" />  
    209.         </fallbackEndPoint>  
    210.         <fallbackStartPoint>  
    211.             <fg:Point id="point16" />  
    212.         </fallbackStartPoint>  
    213.         <label></label>  
    214.     </bg:SequenceFlow>  
    215.     <bg:SequenceFlow id="sequenceFlow9" endPort="port34"  
    216.         startPort="port32">  
    217.         <fallbackEndPoint>  
    218.             <fg:Point id="point17" x="688" y="651" />  
    219.         </fallbackEndPoint>  
    220.         <fallbackStartPoint>  
    221.             <fg:Point id="point18" />  
    222.         </fallbackStartPoint>  
    223.         <label></label>  
    224.     </bg:SequenceFlow>  
    225. </diagram>  

     

    通过XSLT转化后的文档格式:

     

    Java代码  Activiti学习文件10(xml格式的字符串发布流程)
    1. <?xml version="1.0" encoding="utf-8"?>  
    2. <definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"  
    3.     xmlns:ciied="com.ibm.ilog.elixir.diagram" xmlns:bg="bpm.graphic"  
    4.     xmlns:fn="http://www.w3.org/2005/02/xpath-functions" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI"  
    5.     xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"  
    6.     xmlns:activiti="http://activiti.org/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
    7.     targetNamespace="http://www.activiti.org/test" expressionLanguage="http://www.w3.org/1999/XPath"  
    8.     typeLanguage="http://www.w3.org/2001/XMLSchema">  
    9.     <process id="subGraph2" name="子流程">  
    10.         <startEvent id="startEvent1" name="开始" />  
    11.         <endEvent id="endEvent2" name="结束1" />  
    12.         <endEvent id="endEvent3" name="结束3" />  
    13.         <userTask id="task1" name="用户任务1" />  
    14.         <userTask id="task3" name="用户任务3" />  
    15.         <userTask id="task4" name="用户任务4" />  
    16.         <sequenceFlow id="sequenceFlow3" name="" sourceRef="startEvent1"  
    17.             targetRef="task1" />  
    18.         <sequenceFlow id="sequenceFlow4" name="" sourceRef="task1"  
    19.             targetRef="subProcess1" />  
    20.         <sequenceFlow id="sequenceFlow5" name="" sourceRef="subProcess1"  
    21.             targetRef="endEvent2" />  
    22.         <sequenceFlow id="sequenceFlow6" name="" sourceRef="subProcess1"  
    23.             targetRef="task3" />  
    24.         <sequenceFlow id="sequenceFlow7" name="" sourceRef="subProcess1"  
    25.             targetRef="task4" />  
    26.         <sequenceFlow id="sequenceFlow8" name="" sourceRef="task3"  
    27.             targetRef="endEvent3" />  
    28.         <sequenceFlow id="sequenceFlow9" name="" sourceRef="task4"  
    29.             targetRef="endEvent3" />  
    30.         <subProcess id="subProcess1" name="子流程">  
    31.             <startEvent id="startEvent2" name="开始2" />  
    32.             <endEvent id="endEvent1" name="结束2" />  
    33.             <userTask id="task2" name="用户任务2" />  
    34.             <sequenceFlow id="sequenceFlow1" name="" sourceRef="startEvent2"  
    35.                 targetRef="task2" />  
    36.             <sequenceFlow id="sequenceFlow2" name="" sourceRef="task2"  
    37.                 targetRef="endEvent1" />  
    38.         </subProcess>  
    39.     </process>  
    40.     <bpmndi:BPMNDiagram id="BPMNDiagram_subGraph2">  
    41.         <bpmndi:BPMNPlane bpmnElement="subGraph2" id="BPMNPlane_subGraph2">  
    42.             <bpmndi:BPMNShape bpmnElement="startEvent1"  
    43.                 id="BPMNShape_startEvent1">  
    44.                 <omgdc:Bounds height="31" width="31" x="60" y="119.5" />  
    45.             </bpmndi:BPMNShape>  
    46.             <bpmndi:BPMNShape bpmnElement="startEvent2"  
    47.                 id="BPMNShape_startEvent2">  
    48.                 <omgdc:Bounds height="32" width="32" x="389.0" y="292.5" />  
    49.             </bpmndi:BPMNShape>  
    50.             <bpmndi:BPMNShape bpmnElement="endEvent1" id="BPMNShape_endEvent1">  
    51.                 <omgdc:Bounds height="34" width="34" x="740.0" y="291.0" />  
    52.             </bpmndi:BPMNShape>  
    53.             <bpmndi:BPMNShape bpmnElement="endEvent2" id="BPMNShape_endEvent2">  
    54.                 <omgdc:Bounds height="34" width="34" x="740" y="120" />  
    55.             </bpmndi:BPMNShape>  
    56.             <bpmndi:BPMNShape bpmnElement="endEvent3" id="BPMNShape_endEvent3">  
    57.                 <omgdc:Bounds height="34" width="34" x="620" y="630" />  
    58.             </bpmndi:BPMNShape>  
    59.             <bpmndi:BPMNShape bpmnElement="task1" id="BPMNShape_task1">  
    60.                 <omgdc:Bounds height="50" width="90" x="230" y="110" />  
    61.             </bpmndi:BPMNShape>  
    62.             <bpmndi:BPMNShape bpmnElement="task2" id="BPMNShape_task2">  
    63.                 <omgdc:Bounds height="50" width="90" x="540.0" y="283.0" />  
    64.             </bpmndi:BPMNShape>  
    65.             <bpmndi:BPMNShape bpmnElement="task3" id="BPMNShape_task3">  
    66.                 <omgdc:Bounds height="50" width="90" x="440" y="520" />  
    67.             </bpmndi:BPMNShape>  
    68.             <bpmndi:BPMNShape bpmnElement="task4" id="BPMNShape_task4">  
    69.                 <omgdc:Bounds height="50" width="90" x="750" y="520" />  
    70.             </bpmndi:BPMNShape>  
    71.             <bpmndi:BPMNShape bpmnElement="subProcess1"  
    72.                 id="BPMNShape_subProcess1">  
    73.                 <omgdc:Bounds height="210" width="570" x="360" y="230" />  
    74.             </bpmndi:BPMNShape>  
    75.             <bpmndi:BPMNEdge bpmnElement="sequenceFlow1" id="BPMNEdge_sequenceFlow1">  
    76.                 <omgdi:waypoint x="421.0" y="308.5"></omgdi:waypoint>  
    77.                 <omgdi:waypoint x="480.5" y="308.5"></omgdi:waypoint>  
    78.                 <omgdi:waypoint x="480.5" y="308.0"></omgdi:waypoint>  
    79.                 <omgdi:waypoint x="540.0" y="308.0"></omgdi:waypoint>  
    80.             </bpmndi:BPMNEdge>  
    81.             <bpmndi:BPMNEdge bpmnElement="sequenceFlow2" id="BPMNEdge_sequenceFlow2">  
    82.                 <omgdi:waypoint x="630.0" y="308.0"></omgdi:waypoint>  
    83.                 <omgdi:waypoint x="740.0" y="308.0"></omgdi:waypoint>  
    84.             </bpmndi:BPMNEdge>  
    85.             <bpmndi:BPMNEdge bpmnElement="sequenceFlow3" id="BPMNEdge_sequenceFlow3">  
    86.                 <omgdi:waypoint x="91.0" y="135.0"></omgdi:waypoint>  
    87.                 <omgdi:waypoint x="230.0" y="135.0"></omgdi:waypoint>  
    88.             </bpmndi:BPMNEdge>  
    89.             <bpmndi:BPMNEdge bpmnElement="sequenceFlow4" id="BPMNEdge_sequenceFlow4">  
    90.                 <omgdi:waypoint x="275.0" y="160.0"></omgdi:waypoint>  
    91.                 <omgdi:waypoint x="275.0" y="335.0"></omgdi:waypoint>  
    92.                 <omgdi:waypoint x="360.0" y="335.0"></omgdi:waypoint>  
    93.             </bpmndi:BPMNEdge>  
    94.             <bpmndi:BPMNEdge bpmnElement="sequenceFlow5" id="BPMNEdge_sequenceFlow5">  
    95.                 <omgdi:waypoint x="645.0" y="230.0"></omgdi:waypoint>  
    96.                 <omgdi:waypoint x="645.0" y="137.0"></omgdi:waypoint>  
    97.                 <omgdi:waypoint x="740.0" y="137.0"></omgdi:waypoint>  
    98.             </bpmndi:BPMNEdge>  
    99.             <bpmndi:BPMNEdge bpmnElement="sequenceFlow6" id="BPMNEdge_sequenceFlow6">  
    100.                 <omgdi:waypoint x="640.0" y="440.0"></omgdi:waypoint>  
    101.                 <omgdi:waypoint x="640.0" y="480.0"></omgdi:waypoint>  
    102.                 <omgdi:waypoint x="485.0" y="480.0"></omgdi:waypoint>  
    103.                 <omgdi:waypoint x="485.0" y="520.0"></omgdi:waypoint>  
    104.             </bpmndi:BPMNEdge>  
    105.             <bpmndi:BPMNEdge bpmnElement="sequenceFlow7" id="BPMNEdge_sequenceFlow7">  
    106.                 <omgdi:waypoint x="650.0" y="440.0"></omgdi:waypoint>  
    107.                 <omgdi:waypoint x="650.0" y="480.0"></omgdi:waypoint>  
    108.                 <omgdi:waypoint x="795.0" y="480.0"></omgdi:waypoint>  
    109.                 <omgdi:waypoint x="795.0" y="520.0"></omgdi:waypoint>  
    110.             </bpmndi:BPMNEdge>  
    111.             <bpmndi:BPMNEdge bpmnElement="sequenceFlow8" id="BPMNEdge_sequenceFlow8">  
    112.                 <omgdi:waypoint x="485.0" y="570.0"></omgdi:waypoint>  
    113.                 <omgdi:waypoint x="485.0" y="647.0"></omgdi:waypoint>  
    114.                 <omgdi:waypoint x="620.0" y="647.0"></omgdi:waypoint>  
    115.             </bpmndi:BPMNEdge>  
    116.             <bpmndi:BPMNEdge bpmnElement="sequenceFlow9" id="BPMNEdge_sequenceFlow9">  
    117.                 <omgdi:waypoint x="795.0" y="570.0"></omgdi:waypoint>  
    118.                 <omgdi:waypoint x="795.0" y="647.0"></omgdi:waypoint>  
    119.                 <omgdi:waypoint x="654.0" y="647.0"></omgdi:waypoint>  
    120.             </bpmndi:BPMNEdge>  
    121.         </bpmndi:BPMNPlane>  
    122.     </bpmndi:BPMNDiagram>  
    123. </definitions>  

     

    转成后,则直接通过以下api可发布至流程引擎:

     

    Deployment deployment= repositoryService.createDeployment().name(bpmDefinition.getSubject()).addString(bpmDefinition.getSubject()+".bpmn20.xml",actFlowDefXml).deploy();  

     

热点排行