??xml version="1.0" encoding="utf-8" standalone="yes"?>四川快乐12:BlogJava-小菜毛毛技术分?文章分类 - 四川福利彩票快乐12快乐12开奖直播快乐12开奖辽宁福彩快乐12快乐彩12选5走势图//www.ot7t.com.cn/caizh2009/category/39393.html与大家共同成?/description>zh-cnFri, 02 Apr 2010 19:21:39 GMTFri, 02 Apr 2010 19:21:39 GMT60jbpm与ssh完整示例(一) - 四川福利彩票快乐12快乐12开奖直播快乐12开奖辽宁福彩快乐12快乐彩12选5走势图//www.ot7t.com.cn/caizh2009/articles/317032.html小菜毛毛小菜毛毛Wed, 31 Mar 2010 04:19:00 GMT//www.ot7t.com.cn/caizh2009/articles/317032.html//www.ot7t.com.cn/caizh2009/comments/317032.html//www.ot7t.com.cn/caizh2009/articles/317032.html#Feedback0//www.ot7t.com.cn/caizh2009/comments/commentRss/317032.html//www.ot7t.com.cn/caizh2009/services/trackbacks/317032.html

四川快乐12:说明

Jbpm的开发流程可以按如下几步进行:流程的定义、流程的发布、流程实例的启动、流程节点的流转、查看流 程节点图片。本示例是在spring2.0?/span>hibernate3.2?/span>struts1.2下开发?/span>

如果是其它版本的框架也很容易做程 序的迁移?/font>

流程的定?/font>

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

1? 件安?/span>

?/span>jbpm-gpd-feature文件夹复制到C:"Program Files"MyEclipse-6.0M1"eclipse"plugins下,注意自己?/span>ecplise路径?/span>

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

这样再重新启?/span>eclipse就可以使用流程定义功能了?/span>

2? 程的定义

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

这样会产生三个文件:gpd.xml?/span>processdefinition.xml?/span>processimage.jpg?/span>

processdefinition.xml为描述流程定义文件,本例为:

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

<process-definition name="文测试流程">

   <start-state name="开?/span>">

      <transition name="提交张三审批" to="张三审批"></transition>

   </start-state>

   <task-node name="张三审批">

      <task name="审批1">

         <assignment actor-id="张三"/>

      </task>

      <transition name="提交李四审批" to="李四审批"></transition>

   </task-node>

   <task-node name="李四审批">

      <task name="审批2">

         <assignment actor-id="李四"/>

      </task>

      <transition name="提交王五审批" to="王五审批"></transition>

   </task-node>

   <task-node name="王五审批">

      <task name="审批3">

         <assignment actor-id="王五"/>

      </task>

      <transition name="结束流程" to="结束"></transition>

   </task-node>

   <end-state name="结束"></end-state>

</process-definition>

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

本例中的gpd.xml文件

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

<process-diagram name="文测试流程" width="801" height="477">

 <node name="开?/span>" x="308" y="4" width="140" height="40">

    <transition name="提交张三审批">

      <label x="5" y="-10"/>

    </transition>

 </node>

 <node name="张三审批" x="310" y="90" width="140" height="40">

    <transition name="提交李四审批">

      <label x="5" y="-10"/>

    </transition>

 </node>

 <node name="李四审批" x="313" y="192" width="140" height="40">

    <transition name="提交王五审批">

      <label x="5" y="-10"/>

    </transition>

 </node>

 <node name="王五审批" x="308" y="307" width="140" height="40">

    <transition name="结束流程">

      <label x="5" y="-10"/>

    </transition>

 </node>

 <node name="结束" x="307" y="401" width="140" height="40"/>

</process-diagram>


小菜毛毛 2010-03-31 12:19 发表评论
]]>
Jbpm工作流与ssh框架集成 - 四川福利彩票快乐12快乐12开奖直播快乐12开奖辽宁福彩快乐12快乐彩12选5走势图//www.ot7t.com.cn/caizh2009/articles/317030.html小菜毛毛小菜毛毛Wed, 31 Mar 2010 04:17:00 GMT//www.ot7t.com.cn/caizh2009/articles/317030.html//www.ot7t.com.cn/caizh2009/comments/317030.html//www.ot7t.com.cn/caizh2009/articles/317030.html#Feedback0//www.ot7t.com.cn/caizh2009/comments/commentRss/317030.html//www.ot7t.com.cn/caizh2009/services/trackbacks/317030.html阅读全文

