第一:下载 jbpm-jpdl-suite-3.2.GA 并解压之后的目录结构
第二:下载eclipse-SDK-3.2.1-win32 并解压eclipse到jbpm目录下面designer里面 启动 designer.bat批处理文件就可以在eclipse下面安装好jbpm插件
第三:创建jbpm工程
jbpm工程目录结构
第四:在oracle中创建表空间用户,并在jbpm目录下面db中找到oracle对应的脚本执行,在工程中加入oracle的jar文件
修改src-main-config下面的hibernate.cfg.xml配置文件,我是使用oracle以下是配置文件信息
<!-- hibernate dialect -->
<property name="hibernate.dialect">org.hibernate.dialect.OracleDialect</property>
<!-- JDBC connection properties (begin) -->
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:@localhost:1521:orcl</property>
<property name="hibernate.connection.username">jbmp</property>
<property name="hibernate.connection.password">123</property>
<!-- JDBC connection properties (end) -->
第五:在scr-main-jpdl目录下面创建jpdl文件
<?xml version="1.0" encoding="UTF-8"?>
<process-definition xmlns="" name="test">
<start-state name="start">
<transition name="" to="部门经理审批"></transition>
</start-state>
<task-node name="部门经理审批">
<transition name="" to="总经理审批"></transition>
</task-node>
<task-node name="总经理审批">
<transition name="" to="end1"></transition>
</task-node>
<end-state name="end1"></end-state>
</process-definition>
第六:部署流程写一个类对流程进行部署
package com.hello;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import org.jbpm.JbpmConfiguration;
import org.jbpm.JbpmContext;
import org.jbpm.graph.def.ProcessDefinition;
import junit.framework.TestCase;
public class HelloTest extends TestCase {
protected void setUp() throws Exception {
// TODO Auto-generated method stub
super.setUp();
}
protected void tearDown() throws Exception {
// TODO Auto-generated method stub
super.tearDown();
}
public void testJbpmHelloTest() throws FileNotFoundException{
JbpmConfiguration config = JbpmConfiguration.getInstance();
JbpmContext jbpmContext = config.createJbpmContext();
InputStream in = new FileInputStream("src//main//jpdl//test//processdefinition.xml");
ProcessDefinition processDefinition = ProcessDefinition.parseXmlInputStream(in);
jbpmContext.deployProcessDefinition(processDefinition);
jbpmContext.close();
}
}
执行该类,就可以部署流程并在JBPM_PROCESSDEFINITION表中插入流程信息,流程部署完毕