JBPM学习一



Jbpm4.3使用文档
1.介绍
jBPM是一个可扩展、灵活的流程引擎, 它可以运行在独立的服务器上或者嵌入任何Java应用中。
类介绍:1.流程引擎 ProcessEngine processEngine = Configuration.getProcessEngine();
2.流程定义管理RepositoryService repositoryService = processEngine.getRepositoryService();
3.执行管理ExecutionService executionService = processEngine.getExecutionService();
4.任务管理TaskService taskService = processEngine.getTaskService();
5.历史管理HistoryService historyService = processEngine.getHistoryService();
6.用户管理IdentityService identityService= processEngine.getIdentityService();
使用步骤
下载
Jbpm4.3应用包:http://sourceforge.net/projects/jbpm/files/,解压。
源码下载:可以从jBPM的SVN仓库里下载源代码。
https://anonsvn.jboss.org/repos/jbpm/jbpm4/
2集成jbpm4.3
2.1    配置jbpm
首先到jbpm安装目录,复制 examples\src下的xml文件到你的项目src下。然后修改jbpm.hibernate.cfg.xml <!-- 改成自己的数据库链接  默认是hsql,可以直接运行examples-->
<?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>

<property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
<property name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property>
<property name="hibernate.connection.url">jdbc:hsqldb:mem:.</property>
<property name="hibernate.connection.username">sa</property>
<property name="hibernate.connection.password"></property>
<property name="hibernate.hbm2ddl.auto">create-drop</property>
<property name="hibernate.format_sql">false</property>

<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>
2.2    sql脚本
到jbpm4.3安装目录下install\src\db\create找到和自己数据库想对应的sql文件,目前有 hsqldb,mysql,oracle,postgresql。
2.3执行脚本建表
Mysql举例:打开 MySQL Command Line Client,然后执行 source  ./sql文件
2.4使用步骤实例
ProcessEngine processEngine = Configuration.getProcessEngine();
IdentityService identityService = processEngine.getIdentityService();
RepositoryService repositoryService = processEngine.getRepositoryService();
ExecutionService executionService = processEngine.getExecutionService();   
TaskService taskService = processEngine.getTaskService();
HistoryService historyService = processEngine.getHistoryService();
String username = (String) session.getAttribute("username");
//得到流程定义
List<ProcessDefinition> pdL = repositoryService.createProcessDefinitionQuery().list();
//流程实例
List<ProcessInstance> piL = executionService.createProcessInstanceQuery().list();
//当前用户的任务列表
List<Task> tL = taskService.findGroupTasks(username);
List<Task> tLByPerson = taskService.findPersonalTasks(username);
//处理历史列表
List<HistoryActivityInstance> htL = new ArrayList<HistoryActivityInstance>();
待续。。。。

你可能感兴趣的:(mysql,Hibernate,jbpm,配置管理,HSQLDB)