flowable FormEngine和FormEngineConfiguration

来源:互联网 发布:cydia软件源 big 编辑:程序博客网 时间:2024/06/09 21:14

FormEngineConfiguration 继承自 AbstractEngineConfiguration。

一、获得实例

FormEngineConfiguration提供了7个公开的静态方法:
其中5个用于Spring环境下,2个用于独立运行Standalone模式。

Standalone模式代码如下:

public static FormEngineConfiguration createStandaloneFormEngineConfiguration() {        return new StandaloneFormEngineConfiguration();    }    public static FormEngineConfiguration createStandaloneInMemFormEngineConfiguration() {        return new StandaloneInMemFormEngineConfiguration();    }

二、创建FormEngine

FormEngineConfiguration提供buildFormEngine()方法创建FormEngine实例。

public FormEngine buildFormEngine() {        init();        return new FormEngineImpl(this);    }

三、初始化服务

FormEngineConfiguration包含三个属性,是三个服务类。

protected FormManagementService formManagementService = new FormManagementServiceImpl();    protected FormRepositoryService formRepositoryService = new FormRepositoryServiceImpl();    protected FormService formService = new FormServiceImpl();

在创建FormEngine的buildFormEngine()中,init()方法实现了对这些服务的初始化赋值。

protected void init() {...initServices();...} protected void initServices() {        initService(formManagementService);        initService(formRepositoryService);        initService(formService);    }    protected void initService(Object service) {        if (service instanceof ServiceImpl) {            ((ServiceImpl) service).setCommandExecutor(commandExecutor);        }    }

初始化过程是将 FormEngineConfiguration父类的CommandExecutor 传递给这三个服务类。

这三个服务类初始化后封装了CommandExecutor,通过FormEngineConfiguration传递给 FormEngine。

与前面的ContentEngineConfiguration和DmnEngineConfiguration类似,FormEngineConfiguration中的这些服务也是继承了 ServiceImpl 类。

这里写图片描述