[Activiti] Activiti in action

阅读更多
Activiti in action
---------------------

1
流程文件: bookorder.simple.bpmn20.xml

 #2








2
API:
public class SimpleProcessTest {
@Test
public void startBookOrder() {
ProcessEngine processEngine = ProcessEngineConfiguration #1
.createStandaloneInMemProcessEngineConfiguration() #1
.buildProcessEngine(); #1
RuntimeService runtimeService =
processEngine.getRuntimeService();
RepositoryService repositoryService =
processEngine.getRepositoryService();
repositoryService.createDeployment() #2
.addClasspathResource("bookorder.simple.bpmn20.xml") #2
.deploy(); #2
ProcessInstance processInstance = #3
runtimeService.startProcessInstanceByKey( #3
"simplebookorder"); #3
assertNotNull(processInstance.getId());
System.out.println("id " + processInstance.getId() + " " +
processInstance.getProcessDefinitionId());
}
}


3
API 解析:
ProcessEngineConfiguration
ProcessEngine
    RepositoryService
        Deployment
    RuntimeService
ProcessInstance
-----------------------
3.1
创建流程引擎:
3.1.1 从配置文件配置: activiti.cfg.xml
ProcessEngine processEngine = ProcessEngineConfiguration
   .createProcessEngineConfigurationFromResourceDefault()
   .buildProcessEngine();


3.1.2 代码创建
ProcessEngine processEngine = ProcessEngineConfiguration
   .createStandaloneProcessEngineConfiguration()
   .buildProcessEngine();

Or

ProcessEngine processEngine = ProcessEngineConfiguration
   .createStandaloneInMemProcessEngineConfiguration()
   .buildProcessEngine();

你可能感兴趣的:(java)