JBPM4.3+SSH环境搭建 .

http://yy629.iteye.com/category/78025

你要用jBPM4.3,首先至少你要了解
1.UML2.0的活动图(因为jBPM是Activity Diagram模型)
2.Hibernate(因为jBPM集成了Hibernate作为引擎的持久框架)
当然最重要的是你对工作流的系统结构有初步的了解。

具体指引请参考 用户手册和开发手册,这里只是一些简单补充。
一、jBPM4.3下载
sourceforge下载
http://sourceforge.net/projects/jbpm/

svn仓库里下载
http://anonsvn.jboss.org/repos/jbpm/jbpm4

二、搭建环境(GDP在Eclipse上的安装)
当你无法在Eclipse安装jBPM4.3 GDP插件,把你的Eclipse SDK版本升级到3.42就OK了。
本人用Myeclipse8.5

三、Myeclipse8.5安装jbpm4插件
下载好的jBPM4.3解包,找到jbpm-4.3/install/src/gpd/jbpm-gpd-site.zip
菜单【Help】-【MyEclipse Configuration Center】-选中【Software】点击【add site】-【Add from Archive File】选中jbpm-gpd-site.zip 点击ok
在【Personal Sites】将里面的接口右击 add to profile ,再点击右上角 Apply 7 change。自己重启,新建就能看到jbpm的菜单,毕!

四、jBPM4.3+SSH
1.在jbpm-4.3/install/src/db/create下选择你使用的数据库脚本(总共有18张表)
2.使用jbpm-4.3/install/src/demo下的SQL脚本生成测试用的数据
3.spring2.5+
4.hibernate用jbpm4.3的包,不支持ehcache。
四、主要配置文件
jbpm.hibernate.cfg.xml

Xml代码
  1. <?xml version="1.0" encoding="utf-8"?>  
  2.   
  3. <!DOCTYPE hibernate-configuration PUBLIC   
  4.           "-//Hibernate/Hibernate Configuration DTD 3.0//EN"   
  5.           "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">  
  6.   
  7. <hibernate-configuration>  
  8.     <session-factory>  
  9.         <mapping resource="jbpm.repository.hbm.xml" />  
  10.         <mapping resource="jbpm.execution.hbm.xml" />  
  11.         <mapping resource="jbpm.history.hbm.xml" />  
  12.         <mapping resource="jbpm.task.hbm.xml" />  
  13.         <mapping resource="jbpm.identity.hbm.xml" />  
  14.     </session-factory>  
  15. </hibernate-configuration>  
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <mapping resource="jbpm.repository.hbm.xml" /> <mapping resource="jbpm.execution.hbm.xml" /> <mapping resource="jbpm.history.hbm.xml" /> <mapping resource="jbpm.task.hbm.xml" /> <mapping resource="jbpm.identity.hbm.xml" /> </session-factory> </hibernate-configuration>


