JBPM4接口介绍

(1)发布流程:
1:启动JBPM引擎 ProcessEngine

ProcessEngine processEngine;
processEngine = Configuration.getProcessEngine();

2:发布流程
  RepositoryService respositoryService =

processEngine.getRepositoryService();

respositoryService.createDeployment().addResourceFromClasspath

("helloworld.jpdl.xml").deploy();//创建流程发布包,并发布
------------------------------------
(2)查看流程定义

  List<ProcessDefinition> list =

respositoryService.createProcessDefinitionQuery.list();
for( ProcessDefinition pd : list){

   Systme.out.println(pd.getId);
}

-------------------------------------
(3)删除流程定义

String processDefinitionId = responsitoryService.createDeployment

().addResourceFromClasspath("helloworld.jpdl.xml");

responsitoryService.deleteDeploymentCascade(processDefinitionId);

//级联删除流程定义下的所以流程定义及流程定义的实例

-------------------------------------------------------
(4)获得流程实例

ExecutionService executeService = processEngine.getExcuteServie();
//ExcecutionService是用来专门控制流程实例的

ProcessInstance pi = executionService.startProcessInstanceByKey

("helloworld");

pi= executionService.signalExecutionById(pi.getId());
  //执行到等待状态后,继续执行
System.out.println(pi.isEnded());

(5)终结流程
  
pi = exectionService.endProcessInstance(pi.getId(),"cancel");

(6)删除流程
  
pi = exectionService.deleteProcessInstanceCascade(pi.getId());

(7)查看流程实例

  List<ProcessInstance> list =

executionService.createProcessInstanceQuery().list();

你可能感兴趣的:(JBPM4接口介绍)