SoFunction
Updated on 2025-03-08

Summary of the usage example of inclusive in jd-easyflow

In jd-easyflow,inclusiveUsually with the conditional branch in the process (conditions) configuration related, used to control the execution logic of multiple conditional branches. whenconditionTypeSet asinclusiveWhen indicating that all conditions in multiple condition branches are evaluated instead ofexclusiveThat way, the evaluation will be terminated once a certain condition is met.

Here is how to define the use in jd-easyflow's JSON process fileinclusiveExample of event triggering mechanism:

1. Define the conditional branch:
existpostIn configuration, useconditionsFields to define multiple conditional branches. Each conditional branch containswhen(conditional expression) andto(Node to jump to when the condition is met).

2. Settingsinclusivemodel:
existconditionsIn the field, you can set itconditionTypeforinclusive, so that all conditions will be evaluated.

3. Configure the default branch:
If no conditions are met, you can usedefaultToField specifies the default branch.

The following is a specific JSON process file example showing how to use itinclusive

{
  "id": "flow_with_inclusive",
  "name": "Flow with Inclusive Conditions",
  "nodes": [
    {
      "id": "start_node",
      "name": "Start Node",
      "action": {
        "createExp": "new ()"
      },
      "start": true,
      "post": {
        "to": "decision_node"
      }
    },
    {
      "id": "decision_node",
      "name": "Decision Node",
      "post": {
        "conditions": [
          {
            "when": "${condition1}",
            "to": "node1"
          },
          {
            "when": "${condition2}",
            "to": "node2"
          }
        ],
        "conditionType": "inclusive",
        "defaultTo": "default_node"
      }
    },
    {
      "id": "node1",
      "name": "Node 1",
      "action": {
        "createExp": "new .Node1Action()"
      },
      "post": {
        "to": "end_node"
      }
    },
    {
      "id": "node2",
      "name": "Node 2",
      "action": {
        "createExp": "new .Node2Action()"
      },
      "post": {
        "to": "end_node"
      }
    },
    {
      "id": "default_node",
      "name": "Default Node",
      "action": {
        "createExp": "new ()"
      },
      "post": {
        "to": "end_node"
      }
    },
    {
      "id": "end_node",
      "name": "End Node",
      "action": {
        "createExp": "new ()"
      }
    }
  ]
}

In this example,decision_nodeis a decision node, which has two conditional branches, both set toinclusivemodel. This means the process engine evaluatescondition1andcondition2, if they all satisfy, the process can enter at the same timenode1andnode2. If no conditions are met, the process will enterdefault_node. This configuration allows for more complex process control logic, allowing processes to dynamically branch to different nodes according to multiple conditions.

How to use it in jd-easyflowinclusiveDetailed description and examples of

This is the end of this article about the example usage of inclusive in jd-easyflow. For more related jd-easyflow inclusive content, please search for my previous articles or continue to browse the related articles below. I hope everyone will support me in the future!