applicationContext.xml
Xml代码
  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <beans xmlns="http://www.springframework.org/schema/beans"  
  3.     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
  4.     xmlns:aop="http://www.springframework.org/schema/aop"  
  5.     xmlns:tx="http://www.springframework.org/schema/tx"  
  6.     xsi:schemaLocation="   
  7.        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd   
  8.        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd   
  9.        http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">  
  10.   
  11.     <bean id="dataSource"  
  12.         class="org.apache.commons.dbcp.BasicDataSource">  
  13.         <property name="driverClassName">  
  14.             <value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>  
  15.         </property>  
  16.         <property name="url">  
  17.             <value>jdbc:microsoft:sqlserver://localhost:1433;dataBaseName=jbpm</value>  
  18.         </property>  
  19.         <property name="username">  
  20.             <value>sa</value>  
  21.         </property>  
  22.         <property name="password">  
  23.             <value>sa</value>  
  24.         </property>  
  25.     </bean>  
  26.     <bean id="sessionFactory"  
  27.         class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">  
  28.         <property name="dataSource">  
  29.             <ref bean="dataSource" />  
  30.         </property>  
  31.         <property name="typeDefinitions">  
  32.             <ref bean="jbpmTypes" />  
  33.         </property>  
  34.         <property name="hibernateProperties">  
  35.             <props>  
  36.                 <prop key="hibernate.dialect">  
  37.                     org.hibernate.dialect.SQLServerDialect   
  38.                 </prop>  
  39.                 <prop key="hibernate.show_sql">true</prop>  
  40.                 <prop key="hibernate.format_sql">true</prop>  
  41.             </props>  
  42.         </property>  
  43.         <property name="configLocations">  
  44.             <list>  
  45.                 <value>classpath:hbm/jbpm.hibernate.cfg.xml</value>  //指定你存放的路径   
  46.             </list>  
  47.         </property>  
  48.     </bean>  
  49.   
  50.     //大字符串操作   
  51.     <bean id="jbpmTypes"  
  52.         class="org.springframework.orm.hibernate3.TypeDefinitionBean">  
  53.         <property name="typeName" value="string_max" />  
  54.         <property name="typeClass"  
  55.             value="org.jbpm.db.hibernate.StringMax" />  
  56.     </bean>  
  57.   
  58.     <!-- jbpm配置 -->  
  59.     <bean id="springHelper" class="org.jbpm.pvm.internal.processengine.SpringHelper" />  
  60.     <bean id="processEngine" factory-bean="springHelper"  
  61.         factory-method="createProcessEngine" />  
  62.            
  63.     <!-- 模板配置自己写的,不是必须的 -->  
  64.     <bean id="jbpmTemplate" class="com.meibiye.util.JbpmTemplate">  
  65.         <property name="processEngine" ref="processEngine"></property>  
  66.     </bean>  
  67.        
  68.     <!--   
  69.         事务管理bean(平台依赖,有jdbc/jta/jdbc等等)  
  70.     -->  
  71.     <bean id="transactionManager"  
  72.         class="org.springframework.orm.hibernate3.HibernateTransactionManager">  
  73.         <property name="sessionFactory" ref="sessionFactory"></property>  
  74.     </bean>  
  75.     <aop:config>  
  76.         <aop:advisor pointcut="execution(* com.yyaccp.jbpm.biz.*.*(..))"  
  77.             advice-ref="txAdvice" />  
  78.     </aop:config>  
  79.   
  80.     <tx:advice id="txAdvice" transaction-manager="transactionManager">  
  81.         <tx:attributes>  
  82.             <tx:method name="delete*" />  
  83.             <tx:method name="save*" />  
  84.             <tx:method name="update*" />  
  85.             <tx:method name="do*" />  
  86.             <tx:method name="*" propagation="SUPPORTS" read-only="true" />  
  87.         </tx:attributes>  
  88.     </tx:advice>  
  89. </beans>  
<?xml version="1.0" encoding="UTF-8"?> <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-2.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd"> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName"> <value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value> </property> <property name="url"> <value>jdbc:microsoft:sqlserver://localhost:1433;dataBaseName=jbpm</value> </property> <property name="username"> <value>sa</value> </property> <property name="password"> <value>sa</value> </property> </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref bean="dataSource" /> </property> <property name="typeDefinitions"> <ref bean="jbpmTypes" /> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect"> org.hibernate.dialect.SQLServerDialect </prop> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.format_sql">true</prop> </props> </property> <property name="configLocations"> <list> <value>classpath:hbm/jbpm.hibernate.cfg.xml</value> //指定你存放的路径 </list> </property> </bean> //大字符串操作 <bean id="jbpmTypes" class="org.springframework.orm.hibernate3.TypeDefinitionBean"> <property name="typeName" value="string_max" /> <property name="typeClass" value="org.jbpm.db.hibernate.StringMax" /> </bean> <!-- jbpm配置 --> <bean id="springHelper" class="org.jbpm.pvm.internal.processengine.SpringHelper" /> <bean id="processEngine" factory-bean="springHelper" factory-method="createProcessEngine" /> <!-- 模板配置自己写的,不是必须的 --> <bean id="jbpmTemplate" class="com.meibiye.util.JbpmTemplate"> <property name="processEngine" ref="processEngine"></property> </bean> <!-- 事务管理bean(平台依赖,有jdbc/jta/jdbc等等) --> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory"></property> </bean> <aop:config> <aop:advisor pointcut="execution(* com.yyaccp.jbpm.biz.*.*(..))" advice-ref="txAdvice" /> </aop:config> <tx:advice id="txAdvice" transaction-manager="transactionManager"> <tx:attributes> <tx:method name="delete*" /> <tx:method name="save*" /> <tx:method name="update*" /> <tx:method name="do*" /> <tx:method name="*" propagation="SUPPORTS" read-only="true" /> </tx:attributes> </tx:advice> </beans>


