Interface AssigneeResolver

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface AssigneeResolver
Resolves an assignee declaration into a concrete list of user IDs. 把声明式参与者(user / role / dept / expr)解析成实际 userId 列表。

The engine consults this SPI whenever a step is about to materialise its tasks, dispatching on Assignee.type(). Implementations should throw if resolution returns nothing meaningful; an empty list is treated as error BASE-FLOW-RES-001 by the engine.

引擎在节点创建任务时调用本 SPI,根据 Assignee.type() 分派。 实现方在解析无意义时应直接抛异常;返回空列表会被引擎统一视为 BASE-FLOW-RES-001 错误。

Since:
JDK 25, opencode-base-flow V1.0.5
Author:
Leon Soo
  • Method Summary

    Modifier and Type
    Method
    Description
    resolve(Assignee assignee, FlowContext ctx)
    Resolves the given Assignee declaration into the concrete user IDs that should receive the task.
    default boolean
    Validates that a userId refers to a real, active user able to receive tasks.
  • Method Details

    • resolve

      List<String> resolve(Assignee assignee, FlowContext ctx)
      Resolves the given Assignee declaration into the concrete user IDs that should receive the task. 把给定 Assignee 解析成实际接收任务的 userId 列表。
      Parameters:
      assignee - the declarative assignee record from the DSL — DSL 中的声明式参与者
      ctx - the current flow context — 当前流程上下文
      Returns:
      non-null list of user IDs (empty list is treated as error BASE-FLOW-RES-001) — 非 null userId 列表(空列表视为错误)
      Since:
      JDK 25, opencode-base-flow V1.0.5
    • validateUser

      default boolean validateUser(String userId, FlowContext ctx)
      Validates that a userId refers to a real, active user able to receive tasks. Default returns true (no validation; the host is responsible). Implementations are encouraged to provide a real check in multi-tenant / off-boarded-user scenarios. 校验给定 userId 是否为系统中可承接任务的有效用户。 默认 true(不做校验,由宿主自行保证 transfer 安全)。 实现方建议在多租户 / 离职用户场景下提供真实判定。
      Parameters:
      userId - candidate user id — 待校验 userId
      ctx - the current flow context — 当前流程上下文
      Returns:
      true when the user is valid for task delivery — 用户可接收任务时返回 true
      Since:
      JDK 25, opencode-base-flow V1.0.5