小菜毛毛 2010-03-31 12:17 发表评论
]]>
jBPM开发入门指?5) (转?/title><link>//www.ot7t.com.cn/caizh2009/articles/268988.html</link><dc:creator>小菜毛毛</dc:creator><author>小菜毛毛</author><pubDate>Tue, 05 May 2009 07:14:00 GMT</pubDate><guid>//www.ot7t.com.cn/caizh2009/articles/268988.html</guid><wfw:comment>//www.ot7t.com.cn/caizh2009/comments/268988.html</wfw:comment><comments>//www.ot7t.com.cn/caizh2009/articles/268988.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>//www.ot7t.com.cn/caizh2009/comments/commentRss/268988.html</wfw:commentRss><trackback:ping>//www.ot7t.com.cn/caizh2009/services/trackbacks/268988.html</trackback:ping><description><![CDATA[前篇说起要讲在JBPM中实现用户权限,但这段时间比较忙,一直拖着。这里先把jbpm自带的websale例子放上来,大伙先将就看看。这个例子我已经把它抽取了出去,网页部份丢弃了。在看的时候主要看WebsaleTest.java,看看它的用户权限是怎么用的?br /> <br /> 几个重点?br /> (1) jBPM没有角色的概?!! 很多人把ActorID理解成角色,那是相当错误的。jBPM只有参与者的概念,也就是ActorID,它可以是用户ID,也可以是角色ID,也可以什? 都不是。你要自己去把用户角色等东东和ActorID映射起来。不过一般我们把ActorID设置成角色,但jbpm websale却是设置成用户的?br /> (2)用户信息的入口是JbpmContext,里面有一个setActorID方法。你用户登录时候,把一些用户信息set进去?br /> (3)泳道概念:你去看看UML中的带泳道的活动图,那就是象一个游泳池里的泳道一样?br /> <br /> <br /> 安装提示?br />  <classpathentry kind="con" path="JBPM/jBPM 3.1.2"/><br /> .classpath的这一句很可能和你电脑的设置不符,这是jbpm插件的一个设置,指向jbpm的HOME目录,以便找到jbpm的jar包。你按照你电脑上的设置相应修改一下这一? <img src ="//www.ot7t.com.cn/caizh2009/aggbug/268988.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="//www.ot7t.com.cn/caizh2009/" target="_blank">小菜毛毛</a> 2009-05-05 15:14 <a href="//www.ot7t.com.cn/caizh2009/articles/268988.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>jBPM开发入门指?4) (转?/title><link>//www.ot7t.com.cn/caizh2009/articles/268987.html</link><dc:creator>小菜毛毛</dc:creator><author>小菜毛毛</author><pubDate>Tue, 05 May 2009 07:14:00 GMT</pubDate><guid>//www.ot7t.com.cn/caizh2009/articles/268987.html</guid><wfw:comment>//www.ot7t.com.cn/caizh2009/comments/268987.html</wfw:comment><comments>//www.ot7t.com.cn/caizh2009/articles/268987.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>//www.ot7t.com.cn/caizh2009/comments/commentRss/268987.html</wfw:commentRss><trackback:ping>//www.ot7t.com.cn/caizh2009/services/trackbacks/268987.html</trackback:ping><description><![CDATA[<h2 class="yibqv"><a id="viewpost1_TitleUrl" href="../../chengang/archive/2006/08/24/65608.html">jBPM开发入门指?4) </a></h2> <h2 style="margin: 12pt 0cm"><span lang="EN-US"><font face="Arial">7</font> </span><span style="font-family: 黑体"> </span> <span lang="EN-US"><font face="Arial">jBPM</font> </span><span style="font-family: 黑体">的客户端开?/span> </h2> <p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span style="font-family: 宋体">有了前面?/span> <span lang="EN-US">HelloWorld</span> <span style="font-family: 宋体">后台流程,我们就要开始客户端程序了。正如前面提到的,本文不?/span> <span lang="EN-US">JSP</span> <span style="font-family: 宋体">,而改采用</span> <span lang="EN-US">JUnit</span> <span style="font-family: 宋体">的形式,输出则用</span> <span lang="EN-US">System.out.println</span> <span style="font-family: 宋体">。举一反三,知道在方法中输入及?/span> <span lang="EN-US">println</span> <span style="font-family: 宋体">输出,在</span> <span lang="EN-US">JSP</span> <span style="font-family: 宋体">?/span> <span lang="EN-US">SWING</span> <span style="font-family: 宋体">?/span> <span lang="EN-US">GUI</span> <span style="font-family: 宋体">界面还不是一样嘛?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><o:p> </o:p> </span></p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span style="font-family: 宋体">这个</span> <span lang="EN-US">JUnit</span> <span style="font-family: 宋体">客户端,我们就借用创建项目时自动生成的</span> <span lang="EN-US">SimpleProcessTest.java</span> <span style="font-family: 宋体">了,改写后如下:</span> </p> <div style="border-right: medium none; padding-right: 0cm; border-top: windowtext 1pt solid; padding-left: 0cm; background: #fff4e9; padding-bottom: 1pt; border-left: medium none; padding-top: 1pt; border-bottom: 1pt solid; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial"> <p class="a" style="margin: 0cm 0cm 0pt"><font size="2"><font face="Courier New"><strong class="yibqv"><span lang="EN-US" style="color: #7f0055">package</span> </strong><span lang="EN-US">com.sample;</span> </font></font></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><o:p><font face="Courier New" size="2"> </font> </o:p></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><font size="2"><font face="Courier New"><strong class="yibqv"><span lang="EN-US" style="color: #7f0055">import</span> </strong><span lang="EN-US">junit.framework.TestCase;</span> </font></font></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><o:p><font face="Courier New" size="2"> </font> </o:p></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><font size="2"><font face="Courier New"><strong class="yibqv"><span lang="EN-US" style="color: #7f0055">import</span> </strong><span lang="EN-US">org.jbpm.JbpmConfiguration;</span> </font></font></p> <p class="a" style="margin: 0cm 0cm 0pt"><font size="2"><font face="Courier New"><strong class="yibqv"><span lang="EN-US" style="color: #7f0055">import</span> </strong><span lang="EN-US">org.jbpm.JbpmContext;</span> </font></font></p> <p class="a" style="margin: 0cm 0cm 0pt"><font size="2"><font face="Courier New"><strong class="yibqv"><span lang="EN-US" style="color: #7f0055">import</span> </strong><span lang="EN-US">org.jbpm.context.exe.ContextInstance;</span> </font></font></p> <p class="a" style="margin: 0cm 0cm 0pt"><font size="2"><font face="Courier New"><strong class="yibqv"><span lang="EN-US" style="color: #7f0055">import</span> </strong><span lang="EN-US">org.jbpm.graph.def.ProcessDefinition;</span> </font></font></p> <p class="a" style="margin: 0cm 0cm 0pt"><font size="2"><font face="Courier New"><strong class="yibqv"><span lang="EN-US" style="color: #7f0055">import</span> </strong><span lang="EN-US">org.jbpm.graph.exe.ProcessInstance;</span> </font></font></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><o:p><font face="Courier New" size="2"> </font> </o:p></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><font size="2"><font face="Courier New"><strong class="yibqv"><span lang="EN-US" style="color: #7f0055">public</span> </strong><span lang="EN-US"><strong class="yibqv"><span style="color: #7f0055">class</span> </strong>SimpleProcessTest <strong class="yibqv"><span style="color: #7f0055">extends</span></strong> TestCase {</span> </font></font></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><o:p><font face="Courier New" size="2"> </font> </o:p></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">    </span><strong class="yibqv"><span style="color: #7f0055">private</span> </strong>JbpmConfiguration <span style="color: #0000c0">config</span> = JbpmConfiguration.<em>getInstance</em>();</font> </font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">    </span><strong class="yibqv"><span style="color: #7f0055">private</span> </strong>JbpmContext <span style="color: #0000c0">ctx</span> = <span style="color: #0000c0">config</span>.createJbpmContext();</font> </font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><font size="2"><span lang="EN-US"><font face="Courier New"><span class="yibqv">    </span><span style="color: #3f7f5f">// helloworld</span> </font></span><span style="color: #3f7f5f; font-family: 宋体">对应?/span> <span lang="EN-US" style="color: #3f7f5f"><font face="Courier New">jbpm_processdefinition</font> </span><span style="color: #3f7f5f; font-family: 宋体">表的</span> <span lang="EN-US" style="color: #3f7f5f"><font face="Courier New">name</font> </span><span style="color: #3f7f5f; font-family: 宋体">字段值,也即</span> <span lang="EN-US" style="color: #3f7f5f"><font face="Courier New">processdefinition.xml</font> </span><span style="color: #3f7f5f; font-family: 宋体">?/span> <span lang="EN-US" style="color: #3f7f5f"><font face="Courier New">name</font> </span></font></p> <p class="a" style="margin: 0cm 0cm 0pt"><font size="2"><span lang="EN-US"><font face="Courier New"><span class="yibqv">    </span><span style="color: #3f7f5f">// </span></font></span><span style="color: #3f7f5f; font-family: 宋体">这个值得取比较耗时,实际项目里最好和“数据库的</span> <span lang="EN-US" style="color: #3f7f5f"><font face="Courier New">JDBC</font> </span><span style="color: #3f7f5f; font-family: 宋体">连接”一样,让它共享,不要频繁打开关闭?/span> </font></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">    </span><strong class="yibqv"><span style="color: #7f0055">private</span> </strong>ProcessDefinition <span style="color: #0000c0">processDefinition</span> = <span style="color: #0000c0">ctx</span>.getGraphSession().findLatestProcessDefinition(<span style="color: #2a00ff">"helloworld"</span>);</font> </font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><o:p><font face="Courier New" size="2"> </font> </o:p></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">    </span><strong class="yibqv"><span style="color: #7f0055">public</span> </strong><strong class="yibqv"><span style="color: #7f0055">void</span> </strong>testNewRequest() {</font> </font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">        </span><strong class="yibqv"><span style="color: #7f0055">long</span> </strong>id = newRequest();</font> </font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">        </span>System.<em><span style="color: #0000c0">out</span></em>.println(<span style="color: #2a00ff">"id="</span> + id);</font> </font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">        </span>checkNewRequest(id);</font> </font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">        </span>confirmRequest(id);</font> </font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">        </span>checkconfirmRequest(id);</font> </font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><font size="2"><span lang="EN-US"><font face="Courier New"><span class="yibqv">        </span><span style="color: #0000c0">ctx</span>.close();<span style="color: #3f7f5f">// </span></font></span><span style="color: #3f7f5f; font-family: 宋体">关闭</span> <span lang="EN-US" style="color: #3f7f5f"><font face="Courier New">jbpm</font> </span><span style="color: #3f7f5f; font-family: 宋体">容器</span> </font></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">    </span>}</font> </font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><o:p><font face="Courier New" size="2"> </font> </o:p></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">    </span><span style="color: #3f5fbf">/**</span> </font></font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><font size="2"><span lang="EN-US"><font face="Courier New"><span class="yibqv">    </span><span class="yibqv"> </span> <span style="color: #3f5fbf">*</span> </font></span><span style="color: #3f5fbf; font-family: 宋体">创建一个请假单</span> </font></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">    </span><span class="yibqv"> </span> <span style="color: #3f5fbf">*</span> </font></font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">    </span><span class="yibqv"> </span> <span style="color: #3f5fbf">*</span> <strong class="yibqv"><span style="color: #7f9fbf">@return</span> </strong></font></font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">    </span><span class="yibqv"> </span> <span style="color: #3f5fbf">*/</span> </font></font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">    </span><strong class="yibqv"><span style="color: #7f0055">private</span> </strong><strong class="yibqv"><span style="color: #7f0055">long</span> </strong>newRequest() {</font> </font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><font size="2"><span lang="EN-US"><font face="Courier New"><span class="yibqv">        </span><span style="color: #3f7f5f">// </span></font></span><span style="color: #3f7f5f; font-family: 宋体">创建一个新流程</span> </font></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">        </span>ProcessInstance pi = <span style="color: #0000c0">processDefinition</span>.createProcessInstance();</font> </font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><font size="2"><span lang="EN-US"><font face="Courier New"><span class="yibqv">        </span><span style="color: #3f7f5f">// </span></font></span><span style="color: #3f7f5f; font-family: 宋体">取得流程的数据环?/span> </font></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">        </span>ContextInstance ci = pi.getContextInstance();</font> </font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><font size="2"><span lang="EN-US"><font face="Courier New"><span class="yibqv">        </span><span style="color: #3f7f5f">// </span></font></span><span style="color: #3f7f5f; font-family: 宋体">创建一张请假单</span> </font></p> <p class="a" style="margin: 0cm 0cm 0pt"><font size="2"><span lang="EN-US"><font face="Courier New"><span class="yibqv">        </span>ci.setVariable(<span style="color: #2a00ff">"name"</span>, <span style="color: #2a00ff">"</span></font> </span><st1:personname w:st="on"><span style="color: #2a00ff; font-family: 宋体">陈刚</span> </st1:personname><font face="Courier New"><span lang="EN-US" style="color: #2a00ff">www.chengang.com.cn"</span> <span lang="EN-US">);</span> </font></font></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">        </span>ci.setVariable(<span style="color: #2a00ff">"day"</span>, 2);</font> </font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">        </span><em>assertEquals</em>(<strong class="yibqv"><span style="color: #7f0055">null</span></strong>, ci.getVariable(<span style="color: #2a00ff">"note"</span>));</font> </font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><font size="2"><span lang="EN-US"><font face="Courier New"><span class="yibqv">        </span><span style="color: #3f7f5f">// </span></font></span><span style="color: #3f7f5f; font-family: 宋体">请假申请结束,转到下一个流程结?/span> </font></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">        </span>pi.signal();</font> </font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">        </span><strong class="yibqv"><span style="color: #7f0055">return</span> </strong>pi.getId();</font> </font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">    </span>}</font> </font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><o:p><font face="Courier New" size="2"> </font> </o:p></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">    </span><span style="color: #3f5fbf">/**</span> </font></font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><font size="2"><span lang="EN-US"><font face="Courier New"><span class="yibqv">    </span><span class="yibqv"> </span> <span style="color: #3f5fbf">*</span> </font></span><span style="color: #3f5fbf; font-family: 宋体">检查请假单的数?/span> </font></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">    </span><span class="yibqv"> </span> <span style="color: #3f5fbf">*</span> </font></font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">    </span><span class="yibqv"> </span> <span style="color: #3f5fbf">*</span> <strong class="yibqv"><span style="color: #7f9fbf">@param</span> </strong><span style="color: #3f5fbf">id</span> </font></font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">    </span><span class="yibqv"> </span> <span style="color: #3f5fbf">*/</span> </font></font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">    </span><strong class="yibqv"><span style="color: #7f0055">private</span> </strong><strong class="yibqv"><span style="color: #7f0055">void</span> </strong>checkNewRequest(<strong class="yibqv"><span style="color: #7f0055">long</span></strong> id) {</font> </font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><font size="2"><span lang="EN-US"><font face="Courier New"><span class="yibqv">        </span><span style="color: #3f7f5f">// </span></font></span><span style="color: #3f7f5f; font-family: 宋体">从数据库提取原流?/span> </font></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">        </span>ProcessInstance pi = <span style="color: #0000c0">ctx</span>.loadProcessInstance(id);</font> </font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><font size="2"><span lang="EN-US"><font face="Courier New"><span class="yibqv">        </span><span style="color: #3f7f5f">// </span></font></span><span style="color: #3f7f5f; font-family: 宋体">取得流程的数据环?/span> </font></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">        </span>ContextInstance ci = pi.getContextInstance();</font> </font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><font size="2"><span lang="EN-US"><font face="Courier New"><span class="yibqv">        </span><span style="color: #3f7f5f">// </span></font></span><span style="color: #3f7f5f; font-family: 宋体">创建一张请假单</span> </font></p> <p class="a" style="margin: 0cm 0cm 0pt"><font size="2"><span lang="EN-US"><font face="Courier New"><span class="yibqv">        </span><em>assertEquals</em>(<span style="color: #2a00ff">"</span></font> </span><st1:personname w:st="on"><span style="color: #2a00ff; font-family: 宋体">陈刚</span> </st1:personname><font face="Courier New"><span lang="EN-US" style="color: #2a00ff">www.chengang.com.cn"</span> <span lang="EN-US">, ci.getVariable(<span style="color: #2a00ff">"name"</span>));</span> </font></font></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">        </span><em>assertEquals</em>(Integer.<em>valueOf</em>(2), ci.getVariable(<span style="color: #2a00ff">"day"</span>));</font> </font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><font size="2"><span lang="EN-US"><font face="Courier New"><span class="yibqv">        </span><em>assertEquals</em>(<span style="color: #2a00ff">"</span></font> </span><span style="color: #2a00ff; font-family: 宋体">我要请假</span> <font face="Courier New"><span lang="EN-US" style="color: #2a00ff">"</span> <span lang="EN-US">, ci.getVariable(<span style="color: #2a00ff">"note"</span>));</span> </font></font></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><o:p><font face="Courier New" size="2"> </font> </o:p></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><font size="2"><span lang="EN-US"><font face="Courier New"><span class="yibqv">        </span><span style="color: #3f7f5f">// </span></font></span><span style="color: #3f7f5f; font-family: 宋体">当前是结点为</span> <span lang="EN-US" style="color: #3f7f5f"><font face="Courier New">confirm</font> </span></font></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">        </span><em>assertEquals</em>(pi.getRootToken().getNode().getName(), <span style="color: #2a00ff">"confirm"</span>);</font> </font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><font size="2"><span lang="EN-US"><font face="Courier New"><span class="yibqv">        </span><span style="color: #3f7f5f">// </span></font></span><span style="color: #3f7f5f; font-family: 宋体">流程还没结束</span> </font></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">        </span><em>assertFalse</em>(pi.hasEnded());</font> </font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">    </span>}</font> </font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><o:p><font face="Courier New" size="2"> </font> </o:p></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">    </span><span style="color: #3f5fbf">/**</span> </font></font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font face="Courier New"><font size="2"><span class="yibqv">    </span><span class="yibqv"> </span> <span style="color: #3f5fbf">*</span> </font></font></span><span style="color: #3f5fbf; font-family: 宋体"><font size="2">审批<st1:personname w:st="on">陈刚</st1:personname>的请假申?/font> </span></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">    </span><span class="yibqv"> </span> <span style="color: #3f5fbf">*</span> </font></font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">    </span><span class="yibqv"> </span> <span style="color: #3f5fbf">*</span> <strong class="yibqv"><span style="color: #7f9fbf">@param</span> </strong><span style="color: #3f5fbf">id</span> </font></font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">    </span><span class="yibqv"> </span> <span style="color: #3f5fbf">*/</span> </font></font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">    </span><strong class="yibqv"><span style="color: #7f0055">private</span> </strong><strong class="yibqv"><span style="color: #7f0055">void</span> </strong>confirmRequest(<strong class="yibqv"><span style="color: #7f0055">long</span></strong> id) {</font> </font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">        </span>ProcessInstance pi = <span style="color: #0000c0">ctx</span>.loadProcessInstance(id);</font> </font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">        </span>ContextInstance ci = pi.getContextInstance();</font> </font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><font size="2"><span lang="EN-US"><font face="Courier New"><span class="yibqv">        </span><span style="color: #3f7f5f">// </span></font></span><span style="color: #3f7f5f; font-family: 宋体">不通过</span> </font></p> <p class="a" style="margin: 0cm 0cm 0pt"><font size="2"><span lang="EN-US"><font face="Courier New"><span class="yibqv">        </span>ci.setVariable(<span style="color: #2a00ff">"note"</span>, <span style="color: #2a00ff">"</span></font> </span><span style="color: #2a00ff; font-family: 宋体">不准请假,继续加?/span> <font face="Courier New"><span lang="EN-US" style="color: #2a00ff">"</span> <span lang="EN-US">);</span> </font></font></p> <p class="a" style="margin: 0cm 0cm 0pt"><font size="2"><span lang="EN-US"><font face="Courier New"><span class="yibqv">        </span><span style="color: #3f7f5f">// </span></font></span><span style="color: #3f7f5f; font-family: 宋体">审批结束,到下一个流程结?/span> </font></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">        </span>pi.signal();</font> </font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">    </span>}</font> </font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><o:p><font face="Courier New" size="2"> </font> </o:p></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">    </span><strong class="yibqv"><span style="color: #7f0055">private</span> </strong><strong class="yibqv"><span style="color: #7f0055">void</span> </strong>checkConfirmRequest(<strong class="yibqv"><span style="color: #7f0055">long</span></strong> id) {</font> </font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">        </span>ProcessInstance pi = <span style="color: #0000c0">ctx</span>.loadProcessInstance(id);</font> </font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">        </span>ContextInstance ci = pi.getContextInstance();</font> </font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><font size="2"><span lang="EN-US"><font face="Courier New"><span class="yibqv">        </span><span style="color: #3f7f5f">// ConfirmAction</span> </font></span><span style="color: #3f7f5f; font-family: 宋体">类在</span> <span lang="EN-US" style="color: #3f7f5f"><font face="Courier New">signal</font> </span><span style="color: #3f7f5f; font-family: 宋体">后执行,所以覆盖了经理的审批意?/span> </font></p> <p class="a" style="margin: 0cm 0cm 0pt"><font size="2"><span lang="EN-US"><font face="Courier New"><span class="yibqv">        </span><em>assertEquals</em>(<span style="color: #2a00ff">"</span></font> </span><span style="color: #2a00ff; font-family: 宋体">准假</span> <font face="Courier New"><span lang="EN-US" style="color: #2a00ff">"</span> <span lang="EN-US">, ci.getVariable(<span style="color: #2a00ff">"note"</span>));</span> </font></font></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><o:p><font face="Courier New" size="2"> </font> </o:p></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><font size="2"><span lang="EN-US"><font face="Courier New"><span class="yibqv">        </span><span style="color: #3f7f5f">// </span></font></span><span style="color: #3f7f5f; font-family: 宋体">当前是结点为</span> <span lang="EN-US" style="color: #3f7f5f"><font face="Courier New">end</font> </span></font></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">        </span><em>assertEquals</em>(pi.getRootToken().getNode().getName(), <span style="color: #2a00ff">"end"</span>);</font> </font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><font size="2"><span lang="EN-US"><font face="Courier New"><span class="yibqv">        </span><span style="color: #3f7f5f">// </span></font></span><span style="color: #3f7f5f; font-family: 宋体">流程结束?/span> </font></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">        </span><em>assertTrue</em>(pi.hasEnded());</font> </font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font size="2"><font face="Courier New"><span class="yibqv">    </span>}</font> </font></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><o:p><font face="Courier New" size="2"> </font> </o:p></span></p> <p class="a" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><font face="Courier New" size="2">}</font> </span></p> </div> <p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span lang="EN-US"><o:p> </o:p> </span></p> <span style="font-size: 10.5pt; font-family: 宋体">这个例子还是很简单,而且关键是缺少用户、组、权限等工作流系统必须的东西,不过没关系。下面的内容我将完成一个更完整的实?/span> <br /> <br /> <p>//97wen.com/</p> <p>//77.haowyt.com/</p> <img src ="//www.ot7t.com.cn/caizh2009/aggbug/268987.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="//www.ot7t.com.cn/caizh2009/" target="_blank">小菜毛毛</a> 2009-05-05 15:14 <a href="//www.ot7t.com.cn/caizh2009/articles/268987.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>BPM开发入门指?3) (转?/title><link>//www.ot7t.com.cn/caizh2009/articles/268985.html</link><dc:creator>小菜毛毛</dc:creator><author>小菜毛毛</author><pubDate>Tue, 05 May 2009 07:12:00 GMT</pubDate><guid>//www.ot7t.com.cn/caizh2009/articles/268985.html</guid><wfw:comment>//www.ot7t.com.cn/caizh2009/comments/268985.html</wfw:comment><comments>//www.ot7t.com.cn/caizh2009/articles/268985.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>//www.ot7t.com.cn/caizh2009/comments/commentRss/268985.html</wfw:commentRss><trackback:ping>//www.ot7t.com.cn/caizh2009/services/trackbacks/268985.html</trackback:ping><description><![CDATA[     摘要: jBPM开发入门指?3) 5  安装 jBPM ? Eclipse 开发插? 有个辅助工具开发起来方便一点,只不过现?jBPM 的开发工具插件功能还不算太强,也就一?#8220;项目创建向导”的功能,让你? ?)不用再去配?classpath 库的引用? ?)直接得到了一?jBPM ?..  <a href='//www.ot7t.com.cn/caizh2009/articles/268985.html'>阅读全文</a><img src ="//www.ot7t.com.cn/caizh2009/aggbug/268985.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="//www.ot7t.com.cn/caizh2009/" target="_blank">小菜毛毛</a> 2009-05-05 15:12 <a href="//www.ot7t.com.cn/caizh2009/articles/268985.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>jBPM开发入门指?2) (转?/title><link>//www.ot7t.com.cn/caizh2009/articles/268984.html</link><dc:creator>小菜毛毛</dc:creator><author>小菜毛毛</author><pubDate>Tue, 05 May 2009 07:11:00 GMT</pubDate><guid>//www.ot7t.com.cn/caizh2009/articles/268984.html</guid><wfw:comment>//www.ot7t.com.cn/caizh2009/comments/268984.html</wfw:comment><comments>//www.ot7t.com.cn/caizh2009/articles/268984.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>//www.ot7t.com.cn/caizh2009/comments/commentRss/268984.html</wfw:commentRss><trackback:ping>//www.ot7t.com.cn/caizh2009/services/trackbacks/268984.html</trackback:ping><description><![CDATA[<h2 class="yibqv"> <a id="viewpost1_TitleUrl" href="../../chengang/archive/2006/08/22/65132.html">jBPM开发入门指?2) </a> </h2> <h2 style="margin: 12pt 0cm;"> <span lang="EN-US"> <font face="Arial">4 </font> </span> <span style="font-family: 黑体;">数据库初始化</span> </h2> <p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 0cm;"> <span lang="EN-US">jBPM</span> <span style="font-family: 宋体;">需要数据库支持?/span> <span lang="EN-US">jBPM</span> <span style="font-family: 宋体;">会把自己的一个初始化数据存储到数据库,同时工作流的数据也是存储到数据库中的?/span> <span lang="EN-US">jBPM</span> <span style="font-family: 宋体;">使用</span> <span lang="EN-US">Hibernate</span> <span style="font-family: 宋体;">来做为自己的存储层,因此只要?/span> <span lang="EN-US">Hibernate</span> <span style="font-family: 宋体;">支持的数据库?/span> <span lang="EN-US">jBPM</span> <span style="font-family: 宋体;">也就支持?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 0cm;"> <span lang="EN-US"> <o:p> </o:p> </span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 0cm;"> <span style="font-family: 宋体;">本文先以</span> <span lang="EN-US">MySQL</span> <span style="font-family: 宋体;">为例,然后再?/span> <span lang="EN-US">Oracle</span> <span style="font-family: 宋体;">为例,来谈谈</span> <span lang="EN-US">jBPM</span> <span style="font-family: 宋体;">的数据库初始化操作?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 0cm;"> <span lang="EN-US"> <o:p> </o:p> </span> </p> <p class="a0" style="margin: 6pt 0cm;"> <font size="2"> <font style="background-color: #dddddd;"> <span style="font-family: 楷体_GB2312;">注:在上面的</span> <span lang="EN-US">JBoss</span> <span style="font-family: 楷体_GB2312;">自带的示例中,并没有设置数据库,那是因为</span> <span lang="EN-US">jBPM</span> <span style="font-family: 楷体_GB2312;">默认使用的是内存数据?/span> <span lang="EN-US">hsqldb</span> <span style="font-family: 楷体_GB2312;">?/span> </font> </font> </p> <h3 style="margin: 12pt 0cm 6pt;"> <span lang="EN-US"> <font size="3" face="宋体, MS Song">4.1<span class="yibqv">  </span>MySQL</font> </span> </h3> <p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 0cm;"> <span lang="EN-US"> <o:p> </o:p> </span> </p> <p class="4" style="margin: 6pt 0cm; text-indent: 21pt;"> <span lang="EN-US">1</span> <span style="font-family: 楷体_GB2312;">、首先安?/span> <span lang="EN-US">MySQL</span> <span style="font-family: 楷体_GB2312;">?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt;"> <span lang="EN-US">MySQL</span> <span style="font-family: 宋体;">的安装比较简单,网上也有很多文章,本文不再赘述。本指南所?/span> <span lang="EN-US">MySQL</span> <span style="font-family: 宋体;">版本?/span> <span lang="EN-US">MySQL 4.1</span> <span style="font-family: 宋体;">?/span> <span lang="EN-US">for windows</span> <span style="font-family: 宋体;">)。再找一?/span> <span lang="EN-US">MySQL</span> <span style="font-family: 宋体;">客户端,目的是方便查看数据库中的数据,本文推荐使?/span> <span lang="EN-US">MySQL</span> <span style="font-family: 宋体;">网站上免费提供的“</span> <span lang="EN-US">MySQL Query Brower</span> <span style="font-family: 宋体;">”,当然你用其他的客户端也行,比如</span> <span lang="EN-US">MySQL-Front</span> <span style="font-family: 宋体;">?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt;"> <span lang="EN-US"> <o:p> </o:p> </span> </p> <p class="4" style="margin: 6pt 0cm; text-indent: 21pt;"> <span lang="EN-US">2</span> <span style="font-family: 楷体_GB2312;">、建?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt;"> <span lang="EN-US">MySQL</span> <span style="font-family: 宋体;">中创建一个库,库名:</span> <span lang="EN-US">jbpm</span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt;"> <span lang="EN-US"> <o:p> </o:p> </span> </p> <p class="4" style="margin: 6pt 0cm; text-indent: 21pt;"> <span lang="EN-US">3</span> <span style="font-family: 楷体_GB2312;">、生成建表的</span> <span lang="EN-US">SQL</span> <span style="font-family: 楷体_GB2312;">语句并建?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt;"> <span style="font-family: 宋体;">?/span> <span lang="EN-US">jbpm-starters-kit-<st1:chsdate isrocdate="False" islunardate="False" day="30" month="12" year="1899" w:st="on">3.1.1</st1:chsdate></span> <span style="font-family: 宋体;">下的子目?/span> <span lang="EN-US">jbpm</span> <span style="font-family: 宋体;">改名?/span> <span lang="EN-US">jbpm.3</span> <span style="font-family: 宋体;">,否则在执行下面?/span> <span lang="EN-US">ant</span> <span style="font-family: 宋体;">命令时会报如</span> <span lang="EN-US">jbpm.3</span> <span style="font-family: 宋体;">目录不存在的错误?/span> </p> <div style="border-style: solid none; border-color: windowtext -moz-use-text-color; border-width: 1pt medium; padding: 1pt 0cm; background: #fff4e9 none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"> <p class="a" style="margin: 0cm 0cm 0pt;"> <span lang="EN-US"> <font size="2" face="Courier New">D:\jbpm-starters-kit-<st1:chsdate isrocdate="False" islunardate="False" day="30" month="12" year="1899" w:st="on">3.1.1</st1:chsdate>\jbpm-db\build.xml:361: The following error occurred while executing this line:</font> </span> </p> <p class="a" style="margin: 0cm 0cm 0pt;"> <span lang="EN-US"> <font size="2" face="Courier New">D:\jbpm-starters-kit-<st1:chsdate isrocdate="False" islunardate="False" day="30" month="12" year="1899" w:st="on">3.1.1</st1:chsdate>\jbpm-db\build.xml:68: Basedir D:\jbpm-starters-kit-3.1.1\jbpm.3 does not exist</font> </span> </p> </div> <p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 0cm;"> <span lang="EN-US"> <o:p> </o:p> </span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt;"> <span style="font-family: 宋体;">?/span> <span lang="EN-US">DOS</span> <span style="font-family: 宋体;">窗下,进?/span> <span lang="EN-US">D:\jbpm-starters-kit-<st1:chsdate isrocdate="False" islunardate="False" day="30" month="12" year="1899" w:st="on">3.1.1</st1:chsdate>\jbpm-db</span> <span style="font-family: 宋体;">目录,执行如下命令:</span> </p> <div style="border-style: solid none; border-color: windowtext -moz-use-text-color; border-width: 1pt medium; padding: 1pt 0cm; background: #fff4e9 none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"> <p class="a" style="margin: 0cm 0cm 0pt;"> <span lang="EN-US"> <font size="2" face="Courier New">ant mysql.scripts</font> </span> </p> </div> <p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 0cm;"> <span lang="EN-US"> <o:p> </o:p> </span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 0cm;"> <span style="font-family: 宋体;">执行成功后,?/span> <span lang="EN-US">D:\jbpm-starters-kit-<st1:chsdate isrocdate="False" islunardate="False" day="30" month="12" year="1899" w:st="on">3.1.1</st1:chsdate>\jbpm-db\build\mysql\scripts</span> <span style="font-family: 宋体;">目录里生成了四个</span> <span lang="EN-US">sql</span> <span style="font-family: 宋体;">文件,它们做什么用的一看名字就知道了。在</span> <span lang="EN-US">MySQL</span> <span style="font-family: 宋体;">客户端中执行“</span> <span lang="EN-US">mysql.create.sql</span> <span style="font-family: 宋体;">”脚本,这样将?/span> <span lang="EN-US">jbpm</span> <span style="font-family: 宋体;">库中创建一个个的数据表?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 0cm;"> <span lang="EN-US"> <o:p> </o:p> </span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 0cm;"> <span lang="EN-US"> <o:p> </o:p> </span> </p> <h3 style="margin: 12pt 0cm 6pt;"> <span lang="EN-US"> <font size="3" face="宋体, MS Song">4.2<span class="yibqv">  </span>Oracle</font> </span> </h3> <p class="MsoNormal" style="margin: 0cm 0cm 0pt;"> <span style="font-family: 宋体;">先安装好</span> <span lang="EN-US">Oracle</span> <span style="font-family: 宋体;">服务器。我们公司有现存?/span> <span lang="EN-US">Oracle</span> <span style="font-family: 宋体;">服务器,也提供给了我一个属于我自己的用户名,一登录就可以任意在我的库之下创建表了。所以这一步就省了,没有的自个先装好吧?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt;"> <span style="font-family: 宋体;">访问</span> <span lang="EN-US">Oracle</span> <span style="font-family: 宋体;">推荐?#8220;</span> <span lang="EN-US">PLSQL Developer</span> <span style="font-family: 宋体;">”。不过要连接</span> <span lang="EN-US">Oracle</span> <span style="font-family: 宋体;">还要在本机上装上</span> <span lang="EN-US">Oracle</span> <span style="font-family: 宋体;">自己的客户端程序,里面提供了</span> <span lang="EN-US">JDBC</span> <span style="font-family: 宋体;">包和一些配置。要连接服务器还得配置一下,我一般都是不?/span> <span lang="EN-US">GUI</span> <span style="font-family: 宋体;">而直接改</span> <span lang="EN-US">tnsnames.ora</span> <span style="font-family: 宋体;">文件,在我的电脑里此文件的目录地址是:</span> <span lang="EN-US">D:\oracle\ora92\network\ADMIN\tnsnames.ora</span> <span style="font-family: 宋体;">,内容如?/span> <span lang="EN-US">(</span> <span style="font-family: 宋体;">两面有两个配置了</span> <span lang="EN-US">)</span> <span style="font-family: 宋体;">?/span> </p> <div style="border-style: solid none; border-color: windowtext -moz-use-text-color; border-width: 1pt medium; padding: 1pt 0cm; background: #fff4e9 none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"> <p class="a" style="margin: 0cm 0cm 0pt;"> <span lang="EN-US"> <font size="2" face="Courier New"># TNSNAMES.ORA Network Configuration File: E:\oracle\ora92\network\admin\tnsnames.ora</font> </span> </p> <p class="a" style="margin: 0cm 0cm 0pt;"> <span lang="EN-US"> <font size="2" face="Courier New"># Generated by Oracle configuration tools.</font> </span> </p> <p class="a" style="margin: 0cm 0cm 0pt;"> <span lang="EN-US"> <o:p> <font size="2" face="Courier New"> </font> </o:p> </span> </p> <p class="a" style="margin: 0cm 0cm 0pt;"> <span lang="EN-US"> <font size="2" face="Courier New">WXXRDB_192.168.3.2 =</font> </span> </p> <p class="a" style="margin: 0cm 0cm 0pt;"> <span lang="EN-US"> <font size="2"> <font face="Courier New"> <span class="yibqv">  </span>(DESCRIPTION =</font> </font> </span> </p> <p class="a" style="margin: 0cm 0cm 0pt;"> <span lang="EN-US"> <font size="2"> <font face="Courier New"> <span class="yibqv">    </span>(ADDRESS_LIST =</font> </font> </span> </p> <p class="a" style="margin: 0cm 0cm 0pt;"> <span lang="EN-US"> <font size="2"> <font face="Courier New"> <span class="yibqv">      </span>(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.3.2)(PORT = 1521))</font> </font> </span> </p> <p class="a" style="margin: 0cm 0cm 0pt;"> <span lang="EN-US"> <font size="2"> <font face="Courier New"> <span class="yibqv">    </span>)</font> </font> </span> </p> <p class="a" style="margin: 0cm 0cm 0pt;"> <span lang="EN-US"> <font size="2"> <font face="Courier New"> <span class="yibqv">    </span>(CONNECT_DATA =</font> </font> </span> </p> <p class="a" style="margin: 0cm 0cm 0pt;"> <span lang="EN-US"> <font size="2"> <font face="Courier New"> <span class="yibqv">      </span>(SID = wxxrDB)</font> </font> </span> </p> <p class="a" style="margin: 0cm 0cm 0pt;"> <span lang="EN-US"> <font size="2"> <font face="Courier New"> <span class="yibqv">      </span>(SERVER = DEDICATED)</font> </font> </span> </p> <p class="a" style="margin: 0cm 0cm 0pt;"> <span lang="EN-US"> <font size="2"> <font face="Courier New"> <span class="yibqv">    </span>)</font> </font> </span> </p> <p class="a" style="margin: 0cm 0cm 0pt;"> <span lang="EN-US"> <font size="2"> <font face="Courier New"> <span class="yibqv">  </span>)</font> </font> </span> </p> <p class="a" style="margin: 0cm 0cm 0pt;"> <span lang="EN-US"> <o:p> <font size="2" face="Courier New"> </font> </o:p> </span> </p> <p class="a" style="margin: 0cm 0cm 0pt;"> <span lang="EN-US"> <font size="2" face="Courier New">WXXRDB_192.168.4.2 =</font> </span> </p> <p class="a" style="margin: 0cm 0cm 0pt;"> <span lang="EN-US"> <font size="2"> <font face="Courier New"> <span class="yibqv">  </span>(DESCRIPTION =</font> </font> </span> </p> <p class="a" style="margin: 0cm 0cm 0pt;"> <span lang="EN-US"> <font size="2"> <font face="Courier New"> <span class="yibqv">    </span>(ADDRESS_LIST =</font> </font> </span> </p> <p class="a" style="margin: 0cm 0cm 0pt;"> <span lang="EN-US"> <font size="2"> <font face="Courier New"> <span class="yibqv">      </span>(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.4.2)(PORT = 1521))</font> </font> </span> </p> <p class="a" style="margin: 0cm 0cm 0pt;"> <span lang="EN-US"> <font size="2"> <font face="Courier New"> <span class="yibqv">    </span>)</font> </font> </span> </p> <p class="a" style="margin: 0cm 0cm 0pt;"> <span lang="EN-US"> <font size="2"> <font face="Courier New"> <span class="yibqv">    </span>(CONNECT_DATA =</font> </font> </span> </p> <p class="a" style="margin: 0cm 0cm 0pt;"> <span lang="EN-US"> <font size="2"> <font face="Courier New"> <span class="yibqv">      </span>(SID = wxxrDB)</font> </font> </span> </p> <p class="a" style="margin: 0cm 0cm 0pt;"> <span lang="EN-US"> <font size="2"> <font face="Courier New"> <span class="yibqv">      </span>(SERVER = DEDICATED)</font> </font> </span> </p> <p class="a" style="margin: 0cm 0cm 0pt;"> <span lang="EN-US"> <font size="2"> <font face="Courier New"> <span class="yibqv">    </span>)</font> </font> </span> </p> <p class="a" style="margin: 0cm 0cm 0pt;"> <span lang="EN-US"> <font size="2"> <font face="Courier New"> <span class="yibqv">  </span>)</font> </font> </span> </p> </div> <p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 0cm;"> <span lang="EN-US"> <o:p> </o:p> </span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 0cm;"> <span style="font-family: 宋体;">前面都是</span> <span lang="EN-US">Oracle</span> <span style="font-family: 宋体;">的一些知识,不会?/span> <span lang="EN-US">Google</span> <span style="font-family: 宋体;">一下吧。最后配置好后,?/span> <span lang="EN-US">PLSQL Developer</span> <span style="font-family: 宋体;">输入你的用户名和密码联接?/span> <span lang="EN-US">Oracle</span> <span style="font-family: 宋体;">,就?/span> <span lang="EN-US">OK</span> <span style="font-family: 宋体;">了?/span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 0cm;"> <span lang="EN-US"> <o:p> </o:p> </span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 0cm;"> <span style="font-family: 宋体;">参考上?/span> <span lang="EN-US">MySQL</span> <span style="font-family: 宋体;">的步骤,基本一样:</span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 36pt; text-indent: -36pt;"> <span lang="EN-US"> <span class="yibqv">??span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">       </span></span> </span> <span style="font-family: 宋体;">?/span> <span lang="EN-US">jbpm</span> <span style="font-family: 宋体;">改名?/span> <span lang="EN-US">jbpm.3</span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 36pt; text-indent: -36pt;"> <span lang="EN-US"> <span class="yibqv">??span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">       </span></span> </span> <span style="font-family: 宋体;">再执?/span> <span class="Char"> <span style="font-size: 9pt;" lang="EN-US"> <font face="Courier New">ant oracle.scripts</font> </span> </span> </p> <p class="MsoNormal" style="margin: 0cm 0cm 0pt 36pt; text-indent: -36pt;"> <span lang="EN-US"> <span class="yibqv">??span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">       </span></span> </span> <span style="font-family: 宋体;">?/span> <span lang="EN-US">jbpm-db\build\oracle\scripts</span> <span style="font-family: 宋体;">目录?/span> <span lang="EN-US">oracle.create.sql</span> <span style="font-family: 宋体;">脚本,在</span> <span lang="EN-US">Oracle</span> <span style="font-family: 宋体;">中生?/span> <span lang="EN-US">jBPM</span> <span style="font-family: 宋体;">的所有表。在“</span> <span lang="EN-US">PLSQL Developer</span> <span style="font-family: 宋体;">”中可以新建一?/span> <span lang="EN-US">Command Windows</span> <span style="font-family: 宋体;">窗口然后输入命令?/span> <span lang="EN-US">@D:\jbpm-starters-kit-<st1:chsdate isrocdate="False" islunardate="False" day="30" month="12" year="1899" w:st="on">3.1.1</st1:chsdate>\jbpm-db\build\oracle\scripts\oracle.create.sql</span> </p> <img src ="//www.ot7t.com.cn/caizh2009/aggbug/268984.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="//www.ot7t.com.cn/caizh2009/" target="_blank">小菜毛毛</a> 2009-05-05 15:11 <a href="//www.ot7t.com.cn/caizh2009/articles/268984.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>jBPM开发入门指?1)(转?/title><link>//www.ot7t.com.cn/caizh2009/articles/268983.html</link><dc:creator>小菜毛毛</dc:creator><author>小菜毛毛</author><pubDate>Tue, 05 May 2009 07:10:00 GMT</pubDate><guid>//www.ot7t.com.cn/caizh2009/articles/268983.html</guid><wfw:comment>//www.ot7t.com.cn/caizh2009/comments/268983.html</wfw:comment><comments>//www.ot7t.com.cn/caizh2009/articles/268983.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>//www.ot7t.com.cn/caizh2009/comments/commentRss/268983.html</wfw:commentRss><trackback:ping>//www.ot7t.com.cn/caizh2009/services/trackbacks/268983.html</trackback:ping><description><![CDATA[<h2 class="yibqv"> <a id="viewpost1_TitleUrl" href="../../chengang/archive/2006/07/13/57986.html">jBPM开发入门指?1)</a> </h2> <p class="MsoNormal" style="text-indent: 0cm;"> <span style="font-family: 宋体;">工作流虽然还在不成熟的发展阶段,甚至还没有一个公认的规范标准。但其应用却已经在快速展开,这说明市场对工作流框架的需求是急迫而巨大的?/span> </p> <p class="MsoNormal" style="text-indent: 0cm;"> <span style="font-family: 宋体;">我们公司的后台短信管理系统涉及短信编发、领导层层审核等操作,这是一个比较典型的工作流系统。过去我们用的工作流引擎?/span> <span lang="EN-US">shark</span> <span style="font-family: 宋体;">,然后在使用后发现其过于庞大,后台数据库操作频繁而未进行优化,直接导致的后果就是前台操作缓慢。于是经研究决定,将工作流引擎由</span> <span lang="EN-US">shark</span> <span style="font-family: 宋体;">换成</span> <span lang="EN-US">jBPM</span> <span style="font-family: 宋体;">?/span> </p> <p class="MsoNormal" style="text-indent: 0cm;"> <span lang="EN-US">jBPM</span> <span style="font-family: 宋体;">之前是一个开源软件,后加?/span> <span lang="EN-US">JBoss</span> <span style="font-family: 宋体;">组织。正好我们公司也是用</span> <span lang="EN-US">JBoss</span> <span style="font-family: 宋体;">的。不?/span> <span lang="EN-US">jBPM</span> <span style="font-family: 宋体;">并没有绑定在</span> <span lang="EN-US">JBOSS</span> <span style="font-family: 宋体;">上,</span> <span lang="EN-US">Tomcat</span> <span style="font-family: 宋体;">等也可以使用它?/span> </p> <p class="MsoNormal" style="text-indent: 0cm;"> <span lang="EN-US">jBPM</span> <span style="font-family: 宋体;">的正处在不断发展中,做为开源软件的特点,其设计变化往往很大。所以一些过去的资料可能已经不适用了。于是作者根据自己的使用经验,重新整理出这份文,以备学习参考?/span> </p> <p class="MsoNormal" style="text-indent: 0cm;"> <span style="font-family: 楷体_GB2312;">注:本文使用?/span> <span lang="EN-US">jBPM</span> <span style="font-family: 楷体_GB2312;">版本?/span> <span lang="EN-US">3.1.1</span> </p> <h2 class="yibqv"> <span style="font-family: 黑体;">环境准备</span> </h2> <h3> <span lang="EN-US">1</span>、安?span lang="EN-US">JDK</span></h3> <p class="MsoNormal"> <span style="font-family: 宋体;">所?/span> <span lang="EN-US">JAVA</span> <span style="font-family: 宋体;">开发第一个需要安装的,没什么好说的。记得把系统变量</span> <span lang="EN-US">JAVA_HOME</span> <span style="font-family: 宋体;">设上?/span> </p> <h3> <span lang="EN-US">2</span>、安?span lang="EN-US">Ant</span></h3> <p class="MsoNormal" style="text-indent: 0cm;"> <span lang="EN-US">Ant</span> <span style="font-family: 宋体;">是使?/span> <span lang="EN-US">jBPM</span> <span style="font-family: 宋体;">必须的一个工具?/span> <span lang="EN-US">jBPM</span> <span style="font-family: 宋体;">中的很多操作都要用到</span> <span lang="EN-US">Ant</span> <span style="font-family: 宋体;">?/span> </p> <p class="MsoNormal" style="text-indent: 0cm;"> <span style="font-family: 宋体;">安装方法?/span> </p> <p class="MsoNormal" style="text-indent: 0cm;"> <span style="font-family: 宋体;">?/span> <span lang="EN-US">1</span> <span style="font-family: 宋体;">)先下载?/span> <span lang="EN-US"> <a >//archive.apache.org/dist/ant/binaries/</a> </span> <span style="font-family: 宋体;">,选一个如?/span> <span lang="EN-US">apache-ant-1.6.5-bin.zip</span> <span style="font-family: 宋体;">?/span> </p> <p class="MsoNormal" style="text-indent: 0cm;"> <span style="font-family: 宋体;">?/span> <span lang="EN-US">2</span> <span style="font-family: 宋体;">)解压到</span> <span lang="EN-US">D:\ant</span> <span style="font-family: 宋体;">(当然其他目录也可以)?/span> </p> <p class="MsoNormal" style="text-indent: 0cm;"> <span style="font-family: 宋体;">?/span> <span lang="EN-US">3</span> <span style="font-family: 宋体;">)设置如下系统变量:</span> <span lang="EN-US">ANT_HOME=d:\ant</span> <span style="font-family: 宋体;">?/span> </p> <p class="MsoNormal" style="text-indent: 0cm;"> <span style="font-family: 宋体;">?/span> <span lang="EN-US">4</span> <span style="font-family: 宋体;">)把</span> <span lang="EN-US">%ANT_HOME%\bin</span> <span style="font-family: 宋体;">加入到系统变?/span> <span lang="EN-US">PATH</span> <span style="font-family: 宋体;">中?/span> </p> <h3> <span lang="EN-US">3</span>、安?span lang="EN-US">Eclipse</span></h3> <p class="MsoNormal" style="text-indent: 0cm;"> <span lang="EN-US">Eclipse</span> <span style="font-family: 宋体;">不是开?/span> <span lang="EN-US">jBPM</span> <span style="font-family: 宋体;">必须的工具,但它是对</span> <span lang="EN-US">jBPM</span> <span style="font-family: 宋体;">开发很有帮助的工具,特别是</span> <span lang="EN-US">jBPM</span> <span style="font-family: 宋体;">提供了一?/span> <span lang="EN-US">Eclipse</span> <span style="font-family: 宋体;">插件用来辅助开?/span> <span lang="EN-US">jBPM</span> <span style="font-family: 宋体;">。关?/span> <span lang="EN-US">Eclipse</span> <span style="font-family: 宋体;">的安装不赘述了,本文用的版本是:</span> <span lang="EN-US">Eclipse3.2</span> </p> <p class="MsoNormal" style="text-indent: 0cm;"> <span lang="EN-US"> </span> </p> <h2 class="yibqv"> <span style="font-family: 黑体;">安装</span> <span lang="EN-US">jBPM</span> </h2> <p class="MsoNormal" style="text-indent: 0cm;"> <span lang="EN-US">jBPM</span> <span style="font-family: 宋体;">的下载地址?/span> <span lang="EN-US"> <a >//www.jboss.com/products/jbpm/downloads</a> </span> <span style="font-family: 宋体;"> </span> </p> <p class="a1"> <span style="font-size: 7.5pt; font-family: Wingdings;" lang="EN-US">l<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">           </span></span> <span lang="EN-US">JBoss jBPM</span> <span style="font-family: 宋体;">?/span> <span lang="EN-US">jBPM</span> <span style="font-family: 宋体;">的软件包</span> </p> <p class="a1"> <span style="font-size: 7.5pt; font-family: Wingdings;" lang="EN-US">l<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">           </span></span> <span lang="EN-US">JBoss jBPM Starters Kit</span> <span style="font-family: 宋体;"> 是一个综合包,它包括?/span> <span lang="EN-US">jBPM</span> <span style="font-family: 宋体;">软件包、开发插件、一个配置好了的基于</span> <span lang="EN-US">JBoss</span> <span style="font-family: 宋体;">?/span> <span lang="EN-US">jBPM</span> <span style="font-family: 宋体;">示例、一些数据库配置文件示例?/span> </p> <p class="a1"> <span style="font-size: 7.5pt; font-family: Wingdings;" lang="EN-US">l<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">           </span></span> <span lang="EN-US">JBoss jBPM Process Designer Plugin</span> <span style="font-family: 宋体;"> 是辅助开?/span> <span lang="EN-US">jBPM</span> <span style="font-family: 宋体;">?/span> <span lang="EN-US">Eclipse</span> <span style="font-family: 宋体;">插件?/span> </p> <p class="a1"> <span style="font-size: 7.5pt; font-family: Wingdings;" lang="EN-US">l<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">           </span></span> <span lang="EN-US">JBoss jBPM BPEL Extension jBPM</span> <span style="font-family: 宋体;">关于</span> <span lang="EN-US">BPEL</span> <span style="font-family: 宋体;">的扩展包</span> </p> <p class="a1"> <span style="font-family: 宋体;">本指南选择下载?/span> <span lang="EN-US">JBoss jBPM Starters Kit</span> <span style="font-family: 宋体;">。下载后解压?/span> <span lang="EN-US">D:\jbpm-starters-kit-3.1</span> <span style="font-family: 宋体;">,目录下含有五个子目录:</span> </p> <p class="a1"> <span style="font-size: 7.5pt; font-family: Wingdings;" lang="EN-US">l<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">           </span></span> <span lang="EN-US">jbpm</span> <span style="font-family: 宋体;"> </span> <span lang="EN-US">jBPM</span> <span style="font-family: 宋体;">的软件包</span> </p> <p class="a1"> <span style="font-size: 7.5pt; font-family: Wingdings;" lang="EN-US">l<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">           </span></span> <span lang="EN-US">jbpm-bpel </span> <span style="font-family: 宋体;">只含有一个网?/span> </p> <p class="a1"> <span style="font-size: 7.5pt; font-family: Wingdings;" lang="EN-US">l<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">           </span></span> <span lang="EN-US">jbpm-db </span> <span style="font-family: 宋体;">各种数据?/span> <span lang="EN-US">hibernate</span> <span style="font-family: 宋体;">配置文件示例,有些还包含了相应的</span> <span lang="EN-US">jdbc</span> <span style="font-family: 宋体;">驱动程序?/span> </p> <p class="a1"> <span style="font-size: 7.5pt; font-family: Wingdings;" lang="EN-US">l<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">           </span></span> <span lang="EN-US">jbpm-designer</span> <span style="font-family: 宋体;"> 辅助开?/span> <span lang="EN-US">jBPM</span> <span style="font-family: 宋体;">?/span> <span lang="EN-US">Eclipse</span> <span style="font-family: 宋体;">插件,具体在</span> <span lang="EN-US">jbpm-gpd-feature</span> <span style="font-family: 宋体;">子目录中</span> </p> <p class="a1"> <span style="font-size: 7.5pt; font-family: Wingdings;" lang="EN-US">l<span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">           </span></span> <span lang="EN-US">jbpm-server</span> <span style="font-family: 宋体;"> 一个已经配置好了的基于</span> <span lang="EN-US">JBoss</span> <span style="font-family: 宋体;">?/span> <span lang="EN-US">jBPM</span> <span style="font-family: 宋体;">示例</span> <span lang="EN-US">.</span> </p> <p class="MsoNormal" style="text-indent: 0cm;"> <span lang="EN-US"> </span> </p> <h2 class="yibqv"> <span style="font-family: 黑体;">感觉下工作流</span> </h2> <p class="MsoNormal" style="text-indent: 0cm;"> <span style="font-family: 宋体;">前面我们说了,在</span> <span lang="EN-US">JBoss jBPM Starters Kit</span> <span style="font-family: 宋体;">?/span> <span lang="EN-US">jbpm-server</span> <span style="font-family: 宋体;">目录是一个已经配置好的了</span> <span lang="EN-US">jBPM</span> <span style="font-family: 宋体;">示例,那么让我们来感觉一?/span> <span lang="EN-US">jBPM</span> <span style="font-family: 宋体;">做出的东西吧?/span> </p> <p class="MsoNormal" style="text-indent: 0cm;"> <span lang="EN-US"> </span> </p> <p class="MsoNormal" style="text-indent: 0cm;"> <span style="font-family: 宋体;">双击</span> <span lang="EN-US">jbpm-server</span> <span style="font-family: 宋体;">目录下的</span> <span lang="EN-US">start.bat</span> <span style="font-family: 宋体;">文件,启?/span> <span lang="EN-US">JBoss</span> <span style="font-family: 宋体;">服务。这时会打开一?/span> <span lang="EN-US">DOS</span> <span style="font-family: 宋体;">窗口,启动完成后,日志会不断输出,其中最后一句是“</span> <span lang="EN-US">13:55:39,937 DEBUG [StaticNotifier] going to wait for (CMD_EXECUTOR, java.lang.Object@1df59bd)</span> <span style="font-family: 宋体;">”,这表示</span> <span lang="EN-US">jBPM</span> <span style="font-family: 宋体;">在开始工作了,它不断进行轮询?/span> </p> <p class="MsoNormal" style="text-indent: 0cm;"> <span style="font-family: 宋体;">打开网页?/span> <span lang="EN-US"> <a href="//localhost:8080/jbpm/">//localhost:8080/jbpm/</a> </span> <span style="font-family: 宋体;"> 得到如下画面</span> </p> <p class="MsoNormal" style="text-indent: 0cm;"> <span lang="EN-US"> <img alt="20060713_image001.jpg" src="../../images/blogjava_net/chengang/jbpm/20060713_image001.jpg" border="0" width="554" height="191" /></span> </p> <p class="MsoNormal" style="text-indent: 0cm;"> <span style="font-family: 宋体;">这是一个已经用</span> <span lang="EN-US">jBPM</span> <span style="font-family: 宋体;">开发好的用户定单流程,具有下单、审核、估价等流程。它所用的数据库是一个内置的数据库?/span> </p> <p class="MsoNormal" style="text-indent: 0cm;"> <span style="font-family: 宋体;">?/span> <span lang="EN-US">cookie monster</span> <span style="font-family: 宋体;">用户登录,选择“</span> <span lang="EN-US">create new web sale order</span> <span style="font-family: 宋体;">”可以创建一个定单。如下图所示,在图左边是填写的定单情况,右边一整个定货流程的示意图,红色框表示流程进行到哪一步了。填写好定单好,选择“</span> <span lang="EN-US">Save and Close Task</span> <span style="font-family: 宋体;">”,完成定单提交?/span> </p> <p class="MsoNormal" style="text-indent: 0cm;"> <span lang="EN-US"> <img alt="20060713_image002.jpg" src="../../images/blogjava_net/chengang/jbpm/20060713_image002.jpg" border="0" width="553" height="326" /></span> </p> <p class="MsoNormal" style="text-indent: 0cm;"> <span style="font-family: 宋体;">选择右上角的“</span> <span lang="EN-US">Login as another user</span> <span style="font-family: 宋体;">”以另外一个用户名</span> <span lang="EN-US">ernie</span> <span style="font-family: 宋体;">登录。这时可以看?/span> <span lang="EN-US">ernie</span> <span style="font-family: 宋体;">用户的任务列表中多了一项?/span> </p> <p class="MsoNormal" style="text-indent: 0cm;"> <span lang="EN-US"> <img alt="20060713_image003.jpg" src="../../images/blogjava_net/chengang/jbpm/20060713_image003.jpg" border="0" width="489" height="302" /></span> </p> <p class="MsoNormal" style="text-indent: 0cm;"> <span style="font-family: 宋体;">点进去后,显示如下画面。这个示例对中文的支持不好,全都显示成了</span> <span lang="EN-US">unicode</span> <span style="font-family: 宋体;">码了。不管这什么多,反正知道是这么回事就行了。在</span> <span lang="EN-US">comment</span> <span style="font-family: 宋体;">项填写意见,?/span> <span lang="EN-US">OK</span> <span style="font-family: 宋体;">按钮,进入到下一步。如果选择</span> <span lang="EN-US">more info needed</span> <span style="font-family: 宋体;">按钮,则打回?/span> <span lang="EN-US">cookie monster</span> <span style="font-family: 宋体;">用户修改定单?/span> </p> <p class="MsoNormal" style="text-indent: 0cm;"> <span lang="EN-US"> <img alt="20060713_image004.jpg" src="../../images/blogjava_net/chengang/jbpm/20060713_image004.jpg" border="0" width="553" height="271" /></span> </p> <p class="MsoNormal" style="text-indent: 0cm;"> <span style="font-family: 宋体;">下面的流程,这里就不再赘述了。在这个很标准的工作流示例中,我们基本可以看?/span> <span lang="EN-US">jBPM</span> <span style="font-family: 宋体;">的应用范围还是比较广的。而且从这个示例,我们是看不出?/span> <span lang="EN-US">jBPM</span> <span style="font-family: 宋体;">的,也就是说</span> <span lang="EN-US">jBPM</span> <span style="font-family: 宋体;">在后台起着作用?/span> </p> <p class="MsoNormal" style="text-indent: 0cm;"> <span style="font-family: 宋体;">从这个例子,还看不出</span> <span lang="EN-US">jBPM</span> <span style="font-family: 宋体;">的优势。不过,如果在一个流程不确定,经常需要变动的项目中,</span> <span lang="EN-US">jBPM</span> <span style="font-family: 宋体;">的好处将会显然出来。应?/span> <span lang="EN-US">jBPM</span> <span style="font-family: 宋体;">后,改变流程只需改变流程描述文件,这将在后面的内容提到?/span> </p> <span style="font-family: 宋体;">这是一个已做好的示例,接下来我们将仿造这个实例来开发一个请假流程?/span> <img src ="//www.ot7t.com.cn/caizh2009/aggbug/268983.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="//www.ot7t.com.cn/caizh2009/" target="_blank">小菜毛毛</a> 2009-05-05 15:10 <a href="//www.ot7t.com.cn/caizh2009/articles/268983.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>jBPM(一): 开场白, 想从jBMP中学点什?(转?/title><link>//www.ot7t.com.cn/caizh2009/articles/268981.html</link><dc:creator>小菜毛毛</dc:creator><author>小菜毛毛</author><pubDate>Tue, 05 May 2009 07:09:00 GMT</pubDate><guid>//www.ot7t.com.cn/caizh2009/articles/268981.html</guid><wfw:comment>//www.ot7t.com.cn/caizh2009/comments/268981.html</wfw:comment><comments>//www.ot7t.com.cn/caizh2009/articles/268981.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>//www.ot7t.com.cn/caizh2009/comments/commentRss/268981.html</wfw:commentRss><trackback:ping>//www.ot7t.com.cn/caizh2009/services/trackbacks/268981.html</trackback:ping><description><![CDATA[<div class="article_title"> <h1 class="yibqv">jBPM(一): 开场白, 想从jBMP中学点什?</h1> <div class="title_bottom"> </div> <p><a >豆豆?/a>   <a >技术应用频?/a>   2009?4?6?  【字号:<a href="javascript:SetFont('12px');">?/a> <a href="javascript:SetFont('14px');">?/a> <a href="javascript:SetFont('16px');">?/a>?<a href="javascript:window.external.AddFavorite(this.location.href,%20this.document.title)">收藏本文</a></p> </div> <div class="title_bottom_cpr"> <a target="_blank"><img style="display: none;" src="//ad.ddvip.com/net46860.gif" border="0" alt="" /></a> </div> <!--id="929"--> <div class="searchhot">关键字: <a target="_blank">Ultimus</a> <a target="_blank">BPM</a> <a target="_blank">MOSS</a> <a target="_blank">Tracking</a> <a target="_blank">W</a> </div> <div class="article_z"> <h2 class="yibqv"> jBPM(一): 开场白, 想从jBMP中学点什?? </h2> </div> <div class="article_ad"> </div> <div id="clickeye_content"> <div class="article_c" id="fontsize"> <p>  跟刚开始写Acegi一? 还是有些担心? 网上差不多的博客或帖子很多了, 自己为什么还写呢? 说服自己下决心写的理由如?</p> <p>  1, 别人写是别人? 只看他们写的不能解决自己的长远问?</p> <p>  2, 有些博客/帖子写的不够详细, 自己在照着做时,大多都不能成?</p> <p><clk> 3, 以这个系列为一个根据地,把自?nobr id="clickeyekey2" style="border-bottom: 1px dotted #6600ff; text-decoration: underline; color: #6600ff; background-color: transparent;" onclick='kwC(event,2,"")' oncontextmenu="return false" onmouseover="kwE(event,2, this)" onmouseout="kwL(event,this)" onmousemove="kwM(2)">学习</nobr>使用研究jBPM的心得经验记下来.</clk></p> <p> 既然下决心要写了, 先列下要用的工具: JDK(6.0), Ant(1.7.1), Eclipse(3.4.0), Tomcat(6.0.18),Mysql(5.0), jBPM(版本?.1.4, 下载链接: //nchc.dl.sourceforge.net/sourceforge/jbpm/jbpm-starters-kit-3.1.4.zip).</p> <p>  近期的一些计?</p> <p>  0, jBPM的一些简单介?</p> <p><clk> 1, 往Mysql数据库里生成jBPM? 搭建Eclipse<nobr id="clickeyekey1" style="border-bottom: 1px dotted #6600ff; text-decoration: underline; color: #6600ff; background-color: transparent;" onclick='kwC(event,1,"")' oncontextmenu="return false" onmouseover="kwE(event,1, this)" onmouseout="kwL(event,this)" onmousemove="kwM(1)">环境</nobr>.</clk></p> <p>  2, 把自带的例子部署到Tomcat+Mysql,结合源码, 以像跟踪自写程序那样地一步步跟踪那个例子的执?</p> <p>  3, 结合跟踪自带例子心得, 梳理jBPM骨架.</p> <p>  4, 重点关注Hibernate的应?</p> <p>  从jBMP想学什?</p> <p>  1, 了解,学习jBPM的运行机? 以提高自己工作中用jBMP的效?</p> <p><clk> 2, 以这个jBMP为例? 研究学习其对Hibernate的综合使?以弥补现?nobr id="clickeyekey0" style="border-bottom: 1px dotted #6600ff; text-decoration: underline; color: #6600ff; background-color: transparent;" onclick='kwC(event,0,"")' oncontextmenu="return false" onmouseover="kwE(event,0, this)" onmouseout="kwL(event,this)" onmousemove="kwM(0)">项目</nobr>中运用Hibernate的不?</clk></p> <p>  3, 深入学习体会jBPM所体现再来的软件工? 建模.</p> <p>  系列文章?/p> <p>  <a target="_blank">jBPM(?: 一点简单介?/a></p> <p>  <a target="_blank">jBPM(?: 如何在Eclipse搭建jBPM环境?</a></p> <p>  <a target="_blank">jBPM(?: 部署jBPM所用表到数据库_1</a></p> <p>  <a target="_blank">jBPM(?: 部署jBPM所用表到数据库_2</a></p> <p>  <a target="_blank">jBPM(?: 由手动建表想到一个教?/a></p> <p>  <a target="_blank">jBPM(?: 如何让jBPM自带例子运行在指定数据库?</a></p> <p>  <a target="_blank">jBPM(?: 也说jBPM + Tomcat + MySQL</a></p> <p>  <a target="_blank">jBPM(?:jBPM的webSale在Tomcat下怎么连上的数据库?</a></p> <p>  <a target="_blank">jBPM(?:webSale?页面?介绍</a></p> <p>  <a target="_blank">jBPM(十一): 从JbpmContextFilter说起</a></p> <p>  <a target="_blank">jBPM(十二): 流程运行的历史和轨迹与ProcessLog</a></p> <p>  <a target="_blank">jBPM(十三): 从ObjectFactory到ObjectInfo</a></p> <p>  <a target="_blank">jBPM(十四): 见证一ObjectInfo实例的诞?/a></p> <p>  <a target="_blank">jBPM(十五):配置文件到ObjectFactory</a></p> <p>  <a target="_blank">jBPM(十六): 记录JbpmContext实例的诞?/a></p> </div> </div> <img src ="//www.ot7t.com.cn/caizh2009/aggbug/268981.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="//www.ot7t.com.cn/caizh2009/" target="_blank">小菜毛毛</a> 2009-05-05 15:09 <a href="//www.ot7t.com.cn/caizh2009/articles/268981.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>工作流与JBPM开发实例精解(二)(转?/title><link>//www.ot7t.com.cn/caizh2009/articles/268980.html</link><dc:creator>小菜毛毛</dc:creator><author>小菜毛毛</author><pubDate>Tue, 05 May 2009 07:05:00 GMT</pubDate><guid>//www.ot7t.com.cn/caizh2009/articles/268980.html</guid><wfw:comment>//www.ot7t.com.cn/caizh2009/comments/268980.html</wfw:comment><comments>//www.ot7t.com.cn/caizh2009/articles/268980.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>//www.ot7t.com.cn/caizh2009/comments/commentRss/268980.html</wfw:commentRss><trackback:ping>//www.ot7t.com.cn/caizh2009/services/trackbacks/268980.html</trackback:ping><description><![CDATA[<br /> <br />     首先当你想学一个框架的时候一定是你要有项目来用他了,OK,那么你项目当中的流程是什么你应该清楚吧,那么当你清楚了这些的时候我们就开始我们这个最简单的例子吧? <br /> <br />     假如我们现在有这么一个例子,公司员工想报销点出差费,那么他要将他的申请提交给他的第一级领导——部门主管去审批,然后部门主管审批完了之后还要交给这个部门主管的上级公司老总进行审批。那么针对这个简单的流程,我们应该从哪里下手呢? <br /> <br />     首先第一件事情就是写流程定义文件,那么这个文件我们用什么来写呢,他就是一个符合某个语法的xml文件,幸运的?span class="hilite1">jbpm</span>给我们提供了一个集成的开发环境让我们来用? <br /> <br />     首先去官网上下一?span class="hilite1">jbpm</span>-jpdl-suite-3.2.GA包,解压 后你会发现他里面有一个designer文件夹,那个里面就是我们写流程定义文件的开发环境,他是一个eclipse的插件,但是好像他给我们的那? eclipse版本有问题,建议大家从新下一个eclipse-SDK-3.2.1-win32.zip这个版本的eclipse,然后覆盖他给我们提? 的那个? <br /> <br />     准备工作做完了,那么我们就开始吧,首先我们打开解压目录下的designer文件夹中的designer.bat文件,他弹出一个eclipse,然后我们就用这个东西来开发我们的流程定义文件了? <br /> <br />     打开之后你就会看见一个他的小例子,不过我们不去用他,我们自己新建一个工程。右?new-other-jBoss <span class="hilite1">jbpm</span>-process project。这个时候你会看见他弹出一个对话框,输入你的工程名字,然后点击next,这个时候你会发现他已经?span class="hilite1">jbpm</span>加载进去了,记住要选中Generate simple ......? <br /> <br />     工程建立完了,我们开始建立我们的流程定义文件。在工程里面你会发现src/main/jpdl这个source folder,然后你会看见他里面已经有了一个流程定义文件了,但是我们不去用他的,我们自己建立一个,右键src/main/jpdl,然后new- other-jBoss <span class="hilite1">jbpm</span>-process definition。这个时候他就会弹出一个对话框,起一个你要写的流程定义文件的名字输入进去,OK,可以了。这个时候你打开你建立的那个文件夹,里面就有processdefinition.xml文件,ok,打开他? <br /> <br />     在右面的图里面你就可以看到一张什么都没有的白纸,我们看看这部分左面的那些东西,什么start啊,end啊,tasknode啊,fork 啊,join啊。那我们来解释一下这是个什么东西呢,我们看看我们的需求,员工要写一个报销单,然后交给部门主管来处理,那么部门主管就应该算是一? tasknode,他就是一个任务节点。start和end其实就是一个虚状态,当我们写完报销单的时候我们就提交了,这个时候他就到了第一? tasknode这个节点了。然后他审批完了还要交给总经理审批,那么他又是一个tasknode,然后总经理审批完了结束,ok,是一个end? <br /> <br />     start--》tasknode(部门主管审批)--》tasknode(总经理审批)--》end? <br /> <br />     如果觉得看的有点模糊可以看看我传上来的那个图。然后你在这个试图框的下面可以看到有个source,点击一下,就会发现他已经自动的给你生成xml代码 了。但是这样还是有点不够,我们只是定义了一个tasknode节点,并没有定义tasknode节点的任务由谁来做。那么我们还要定义一? tasknode节点是由谁来做的? <br />     那么这段代码是这么写的: <br /> <br /> <div class="dp-highlighter"> <div class="bar"> <div class="tools">Java代码 <a style="left: 64px ! important; top: -4px ! important;" title="点击这里?Adblock Plus 过滤该对? class="abp-objtab-09397903547059967 visible ontop" ></a><embed tplayername="other" splayername="SWF" id="Player1241496372424" type="application/x-shockwave-flash" src="//www.javaeye.com/javascripts/syntaxhighlighter/clipboard_new.swf" mediawrapchecked="true" flashvars="clipboard=%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%3F%3E%0A%0A%3Cprocess-definition%0A%20%20xmlns%3D%22%22%20%20name%3D%22test1%22%3E%0A%20%20%20%3Cstart-state%20name%3D%22start%22%3E%0A%20%20%20%20%20%20%3Ctransition%20name%3D%22%22%20to%3D%22%E9%83%A8%E9%97%A8%E7%BB%8F%E7%90%86%E5%AE%A1%E6%89%B9%22%3E%3C%2Ftransition%3E%0A%20%20%20%3C%2Fstart-state%3E%0A%20%20%20%3Ctask-node%20name%3D%22%E9%83%A8%E9%97%A8%E7%BB%8F%E7%90%86%E5%AE%A1%E6%89%B9%22%3E%0A%20%20%20%20%20%20%3Ctask%3E%0A%20%20%20%20%20%20%09%3Cassigment%20actorId%3D%22%E9%83%A8%E9%97%A8%E7%BB%8F%E7%90%86%22%3E%3C%2Fassigment%3E%0A%20%20%20%20%20%20%3C%2Ftask%3E%0A%20%20%20%20%20%20%3Ctransition%20name%3D%22%22%20to%3D%22%E6%80%BB%E7%BB%8F%E7%90%86%E5%AE%A1%E6%89%B9%22%3E%3C%2Ftransition%3E%0A%20%20%20%3C%2Ftask-node%3E%0A%20%20%20%3Ctask-node%20name%3D%22%E6%80%BB%E7%BB%8F%E7%90%86%E5%AE%A1%E6%89%B9%22%3E%0A%20%20%20%20%20%20%3Ctask%3E%0A%20%20%20%20%20%20%09%3Cassigment%20actorId%3D%22%E6%80%BB%E7%BB%8F%E7%90%86%22%3E%3C%2Fassigment%3E%0A%20%20%20%20%20%20%3C%2Ftask%3E%0A%20%20%20%20%20%20%3Ctransition%20name%3D%22%22%20to%3D%22end1%22%3E%3C%2Ftransition%3E%0A%20%20%20%3C%2Ftask-node%3E%0A%20%20%20%3Cend-state%20name%3D%22end1%22%3E%3C%2Fend-state%3E%0A%3C%2Fprocess-definition%3E" quality="high" allowscriptaccess="always" pluginspage="//www.macromedia.com/go/getflashplayer" width="14" height="0"></div> </div> <ol class="dp-j" start="1"> <li class="yibqv"><span class="yibqv"><span class="yibqv"><?xml version=</span><span class="string">"1.0"</span><span class="yibqv"> encoding=</span><span class="string">"UTF-8"</span><span class="yibqv">?>  </span></span></li> <li class="yibqv"><span class="yibqv">  </span></li> <li class="yibqv"><span class="yibqv"><process-definition  </span></li> <li class="yibqv"><span class="yibqv">  xmlns=<span class="string">""</span><span class="yibqv">  name=</span><span class="string">"test1"</span><span class="yibqv">>  </span></span></li> <li class="yibqv"><span class="yibqv">   <start-state name=<span class="string">"start"</span><span class="yibqv">>  </span></span></li> <li class="yibqv"><span class="yibqv">      <transition name=<span class="string">""</span><span class="yibqv"> to=</span><span class="string">"部门经理审批"</span><span class="yibqv">></transition>  </span></span></li> <li class="yibqv"><span class="yibqv">   </start-state>  </span></li> <li class="yibqv"><span class="yibqv">   <task-node name=<span class="string">"部门经理审批"</span><span class="yibqv">>  </span></span></li> <li class="yibqv"><span class="yibqv">      <task>  </span></li> <li class="yibqv"><span class="yibqv">        <assigment actorId=<span class="string">"部门经理"</span><span class="yibqv">></assigment>  </span></span></li> <li class="yibqv"><span class="yibqv">      </task>  </span></li> <li class="yibqv"><span class="yibqv">      <transition name=<span class="string">""</span><span class="yibqv"> to=</span><span class="string">"总经理审?</span><span class="yibqv">></transition>  </span></span></li> <li class="yibqv"><span class="yibqv">   </task-node>  </span></li> <li class="yibqv"><span class="yibqv">   <task-node name=<span class="string">"总经理审?</span><span class="yibqv">>  </span></span></li> <li class="yibqv"><span class="yibqv">      <task>  </span></li> <li class="yibqv"><span class="yibqv">        <assigment actorId=<span class="string">"总经?</span><span class="yibqv">></assigment>  </span></span></li> <li class="yibqv"><span class="yibqv">      </task>  </span></li> <li class="yibqv"><span class="yibqv">      <transition name=<span class="string">""</span><span class="yibqv"> to=</span><span class="string">"end1"</span><span class="yibqv">></transition>  </span></span></li> <li class="yibqv"><span class="yibqv">   </task-node>  </span></li> <li class="yibqv"><span class="yibqv">   <end-state name=<span class="string">"end1"</span><span class="yibqv">></end-state>  </span></span></li> <li class="yibqv"><span class="yibqv"></process-definition>  </span></li> </ol> </div> <pre style="display: none;" name="code" class="java"><?xml version="1.0" encoding="UTF-8"?> <process-definition xmlns="" name="test1"> <start-state name="start"> <transition name="" to="部门经理审批"></transition> </start-state> <task-node name="部门经理审批"> <task> <assigment actorId="部门经理"></assigment> </task> <transition name="" to="总经理审?></transition> </task-node> <task-node name="总经理审?> <task> <assigment actorId="总经?></assigment> </task> <transition name="" to="end1"></transition> </task-node> <end-state name="end1"></end-state> </process-definition></pre> <br />     这样的话我们的流程定义文件就定义完了,但是这只是把文件定义完了,系统并不知道啊,所以我们还要把我们的文件部署到系统中去,那么这个过程是这样的: <br /> <br />     首先我们在src/main/java里面新建立一个包,然后建立一个class,随便起个名字,就叫TestJBPM_01吧,那么在这个类里面我们要做的是什么呢?我们要先导入表,因?span class="hilite1">jbpm</span>要运行就要用到很多个表,ok,那么我们这个里面导入表和hibernate导入表是差不多的,它的代码是这样的: <br /> <div class="dp-highlighter"> <div class="bar"> <div class="tools">Java代码 <a style="left: 64px ! important; top: -4px ! important;" title="点击这里?Adblock Plus 过滤该对? class="abp-objtab-09397903547059967 visible ontop" ></a><embed tplayername="other" splayername="SWF" id="Player1241496372468" type="application/x-shockwave-flash" src="//www.javaeye.com/javascripts/syntaxhighlighter/clipboard_new.swf" mediawrapchecked="true" flashvars="clipboard=package%20com.jbpm.test%3B%0A%0Aimport%20junit.framework.TestCase%3B%0A%0Aimport%20org.jbpm.JbpmConfiguration%3B%0A%0Apublic%20class%20TestJbpm_01%20extends%20TestCase%20%7B%0A%09%0A%09public%20void%20testJbpm()%7B%0A%09%09%0A%09%09%2F%2F%E5%88%9B%E5%BB%BAjbpm%E6%95%B0%E6%8D%AE%E5%BA%93%E8%A1%A8%E3%80%82%E4%BB%96%E5%B0%B1%E5%83%8Fhibernate%E9%87%8C%E9%9D%A2%E7%9A%84%E5%93%AA%E4%B8%AAexport%E4%B8%80%E6%A0%B7%E3%80%82%E5%AE%9E%E9%99%85%E4%B8%8A%E4%BB%96%E5%B0%B1%E6%98%AFhibernate%E9%87%8C%E9%9D%A2%E7%9A%84%E5%93%AA%E4%B8%AAexport%E3%80%82%0A%09%09%2F%2F%E5%BA%94%E4%B8%BA%E4%BB%96%E6%98%A0%E5%B0%84%E4%BA%86%E5%BE%88%E5%A4%9A%E4%B8%AA%E8%A1%A8%EF%BC%8C%E6%89%80%E4%BB%A5%E6%88%91%E4%BB%AC%E5%B0%B1%E8%83%BD%E5%88%9B%E5%BB%BA%E9%82%A3%E4%B9%88%E5%A4%9A%E4%B8%AA%E8%A1%A8%E3%80%82%0A%09%09JbpmConfiguration.getInstance().createSchema()%3B%0A%09%09%0A%09%7D%0A%7D" quality="high" allowscriptaccess="always" pluginspage="//www.macromedia.com/go/getflashplayer" width="14" height="0"></div> </div> <ol class="dp-j" start="1"> <li class="yibqv"><span class="yibqv"><span class="keyword">package</span><span class="yibqv"> com.<span class="hilite1">jbpm</span>.test;  </span></span></li> <li class="yibqv"><span class="yibqv">  </span></li> <li class="yibqv"><span class="yibqv"><span class="keyword">import</span><span class="yibqv"> junit.framework.TestCase;  </span></span></li> <li class="yibqv"><span class="yibqv">  </span></li> <li class="yibqv"><span class="yibqv"><span class="keyword">import</span><span class="yibqv"> org.<span class="hilite1">jbpm</span>.JbpmConfiguration;  </span></span></li> <li class="yibqv"><span class="yibqv">  </span></li> <li class="yibqv"><span class="yibqv"><span class="keyword">public</span><span class="yibqv"> </span><span class="keyword">class</span><span class="yibqv"> TestJbpm_01 </span><span class="keyword">extends</span><span class="yibqv"> TestCase {  </span></span></li> <li class="yibqv"><span class="yibqv">      </span></li> <li class="yibqv"><span class="yibqv">    <span class="keyword">public</span><span class="yibqv"> </span><span class="keyword">void</span><span class="yibqv"> testJbpm(){  </span></span></li> <li class="yibqv"><span class="yibqv">          </span></li> <li class="yibqv"><span class="yibqv">        <span class="comment">//创建<span class="hilite1">jbpm</span>数据库表。他就像hibernate里面的哪个export一样。实际上他就是hibernate里面的哪个export?/span><span class="yibqv">  </span></span></li> <li class="yibqv"><span class="yibqv">        <span class="comment">//应为他映射了很多个表,所以我们就能创建那么多个表?/span><span class="yibqv">  </span></span></li> <li class="yibqv"><span class="yibqv">        JbpmConfiguration.getInstance().createSchema();  </span></li> <li class="yibqv"><span class="yibqv">          </span></li> <li class="yibqv"><span class="yibqv">    }  </span></li> <li class="yibqv"><span class="yibqv">}  </span></li> </ol> </div> <pre style="display: none;" name="code" class="java">package com.<span class="hilite1">jbpm</span>.test; import junit.framework.TestCase; import org.<span class="hilite1">jbpm</span>.JbpmConfiguration; public class TestJbpm_01 extends TestCase { public void testJbpm(){ //创建<span class="hilite1">jbpm</span>数据库表。他就像hibernate里面的哪个export一样。实际上他就是hibernate里面的哪个export? //应为他映射了很多个表,所以我们就能创建那么多个表? JbpmConfiguration.getInstance().createSchema(); } }</pre> <br /> 然后呢我们就开始部署我们的流程定义文件,我们将这个文件当中的内容呢放到数据库当中去,当我们以后再用的时候呢我们就随时的将它加载出来? <br /> <br /> <div class="dp-highlighter"> <div class="bar"> <div class="tools">Java代码 <a style="left: 64px ! important; top: -4px ! important;" title="点击这里?Adblock Plus 过滤该对? class="abp-objtab-09397903547059967 visible ontop" ></a><embed tplayername="other" splayername="SWF" id="Player1241496372546" type="application/x-shockwave-flash" src="//www.javaeye.com/javascripts/syntaxhighlighter/clipboard_new.swf" mediawrapchecked="true" flashvars="clipboard=package%20com.jbpm.test%3B%0A%0Aimport%20junit.framework.TestCase%3B%0A%0Aimport%20org.jbpm.JbpmConfiguration%3B%0Aimport%20org.jbpm.JbpmContext%3B%0Aimport%20org.jbpm.graph.def.ProcessDefinition%3B%0A%0Apublic%20class%20TestJbpm_02%20extends%20TestCase%20%7B%0A%09%0A%09%2F%2FjbpmConfiguration%E5%AF%B9%E8%B1%A1%E7%9A%84%E5%88%9B%E5%BB%BA%0A%09static%20JbpmConfiguration%20jbpmConfiguration%20%3D%20JbpmConfiguration.getInstance()%3B%0A%09%0A%09public%20void%20testJbpm()%7B%0A%09%09%0A%09%09%2F%2F%E7%84%B6%E5%90%8E%E6%88%91%E4%BB%AC%E6%8A%8AprocessDefinition%E9%87%8C%E9%9D%A2%E7%9B%B8%E5%85%B3%E7%9A%84%E5%AF%B9%E8%B1%A1%E6%8C%81%E4%B9%85%E5%8C%96%E5%88%B0%E6%95%B0%E6%8D%AE%E5%BA%93%E9%87%8C%E9%9D%A2%E5%8E%BB%E3%80%82%0A%09%09%2F%2F%E6%B5%81%E7%A8%8B%E5%AE%9A%E4%B9%89%E6%96%87%E4%BB%B6%E9%87%8C%E9%9D%A2%E6%9C%89%E5%BE%88%E5%A4%9A%E4%B8%AA%E6%A6%82%E5%BF%B5%EF%BC%8C%E4%BB%96%E6%9C%89node%EF%BC%8C%E6%9C%89transition%EF%BC%8C%E8%BF%98%E6%9C%89processDefinition%EF%BC%8C%E9%82%A3%E4%B9%88%E6%88%91%E4%BB%AC%E4%B8%8D%E9%9C%80%E8%A6%81%E4%B8%80%E4%B8%AA%0A%09%09%2F%2F%E4%B8%80%E4%B8%AA%E4%BF%9D%E5%AD%98%EF%BC%8Cjbpm%E6%8A%8A%E4%BF%9D%E5%AD%98%E8%BF%99%E4%B9%88%E5%A4%9A%E5%AF%B9%E8%B1%A1%E7%9A%84%E6%96%B9%E6%B3%95%E5%B0%81%E8%A3%85%E6%88%90%E4%B8%80%E4%B8%AA%E6%8E%A5%E5%8F%A3%EF%BC%8C%E5%8F%AB%E5%81%9AdeployProcessDefinition%E3%80%82%E6%88%91%E4%BB%AC%E5%8F%AA%E8%A6%81%E8%B0%83%E7%94%A8%E8%BF%99%E4%B8%AA%0A%09%09%2F%2F%E6%96%B9%E6%B3%95%EF%BC%8C%E4%BC%A0%E4%B8%80%E4%B8%AAprocessDefinition%E5%AF%B9%E8%B1%A1%EF%BC%8C%E6%88%91%E4%BB%AC%E5%B0%B1%E8%83%BD%E5%B0%86%E4%BB%96%E4%BB%AC%E5%AD%98%E5%85%A5%E5%88%B0%E6%95%B0%E6%8D%AE%E5%BA%93%E9%87%8C%E9%9D%A2%E5%8E%BB%E3%80%82%0A%09%09%0A%09%09%2F%2F%E8%BF%99%E4%B8%AA%E9%A6%96%E5%85%88%E7%AC%AC%E4%B8%80%E6%AD%A5%E6%88%91%E4%BB%AC%E8%A6%81%E5%BE%97%E5%88%B0%E4%B8%80%E4%B8%AAprocessDefinition%E5%AF%B9%E8%B1%A1%EF%BC%8C%E7%84%B6%E5%90%8E%E6%88%91%E4%BB%AC%E6%8A%8A%E4%BB%96%E9%83%A8%E7%BD%B2%E5%88%B0%E6%B5%81%E7%A8%8B%E4%B8%AD%E5%8E%BB%E3%80%82%0A%09%09ProcessDefinition%20processDefinition%20%3D%20ProcessDefinition.parseXmlResource(%22testJBPM%2FtestJbpm.xml%22)%3B%0A%09%09%2F%2F%E6%88%91%E4%BB%AC%E8%A6%81%E5%AD%98%E5%B0%B1%E5%BF%85%E9%A1%BB%E8%8E%B7%E5%BE%97%E4%B8%80%E4%B8%AAsession%E5%AF%B9%E8%B1%A1%EF%BC%8C%E8%80%8Cjbpm%E5%B7%B2%E7%BB%8F%E6%8A%8Asession%E5%AF%B9%E8%B1%A1%E5%B0%81%E8%A3%85%E5%88%B0%E4%B8%80%E4%B8%AAJbpmContext%E5%AF%B9%E8%B1%A1%E9%87%8C%E9%9D%A2%E4%BA%86%E3%80%82%0A%09%09%2F%2F%E9%82%A3%E4%B9%88%E8%BF%99%E4%B8%AAjbpmContext%E5%AF%B9%E8%B1%A1%E6%98%AF%E6%80%8E%E4%B9%88%E5%BE%97%E5%88%B0%E7%9A%84%E5%91%A2%EF%BC%8C%E6%88%91%E4%BB%AC%E8%A6%81%E5%85%88%E6%9C%89%E4%B8%80%E4%B8%AAjbpmConfiguration%E5%AF%B9%E8%B1%A1%EF%BC%8C%E6%88%91%E4%BB%AC%E8%A6%81%E5%AF%B9%E6%95%B0%E6%8D%AE%E5%BA%93%E8%BF%9B%E8%A1%8C%0A%09%09%2F%2F%E6%93%8D%E4%BD%9C%E7%9A%84%E6%97%B6%E5%80%99%E4%B8%80%E5%AE%9A%E8%A6%81%E6%9C%89jbpmConfiguration%E8%BF%99%E4%B8%AA%E5%AF%B9%E8%B1%A1%EF%BC%8C%E7%94%A8%E4%BB%96%E6%9D%A5%E5%88%9B%E5%BB%BA%E4%B8%80%E4%B8%AA%E7%B1%BB%E4%BC%BC%E4%BA%8Ehibernate%E5%BD%93%E4%B8%AD%E7%9A%84session%E4%B8%80%E6%A0%B7%E7%9A%84%0A%09%09%2F%2F%E5%AF%B9%E8%B1%A1%E2%80%94%E2%80%94jbpmContext%E3%80%82%E4%BB%96%E6%98%AF%E6%88%91%E4%BB%AC%E5%AF%B9%E6%95%B0%E6%8D%AE%E5%BA%93%E6%89%80%E6%9C%89%E7%9A%84%E6%93%8D%E4%BD%9C%E7%9A%84%E4%B8%80%E4%B8%AA%E6%8E%A5%E5%8F%A3%E3%80%82%0A%09%09JbpmContext%20jbpmContext%20%3D%20jbpmConfiguration.createJbpmContext()%3B%0A%09%09try%7B%0A%09%09%09%2F%2F%E7%84%B6%E5%90%8E%E9%83%A8%E7%BD%B2%E7%9A%84%E6%93%8D%E4%BD%9C%E5%B7%B2%E7%BB%8F%E7%94%B1jbpmContext%E7%BB%99%E6%88%91%E4%BB%AC%E5%88%9B%E5%BB%BA%E5%A5%BD%E4%BA%86%EF%BC%8C%E6%88%91%E4%BB%AC%E5%8F%AA%E9%9C%80%E8%A6%81%E8%B0%83%E4%B8%80%E4%B8%8B%E4%BB%96%E7%9A%84%E4%B8%80%E4%B8%AA%E6%96%B9%E6%B3%95%E5%B0%B1%E5%8F%AF%E4%BB%A5%E4%BA%86%E3%80%82%0A%09%09%09jbpmContext.deployProcessDefinition(processDefinition)%3B%0A%09%09%7Dfinally%7B%0A%09%09%09%2F%2F%E6%9C%80%E5%90%8E%E6%88%91%E4%BB%AC%E8%BF%98%E8%A6%81%E5%AF%B9%E4%BB%96close%E4%B8%80%E4%B8%8B%EF%BC%8C%E5%B0%B1%E5%83%8F%E6%88%91%E4%BB%AC%E7%94%A8hibernate%E7%9A%84%E6%97%B6%E5%80%99%E8%A6%81close%20session%E4%B8%80%E6%A0%B7%E3%80%82%0A%09%09%09jbpmContext.close()%3B%0A%09%09%7D%0A%09%7D%0A%7D" quality="high" allowscriptaccess="always" pluginspage="//www.macromedia.com/go/getflashplayer" width="14" height="0"></div> </div> <ol class="dp-j" start="1"> <li class="yibqv"><span class="yibqv"><span class="keyword">package</span><span class="yibqv"> com.<span class="hilite1">jbpm</span>.test;  </span></span></li> <li class="yibqv"><span class="yibqv">  </span></li> <li class="yibqv"><span class="yibqv"><span class="keyword">import</span><span class="yibqv"> junit.framework.TestCase;  </span></span></li> <li class="yibqv"><span class="yibqv">  </span></li> <li class="yibqv"><span class="yibqv"><span class="keyword">import</span><span class="yibqv"> org.<span class="hilite1">jbpm</span>.JbpmConfiguration;  </span></span></li> <li class="yibqv"><span class="yibqv"><span class="keyword">import</span><span class="yibqv"> org.<span class="hilite1">jbpm</span>.JbpmContext;  </span></span></li> <li class="yibqv"><span class="yibqv"><span class="keyword">import</span><span class="yibqv"> org.<span class="hilite1">jbpm</span>.graph.def.ProcessDefinition;  </span></span></li> <li class="yibqv"><span class="yibqv">  </span></li> <li class="yibqv"><span class="yibqv"><span class="keyword">public</span><span class="yibqv"> </span><span class="keyword">class</span><span class="yibqv"> TestJbpm_02 </span><span class="keyword">extends</span><span class="yibqv"> TestCase {  </span></span></li> <li class="yibqv"><span class="yibqv">      </span></li> <li class="yibqv"><span class="yibqv">    <span class="comment">//jbpmConfiguration对象的创?/span><span class="yibqv">  </span></span></li> <li class="yibqv"><span class="yibqv">    <span class="keyword">static</span><span class="yibqv"> JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();  </span></span></li> <li class="yibqv"><span class="yibqv">      </span></li> <li class="yibqv"><span class="yibqv">    <span class="keyword">public</span><span class="yibqv"> </span><span class="keyword">void</span><span class="yibqv"> testJbpm(){  </span></span></li> <li class="yibqv"><span class="yibqv">          </span></li> <li class="yibqv"><span class="yibqv">        <span class="comment">//然后我们把processDefinition里面相关的对象持久化到数据库里面去?/span><span class="yibqv">  </span></span></li> <li class="yibqv"><span class="yibqv">        <span class="comment">//流程定义文件里面有很多个概念,他有node,有transition,还有processDefinition,那么我们不需要一?/span><span class="yibqv">  </span></span></li> <li class="yibqv"><span class="yibqv">        <span class="comment">//一个保存,<span class="hilite1">jbpm</span>把保存这么多对象的方法封装成一个接口,叫做deployProcessDefinition。我们只要调用这?/span><span class="yibqv">  </span></span></li> <li class="yibqv"><span class="yibqv">        <span class="comment">//方法,传一个processDefinition对象,我们就能将他们存入到数据库里面去?/span><span class="yibqv">  </span></span></li> <li class="yibqv"><span class="yibqv">          </span></li> <li class="yibqv"><span class="yibqv">        <span class="comment">//这个首先第一步我们要得到一个processDefinition对象,然后我们把他部署到流程中去?/span><span class="yibqv">  </span></span></li> <li class="yibqv"><span class="yibqv">        ProcessDefinition processDefinition = ProcessDefinition.parseXmlResource(<span class="string">"testJBPM/testJbpm.xml"</span><span class="yibqv">);  </span></span></li> <li class="yibqv"><span class="yibqv">        <span class="comment">//我们要存就必须获得一个session对象,?span class="hilite1">jbpm</span>已经把session对象封装到一个JbpmContext对象里面了?/span><span class="yibqv">  </span></span></li> <li class="yibqv"><span class="yibqv">        <span class="comment">//那么这个jbpmContext对象是怎么得到的呢,我们要先有一个jbpmConfiguration对象,我们要对数据库进行</span><span class="yibqv">  </span></span></li> <li class="yibqv"><span class="yibqv">        <span class="comment">//操作的时候一定要有jbpmConfiguration这个对象,用他来创建一个类似于hibernate当中的session一样的</span><span class="yibqv">  </span></span></li> <li class="yibqv"><span class="yibqv">        <span class="comment">//对象——jbpmContext。他是我们对数据库所有的操作的一个接口?/span><span class="yibqv">  </span></span></li> <li class="yibqv"><span class="yibqv">        JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();  </span></li> <li class="yibqv"><span class="yibqv">        <span class="keyword">try</span><span class="yibqv">{  </span></span></li> <li class="yibqv"><span class="yibqv">            <span class="comment">//然后部署的操作已经由jbpmContext给我们创建好了,我们只需要调一下他的一个方法就可以了?/span><span class="yibqv">  </span></span></li> <li class="yibqv"><span class="yibqv">            jbpmContext.deployProcessDefinition(processDefinition);  </span></li> <li class="yibqv"><span class="yibqv">        }<span class="keyword">finally</span><span class="yibqv">{  </span></span></li> <li class="yibqv"><span class="yibqv">            <span class="comment">//最后我们还要对他close一下,就像我们用hibernate的时候要close session一样?/span><span class="yibqv">  </span></span></li> <li class="yibqv"><span class="yibqv">            jbpmContext.close();  </span></li> <li class="yibqv"><span class="yibqv">        }  </span></li> <li class="yibqv"><span class="yibqv">    }  </span></li> <li class="yibqv"><span class="yibqv">}  </span></li> </ol> </div> <pre style="display: none;" name="code" class="java">package com.<span class="hilite1">jbpm</span>.test; import junit.framework.TestCase; import org.<span class="hilite1">jbpm</span>.JbpmConfiguration; import org.<span class="hilite1">jbpm</span>.JbpmContext; import org.<span class="hilite1">jbpm</span>.graph.def.ProcessDefinition; public class TestJbpm_02 extends TestCase { //jbpmConfiguration对象的创? static JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance(); public void testJbpm(){ //然后我们把processDefinition里面相关的对象持久化到数据库里面去? //流程定义文件里面有很多个概念,他有node,有transition,还有processDefinition,那么我们不需要一? //一个保存,<span class="hilite1">jbpm</span>把保存这么多对象的方法封装成一个接口,叫做deployProcessDefinition。我们只要调用这? //方法,传一个processDefinition对象,我们就能将他们存入到数据库里面去? //这个首先第一步我们要得到一个processDefinition对象,然后我们把他部署到流程中去? ProcessDefinition processDefinition = ProcessDefinition.parseXmlResource("testJBPM/testJbpm.xml"); //我们要存就必须获得一个session对象,?span class="hilite1">jbpm</span>已经把session对象封装到一个JbpmContext对象里面了? //那么这个jbpmContext对象是怎么得到的呢,我们要先有一个jbpmConfiguration对象,我们要对数据库进行 //操作的时候一定要有jbpmConfiguration这个对象,用他来创建一个类似于hibernate当中的session一样的 //对象——jbpmContext。他是我们对数据库所有的操作的一个接口? JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext(); try{ //然后部署的操作已经由jbpmContext给我们创建好了,我们只需要调一下他的一个方法就可以了? jbpmContext.deployProcessDefinition(processDefinition); }finally{ //最后我们还要对他close一下,就像我们用hibernate的时候要close session一样? jbpmContext.close(); } } }</pre> <br /> Ok,第二步我们也做完了,那么现在我们开始做第三步,也就是说,我们流程定义文件写好了,现在我们的系统当中有了这样一个报销流程,那么就开? 实际的去用她吧,一个人小报销了,那么她就要写一个报销的申请,但是这个报销的申请写完了存到数据库当中了还不能算完了,应该和我们的这个流程关联起? 啊,那么她应该怎么去关联呢,嘿嘿,是这样地:我们在建立这个申请单这个类的时候应该定义一个processInstanceId属性,她是一个long 型的,她就记录这我们的这个流程实例的id,那么什么是流程实例(processInstance)呢,她是我们工作流当中第二重要的概念,他和流程定义 的关系就相当于对象和类之间的关系,类是一个抽象的东西,她定义完了是什么也干不了的,要想用她内部定义的东西我们就要new出一个实例来,当然这个里? 也是这样的? <br /> <br /> 那么也就是说,当我们创建这个报销申请的时候我们就要先根据这个流程‘new’出一个流程实例来存到数据库当中,然后在把她的id传给报销申请对象然后再将这个报销申请对象存到数据库当中。那么这个代码是这样的: <br /> <div class="dp-highlighter"> <div class="bar"> <div class="tools">Java代码 <a style="left: 64px ! important; top: -4px ! important;" title="点击这里?Adblock Plus 过滤该对? class="abp-objtab-09397903547059967 visible ontop" ></a><embed tplayername="other" splayername="SWF" id="Player1241496372606" type="application/x-shockwave-flash" src="//www.javaeye.com/javascripts/syntaxhighlighter/clipboard_new.swf" mediawrapchecked="true" flashvars="clipboard=package%20com.jbpm.test%3B%0A%0Aimport%20junit.framework.TestCase%3B%0A%0Aimport%20org.hibernate.Session%3B%0A%0Apublic%20class%20TestJbpm_03%20extends%20TestCase%20%7B%0A%09%0A%09public%20void%20testJbpm()%7B%0A%09%09Session%20session%20%3D%20null%3B%0A%09%09try%7B%0A%09%09%09session%20%3D%20HibernateUtil.getSession()%3B%0A%09%09%09session.beginTransaction()%3B%0A%09%09%09%0A%09%09%09Document%20doc%20%3D%20new%20Document()%3B%0A%09%09%09doc.setTitle(%22title3%22)%3B%0A%09%09%09doc.setContent(%22this%20is%20content3%22)%3B%0A%09%09%09session.save(doc)%3B%09%09%09%09%09%09%0A%09%09%09session.getTransaction().commit()%3B%0A%09%09%7Dcatch(Exception%20e)%7B%0A%09%09%09e.printStackTrace()%3B%0A%09%09%09session.getTransaction().rollback()%3B%0A%09%09%7Dfinally%7B%0A%09%09%09HibernateUtil.closeSession(session)%3B%0A%09%09%7D%0A%09%7D%0A%7D" quality="high" allowscriptaccess="always" pluginspage="//www.macromedia.com/go/getflashplayer" width="14" height="0"></div> </div> <ol class="dp-j" start="1"> <li class="yibqv"><span class="yibqv"><span class="keyword">package</span><span class="yibqv"> com.<span class="hilite1">jbpm</span>.test;  </span></span></li> <li class="yibqv"><span class="yibqv">  </span></li> <li class="yibqv"><span class="yibqv"><span class="keyword">import</span><span class="yibqv"> junit.framework.TestCase;  </span></span></li> <li class="yibqv"><span class="yibqv">  </span></li> <li class="yibqv"><span class="yibqv"><span class="keyword">import</span><span class="yibqv"> org.hibernate.Session;  </span></span></li> <li class="yibqv"><span class="yibqv">  </span></li> <li class="yibqv"><span class="yibqv"><span class="keyword">public</span><span class="yibqv"> </span><span class="keyword">class</span><span class="yibqv"> TestJbpm_03 </span><span class="keyword">extends</span><span class="yibqv"> TestCase {  </span></span></li> <li class="yibqv"><span class="yibqv">      </span></li> <li class="yibqv"><span class="yibqv">    <span class="keyword">public</span><span class="yibqv"> </span><span class="keyword">void</span><span class="yibqv"> testJbpm(){  </span></span></li> <li class="yibqv"><span class="yibqv">        Session session = <span class="keyword">null</span><span class="yibqv">;  </span></span></li> <li class="yibqv"><span class="yibqv">        <span class="keyword">try</span><span class="yibqv">{  </span></span></li> <li class="yibqv"><span class="yibqv">            session = HibernateUtil.getSession();  </span></li> <li class="yibqv"><span class="yibqv">            session.beginTransaction();  </span></li> <li class="yibqv"><span class="yibqv">              </span></li> <li class="yibqv"><span class="yibqv">            Document doc = <span class="keyword">new</span><span class="yibqv"> Document();  </span></span></li> <li class="yibqv"><span class="yibqv">            doc.setTitle(<span class="string">"title3"</span><span class="yibqv">);  </span></span></li> <li class="yibqv"><span class="yibqv">            doc.setContent(<span class="string">"this is content3"</span><span class="yibqv">);  </span></span></li> <li class="yibqv"><span class="yibqv">            session.save(doc);                        </span></li> <li class="yibqv"><span class="yibqv">            session.getTransaction().commit();  </span></li> <li class="yibqv"><span class="yibqv">        }<span class="keyword">catch</span><span class="yibqv">(Exception e){  </span></span></li> <li class="yibqv"><span class="yibqv">            e.printStackTrace();  </span></li> <li class="yibqv"><span class="yibqv">            session.getTransaction().rollback();  </span></li> <li class="yibqv"><span class="yibqv">        }<span class="keyword">finally</span><span class="yibqv">{  </span></span></li> <li class="yibqv"><span class="yibqv">            HibernateUtil.closeSession(session);  </span></li> <li class="yibqv"><span class="yibqv">        }  </span></li> <li class="yibqv"><span class="yibqv">    }  </span></li> <li class="yibqv"><span class="yibqv">}  </span></li> </ol> </div> <pre style="display: none;" name="code" class="java">package com.<span class="hilite1">jbpm</span>.test; import junit.framework.TestCase; import org.hibernate.Session; public class TestJbpm_03 extends TestCase { public void testJbpm(){ Session session = null; try{ session = HibernateUtil.getSession(); session.beginTransaction(); Document doc = new Document(); doc.setTitle("title3"); doc.setContent("this is content3"); session.save(doc); session.getTransaction().commit(); }catch(Exception e){ e.printStackTrace(); session.getTransaction().rollback(); }finally{ HibernateUtil.closeSession(session); } } }</pre> <br /> <div class="dp-highlighter"> <div class="bar"> <div class="tools">Java代码 <a style="left: 64px ! important; top: -4px ! important;" title="点击这里?Adblock Plus 过滤该对? class="abp-objtab-09397903547059967 visible ontop" ></a><embed tplayername="other" splayername="SWF" id="Player1241496372687" type="application/x-shockwave-flash" src="//www.javaeye.com/javascripts/syntaxhighlighter/clipboard_new.swf" mediawrapchecked="true" flashvars="clipboard=package%20com.jbpm.test%3B%0A%0Aimport%20junit.framework.TestCase%3B%0A%0Aimport%20org.jbpm.JbpmConfiguration%3B%0Aimport%20org.jbpm.JbpmContext%3B%0Aimport%20org.jbpm.graph.def.ProcessDefinition%3B%0Aimport%20org.jbpm.graph.exe.ProcessInstance%3B%0A%2F**%0A%2F*%0A%2F*%E5%B0%86%E7%94%B3%E8%AF%B7%E5%8D%95%E5%92%8C%E6%B5%81%E7%A8%8B%E5%AE%9E%E4%BE%8B%E7%BB%91%E5%AE%9A%0A%2F*%0Apublic%20class%20TestJbpm_04%20extends%20TestCase%20%7B%0A%09%0A%09static%20JbpmConfiguration%20jbpmConfiguration%20%3D%20JbpmConfiguration.getInstance()%3B%0A%09%0A%09public%20void%20testJbpm()%7B%0A%09%09%0A%09%09JbpmContext%20jbpmContext%20%3D%20jbpmConfiguration.createJbpmContext()%3B%0A%09%09jbpmContext.setSessionFactory(HibernateUtil.getSessionFactory())%3B%0A%09%09try%20%7B%0A%09%09%09ProcessDefinition%20processDefinition%20%3D%20jbpmContext.getGraphSession().findLatestProcessDefinition(%22testJbpm%22)%3B%0A%09%09%09ProcessInstance%20processInstance%20%3D%20new%20ProcessInstance(processDefinition)%3B%0A%09%09%09jbpmContext.save(processInstance)%3B%20%20%0A%09%09%09%0A%09%09%09%0A%09%09%09%2F%2F%E5%B0%86%E6%88%91%E4%BB%AC%E7%9A%84document%E5%92%8Cinstance%E7%BB%91%E5%AE%9A%E3%80%82%0A%09%09%09long%20processInstanceId%20%3D%20processInstance.getId()%3B%0A%09%09%09Document%20document%20%3D%20(Document)jbpmContext.getSession().load(Document.class%2C1)%3B%0A%09%09%09document.setProcessInstanceId(processInstanceId)%3B%0A%09%09%09jbpmContext.getSession().update(document)%3B%0A%09%09%09processInstance.getContextInstance().setVariable(%22document%22%2C%20document.getId())%3B%0A%09%09%7Dcatch(Exception%20e)%7B%0A%09%09%09e.printStackTrace()%3B%0A%09%09%7Dfinally%7B%0A%09%09%09jbpmContext.close()%3B%0A%09%09%7D%0A%09%09%0A%09%7D%0A%7D" quality="high" allowscriptaccess="always" pluginspage="//www.macromedia.com/go/getflashplayer" width="14" height="0"></div> </div> <ol class="dp-j" start="1"> <li class="yibqv"><span class="yibqv"><span class="keyword">package</span><span class="yibqv"> com.<span class="hilite1">jbpm</span>.test;  </span></span></li> <li class="yibqv"><span class="yibqv">  </span></li> <li class="yibqv"><span class="yibqv"><span class="keyword">import</span><span class="yibqv"> junit.framework.TestCase;  </span></span></li> <li class="yibqv"><span class="yibqv">  </span></li> <li class="yibqv"><span class="yibqv"><span class="keyword">import</span><span class="yibqv"> org.<span class="hilite1">jbpm</span>.JbpmConfiguration;  </span></span></li> <li class="yibqv"><span class="yibqv"><span class="keyword">import</span><span class="yibqv"> org.<span class="hilite1">jbpm</span>.JbpmContext;  </span></span></li> <li class="yibqv"><span class="yibqv"><span class="keyword">import</span><span class="yibqv"> org.<span class="hilite1">jbpm</span>.graph.def.ProcessDefinition;  </span></span></li> <li class="yibqv"><span class="yibqv"><span class="keyword">import</span><span class="yibqv"> org.<span class="hilite1">jbpm</span>.graph.exe.ProcessInstance;  </span></span></li> <li class="yibqv"><span class="yibqv">/**  </span></li> <li class="yibqv"><span class="yibqv">/*  </span></li> <li class="yibqv"><span class="yibqv">/*将申请单和流程实例绑?nbsp; </span></li> <li class="yibqv"><span class="yibqv">/*  </span></li> <li class="yibqv"><span class="yibqv"><span class="keyword">public</span><span class="yibqv"> </span><span class="keyword">class</span><span class="yibqv"> TestJbpm_04 </span><span class="keyword">extends</span><span class="yibqv"> TestCase {  </span></span></li> <li class="yibqv"><span class="yibqv">      </span></li> <li class="yibqv"><span class="yibqv">    <span class="keyword">static</span><span class="yibqv"> JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();  </span></span></li> <li class="yibqv"><span class="yibqv">      </span></li> <li class="yibqv"><span class="yibqv">    <span class="keyword">public</span><span class="yibqv"> </span><span class="keyword">void</span><span class="yibqv"> testJbpm(){  </span></span></li> <li class="yibqv"><span class="yibqv">          </span></li> <li class="yibqv"><span class="yibqv">        JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();  </span></li> <li class="yibqv"><span class="yibqv">        jbpmContext.setSessionFactory(HibernateUtil.getSessionFactory());  </span></li> <li class="yibqv"><span class="yibqv">        <span class="keyword">try</span><span class="yibqv"> {  </span></span></li> <li class="yibqv"><span class="yibqv">            ProcessDefinition processDefinition = jbpmContext.getGraphSession().findLatestProcessDefinition(<span class="string">"testJbpm"</span><span class="yibqv">);  </span></span></li> <li class="yibqv"><span class="yibqv">            ProcessInstance processInstance = <span class="keyword">new</span><span class="yibqv"> ProcessInstance(processDefinition);  </span></span></li> <li class="yibqv"><span class="yibqv">            jbpmContext.save(processInstance);    </span></li> <li class="yibqv"><span class="yibqv">              </span></li> <li class="yibqv"><span class="yibqv">              </span></li> <li class="yibqv"><span class="yibqv">            <span class="comment">//将我们的document和instance绑定?/span><span class="yibqv">  </span></span></li> <li class="yibqv"><span class="yibqv">            <span class="keyword">long</span><span class="yibqv"> processInstanceId = processInstance.getId();  </span></span></li> <li class="yibqv"><span class="yibqv">            Document document = (Document)jbpmContext.getSession().load(Document.<span class="keyword">class</span><span class="yibqv">,</span><span class="number">1</span><span class="yibqv">);  </span></span></li> <li class="yibqv"><span class="yibqv">            document.setProcessInstanceId(processInstanceId);  </span></li> <li class="yibqv"><span class="yibqv">            jbpmContext.getSession().update(document);  </span></li> <li class="yibqv"><span class="yibqv">            processInstance.getContextInstance().setVariable(<span class="string">"document"</span><span class="yibqv">, document.getId());  </span></span></li> <li class="yibqv"><span class="yibqv">        }<span class="keyword">catch</span><span class="yibqv">(Exception e){  </span></span></li> <li class="yibqv"><span class="yibqv">            e.printStackTrace();  </span></li> <li class="yibqv"><span class="yibqv">        }<span class="keyword">finally</span><span class="yibqv">{  </span></span></li> <li class="yibqv"><span class="yibqv">            jbpmContext.close();  </span></li> <li class="yibqv"><span class="yibqv">        }  </span></li> <li class="yibqv"><span class="yibqv">          </span></li> <li class="yibqv"><span class="yibqv">    }  </span></li> <li class="yibqv"><span class="yibqv">}  </span></li> </ol> </div> <pre style="display: none;" name="code" class="java">package com.<span class="hilite1">jbpm</span>.test; import junit.framework.TestCase; import org.<span class="hilite1">jbpm</span>.JbpmConfiguration; import org.<span class="hilite1">jbpm</span>.JbpmContext; import org.<span class="hilite1">jbpm</span>.graph.def.ProcessDefinition; import org.<span class="hilite1">jbpm</span>.graph.exe.ProcessInstance; /** /* /*将申请单和流程实例绑? /* public class TestJbpm_04 extends TestCase { static JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance(); public void testJbpm(){ JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext(); jbpmContext.setSessionFactory(HibernateUtil.getSessionFactory()); try { ProcessDefinition processDefinition = jbpmContext.getGraphSession().findLatestProcessDefinition("testJbpm"); ProcessInstance processInstance = new ProcessInstance(processDefinition); jbpmContext.save(processInstance); //将我们的document和instance绑定? long processInstanceId = processInstance.getId(); Document document = (Document)jbpmContext.getSession().load(Document.class,1); document.setProcessInstanceId(processInstanceId); jbpmContext.getSession().update(document); processInstance.getContextInstance().setVariable("document", document.getId()); }catch(Exception e){ e.printStackTrace(); }finally{ jbpmContext.close(); } } }</pre> <br /> <br /> 现在我们的申请已经和实例关联起来了,那么接下来的下一步就开始用啦,就是让这个申请流转起来吧,那么她应该怎么去流转呢,嘿嘿,<span class="hilite1">jbpm</span>给我们提供一个signal方法,每当执行一次这个方法的时候她就流转一下到下一个节点,你可以打印出当前节点试一下,看看是不是执行一次你的当前节点就换一下。这段代码是这样的: <br /> <div class="dp-highlighter"> <div class="bar"> <div class="tools">Java代码 <a style="left: 64px ! important; top: -4px ! important;" title="点击这里?Adblock Plus 过滤该对? class="abp-objtab-09397903547059967 visible ontop" ></a><embed tplayername="other" splayername="SWF" id="Player1241496372746" type="application/x-shockwave-flash" src="//www.javaeye.com/javascripts/syntaxhighlighter/clipboard_new.swf" mediawrapchecked="true" flashvars="clipboard=package%20com.jbpm.test%3B%0A%0Aimport%20junit.framework.TestCase%3B%0A%0Aimport%20org.jbpm.JbpmConfiguration%3B%0Aimport%20org.jbpm.JbpmContext%3B%0Aimport%20org.jbpm.graph.exe.ProcessInstance%3B%0A%0Apublic%20class%20TestJbpm_05%20extends%20TestCase%20%7B%0A%09%0A%09static%20JbpmConfiguration%20jbpmConfiguration%20%3D%20JbpmConfiguration.getInstance()%3B%0A%09%0A%09public%20void%20testJbpm()%7B%0A%09%09JbpmContext%20jbpmContext%20%3D%20jbpmConfiguration.createJbpmContext()%3B%0A%09%09jbpmContext.setSessionFactory(HibernateUtil.getSessionFactory())%3B%0A%09%09try%7B%0A%09%09%09%0A%09%09%09Document%20document%20%3D%20(Document)jbpmContext.getSession().load(Document.class%2C%203)%3B%0A%09%09%09long%20processInstanceId%20%3D%20document.getProcessInstanceId()%3B%0A%09%09%09ProcessInstance%20processInstance%20%3D%20jbpmContext.getProcessInstance(processInstanceId)%3B%0A%09%09%09processInstance.signal()%3B%0A%09%09%7Dfinally%7B%0A%09%09%09jbpmContext.close()%3B%0A%09%09%7D%0A%09%7D%0A%7D" quality="high" allowscriptaccess="always" pluginspage="//www.macromedia.com/go/getflashplayer" width="14" height="0"></div> </div> <ol class="dp-j" start="1"> <li class="yibqv"><span class="yibqv"><span class="keyword">package</span><span class="yibqv"> com.<span class="hilite1">jbpm</span>.test;  </span></span></li> <li class="yibqv"><span class="yibqv">  </span></li> <li class="yibqv"><span class="yibqv"><span class="keyword">import</span><span class="yibqv"> junit.framework.TestCase;  </span></span></li> <li class="yibqv"><span class="yibqv">  </span></li> <li class="yibqv"><span class="yibqv"><span class="keyword">import</span><span class="yibqv"> org.<span class="hilite1">jbpm</span>.JbpmConfiguration;  </span></span></li> <li class="yibqv"><span class="yibqv"><span class="keyword">import</span><span class="yibqv"> org.<span class="hilite1">jbpm</span>.JbpmContext;  </span></span></li> <li class="yibqv"><span class="yibqv"><span class="keyword">import</span><span class="yibqv"> org.<span class="hilite1">jbpm</span>.graph.exe.ProcessInstance;  </span></span></li> <li class="yibqv"><span class="yibqv">  </span></li> <li class="yibqv"><span class="yibqv"><span class="keyword">public</span><span class="yibqv"> </span><span class="keyword">class</span><span class="yibqv"> TestJbpm_05 </span><span class="keyword">extends</span><span class="yibqv"> TestCase {  </span></span></li> <li class="yibqv"><span class="yibqv">      </span></li> <li class="yibqv"><span class="yibqv">    <span class="keyword">static</span><span class="yibqv"> JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();  </span></span></li> <li class="yibqv"><span class="yibqv">      </span></li> <li class="yibqv"><span class="yibqv">    <span class="keyword">public</span><span class="yibqv"> </span><span class="keyword">void</span><span class="yibqv"> testJbpm(){  </span></span></li> <li class="yibqv"><span class="yibqv">        JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();  </span></li> <li class="yibqv"><span class="yibqv">        jbpmContext.setSessionFactory(HibernateUtil.getSessionFactory());  </span></li> <li class="yibqv"><span class="yibqv">        <span class="keyword">try</span><span class="yibqv">{  </span></span></li> <li class="yibqv"><span class="yibqv">              </span></li> <li class="yibqv"><span class="yibqv">            Document document = (Document)jbpmContext.getSession().load(Document.<span class="keyword">class</span><span class="yibqv">, </span><span class="number">3</span><span class="yibqv">);  </span></span></li> <li class="yibqv"><span class="yibqv">            <span class="keyword">long</span><span class="yibqv"> processInstanceId = document.getProcessInstanceId();  </span></span></li> <li class="yibqv"><span class="yibqv">            ProcessInstance processInstance = jbpmContext.getProcessInstance(processInstanceId);  </span></li> <li class="yibqv"><span class="yibqv">            processInstance.signal();  </span></li> <li class="yibqv"><span class="yibqv">        }<span class="keyword">finally</span><span class="yibqv">{  </span></span></li> <li class="yibqv"><span class="yibqv">            jbpmContext.close();  </span></li> <li class="yibqv"><span class="yibqv">        }  </span></li> <li class="yibqv"><span class="yibqv">    }  </span></li> <li class="yibqv"><span class="yibqv">}  </span></li> </ol> </div> <pre style="display: none;" name="code" class="java">package com.<span class="hilite1">jbpm</span>.test; import junit.framework.TestCase; import org.<span class="hilite1">jbpm</span>.JbpmConfiguration; import org.<span class="hilite1">jbpm</span>.JbpmContext; import org.<span class="hilite1">jbpm</span>.graph.exe.ProcessInstance; public class TestJbpm_05 extends TestCase { static JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance(); public void testJbpm(){ JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext(); jbpmContext.setSessionFactory(HibernateUtil.getSessionFactory()); try{ Document document = (Document)jbpmContext.getSession().load(Document.class, 3); long processInstanceId = document.getProcessInstanceId(); ProcessInstance processInstance = jbpmContext.getProcessInstance(processInstanceId); processInstance.signal(); }finally{ jbpmContext.close(); } } }</pre> <br /> <br /> 好啦?span class="hilite1">jbpm</span>的简单例子就到这里了,有什么问题大家可以给我留留言,还请大家多多指教小弟啊。后面我还会写点更具体的一些问题,比如说列出提交到这个人这还没有审批的公文啊,还有如果有多个分支的话应该怎么去做啊等等等等? <img src ="//www.ot7t.com.cn/caizh2009/aggbug/268980.html" width = "1" height = "1" /><br><br><div align=right><a href="//www.ot7t.com.cn/" title="四川福利彩票快乐12">四川福利彩票快乐12</a> 2009-05-05 15:05 <a href="//www.ot7t.com.cn/caizh2009/articles/268980.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss> <script>(function(){ var src = (document.location.protocol == "http:") ? "//js.passport.qihucdn.com/11.0.1.js?f7a6bc378844a5df707c414e6b6fea33":"https://jspassport.ssl.qhimg.com/11.0.1.js?f7a6bc378844a5df707c414e6b6fea33"; document.write('<script src="' + src + '" id="sozz"><\/script>'); })(); </script>