任务委托:
签收了的:
taskService.delegateTask(taskId, userId);
未签收的:
taskService.addCandidateUser(taskId, userId);
有一个节点的Id怎么得到这个节点的Activity:
processDefinitionEntity.findExctivity(activitiyId)
获得当前任务的所有节点:
ProcessDefinitionEntity processDefinition1 = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService)
.getDeployedProcessDefinition(processInstance.getProcessDefinitionId());
List<ActivityImpl> activitiList = processDefinition1.getActivities();//获得当前任务的所有节点
获取历史节点信息:
List<HistoricActivityInstance> hiaciList = getHistoryService().createHistoricActivityInstanceQuery().processInstanceId(processInstanceId).finished().orderByHistoricActivityInstanceEndTime().asc().list();
HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
lastActivitiHandleUserName=historicProcessInstance.getStartUserId();
获取activiti变量:
第一种:
Map<String, Object> variables1 = runtimeService.getVariables("processInstanceId");
第二种:
List<HistoricVariableInstance> list = historyService.createHistoricVariableInstanceQuery().processInstanceId("6310").list();
for (HistoricVariableInstance variableInstance : list) {
System.out.println("variable: " + variableInstance.getVariableName() + " = " + variableInstance.getValue());
}
获取当前任务,通过processinstanceId:
Task task11= taskService.createTaskQuery().processInstanceId(processinstanceId).singleResult();
通过表达式分配任务:
变量通过map传递
删除流程:
流程没有结束: runtimeService.deleteProcessInstance(processInstanceId,"");
historyService.deleteHistoricProcessInstance(procesInstanceId);(顺序不能换)
流程已经结束:historyService.deleteHistoricProcessInstance(procesInstanceId);