JBPM的使用心得

首先是安装4.4版本的插件.通过使用links方式安装好了插件,前提是7.0以上版本的myeclipse吧. 插件见附件jbpm_jpd_site.zip!

之后,由于插件对于中文支持不是太好,经常二次打开后,乱码,故修改myeclipse.ini,在最后加上 '-Dfile.encoding=UTF-8'. 这样做使得jbpm配置文件不再乱码.但是导致tomcat控制台中文乱码,再次修改tomcat目录下/bin/catalina.bat文件,在set JAVA OPT=XXX 这段话最后也加上'-Dfile.encoding=UTF-8' . 这样就搞定乱码问题了!
[b]一 ssh整合jbpm了,其实很简单:[/b]
1.[b]首先写下jbpm在spring中的配置[/b]:

<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">


<bean id="springHelper" class="org.jbpm.pvm.internal.processengine.SpringHelper">
<property name="jbpmCfg" value="jbpm.cfg.xml" />
</bean>

<bean id="processEngine" factory-bean="springHelper" factory-method="createProcessEngine" />

<bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService" />

<bean id="executionService" factory-bean="processEngine" factory-method="getExecutionService" />

<bean id="taskService" factory-bean="processEngine" factory-method="getTaskService"/>

<bean id="historyService" factory-bean="processEngine" factory-method="getHistoryService"/>

<bean id="identityService" factory-bean="processEngine" factory-method="getIdentityService"/>



<bean id="jbpmService" class="com.creditease.engine.flow.jbpm.service.JBPMServiceImpl" parent="baseService">
<property name="repositoryService" ref="repositoryService" />
<property name="taskService" ref="taskService" />
<property name="executionService" ref="executionService" />
<property name="jbpmLogService" ref="jbpmLogService" />
</bean>

<bean id="jbpmLogService" class="com.creditease.engine.flow.jbpm.log.JbpmLogServiceImpl" parent="baseService">
</bean>

</beans>


jbpmService是自己封装的工作流服务类,既然是做成组件,那当然业务对象里不能参合工作流的东西了.这个service一会再讲.
jbpmLogService是是用来做历史服务的,详细记录了什么人什么时间执行了什么流程,成功执行还是回退到某个流程.

[b]jbpm.cfg.xml这个文件也是必须的,每天可连不上数据库哦:[/b]

<?xml version="1.0" encoding="UTF-8"?>

<jbpm-configuration>

<import resource="jbpm.default.cfg.xml" />
<import resource="jbpm.tx.spring.cfg.xml" />
<import resource="jbpm.jpdl.cfg.xml" />
<import resource="jbpm.bpmn.cfg.xml" />
<import resource="jbpm.identity.cfg.xml" />
<import resource="jbpm.businesscalendar.cfg.xml" />
<import resource="jbpm.console.cfg.xml" />


<!-- Job executor is excluded for running the example test cases. -->
<!-- To enable timers and messages in production use, this should be included. -->
<!--
<import resource="jbpm.jobexecutor.cfg.xml" />
-->

</jbpm-configuration>


[b]最后,事务控制别忘了做哦:[/b]
<!-- 事务控制  -->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="saveOrUpdate" propagation="REQUIRED" />
<tx:method name="delete" propagation="REQUIRED" />
<tx:method name="get" read-only="true" />
<tx:method name="count" read-only="true" />
<tx:method name="find" read-only="true" />
</tx:attributes>
</tx:advice>

<tx:advice id="jbpmAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="*" propagation="REQUIRED" />
</tx:attributes>
</tx:advice>

<aop:config>
<aop:pointcut id="jbpmPointcut"
expression="execution(* com.creditease.engine.**.service.*.*(..))" />
<aop:pointcut id="servicePointcut"
expression="execution(* com.creditease.clic.**.service.*.*(..))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="servicePointcut" />
<aop:advisor advice-ref="jbpmAdvice" pointcut-ref="jbpmPointcut" />
</aop:config>


[b]jbpmService最好注入在其他服务类中,使用时,调用其他服务类中带事务的方法也就保持了事务一致性了.[/b]

这样我们经过以上的一些配置,jbpm与sping就完成了结合的工作了.

二 jbpmService服务类,[b]下班了,下次有空再写吧.[/b]



[b]目前在做接口,供其他开发人员调用,也就是说组件化jbpm.做完了,再上来说,继续忙![/b]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值