當前位置: 首頁>>代碼示例>>Java>>正文


Java Leave類代碼示例

本文整理匯總了Java中me.kafeitu.activiti.chapter7.entity.Leave的典型用法代碼示例。如果您正苦於以下問題:Java Leave類的具體用法?Java Leave怎麽用?Java Leave使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Leave類屬於me.kafeitu.activiti.chapter7.entity包,在下文中一共展示了Leave類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: startWorkflow

import me.kafeitu.activiti.chapter7.entity.Leave; //導入依賴的package包/類
/**
 * 保存請假實體並啟動流程
 */
public ProcessInstance startWorkflow(Leave entity, String userId, Map<String, Object> variables) {
    if (entity.getId() == null) {
        entity.setApplyTime(new Date());
        entity.setUserId(userId);
    }
    leaveManager.save(entity);
    String businessKey = entity.getId().toString();

    // 用來設置啟動流程的人員ID,引擎會自動把用戶ID保存到activiti:initiator中
    identityService.setAuthenticatedUserId(userId);

    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("leave", businessKey, variables);
    String processInstanceId = processInstance.getId();
    entity.setProcessInstanceId(processInstanceId);
    logger.debug("start process of {key={}, bkey={}, pid={}, variables={}}", new Object[]{"leave", businessKey, processInstanceId, variables});
    leaveManager.save(entity);
    return processInstance;
}
 
開發者ID:shawn-gogh,項目名稱:myjavacode,代碼行數:22,代碼來源:LeaveWorkflowService.java

示例2: taskList

import me.kafeitu.activiti.chapter7.entity.Leave; //導入依賴的package包/類
/**
 * 任務列表
 *
 * @param leave
 */
@RequestMapping(value = "task/list")
public ModelAndView taskList(HttpSession session) {
    ModelAndView mav = new ModelAndView("/chapter7/leave/leave-task-list");
    String userId = UserUtil.getUserFromSession(session).getId();
    List<Leave> results = leaveService.findTodoTasks(userId);
    mav.addObject("records", results);
    return mav;
}
 
開發者ID:barudisshu,項目名稱:activiti-in-action-codes,代碼行數:14,代碼來源:LeaveController.java

示例3: 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;
}
 
開發者ID:barudisshu,項目名稱:activiti-in-action-codes,代碼行數:34,代碼來源:LeaveWorkflowService.java

示例4: 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;
}
 
開發者ID:barudisshu,項目名稱:activiti-in-action-codes,代碼行數:34,代碼來源:LeaveWorkflowService.java

示例5: showTaskView

import me.kafeitu.activiti.chapter7.entity.Leave; //導入依賴的package包/類
/**
 * 任務列表
 *
 * @param leave
 */
@RequestMapping(value = "task/view/{taskId}")
public ModelAndView showTaskView(@PathVariable("taskId") String taskId) {
    Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
    String processInstanceId = task.getProcessInstanceId();
    ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
    Leave leave = leaveManager.get(new Long(processInstance.getBusinessKey()));
    ModelAndView mav = new ModelAndView("/chapter7/leave/task-" + task.getTaskDefinitionKey());
    mav.addObject("leave", leave);
    mav.addObject("task", task);
    return mav;
}
 
開發者ID:shawn-gogh,項目名稱:myjavacode,代碼行數:17,代碼來源:LeaveController.java

示例6: notify

import me.kafeitu.activiti.chapter7.entity.Leave; //導入依賴的package包/類
public void notify(DelegateTask delegateTask) {
    Leave leave = leaveManager.get(new Long(delegateTask.getExecution().getProcessBusinessKey()));
    Object realityStartTime = delegateTask.getVariable("realityStartTime");
    leave.setRealityStartTime((Date) realityStartTime);
    Object realityEndTime = delegateTask.getVariable("realityEndTime");
    leave.setRealityEndTime((Date) realityEndTime);
    leaveManager.save(leave);
}
 
開發者ID:barudisshu,項目名稱:activiti-in-action-codes,代碼行數:9,代碼來源:ReportBackEndProcessor.java

示例7: getLeave

import me.kafeitu.activiti.chapter7.entity.Leave; //導入依賴的package包/類
/**
 * 自動綁定頁麵字段
 */
@ModelAttribute("preloadLeave")
public Leave getLeave(@RequestParam(value = "id", required = false) Long id, HttpSession session) {
    if (id != null) {
        return leaveManager.get(id);
    }
    return new Leave();
}
 
開發者ID:barudisshu,項目名稱:activiti-in-action-codes,代碼行數:11,代碼來源:LeaveController.java


注:本文中的me.kafeitu.activiti.chapter7.entity.Leave類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。