当前位置: 首页>>代码示例>>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;未经允许,请勿转载。