workflow

package
v0.0.0-...-738d89c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2023 License: AGPL-3.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTenantIDRequire  = errors.New("tenant id is required")
	ErrUserIDRequire    = errors.New("user id is required")
	ErrTaskIDRequire    = errors.New("task id is required")
	ErrIdentityNotFound = errors.New("identity link not found")
)

Functions

func AlternateSchema

func AlternateSchema() ent.Option

Types

type DbExport

type DbExport struct {
	Service *Service
}

func (*DbExport) ClaimUserTask

func (e *DbExport) ClaimUserTask(ctx context.Context, input *ent.CreateIdentityLinkInput) (added bool, err error)

ClaimUserTask 用户主动认领任务,并更新任务统计后,将任务数据返回给工作流引擎.

在创建用户任务时 CreateUserTask会默认的更新任务人数统计,因此在本方法执行时,只有候选组或参考人主动认领任务时,才会再次更新任务人数统计. 需要注意added返回值的处理.

func (*DbExport) CreateUserTask

func (e *DbExport) CreateUserTask(ctx context.Context, pi *api.InstanceRequest, taskEle *bpmn.UserTask) (tk *ent.Task, err error)

CreateUserTask 创建用户任务,并更新任务统计后,将任务数据返回给工作流引擎.

任务统计:

1.如果任务已经明确指了Assignee,则将成员数+1;
2.如果只设定了候选组,则成员数+1;
3.如果是指定了候选人且任务为多实例,则成员数及未完成数初始化总数;

func (*DbExport) GetDecisionReqDef

func (e *DbExport) GetDecisionReqDef(ctx context.Context, req *api.GetDecisionReqDefRequest) (*ent.DecisionReqDef, error)

func (*DbExport) GetGroupIDs

func (e *DbExport) GetGroupIDs(ctx context.Context, req *api.GetGroupIDsRequest) (*api.GetGroupIDResponse, error)

func (*DbExport) GetGroupUsers

func (e *DbExport) GetGroupUsers(ctx context.Context, req *api.GetGroupUserRequest) (*api.GetGroupUserResponse, error)

func (*DbExport) GetProcDef

func (e *DbExport) GetProcDef(ctx context.Context, req *api.GetProcDefRequest) (*ent.ProcDef, error)

func (*DbExport) GetUserIDs

func (e *DbExport) GetUserIDs(ctx context.Context, req *api.GetUserIDsRequest) (*api.GetUserIDResponse, error)

GetUserIDs 根据用户名称获取用户ID

func (*DbExport) Review

func (e *DbExport) Review(ctx context.Context, input *ent.UpdateIdentityLinkInput, lastUndone int) error

type Definition

type Definition struct {
	api.Exporter
	Service *Service
}

Definition temporal workflow definition.

func (*Definition) BPMNWorkflowDef

func (def *Definition) BPMNWorkflowDef(ctx workflow.Context, pi api.InstanceRequest) error

BPMNWorkflowDef is entry point of workflow.

type Service

type Service struct {
	Db           *ent.Client
	Client       client.Client
	TaskQueue    string
	WorkflowType string
	// 资源根目录
	ResourceDir string
}

func NewService

func NewService(cnf *conf.AppConfiguration) (*Service, error)

func (*Service) BuildEngine

func (s *Service) BuildEngine(name string, path string, data []byte) (eg spec.Loader, err error)

BuildEngine 构建流程引擎

func (*Service) CreateAndRunProcessInstance

func (s *Service) CreateAndRunProcessInstance(ctx context.Context, input model.StartProcessInput) (wfr *types.WorkflowRun, err error)

CreateAndRunProcessInstance 启动流程实例,如果实例已经在执行过程则返回工作流ID,否则将创新流程.对于调用方需要控制状态.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL