feat: evaluate built-in routing predicates and parameterized host conditions

Store transition when as JSON instead of a lookup key so designers can compose closed-set logic while hosts still supply complex refs with args. Match conditional edges before the unconditional default.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
0264408
2026-09-18 11:09:50 +08:00
co-authored by Cursor
parent e177e9592a
commit 1f6e33c14b
27 changed files with 781 additions and 83 deletions
+4 -4
View File
@@ -18,7 +18,7 @@
## 能力
- 线性或多步图:`StepTransition` + 可选 `RoutingCondition`
- 线性或多步图:`StepTransition` + 内置谓词 / 宿主 `RoutingCondition`
- 会签/或签:`ApprovalPolicy.ALL` / `ANY`(多候选人)
- ACTION 步骤:事务提交后调用宿主 `ActionHandler`
- 发起人撤回:`WITHDRAWN`,待办任务 `SKIPPED`
@@ -72,7 +72,7 @@ ordo.approve(manager.id(), "maria", "ok");
],
"transitions": [
{ "from": "notify-submitted", "to": "manager" },
{ "from": "manager", "to": "hr", "when": "days-gt-3", "priority": 0 },
{ "from": "manager", "to": "hr", "when": { "gt": ["days", 3] }, "priority": 0 },
{ "from": "manager", "to": "notify-approved", "priority": 1 },
{ "from": "hr", "to": "notify-approved" },
{ "from": "notify-approved", "to": null }
@@ -81,7 +81,7 @@ ordo.approve(manager.id(), "maria", "ok");
```
- `kind` 默认 `APPROVAL`;ACTION 用 `"action"` 作为 handler 查找键。
- 转移按 `priority` 升序匹配;`when` 为空或条件命中则走该边;`to: null` 表示结束。
- 带 `when` 的边先按 `priority` 匹配,都未命中再走无条件边;`to: null` 表示结束。
- 代码侧可用 `ProcessDefinitionParser.fromJson(...)`。
- `replace` 会整体替换同 id 定义;存在 `RUNNING` 实例时拒绝替换。
@@ -111,7 +111,7 @@ ordo:
| Bean | 默认 |
|---|---|
| `AssigneeResolver` | 候选人即办理人 |
| `RoutingCondition` | 始终匹配(全局单例;宿主可按 key 分发) |
| `RoutingCondition` | 始终匹配(`ref` 边;宿主可按 key+args 分发) |
| `ActionHandler` | 空操作 |
| `OrdoEventListener` | 可注册多个,提交后按顺序调用 |