Example usage for com.liferay.portal.kernel.workflow WorkflowHandler updateStatus

List of usage examples for com.liferay.portal.kernel.workflow WorkflowHandler updateStatus

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.workflow WorkflowHandler updateStatus.

Prototype

public T updateStatus(int status, Map<String, Serializable> workflowContext) throws PortalException;

Source Link

Usage

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);
}