package com.tykj.workflowcore.workflow_editer.validate;

import org.flowable.validation.ProcessValidator;
import org.flowable.validation.ProcessValidatorFactory;
import org.flowable.validation.validator.ValidatorSet;
import org.springframework.stereotype.Component;

/**
 * ClassName:    ProcessValidatorFactoryExt
 * Package:    com.example.config
 * Description:
 * Datetime:    2021/3/26   14:04
 *
 * @Author: zsp
 */
@Component
public class ProcessValidatorFactoryExt extends ProcessValidatorFactory {

    @Override
    public ProcessValidator createDefaultProcessValidator() {
        ProcessValidator defaultProcessValidator = super.createDefaultProcessValidator();
        //将自定义校验器添加进去
        ValidatorSet validatorSet = new ValidatorSet("Validate BPMN");
        validatorSet.addValidator(new FlowEventValidator());
        defaultProcessValidator.getValidatorSets().add(validatorSet);
        return defaultProcessValidator;
    }

}
