com.iqiny.silly.service.process.DefaultSillyProcessEngineService Maven / Gradle / Ivy
/*
* Copyright iqiny.com
*
* https://gitee.com/iqiny/silly
*
* project name:silly-activiti-52
* project description:top silly project pom.xml file
*/
package com.iqiny.silly.service.process;
import com.iqiny.silly.activiti.BaseSillyActivitiEngineService;
import com.iqiny.silly.common.util.SillyReflectUtil;
import com.iqiny.silly.core.base.SillyCategory;
import com.iqiny.silly.core.base.SillyContext;
import org.activiti.engine.EngineServices;
import org.apache.ibatis.transaction.TransactionFactory;
import javax.sql.DataSource;
/**
* 集成activiti 工作流引擎服务
*/
public class DefaultSillyProcessEngineService extends BaseSillyActivitiEngineService implements SillyCategory {
private String category;
@Override
public String usedCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
@Override
protected EngineServices getEngineServices() {
SillyContext sillyContext = usedConfig().getSillyContext();
return sillyContext.getBean(EngineServices.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;
}
}