jbpm.cfg.xml  -- 这个文件一定要放到src目录下,不然系统找不到,开始半天没调通就是这个问题。
Xml代码
  1. <?xml version="1.0" encoding="UTF-8"?>  
  2.   
  3. <jbpm-configuration>  
  4.   
  5.   <import resource="jbpm.default.cfg.xml" />  
  6.   <import resource="jbpm.tx.spring.cfg.xml" />  
  7.   <import resource="jbpm.jpdl.cfg.xml" />  
  8.   <import resource="jbpm.bpmn.cfg.xml" />  
  9.   <import resource="jbpm.identity.cfg.xml" />  
  10.   <import resource="jbpm.businesscalendar.cfg.xml" />  
  11.   <import resource="jbpm.console.cfg.xml" />  
  12.   <!-- <import resource="jbpm.jobexecutor.cfg.xml" /> -->  
  13.      
  14.   <process-engine-context>  
  15.     <string name="spring.cfg" value="classpath:/config/applicationContext.xml" /> //指定自己的路径   
  16.   </process-engine-context>  
  17.   
  18. </jbpm-configuration>  
<?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" /> <!-- <import resource="jbpm.jobexecutor.cfg.xml" /> --> <process-engine-context> <string name="spring.cfg" value="classpath:/config/applicationContext.xml" /> //指定自己的路径 </process-engine-context> </jbpm-configuration>


