Class DefaultFlowDefinitionService
java.lang.Object
cloud.opencode.base.flow.internal.DefaultFlowDefinitionService
- All Implemented Interfaces:
FlowDefinitionService
Default
FlowDefinitionService backed by the supplied
FlowRepository, DslParser, and DslValidator.
默认 FlowDefinitionService 实现。- Since:
- JDK 25, opencode-base-flow V1.0.5
- Author:
- Leon Soo
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct the service with default DSL parser / validator.DefaultFlowDefinitionService(FlowRepository repo, DslParser parser, DslValidator validator, cloud.opencode.base.flow.internal.IdProvider idProvider) Test-friendly constructor. -
Method Summary
Modifier and TypeMethodDescriptionDeploy a new flow definition from the given JSON DSL.voidDeprecate a specific (flowKey, version) definition.findActive(String flowKey) Returns the currently active definition for the given business key.listVersions(String flowKey) Lists every version of the given business key (asc by version).
-
Constructor Details
-
DefaultFlowDefinitionService
Construct the service with default DSL parser / validator. 使用默认 DSL parser / validator 构造服务。- Parameters:
repo- persistence facade — 持久化门面- Since:
- JDK 25, opencode-base-flow V1.0.5
-
DefaultFlowDefinitionService
public DefaultFlowDefinitionService(FlowRepository repo, DslParser parser, DslValidator validator, cloud.opencode.base.flow.internal.IdProvider idProvider) Test-friendly constructor. 测试友好构造器。- Parameters:
repo- persistence facade — 持久化门面parser- DSL parser — DSL 解析器validator- DSL validator — DSL 校验器idProvider- id provider — id 提供者- Since:
- JDK 25, opencode-base-flow V1.0.5
-
-
Method Details
-
deploy
Description copied from interface:FlowDefinitionServiceDeploy a new flow definition from the given JSON DSL. Allocates an id (snowflake) and persists it as ACTIVE. 部署新的流程定义(从 JSON DSL)。分配 id(snowflake)并以 ACTIVE 持久化。- Specified by:
deployin interfaceFlowDefinitionService- Parameters:
dslJson- DSL JSON string — DSL JSON 串- Returns:
- persisted definition — 已持久化的定义
-
findActive
Description copied from interface:FlowDefinitionServiceReturns the currently active definition for the given business key. 返回业务 key 当前 ACTIVE 的定义。- Specified by:
findActivein interfaceFlowDefinitionService- Parameters:
flowKey- business key — 业务 key- Returns:
- active definition (Optional) — 当前定义(Optional)
-
listVersions
Description copied from interface:FlowDefinitionServiceLists every version of the given business key (asc by version). 列出业务 key 的所有版本(按 version 升序)。- Specified by:
listVersionsin interfaceFlowDefinitionService- Parameters:
flowKey- business key — 业务 key- Returns:
- all versions — 全部版本
-
deprecate
Deprecate a specific (flowKey, version) definition. 弃用指定 (flowKey, version) 的定义。R1 S-3 (closed as design tweak): when no definition matches the given
(flowKey, version), this method throwsFlowErrorCode.DEF_DEPRECATED. The semantics is "the requested definition is not in a usable state" — closest available code to "definition not found" without expanding the 23-code catalogue locked in v4 §7.2.R1 S-3 决策:找不到指定 (flowKey, version) 时抛
FlowErrorCode.DEF_DEPRECATED。错误码总数仍保持 v4 §7.2 锁定的 23 项, 不新增 DEF_NOT_FOUND;该码语义最接近"定义不可用"。- Specified by:
deprecatein interfaceFlowDefinitionService- Parameters:
flowKey- business key — 业务 keyversion- definition version — 定义版本号- Since:
- JDK 25, opencode-base-flow V1.0.5
-