这里直接讲如何部署启动的简单流程。/** * 部署流程定义 */Deployment deploy = processEngine.getRepositoryService().createDeployment() .addClasspathResource('hello/hello.png') .addClasspathResource('hello/hello.bpmn') .name('helloWord演示') .deploy();System.out.println(deploy);
//使用key启动,默认使用最新版本String key = 'helloworld';//流程实例ProcessInstance processInstance = processEngine.getRuntimeService().startProcessInstanceByKey(key);System.out.println(processInstance.getId());System.out.println(processInstance.getProcessDefinitionId());
String assignee = '王五';List
/** * 完成任务 */String taskId = '30002';processEngine.getTaskService().complete(taskId);System.out.println('=========================');System.out.println('任务Id:'+taskId);System.out.println('任务完成');
String deploymentId = '';processEngine.getRepositoryService().createProcessDefinitionQuery(); // .deploymentId(deploymentId);部署对象id查询 // .processDefinitionKey(key);使用流程定义key查询 //.processDefinitionNameLike(name);使用流程定义名称模糊查询 //.processDefinitionId(id);流程定义id查询 //.list();返回集合列表,封装流程定义 //.listPage(start,end);分页查询 //.count();返回数量 //.orderByProcessDefinitionVersion().desc();根据版本降序排列
/** * 刪除流程定义 */
String deploymentId = '25006';processEngine.getRepositoryService() .deleteDeployment(deploymentId,true);//使用部署id刪除,已经部署的无法删除,默认false,设置true,启用级联删除
这里的代码,可以直接粘贴测试