当前位置: 首页>>代码示例>>Java>>正文


Java UserUtil类代码示例

本文整理汇总了Java中me.kafeitu.activiti.chapter6.util.UserUtil的典型用法代码示例。如果您正苦于以下问题:Java UserUtil类的具体用法?Java UserUtil怎么用?Java UserUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


UserUtil类属于me.kafeitu.activiti.chapter6.util包,在下文中一共展示了UserUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addCandidates

import me.kafeitu.activiti.chapter6.util.UserUtil; //导入依赖的package包/类
/**
 * 添加候选人
 */
@RequestMapping("task/candidate/add/{taskId}")
@ResponseBody
public String addCandidates(@PathVariable("taskId") String taskId, @RequestParam("userOrGroupIds[]") String[] userOrGroupIds,
                            @RequestParam("type[]") String[] types, HttpServletRequest request) {
    // 设置当前操作人,对于调用活动可以获取到当前操作人
    String currentUserId = UserUtil.getUserFromSession(request.getSession()).getId();
    identityService.setAuthenticatedUserId(currentUserId);

    for (int i = 0; i < userOrGroupIds.length; i++) {
        String type = types[i];
        if (StringUtils.equals("user", type)) {
            taskService.addCandidateUser(taskId, userOrGroupIds[i]);
        } else if (StringUtils.equals("group", type)) {
            taskService.addCandidateGroup(taskId, userOrGroupIds[i]);
        }
    }
    return "success";
}
 
开发者ID:barudisshu,项目名称:activiti-in-action-codes,代码行数:22,代码来源:TaskController.java

示例2: newFile

import me.kafeitu.activiti.chapter6.util.UserUtil; //导入依赖的package包/类
/**
 * 文件类型的附件
 */
@RequestMapping(value = "new/file")
public String newFile(@RequestParam("taskId") String taskId, @RequestParam(value = "processInstanceId", required = false) String processInstanceId,
                      @RequestParam("attachmentName") String attachmentName, @RequestParam(value = "attachmentDescription", required = false) String attachmentDescription,
                      @RequestParam("file") MultipartFile file, HttpSession session) {
    try {
        String attachmentType = file.getContentType() + ";" + FilenameUtils.getExtension(file.getOriginalFilename());
        identityService.setAuthenticatedUserId(UserUtil.getUserFromSession(session).getId());
        Attachment attachment = taskService.createAttachment(attachmentType, taskId, processInstanceId, attachmentName, attachmentDescription,
                file.getInputStream());
        taskService.saveAttachment(attachment);
    } catch (IOException e) {
        e.printStackTrace();
    }
    return "redirect:/chapter6/task/getform/" + taskId;
}
 
开发者ID:barudisshu,项目名称:activiti-in-action-codes,代码行数:19,代码来源:AttachmentController.java

示例3: todoTasks

import me.kafeitu.activiti.chapter6.util.UserUtil; //导入依赖的package包/类
/**
 * 读取启动流程的表单字段
 */
