package cn.axzo.workflow.form.conf;

import cn.axzo.workflow.form.engine.api.CustomFormServiceImpl;
import org.flowable.form.spring.SpringFormEngineConfiguration;
import org.flowable.spring.boot.EngineConfigurationConfigurer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import static org.flowable.common.engine.impl.AbstractEngineConfiguration.DB_SCHEMA_UPDATE_TRUE;

/**
 * 表单引擎配置
 *
 * @author wangli
 * @since 2024-11-04 13:38
 */
@Configuration
public class FormFlowableConfiguration {

    @Bean
    public EngineConfigurationConfigurer<SpringFormEngineConfiguration> formEngineConfigurer() {
        return configuration -> {
            configuration.setDatabaseSchemaUpdate(DB_SCHEMA_UPDATE_TRUE);
            configuration.setFormService(new CustomFormServiceImpl(configuration));
        };
    }
}
