Activiti入门学习demo_1_流程定义和发布
2016-06-14 17:46
267 查看
环境参照另一个博客中
@Test
public void testProcessDefinition() {
// 创建 Activiti流程引擎
ProcessEngine processEngine = ProcessEngineConfiguration.
createProcessEngineConfigurationFromResource("activiti.cfg.xml").
buildProcessEngine();
// 取得 Activiti 服务
RepositoryService repositoryService = processEngine.getRepositoryService();
RuntimeService runtimeService = processEngine.getRuntimeService();
// 部署流程定义
Deployment deploy = repositoryService.createDeployment().
addClasspathResource("Interview.bpmn").deploy();
//查看定义的流程(非必须,只是验证流程定义是否部署成功)
System.out.println("deploy.getId():" + deploy.getId()); //数字:1
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
.deploymentId(deploy.getId()).singleResult();
System.out.println("processDefinition.getKey():"+processDefinition.getKey()); //process中id的值,自定义的: Interview
// 启动流程实例
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processDefinition.getKey());
System.out.println("pid="+processInstance.getId()+",pdid="+
processInstance.getProcessDefinitionId()); //pid=4,pdid=Interview:1:3
}
@Test
public void testProcessDefinition() {
// 创建 Activiti流程引擎
ProcessEngine processEngine = ProcessEngineConfiguration.
createProcessEngineConfigurationFromResource("activiti.cfg.xml").
buildProcessEngine();
// 取得 Activiti 服务
RepositoryService repositoryService = processEngine.getRepositoryService();
RuntimeService runtimeService = processEngine.getRuntimeService();
// 部署流程定义
Deployment deploy = repositoryService.createDeployment().
addClasspathResource("Interview.bpmn").deploy();
//查看定义的流程(非必须,只是验证流程定义是否部署成功)
System.out.println("deploy.getId():" + deploy.getId()); //数字:1
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
.deploymentId(deploy.getId()).singleResult();
System.out.println("processDefinition.getKey():"+processDefinition.getKey()); //process中id的值,自定义的: Interview
// 启动流程实例
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processDefinition.getKey());
System.out.println("pid="+processInstance.getId()+",pdid="+
processInstance.getProcessDefinitionId()); //pid=4,pdid=Interview:1:3
}
相关文章推荐
- 加法器(基于Swing,计算精度高于Excel)
- 计算机类期刊审稿周期
- android studio 添加按钮点击事件的三种方法
- linux--几种常见的进程调度算法
- 组合框
- C 碎片六 函数
- Vuforia AR 物体制作阴影
- iOS数组中的判断某元素是否存在于数组中
- Boa服务器移植及应用(一)
- sqlite内存数据库和文件数据库的同步
- Linux资源监控工具
- ORA-06502: PL/SQL: numeric or value error: character string buffer too small
- Spring定时任务的几种实现
- C# 特性(Attribute)
- 使用过的第三方框架汇总
- 问题:聚簇索引和非聚簇索引??
- Java中处理时区的转换
- 一个android程序员的独白
- 机器学习问题方法总结
- 城市选择下拉菜单三级联动