ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
RepositoryService repositoryService = processEngine.getRepositoryService();
Deployment deployment = repositoryService.createDeployment()
.addClasspathResource("processes/my-process.bpmn20.xml")
.deploy();
RuntimeService runtimeService = processEngine.getRuntimeService();
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("my-process");
TaskService taskService = processEngine.getTaskService();
List<Task> tasks = taskService.createTaskQuery().taskAssignee("kermit").list();
taskService.complete(task.getId());
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId("my-process-id").singleResult();
HistoryService historyService = processEngine.getHistoryService();
List<HistoricProcessInstance> historicProcessInstances = historyService.createHistoricProcessInstanceQuery().finished().list();
RepositoryService repositoryService = processEngine.getRepositoryService();
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(processInstance.getProcessDefinitionId()).singleResult();
这些是使用Activiti框架API的基本技巧,可以帮助您在实际开发中更好地使用Activiti框架。