工作流学习(二)

做公司的oa系统,所以接触到了工作利用,我们这里的工作流用的是activiti。

我这里主要总结一下自己学习的过程,以及遇到的问题和解决方案。

(一)学习过程

1)安装插件

我用的是myeclipse,有activiti插件,我们可以直接安装。

1.help------install new software

2.Add

 

3.http://activiti.org/designer/update/

 

4等待下载,然后Next就行

 

5.activiti数据库的安装

在数据库中执行安装文件中create下面的sql文件即可

2)安装好插件后,就可以开始开发了。

这里最主要的问题是,流程梳理。我们可以使用插件图形化创建流程引擎。这里不做赘述。

详细内容参考acitviti的官方文献。下面我会上传文档。

创建的文件是.bpmn

创建后,就可以用图形化工具创建流程。

 Activiti Modeler


对于单个节点的编辑:


点击以后节点的性质会在properties里面看到,在这里我们就可以修改该节点的性质。

id:唯一标识在该流程中该节点的信息。

name:节点显示的名称。

main config:这个很重要。


这里的配置是拥有该节点权限的用户或者用户组。

上面只介绍了一种任务图形的用法,还有很多其他的,例如,网管,流等。用的时候自行查看。

创建好流程后就可以编写流程启动代码,下一环节将详细介绍,此处只讲大概流程。

上面的流程用文本形式表示是:

