Documentation
¶
Overview ¶
Package engine 引擎接口 + 常量
Index ¶
- Constants
- type AssignmentHandler
- type DecisionHandler
- type Engine
- type EngineImpl
- func (e *EngineImpl) ExecuteAndJumpTask(ctx context.Context, taskID int64, operator string, ...) (*model.ProcessInstance, error)
- func (e *EngineImpl) ExecuteAndJumpToEnd(ctx context.Context, taskID int64, operator string, ...) (*model.ProcessInstance, error)
- func (e *EngineImpl) ExecuteAndJumpToFirstTaskNode(ctx context.Context, taskID int64, operator string, ...) (*model.ProcessInstance, error)
- func (e *EngineImpl) ExecuteProcessTask(ctx context.Context, taskID int64, operator string, ...) (*model.ProcessInstance, error)
- func (e *EngineImpl) SetExtensions(ext *Extensions)
- func (e *EngineImpl) SetRegistry(reg *HandlerRegistry)
- func (e *EngineImpl) StartProcessInstanceByID(ctx context.Context, defineID int64, operator string, ...) (*model.ProcessInstance, error)
- type EventType
- type Extensions
- type FlowInterceptor
- type HandlerRegistry
- func (r *HandlerRegistry) RegisterAssignment(name string, h IAssignmentHandler)
- func (r *HandlerRegistry) RegisterDecision(name string, h IDecisionHandler)
- func (r *HandlerRegistry) ResolveAssignment(name string) IAssignmentHandler
- func (r *HandlerRegistry) ResolveDecision(name string) IDecisionHandler
- type IAssignmentHandler
- type IDecisionHandler
- type ProcessEvent
- type ProcessEventListener
Constants ¶
View Source
const ( KeySubmitType = "submitType" KeyBusinessNo = "BUSINESS_NO" KeyUserID = "u_userId" KeyRealName = "u_realName" KeyDeptID = "u_deptId" KeyDeptName = "u_deptName" KeyPostID = "u_postId" KeyPostName = "u_postName" KeyAutoGenTitle = "autoGenTitle" // v1.0.1:下一节点处理人(对齐 boot3 tf_nextNodeOperator) KeyNextNodeOperator = "tf_nextNodeOperator" // v1.0.1:系统代执行 / 超级管理员(对齐 boot3 FlowConst) KeyAutoExecute = "flow.auto" KeyAdminID = "flow.admin" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AssignmentHandler ¶
type AssignmentHandler func(handlerName string, node *model.FlowNode, inst *model.ProcessInstance) []string
AssignmentHandler 动态参与者指派——对标 Java AssignmentHandler.assign handlerName: 节点配置的 assignmentHandler 类名(如 "com.xxx.MyHandler") 返回参与者 ID 列表(nil 表示不处理)
type DecisionHandler ¶
type DecisionHandler func(handlerName string, node *model.FlowNode, inst *model.ProcessInstance, vars map[string]interface{}) string
DecisionHandler 自定义决策处理器——对标 Java DecisionHandler handlerName: 节点配置的 decisionHandler 类名 返回选中的分支边 ID(空字符串表示不处理)
type Engine ¶
type Engine interface {
StartProcessInstanceByID(ctx context.Context, defineID int64, operator string, args map[string]interface{}) (*model.ProcessInstance, error)
ExecuteProcessTask(ctx context.Context, taskID int64, operator string, args map[string]interface{}) (*model.ProcessInstance, error)
ExecuteAndJumpToEnd(ctx context.Context, taskID int64, operator string, args map[string]interface{}) (*model.ProcessInstance, error)
ExecuteAndJumpTask(ctx context.Context, taskID int64, operator string, args map[string]interface{}, targetTaskName string) (*model.ProcessInstance, error)
ExecuteAndJumpToFirstTaskNode(ctx context.Context, taskID int64, operator string, args map[string]interface{}) (*model.ProcessInstance, error)
}
type EngineImpl ¶
type EngineImpl struct {
// contains filtered or unexported fields
}
func New ¶
func New(repo spi.ProcessRepository, userProv spi.UserProvider, idGen spi.IDGenerator, exprEval spi.ExpressionEvaluator) *EngineImpl
func (*EngineImpl) ExecuteAndJumpTask ¶
func (e *EngineImpl) ExecuteAndJumpTask(ctx context.Context, taskID int64, operator string, args map[string]interface{}, targetTaskName string) (*model.ProcessInstance, error)
func (*EngineImpl) ExecuteAndJumpToEnd ¶
func (e *EngineImpl) ExecuteAndJumpToEnd(ctx context.Context, taskID int64, operator string, args map[string]interface{}) (*model.ProcessInstance, error)
func (*EngineImpl) ExecuteAndJumpToFirstTaskNode ¶
func (e *EngineImpl) ExecuteAndJumpToFirstTaskNode(ctx context.Context, taskID int64, operator string, args map[string]interface{}) (*model.ProcessInstance, error)
func (*EngineImpl) ExecuteProcessTask ¶
func (e *EngineImpl) ExecuteProcessTask(ctx context.Context, taskID int64, operator string, args map[string]interface{}) (*model.ProcessInstance, error)
func (*EngineImpl) SetExtensions ¶
func (e *EngineImpl) SetExtensions(ext *Extensions)
func (*EngineImpl) SetRegistry ¶
func (e *EngineImpl) SetRegistry(reg *HandlerRegistry)
func (*EngineImpl) StartProcessInstanceByID ¶
func (e *EngineImpl) StartProcessInstanceByID(ctx context.Context, defineID int64, operator string, args map[string]interface{}) (*model.ProcessInstance, error)
type Extensions ¶
type Extensions struct {
Interceptors []FlowInterceptor
AssignmentHandler AssignmentHandler
DecisionHandler DecisionHandler
Listeners []ProcessEventListener
}
Extensions 引擎扩展配置
type FlowInterceptor ¶
type FlowInterceptor interface {
// PreHandle 节点执行前调用,返回 false 则跳过该节点
PreHandle(node *model.FlowNode, inst *model.ProcessInstance) (proceed bool)
// PostHandle 节点执行后调用
PostHandle(node *model.FlowNode, inst *model.ProcessInstance)
// Order 拦截器排序,越小越先执行
Order() int
}
FlowInterceptor 流程拦截器——对标 Java FlowInterceptor
type HandlerRegistry ¶
type HandlerRegistry struct {
// contains filtered or unexported fields
}
HandlerRegistry 处理器注册表——按名称注册/解析
func NewHandlerRegistry ¶
func NewHandlerRegistry() *HandlerRegistry
func (*HandlerRegistry) RegisterAssignment ¶
func (r *HandlerRegistry) RegisterAssignment(name string, h IAssignmentHandler)
RegisterAssignment 注册参与者指派处理器
func (*HandlerRegistry) RegisterDecision ¶
func (r *HandlerRegistry) RegisterDecision(name string, h IDecisionHandler)
RegisterDecision 注册决策处理器
func (*HandlerRegistry) ResolveAssignment ¶
func (r *HandlerRegistry) ResolveAssignment(name string) IAssignmentHandler
ResolveAssignment 按名称解析指派处理器
func (*HandlerRegistry) ResolveDecision ¶
func (r *HandlerRegistry) ResolveDecision(name string) IDecisionHandler
ResolveDecision 按名称解析决策处理器
type IAssignmentHandler ¶
type IAssignmentHandler interface {
// Assign 返回参与者列表
Assign(node *model.FlowNode, inst *model.ProcessInstance) []string
}
IAssignmentHandler 参与者指派处理器接口
type IDecisionHandler ¶
type IDecisionHandler interface {
// Decide 返回选中的分支边 ID
Decide(node *model.FlowNode, inst *model.ProcessInstance, vars map[string]interface{}) string
}
IDecisionHandler 决策处理器接口
type ProcessEvent ¶
type ProcessEvent struct {
Type EventType
InstanceID int64
TaskID int64
NodeID string
Operator string
}
ProcessEvent 流程事件
type ProcessEventListener ¶
type ProcessEventListener func(event ProcessEvent)
ProcessEventListener 事件监听器
Click to show internal directories.
Click to hide internal directories.