Class AddSignOperation

java.lang.Object
cloud.opencode.base.flow.operation.AddSignOperation

public final class AddSignOperation extends Object
Add-sign action — appends additional approvers to the current step (v4 §8.5). Depth is tracked via CAS on flow_instance.addsign_depth (D21). 后加签操作 —— 通过对 flow_instance.addsign_depth 做 CAS 限制链深度。
Since:
JDK 25, opencode-base-flow V1.0.5
Author:
Leon Soo
  • Field Details

    • PROP_ADDSIGN_MAX_DEPTH

      public static final String PROP_ADDSIGN_MAX_DEPTH
      System property key for max addsign depth.
      See Also:
    • DEFAULT_MAX_DEPTH

      public static final int DEFAULT_MAX_DEPTH
      Default max addsign chain depth (v4 §8.5).
      See Also:
    • MAX_USERS_PER_CALL

      public static final int MAX_USERS_PER_CALL
      Hard ceiling on a single addSign call's recipient list. Prevents memory / metric / history blowup from a single malicious call that asks to spawn millions of tasks. 单次加签 userId 列表上限;防止单次调用扇出到千万级任务。
      See Also:
  • Constructor Details

    • AddSignOperation

      public AddSignOperation(FlowRepository repo, HistoryWriter history, TransitionResolver router, StepEntry stepEntry)
      Construct an add-sign operation with the default max-depth read once from system properties (v4 D22 — frozen at construction). 构造加签操作;构造时一次性读取 PROP_ADDSIGN_MAX_DEPTH 并固化。
      Parameters:
      repo - persistence facade — 持久化门面
      history - history writer — 历史追加器
      router - transition resolver — 流转解析器
      stepEntry - step entry helper — 节点进入工具
      Since:
      JDK 25, opencode-base-flow V1.0.5
    • AddSignOperation

      public AddSignOperation(FlowRepository repo, HistoryWriter history, TransitionResolver router, StepEntry stepEntry, int maxDepth)
      Test-only constructor with explicit max-depth. 测试用构造器(显式 max-depth)。
      Parameters:
      repo - persistence facade — 持久化门面
      history - history writer — 历史追加器
      router - transition resolver — 流转解析器
      stepEntry - step entry helper — 节点进入工具
      maxDepth - max chain depth (≥ 1) — 链深度上限(≥ 1)
      Since:
      JDK 25, opencode-base-flow V1.0.5
  • Method Details

    • execute

      public void execute(Task task, FlowDefinition def, List<String> additionalUserIds, String comment)
      Execute the add-sign action. 执行加签操作。

      R1 S-5: the CAS-increment + per-user task creation + history append runs inside FlowRepository.runInTransaction(Runnable) so a partial failure rolls back atomically on JDBC backends.

      R1 S-5:CAS 深度自增 + 逐人 task 创建 + history 追加置于 FlowRepository.runInTransaction(Runnable),JDBC 后端可原子回滚。

      Parameters:
      task - already-validated owned PENDING task — 已校验任务
      def - flow definition — 流程定义
      additionalUserIds - new approver user ids (non-empty) — 新增 userId 列表(非空)
      comment - sanitised comment (nullable) — 已清洗意见
      Since:
      JDK 25, opencode-base-flow V1.0.5