Class StepEntry
java.lang.Object
cloud.opencode.base.flow.internal.StepEntry
Shared helper that materialises a
Step into one or more PENDING
Task rows for an existing FlowInstance.
共享工具:把 Step 物化为若干 PENDING Task,写入仓储。
Used by both DefaultFlowInstanceService (initial step) and the
approve / reject operations (advance / rollback).
由 DefaultFlowInstanceService(初始节点)以及 approve / reject
操作(推进 / 回溯)共用。
Strategy:
- approve / sequential: 1 task for assignees[0]
- approve / one_of_n: 1 task per assignee
- vote (any strategy): 1 task per assignee
- end: no tasks (caller handles instance completion)
- Since:
- JDK 25, opencode-base-flow V1.0.5
- Author:
- Leon Soo
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intEngine-side cap on a${...}expression's body length.static final intEngine-side cap on the number of resolved user ids per step entry. -
Constructor Summary
ConstructorsConstructorDescriptionStepEntry(FlowRepository repo, AssigneeResolver assigneeResolver, ExpressionEvaluator exprEvaluator) Constructs a step-entry helper with default snowflake ids. -
Method Summary
Modifier and TypeMethodDescriptioncreateOne(FlowInstance instance, Step step, String userId) Creates a single PENDING task for the given assignee (used by sequential approve to add the next-in-line task after the current approver passes).enter(FlowInstance instance, Step step) Creates and persists the PENDING tasks for a step entry.resolveStepAssignees(FlowInstance instance, Step step) Resolves every assignee declared on the step into a flat de-duplicated list of user ids (order preserved by first-seen).
-
Field Details
-
MAX_EXPR_LEN
public static final int MAX_EXPR_LENEngine-side cap on a${...}expression's body length. Hosts that legitimately need more must build their own SPI wrapper; defence-in-depth against expression-language injection (CVE-2022-22963 class).${...}表达式体的引擎侧长度上限;超过则拒绝(避免表达式注入)。- See Also:
-
MAX_RESOLVED_USERS_PER_STEP
public static final int MAX_RESOLVED_USERS_PER_STEPEngine-side cap on the number of resolved user ids per step entry. Bounds the AssigneeResolver SPI fan-out so a single role expansion (e.g. "approve by entire department") cannot starve the engine, and removes the worst-case for the dedup pass. 单节点解析后用户数上限。AssigneeResolver SPI 单次扇出不得超过该值, 避免"全员审批"类配置拖垮引擎,同时为去重提供确定性上界。- Since:
- JDK 25, opencode-base-flow V1.0.5
- See Also:
-
-
Constructor Details
-
StepEntry
public StepEntry(FlowRepository repo, AssigneeResolver assigneeResolver, ExpressionEvaluator exprEvaluator) Constructs a step-entry helper with default snowflake ids. 使用默认 snowflake id 构造 helper。- Parameters:
repo- persistence facade — 持久化门面assigneeResolver- assignee resolver SPI — 参与者解析 SPIexprEvaluator- optional expression evaluator (nullable) — 可选表达式求值 SPI- Since:
- JDK 25, opencode-base-flow V1.0.5
-
-
Method Details
-
enter
Creates and persists the PENDING tasks for a step entry. 创建并持久化进入该节点应有的 PENDING 任务。- Parameters:
instance- owning instance — 所属实例step- step to enter — 进入的节点- Returns:
- list of created tasks (empty if step is END) — 已创建任务(END 节点返回空)
- Since:
- JDK 25, opencode-base-flow V1.0.5
-
createOne
Creates a single PENDING task for the given assignee (used by sequential approve to add the next-in-line task after the current approver passes). 为指定承接人创建单个 PENDING 任务(sequential approve 推进下一位)。- Parameters:
instance- owning instance — 所属实例step- step — 所在节点userId- assignee user id — 承接人- Returns:
- the created task — 已创建任务
- Since:
- JDK 25, opencode-base-flow V1.0.5
-
resolveStepAssignees
Resolves every assignee declared on the step into a flat de-duplicated list of user ids (order preserved by first-seen). 把节点上声明的所有参与者解析为去重后的 userId 列表(按首次出现顺序)。- Parameters:
instance- owning instance — 所属实例step- step — 节点- Returns:
- resolved user ids — 解析后的 userId 列表
- Since:
- JDK 25, opencode-base-flow V1.0.5
-