/*
* Copyright (c) 2010.
* Copyright © 2009 CTIT, All Rights Reserved
*/
package cn.ctit.ruleworkflow;
import org.jbpm.api.ProcessEngine;
import org.jbpm.pvm.internal.cfg.ConfigurationImpl;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
/**
* Class Name: JbpmSpringHelper
*
* @author hengheng8848
* @version 1.0
*/
public class JbpmSpringHelper implements ApplicationContextAware {
protected ApplicationContext applicationContext;
protected String jbpmCfg = "jbpm.cfg.xml";
public void setJbpmCfg(String jbpmCfg) {
this.jbpmCfg = jbpmCfg;
}
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.applicationContext = applicationContext;
}
public ProcessEngine createProcessEngine() {
return new ConfigurationImpl()
.springInitiated(applicationContext)
.setResource(jbpmCfg)
.buildProcessEngine();
}
}