activiti查詢
一 1.根據當前任務id獲得當前任務對象
Task task = processEngine.getTaskService().createTaskQuery().taskId(taskId).singleResult();
2.根據流程id獲得流程實例
ProcessInstance pi =processEngine.getRuntimeService().createProcessInstanceQuery().processInstanceId(task.getProcessInstanceId()).singleResult();
3.根據任務id獲得流程實例id
task.getProcessInstanceId();
4.根據任務id獲得流程定義id
task.getProcessDefinitionId();
5.更具流程實例id獲得流程
HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery()
.processInstanceId(pProcessInstanceId).singleResult();
6.根據任務名字獲得所有任務
List<Task> list = taskService.createTaskQuery()
.taskCandidateOrAssigned("userId").list();
7.添加批註信息
taskService.addComment(taskId, task.getProcessInstanceId(), message);
8.查詢批註信息
List<Comment> list = taskService.getProcessInstanceComments(task.getProcessInstanceId());
9.獲取歷史流程實例
HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery()
.processInstanceId(pProcessInstanceId).singleResult();
10.獲得流程定義(根據歷史流程實例id)
ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService)
.getDeployedProcessDefinition(historicProcessInstance.getProcessDefinitionId());
11.獲得流程實例中已執行的節點
List<HistoricActivityInstance> historicActivityInstanceList = historyService.createHistoricActivityInstanceQuery()
.processInstanceId(pProcessInstanceId).orderByHistoricActivityInstanceId().asc().list();
12.查詢流程定
List<ProcessDifintion> list = processEngine.getRepositoryService.CreateProcessDefinitionQuery().processDefinitionId(processDefifinitionId).list();
---------------------
作者:pgh_1947
來源:CSDN
原文:https://blog.csdn.net/pgh_1947/article/details/77340711
版權聲明:本文為博主原創文章,轉載請附上博文鏈接!
activiti查詢