<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                ![](https://img.kancloud.cn/ae/3c/ae3c16005e6612fb273abd0be9095751_1225x174.png) 排他網關,用來在流程中實現決策。 當流程執行到這個網關,所有分支都會判斷條件是否為true,如果為true則執行該分支。 <br/> **注意**:排他網關只會選擇一個為true的分支執行。如果有兩個分支條件都為true,排他網關會選擇id值較小的一條分支去執行。 <br/> 為什么要用排他網關? 不用排他網關也可以實現分支,如在連線的condition條件上設置分支條件。 在連線設置condition條件的缺點:如果條件都不滿足,流程就結束了(是異常結束)。 如果使用排他網關決定分支的走向,則從網關出去的線所有條件都不滿足則系統拋出異常。 ```java org.activiti.engine.ActivitiException: No outgoing sequence flow of the exclusive gateway 'exclusivegateway1' could be selected for continuing the process at org.activiti.engine.impl.bpmn.behavior.ExclusiveGatewayActivityBehavior.leave(ExclusiveGatewayActivityBehavior.java:85) ``` <br/> 演示,步驟如下: **1. 流程定義** ![](https://img.kancloud.cn/c0/b6/c0b67cd6156388749a00927ba73f8dd4_844x376.png) **2. java程序** ```java public class ActivitiGatewayExclusive { /** * 部署流程定義 */ @Test public void testDeployment() { //1、創建ProcessEngine ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine(); //2、得到RepositoryService實例 RepositoryService repositoryService = processEngine.getRepositoryService(); //3、使用RepositoryService進行部署 Deployment deployment = repositoryService.createDeployment() .addClasspathResource("bpmn/evection-exclusive.bpmn") .addClasspathResource("bpmn/evection.png") .name("出差申請流程-排他網關") .deploy(); //4、輸出部署信息 System.out.println("流程部署id:" + deployment.getId()); System.out.println("流程部署名稱:" + deployment.getName()); } /** * 啟動流程實例,設置流程變量的值 */ @Test public void startProcess() { //獲取流程引擎 ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine(); //獲取RunTimeService RuntimeService runtimeService = processEngine.getRuntimeService(); //流程定義key String key = "exclusive"; //創建變量集合 Map<String, Object> map = new HashMap<String, Object>(); //創建出差pojo對象 Evection evection = new Evection(); //設置出差天數 evection.setNum(2d); //定義流程變量,把出差pojo對象放入map map.put("evection", evection); //啟動流程實例,并設置流程變量的值(把map傳入) ProcessInstance processInstance = runtimeService .startProcessInstanceByKey(key, map); //輸出 System.out.println("流程實例名稱=" + processInstance.getName()); System.out.println("流程定義id==" + processInstance.getProcessDefinitionId()); } /** * 完成個人任務 */ @Test public void completTask() { //流程定義的Key String key = "exclusive"; //任務負責人 String assingee = "jerry"; //獲取流程引擎 ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine(); //獲取taskservice TaskService taskService = processEngine.getTaskService(); //查詢任務 Task task = taskService.createTaskQuery() .processDefinitionKey(key) .taskAssignee(assingee) .singleResult(); if (task != null) { //根據任務id來完成任務 taskService.complete(task.getId()); } } } ``` **3. 測試結果** 在部門經理審核后,走排他網關,從排他網關出來的分支有兩條,一條是判斷出差天數是否大于3天,另一條是判斷出差天數是否小于等于3天。 設置分支條件時,如果所有分支條件都不是true,報錯: ```java org.activiti.engine.ActivitiException: No outgoing sequence flow of the exclusive gateway 'exclusivegateway1' could be selected for continuing the process at org.activiti.engine.impl.bpmn.behavior.ExclusiveGatewayActivityBehavior.leave(ExclusiveGatewayActivityBehavior.java:85) ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看