本文整理汇总了Java中me.kafeitu.activiti.chapter7.entity.Leave.setProcessInstance方法的典型用法代码示例。如果您正苦于以下问题:Java Leave.setProcessInstance方法的具体用法?Java Leave.setProcessInstance怎么用?Java Leave.setProcessInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类me.kafeitu.activiti.chapter7.entity.Leave
的用法示例。
在下文中一共展示了Leave.setProcessInstance方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findTodoTasks
import me.kafeitu.activiti.chapter7.entity.Leave; //导入方法依赖的package包/类
/**
* 查询待办任务
*/
@Transactional(readOnly = true)
public List<Leave> findTodoTasks(String userId) {
List<Leave> results = new ArrayList<Leave>();
List<Task> tasks = new ArrayList<Task>();
// 根据当前人的ID查询
List<Task> todoList = taskService.createTaskQuery().processDefinitionKey("leave").taskAssignee(userId).list();
// 根据当前人未签收的任务
List<Task> unsignedTasks = taskService.createTaskQuery().processDefinitionKey("leave").taskCandidateUser(userId).list();
// 合并
tasks.addAll(todoList);
tasks.addAll(unsignedTasks);
// 根据流程的业务ID查询实体并关联
for (Task task : tasks) {
String processInstanceId = task.getProcessInstanceId();
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
String businessKey = processInstance.getBusinessKey();
Leave leave = leaveManager.get(new Long(businessKey));
leave.setTask(task);
leave.setProcessInstance(processInstance);
String processDefinitionId = processInstance.getProcessDefinitionId();
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(processDefinitionId).singleResult();
leave.setProcessDefinition(processDefinition);
results.add(leave);
}
return results;
}
示例2: findTodoTasks
import me.kafeitu.activiti.chapter7.entity.Leave; //导入方法依赖的package包/类
/**
* 查询待办任务
*/
@Transactional(readOnly = true)
public List<Leave> findTodoTasks(String userId) {
List<Leave> results = new ArrayList<Leave>();
List<Task> tasks = new ArrayList<Task>();
// 根据当前人的ID查询
List<Task> todoList = taskService.createTaskQuery().processDefinitionKey("leave").taskAssignee(userId).active().list();
// 根据当前人未签收的任务
List<Task> unsignedTasks = taskService.createTaskQuery().processDefinitionKey("leave").taskCandidateUser(userId).active().list();
// 合并
tasks.addAll(todoList);
tasks.addAll(unsignedTasks);
// 根据流程的业务ID查询实体并关联
for (Task task : tasks) {
String processInstanceId = task.getProcessInstanceId();
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
String businessKey = processInstance.getBusinessKey();
Leave leave = leaveManager.get(new Long(businessKey));
leave.setTask(task);
leave.setProcessInstance(processInstance);
String processDefinitionId = processInstance.getProcessDefinitionId();
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(processDefinitionId).singleResult();
leave.setProcessDefinition(processDefinition);
results.add(leave);
}
return results;
}