流程模板管理接口
查询流程模板相关信息
基本用法
IWorkflowTemplateManager 接口对象通过 Engine 对象获取,在表单后台的自定义代码界面可通过以下方式调用 IWorkflowTemplateManager 接口的方法。
WorkflowTemplate node = this.Engine.WorkflowTemplate.GetDraftTemplate("sxlsbdew4xu273");
接口列表
获取设计中的流程模板
功能描述
获取设计中的流程模板。
接口定义
WorkflowTemplate GetDraftTemplate(string schemaCode);
参数
| 参数名称 |
是否必填 |
类型 |
描述 |
schemaCode |
是 |
string |
流程模板编码 |
返回值
| 类型 |
描述 |
WorkflowTemplate |
流程模板草稿对象 |
示例
string schemaCode = "D00018fd918fe37ca841ebb5342890730a5966";
H3.Workflow.Template.WorkflowTemplate template = this.Engine.WorkflowTemplateManager.GetDraftTemplate(schemaCode);
开启流程或新增流程包时默认的流程内容
功能描述
开启流程或新增流程包时默认的流程内容。
接口定义
string GetDefaultDraftWorkflowTemplate();
参数
无
返回值
| 类型 |
描述 |
string |
开启流程或新增流程包时默认的流程内容 |
示例
string templateContent = this.Engine.WorkflowTemplateManager.GetDefaultDraftWorkflowTemplate();
保存设计中的流程模板
功能描述
保存设计中的流程模板。
接口定义
bool SaveDraftTemplate(WorkflowTemplate workflowTemplate);
参数
| 极数名称 |
是否必填 |
类型 |
描述 |
workflowTemplate |
是 |
WorkflowTemplate |
流程模板草稿对象 |
返回值
示例
string schemaCode = "D00018fd918fe37ca841ebb5342890730a5966";
H3.Workflow.Template.WorkflowTemplate template = this.Engine.WorkflowTemplateManager.GetDraftTemplate(schemaCode);
bool result = this.Engine.WorkflowTemplateManager.SaveDraftTemplate(template);
获得默认版本的流程模板
功能描述
获得默认版本的流程模板。
接口定义
WorkflowTemplate GetDefaultWorkflow(string schemaCode);
参数
| 参数名称 |
是否必填 |
类型 |
描述 |
schemaCode |
是 |
string |
流程模板编码 |
返回值
| 类型 |
描述 |
WorkflowTemplate |
已发布的流程模板对象 |
示例
string schemaCode = "D00018fd918fe37ca841ebb5342890730a5966";
H3.Workflow.Template.WorkflowTemplate template = this.Engine.WorkflowTemplateManager.GetDefaultWorkflow(schemaCode);
获得流程模板族定义
功能描述
获得流程模板族定义。
接口定义
WorkflowClause GetClause(string schemaCode, bool clone = false);
参数
| 参数名称 |
是否必填 |
类型 |
描述 |
schemaCode |
是 |
string |
流程模板编码 |
clone |
否 |
bool |
是否克隆一个新对象,默认 false |
返回值
| 类型 |
描述 |
WorkflowClause |
流程模板族 |
示例
string schemaCode = "D00018fd918fe37ca841ebb5342890730a5966";
H3.Workflow.Template.WorkflowClause clause = this.Engine.WorkflowTemplateManager.GetClause(schemaCode);
根据数据模型数组批量获取流程族
功能描述
根据数据模型数组批量获取流程族。
接口定义
Dictionary<string, WorkflowClause> GetClauses(string[] schemaCodes);
参数
| 参数名称 |
是否必填 |
类型 |
描述 |
schemaCodes |
是 |
string[] |
流程包编码集合 |
返回值
| 类型 |
描述 |
Dictionary<string, WorkflowClause> |
流程模板族集合 |
示例
string[] schemaCodes = new string[] { "D00018fd918fe37ca841ebb5342890730a5966"};
Dictionary<string, H3.Workflow.Template.WorkflowClause> clauseDict = this.Engine.WorkflowTemplateManager.GetClauses(schemaCodes);
移除流程模板族
功能描述
移除流程模板族。
接口定义
void RemoveClause(string schemaCode);
参数
| 参数名称 |
是否必填 |
类型 |
描述 |
schemaCode |
是 |
string |
流程模板编码 |
返回值
无返回值
示例
this.Engine.WorkflowTemplateManager.RemoveClause(schemaCode);
关闭流程
功能描述
关闭流程。
接口定义
void CloseWorkflow(string schemaCode);
参数
| 参数名称 |
是否必填 |
类型 |
描述 |
schemaCode |
是 |
string |
流程模板编码 |
返回值
无返回值
示例
this.Engine.WorkflowTemplateManager.CloseWorkflow(schemaCode);
获取发布后的流程模板
功能描述
获取发布后的流程模板。
接口定义
WorkflowTemplate GetPublishedTemplate(string schemaCode, int workflowVersion);
参数
| 参数名称 |
是否必填 |
类型 |
描述 |
schemaCode |
是 |
string |
流程模板编码 |
workflowVersion |
是 |
int |
流程版本号 |
返回值
| 类型 |
描述 |
WorkflowTemplate |
流程模板对象 |
示例
string schemaCode = "D00018fd918fe37ca841ebb5342890730a5966";
int workflowVersion = 100;
H3.Workflow.Template.WorkflowTemplate template = this.Engine.WorkflowTemplateManager.GetPublishedTemplate(schemaCode, workflowVersion);
获得某个流程编码的所有版本号
功能描述
获得某个流程编码的所有版本号。
接口定义
int[] GetWorkflowVersions(string schemaCode);
参数
| 参数名称 | 是否必填 | 类型 | 描述 |
| :--- | :--- | :--- | :极 |
| schemaCode | 是 | string | 流程模板编码 |
返回值
| 类型 |
描述 |
int[] |
指定流程模板的所有版本号集合 |
示例
string schemaCode = "D00018fd918fe37ca841ebb5342890730a5966";
int[] versions = this.Engine.WorkflowTemplateManager.GetWorkflowVersions(schemaCode);
获得某个流程的当前默认版本号
功能描述
获得某个流程的当前默认版本号。
接口定义
int GetWorkflowDefaultVersion(string schemaCode);
参数
| 参数名称 |
是否必填 |
类型 |
描述 |
schemaCode |
是 |
string |
流程模板编码 |
返回值
示例
string schemaCode = "D00018fd918fe37ca841ebb5342890730a5966";
int version = this.Engine.WorkflowTemplateManager.GetWorkflowDefaultVersion(schema极);
设置某个流程的默认版本号
功能描述
设置某个流程的默认版本号。
接口定义
ErrorCode SetWorkflowDefaultVersion(string schemaCode, int defaultVersion);
参数
| 参数名称 |
是否必填 |
类型 |
描述 |
schemaCode |
是 |
string |
流程模板编码 |
defaultVersion |
是 |
int |
要设置的默认版本号 |
返回值
| 类型 |
描述 |
ErrorCode |
设置成功返回 0,否则返回错误代码 |
示例
string schemaCode = "D00018fd918fe极ca841ebb5342890730a5966";
int defaultVersion = 10;
H3.ErrorCode errorCode = this.Engine.WorkflowTemplateManager.SetWorkflowDefaultVersion(schemaCode, defaultVersion);
获得某个流程的新版本号
功能描述
获得某个流程的新版本号,这个版本号并不一定能够作为新版本,因为可能获得这个版本的时候其他地方又重新发布了一个新版本。
接口定义
int GetWorkflowNewVersion(string schemaCode);
参数
| 参数名称 |
是否必填 |
类型 |
描述 |
schemaCode |
是 |
string |
流程模板编码 |
返回值
示例
int newVersion = this.Engine.WorkflowTemplateManager.GetWorkflowNewVersion(schemaCode);
设置工作流模板的状态
功能描述
设置工作流模板的状态。
接口定义
ErrorCode SetWorkflowState(string schemaCode, WorkflowState state);
参数
| 参数名称 |
是否必填 |
类型 |
描述 |
schemaCode |
是 |
string |
流程模板编码 |
state |
是 |
WorkflowState |
流程模板的状态 |
返回值
| 类型 |
描述 |
ErrorCode |
设置成功返回 0,否则返回错误代码 |
示例
this.Engine.WorkflowTemplateManager.SetWorkflowState(schemaCode, H3.Workflow.Template.WorkflowState.Active);
获得工作流模板的状态
功能描述
获得工作流模板的状态。
接口定义
WorkflowState GetWorkflowState(string schemaCode);
参数
| 参数名称 |
是否必填 |
类型 |
描述 |
schemaCode |
是 |
string |
流程模板编码 |
返回值
| 类型 |
描述 |
WorkflowState |
流程模板的状态 |
示例
H3.Workflow.Template.WorkflowState state = this.Engine.WorkflowTemplateManager.GetWorkflowState(schemaCode);
获取流程模板数量
功能描述
获取流程模板数量。
接口定义
参数
无参数
返回值
示例
int count = this.Engine.WorkflowTemplateManager.GetWorkflowCount();
移除已发布的流程模板
功能描述
移除已发布的流程模板。这里需要指定具体某一个流程模板。
接口定义
void RemoveWorkflowTemplate(string schemaCode, int workflowVersion);
参数
| 参数名称 |
是否必填 |
类型 |
描述 |
schemaCode |
是 |
string |
流程模板编码 |
workflowVersion |
是 |
int |
流程模板版本号 |
返回值
无返回值
示例
string schemaCode = "D00018fd918fe37ca841ebb5342890730a5966";
int workflowVersion = 100;
this.Engine.WorkflowTemplateManager.RemoveWorkflowTemplate(schemaCode, workflowVersion);
获取流程模板显示名称
功能描述
获取流程模板显示名称。
接口定义
string GetClauseDisplayName(string schemaCode);
参数
| 参数名称 |
是否必填 |
类型 |
描述 |
schemaCode |
是 |
string |
流程模板编码 |
返回值
示例
string schemaCode = "D00018fd918fe37ca841ebb5342890730a5966";
string displayName = this.Engine.WorkflowTemplateManager.GetClauseDisplayName(schemaCode);
获取指定版本流程模板显示名称
功能描述
获取指定版本流程模板显示名称。
接口定义
string GetTemplateDisplayName(string schemaCode, int workflowVersion);
参数
| 参数名称 |
是否必填 |
类型 |
描述 |
schemaCode |
是 |
string |
流程模板编码 |
workflowVersion |
是 |
int |
流程模板版本 |
返回值
示例
string schemaCode = "D00018fd918fe37ca841ebb5342890730a5966";
int workflowVersion = 100;
string displayName = this.Engine.WorkflowTemplateManager.GetTemplateDisplayName(schemaCode, workflowVersion);
更新流程模板族
功能描述
更新流程模板族。
接口定义
ErrorCode UpdateClause(WorkflowClause workflowClause);
参数
| 参数名称 |
是否必填 |
类型 |
描述 |
workflowClause |
是 |
WorkflowClause |
流程模板族对象 |
返回值
| 类型 |
描述 |
ErrorCode |
修改成功返回 0,否则返回错误代码 |
示例
string schemaCode = "D00018fd918fe37ca841ebb5342890730a5966";
H3.Workflow.Template.WorkflowClause clause = this.Engine.WorkflowTemplateManager.GetClause(schemaCode);
H3.ErrorCode errorCode = this.Engine.WorkflowTemplateManager.UpdateClause(clause);
添加流程模板族
功能描述
添加流程模板族。
接口定义
bool AddClause(WorkflowClause workflowClause);
参数
| 参数名称 |
是否必填 |
类型 |
描述 |
workflowClause |
是 |
WorkflowClause |
流程模板族对象 |
返回值
| 类型 |
描述 |
bool |
添加成功返回 true,否则返回 false |
示例
H3.Workflow.Template.WorkflowClause clause = new H3.Workflow.Template.WorkflowClause();
bool result = this.Engine.WorkflowTemplateManager.AddClause(clause);