spring2.5整合osworkflow2.8 .
下面是spring整合osworkflow的配置文件:
- <?xml version="1.0" encoding="UTF-8"?>
- <!-- 使用aop/tx命名空间 -->
- <beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:aop="http://www.springframework.org/schema/aop"
- xmlns:tx="http://www.springframework.org/schema/tx"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
- <description>spring JDBCTemplate 方式</description>
- <!-- 专门为mysql数据库定制的一个bean,让工作流程实例(如果需要的话)分享当前事务 -->
- <bean id="mysqlTemplateWorkflowStore"
- class="com.opensymphony.workflow.spi.jdbc.MySQLTemplateWorkflowStore"
- scope="prototype">
- <property name="dataSource">
- <ref bean="dataSource" />
- </property>
- <property name="propertySetDelegate">
- <ref bean="propertySetDelegate" />
- </property>
- <property name="jdbcTemplateProperties">
- <props>
- <prop key="history.table">OS_HISTORYSTEP</prop>
- <prop key="historyPrev.table">OS_HISTORYSTEP_PREV</prop>
- <prop key="current.table">OS_CURRENTSTEP</prop>
- <prop key="currentPrev.table">OS_CURRENTSTEP_PREV</prop>
- <prop key="step.id">ID</prop>
- <prop key="step.entryId">ENTRY_ID</prop>
- <prop key="step.stepId">STEP_ID</prop>
- <prop key="step.actionId">ACTION_ID</prop>
- <prop key="step.owner">OWNER</prop>
- <prop key="step.caller">CALLER</prop>
- <prop key="step.startDate">START_DATE</prop>
- <prop key="step.finishDate">FINISH_DATE</prop>
- <prop key="step.dueDate">DUE_DATE</prop>
- <prop key="step.status">STATUS</prop>
- <prop key="step.previousId">PREVIOUS_ID</prop>
- <prop key="step.sequence">SELECT max(ID)+1 FROM OS_STEPIDS</prop>
- <prop key="entry.sequence">SELECT max(ID)+1 FROM OS_WFENTRY</prop>
- <prop key="entry.table">OS_WFENTRY</prop>
- <prop key="entry.id">ID</prop>
- <prop key="entry.name">NAME</prop>
- <prop key="entry.state">STATE</prop>
- <!-- mysql 特有的 -->
- <prop key="step.sequence.increment">INSERT INTO OS_STEPIDS (ID) values (null)</prop>
- <prop key="step.sequence.retrieve">SELECT max(ID) FROM OS_STEPIDS</prop>
- <prop key="entry.sequence.increment">INSERT INTO OS_ENTRYIDS (ID) values (null)</prop>
- <prop key="entry.sequence.retrieve">SELECT max(ID) FROM OS_ENTRYIDS</prop>
- </props>
- </property>
- </bean>
- <!-- OSWorkflow的核心功能之一就是动态保存变量,这允许函数从workflow声明周期的一开始就运行还能保存一些数据到OSWorkflow中
- 因此,后继的action执行的时候,可以取出这些数据,在其他函数中使用。
- 这是非常强力的功能,使用得当的话可以做出高度定制的,具有长生命周期的工作流行为,就算服务器重启也可以持续
- 这都归功于PropertySet模块 -->
- <bean id="propertySetDelegate"
- class="com.opensymphony.workflow.spi.jdbc.DefaultJDBCTemplatePropertySetDelegate"
- scope="prototype">
- <property name="configurationProvider">
- <ref bean="defaultJDBCTemplateConfigurationProvider"/>
- </property>
- </bean>
- <bean id="defaultJDBCTemplateConfigurationProvider"
- class="com.opensymphony.module.propertyset.database.DefaultJDBCTemplateConfigurationProvider"
- scope="prototype">
- <property name="propertySetDAO">
- <ref bean="jdbcTemplatePropertySetDAOImpl"/>
- </property>
- </bean>
- <bean id="jdbcTemplatePropertySetDAOImpl"
- class="com.opensymphony.module.propertyset.database.JDBCTemplatePropertySetDAOImpl"
- scope="prototype">
- <property name="dataSource">
- <ref bean="dataSource" />
- </property>
- </bean>
- <!--
- 这是一个XMLWorkflowFactory封装包,它可以允许从容器中注入configuration,从而不再从其它的XML配置文件中读取它们
- -->
- <bean id="workflowFactory"
- class="com.opensymphony.workflow.spi.hibernate.SpringWorkflowFactory"
- init-method="init">
- <property name="resource">
- <value>../osworkflow/workflows.xml</value>
- </property>
- <property name="reload">
- <value>true</value>
- </property>
- </bean>
- <!-- WorkflowStore 事务处理配置 -->
- <aop:config>
- <aop:pointcut id="oswfMethod1"
- expression="execution(* com.opensymphony.workflow.spi.WorkflowStore.*(..))" />
- <aop:pointcut id="oswfMethod2"
- expression="execution(* com.opensymphony.module.propertyset.database.JDBCTemplatePropertySetDAO.*(..))" />
- <aop:advisor pointcut-ref="oswfMethod1" advice-ref="txAdvice_oswf" />
- <aop:advisor pointcut-ref="oswfMethod2" advice-ref="txAdvice_oswf" />
- </aop:config>
- <tx:advice id="txAdvice_oswf" transaction-manager="txManager">
- <tx:attributes>
- <tx:method name="*" />
- </tx:attributes>
- </tx:advice>
- <!-- 这是一个Workflow Configuration接口的实现类,它包含指向store和factory的引用,这样可以在spring中注入 -->
- <bean id="osworkflowConfiguration" class="com.opensymphony.workflow.config.SpringConfiguration"
- scope="prototype">
- <property name="store">
- <ref local="mysqlTemplateWorkflowStore" />
- </property>
- <property name="factory">
- <ref local="workflowFactory" />
- </property>
- </bean>
- <!--允许OSWorkflow从Spring ApplicationContext中获得业务逻辑组件(conditions,functions等等) -->
- <bean id="workflowTypeResolver" class="com.opensymphony.workflow.util.SpringTypeResolver"></bean>
- </beans>
用到了一些自己扩展的类(是网上一个牛人的写的,我只抽取了mysql jdbc那部分)见下图的结构:
代码依次如下:
DefaultJDBCTemplateConfigurationProvider.java
- package com.opensymphony.module.propertyset.database;
- /**
- * @author
- */
- public class DefaultJDBCTemplateConfigurationProvider implements JDBCTemplateConfigurationProvider {
- private JDBCTemplatePropertySetDAO propertySetDAO;
- public JDBCTemplatePropertySetDAO getPropertySetDAO() {
- return this.propertySetDAO;
- }
- public void setPropertySetDAO(JDBCTemplatePropertySetDAO propertySetDAO) {
- this.propertySetDAO = propertySetDAO;
- }
- }
JDBCTemplateConfigurationProvider.java
- package com.opensymphony.module.propertyset.database;
- /**
- * @author
- */
- public interface JDBCTemplateConfigurationProvider {
- JDBCTemplatePropertySetDAO getPropertySetDAO();
- }
JDBCTemplatePropertySet.java
- package com.opensymphony.module.propertyset.database;
- import com.opensymphony.module.propertyset.AbstractPropertySet;
- import com.opensymphony.module.propertyset.PropertyException;
- import com.opensymphony.util.ClassLoaderUtil;
- import org.apache.commons.logging.Log;
- import org.apache.commons.logging.LogFactory;
- import java.util.Collection;
- import java.util.Map;
- /**
- * @author
- */
- public class JDBCTemplatePropertySet extends AbstractPropertySet {
- protected static Log log = LogFactory.getLog(JDBCTemplatePropertySet.class);
- private JDBCTemplateConfigurationProvider configProvider;
- private JDBCTemplatePropertySetDAO dao;
- @SuppressWarnings("unchecked")
- public void init(Map config, Map args) {
- log.debug("(JDBCTemplatePropertySet) top of init.");
- super.init(config, args);
- // first let's see if we got given a configuration provider to use
- // already
- this.configProvider = (JDBCTemplateConfigurationProvider) args.get("configurationProvider"); //$NON-NLS-1$
- /* if we did not get given one in the args, we need to set a config provider up */
- if (this.configProvider == null) {
- // lets see if we need to use a configurationProvider from a class
- String configProviderClass = (String) config.get("configuration.provider.class");//$NON-NLS-1$
- if (configProviderClass != null) {
- if (log.isDebugEnabled()) {
- log.debug("Setting up property set provider of class: " + configProviderClass);//$NON-NLS-1$
- }
- try {
- this.configProvider = (JDBCTemplateConfigurationProvider) ClassLoaderUtil
- .loadClass(configProviderClass, this.getClass()).newInstance();
- }
- catch (Exception e) {
- log.error("Unable to load configuration provider class: " + configProviderClass, e);//$NON-NLS-1$
- return;
- }
- } else {
- if (log.isDebugEnabled()) {
- log.debug("Setting up property set with DefaultJDBCTemplateConfigurationProvider");//$NON-NLS-1$
- }
- this.configProvider = new DefaultJDBCTemplateConfigurationProvider();
- }
- } else {
- if (log.isDebugEnabled()) {
- log.debug("Setting up property set with jdbcTemplate provider passed in args."); //$NON-NLS-1$
- }
- }
- dao = configProvider.getPropertySetDAO();
- dao.setGlobalKey((String) args.get("globalKey"));
- dao.setTableName((String) config.get("table.name"));
- dao.setColGlobalKey((String) config.get("col.globalKey"));
- dao.setColItemKey((String) config.get("col.itemKey"));
- dao.setColItemType((String) config.get("col.itemType"));
- dao.setColString((String) config.get("col.string"));
- dao.setColDate((String) config.get("col.date"));
- dao.setColData((String) config.get("col.data"));
- dao.setColFloat((String) config.get("col.float"));
- dao.setColNumber((String) config.get("col.number"));
- }
- @SuppressWarnings("unchecked")
- public Collection getKeys(String prefix, int type) throws PropertyException {
- return dao.getKeys(prefix, type);
- }
- public int getType(String key) throws PropertyException {
- return dao.getType(key);
- }
- public boolean exists(String key) throws PropertyException {
- return dao.exists(key);
- }
- public void remove(String key) throws PropertyException {
- dao.remove(key);
- }
- protected void setImpl(int type, String key, Object value) throws PropertyException {
- dao.setImpl(type, key, value);
- }
- protected Object get(int type, String key) throws PropertyException {
- return dao.get(type, key);
- }
- public void remove() throws PropertyException {
- }
- }
JDBCTemplatePropertySetDAO.java
- package com.opensymphony.module.propertyset.database;
- import com.opensymphony.module.propertyset.PropertyException;
- import java.util.Collection;
- /**
- * @author
- */
- public interface JDBCTemplatePropertySetDAO {
- @SuppressWarnings("unchecked")
- public Collection getKeys(String prefix, int type) throws PropertyException;
- public int getType(String key) throws PropertyException;
- public boolean exists(String key) throws PropertyException;
- public void remove(String key) throws PropertyException;
- public void setImpl(int type, String key, Object value) throws PropertyException;
- public Object get(int type, String key) throws PropertyException;
- public void setColData(String colData);
- public void setColDate(String colDate);
- public void setColFloat(String colFloat);
- public void setColGlobalKey(String colGlobalKey);
- public void setColItemKey(String colItemKey);
- public void setColItemType(String colItemType);
- public void setColNumber(String colNumber);
- public void setColString(String colString);
- public void setGlobalKey(String globalKey);
- public void setTableName(String tableName);
- }
JDBCTemplatePropertySetDAOImpl.java
- package com.opensymphony.module.propertyset.database;
- import com.opensymphony.module.propertyset.InvalidPropertyTypeException;
- import com.opensymphony.module.propertyset.PropertyException;
- import com.opensymphony.module.propertyset.PropertySet;
- import com.opensymphony.util.Data;
- import org.springframework.dao.DataAccessException;
- import org.springframework.jdbc.core.RowCallbackHandler;
- import org.springframework.jdbc.core.support.JdbcDaoSupport;
- import java.sql.ResultSet;
- import java.sql.SQLException;
- import java.sql.Timestamp;
- import java.util.ArrayList;
- import java.util.Collection;
- import java.util.List;
- /**
- * @author
- */
- public class JDBCTemplatePropertySetDAOImpl extends JdbcDaoSupport implements JDBCTemplatePropertySetDAO {
- private String colData;
- private String colDate;
- private String colFloat;
- private String colGlobalKey;
- private String colItemKey;
- private String colItemType;
- private String colNumber;
- private String colString;
- // args
- private String globalKey;
- private String tableName;
- public void setColData(String colData) {
- this.colData = colData;
- }
- public void setColDate(String colDate) {
- this.colDate = colDate;
- }
- public void setColFloat(String colFloat) {
- this.colFloat = colFloat;
- }
- public void setColGlobalKey(String colGlobalKey) {
- this.colGlobalKey = colGlobalKey;
- }
- public void setColItemKey(String colItemKey) {
- this.colItemKey = colItemKey;
- }
- public void setColItemType(String colItemType) {
- this.colItemType = colItemType;
- }
- public void setColNumber(String colNumber) {
- this.colNumber = colNumber;
- }
- public void setColString(String colString) {
- this.colString = colString;
- }
- public void setGlobalKey(String globalKey) {
- this.globalKey = globalKey;
- }
- public void setTableName(String tableName) {
- this.tableName = tableName;
- }
- @SuppressWarnings("unchecked")
- public Collection getKeys(String prefix, int type) throws PropertyException {
- if (prefix == null) {
- prefix = "";
- }
- try {
- String sql = "SELECT " + colItemKey + " FROM " + tableName + " WHERE " + colItemKey + " LIKE ? AND " + colGlobalKey + " = ?";
- final ArrayList list = new ArrayList();
- if (type == 0) {
- this.getJdbcTemplate().query(sql, new Object[]{prefix + "%", globalKey}, new RowCallbackHandler() {
- public void processRow(ResultSet rs) throws SQLException {
- list.add(rs.getString(colItemKey));
- }
- });
- } else {
- sql = sql + " AND " + colItemType + " = ?";
- this.getJdbcTemplate().query(sql, new Object[]{prefix + "%", globalKey, new Integer(type)}, new RowCallbackHandler() {
- public void processRow(ResultSet rs) throws SQLException {
- list.add(rs.getString(colItemKey));
- }
- });
- }
- return list;
- } catch (DataAccessException
- e) {
- throw new PropertyException(e.getMessage());
- }
- }
- public int getType(String key) throws PropertyException {
- try {
- String sql = "SELECT " + colItemType + " FROM " + tableName + " WHERE " + colGlobalKey + " = ? AND " + colItemKey + " = ?";
- return this.getJdbcTemplate().queryForInt(sql, new Object[]{globalKey, key});
- } catch (DataAccessException e) {
- throw new PropertyException(e.getMessage());
- }
- }
- public boolean exists(String key) throws PropertyException {
- return getType(key) != 0;
- }
- public void remove(String key) throws PropertyException {
- try {
- String sql = "DELETE FROM " + tableName + " WHERE " + colGlobalKey + " = ? AND " + colItemKey + " = ?";
- this.getJdbcTemplate().update(sql, new Object[]{globalKey, key});
- } catch (DataAccessException e) {
- throw new PropertyException(e.getMessage());
- }
- }
- public void setImpl(int type, String key, Object value) throws PropertyException {
- if (value == null) {
- throw new PropertyException("JDBCTemplatePropertySet does not allow for null values to be stored");
- }
- try {
- int rows = updateValues(type, key, value);
- if (rows != 1) {
- insertValues(type, key, value);
- }
- } catch (Exception e) {
- throw new PropertyException(e.getMessage());
- }
- }
- @SuppressWarnings("unchecked")
- public Object get(final int type, String key) throws PropertyException {
- String sql = "SELECT " + colItemType + ", " + colString + ", " + colDate + ", " + colData + ", " + colFloat + ", " + colNumber + " FROM " + tableName + " WHERE " + colItemKey + " = ? AND " + colGlobalKey + " = ?";
- final List list = new ArrayList();
- try {
- this.getJdbcTemplate().query(sql, new Object[]{key, globalKey}, new RowCallbackHandler() {
- public void processRow(ResultSet rs) throws SQLException {
- int propertyType = rs.getInt(colItemType);
- if (propertyType != type) {
- throw new InvalidPropertyTypeException();
- }
- Object o;
- switch (type) {
- case PropertySet.BOOLEAN:
- int boolVal = rs.getInt(colNumber);
- o = new Boolean(boolVal == 1);
- break;
- case PropertySet.DATA:
- o = rs.getBytes(colData);
- break;
- case PropertySet.DATE:
- o = rs.getTimestamp(colDate);
- break;
- case PropertySet.DOUBLE:
- o = new Double(rs.getDouble(colFloat));
- break;
- case PropertySet.INT:
- o = new Integer(rs.getInt(colNumber));
- break;
- case PropertySet.LONG:
- o = new Long(rs.getLong(colNumber));
- break;
- case PropertySet.STRING:
- o = rs.getString(colString);
- break;
- default:
- throw new InvalidPropertyTypeException("JDBCPropertySet doesn't support this type yet.");
- }
- list.add(o);
- }
- });
- } catch (NumberFormatException e) {
- throw new PropertyException(e.getMessage());
- }
- return list.get(0);
- }
- private int updateValues(int type, String key, Object value) throws DataAccessException, PropertyException {
- //String sql = "UPDATE " + tableName + " SET " + colString + " = ?, " + colDate + " = ?, " + colData + " = ?, " + colFloat + " = ?, " + colNumber + " = ?, " + colItemType + " = ? " + " WHERE " + colGlobalKey + " = ? AND " + colItemKey + " = ?";
- String sql = "";
- switch (type) {
- case PropertySet.BOOLEAN:
- Boolean boolVal = (Boolean) value;
- sql = "UPDATE " + tableName + " SET " + colNumber + " = ?, " + colItemType + " = ? " + " WHERE " + colGlobalKey + " = ? AND " + colItemKey + " = ?";
- return this.getJdbcTemplate().update(sql, new Object[]{(boolVal.booleanValue() ? 1 : 0), type, globalKey, key});
- case PropertySet.DATA:
- Data data = (Data) value;
- sql = "UPDATE " + tableName + " SET " + colData + " = ?, " + colItemType + " = ? " + " WHERE " + colGlobalKey + " = ? AND " + colItemKey + " = ?";
- return this.getJdbcTemplate().update(sql, new Object[]{data.getBytes(), type, globalKey, key});
- case PropertySet.DATE:
- java.util.Date date = (java.util.Date) value;
- sql = "UPDATE " + tableName + " SET " + colDate + " = ?, " + colItemType + " = ? " + " WHERE " + colGlobalKey + " = ? AND " + colItemKey + " = ?";
- return this.getJdbcTemplate().update(sql, new Object[]{new Timestamp(date.getTime()), type, globalKey, key});
- case PropertySet.DOUBLE:
- Double d = (Double) value;
- sql = "UPDATE " + tableName + " SET " + colFloat + " = ?, " + colItemType + " = ? " + " WHERE " + colGlobalKey + " = ? AND " + colItemKey + " = ?";
- return this.getJdbcTemplate().update(sql, new Object[]{d, type, globalKey, key});
- case PropertySet.INT:
- Integer i = (Integer) value;
- sql = "UPDATE " + tableName + " SET " + colNumber + " = ?, " + colItemType + " = ? " + " WHERE " + colGlobalKey + " = ? AND " + colItemKey + " = ?";
- return this.getJdbcTemplate().update(sql, new Object[]{i, type, globalKey, key});
- case PropertySet.LONG:
- Long l = (Long) value;
- sql = "UPDATE " + tableName + " SET " + colNumber + " = ?, " + colItemType + " = ? " + " WHERE " + colGlobalKey + " = ? AND " + colItemKey + " = ?";
- return this.getJdbcTemplate().update(sql, new Object[]{l, type, globalKey, key});
- case PropertySet.STRING:
- sql = "UPDATE " + tableName + " SET " + colString + " = ?, " + colItemType + " = ? " + " WHERE " + colGlobalKey + " = ? AND " + colItemKey + " = ?";
- return this.getJdbcTemplate().update(sql, new Object[]{(String) value, type, globalKey, key});
- default:
- throw new PropertyException("This type isn't supported!");
- }
- }
- private void insertValues(int type, String key, Object value) throws DataAccessException, PropertyException {
- //String sql = "INSERT INTO " + tableName + " (" + colString + ", " + colDate + ", " + colData + ", " + colFloat + ", " + colNumber + ", " + colItemType + ", " + colGlobalKey + ", " + colItemKey + ") VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
- String sql = "";
- switch (type) {
- case PropertySet.BOOLEAN:
- Boolean boolVal = (Boolean) value;
- sql = "INSERT INTO " + tableName + " (" + colNumber + ", " + colItemType + ", " + colGlobalKey + ", " + colItemKey + ") VALUES (?, ?, ?, ?)";
- this.getJdbcTemplate().update(sql, new Object[]{(boolVal.booleanValue() ? 1 : 0), type, globalKey, key});
- break;
- case PropertySet.DATA:
- Data data = (Data) value;
- sql = "INSERT INTO " + tableName + " (" + colData + ", " + colItemType + ", " + colGlobalKey + ", " + colItemKey + ") VALUES (?, ?, ?, ?)";
- this.getJdbcTemplate().update(sql, new Object[]{data.getBytes(), type, globalKey, key});
- break;
- case PropertySet.DATE:
- java.util.Date date = (java.util.Date) value;
- sql = "INSERT INTO " + tableName + " (" + colDate + ", " + colItemType + ", " + colGlobalKey + ", " + colItemKey + ") VALUES (?, ?, ?, ?)";
- this.getJdbcTemplate().update(sql, new Object[]{new Timestamp(date.getTime()), type, globalKey, key});
- break;
- case PropertySet.DOUBLE:
- Double d = (Double) value;
- sql = "INSERT INTO " + tableName + " (" + colFloat + ", " + colItemType + ", " + colGlobalKey + ", " + colItemKey + ") VALUES (?, ?, ?, ?)";
- this.getJdbcTemplate().update(sql, new Object[]{d, type, globalKey, key});
- break;
- case PropertySet.INT:
- Integer i = (Integer) value;
- sql = "INSERT INTO " + tableName + " (" + colNumber + ", " + colItemType + ", " + colGlobalKey + ", " + colItemKey + ") VALUES (?, ?, ?, ?)";
- this.getJdbcTemplate().update(sql, new Object[]{i, type, globalKey, key});
- break;
- case PropertySet.LONG:
- Long l = (Long) value;
- sql = "INSERT INTO " + tableName + " (" + colNumber + ", " + colItemType + ", " + colGlobalKey + ", " + colItemKey + ") VALUES (?, ?, ?, ?)";
- this.getJdbcTemplate().update(sql, new Object[]{l, type, globalKey, key});
- break;
- case PropertySet.STRING:
- sql = "INSERT INTO " + tableName + " (" + colString + ", " + colItemType + ", " + colGlobalKey + ", " + colItemKey + ") VALUES (?, ?, ?, ?)";
- this.getJdbcTemplate().update(sql, new Object[]{(String) value, type, globalKey, key});
- break;
- default:
- throw new PropertyException("This type isn't supported!");
- }
- }
- }
DefaultJDBCTemplatePropertySetDelegate.java
- package com.opensymphony.workflow.spi.jdbc;
- import com.opensymphony.module.propertyset.PropertySet;
- import com.opensymphony.module.propertyset.PropertySetManager;
- import com.opensymphony.module.propertyset.database.DefaultJDBCTemplateConfigurationProvider;
- import com.opensymphony.workflow.util.PropertySetDelegate;
- import java.util.HashMap;
- import java.util.Map;
- /**
- * @author
- */
- public class DefaultJDBCTemplatePropertySetDelegate implements PropertySetDelegate {
- private DefaultJDBCTemplateConfigurationProvider configurationProvider;
- public void setConfigurationProvider(
- DefaultJDBCTemplateConfigurationProvider configurationProvider) {
- this.configurationProvider = configurationProvider;
- }
- public DefaultJDBCTemplatePropertySetDelegate() {
- super();
- }
- @SuppressWarnings("unchecked")
- public PropertySet getPropertySet(long entryId) {
- Map args = new HashMap(1);
- args.put("globalKey", "osff_temp_" + entryId);
- args.put("configurationProvider", configurationProvider);
- return PropertySetManager.getInstance("jdbcTemplate", args);
- }
- }
JDBCTemplateWorkflowStore.java
MySQLTemplateWorkflowStore.java
要注意配置文件里,spring关于osworkflow事务的aop配置,一定对应扩展的类,否则流程过程中的sql语句不能即使的执行,配了就完全ok了。
下面是数据库的sql,我把原数据库里的用户权限的3个表去了,这个可以用自己的,用它的好不爽。
对了还有个propertyset.xml文件:
至于自定义的流程的xml就参看osworkflow官方的例子吧,这样配置好以后osworkflowConfiguration就成为了spring的bean了可以注入了,当然也可以把baseWorkflow也配置成bean,进行注入。
最后提供一个svn:http://xeducation.googlecode.com/svn/trunk,这里是一个spring2.5+hibernate3.x+struts2.1.x+osworkflow2.8的一个空架子,可以运行的。注释也写的比较明白。(myeclipse的工程)
有兴趣的可以当下来看看。
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐



所有评论(0)