1
14
15 package com.liferay.portlet.workflowtasks.action;
16
17 import com.liferay.portal.kernel.util.ParamUtil;
18 import com.liferay.portal.kernel.util.Validator;
19 import com.liferay.portal.kernel.workflow.WorkflowTask;
20 import com.liferay.portal.kernel.workflow.WorkflowTaskManagerUtil;
21 import com.liferay.portal.theme.ThemeDisplay;
22 import com.liferay.portal.util.PortalUtil;
23 import com.liferay.portal.util.WebKeys;
24
25 import javax.portlet.ActionRequest;
26 import javax.portlet.RenderRequest;
27
28 import javax.servlet.http.HttpServletRequest;
29
30
35 public class ActionUtil {
36
37 public static void getWorkflowTask(ActionRequest actionRequest)
38 throws Exception {
39
40 HttpServletRequest request = PortalUtil.getHttpServletRequest(
41 actionRequest);
42
43 getWorkflowTask(request);
44 }
45
46 public static void getWorkflowTask(RenderRequest renderRequest)
47 throws Exception {
48
49 HttpServletRequest request = PortalUtil.getHttpServletRequest(
50 renderRequest);
51
52 getWorkflowTask(request);
53 }
54
55 public static void getWorkflowTask(HttpServletRequest request)
56 throws Exception {
57
58 ThemeDisplay themeDisplay = (ThemeDisplay)request.getAttribute(
59 WebKeys.THEME_DISPLAY);
60
61 long workflowTaskId = ParamUtil.getLong(request, "workflowTaskId");
62
63 WorkflowTask workflowTask = null;
64
65 if (Validator.isNotNull(workflowTaskId)) {
66 workflowTask = WorkflowTaskManagerUtil.getWorkflowTask(
67 themeDisplay.getCompanyId(), workflowTaskId);
68 }
69
70 request.setAttribute(WebKeys.WORKFLOW_TASK, workflowTask);
71 }
72
73 }