> 1. Process deployment 1. Process Engine Retrieval
ProcessEngine processEngine = new Configuration().setResource("my-own-configuration-file.xml").buildProcessEngine();
In actual development, we generally obtain the data through the spring configuration file through relevant methods.
2. obtain the corresponding WebService according to the process engine.
RepositoryService repositoryService = processEngine.getRepositoryService();ExecutionService executionService = processEngine.getExecutionService();TaskService taskService = processEngine.getTaskService();HistoryService historyService = processEngine.getHistoryService();ManagementService managementService = processEngine.getManagementService();
3. deployment process
The repositoryservice contains all the methods used to manage published resources. In the first example, we will use
Repositoryservice deploys a process resource from classpath.
String deploymentid = repositoryService.createDeployment().addResourceFromClasspath("org/jbpm/examples/services/Order.jpdl.xml").deploy();
2. Process instance Management 1. Start a process instance
The following is the simplest and most common method to start a new process instance for the process definition:
ProcessInstance processInstance = executionService.startProcessInstanceByKey("ICL");
The above service method will find the process definition of the latest version whose key is ICL, and then start it in the latest process definition.
Process instance.
When a new version is deployed in the insurance claim process, the startprocessinstancebykey method automatically switches to
The new deployment version.
2. delete an instance
executionService.deleteProcessInstanceCascade(processInstance.getId());
3. termination process
executionService.endProcessInstance(processInstance.getId(), "cancle");