zoukankan      html  css  js  c++  java
  • flowableのID生成器

    1.  ID生成器

    • DbIdGenerator
    • StrongUuidGenerator
    • 自定义生成器

    2. 在流程配置类ProcessEngineConfigurationImpl中初始化生成

        @Override
        public void initIdGenerator() {
            if (idGenerator == null) {
                DbIdGenerator dbIdGenerator = new DbIdGenerator();
                dbIdGenerator.setIdBlockSize(idBlockSize);
                idGenerator = dbIdGenerator;
            }
    
            if (idGenerator instanceof DbIdGenerator) {
                DbIdGenerator dbIdGenerator = (DbIdGenerator) idGenerator;
                if (dbIdGenerator.getIdBlockSize() == 0) {
                    dbIdGenerator.setIdBlockSize(idBlockSize);
                }
                if (dbIdGenerator.getCommandExecutor() == null) {
                    dbIdGenerator.setCommandExecutor(getCommandExecutor());
                }
                if (dbIdGenerator.getCommandConfig() == null) {
                    dbIdGenerator.setCommandConfig(getDefaultCommandConfig().transactionRequiresNew());
                }
            }
        }

    3.  自定义ID生成器实现IdGenerator

    import org.flowable.common.engine.impl.cfg.IdGenerator;
    import java.util.UUID;
    
    public class McmUuidGenerator implements IdGenerator {
        @Override
        public String getNextId() {
            return "mcm_"+UUID.randomUUID().toString();
        }
    }

    4.  在配置类中设置

    @Configuration
    public class FlowableConfig implements EngineConfigurationConfigurer<SpringProcessEngineConfiguration> {
        @Override
        public void configure(SpringProcessEngineConfiguration engineConfiguration) {
            engineConfiguration.setActivityFontName("宋体");
            engineConfiguration.setLabelFontName("宋体");
            engineConfiguration.setAnnotationFontName("宋体");
            engineConfiguration.setIdGenerator(new McmUuidGenerator());//自定义id生成器
        }
    
    }
  • 相关阅读:
    C++中的空类,编译器默认可以产生哪些成员函数
    野指针(Wild pointer)和悬垂指针(dangling pointer)
    WHY C++ ?(by Herb Sutter) & C++17 standard
    mapreduce 多路输出
    stdout 编码 vim 删除左边,右边
    积累碎片shell
    python logging模块
    shell 流程控制
    shell 变量
    时间管理法则
  • 原文地址:https://www.cnblogs.com/yangjiming/p/11153936.html
Copyright © 2011-2022 走看看