JBPM与SSH架构融合

JBPM与SSH架构融合 

 

1.  加入 spring-modules-jbpm31.jar

2.  spirng 中配置 jbpmConfiguration

    <!-- jbpm configuration -->

    < bean id = "jbpmConfiguration" class = "org.springmodules.workflow.jbpm31.LocalJbpmConfigurationFactoryBean" >

       < property name = "sessionFactory" ref = "sessionFactory" />

       < property name = "configuration" value = "classpath:jbpm.cfg.xml" />

    <!--   <property name="createSchema" value="true" />  -->

    </ bean >

   

    < bean id = "jbpmTemplate" class = "org.springmodules.workflow.jbpm31.JbpmTemplate" >

       < constructor-arg index = "0" ref = "jbpmConfiguration" />

    </ bean >

    <!-- end jbpm configuration -->

 

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

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

       < property name = "xxxDao" >

           < ref bean = "xxxDao" />

       </ property >

       < property name = "jbpmConfiguration" >

           < ref bean = "jbpmConfiguration" />

       </ property >

    </ bean >

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

<!-- reading jBPM process definitions -->

    < bean id = "baoxiao"

       class = "org.springmodules.workflow.jbpm31.definition.ProcessDefinitionFactoryBean" >

       < property name = "definitionLocation"

           value = "classpath:com/workflow/flowchart/baoxiao/processdefinition.xml" />

    </ bean >

    < bean id = "caiwu"

       class = "org.springmodules.workflow.jbpm31.definition.ProcessDefinitionFactoryBean" >

       < property name = "definitionLocation"

           value = "classpath:com/workflow/flowchart/caiwu/processdefinition.xml" />

    </ bean >

    <!-- jbpm configuration -->

    < bean id = "jbpmConfiguration"

       class = "org.springmodules.workflow.jbpm31.LocalJbpmConfigurationFactoryBean" >

       < property name = "sessionFactory" ref = "sessionFactory" />

       < property name = "configuration" value = "classpath:jbpm.cfg.xml" />

       < property name = "createSchema" value = "true" />

       < property name = "processDefinitions" >  

           < list >

              < ref local = "baoxiao" />

              < ref local = "caiwu" />

           </ list >

       </ property >

    </ bean >

 

    < bean id = "jbpmTemplate"

       class = "org.springmodules.workflow.jbpm31.JbpmTemplate" >

       < constructor-arg index = "0" ref = "jbpmConfiguration" />

       < constructor-arg index = "1" ref = "baoxiao" />

       < constructor-arg index = "1" ref = "caiwu" />

    </ bean >

    <!-- end jbpm configuration -->

 

4 .配置 workflow action,assignment,decision , spring 中普通的 javaBean 配置一样,采用依赖注入。

 

5. 配置好后,在具体的 processdefinition.xml 中,引用这个类时,就有点区别:

   < assignment class = "org.springmodules.workflow.jbpm31.JbpmHandlerProxy" config-type = "bean" >

            < targetBean > userAssignment </ targetBean

            < factoryKey > jbpmConfiguration </ factoryKey >

         </ assignment >

< handler class = "org.springmodules.workflow.jbpm31.JbpmHandlerProxy" >

          < targetBean > processDecision </ targetBean >

          < factoryKey > jbpmConfiguration </ factoryKey >

      </ handler >

 

  < action name = "action1" class = "org.springmodules.workflow.jbpm31.JbpmHandlerProxy" >

         < targetBean > processResult </ targetBean >

            < factoryKey > jbpmConfiguration </ factoryKey >

         </ action >

 

 

6. 注意

config-type 4 种配置类型:

1 Field------ 直接给目标类的字段赋值。 字段没有 set/get 方法,不是一个属性。该类也不是一个 Bean 。这应该是使用 CGLIB 字节码生成实现的。也可能使用反射。

< assignment class = "com.withub.cms.jbpm.assignmenthandler.WriteNewsAssignmentHandler" >

            < a > a </ a >

         </ assignment >

2 Bean------ 通过 set 方法赋值。    这和 Spring <property> 是一致的。

< assignment class = "com.withub.cms.jbpm.assignmenthandler.WriteNewsAssignmentHandler" config-type = "bean" >

            < a > a </ a >

         </ assignment >

3 constructor----- 传给构造器的参数。

< assignment class = "com.withub.cms.jbpm.assignmenthandler.WriteNewsAssignmentHandler" config-type = "constructor" >

            a

         </ assignment >

4 compatibility----- 兼容性

< assignment class = "com.withub.cms.jbpm.assignmenthandler.WriteNewsAssignmentHandler" config-type = "configuration-property" >

            a

         </ assignment >

默认的配置是默认的构造

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值