论坛首页 Java企业应用论坛

JBPM数据库表解析与实例

浏览 5144 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2009-02-08   最后修改:2009-02-08
1.jbpm_action表

字段     含义
ID_                       标识    主键
class                    流程动作分类
                          A(动作): org.jbpm.graph.def.Action
                          B(脚本):org.jbpm.graph.action.Script
                          C(创建定时器):        org.jbpm.scheduler.def.CreateTimerAction
                          I(取消定时器): org.jbpm.scheduler.def.CancelTimerAction
NAME_               流程动作名称
ISPROPAGATIONALLOWED_            boolean类型通常值为true
ACTIONEXPRESSION_                     动作类行为I时,表示动作执行的脚本
ISASYNC_                                       该动作是否支持异步机制
REFERENCEDACTION_                    动作中引用的动作,对应JBPM_ACTION
ACTIONDELEGATION_                     动作类型为A时使用,表示动作执行的代理类,对JBPM_DELEFGATION
EVENT_                                           动作中指定的事件,对应JBPM_EVENT
PROCESSDEFINITION_                   动作在流程模板id
TIMERNAME_                                  定时器名称
DUEDATE_                                     定时器间隔时间
REPEAT_                                        定时器动作执行次数
TRANSITIONNAME                          动作指定后的transition的name
TIMERACTION                                定时器动作代理类,对应JBPM_ACTION
EXPRESSION_                                定时器执行表达式
EVENTINDEX_                                事件索引
EXCEPTIONHANDLER_                   异常处理类,对应JBPM_EXCEPTIONHANDLER
EXCEPTIONHANDLERINDEX           异常处理类索引



2.jbpm_processdefinition表
字段                          含义
ID_                           标识   主键
CLASS_
NAME_                      流程定义的名字
DESCRIPTION_         流程定义表述
VERSION_                 流程的版本
ISTERMINATIONIMPLICIT_                         是否支持强制终止流程
STARTSTATE_                                         起始节点ID,在JBPM_NODE表中

3.jbpm_transition表
字段                含义
ID_                 流程迁移标识    主键
NAME_            流程迁移的名字
DESCRIPTION_         流程迁移描述
PROCESSDEFINITION_                 流程定义的ID_   外键
FROM_                                         迁移的来源,与node节点的id对应
TO_                                             迁移的目的,与node节点的id对应
CONDITION_                               还不了解
FROMINDEX_                               还不了解



4.jbpm_ node表
字段 含义
ID_         节点的标识     主键
CLASS_ 节点类型:
                  C: org.jbpm.graph.node.ProcessState
                  D: org.jbpm.graph.node.Decision
                  E: org.jbpm.graph.node.EndState
                  F: org.jbpm.graph.node.Fork
                  J: org.jbpm.graph.node.Join
                  K: org.jbpm.graph.node.TaskNode
                  N: org.jbpm.graph.def.Node
                  R: org.jbpm.graph.node.StartState
                  S: org.jbpm.graph.node.State
                  U: org.jbpm.graph.def.SuperState
NAME_           节点名字
DESCRIPTION_             节点描述
PROCESSDEFINITION_ 节点所在流程定义的ID 外键
ISASYNC_                     节点是否支持异步机制
ISAYYNCEXCL_              ???
ACTION_                      节点上的动作,对应与JBPM_ACTION表
SUPERSTATE_              节点对应的superState的id,表明该节点属于某个SuperState
SUBPROCNAME_          节点类型为ProcessState时使用,代表子流程定义的Name
SUBPROCESSDEFINITION_     节点类型为ProcessState时使用,代表子流程定义的ID外键
DECISIONEXPRESSION_         节点类型为Decision时使用,该属性表示Decision中使用的判断表达式
DECISIONDELEGATION           节点类型为Decision时使用,表明Decision对应的代理类,对应JBPM_DELEGATION
SCRIPT_                    脚本
SIGNAL_                   节点类型为Task
CREATETASKS_        节点类型为Task
ENDTASKS_              节点类型为Task
NODECOLLECTIONINDEX_           节点类型为SuperState时使用       `



5.jbpm_delegation表:
字段                      含义
ID_                        流程代理标识
CLASSNAME_         流程代理类名称
CONFIGURATION_ 流程代理类配置信息
CONFIGTYPE_          流程代理类配置类型
PROCESSDEFINITION_                流程代理类所属流程定义,对应JBPM_PROCESSDEFINITION 外键



6.jbom_event表:
字段              含义
ID_                     流程事件标识
EVENTTYPE_        流程事件类型名称
TYPE_                   流程事件所在的图形节点类型
"A" :Task
"C" :ProcessState
"D" :Decision"
"E" :EndState"
"F" :Fork"
"J" :Join"
"K" :TaskNode"
"N" :Node"
"P" :ProcessDefinition"
"R" :StartState"
"S" :State"
"T" :Transition"
"U" :SuperState"
GRAPHELEMENT_                流程事件所在的图形节点的ID
PROCESSDEFINITION_       流程事件所属流程定义,对应JBPM_PROCESSDEFINITION
外键
NODE_                               流程定义所属的节点,对应于JBPM_NODE
外键
TRANSITION_                     流程事件所属迁移,对应于JBPM_TRANSITION,外键
TASK_                                 流程事件所属任务,对应JBPM_TASK,外键

 
看一个例子:
Processdefinition.xml

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

<process-definition
  xmlns="urn:jbpm.org:jpdl-3.2"
  name="simple">
   <start-state name="start">
      <transition name="to_state" to="first">
         <action name="action" class="com.sample.action.Test1Action">
            <message>Going to the first state!</message>
         </action>
      </transition>
   </start-state>
   <state name="first">
      <transition name="to_end" to="end">
         <action name="action" class="com.sample.action.Test2Action">
            <message>About to finish!</message>
         </action>
      </transition>
   </state>
   <end-state name="end"></end-state>
</process-definition>


Test1Action.java
public class Test1Action implements ActionHandler{

private static final long serialVersionUID = 1L;

public void execute(ExecutionContext executionContext) throws Exception {
System.out.println("你好,我是Test1Action动作!");
}

}


Test2Action.java
public class Test2Action implements ActionHandler{

private static final long serialVersionUID = 1L;

public void execute(ExecutionContext executionContext) throws Exception {
System.out.println("你好,我是Test2Action动作!");
}

}


SimpleProcessTest.java
public class SimpleProcessTest extends TestCase {

public void testCreateSchema() {
JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();
jbpmConfiguration.createSchema();
System.out.println("the database is created successfully!");
}

public void testDeployProcessDefinition() {
JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();
JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
try {
ProcessDefinition pdf = ProcessDefinition
.parseXmlResource("simple/processdefinition.xml");
jbpmContext.deployProcessDefinition(pdf);
} finally {
if (jbpmContext != null)
jbpmContext.close();
}
System.out.println("the deploy is successful!");
}
}

我用的是mysql数据库,Hibernate配置

<!-- hibernate dialect -->
    <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>

    <!-- JDBC connection properties (begin) -->
    <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
    <property name="hibernate.connection.url">jdbc:mysql:///jbpm</property>
    <property name="hibernate.connection.username">root</property>
    <property name="hibernate.connection.password">****</property>
    <!-- JDBC connection properties (end) -->
  
    <property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>


   发表时间:2009-02-26  
谢谢楼主的努力, 我也在看这方面的材料.
0 请登录后投票
   发表时间:2009-03-06  
<action name="action" class="com.sample.action.Test1Action">
            <message>Going to the first state!</message>
</action>
其中的message好像没定义过吧?~~是吧~~?
0 请登录后投票
   发表时间:2009-03-06  
xujie2009 写道
<action name="action" class="com.sample.action.Test1Action">
            <message>Going to the first state!</message>
</action>
其中的message好像没定义过吧?~~是吧~~?

恩,没有定义.....没涉及到message,就没写.........
0 请登录后投票
论坛首页 Java企业应用版

跳转论坛:
Global site tag (gtag.js) - Google Analytics