@RequestMapping(value = "task/list")
public ModelAndView todoTasks(HttpSession session) throws Exception {
    String viewName = "chapter6/task-list";
    ModelAndView mav = new ModelAndView(viewName);
    User user = UserUtil.getUserFromSession(session);

    /*// 读取直接分配给当前人或者已经签收的任务
    List<Task> doingTasks = taskService.createTaskQuery().taskAssignee(user.getId()).list();

    // 等待签收的任务
    List<Task> waitingClaimTasks = taskService.createTaskQuery().taskCandidateUser(user.getId()).list();

    // 合并两种任务
    List<Task> allTasks = new ArrayList<Task>();
    allTasks.addAll(doingTasks);
    allTasks.addAll(waitingClaimTasks);*/

    // 5.16版本可以使用一下代码待办查询
    List<Task> tasks = taskService.createTaskQuery().taskCandidateOrAssigned(user.getId()).list();

    mav.addObject("tasks", tasks);
    return mav;
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:27,代码来源:TaskController.java

示例4: todoTasks

import me.kafeitu.activiti.chapter6.util.UserUtil; //导入依赖的package包/类
/**
 * 读取启动流程的表单字段
 */
@RequestMapping(value = "task/list")
public ModelAndView todoTasks(HttpSession session) throws Exception {
    String viewName = "chapter6/task-list";
    ModelAndView mav = new ModelAndView(viewName);
    User user = UserUtil.getUserFromSession(session);

    /*// 读取直接分配给当前人或者已经签收的任务
    List<Task> doingTasks = taskService.createTaskQuery().taskAssignee(user.getId()).list();

    // 等待签收的任务
    List<Task> waitingClaimTasks = taskService.createTaskQuery().taskCandidateUser(user.getId()).list();

    // 合并两种任务
    List<Task> allTasks = new ArrayList<Task>();
    allTasks.addAll(doingTasks);
    allTasks.addAll(waitingClaimTasks);*/

    // 5.16版本可以使用一下代码待办查询
    List<Task> allTasks = taskService.createTaskQuery().taskCandidateOrAssigned(user.getId()).list();

    mav.addObject("tasks", allTasks);
    return mav;
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:27,代码来源:TaskController.java

示例5: taskList

import me.kafeitu.activiti.chapter6.util.UserUtil; //导入依赖的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:shawn-gogh,项目名称:myjavacode,代码行数:14,代码来源:LeaveController.java

示例6: claim

import me.kafeitu.activiti.chapter6.util.UserUtil; //导入依赖的package包/类
/**
 * 签收任务
 */
@RequestMapping(value = "task/claim/{id}")
public String claim(@PathVariable("id") String taskId, @RequestParam(value = "nextDo", required = false) String nextDo, HttpSession session,
                    RedirectAttributes redirectAttributes) {
    String userId = UserUtil.getUserFromSession(session).getId();
    taskService.claim(taskId, userId);
    redirectAttributes.addFlashAttribute("message", "任务已签收");
    if (StringUtils.equals(nextDo, "handle")) {
        return "redirect:/chapter6/task/getform/" + taskId;
    } else {
        return TASK_LIST;
    }
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:16,代码来源:TaskController.java

示例7: addComment

import me.kafeitu.activiti.chapter6.util.UserUtil; //导入依赖的package包/类
/**
 * 保存意见
 */
@RequestMapping(value = "save", method = RequestMethod.POST)
@ResponseBody
public Boolean addComment(@RequestParam("taskId") String taskId, @RequestParam(value = "processInstanceId", required = false) String processInstanceId,
                          @RequestParam("message") String message, HttpSession session) {
    identityService.setAuthenticatedUserId(UserUtil.getUserFromSession(session).getId());
    taskService.addComment(taskId, processInstanceId, message);
    return true;
}
 
开发者ID:barudisshu,项目名称:activiti-in-action-codes,代码行数:12,代码来源:CommentController.java

示例8: addSubTask

import me.kafeitu.activiti.chapter6.util.UserUtil; //导入依赖的package包/类
/**
 * 添加子任务
 */
@RequestMapping("task/subtask/add/{taskId}")
public String addSubTask(@PathVariable("taskId") String parentTaskId, @RequestParam("taskName") String taskName,
                         @RequestParam(value = "description", required = false) String description, HttpSession session) {
    Task newTask = taskService.newTask();
    newTask.setParentTaskId(parentTaskId);
    String userId = UserUtil.getUserFromSession(session).getId();
    newTask.setOwner(userId);
    newTask.setAssignee(userId);
    newTask.setName(taskName);
    newTask.setDescription(description);

    taskService.saveTask(newTask);
    return "redirect:/chapter6/task/getform/" + parentTaskId;
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:18,代码来源:TaskController.java

示例9: deleteSubTask

import me.kafeitu.activiti.chapter6.util.UserUtil; //导入依赖的package包/类
/**
 * 删除子任务
 */
@RequestMapping("task/delete/{taskId}")
public String deleteSubTask(@PathVariable("taskId") String taskId, HttpSession session) {
    String userId = UserUtil.getUserFromSession(session).getId();
    taskService.deleteTask(taskId, "deleteByUser" + userId);
    return "redirect:/chapter6/task/archived/" + taskId;
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:10,代码来源:TaskController.java

示例10: logon

import me.kafeitu.activiti.chapter6.util.UserUtil; //导入依赖的package包/类
/**
 * 登录系统
 *
 * @param userName
 * @param password
 * @param session
 * @return
 */
@RequestMapping(value = "/logon")
public String logon(@RequestParam("username") String userName, @RequestParam("password") String password, HttpSession session) {
    logger.debug("logon request: {username={}, password={}}", userName, password);
    boolean checkPassword = identityService.checkPassword(userName, password);
    if (checkPassword) {

        // 查看用户是否存在
        User user = identityService.createUserQuery().userId(userName).singleResult();
        UserUtil.saveUserToSession(session, user);

  /*
   * 读取角色
   */
        List<Group> groupList = identityService.createGroupQuery().groupMember(user.getId()).list();
        session.setAttribute("groups", groupList);

        String[] groupNames = new String[groupList.size()];
        for (int i = 0; i < groupNames.length; i++) {
            groupNames[i] = groupList.get(i).getName();
        }
        session.setAttribute("groupNames", ArrayUtils.toString(groupNames));

        return "redirect:/main/index";
    } else {
        return "redirect:/login.jsp?error=true";
    }
}
 
开发者ID:barudisshu,项目名称:activiti-in-action-codes,代码行数:36,代码来源:UseController.java

示例11: addComment

import me.kafeitu.activiti.chapter6.util.UserUtil; //导入依赖的package包/类
/**
 * 保存意见
 */
@RequestMapping(value = "save", method = RequestMethod.POST)
@ResponseBody
public Boolean addComment(@RequestParam("taskId") String taskId, @RequestParam("processInstanceId") String processInstanceId,
                          @RequestParam("message") String message, HttpSession session) {
    identityService.setAuthenticatedUserId(UserUtil.getUserFromSession(session).getId());
    taskService.addComment(taskId, processInstanceId, message);
    return true;
}
 
开发者ID:barudisshu,项目名称:activiti-in-action-codes,代码行数:12,代码来源:CommentController.java

示例12: claim

import me.kafeitu.activiti.chapter6.util.UserUtil; //导入依赖的package包/类
/**
 * 签收任务
 */
@RequestMapping(value = "task/claim/{id}")
public String claim(@PathVariable("id") String taskId, HttpSession session, RedirectAttributes redirectAttributes) {
    String userId = UserUtil.getUserFromSession(session).getId();
    taskService.claim(taskId, userId);
    redirectAttributes.addFlashAttribute("message", "任务已签收");
    return "redirect:/chapter7/leave/task/list";
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:11,代码来源:LeaveController.java

示例13: newUrl

import me.kafeitu.activiti.chapter6.util.UserUtil; //导入依赖的package包/类
/**
     * URL类型的附件
     */
    @RequestMapping(value = "new/url")
    public String newUrl(@RequestParam("taskId") String taskId, @RequestParam(value = "processInstanceId", required = false) String processInstanceId,
                         @RequestParam("attachmentName") String attachmentName, @RequestParam(value = "attachmentDescription", required = false) String attachmentDescription,
                         @RequestParam("url") String url, HttpSession session) {
        String attachmentType = "url";
        identityService.setAuthenticatedUserId(UserUtil.getUserFromSession(session).getId());
    /*Attachment attachment = */
        taskService.createAttachment(attachmentType, taskId, processInstanceId, attachmentName, attachmentDescription, url);
    /*
     * 如果要更新附件内容,先读取附件对象,然后设置属性(只能更新name和description),最后保存附件对象
     */
//    taskService.saveAttachment(attachment);
        return "redirect:/chapter6/task/getform/" + taskId;
    }
 
开发者ID:barudisshu,项目名称:activiti-in-action-codes,代码行数:18,代码来源:AttachmentController.java

示例14: addParticipants

import me.kafeitu.activiti.chapter6.util.UserUtil; //导入依赖的package包/类
/**
 * 添加参与人
 */
@RequestMapping("task/participant/add/{taskId}")
@ResponseBody
public String addParticipants(@PathVariable("taskId") String taskId, @RequestParam("userId[]") String[] userIds, @RequestParam("type[]") String[] types,
                              HttpServletRequest request) {
    // 设置当前操作人,对于调用活动可以获取到当前操作人
    String currentUserId = UserUtil.getUserFromSession(request.getSession()).getId();
    identityService.setAuthenticatedUserId(currentUserId);

    for (int i = 0; i < userIds.length; i++) {
        taskService.addUserIdentityLink(taskId, userIds[i], types[i]);
    }
    return "success";
}
 
开发者ID:barudisshu,项目名称:activiti-in-action-codes,代码行数:17,代码来源:TaskController.java

示例15: claim

import me.kafeitu.activiti.chapter6.util.UserUtil; //导入依赖的package包/类
/**
 * 签收任务
 */
@RequestMapping(value = "task/claim/{id}")
public String claim(@PathVariable("id") String taskId, HttpSession session, RedirectAttributes redirectAttributes) {
    String userId = UserUtil.getUserFromSession(session).getId();
    taskService.claim(taskId, userId);
    redirectAttributes.addFlashAttribute("message", "任务已签收");
    return TASK_LIST;
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:11,代码来源:TaskController.java


注:本文中的me.kafeitu.activiti.chapter6.util.UserUtil类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。