List of usage examples for com.liferay.portal.kernel.workflow WorkflowInstanceManagerUtil getWorkflowInstance
public static WorkflowInstance getWorkflowInstance(long companyId, long workflowInstanceId) throws WorkflowException
From source file:com.liferay.portlet.workflowinstances.action.ActionUtil.java
License:Open Source License
public static void getWorkflowInstance(HttpServletRequest request) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); long workflowInstanceId = ParamUtil.getLong(request, "workflowInstanceId"); WorkflowInstance workflowInstance = null; if (workflowInstanceId > 0) { workflowInstance = WorkflowInstanceManagerUtil.getWorkflowInstance(themeDisplay.getCompanyId(), workflowInstanceId);//from ww w.j a v a2s . c om } request.setAttribute(WebKeys.WORKFLOW_INSTANCE, workflowInstance); }
From source file:com.liferay.portlet.workflowinstances.action.EditWorkflowInstanceAction.java
License:Open Source License
protected void deleteInstance(ActionRequest actionRequest) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); long workflowInstanceId = ParamUtil.getLong(actionRequest, "workflowInstanceId"); WorkflowInstance workflowInstance = WorkflowInstanceManagerUtil .getWorkflowInstance(themeDisplay.getCompanyId(), workflowInstanceId); Map<String, Serializable> workflowContext = workflowInstance.getWorkflowContext(); long companyId = GetterUtil.getLong(workflowContext.get(WorkflowConstants.CONTEXT_COMPANY_ID)); long groupId = GetterUtil.getLong(workflowContext.get(WorkflowConstants.CONTEXT_GROUP_ID)); String className = GetterUtil.getString(workflowContext.get(WorkflowConstants.CONTEXT_ENTRY_CLASS_NAME)); long classPK = GetterUtil.getLong(workflowContext.get(WorkflowConstants.CONTEXT_ENTRY_CLASS_PK)); WorkflowHandler workflowHandler = WorkflowHandlerRegistryUtil.getWorkflowHandler(className); workflowHandler.updateStatus(WorkflowConstants.STATUS_DRAFT, workflowContext); WorkflowInstanceLinkLocalServiceUtil.deleteWorkflowInstanceLink(companyId, groupId, className, classPK); }