本文整理匯總了Java中me.kafeitu.activiti.chapter7.entity.Leave.setProcessDefinition方法的典型用法代碼示例。如果您正苦於以下問題:Java Leave.setProcessDefinition方法的具體用法?Java Leave.setProcessDefinition怎麽用?Java Leave.setProcessDefinition使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類me.kafeitu.activiti.chapter7.entity.Leave
的用法示例。
在下文中一共展示了Leave.setProcessDefinition方法的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;
}