Example usage for com.liferay.portal.kernel.workflow WorkflowInstance getWorkflowContext

List of usage examples for com.liferay.portal.kernel.workflow WorkflowInstance getWorkflowContext

Introduction

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

Prototype

public Map<String, Serializable> getWorkflowContext();

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

From source file:de.hofuniversity.iisys.liferay.workflows.LoggingWorkflowEngine.java

License:Open Source License

private void logWfInstance(WorkflowInstance wf, String indent) {
    if (wf != null) {
        fLogger.println(indent + "ChildrenWorkflowInstanceCount: " + wf.getChildrenWorkflowInstanceCount());
        fLogger.println(indent + "ParentWorkflowInstanceId: " + wf.getParentWorkflowInstanceId());
        fLogger.println(indent + "state: " + wf.getState());
        fLogger.println(indent + "WorkflowDefinitionName: " + wf.getWorkflowDefinitionName());
        fLogger.println(indent + "WorkflowInstanceId: " + wf.getWorkflowInstanceId());
        fLogger.println(indent + "WorkflowContext:");
        logMap(wf.getWorkflowContext(), indent + "\t");
    }// w  w  w .  j a v a2  s .c  o m
}