`
longgangbai
  • 浏览: 7339270 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

jBPM与Spring整合浅析

阅读更多

1、创建公文流转相关的实体类,并创建数据库表

2、根据对用例的分析,初步建立公文流转相关的接口

3、实现接口

- 集成JBPM到OA系统(第一步:创建数据库表)

◆拷贝相关的依赖包到WEB-INF/lib下面(bsh.jar/ jcr-1.0.jar/ jbpm-identity.jar/ jbpm-jpdl.jar)

◆修改hibernate.cfg.xml,添加JBPM的映射配置,以及缓存属性的配置

◆因为JBPM中的User对象与OA系统中的User对象名称上有冲突,所以需要,修改OA系统中User映射的auto-import属性为"false"。(参考User.hbm.xml)

◆当修改了User映射的auto-import="false"之后,需要在查询User对象的时候,使用其全路径类名(请参考UserManagerImpl.java)

◆启动Tomcat,应能正确创建JBPM的所有数据库表

- 集成JBPM到OA系统(第二步:与Spring集成)

◆JBPM与Spring整合,需要用到第三方的集成包:spring-modules-0.8.zip

◆将其中的spring-modules-jbpm31.jar拷贝到WEB-INF/lib下面即可

◆JBPM与Spring整合的方法是:将JbpmConfiguration对象的创建交给Spring来完成

◆所以,JBPM与Spring整合需要在spring配置文件中配置JbpmConfiguration对象的创建

配置JbmpConfiguration

  1. <bean id="jbpmConfiguration" class="org.springmodules.workflow.jbpm31.LocalJbpmConfigurationFactoryBean"> 
  2.      <property name="configuration" value="classpath:jbpm.cfg.xml"> 
  3. property> 
  4. bean> 

◆这时候,需要jbpm.cfg.xml,这是JBPM的配置文件,我们可以从:JBPM_HOME\src\jpdl\org\jbpm目录下拷贝default.jbpm.cfg.xml文件,并重新命名为jbpm.cfg.xml

- 集成JBPM到OA系统(第三步:如何实现业务逻辑类,请参考WorkflowManagerImpl.java)

◆用到jbpmConfiguration对象的时候,需要注入

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

◆当我们使用JbpmContext对象来操纵JBPM的时候,需要将JbpmContext的HibernateSession对象设置为当前的HibernateSession对象

  1. private JbpmContext getContext(){  
  2.      JbpmContext context = jbpmConfiguration.createJbpmContext();  
  3.      context.setSession(getSession());  
  4.      return context;  

 

流程的定义

流程的定义建议使用jBPM提供的eclipse下的插件,图形化配置插件安装文件可以到jbpm-starters-kit-3.1.4\jbpm-designer\jbpm-gpd-feature\eclipse下找到,需注意版本。使用这种方式可以把定义的流程描述的三个文件压缩成zip包,统一的部署到数据库中,方便b/s系统中显示图片当前节点信息。

1插件安装

把jbpm-gpd-feature文件夹复制到C:\Program Files\MyEclipse-6.0M1\eclipse\plugins下,注意自己的ecplise路径。

在C:\Program Files\MyEclipse-6.0M1\eclipse\links文件夹下建立jbpm-gpd.link文件。内容如下:path=C:\\Program Files\\MyEclipse-6.0M1\\eclipse\\plugins\\jbpm-gpd-feature。

这样再重新启动eclipse就可以使用流程定义功能了。

2流程的定义

在Eclipse环境中选择file->new->other下的jboss jbpm->process definition流程定义。要在自己的项目文件中先指定文件要创建的文件夹。

这样会产生三个文件:gpd.xml、processdefinition.xml、processimage.jpg。

processimage.jpg文件是定义流程产生的图片、gpd.xml文件是图形文件的座标说明。用于在b/s下显示流程流转的图片位置。

分享到:
评论
2 楼 longgangbai 2009-12-27  
289056879 写道
你好, 我现在在做 尚学堂的oa系统,查找问题的答案是看到了你的版面,希望请教你个问题,我刚好做到你所说的这里,可是我到页面上传文件不能成功,提示sqlException
我是按照视频写的,我上传文件一点提交debug里就出现
     Daemon Thread [http-8080-1] (Suspended (exception SQLException))
ServerPreparedStatement(PreparedStatement).executeUpdate(byte[][], InputStream[], boolean[], int[], boolean[], boolean) line: 1302
ServerPreparedStatement(PreparedStatement).executeUpdate(boolean) line: 1274
ServerPreparedStatement(PreparedStatement).executeUpdate() line: 1259
IdentityGenerator$GetGeneratedKeysDelegate.executeAndExtract(PreparedStatement) line: 73
IdentityGenerator$GetGeneratedKeysDelegate(AbstractReturningDelegate).performInsert(String, SessionImplementor, Binder) line: 33
SingleTableEntityPersister(AbstractEntityPersister).insert(Object[], boolean[], String, Object, SessionImplementor) line: 2158
SingleTableEntityPersister(AbstractEntityPersister).insert(Object[], Object, SessionImplementor) line: 2638
EntityIdentityInsertAction.execute() line: 48
ActionQueue.execute(Executable) line: 250
DefaultSaveEventListener(AbstractSaveEventListener).performSaveOrReplicate(Object, EntityKey, EntityPersister, boolean, Object, EventSource, boolean) line: 298
DefaultSaveEventListener(AbstractSaveEventListener).performSave(Object, Serializable, EntityPersister, boolean, Object, EventSource, boolean) line: 181
DefaultSaveEventListener(AbstractSaveEventListener).saveWithGeneratedId(Object, String, Object, EventSource, boolean) line: 107
DefaultSaveEventListener(DefaultSaveOrUpdateEventListener).saveWithGeneratedOrRequestedId(SaveOrUpdateEvent) line: 187
DefaultSaveEventListener.saveWithGeneratedOrRequestedId(SaveOrUpdateEvent) line: 33
DefaultSaveEventListener(DefaultSaveOrUpdateEventListener).entityIsTransient(SaveOrUpdateEvent) line: 172
DefaultSaveEventListener.performSaveOrUpdate(SaveOrUpdateEvent) line: 27
DefaultSaveEventListener(DefaultSaveOrUpdateEventListener).onSaveOrUpdate(SaveOrUpdateEvent) line: 70
SessionImpl.fireSave(SaveOrUpdateEvent) line: 535
SessionImpl.save(String, Object) line: 523
SessionImpl.save(Object) line: 519
GraphSession.deployProcessDefinition(ProcessDefinition) line: 77
JbpmContext.deployProcessDefinition(ProcessDefinition) line: 173
WorkflowManagerImpl.deployProcessDefinition(byte[], byte[]) line: 61
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
Method.invoke(Object, Object...) line: 597
AopUtils.invokeJoinpointUsingReflection(Object, Method, Object[]) line: 310
ReflectiveMethodInvocation.invokeJoinpoint() line: 182
ReflectiveMethodInvocation.proceed() line: 149
TransactionInterceptor.invoke(MethodInvocation) line: 106
ReflectiveMethodInvocation.proceed() line: 171
ExposeInvocationInterceptor.invoke(MethodInvocation) line: 89
ReflectiveMethodInvocation.proceed() line: 171
JdkDynamicAopProxy.invoke(Object, Method, Object[]) line: 204
$Proxy8.deployProcessDefinition(byte[], byte[]) line: not available
WorkflowAction.add(ActionMapping, ActionForm, HttpServletRequest, HttpServletResponse) line: 48
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
Method.invoke(Object, Object...) line: 597
WorkflowAction(DispatchAction).dispatchMethod(ActionMapping, ActionForm, HttpServletRequest, HttpServletResponse, String) line: 270
WorkflowAction(DispatchAction).execute(ActionMapping, ActionForm, HttpServletRequest, HttpServletResponse) line: 187
DelegatingActionProxy.execute(ActionMapping, ActionForm, HttpServletRequest, HttpServletResponse) line: 110
RequestProcessor.processActionPerform(HttpServletRequest, HttpServletResponse, Action, ActionForm, ActionMapping) line: 431
RequestProcessor.process(HttpServletRequest, HttpServletResponse) line: 236
ActionServlet.process(HttpServletRequest, HttpServletResponse) line: 1196
ActionServlet.doPost(HttpServletRequest, HttpServletResponse) line: 432
ActionServlet(HttpServlet).service(HttpServletRequest, HttpServletResponse) line: 710
ActionServlet(HttpServlet).service(ServletRequest, ServletResponse) line: 803
ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 290
ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 206
PagerFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 29
ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 235
ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 206
OpenSessionInViewFilter.doFilterInternal(HttpServletRequest, HttpServletResponse, FilterChain) line: 198
OpenSessionInViewFilter(OncePerRequestFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 76
ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 235
ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 206
CharacterEncodingFilter.doFilterInternal(HttpServletRequest, HttpServletResponse, FilterChain) line: 96
CharacterEncodingFilter(OncePerRequestFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 76
ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 235
ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 206
StandardWrapperValve.invoke(Request, Response) line: 228
StandardContextValve.invoke(Request, Response) line: 175
StandardHostValve.invoke(Request, Response) line: 128
ErrorReportValve.invoke(Request, Response) line: 104
StandardEngineValve.invoke(Request, Response) line: 109
CoyoteAdapter.service(Request, Response) line: 216
Http11AprProcessor.process(long) line: 866
Http11AprProtocol$Http11ConnectionHandler.process(long) line: 716
AprEndpoint$Worker.run() line: 1498
Thread.run() line: 619
  
这样的异常,我在action中获取了值,能够取到

        WorkflowActionForm waf = (WorkflowActionForm)form;

//判断上传文件是否为空,觉得是否抛出异常

         System.err.println("----------------"+waf.getProcessDefinition().getFileData());

//部署流程
workflowManager.deployProcessDefinition(
waf.getProcessDefinition().getFileData(),
  waf.getProcessImage().getFileData() );
  
  请教了




我们的项目中使用的工作流,处理各种有一定的顺序的业务逻辑,好像你采用的是WorkFlow吧,在Spring的WorkFlow中好像有关于文件上传的业务流程的Demo哦
1 楼 289056879 2009-12-25  
你好, 我现在在做 尚学堂的oa系统,查找问题的答案是看到了你的版面,希望请教你个问题,我刚好做到你所说的这里,可是我到页面上传文件不能成功,提示sqlException
我是按照视频写的,我上传文件一点提交debug里就出现
     Daemon Thread [http-8080-1] (Suspended (exception SQLException))
ServerPreparedStatement(PreparedStatement).executeUpdate(byte[][], InputStream[], boolean[], int[], boolean[], boolean) line: 1302
ServerPreparedStatement(PreparedStatement).executeUpdate(boolean) line: 1274
ServerPreparedStatement(PreparedStatement).executeUpdate() line: 1259
IdentityGenerator$GetGeneratedKeysDelegate.executeAndExtract(PreparedStatement) line: 73
IdentityGenerator$GetGeneratedKeysDelegate(AbstractReturningDelegate).performInsert(String, SessionImplementor, Binder) line: 33
SingleTableEntityPersister(AbstractEntityPersister).insert(Object[], boolean[], String, Object, SessionImplementor) line: 2158
SingleTableEntityPersister(AbstractEntityPersister).insert(Object[], Object, SessionImplementor) line: 2638
EntityIdentityInsertAction.execute() line: 48
ActionQueue.execute(Executable) line: 250
DefaultSaveEventListener(AbstractSaveEventListener).performSaveOrReplicate(Object, EntityKey, EntityPersister, boolean, Object, EventSource, boolean) line: 298
DefaultSaveEventListener(AbstractSaveEventListener).performSave(Object, Serializable, EntityPersister, boolean, Object, EventSource, boolean) line: 181
DefaultSaveEventListener(AbstractSaveEventListener).saveWithGeneratedId(Object, String, Object, EventSource, boolean) line: 107
DefaultSaveEventListener(DefaultSaveOrUpdateEventListener).saveWithGeneratedOrRequestedId(SaveOrUpdateEvent) line: 187
DefaultSaveEventListener.saveWithGeneratedOrRequestedId(SaveOrUpdateEvent) line: 33
DefaultSaveEventListener(DefaultSaveOrUpdateEventListener).entityIsTransient(SaveOrUpdateEvent) line: 172
DefaultSaveEventListener.performSaveOrUpdate(SaveOrUpdateEvent) line: 27
DefaultSaveEventListener(DefaultSaveOrUpdateEventListener).onSaveOrUpdate(SaveOrUpdateEvent) line: 70
SessionImpl.fireSave(SaveOrUpdateEvent) line: 535
SessionImpl.save(String, Object) line: 523
SessionImpl.save(Object) line: 519
GraphSession.deployProcessDefinition(ProcessDefinition) line: 77
JbpmContext.deployProcessDefinition(ProcessDefinition) line: 173
WorkflowManagerImpl.deployProcessDefinition(byte[], byte[]) line: 61
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
Method.invoke(Object, Object...) line: 597
AopUtils.invokeJoinpointUsingReflection(Object, Method, Object[]) line: 310
ReflectiveMethodInvocation.invokeJoinpoint() line: 182
ReflectiveMethodInvocation.proceed() line: 149
TransactionInterceptor.invoke(MethodInvocation) line: 106
ReflectiveMethodInvocation.proceed() line: 171
ExposeInvocationInterceptor.invoke(MethodInvocation) line: 89
ReflectiveMethodInvocation.proceed() line: 171
JdkDynamicAopProxy.invoke(Object, Method, Object[]) line: 204
$Proxy8.deployProcessDefinition(byte[], byte[]) line: not available
WorkflowAction.add(ActionMapping, ActionForm, HttpServletRequest, HttpServletResponse) line: 48
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
Method.invoke(Object, Object...) line: 597
WorkflowAction(DispatchAction).dispatchMethod(ActionMapping, ActionForm, HttpServletRequest, HttpServletResponse, String) line: 270
WorkflowAction(DispatchAction).execute(ActionMapping, ActionForm, HttpServletRequest, HttpServletResponse) line: 187
DelegatingActionProxy.execute(ActionMapping, ActionForm, HttpServletRequest, HttpServletResponse) line: 110
RequestProcessor.processActionPerform(HttpServletRequest, HttpServletResponse, Action, ActionForm, ActionMapping) line: 431
RequestProcessor.process(HttpServletRequest, HttpServletResponse) line: 236
ActionServlet.process(HttpServletRequest, HttpServletResponse) line: 1196
ActionServlet.doPost(HttpServletRequest, HttpServletResponse) line: 432
ActionServlet(HttpServlet).service(HttpServletRequest, HttpServletResponse) line: 710
ActionServlet(HttpServlet).service(ServletRequest, ServletResponse) line: 803
ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 290
ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 206
PagerFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 29
ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 235
ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 206
OpenSessionInViewFilter.doFilterInternal(HttpServletRequest, HttpServletResponse, FilterChain) line: 198
OpenSessionInViewFilter(OncePerRequestFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 76
ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 235
ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 206
CharacterEncodingFilter.doFilterInternal(HttpServletRequest, HttpServletResponse, FilterChain) line: 96
CharacterEncodingFilter(OncePerRequestFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 76
ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 235
ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 206
StandardWrapperValve.invoke(Request, Response) line: 228
StandardContextValve.invoke(Request, Response) line: 175
StandardHostValve.invoke(Request, Response) line: 128
ErrorReportValve.invoke(Request, Response) line: 104
StandardEngineValve.invoke(Request, Response) line: 109
CoyoteAdapter.service(Request, Response) line: 216
Http11AprProcessor.process(long) line: 866
Http11AprProtocol$Http11ConnectionHandler.process(long) line: 716
AprEndpoint$Worker.run() line: 1498
Thread.run() line: 619
  
这样的异常,我在action中获取了值,能够取到

        WorkflowActionForm waf = (WorkflowActionForm)form;

//判断上传文件是否为空,觉得是否抛出异常

         System.err.println("----------------"+waf.getProcessDefinition().getFileData());

//部署流程
workflowManager.deployProcessDefinition(
waf.getProcessDefinition().getFileData(),
  waf.getProcessImage().getFileData() );
  
  请教了

相关推荐

    jbpm4.3与spring整合

    ### jbpm4.3与Spring框架的整合指南 在企业级应用开发中,流程管理引擎JBPM(JBoss Business Process Management)与Spring框架的结合使用是常见的一种技术方案。JBPM是一个灵活、强大的业务流程管理工具,而Spring...

    JBPM4与Spring整合例子代码

    **JBPM4与Spring整合详解** JBPM4(Java Business Process Management 4)是一个开源的工作流管理系统,它提供了业务流程的建模、部署、执行和监控功能。Spring框架则是Java应用开发中的一个核心组件,主要负责依赖...

    jbpm4和spring整合例子

    近期网上有人介绍jBPM4与Spring整合的2种方式,但没有人贴出代码,闲着无聊写了个例子,源码见附件,在WEBLOGIC下运行正常,事务由spring控制http://ip:7001/Spring/helloWorld.do

    jBPM4与Spring整合的2种方式

    **标题:“jBPM4与Spring整合的2种方式”** **内容概述:** jBPM4是一款开源的工作流管理系统,它提供了业务流程管理(BPM)和工作流服务。而Spring是一个广泛应用的Java企业级应用框架,它简化了开发、配置和管理...

    jbpm与spring集成

    【jbpm与Spring集成】是企业级应用中常见的技术整合,旨在利用jbpm(Java Business Process Management)的流程管理能力,结合Spring框架的灵活服务管理,实现高效、可扩展的业务流程自动化。jbpm是一个开源的工作流...

    jbpm5 spring3 整合实例

    在spring3中整合jbpm5的例子,前台用spring mvc3做了简单的页面。 其中用到了jbpm5的persistence,local human service等,简单、完整。 用的mysql数据库,修改下spring datasource的配置,然后用mvn jetty:run编译...

    JBPM4.3 Spring会签 实例

    这些bean是Spring与JBPM交互的基础,通过它们可以启动流程实例、执行任务以及查询流程状态。 其次,创建流程定义(.bpmn文件)来描述会签流程。在这个流程中,可以设置多个并行的任务节点,每个节点代表一个会签的...

    jbpm+spring配置

    【jbpm+spring配置】是将业务流程管理(Business Process Management, BPM)框架jbpm与企业级应用开发...通过对这个项目的学习,你可以深入理解jbpm的流程设计、Spring的整合技巧以及如何在企业应用中实现流程自动化。

    Jbpm4.4 整合Spring Hibernate4

    在这个版本中,Jbpm与Spring框架和Hibernate ORM工具进行了整合,实现了更加灵活和高效的企业级应用开发。 **1. Jbpm简介** Jbpm4.4是Jbpm系列的一个版本,它主要负责处理业务流程的建模、执行、管理和监控。它支持...

    JBPM与Spring集成开发指南

    将JBPM与Spring集成,可以充分利用Spring的IoC(Inversion of Control)和AOP(Aspect Oriented Programming)特性,以及其丰富的生态系统,来管理和控制工作流的生命周期。 在集成JBPM与Spring时,首先需要理解...

    jbpm4.3-spring2.5整合

    jbpm4.3-spring2.5整合是一个关键的话题,涉及到企业级工作流管理系统Jbpm与Spring框架的集成。Jbpm是一个开源的工作流程管理(BPM)和业务规则管理系统,它允许开发者设计、执行、管理和监控业务流程。而Spring是...

    JBPM与Spring集成开发指南.docx

    【JBPM与Spring集成开发指南】 JBPM(Java Business Process Management)是一款开源的工作流引擎,它允许开发者在Java应用程序中实现复杂的业务流程自动化。而Spring框架则是Java领域中广泛使用的轻量级应用框架,...

    jbpm4.4 ibatis-spring 整合

    jbpm4.4 ibatis-spring 整合

    jbpm5.4 spring mvc 集成

    jbpm5.4与Spring MVC的集成是企业级应用开发中的常见组合,它结合了jbpm(业务流程管理)的强大功能和Spring MVC的灵活控制层架构。以下将详细阐述这一集成涉及的关键知识点: 1. **jbpm5.4**:jbpm是一个开源的...

    JBPM4.4+spring+ext整合

    【JBPM4.4+Spring+EXT 整合详解】 JBPM(Java Business Process Management)是一个开源的工作流管理系统,主要用于处理业务流程自动化。版本4.4是JBPM的一个重要里程碑,它提供了强大的工作流设计、执行和监控能力...

    JBPM5 整合Spring3经典案例

    - `jbpm_03_for_ant部署.doc`:这个文档很可能是关于使用Ant构建工具来部署和运行JBPM5与Spring3整合应用的指南。Ant是Java项目常用的构建工具,可以编写XML配置文件来自动化编译、打包和部署过程。 - `jbpm_03_for_...

    JBPM与Spring集成开发指导书.doc

    【JBPM与Spring集成开发】\n\nJBPM(Java Business Process Management)是一个开源的工作流管理系统,它允许开发者设计、执行、监控和优化业务流程。Spring框架则是一个广泛应用的Java企业级应用开发框架,提供了...

    JBPM与Spring集成开发指导书.docx

    4. **任务服务**:利用Spring与JBPM的接口,实现任务的分配、完成和查询。 在实际应用中,如请假流程、政策审批、图书订阅和驾照学习等,集成JBPM和Spring可以显著提升流程效率,减少人为错误,并方便后期的流程...

Global site tag (gtag.js) - Google Analytics