package com.ruoyi.flowable.listener;

import org.flowable.engine.delegate.DelegateExecution;
import org.flowable.engine.delegate.ExecutionListener;
import org.springframework.stereotype.Component;

/**
 * 自动跳过流程任务监听
 * @author cmc
 * @date 2024-07-10
 */

@Component
public class FlowSkipListener implements ExecutionListener {
    @Override
    public void notify(DelegateExecution execution) {
        //通过设置流程变量_FLOWABLE_SKIP_EXPRESSION_ENABLED为true启动skipExpression属性,
        //必须是true而非字符串"true",若不启动是不生效的
        execution.setVariable("_FLOWABLE_SKIP_EXPRESSION_ENABLED", true);
    }
}