jbpmTemplate.java
Java代码
  1. package com.meibiye.util;   
  2.   
  3. import java.util.List;   
  4. import java.util.Map;   
  5.   
  6. import org.jbpm.api.Execution;   
  7. import org.jbpm.api.ExecutionService;   
  8. import org.jbpm.api.HistoryService;   
  9. import org.jbpm.api.ManagementService;   
  10. import org.jbpm.api.ProcessEngine;   
  11. import org.jbpm.api.ProcessInstance;   
  12. import org.jbpm.api.RepositoryService;   
  13. import org.jbpm.api.TaskService;   
  14. import org.jbpm.api.task.Task;   
  15.   
  16. /**  
  17.  * jbpm模板类(初步实现)  
  18.  *   
  19.  * @author Administrator  
  20.  *   
  21.  */  
  22. public class JbpmTemplate {   
  23.   
  24.     /**  
  25.      * 部署流程到数据库  
  26.      *   
  27.      * @param resourceName  
  28.      *            资源文件名字 比如(org/forever/jbpm/jpdl/process.jpdl.xml)  
  29.      * @return 返回流程定义id(格式:key-version)  
  30.      */  
  31.     public String Deploy(String resourceName) {   
  32.         return repositoryService.createDeployment().addResourceFromClasspath(   
  33.                 resourceName).deploy();   
  34.     }   
  35.   
  36.     /**  
  37.      * 创建一个新的流程实例  
  38.      *   
  39.      * @param processDefinitionKey  
  40.      *            (process.jpdl.xml中process标签的key)  
  41.      * @param processInstanceKey  
  42.      *            (用户给的key,比如一个请假单的id)  
  43.      * @return 流程实例  
  44.      */  
  45.     public ProcessInstance addProcessInstance(String processDefinitionKey,   
  46.             String processInstanceKey) {   
  47.         return executionService.startProcessInstanceByKey(processDefinitionKey,   
  48.                 processInstanceKey);   
  49.   
  50.     }   
  51.        
  52.     /**  
  53.      * 创建一个新的流程实例  
  54.      * @param processDefinitionKey(process.jpdl.xml中process标签的key)  
  55.      * @param variables 该流程实例要用到的变量  
  56.      * @param processInstanceKey(用户给定的业务key)  
  57.      * @return  
  58.      */  
  59.     public ProcessInstance addProcessInstance(   
  60.             String processDefinitionKey,   
  61.             Map<String, ?> variables,   
  62.             String processInstanceKey){   
  63.         return executionService.startProcessInstanceByKey(processDefinitionKey, variables, processInstanceKey);   
  64.     }   
  65.        
  66.     /**  
  67.      * 提交任务  
  68.      * @param taskId 任务id  
  69.      */  
  70.     public void completeTask(String taskId){   
  71.         taskService.completeTask(taskId);   
  72.     }   
  73.        
  74.     /**  
  75.      * 将任务流转到指定名字的流程中去  
  76.      * @param taskId  
  77.      * @param outcome  
  78.      */  
  79.     public void completeTask(String taskId,String outcome){   
  80.         taskService.completeTask(taskId, outcome);   
  81.     }   
  82.   
  83.     /**  
  84.      * 根据key获取流程实例(这里我使用的uuid)  
  85.      *   
  86.      * @param key  
  87.      *            (对应于数据库表jbpm4_execution中的KEY_字段)  
  88.      * @return 返回查找到得流程实例,没有返回null  
  89.      */  
  90.     public ProcessInstance getProcessInstance(String key) {   
  91.         return executionService.createProcessInstanceQuery()   
  92.                 .processInstanceKey(key).uniqueResult();   
  93.     }   
  94.        
  95.        
  96.     /**  
  97.      * 根据executionId获取指定的变量值  
  98.      * @param executionId  
  99.      * @param variableName  
  100.      * @return  
  101.      */  
  102.     public Object getVariableByexecutionId(String executionId,String variableName){   
  103.         return executionService.getVariable(executionId, variableName);   
  104.     }   
  105.        
  106.        
  107.     /**  
  108.      * 根据任务id获取指定变量值  
  109.      * @param taskId  
  110.      * @param variableName  
  111.      * @return  
  112.      */  
  113.     public Object getVariableByTaskId(String taskId,String variableName){   
  114.         return taskService.getVariable(taskId, variableName);   
  115.     }   
  116.        
  117.     /**  
  118.      * 获取指定用户名字的任务  
  119.      * @param userId  
  120.      * @return  
  121.      */  
  122.     public List<Task> findPersonalTasks(String userId){   
  123.         return taskService.findPersonalTasks(userId);   
  124.     }   
  125.        
  126.     /**  
  127.      * 根据任务id获取任务  
  128.      * @param taskId  
  129.      * @return  
  130.      */  
  131.     public Task getTask(String taskId) {   
  132.         return taskService.getTask(taskId);   
  133.            
  134.     }   
  135.        
  136.     /**  
  137.      * 根据流程实例id获取  
  138.      * @param executionId  
  139.      * @return  
  140.      */  
  141.     public Execution findExecutionById(String executionId) {   
  142.         return executionService.findExecutionById(executionId);   
  143.     }   
  144.   
  145.     /**  
  146.      * 彻底删除文件的部署  
  147.      *   
  148.      * @param deploymentId流程定义id  
  149.      */  
  150.     public void deleteDeploymentCascade(String deploymentId) {   
  151.         repositoryService.deleteDeploymentCascade(deploymentId);   
  152.     }   
  153.   
  154.     public JbpmTemplate() {   
  155.            
  156.     }   
  157.   
  158.     public JbpmTemplate(ProcessEngine processEngine) {   
  159.         this.processEngine = processEngine;   
  160.         repositoryService = processEngine.getRepositoryService();   
  161.         executionService = processEngine.getExecutionService();   
  162.         taskService = processEngine.getTaskService();   
  163.         historyService = processEngine.getHistoryService();   
  164.         managementService = processEngine.getManagementService();   
  165.     }   
  166.   
  167.     private ProcessEngine processEngine;   
  168.     private RepositoryService repositoryService = null;   
  169.     private ExecutionService executionService = null;   
  170.     private TaskService taskService = null;   
  171.     private HistoryService historyService = null;   
  172.     private ManagementService managementService = null;   
  173.   
  174.     public ProcessEngine getProcessEngine() {   
  175.         return processEngine;   
  176.     }   
  177.   
  178.     public void setProcessEngine(ProcessEngine processEngine) {   
  179.         this.processEngine = processEngine;   
  180.         System.out.println(processEngine);   
  181.         repositoryService = processEngine.getRepositoryService();   
  182.         executionService = processEngine.getExecutionService();   
  183.         taskService = processEngine.getTaskService();   
  184.         historyService = processEngine.getHistoryService();   
  185.         managementService = processEngine.getManagementService();   
  186.     }   
  187.   
  188.     public RepositoryService getRepositoryService() {   
  189.         return repositoryService;   
  190.     }   
  191.   
  192.     public void setRepositoryService(RepositoryService repositoryService) {   
  193.         this.repositoryService = repositoryService;   
  194.     }   
  195.   
  196.     public ExecutionService getExecutionService() {   
  197.         return executionService;   
  198.     }   
  199.   
  200.     public void setExecutionService(ExecutionService executionService) {   
  201.         this.executionService = executionService;   
  202.     }   
  203.   
  204.     public TaskService getTaskService() {   
  205.         return taskService;   
  206.     }   
  207.   
  208.     public void setTaskService(TaskService taskService) {   
  209.         this.taskService = taskService;   
  210.     }   
  211.   
  212.     public HistoryService getHistoryService() {   
  213.         return historyService;   
  214.     }   
  215.   
  216.     public void setHistoryService(HistoryService historyService) {   
  217.         this.historyService = historyService;   
  218.     }   
  219.   
  220.     public ManagementService getManagementService() {   
  221.         return managementService;   
  222.     }   
  223.   
  224.     public void setManagementService(ManagementService managementService) {   
  225.         this.managementService = managementService;   
  226.     }   
  227.        
  228.   
  229. }  