<?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:xsd="http://www.w3.org/2001/XMLSchema" 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" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="appointProcess">
  <process id="appointProcess" name="经理任命" isExecutable="true">
    <startEvent id="startevent1" name="Start" activiti:initiator="appoint_apply_user"></startEvent>
    <userTask id="appoint_approve_hr" name="人事审批" activiti:candidateGroups="${appoint_approve_hr}"></userTask>
    <sequenceFlow id="flow1" sourceRef="startevent1" targetRef="appoint_approve_hr"></sequenceFlow>
    <exclusiveGateway id="exclusivegateway1" name="Exclusive Gateway"></exclusiveGateway>
    <sequenceFlow id="flow2" sourceRef="appoint_approve_hr" targetRef="exclusivegateway1"></sequenceFlow>
    <userTask id="appoint_apply_user" name="打回修改" activiti:candidateGroups="${appoint_apply_user}"></userTask>
    <sequenceFlow id="flow3" sourceRef="exclusivegateway1" targetRef="appoint_apply_user">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${approve_result == 'callback'}]]></conditionExpression>
    </sequenceFlow>
    <userTask id="appoint_approve_yyz" name="营运总审批" activiti:candidateGroups="${appoint_approve_yyz}"></userTask>
    <sequenceFlow id="flow4" sourceRef="exclusivegateway1" targetRef="appoint_approve_yyz">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${approve_result =='pass'}]]></conditionExpression>
    </sequenceFlow>
    <exclusiveGateway id="exclusivegateway2" name="Exclusive Gateway"></exclusiveGateway>
    <sequenceFlow id="flow5" sourceRef="appoint_approve_yyz" targetRef="exclusivegateway2"></sequenceFlow>
    <exclusiveGateway id="exclusivegateway3" name="Exclusive Gateway"></exclusiveGateway>
    <sequenceFlow id="flow6" sourceRef="appoint_apply_user" targetRef="exclusivegateway3"></sequenceFlow>
    <sequenceFlow id="flow7" sourceRef="exclusivegateway3" targetRef="appoint_approve_hr">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${approve_result == 'pass'}]]></conditionExpression>
    </sequenceFlow>
    <userTask id="appoint_handle_hr" name="人事处理" activiti:candidateGroups="${appoint_handle_hr}"></userTask>
    <sequenceFlow id="flow8" sourceRef="exclusivegateway2" targetRef="appoint_handle_hr">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${approve_result == 'pass'}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="flow9" sourceRef="exclusivegateway2" targetRef="appoint_apply_user">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${approve_result == 'callback'}]]></conditionExpression>
    </sequenceFlow>
    <endEvent id="endevent1" name="End"></endEvent>
    <sequenceFlow id="flow10" sourceRef="appoint_handle_hr" targetRef="endevent1">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${approve_result=='close'}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="flow11" sourceRef="exclusivegateway3" targetRef="endevent1">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${approve_result=='close'}]]></conditionExpression>
    </sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_appointProcess">
    <bpmndi:BPMNPlane bpmnElement="appointProcess" id="BPMNPlane_appointProcess">
      <bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1">
        <omgdc:Bounds height="35.0" width="35.0" x="90.0" y="128.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="appoint_approve_hr" id="BPMNShape_appoint_approve_hr">
        <omgdc:Bounds height="55.0" width="141.0" x="200.0" y="120.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="exclusivegateway1" id="BPMNShape_exclusivegateway1">
        <omgdc:Bounds height="40.0" width="40.0" x="440.0" y="127.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="appoint_apply_user" id="BPMNShape_appoint_apply_user">
        <omgdc:Bounds height="51.0" width="91.0" x="695.0" y="39.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="appoint_approve_yyz" id="BPMNShape_appoint_approve_yyz">
        <omgdc:Bounds height="51.0" width="131.0" x="530.0" y="205.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="exclusivegateway2" id="BPMNShape_exclusivegateway2">
        <omgdc:Bounds height="40.0" width="40.0" x="720.0" y="210.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="exclusivegateway3" id="BPMNShape_exclusivegateway3">
        <omgdc:Bounds height="40.0" width="40.0" x="720.0" y="-51.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="appoint_handle_hr" id="BPMNShape_appoint_handle_hr">
        <omgdc:Bounds height="55.0" width="111.0" x="870.0" y="203.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
        <omgdc:Bounds height="35.0" width="35.0" x="908.0" y="128.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
        <omgdi:waypoint x="125.0" y="145.0"></omgdi:waypoint>
        <omgdi:waypoint x="200.0" y="147.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
        <omgdi:waypoint x="341.0" y="147.0"></omgdi:waypoint>
        <omgdi:waypoint x="440.0" y="147.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3">
        <omgdi:waypoint x="460.0" y="127.0"></omgdi:waypoint>
        <omgdi:waypoint x="460.0" y="65.0"></omgdi:waypoint>
        <omgdi:waypoint x="695.0" y="64.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow4" id="BPMNEdge_flow4">
        <omgdi:waypoint x="460.0" y="167.0"></omgdi:waypoint>
        <omgdi:waypoint x="460.0" y="230.0"></omgdi:waypoint>
        <omgdi:waypoint x="530.0" y="230.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow5" id="BPMNEdge_flow5">
        <omgdi:waypoint x="661.0" y="230.0"></omgdi:waypoint>
        <omgdi:waypoint x="720.0" y="230.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow6" id="BPMNEdge_flow6">
        <omgdi:waypoint x="740.0" y="39.0"></omgdi:waypoint>
        <omgdi:waypoint x="740.0" y="-11.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow7" id="BPMNEdge_flow7">
        <omgdi:waypoint x="720.0" y="-31.0"></omgdi:waypoint>
        <omgdi:waypoint x="270.0" y="-32.0"></omgdi:waypoint>
        <omgdi:waypoint x="270.0" y="120.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow8" id="BPMNEdge_flow8">
        <omgdi:waypoint x="760.0" y="230.0"></omgdi:waypoint>
        <omgdi:waypoint x="870.0" y="230.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow9" id="BPMNEdge_flow9">
        <omgdi:waypoint x="740.0" y="210.0"></omgdi:waypoint>
        <omgdi:waypoint x="740.0" y="90.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow10" id="BPMNEdge_flow10">
        <omgdi:waypoint x="925.0" y="203.0"></omgdi:waypoint>
        <omgdi:waypoint x="925.0" y="163.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow11" id="BPMNEdge_flow11">
        <omgdi:waypoint x="760.0" y="-31.0"></omgdi:waypoint>
        <omgdi:waypoint x="925.0" y="-31.0"></omgdi:waypoint>
        <omgdi:waypoint x="925.0" y="128.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值