Class ApproveOperation

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

public final class ApproveOperation extends Object
Approve action — marks the caller's task DONE+APPROVED, evaluates the step and either advances the instance (next step / END) or stays put for further approvals (v4 §8.2 / §8.3). 同意操作 —— 把当前任务置为 DONE+APPROVED,评估当前节点并酌情推进到下一步 / END。
Since:
JDK 25, opencode-base-flow V1.0.5
Author:
Leon Soo
  • Constructor Details

    • ApproveOperation

      public ApproveOperation(FlowRepository repo, HistoryWriter history, StepEvaluator evaluator, TransitionResolver router, StepEntry stepEntry)
      Construct an approve operation with a no-op FlowMetrics. 构造同意操作(no-op FlowMetrics)。
      Parameters:
      repo - persistence facade — 持久化门面
      history - history writer — 历史追加器
      evaluator - step evaluator — 节点评估器
      router - transition resolver — 流转解析器
      stepEntry - step entry helper — 节点进入工具
      Since:
      JDK 25, opencode-base-flow V1.0.5
    • ApproveOperation

      public ApproveOperation(FlowRepository repo, HistoryWriter history, StepEvaluator evaluator, TransitionResolver router, StepEntry stepEntry, FlowMetrics metrics)
      Construct an approve operation with explicit FlowMetrics. 构造同意操作(显式注入 FlowMetrics)。
      Parameters:
      repo - persistence facade — 持久化门面
      history - history writer — 历史追加器
      evaluator - step evaluator — 节点评估器
      router - transition resolver — 流转解析器
      stepEntry - step entry helper — 节点进入工具
      metrics - metrics sink — 指标接收器
      Since:
      JDK 25, opencode-base-flow V1.0.5
  • Method Details

    • execute

      public void execute(Task task, FlowDefinition def, String comment)
      Execute the approve action. 执行同意操作。

      R1 S-5: the entire multi-step body (task UPDATE + history append + step evaluation + cancel-siblings + instance UPDATE + next-step entry) runs inside FlowRepository.runInTransaction(Runnable) so a partial failure rolls back atomically on JDBC backends. Nested calls join the outer transaction.

      R1 S-5:整段(task UPDATE + history + 评估 + cancel siblings + 实例 UPDATE + 进入下一步)置于 FlowRepository.runInTransaction(Runnable) 中,JDBC 后端可原子回滚;嵌套调用自动并入外层事务。

      Parameters:
      task - the already-validated owned PENDING task — 已校验的任务
      def - flow definition — 流程定义
      comment - sanitised comment (nullable) — 已清洗意见(可空)
      Since:
      JDK 25, opencode-base-flow V1.0.5