package com.meibiye.util; import java.util.List; import java.util.Map; import org.jbpm.api.Execution; import org.jbpm.api.ExecutionService; import org.jbpm.api.HistoryService; import org.jbpm.api.ManagementService; import org.jbpm.api.ProcessEngine; import org.jbpm.api.ProcessInstance; import org.jbpm.api.RepositoryService; import org.jbpm.api.TaskService; import org.jbpm.api.task.Task; /** * jbpm模板类(初步实现) * * @author Administrator * */ public class JbpmTemplate { /** * 部署流程到数据库 * * @param resourceName * 资源文件名字 比如(org/forever/jbpm/jpdl/process.jpdl.xml) * @return 返回流程定义id(格式:key-version) */ public String Deploy(String resourceName) { return repositoryService.createDeployment().addResourceFromClasspath( resourceName).deploy(); } /** * 创建一个新的流程实例 * * @param processDefinitionKey * (process.jpdl.xml中process标签的key) * @param processInstanceKey * (用户给的key,比如一个请假单的id) * @return 流程实例 */ public ProcessInstance addProcessInstance(String processDefinitionKey, String processInstanceKey) { return executionService.startProcessInstanceByKey(processDefinitionKey, processInstanceKey); } /** * 创建一个新的流程实例 * @param processDefinitionKey(process.jpdl.xml中process标签的key) * @param variables 该流程实例要用到的变量 * @param processInstanceKey(用户给定的业务key) * @return */ public ProcessInstance addProcessInstance( String processDefinitionKey, Map<String, ?> variables, String processInstanceKey){ return executionService.startProcessInstanceByKey(processDefinitionKey, variables, processInstanceKey); } /** * 提交任务 * @param taskId 任务id */ public void completeTask(String taskId){ taskService.completeTask(taskId); } /** * 将任务流转到指定名字的流程中去 * @param taskId * @param outcome */ public void completeTask(String taskId,String outcome){ taskService.completeTask(taskId, outcome); } /** * 根据key获取流程实例(这里我使用的uuid) * * @param key * (对应于数据库表jbpm4_execution中的KEY_字段) * @return 返回查找到得流程实例,没有返回null */ public ProcessInstance getProcessInstance(String key) { return executionService.createProcessInstanceQuery() .processInstanceKey(key).uniqueResult(); } /** * 根据executionId获取指定的变量值 * @param executionId * @param variableName * @return */ public Object getVariableByexecutionId(String executionId,String variableName){ return executionService.getVariable(executionId, variableName); } /** * 根据任务id获取指定变量值 * @param taskId * @param variableName * @return */ public Object getVariableByTaskId(String taskId,String variableName){ return taskService.getVariable(taskId, variableName); } /** * 获取指定用户名字的任务 * @param userId * @return */ public List<Task> findPersonalTasks(String userId){ return taskService.findPersonalTasks(userId); } /** * 根据任务id获取任务 * @param taskId * @return */ public Task getTask(String taskId) { return taskService.getTask(taskId); } /** * 根据流程实例id获取 * @param executionId * @return */ public Execution findExecutionById(String executionId) { return executionService.findExecutionById(executionId); } /** * 彻底删除文件的部署 * * @param deploymentId流程定义id */ public void deleteDeploymentCascade(String deploymentId) { repositoryService.deleteDeploymentCascade(deploymentId); } public JbpmTemplate() { } public JbpmTemplate(ProcessEngine processEngine) { this.processEngine = processEngine; repositoryService = processEngine.getRepositoryService(); executionService = processEngine.getExecutionService(); taskService = processEngine.getTaskService(); historyService = processEngine.getHistoryService(); managementService = processEngine.getManagementService(); } private ProcessEngine processEngine; private RepositoryService repositoryService = null; private ExecutionService executionService = null; private TaskService taskService = null; private HistoryService historyService = null; private ManagementService managementService = null; public ProcessEngine getProcessEngine() { return processEngine; } public void setProcessEngine(ProcessEngine processEngine) { this.processEngine = processEngine; System.out.println(processEngine); repositoryService = processEngine.getRepositoryService(); executionService = processEngine.getExecutionService(); taskService = processEngine.getTaskService(); historyService = processEngine.getHistoryService(); managementService = processEngine.getManagementService(); } public RepositoryService getRepositoryService() { return repositoryService; } public void setRepositoryService(RepositoryService repositoryService) { this.repositoryService = repositoryService; } public ExecutionService getExecutionService() { return executionService; } public void setExecutionService(ExecutionService executionService) { this.executionService = executionService; } public TaskService getTaskService() { return taskService; } public void setTaskService(TaskService taskService) { this.taskService = taskService; } public HistoryService getHistoryService() { return historyService; } public void setHistoryService(HistoryService historyService) { this.historyService = historyService; } public ManagementService getManagementService() { return managementService; } public void setManagementService(ManagementService managementService) { this.managementService = managementService; } }


配置文件就是这些,毕!

五、请假流程
下面完成一个简单的请假流程。
参见:http://abstractforever.javaeye.com/blog/608189

附录:
JBPM4表结构说明

JBPM4_DEPLOYMENT   流程定义表
JBPM4_DEPLOYPROP 流程定义属性表

JBPM4_EXECUTION  流程实例表
JBPM4_HIST_ACTINST 流程活动(节点)实例表

JBPM4_HIST_DETAIL  流程历史详细表

JBPM4_HIST_PROCINST 流程实例历史表

JBPM4_HIST_TASK  流程任务实例历史表
JBPM4_HIST_VAR  流程变量(上下文)历史表

JBPM4_ID_GROUP 组表
JBPM4_ID_MEMBERSHIP 用户角色表
JBPM4_ID_USER  用户表
JBPM4_JOB  定时表
JBPM4_LOB  存储表
JBPM4_PARTICIPATION 参与者表
JBPM4_SWIMLANE  泳道表
JBPM4_TASK 任务表
JBPM4_VARIABLE 上下文表

红 色的表为经常使用的表.这里不使用JBPM自己的权限角色定义.
发布一个流程deploy后
jbpm4_deployment新增一条记录
jbpm4_deployprop新增三条记录
jbpm4_lob 新增一条记录

开始一个流程startProcessInstanceByKey后
jbpm4_execution新增一条记录
jbpm4_hist_actinst 新增一条记录
jbpm4_hist_procinst新增一条记录
jbpm4_hist_task新增一条记录
jbpm4_task 新增一条记录
流程定义相关的布署信息就存储在(1) JBPM4_DEPLOYMENT、(2) JBPM4_DEPLOYPROP 及(3) JBPM4_LOB 中。上传一个包含png和jpdl.xml的zip包后,JBPM4_DEPLOYMENT多一条记录 JBPM4_DEPLOYPROP 多三条, JBPM4_LOB多两条。
(4)J B PM4_HIST_PROCINST 与(5) JBPM4_HIST_ACTINST 分别存放的是Process Instance、Activity Instance的历史记录。
(6)JBPM4_EXECUTION 主要是存放JBPM4的执行信息,Execution机制代替了JBPM3的Token机制(详细参阅JBPM4的PVM机制,过段时间我也会进一步分析)。
(7)JBPM4_TASK 存放需要人来完成的Activities,需要人来参与完成的Activity 被称为Task。
(8)JBPM4_PARTICIPATION 存放 Participation的信息,Participation的种类有Candidate、Client、Owner、 Replaced Assignee和Viewer。而具体的Participation既可以是单一用户,也可以是用户组。
(9)JBPM4_SWIMLANE。 Swim Lane是一种Runtime Process Role。通过Swim Lane,多个Task可以一次分配到同一Actor身上。
(10) JBPM4 _VARIABLE 存的是进行时的临时变量。
(11) JBPM4_HIST_DETAIL 保存 Variable的变更记录。
(12)JBPM4_HIST_VAR 保存历史的变量 。
(13) JBPM4_HIST_TASK Task的历史信息。
(14)JBPM4_ID_GROUP (15)JBPM_ID_MEMBERSHIP (16)JBPM4_ID_USER 这三张表很常见了,基本的权限控制,关于用户认证方面建议还是自己开发一套,JBPM4的功能太简单了,使用中有很多需要难以满足。
(17) JBPM4_JOB 存放的是Timer 的定义。
(18) JBPM4_PROPERTY  JBPM引擎参数表。

你可能感兴趣的:(jbpm4)