All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.iqiny.silly.service.process.DefaultSillyProcessEngineService Maven / Gradle / Ivy

/*
 *  Copyright  iqiny.com
 *
 *  https://gitee.com/iqiny/silly
 *
 *  project name:silly-flowable-68
 *  project description:top silly project pom.xml file
 */
package com.iqiny.silly.service.process;

import com.iqiny.silly.common.util.SillyReflectUtil;
import com.iqiny.silly.core.base.SillyCategory;
import com.iqiny.silly.core.base.SillyContext;
import com.iqiny.silly.flowable.BaseSillyFlowableEngineService;
import org.apache.ibatis.transaction.TransactionFactory;
import org.flowable.engine.ProcessEngine;

import javax.sql.DataSource;

/**
 * 集成 Flowable 工作流引擎服务
 */
public class DefaultSillyProcessEngineService extends BaseSillyFlowableEngineService implements SillyCategory {

    private String category;

    @Override
    public String usedCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }


    @Override
    protected ProcessEngine getEngineServices() {
        SillyContext sillyContext = usedConfig().getSillyContext();
        return sillyContext.getBean(ProcessEngine.class);
    }

    @Override
    protected DataSource getDataSource() {
        SillyContext sillyContext = usedConfig().getSillyContext();
        return sillyContext.getBean(DataSource.class);
    }

    @Override
    protected TransactionFactory getTransactionFactory() {
        SillyContext sillyContext = usedConfig().getSillyContext();
        TransactionFactory transactionFactory = sillyContext.getBean(TransactionFactory.class);
        if (transactionFactory == null) {
            transactionFactory = SillyReflectUtil.newInstance("org.mybatis.spring.transaction.SpringManagedTransactionFactory");
        }
        return transactionFactory;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy