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

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

Introduction

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

Prototype

public static WorkflowDefinition updateActive(long companyId, long userId, String name, int version,
            boolean active) throws WorkflowException 

Source Link

Usage

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

License:Open Source License

protected void deleteWorkflowDefinition(ActionRequest actionRequest) throws Exception {

    String cmd = ParamUtil.getString(actionRequest, Constants.CMD);

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

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

    if (cmd.equals(Constants.DEACTIVATE) || cmd.equals(Constants.RESTORE)) {
        boolean active = !cmd.equals(Constants.DEACTIVATE);

        WorkflowDefinitionManagerUtil.updateActive(themeDisplay.getCompanyId(), themeDisplay.getUserId(), name,
                version, active);/* w w w. j  a  va2  s  . c  om*/
    } else {
        WorkflowDefinitionManagerUtil.undeployWorkflowDefinition(themeDisplay.getCompanyId(),
                themeDisplay.getUserId(), name, version);
    }
}