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

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

Introduction

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

Prototype

public static void undeployWorkflowDefinition(long companyId, long userId, String name, int version)
            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);/*from  ww w  .j  a  va  2s.c  o m*/
    } else {
        WorkflowDefinitionManagerUtil.undeployWorkflowDefinition(themeDisplay.getCompanyId(),
                themeDisplay.getUserId(), name, version);
    }
}