當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。