S2+S+H+JBPM 工作流整合

在S2SH的web project 项目中加入JBPM(工作流)开源框架

要引入的jar包

很多jar包是从jbpm-starters-kit-3.2.0\lib下

jbpm-identity.jar,jbpm-jpdl.jar

其中spring-modules-jbpm31.jar要下载

web.xml:

<context-param>

    <param-name>webAppRootKey</param-name>

    <param-value>/jbpm/</param-value>

</context-param>


  applicationContext.xml

  <bean id="sessionFactory"
  class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
  <property name="dataSource">
   <ref local="dataSource" />
  </property>
  <property name="mappingLocations">
   <value>classpath*:/org/jbpm/**/*.hbm.xml</value>
  </property>


-----------------------------------

如果想在项目部署时,就将流程自动部署到数据库中,则加上配置

<!-- reading jBPM process definitions -->
 <bean id="websaleWorkflow1"
  class="org.springmodules.workflow.jbpm31.definition.ProcessDefinitionFactoryBean">
  <property name="definitionLocation" value="classpath:/com/jbpm/jpdl/processdefinition.xml" />
 </bean>
 <!-- jBPM configuration-->
 <bean id="jbpmConfigurationLocal"
  class="org.springmodules.workflow.jbpm31.LocalJbpmConfigurationFactoryBean">
  <property name="sessionFactory" ref="sessionFactory" />
  <property name="configuration" value="classpath:/jbpm.cfg.xml" />
  <property name="processDefinitions">
   <list>
    <ref local="websaleWorkflow1" />
   </list>
  </property>
  <property name="createSchema" value="true" />
 </bean>
 
 <!-- jBPM template -->
 <bean id="jbpmTemplate" class="org.springmodules.workflow.jbpm31.JbpmTemplate">
  <constructor-arg index="0" ref="jbpmConfigurationLocal" />
  <constructor-arg index="1" ref="websaleWorkflow1" />
 </bean>



jbpm.cfg.xml:

下载包下

jbpm-jpdl-3[1].2.GA\jbpm-jpdl-3.2.GA\src\jpdl\org\jbpm\default.jbpm.cfg.xml

改名成jbpm.cfg.xml



hibernate.cfg.xml
加入

<property name="connection.username">oa</property>
 <property name="connection.url">jdbc:oracle:thin:@server:1521:oa</property>
 <property name="myeclipse.connection.profile">oa</property>
 <property name="connection.password">oa</property>
     
   <property name="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</property>
   <property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>


(以上之只针对我当时在公司所用的框架,没有hibernate.cfg.xml文件,设置方言,driver_class,JDBC连接方式,只为了发布项目时候不报错,这些已在applicationContext.xml中设置过)



hibernate.cfg.xml 和 jbpm.cfg.xml 存放在classes下无需特殊配置



如果Service中要用到工作流,将jbpmConfiguration注入到其属性中。

<bean id="xxxService" class="com.business.xxxServiceImpl">

       <property name="xxxDao">

           <ref bean="xxxDao" />

       </property>

       <property name="jbpmConfiguration">

           <ref bean="jbpmConfiguration" />

       </property>

    </bean>

最后附上项目结构图


S2+S+H+JBPM 工作流整合






你可能感兴趣的:(oracle,工作,Hibernate,xml,jbpm)