Example usage for com.liferay.portal.kernel.workflow WorkflowDefinitionManagerUtil getWorkflowDefinitions

List of usage examples for com.liferay.portal.kernel.workflow WorkflowDefinitionManagerUtil getWorkflowDefinitions

Introduction

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

Prototype

public static List<WorkflowDefinition> getWorkflowDefinitions(long companyId, String name, int start, int end,
            OrderByComparator<WorkflowDefinition> orderByComparator) throws WorkflowException 

Source Link

Usage

From source file:com.liferay.portlet.workflowdefinitions.action.ActionUtil.java

License:Open Source License

public static void getWorkflowDefinition(HttpServletRequest request) throws Exception {

    if (request.getAttribute(WebKeys.WORKFLOW_DEFINITION) != null) {
        return;/*  w ww . j a  v  a2  s .c o m*/
    }

    ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);

    String name = ParamUtil.getString(request, "name");
    int version = ParamUtil.getInteger(request, "version");

    List<WorkflowDefinition> workflowDefinitions = WorkflowDefinitionManagerUtil.getWorkflowDefinitions(
            themeDisplay.getCompanyId(), name, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);

    for (WorkflowDefinition workflowDefinition : workflowDefinitions) {
        if (version == workflowDefinition.getVersion()) {
            request.setAttribute(WebKeys.WORKFLOW_DEFINITION, workflowDefinition);

            break;
        }
    }
}