您的位置:首页 > 产品设计 > 产品经理

《jbpm5简单小案例》--环境搭建好,建立新项目只需替换bpmn文件即可

2013-04-16 23:10 513 查看
<?xml version="1.0" encoding="UTF-8"?> 
<definitions id="Definition"
             targetNamespace="http://www.jboss.org/drools"
             typeLanguage="http://www.java.com/javaTypes"
             expressionLanguage="http://www.mvel.org/2.0"
             xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"
             xmlns:g="http://www.jboss.org/drools/flow/gpd"
             xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
             xmlns:dc="http://www.omg.org/spec/DD/20100524/DC"
             xmlns:di="http://www.omg.org/spec/DD/20100524/DI"
             xmlns:tns="http://www.jboss.org/drools">

  <itemDefinition id="_strItem" structureRef="String" />
  <itemDefinition id="_numItem" structureRef="Integer" />

  <process processType="Private" isExecutable="true" id="com.sample.bpmn.hello" name="Hello World" >

    <extensionElements>
     <tns:import name="java.io.*" />
    </extensionElements>
    <!-- process variables -->
    <property id="str" itemSubjectRef="_strItem"/>
    <property id="num" itemSubjectRef="_numItem"/>

    <!-- nodes -->
    <startEvent id="_1" name="StartProcess" />
    <scriptTask id="_2" name="input" scriptFormat="http://www.java.com/java" >
      <script>System.out.println("please input str:");

BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));

str = bf.readLine();
System.out.println(str);

String numstr = bf.readLine();
num = Integer.parseInt(numstr);

kcontext.setVariable("str", str);
kcontext.setVariable("num", num);
</script>
    </scriptTask>
    <endEvent id="_3" name="EndProcess" >
        <terminateEventDefinition/>
    </endEvent>
    <scriptTask id="_4" name="output" scriptFormat="http://www.java.com/java" >
      <script>System.out.println("your input is:" + str);

System.out.println("your input is:" + num);</script>
    </scriptTask>
    <exclusiveGateway id="_5" name="Gateway" gatewayDirection="Diverging" />
    <scriptTask id="_6" name="yes" scriptFormat="http://www.java.com/java" >
      <script>System.out.println("yyyyyyy");</script>
    </scriptTask>
    <scriptTask id="_7" name="no" scriptFormat="http://www.java.com/java" >
      <script>System.out.println("nnnnnnnnnnn");</script>
    </scriptTask>
    <exclusiveGateway id="_8" name="Gateway" gatewayDirection="Converging" />

    <!-- connections -->
    <sequenceFlow id="_1-_2" sourceRef="_1" targetRef="_2" />
    <sequenceFlow id="_4-_3" sourceRef="_4" targetRef="_3" />
    <sequenceFlow id="_8-_4" sourceRef="_8" targetRef="_4" />
    <sequenceFlow id="_2-_5" sourceRef="_2" targetRef="_5" />
    <sequenceFlow id="_5-_6" sourceRef="_5" targetRef="_6" name="yes" >
      <conditionExpression xsi:type="tFormalExpression" language="http://www.java.com/java" >System.out.println("yes");

return num > 100;</conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="_5-_7" sourceRef="_5" targetRef="_7" name="no" >
      <conditionExpression xsi:type="tFormalExpression" language="http://www.java.com/java" >System.out.println("no");

return num <= 100;</conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="_6-_8" sourceRef="_6" targetRef="_8" />
    <sequenceFlow id="_7-_8" sourceRef="_7" targetRef="_8" />

  </process>

  <bpmndi:BPMNDiagram>
    <bpmndi:BPMNPlane bpmnElement="com.sample.bpmn.hello" >
      <bpmndi:BPMNShape bpmnElement="_1" >
        <dc:Bounds x="88" y="16" width="48" height="48" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="_2" >
        <dc:Bounds x="72" y="96" width="80" height="48" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="_3" >
        <dc:Bounds x="88" y="498" width="48" height="48" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="_4" >
        <dc:Bounds x="72" y="418" width="80" height="48" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="_5" >
        <dc:Bounds x="88" y="176" width="48" height="48" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="_6" >
        <dc:Bounds x="16" y="257" width="80" height="48" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="_7" >
        <dc:Bounds x="128" y="257" width="80" height="48" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="_8" >
        <dc:Bounds x="88" y="337" width="48" height="48" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="_1-_2" >
        <di:waypoint x="112" y="40" />
        <di:waypoint x="112" y="120" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="_4-_3" >
        <di:waypoint x="112" y="442" />
        <di:waypoint x="112" y="522" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="_8-_4" >
        <di:waypoint x="112" y="361" />
        <di:waypoint x="112" y="442" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="_2-_5" >
        <di:waypoint x="112" y="120" />
        <di:waypoint x="112" y="200" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="_5-_6" >
        <di:waypoint x="112" y="200" />
        <di:waypoint x="56" y="281" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="_5-_7" >
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