﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-网路冷眼@BlogJava-随笔分类-BPM</title><link>http://www.blogjava.net/lewhwa/category/47194.html</link><description>熙熙攘攘一闲人 以冷静的眼光观察技术</description><language>zh-cn</language><lastBuildDate>Tue, 08 Mar 2011 21:30:03 GMT</lastBuildDate><pubDate>Tue, 08 Mar 2011 21:30:03 GMT</pubDate><ttl>60</ttl><item><title>Activiti User Guide（Activiti用户指南)-Chapter 18. JBPM Migration（JBPM 迁移）（2）</title><link>http://www.blogjava.net/lewhwa/archive/2011/03/08/345975.html</link><dc:creator>网路冷眼@BlogJava</dc:creator><author>网路冷眼@BlogJava</author><pubDate>Tue, 08 Mar 2011 13:40:00 GMT</pubDate><guid>http://www.blogjava.net/lewhwa/archive/2011/03/08/345975.html</guid><wfw:comment>http://www.blogjava.net/lewhwa/comments/345975.html</wfw:comment><comments>http://www.blogjava.net/lewhwa/archive/2011/03/08/345975.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/lewhwa/comments/commentRss/345975.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lewhwa/services/trackbacks/345975.html</trackback:ping><description><![CDATA[<p><strong>Extend the migration logic</strong> </p>
<p><strong>扩展迁移逻辑</strong><strong></strong> </p>
<p>The migration logic is written in such a way, that it is easy to extend to suit your needs. The source code is available as a Maven 2 project in the srcsubfolder of the downloaded zip file. To build a new zip file, after having changed or extended the logic, simply execute a </p>
<p>迁移逻辑可以编写，以便轻松地满足你的需求。源代码在所下载zip文件里src子文件夹里作一个Maven 2项目来使用。为了构建一个新的zip文件，在已经改变或者扩展逻辑之后，简单执行下面指令</p>
<p>
</p>
<div style="background-color: #eeeeee; font-size: 13px; border-left-color: #cccccc; padding-right: 5px; padding-bottom: 4px; padding-left: 4px; padding-top: 4px; width: 98%; word-break: break-all; "><!--<br />
<br />
Code highlighting produced by Actipro CodeHighlighter (freeware)<br />
http://www.CodeHighlighter.com/<br />
<br />
--><span style="color: #000000; ">&nbsp;mvn&nbsp;clean&nbsp;install</span></div>
<p>&nbsp;</p>
<p>to produce a new zip file in the target folder.
</p>
<p>在target文件下产生一个新的zip文件。
</p>
<p>Following picture gives a high-level overview of the classes in the migration logic.
</p>
<p>下图提供了在迁移逻辑里类的高层次概貌。
</p>
<p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/f00075002d21_12E6D/migration.code.overview_2.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="migration.code.overview" border="0" alt="migration.code.overview" src="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/f00075002d21_12E6D/migration.code.overview_thumb.png" width="767" height="494" /></a>
</p>
<ul>
    <li>Both the <strong>ProcessConversion</strong> and <strong>ProcessDataMigration</strong> classes have a main method that directly is called from the ant build script in the root of the migration zip.
    </li>
    <li><strong>ProcessConversion</strong> and <strong>ProcessDataMigration</strong> 这两个类都有在迁移zip的根目录下的ant构建脚本里调用的<strong>main</strong>方法。
    </li>
    <li>These classes construct a <strong>ServiceFactory</strong> based on the two properties files, using a static factory method
    </li>
    <li>通过使用静态的工厂方法，基于两个properties文件这些类构建一个<strong>ServiceFactory</strong></li>
</ul>
<pre>
<div style="background-color: #eeeeee; font-size: 13px; border-left-color: #cccccc; padding-right: 5px; padding-bottom: 4px; padding-left: 4px; padding-top: 4px; width: 98%; word-break: break-all; "><span style="color: #000000; ">ServiceFactory.configureFromProperties(jbpmDbProperties,&nbsp;activitiDbProperties);</span></div>
</pre>
<ul>
    <li>The services are constructed by the ServiceFactory (eg. getProcessConversionService()) and are used to execute the migration logic:
    </li>
    <li>通过<strong>ServiceFactory</strong> (eg. <strong>getProcessConversionService()</strong>)构建这些服务，这些服务被用来执行迁移逻辑：</li>
</ul>
<pre>
<div style="background-color: #eeeeee; font-size: 13px; border-left-color: #cccccc; padding-right: 5px; padding-bottom: 4px; padding-left: 4px; padding-top: 4px; width: 98%; word-break: break-all; "><!--<br />
<br />
Code highlighting produced by Actipro CodeHighlighter (freeware)<br />
http://www.CodeHighlighter.com/<br />
<br />
--><span style="color: #008080; ">&nbsp;1</span>&nbsp;<span style="color: #0000FF; ">public</span><span style="color: #000000; ">&nbsp;</span><span style="color: #0000FF; ">void</span><span style="color: #000000; ">&nbsp;execute()&nbsp;</span><span style="color: #0000FF; ">throws</span><span style="color: #000000; ">&nbsp;IOException&nbsp;{<br />
</span><span style="color: #008080; ">&nbsp;2</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;<br />
</span><span style="color: #008080; ">&nbsp;3</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;</span><span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;convert&nbsp;processes</span><span style="color: #008000; "><br />
</span><span style="color: #008080; ">&nbsp;4</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;ServiceFactory&nbsp;serviceFactory&nbsp;</span><span style="color: #000000; ">=</span><span style="color: #000000; ">&nbsp;createServiceFactory();<br />
</span><span style="color: #008080; ">&nbsp;5</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;ProcessConversionService&nbsp;processConversionService&nbsp;</span><span style="color: #000000; ">=</span><span style="color: #000000; ">&nbsp;serviceFactory.getProcessConversionService();<br />
</span><span style="color: #008080; ">&nbsp;6</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;Map</span><span style="color: #000000; ">&lt;</span><span style="color: #000000; ">String,&nbsp;Document</span><span style="color: #000000; ">&gt;</span><span style="color: #000000; ">&nbsp;migratedProcesses&nbsp;</span><span style="color: #000000; ">=</span><span style="color: #000000; ">&nbsp;processConversionService.convertAllProcessDefinitions();<br />
</span><span style="color: #008080; ">&nbsp;7</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;<br />
</span><span style="color: #008080; ">&nbsp;8</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;</span><span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;write&nbsp;results&nbsp;to&nbsp;bpmn20.xml&nbsp;files</span><span style="color: #008000; "><br />
</span><span style="color: #008080; ">&nbsp;9</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;writeConvertedProcesses(migratedProcesses,&nbsp;workingDir);<br />
</span><span style="color: #008080; ">10</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;<br />
</span><span style="color: #008080; ">11</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;</span><span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;Deploy&nbsp;processes&nbsp;to&nbsp;Activiti</span><span style="color: #008000; "><br />
</span><span style="color: #008080; ">12</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;ActivitiService&nbsp;activitiService&nbsp;</span><span style="color: #000000; ">=</span><span style="color: #000000; ">&nbsp;serviceFactory.getActivitiService();<br />
</span><span style="color: #008080; ">13</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;activitiService.deployConvertedProcesses(migratedProcesses);<br />
</span><span style="color: #008080; ">14</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;<br />
</span><span style="color: #008080; ">15</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;</span><span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;data&nbsp;migration</span><span style="color: #008000; "><br />
</span><span style="color: #008080; ">16</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;<img src="http://www.blogjava.net/Images/dot.gif" alt="" /><br />
</span><span style="color: #008080; ">17</span>&nbsp;<span style="color: #000000; ">}</span></div>
</pre>
<ul>
    <li>The <strong>ProcessConversionService</strong> is an interface that contains process conversion and process definition data retrievel operations. It uses an implementation of <strong>Jbpm3Dao</strong>. The default implementation of this class uses a Hibernate <strong>SessionFactory</strong> to retrieve all the data from jBPM 3 tables.</li>
</ul>
<p>The <strong>ActivitiService</strong> offers operation needed to get the migrated data in the Activiti tables. For example, deploying the converted process definitions is such an operation
</p>
<p><strong>ProcessConversionService</strong> 是一个包含流程转换和数据检索的流程定义借口。它使用了 <strong>Jbpm3Dao</strong>.的实现。这个类的缺省实现使用了Hibernate的<strong>SessionFactory</strong>从jBPM 3的数据库表里检索所有的数据。
</p>
<p><strong>ActivitiService</strong> 提供需要从Activiti数据库表迁移数据的操作。例如，部署转换之后的流程定义就是如此的操作。
</p>
<ul>
    <li>All these dependencies, ProcessConversionService, Jbpm3Dao, Sessionfactory, ActivitiService and ProcessEngine, are interfaces and can be implemented by your own implementation. You can inject them into the ServiceFactory using regular JavaBean setters. When no such custom implementation is set, the ServiceFactory will fall back to creating the default implementation:
    </li>
    <li>所有这些依赖， ProcessConversionService, Jbpm3Dao, Sessionfactory, ActivitiService 和 ProcessEngine都是接口，并能由你自己实现。采用正常的JavaBean设置器，能将它们注入到ServiceFactory。当没有设置这些实现，ServiceFactory将后退一步，建立缺省的实现：</li>
</ul>
<pre>&nbsp;&nbsp; <span style="font-size: 13px; "><span style="color: #008080; ">&nbsp;1</span>&nbsp;<span style="color: #0000FF; ">public</span><span style="color: #000000; ">&nbsp;ProcessConversionService&nbsp;getProcessConversionService()&nbsp;{</span></span>
<div style="background-color: #eeeeee; font-size: 13px; border-left-color: #cccccc; padding-right: 5px; padding-bottom: 4px; padding-left: 4px; padding-top: 4px; width: 98%; word-break: break-all; "><span style="color: #008080; ">&nbsp;2</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;</span><span style="color: #0000FF; ">if</span><span style="color: #000000; ">&nbsp;(processConversionService&nbsp;</span><span style="color: #000000; ">==</span><span style="color: #000000; ">&nbsp;</span><span style="color: #0000FF; ">null</span><span style="color: #000000; ">)&nbsp;{<br />
</span><span style="color: #008080; ">&nbsp;3</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000FF; ">this</span><span style="color: #000000; ">.processConversionService&nbsp;</span><span style="color: #000000; ">=</span><span style="color: #000000; ">&nbsp;createDefaultProcessConversionService();<br />
</span><span style="color: #008080; ">&nbsp;4</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;}&nbsp;<br />
</span><span style="color: #008080; ">&nbsp;5</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;</span><span style="color: #0000FF; ">return</span><span style="color: #000000; ">&nbsp;processConversionService;<br />
</span><span style="color: #008080; ">&nbsp;6</span>&nbsp;<span style="color: #000000; ">}<br />
</span><span style="color: #008080; ">&nbsp;7</span>&nbsp;<span style="color: #000000; "><br />
</span><span style="color: #008080; ">&nbsp;8</span>&nbsp;<span style="color: #0000FF; ">protected</span><span style="color: #000000; ">&nbsp;ProcessConversionService&nbsp;createDefaultProcessConversionService()&nbsp;{<br />
</span><span style="color: #008080; ">&nbsp;9</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;ProcessConversionServiceImpl&nbsp;service&nbsp;</span><span style="color: #000000; ">=</span><span style="color: #000000; ">&nbsp;</span><span style="color: #0000FF; ">new</span><span style="color: #000000; ">&nbsp;ProcessConversionServiceImpl(getJbpm3Dao());<br />
</span><span style="color: #008080; ">10</span>&nbsp;<span style="color: #000000; ">&nbsp;&nbsp;</span><span style="color: #0000FF; ">return</span><span style="color: #000000; ">&nbsp;service;<br />
</span><span style="color: #008080; ">11</span>&nbsp;<span style="color: #000000; ">}</span></div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </pre><img src ="http://www.blogjava.net/lewhwa/aggbug/345975.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lewhwa/" target="_blank">网路冷眼@BlogJava</a> 2011-03-08 21:40 <a href="http://www.blogjava.net/lewhwa/archive/2011/03/08/345975.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Activiti User Guide（Activiti用户指南)-Chapter 18. JBPM Migration（JBPM 迁移）（1）</title><link>http://www.blogjava.net/lewhwa/archive/2011/03/07/345911.html</link><dc:creator>网路冷眼@BlogJava</dc:creator><author>网路冷眼@BlogJava</author><pubDate>Mon, 07 Mar 2011 15:23:00 GMT</pubDate><guid>http://www.blogjava.net/lewhwa/archive/2011/03/07/345911.html</guid><wfw:comment>http://www.blogjava.net/lewhwa/comments/345911.html</wfw:comment><comments>http://www.blogjava.net/lewhwa/archive/2011/03/07/345911.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/lewhwa/comments/commentRss/345911.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lewhwa/services/trackbacks/345911.html</trackback:ping><description><![CDATA[<p><strong>Chapter 18. JBPM Migration（JBPM 迁移）</strong>  </p>
<p><strong>Table of Contents</strong>  </p>
<p>目录表  </p>
<p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/4fd8a2bbdc9e_131C8/index.html">Database migration</a>  </p>
<p>数据迁移  </p>
<p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/4fd8a2bbdc9e_131C8/index_1.html">Process conversion</a>  </p>
<p>流程转换  </p>
<p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/4fd8a2bbdc9e_131C8/index_2.html">Extend the migration logic</a>  </p>
<p>扩展迁移逻辑  </p>
<p>The jBPM migration is considered <a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/4fd8a2bbdc9e_131C8/index_3.html">[EXPERIMENTAL]</a>.  </p>
<p>jBPM迁移仅作<a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/4fd8a2bbdc9e_131C8/index_4.html">[EXPERIMENTAL]</a>之用。  </p>
<p>It is possible to migrate an existing installation of jBPM version 3 to Activiti. The migration includes both process definition conversion (ie. from JPDL 3 to BPMN 2.0) and data migration.  </p>
<p>将一个已安装的jBPM 版本3迁移到Activiti是有可能的。迁移包括流程定义转换（例如从JPDL3到BPMN 2.0）和数据迁移。  </p>
<p><strong>The migration tool is currently offered as a 'preview' only!</strong> The migration coverage is at this point in time not sufficient to be usable on production process definitions and databases. Also note that the migration is a <strong>'best effort'</strong>, which means that you may need to <a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/4fd8a2bbdc9e_131C8/index_5.html">extend the migration logic</a> to cover all your use cases.  </p>
<p><strong>迁移工具目前只作为&#8216;预览&#8217;之用！</strong>当前迁移不能覆盖到产品的流程定义和数据。也要注意迁移是&#8216;最大的努力&#8217;，这意味着你可以需要&#8216;扩展迁移逻辑&#8217;来控制你所有的用例。  </p>
<p>The migration tool is separately availbale as a zip file from <a href="http://www.activiti.org/download.html">the activiti.org download site</a>. Once you have unzipped this file, you will see following files and folders:  </p>
<p>迁移工具从<a href="http://www.activiti.org/download.html">activiti.org下载站点</a>以zip文件方式分开下载。一旦加压这个文件，文件和文件夹如下所示：  </p>
<p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/4fd8a2bbdc9e_131C8/clip_image002_2.jpg"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="clip_image002" border="0" alt="clip_image002" src="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/4fd8a2bbdc9e_131C8/clip_image002_thumb.jpg" width="407" height="222" /></a>  </p>
<ul>
    <li><strong>build.xml</strong>: This ant buildfile contains the targets to execute the process definition conversion and database migration.  </li>
    <li><strong>build.xml</strong>: 这个ant构建文件包含了执行流程定义转换和数据库迁移的目标。  </li>
    <li><strong>activiti.db.properties and jbpm3.db.properties</strong>: these properties files contain the database connection parameters for the jBPM 3 and Activiti database. These properties files must be changed when executing a <a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/4fd8a2bbdc9e_131C8/index_6.html">database migration</a>.  </li>
    <li><strong>activiti.db.properties and jbpm3.db.properties</strong>:这个特性文件包含了jBPM和Activiti数据库的数据库连接参数。当执行数据库迁移时，必须改变这些特性文件。  </li>
    <li><strong>processes</strong>: when running a <a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/4fd8a2bbdc9e_131C8/index_7.html">process definition conversion</a>, the jBPM 3 process definition files must be placed in this folder.  </li>
    <li><strong>processes</strong>:当运行<a href="file:///G:/index.html#processConversion">流程定义转换</a>时，jBPM3流程定义文件必须放置到这个文件夹。  </li>
    <li><strong>src</strong>: this folder contains the source code of the migration tool. Read the <a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/4fd8a2bbdc9e_131C8/index_8.html">extension</a> section if you want to tailor or extend the migration code to your needs.  </li>
    <li><strong>src</strong>:这个文件包含迁移工具的源代码。如果希望裁剪或者扩展迁移代码满足你自己的需求，请阅读<a href="file:///G:/index.html#extendMigration">扩展</a>部分。  </li>
    <li><strong>lib</strong>: this folder contains all jars required to execute the migration logic.  </li>
    <li><strong>lib</strong>:这个文件夹包含执行迁移逻辑的全部jar包。</li>
</ul>
<p><a name="databaseMigration"></a><strong>Database migration</strong>  </p>
<p><strong>数据库迁移</strong><strong></strong>  </p>
<p>It is possible to migrate the data in the jBPM 3 database tables to the Activiti database schema. To do this, following properties files must be changed to point at the right database:  </p>
<p>将jBPM3数据库表迁移到Activiti数据库schema是有可能的。为了完成这个任务，必须改变下面的properties文件，指向正确的数据库：  </p>
<ul>
    <li><strong>jbpm3.db.properties</strong>: contains the parameters to connect to the jBPM 3 database. Also the Hibernate dialect must be provided.  </li>
    <li><strong>jbpm3.db.properties</strong>:包含了连接jBPM3数据库的参数。也必须提供Hibernate方言。  </li>
    <li><strong>activiti.db.properties</strong>: contains the parameters to connect to database to which the migrated data will be written. This can be the same database schema as the jBPM schema (ie. there are no name-clashes between jBPM and Activiti tables, indexes, foreign keyes, etc).  </li>
    <li><strong>activiti.db.properties</strong>: 包含了迁移将要写入数据库的连接参数。这个可能是和jBPM相同数据库schema（例如，在jBPM和Activiti数据库表名，索引名，外键名等等没有冲突）.</li>
</ul>
<p>The database migration will use the data in the jBPM 3 tables to:  </p>
<p>数据迁移将使用jBPM3数据库表的数据来做：  </p>
<ul>
    <li>Convert the process definition to the BPMN 2.0 counterpart. This means that the converted process definition will be deployed to the Activiti tables as part of the migration. As a side-effect, it will also produce the BPMN 2.0 XML files, similar to what happens when executing the<a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/4fd8a2bbdc9e_131C8/index_9.html">process conversion</a>.  </li>
    <li>转换流程定义为BPMN 2.0对应物。这意味着转换之后的流程定义将作为迁移的一部分被部署到Activiti的数据库表。作为副作用，它也产生BPMN 2.0 XML文件，这和当执行流程转换时所发生的事相似。  </li>
    <li>Migrate runtime and history data of the processes to the Activiti tables. <strong>In this release, this is not yet implemented!</strong>  </li>
    <li>迁移流程的运行时和历史数据到Activiti数据库表。<strong>本次发布，这没有实现！</strong></li>
</ul>
<p>The data is retrieved from the jBPM 3 tables using Hibernate queries and the Hibernate mappings of jBPM itself.  </p>
<p>使用Hibernate查询和jBPM自身的Hibernate映  </p>
<p>射，可以从jBPM 3数据库表里检索到这些数据。  </p>
<p><a name="processConversion"></a><strong>Process conversion</strong>  </p>
<p><strong>流程转换</strong><strong></strong>  </p>
<p>It is possible to only convert the process definitions xml from JPDL to BPMN 2.0 that can be executed on the Activiti engine. To do this, place the jBPM 3 processes inside the processes folder. There can be any number of (nested) subfolders, the tool will scan every (sub)folder inside processes to discover processdefinition.xml files (file name must be processdefinition.xml!).  </p>
<p>只将JPDL的流程定义xml转换为能在Activiti引擎执行的BPMN 2.0是有可能的。为了完成这个任务，请将jBPM 3放置到process 文件夹。可以有任何数量（内置）子文件夹，工具将扫描process每个（子）文件夹，来发现processdefinition.xml文件（文件名必须是processfinition.xml!）。  </p>
<p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/4fd8a2bbdc9e_131C8/migration.processes.location_2.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="migration.processes.location" border="0" alt="migration.processes.location" src="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/4fd8a2bbdc9e_131C8/migration.processes.location_thumb.png" width="593" height="154" /></a>  </p>
<p>The discovered processes will be parsed and deployed to an in-memory databse, such that the logic of reverse engineering the process definition from the jBPM deployment tables contained in <a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/4fd8a2bbdc9e_131C8/index_10.html">the database migration</a> is used for both cases.  </p>
<p>被发现的流程将被解析并部署到一个内存数据库，以便对包含在数据库迁移的jBPM部署数据库表的流程定义进行反向工程，以为解析和部署之用。  </p>
<p>Once the jBPM 3 processes are placed in the processes folder, execute the convert.processes target in the root of the unzipped migration tool folder:  </p>
<p>一旦jBPM 3流程被放置到process文件夹，那么执行在解压之后的迁移工具文件夹根目录下的convert.processes目标。  </p>
<p>ant convert.processes  </p>
<p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/4fd8a2bbdc9e_131C8/migration.ant.convert.processes_2.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="migration.ant.convert.processes" border="0" alt="migration.ant.convert.processes" src="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/4fd8a2bbdc9e_131C8/migration.ant.convert.processes_thumb.png" width="469" height="66" /></a>  </p>
<p>During conversion, you will see plenty logging passing by describing where and how the process conversion is being executed. At the end of the conversion, you will see following logging appear:  </p>
<p>在转换过程中，通过描述流程转换执行是何地和何时转换的方式，可以观察到大量的日志。在转换的末尾，将观察到下列日志出现：  </p>
<p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/4fd8a2bbdc9e_131C8/migration.process.conversion.completed_2.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="migration.process.conversion.completed" border="0" alt="migration.process.conversion.completed" src="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/4fd8a2bbdc9e_131C8/migration.process.conversion.completed_thumb.png" width="700" height="136" /></a>  </p>
<p>As shown in the logging, the resulting BPMN 2.0 processes can be find in the converted-process-xxxx folder, where the xxxx is the timestamp of the conversion.  </p>
<p>正如日志所示，BPMN 2.0流程的结果可以在converted-process-xxxx文件夹里找到，这里xxxx是转换的时间戳。  </p>
<p>In this release, only limited support for start, end, wait state and task-nodes is implemented. In the future, this coverage will expand.  </p>
<p>在本次发布里，只实现了对开始，结束，等待和任务节点的有限支持。在将来，这个覆盖范围将要扩充。
</p><img src ="http://www.blogjava.net/lewhwa/aggbug/345911.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lewhwa/" target="_blank">网路冷眼@BlogJava</a> 2011-03-07 23:23 <a href="http://www.blogjava.net/lewhwa/archive/2011/03/07/345911.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Activiti User Guide（Activiti用户指南)-Chapter 17. Activiti KickStart</title><link>http://www.blogjava.net/lewhwa/archive/2011/01/10/342729.html</link><dc:creator>网路冷眼@BlogJava</dc:creator><author>网路冷眼@BlogJava</author><pubDate>Mon, 10 Jan 2011 12:58:00 GMT</pubDate><guid>http://www.blogjava.net/lewhwa/archive/2011/01/10/342729.html</guid><wfw:comment>http://www.blogjava.net/lewhwa/comments/342729.html</wfw:comment><comments>http://www.blogjava.net/lewhwa/archive/2011/01/10/342729.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/lewhwa/comments/commentRss/342729.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lewhwa/services/trackbacks/342729.html</trackback:ping><description><![CDATA[<p><strong>Chapter 17. Activiti KickStart</strong> </p>
<p><strong>Table of Contents</strong> </p>
<p><a href="http://activiti.org/userguide/index.html#N11DFE">Overview</a>（概述） </p>
<p><a href="http://activiti.org/userguide/index.html#N11E52">Changing the database</a>（变更数据库） </p>
<p><a name="N11DFE"></a><strong>Overview</strong><strong>（概述）</strong><strong></strong> </p>
<p>Activiti KickStart is a webbased tool to quickly create 'adhoc' business processes using a subset of constructs available to the Activiti engine. KickStart provides a simple UI that doesn't require to learn BPMN or any modeling environment, as it works with concepts that are familiar to every business user. However, the processes that are created using KickStart, are fully BPMN 2.0 compliant and can be used as a starting point for more complex BPM endeavours. </p>
<p>Activiti KickStart的是一个基于Web的工具，用Activiti引擎可用的构件（constructs）的子集提供给快速创建&#8220;即席（adhoc）&#8221;的业务流程。Kickstart提供了不必学习BPMN或者任何建模环境的简单UI，因为它树立了每个业务用户都熟悉的概念。但是，通过KickStart创建的的流程，是和BPMN 2.0兼容，并可作为更为复杂BPM努力的起点。 </p>
<p>KickStart integrates perfectly with the Activiti engine. As such, processes created with KickStart are immediataly usable in Activiti Explorer and are visible in Probe. </p>
<p>KickStart能和Activiti引擎完美集成。因此，采用KickStart创建的流程在Activiti Explorer立即可用，并在Probe里面可见。 </p>
<p>KickStart serves many business cases, but the following three are probably the most common: </p>
<p>KickStart服务许多商业案例，但以下三个可能是最常见： </p>
<ul>
    <li><strong>Simple business processes: </strong>some processes are just simple by nature, and every company has them. Think about an expense process, a holiday leave process, a hiring process, etc... These kind of processes are probably already being done using paper or e-mail. KickStart allows to model these processes quickly and change them whenever it is needed. As such, KickStart really lowers the threshold to automate these business processes. </li>
    <li><strong>简单的业务流程</strong>：一些流程天然简单，并且每个公司都有。考虑到付费流程，请假流程，雇佣流程，等等&#8230;这些流程用书面或者e-mail的方式已经完成。Kickstart运行快速对这些流程建模，每当需要时改变它们。因此，Kickstart真正地降低了门槛，并让这些业务流程自动化。 </li>
    <li><strong>Prototyping: </strong>before diving into complex BPMN 2.0 modeling and thinking about the corner cases of the process, it is often wise to get all people involved aligned and work out a prototype that shows the vision of what needs to be done. KickStart allows to do exatcly that: create a business process prototype on the fly, to get your ideas visible for everyone. </li>
    <li><strong>原型</strong>：在钻研复杂的BPMN 2.0建模和考虑流程的偏例之前，它往往是明智的，让所有参与的人平等，制定一个原型来展示所要完成的愿景。KickStart的允许恰恰如此：创建一个业务流程的原型，让大家看到你的想法。 </li>
    <li><strong>Adhoc work: </strong>in some cases, coordination is required between different people or groups in a company. You know how it normally goes: sending an email here, doing a telephone there ... which often ends up in a tar pit of nobody knowing what or when something needs to be done. However, a business process management platform such as Activiti is an excellent way of distributing and follow-up everything, as it is intended to track exactly such things. KickStart allows you to create processes for adhoc work in a matter of minutes, and distribute and coordinate tasks between people easily. </li>
    <li><strong>即席工作</strong>：在一些情况，在一个公司里，不同的人员或组之间的协作是必要的。您知道正常时如何运作的：在这里发送邮件，在那里打电话&#8230;这经常终止于没有人知道需要完成什么或者何时完成这样的焦油坑。但是，诸如Activiti这样的业务流程管理平台是解决分发和后续事情的卓越解决之道，因为它的目的是准确跟踪这些事情。Kickstart允许您在数分钟之内创建即席工作的流程，并在人们之间分发和协调任务。</li>
</ul>
<p>Following screenshots show the capabilities of Activiti KickStart. Take for example the next picture. It shows how an expense process is created in a matter of a few minutes. </p>
<p>下列屏幕截图展示了Activiti KickStart的能力。下图作为示例。它展示如何在几分钟之内创建一个付费流程。 </p>
<p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/Activiti-User-GuideActivit.-Introduction_1258B/clip_image002_2.gif"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="clip_image002" border="0" alt="clip_image002" src="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/Activiti-User-GuideActivit.-Introduction_1258B/clip_image002_thumb.gif" width="926" height="435" /></a> </p>
<p>After clicking the save button, the process is immediately usable in Activiti Explorer: </p>
<p>在点击&#8220;保存&#8221;按钮之后，这个流程立即在Activiti Explorer可用。 </p>
<p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/Activiti-User-GuideActivit.-Introduction_1258B/clip_image004_2.jpg"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="clip_image004" border="0" alt="clip_image004" src="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/Activiti-User-GuideActivit.-Introduction_1258B/clip_image004_thumb.jpg" width="636" height="178" /></a> </p>
<p>KickStart also allows to define forms for every task: </p>
<p>KickStart也允许为每个任务定义表单： </p>
<p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/Activiti-User-GuideActivit.-Introduction_1258B/clip_image006_2.jpg"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="clip_image006" border="0" alt="clip_image006" src="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/Activiti-User-GuideActivit.-Introduction_1258B/clip_image006_thumb.jpg" width="650" height="332" /></a> </p>
<p>Which are obviously directly usable in Activiti Explorer: </p>
<p>这些明显直接在Activiti Explorer可用： </p>
<p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/Activiti-User-GuideActivit.-Introduction_1258B/clip_image008_2.jpg"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="clip_image008" border="0" alt="clip_image008" src="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/Activiti-User-GuideActivit.-Introduction_1258B/clip_image008_thumb.jpg" width="647" height="300" /></a> </p>
<p>At any time during process creation, it is possible to view the corresponding BPMN 2.0 diagram of the business process: </p>
<p>在流程建立的任意时间，它可以查看相应的BPMN2.0业务流程图。 </p>
<p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/Activiti-User-GuideActivit.-Introduction_1258B/clip_image010_2.jpg"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="clip_image010" border="0" alt="clip_image010" src="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/Activiti-User-GuideActivit.-Introduction_1258B/clip_image010_thumb.jpg" width="982" height="423" /></a> </p>
<p>Whenever it is required, the processes defined with KickStart can be opened up and modified: </p>
<p>每当它是必需，与KickStart的定义的流程可被打开和修改： </p>
<p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/Activiti-User-GuideActivit.-Introduction_1258B/clip_image012_2.jpg"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="clip_image012" border="0" alt="clip_image012" src="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/Activiti-User-GuideActivit.-Introduction_1258B/clip_image012_thumb.jpg" width="924" height="233" /></a> </p>
<p>Processes created with KickStart are fully compliant with the BPMN 2.0 XML, which means that the process can be imported into any BPMN 2.0 editor: </p>
<p>用KickStart的创建的流程是完全符合BPMN2.0的XML，这意味着该流程可以由任何兼容的BPMN2.0编辑器输入： </p>
<p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/Activiti-User-GuideActivit.-Introduction_1258B/clip_image014_2.jpg"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="clip_image014" border="0" alt="clip_image014" src="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/Activiti-User-GuideActivit.-Introduction_1258B/clip_image014_thumb.jpg" width="923" height="438" /></a> </p>
<p><a name="N11E52" style="width: 20px; height: 20px; text-indent: 20px; background-image: url(http://www.blogjava.net/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); background-repeat: no-repeat no-repeat; "></a><strong>Changing the database</strong><strong>（变更数据库）</strong><strong></strong> </p>
<p>Activiti KickStart is currently not yet using the REST API, but uses the service API by including the Activiti engine as a library. While Explorer, Probe and Cycle use the same mechanism for changing the database (see <a href="http://activiti.org/userguide/index.html#changingTheDatabase">here</a>), the same does not yet apply for KickStart. </p>
<p>Activiti KickStart当前还没有使用REST API，而是通过包括了Activiti引擎作为类库使用服务API。虽然Explorer，Probe和Cycle使用相同的机制改变数据（参见<a href="http://activiti.org/userguide/index.html#changingTheDatabase">这里</a>），但这不适于KickStart。 </p>
<p>To change the database that KickStart uses in the demo setup, generate a new activiti.cfg.jar, and place it in the apps/apache-tomcat-6.x/webapps/activiti-kickstart/WEB-INF/lib folder. </p>
<p>为了改变演示安装里KickStart使用的数据库，产生一个新的activiti.cfg.jar,并将它放置到apps/apache-tomcat-6.x/webapps/activiti-kickstart/WEB-INF/lib文件夹。
</p><img src ="http://www.blogjava.net/lewhwa/aggbug/342729.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lewhwa/" target="_blank">网路冷眼@BlogJava</a> 2011-01-10 20:58 <a href="http://www.blogjava.net/lewhwa/archive/2011/01/10/342729.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Activiti in Action（实战Activiti）-第一章 BPMN 2.0: what&amp;rsquo;s in it for developers?（11）</title><link>http://www.blogjava.net/lewhwa/archive/2011/01/08/342571.html</link><dc:creator>网路冷眼@BlogJava</dc:creator><author>网路冷眼@BlogJava</author><pubDate>Sat, 08 Jan 2011 03:49:00 GMT</pubDate><guid>http://www.blogjava.net/lewhwa/archive/2011/01/08/342571.html</guid><wfw:comment>http://www.blogjava.net/lewhwa/comments/342571.html</wfw:comment><comments>http://www.blogjava.net/lewhwa/archive/2011/01/08/342571.html#Feedback</comments><slash:comments>5</slash:comments><wfw:commentRss>http://www.blogjava.net/lewhwa/comments/commentRss/342571.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lewhwa/services/trackbacks/342571.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要:  随着符合BPMN 2.0标准的BPMS流程引擎Activiti 5.0正式版推出，由Tijs Rademakers 和 Ron Van Liempd编写的‘实战Activiti’书籍昨天在“Manning Early Access Program”现身。目前第一章释出，可以先睹为快。呵呵，真棒！本篇是第一章之（11）&nbsp;&nbsp;<a href='http://www.blogjava.net/lewhwa/archive/2011/01/08/342571.html'>阅读全文</a><img src ="http://www.blogjava.net/lewhwa/aggbug/342571.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lewhwa/" target="_blank">网路冷眼@BlogJava</a> 2011-01-08 11:49 <a href="http://www.blogjava.net/lewhwa/archive/2011/01/08/342571.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Activiti in Action（实战Activiti）-第一章 BPMN 2.0: what&amp;rsquo;s in it for developers?（10）</title><link>http://www.blogjava.net/lewhwa/archive/2011/01/06/342454.html</link><dc:creator>网路冷眼@BlogJava</dc:creator><author>网路冷眼@BlogJava</author><pubDate>Thu, 06 Jan 2011 13:26:00 GMT</pubDate><guid>http://www.blogjava.net/lewhwa/archive/2011/01/06/342454.html</guid><wfw:comment>http://www.blogjava.net/lewhwa/comments/342454.html</wfw:comment><comments>http://www.blogjava.net/lewhwa/archive/2011/01/06/342454.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/lewhwa/comments/commentRss/342454.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lewhwa/services/trackbacks/342454.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要:  随着符合BPMN 2.0标准的BPMS流程引擎Activiti 5.0正式版推出，由Tijs Rademakers 和 Ron Van Liempd编写的‘实战Activiti’书籍昨天在“Manning Early Access Program”现身。目前第一章释出，可以先睹为快。呵呵，真棒！本篇是第一章之（10）&nbsp;&nbsp;<a href='http://www.blogjava.net/lewhwa/archive/2011/01/06/342454.html'>阅读全文</a><img src ="http://www.blogjava.net/lewhwa/aggbug/342454.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lewhwa/" target="_blank">网路冷眼@BlogJava</a> 2011-01-06 21:26 <a href="http://www.blogjava.net/lewhwa/archive/2011/01/06/342454.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Activiti in Action（实战Activiti）-第一章 BPMN 2.0: what&amp;rsquo;s in it for developers?（9）</title><link>http://www.blogjava.net/lewhwa/archive/2011/01/05/342376.html</link><dc:creator>网路冷眼@BlogJava</dc:creator><author>网路冷眼@BlogJava</author><pubDate>Wed, 05 Jan 2011 13:01:00 GMT</pubDate><guid>http://www.blogjava.net/lewhwa/archive/2011/01/05/342376.html</guid><wfw:comment>http://www.blogjava.net/lewhwa/comments/342376.html</wfw:comment><comments>http://www.blogjava.net/lewhwa/archive/2011/01/05/342376.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/lewhwa/comments/commentRss/342376.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lewhwa/services/trackbacks/342376.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要:  随着符合BPMN 2.0标准的BPMS流程引擎Activiti 5.0正式版推出，由Tijs Rademakers 和 Ron Van Liempd编写的‘实战Activiti’书籍昨天在“Manning Early Access Program”现身。目前第一章释出，可以先睹为快。呵呵，真棒！本篇是第一章之（9）&nbsp;&nbsp;<a href='http://www.blogjava.net/lewhwa/archive/2011/01/05/342376.html'>阅读全文</a><img src ="http://www.blogjava.net/lewhwa/aggbug/342376.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lewhwa/" target="_blank">网路冷眼@BlogJava</a> 2011-01-05 21:01 <a href="http://www.blogjava.net/lewhwa/archive/2011/01/05/342376.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Activiti in Action（实战Activiti）-第一章 BPMN 2.0: what&amp;rsquo;s in it for developers?（8）</title><link>http://www.blogjava.net/lewhwa/archive/2011/01/04/342322.html</link><dc:creator>网路冷眼@BlogJava</dc:creator><author>网路冷眼@BlogJava</author><pubDate>Tue, 04 Jan 2011 15:12:00 GMT</pubDate><guid>http://www.blogjava.net/lewhwa/archive/2011/01/04/342322.html</guid><wfw:comment>http://www.blogjava.net/lewhwa/comments/342322.html</wfw:comment><comments>http://www.blogjava.net/lewhwa/archive/2011/01/04/342322.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/lewhwa/comments/commentRss/342322.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lewhwa/services/trackbacks/342322.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要:  随着符合BPMN 2.0标准的BPMS流程引擎Activiti 5.0正式版推出，由Tijs Rademakers 和 Ron Van Liempd编写的‘实战Activiti’书籍昨天在“Manning Early Access Program”现身。目前第一章释出，可以先睹为快。呵呵，真棒！本篇是第一章之（8）&nbsp;&nbsp;<a href='http://www.blogjava.net/lewhwa/archive/2011/01/04/342322.html'>阅读全文</a><img src ="http://www.blogjava.net/lewhwa/aggbug/342322.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lewhwa/" target="_blank">网路冷眼@BlogJava</a> 2011-01-04 23:12 <a href="http://www.blogjava.net/lewhwa/archive/2011/01/04/342322.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Activiti in Action（实战Activiti）-第一章 BPMN 2.0: what&amp;rsquo;s in it for developers?（7）</title><link>http://www.blogjava.net/lewhwa/archive/2011/01/04/342304.html</link><dc:creator>网路冷眼@BlogJava</dc:creator><author>网路冷眼@BlogJava</author><pubDate>Tue, 04 Jan 2011 12:43:00 GMT</pubDate><guid>http://www.blogjava.net/lewhwa/archive/2011/01/04/342304.html</guid><wfw:comment>http://www.blogjava.net/lewhwa/comments/342304.html</wfw:comment><comments>http://www.blogjava.net/lewhwa/archive/2011/01/04/342304.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/lewhwa/comments/commentRss/342304.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lewhwa/services/trackbacks/342304.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要:  随着符合BPMN 2.0标准的BPMS流程引擎Activiti 5.0正式版推出，由Tijs Rademakers 和 Ron Van Liempd编写的‘实战Activiti’书籍昨天在“Manning Early Access Program”现身。目前第一章释出，可以先睹为快。呵呵，真棒！本篇是第一章之（7）&nbsp;&nbsp;<a href='http://www.blogjava.net/lewhwa/archive/2011/01/04/342304.html'>阅读全文</a><img src ="http://www.blogjava.net/lewhwa/aggbug/342304.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lewhwa/" target="_blank">网路冷眼@BlogJava</a> 2011-01-04 20:43 <a href="http://www.blogjava.net/lewhwa/archive/2011/01/04/342304.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Activiti in Action（实战Activiti）-第一章 BPMN 2.0: what&amp;rsquo;s in it for developers?（6）</title><link>http://www.blogjava.net/lewhwa/archive/2011/01/03/342208.html</link><dc:creator>网路冷眼@BlogJava</dc:creator><author>网路冷眼@BlogJava</author><pubDate>Mon, 03 Jan 2011 09:59:00 GMT</pubDate><guid>http://www.blogjava.net/lewhwa/archive/2011/01/03/342208.html</guid><wfw:comment>http://www.blogjava.net/lewhwa/comments/342208.html</wfw:comment><comments>http://www.blogjava.net/lewhwa/archive/2011/01/03/342208.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/lewhwa/comments/commentRss/342208.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lewhwa/services/trackbacks/342208.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要:  随着符合BPMN 2.0标准的BPMS流程引擎Activiti 5.0正式版推出，由Tijs Rademakers 和 Ron Van Liempd编写的‘实战Activiti’书籍昨天在“Manning Early Access Program”现身。目前第一章释出，可以先睹为快。呵呵，真棒！本篇是第一章之（6）&nbsp;&nbsp;<a href='http://www.blogjava.net/lewhwa/archive/2011/01/03/342208.html'>阅读全文</a><img src ="http://www.blogjava.net/lewhwa/aggbug/342208.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lewhwa/" target="_blank">网路冷眼@BlogJava</a> 2011-01-03 17:59 <a href="http://www.blogjava.net/lewhwa/archive/2011/01/03/342208.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Activiti in Action（实战Activiti）-第一章 BPMN 2.0: what&amp;rsquo;s in it for developers?（5）</title><link>http://www.blogjava.net/lewhwa/archive/2011/01/03/342199.html</link><dc:creator>网路冷眼@BlogJava</dc:creator><author>网路冷眼@BlogJava</author><pubDate>Mon, 03 Jan 2011 08:06:00 GMT</pubDate><guid>http://www.blogjava.net/lewhwa/archive/2011/01/03/342199.html</guid><wfw:comment>http://www.blogjava.net/lewhwa/comments/342199.html</wfw:comment><comments>http://www.blogjava.net/lewhwa/archive/2011/01/03/342199.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/lewhwa/comments/commentRss/342199.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lewhwa/services/trackbacks/342199.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要:  随着符合BPMN 2.0标准的BPMS流程引擎Activiti 5.0正式版推出，由Tijs Rademakers 和 Ron Van Liempd编写的‘实战Activiti’书籍昨天在“Manning Early Access Program”现身。目前第一章释出，可以先睹为快。呵呵，真棒！本篇是第一章之（5）&nbsp;&nbsp;<a href='http://www.blogjava.net/lewhwa/archive/2011/01/03/342199.html'>阅读全文</a><img src ="http://www.blogjava.net/lewhwa/aggbug/342199.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lewhwa/" target="_blank">网路冷眼@BlogJava</a> 2011-01-03 16:06 <a href="http://www.blogjava.net/lewhwa/archive/2011/01/03/342199.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Activiti in Action（实战Activiti）-第一章 BPMN 2.0: what&amp;rsquo;s in it for developers?（4）</title><link>http://www.blogjava.net/lewhwa/archive/2011/01/02/342173.html</link><dc:creator>网路冷眼@BlogJava</dc:creator><author>网路冷眼@BlogJava</author><pubDate>Sun, 02 Jan 2011 14:39:00 GMT</pubDate><guid>http://www.blogjava.net/lewhwa/archive/2011/01/02/342173.html</guid><wfw:comment>http://www.blogjava.net/lewhwa/comments/342173.html</wfw:comment><comments>http://www.blogjava.net/lewhwa/archive/2011/01/02/342173.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/lewhwa/comments/commentRss/342173.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lewhwa/services/trackbacks/342173.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要:  随着符合BPMN 2.0标准的BPMS流程引擎Activiti 5.0正式版推出，由Tijs Rademakers 和 Ron Van Liempd编写的‘实战Activiti’书籍昨天在“Manning Early Access Program”现身。目前第一章释出，可以先睹为快。呵呵，真棒！本篇是第一章之（4）&nbsp;&nbsp;<a href='http://www.blogjava.net/lewhwa/archive/2011/01/02/342173.html'>阅读全文</a><img src ="http://www.blogjava.net/lewhwa/aggbug/342173.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lewhwa/" target="_blank">网路冷眼@BlogJava</a> 2011-01-02 22:39 <a href="http://www.blogjava.net/lewhwa/archive/2011/01/02/342173.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Activiti in Action（实战Activiti）-第一章 BPMN 2.0: what&amp;rsquo;s in it for developers?（3）</title><link>http://www.blogjava.net/lewhwa/archive/2011/01/01/342136.html</link><dc:creator>网路冷眼@BlogJava</dc:creator><author>网路冷眼@BlogJava</author><pubDate>Sat, 01 Jan 2011 14:52:00 GMT</pubDate><guid>http://www.blogjava.net/lewhwa/archive/2011/01/01/342136.html</guid><wfw:comment>http://www.blogjava.net/lewhwa/comments/342136.html</wfw:comment><comments>http://www.blogjava.net/lewhwa/archive/2011/01/01/342136.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/lewhwa/comments/commentRss/342136.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lewhwa/services/trackbacks/342136.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要:  随着符合BPMN 2.0标准的BPMS流程引擎Activiti 5.0正式版推出，由Tijs Rademakers 和 Ron Van Liempd编写的‘实战Activiti’书籍昨天在“Manning Early Access Program”现身。目前第一章释出，可以先睹为快。呵呵，真棒！本篇是第一章之（3）&nbsp;&nbsp;<a href='http://www.blogjava.net/lewhwa/archive/2011/01/01/342136.html'>阅读全文</a><img src ="http://www.blogjava.net/lewhwa/aggbug/342136.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lewhwa/" target="_blank">网路冷眼@BlogJava</a> 2011-01-01 22:52 <a href="http://www.blogjava.net/lewhwa/archive/2011/01/01/342136.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Activiti in Action（实战Activiti）-第一章 BPMN 2.0: what&amp;rsquo;s in it for developers?（2）</title><link>http://www.blogjava.net/lewhwa/archive/2011/01/01/342119.html</link><dc:creator>网路冷眼@BlogJava</dc:creator><author>网路冷眼@BlogJava</author><pubDate>Sat, 01 Jan 2011 07:40:00 GMT</pubDate><guid>http://www.blogjava.net/lewhwa/archive/2011/01/01/342119.html</guid><wfw:comment>http://www.blogjava.net/lewhwa/comments/342119.html</wfw:comment><comments>http://www.blogjava.net/lewhwa/archive/2011/01/01/342119.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/lewhwa/comments/commentRss/342119.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lewhwa/services/trackbacks/342119.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要:  随着符合BPMN 2.0标准的BPMS流程引擎Activiti 5.0正式版推出，由Tijs Rademakers 和 Ron Van Liempd编写的‘实战Activiti’书籍昨天在“Manning Early Access Program”现身。目前第一章释出，可以先睹为快。呵呵，真棒！本篇是第一章之（2）&nbsp;&nbsp;<a href='http://www.blogjava.net/lewhwa/archive/2011/01/01/342119.html'>阅读全文</a><img src ="http://www.blogjava.net/lewhwa/aggbug/342119.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lewhwa/" target="_blank">网路冷眼@BlogJava</a> 2011-01-01 15:40 <a href="http://www.blogjava.net/lewhwa/archive/2011/01/01/342119.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Activiti in Action（实战Activiti）-第一章 BPMN 2.0: what&amp;rsquo;s in it for developers?（1）</title><link>http://www.blogjava.net/lewhwa/archive/2010/12/18/341075.html</link><dc:creator>网路冷眼@BlogJava</dc:creator><author>网路冷眼@BlogJava</author><pubDate>Sat, 18 Dec 2010 13:54:00 GMT</pubDate><guid>http://www.blogjava.net/lewhwa/archive/2010/12/18/341075.html</guid><wfw:comment>http://www.blogjava.net/lewhwa/comments/341075.html</wfw:comment><comments>http://www.blogjava.net/lewhwa/archive/2010/12/18/341075.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/lewhwa/comments/commentRss/341075.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lewhwa/services/trackbacks/341075.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要:  随着符合BPMN 2.0标准的BPMS流程引擎Activiti 5.0正式版推出，由Tijs Rademakers 和 Ron Van Liempd编写的‘实战Activiti’书籍昨天在“Manning Early Access Program”现身。目前第一章释出，可以先睹为快。呵呵，真棒！本篇是第一章之（1）&nbsp;&nbsp;<a href='http://www.blogjava.net/lewhwa/archive/2010/12/18/341075.html'>阅读全文</a><img src ="http://www.blogjava.net/lewhwa/aggbug/341075.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lewhwa/" target="_blank">网路冷眼@BlogJava</a> 2010-12-18 21:54 <a href="http://www.blogjava.net/lewhwa/archive/2010/12/18/341075.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Activiti in Action（实战Activiti）-目录</title><link>http://www.blogjava.net/lewhwa/archive/2010/12/16/340933.html</link><dc:creator>网路冷眼@BlogJava</dc:creator><author>网路冷眼@BlogJava</author><pubDate>Thu, 16 Dec 2010 14:33:00 GMT</pubDate><guid>http://www.blogjava.net/lewhwa/archive/2010/12/16/340933.html</guid><wfw:comment>http://www.blogjava.net/lewhwa/comments/340933.html</wfw:comment><comments>http://www.blogjava.net/lewhwa/archive/2010/12/16/340933.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/lewhwa/comments/commentRss/340933.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lewhwa/services/trackbacks/340933.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要:  随着符合BPMN 2.0标准的BPMS流程引擎Activiti 5.0正式版推出，由Tijs Rademakers 和 Ron Van Liempd编写的‘实战Activiti’书籍昨天在“Manning Early Access Program”现身。目前第一章释出，可以先睹为快。呵呵，真棒！本文是该书的目录。&nbsp;&nbsp;<a href='http://www.blogjava.net/lewhwa/archive/2010/12/16/340933.html'>阅读全文</a><img src ="http://www.blogjava.net/lewhwa/aggbug/340933.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lewhwa/" target="_blank">网路冷眼@BlogJava</a> 2010-12-16 22:33 <a href="http://www.blogjava.net/lewhwa/archive/2010/12/16/340933.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Activiti Components（Activiti组件）</title><link>http://www.blogjava.net/lewhwa/archive/2010/12/14/340697.html</link><dc:creator>网路冷眼@BlogJava</dc:creator><author>网路冷眼@BlogJava</author><pubDate>Tue, 14 Dec 2010 12:56:00 GMT</pubDate><guid>http://www.blogjava.net/lewhwa/archive/2010/12/14/340697.html</guid><wfw:comment>http://www.blogjava.net/lewhwa/comments/340697.html</wfw:comment><comments>http://www.blogjava.net/lewhwa/archive/2010/12/14/340697.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.blogjava.net/lewhwa/comments/commentRss/340697.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lewhwa/services/trackbacks/340697.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: Activiti是一个轻量级的工作流和业务流程管理（BPM，Business Process Management）平台。其项目主管及首席架构师为Tom Baeyens，原jBPM的创始人，Activiti为Tom另一力作。Activiti为业务人员提供Activiti Cycle工具，为开发人员提供Activiti 引擎，为系统管理员提供Activiti Probe（Activiti 探针，一个系统平台治理工具）。它的核心是一个针对Java平台基于BPMN 2的原生流程引擎，快若闪电，坚若磐石。它是开源软件，采用Apache许可分发。Activiti可运行在任何Java应用程序：在服务器，在集群，甚至在云计算环境均可运行。它可和Spring完美集成，体型轻盈（lightweight），概念简洁。本文是对它所包含组件的介绍。&nbsp;&nbsp;<a href='http://www.blogjava.net/lewhwa/archive/2010/12/14/340697.html'>阅读全文</a><img src ="http://www.blogjava.net/lewhwa/aggbug/340697.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lewhwa/" target="_blank">网路冷眼@BlogJava</a> 2010-12-14 20:56 <a href="http://www.blogjava.net/lewhwa/archive/2010/12/14/340697.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>流程周期层（The Process Cycle Layer）</title><link>http://www.blogjava.net/lewhwa/archive/2010/12/13/340551.html</link><dc:creator>网路冷眼@BlogJava</dc:creator><author>网路冷眼@BlogJava</author><pubDate>Mon, 13 Dec 2010 13:40:00 GMT</pubDate><guid>http://www.blogjava.net/lewhwa/archive/2010/12/13/340551.html</guid><wfw:comment>http://www.blogjava.net/lewhwa/comments/340551.html</wfw:comment><comments>http://www.blogjava.net/lewhwa/archive/2010/12/13/340551.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/lewhwa/comments/commentRss/340551.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lewhwa/services/trackbacks/340551.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: Activiti是一个轻量级的工作流和业务流程管理（BPM，Business Process Management）平台。其项目主管为Tom Baeyens，原jBPM的创始人，Activiti为Tom另一力作。Activiti为业务人员提供Activiti Cycle工具，为开发人员提供Activiti 引擎，为系统管理员提供Activiti Probe（Activiti 探针，一个系统平台治理工具）。它的核心是一个针对Java平台基于BPMN 2的原生流程引擎，快若闪电，坚若磐石。它是开源软件，采用Apache许可分发。Activiti可运行在任何Java应用程序：在服务器，在集群，甚至在云计算环境均可运行。它可和Spring完美集成，体型轻盈（lightweight），概念简洁。本文是Activiti网站上一篇文章“The Process Cycle Layer”的翻译。&nbsp;&nbsp;<a href='http://www.blogjava.net/lewhwa/archive/2010/12/13/340551.html'>阅读全文</a><img src ="http://www.blogjava.net/lewhwa/aggbug/340551.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lewhwa/" target="_blank">网路冷眼@BlogJava</a> 2010-12-13 21:40 <a href="http://www.blogjava.net/lewhwa/archive/2010/12/13/340551.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>关于Activiti的常见问题（翻译）</title><link>http://www.blogjava.net/lewhwa/archive/2010/12/11/340365.html</link><dc:creator>网路冷眼@BlogJava</dc:creator><author>网路冷眼@BlogJava</author><pubDate>Sat, 11 Dec 2010 12:40:00 GMT</pubDate><guid>http://www.blogjava.net/lewhwa/archive/2010/12/11/340365.html</guid><wfw:comment>http://www.blogjava.net/lewhwa/comments/340365.html</wfw:comment><comments>http://www.blogjava.net/lewhwa/archive/2010/12/11/340365.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/lewhwa/comments/commentRss/340365.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lewhwa/services/trackbacks/340365.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 摘要: Activiti是一个轻量级的工作流和业务流程管理（BPM，Business Process Management）平台。其项目主管为Tom Baeyens，原jBPM的创始人，Activiti为Tom另一力作。Activiti为业务人员提供Activiti Cycle工具，为开发人员提供Activiti 引擎，为系统管理员提供Activiti Probe（Activiti 探针，一个系统平台治理工具）。它的核心是一个针对Java平台基于BPMN 2的原生流程引擎，快若闪电，坚若磐石。它是开源软件，采用Apache许可分发。Activiti可运行在任何Java应用程序：在服务器，在集群，甚至在云计算环境均可运行。它可和Spring完美集成，体型轻盈（lightweight），概念简洁。本文是Activiti网站上FAQ的翻译。 &nbsp;&nbsp;<a href='http://www.blogjava.net/lewhwa/archive/2010/12/11/340365.html'>阅读全文</a><img src ="http://www.blogjava.net/lewhwa/aggbug/340365.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lewhwa/" target="_blank">网路冷眼@BlogJava</a> 2010-12-11 20:40 <a href="http://www.blogjava.net/lewhwa/archive/2010/12/11/340365.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Activiti User Guide（Activiti用户指南)-Chapter 1. Introduction（简介）</title><link>http://www.blogjava.net/lewhwa/archive/2010/12/05/339825.html</link><dc:creator>网路冷眼@BlogJava</dc:creator><author>网路冷眼@BlogJava</author><pubDate>Sat, 04 Dec 2010 17:37:00 GMT</pubDate><guid>http://www.blogjava.net/lewhwa/archive/2010/12/05/339825.html</guid><wfw:comment>http://www.blogjava.net/lewhwa/comments/339825.html</wfw:comment><comments>http://www.blogjava.net/lewhwa/archive/2010/12/05/339825.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/lewhwa/comments/commentRss/339825.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lewhwa/services/trackbacks/339825.html</trackback:ping><description><![CDATA[<h4>Chapter 1. Introduction（简介）</h4>
<p><strong>Table of Contents</strong> </p>
<dl> <dt><a href="file:///G:/作品/userguide/src/Zh_CN.html/#license">License（授权）</a>  </dt><dt><a href="file:///G:/作品/userguide/src/Zh_CN.html/#download">Download（下载）</a>  </dt><dt><a href="file:///G:/作品/userguide/src/Zh_CN.html/#sources">Sources（源代码）</a>  </dt><dt><a href="file:///G:/作品/userguide/src/Zh_CN.html/#required.software">Required software（依赖的软件）</a>  </dt><dt><a href="file:///G:/作品/userguide/src/Zh_CN.html/#reporting.problems">Reporting problems（报告问题）</a>  </dt><dt><a href="file:///G:/作品/userguide/src/Zh_CN.html/#experimental">Experimental features（实验性特性）</a></dt></dl>
<h4><a name="license"></a>License（授权）</h4>
<p>Activiti is distributed under <a href="file:///G:/作品/userguide/license.txt">the Apache V2 license</a>. </p>
<h4><a name="download"></a>Download（下载）</h4>
<p><a href="http://activiti.org/download.html">http://activiti.org/download.html</a> </p>
<h4><a name="sources"></a>Sources（源代码）</h4>
<p>The distribution contains most of the sources as jar files. To find and build the full source codebase, please read the <a href="http://docs.codehaus.org/display/ACT/Developers+Guide#DevelopersGuide-Buildingthedistribution">'Building the distribution' wiki page</a> </p>
<h4><a name="required.software"></a>Required software（依赖的软件）</h4>
<ul>
    <li>
    <p>JVM 5+</p>
    </li>
    <li>
    <p>Ant 1.7.1+</p>
    </li>
</ul>
<h4><a name="reporting.problems"></a>Reporting problems（报告问题）</h4>
<p>Every self respecting developer should have read <a href="http://www.catb.org/~esr/faqs/smart-questions.html">How to ask questions the smart way</a> </p>
<p>每个自重的开发人与应当阅读 <a href="http://www.catb.org/~esr/faqs/smart-questions.html">How to ask questions the smart way</a> 。 </p>
<p>After you've done that you can post questions and comments on <a href="http://forums.activiti.org/en/viewforum.php?f=3">the Users forum</a> and create issues in <a href="http://jira.codehaus.org/browse/ACT">our JIRA issue tracker</a> </p>
<p>在<a href="http://forums.activiti.org/en/viewforum.php?f=3">the Users forum</a>上完成粘贴问题和意见之后，在<a href="http://jira.codehaus.org/browse/ACT">our JIRA issue tracker</a> 上建立问题（issues). </p>
<h4><a name="experimental"></a>Experimental features（实验性特性）</h4>
<p>Sections marked with <strong>[EXPERIMENTAL]</strong> should not be considered stable. </p>
<p>（标记为 <strong>[EXPERIMENTAL]</strong> 的小节应当视为不稳定的。</p><img src ="http://www.blogjava.net/lewhwa/aggbug/339825.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lewhwa/" target="_blank">网路冷眼@BlogJava</a> 2010-12-05 01:37 <a href="http://www.blogjava.net/lewhwa/archive/2010/12/05/339825.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Activiti User Guide（Activiti用户指南)-Chapter 2. Getting Started（入门指南）</title><link>http://www.blogjava.net/lewhwa/archive/2010/12/05/339824.html</link><dc:creator>网路冷眼@BlogJava</dc:creator><author>网路冷眼@BlogJava</author><pubDate>Sat, 04 Dec 2010 17:35:00 GMT</pubDate><guid>http://www.blogjava.net/lewhwa/archive/2010/12/05/339824.html</guid><wfw:comment>http://www.blogjava.net/lewhwa/comments/339824.html</wfw:comment><comments>http://www.blogjava.net/lewhwa/archive/2010/12/05/339824.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/lewhwa/comments/commentRss/339824.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lewhwa/services/trackbacks/339824.html</trackback:ping><description><![CDATA[<h4>Chapter 2. Getting Started（入门指南）</h4> <p><b>Table of Contents</b> <dl> <dt><a href="file:///G:/作品/userguide/src/Zh_CN.html/#demo.setup">Demo setup（安装演示）</a>  <dt><a href="file:///G:/作品/userguide/src/Zh_CN.html/#examples">Example projects in the workspace（工作区里的示例项目）</a>  <dt><a href="file:///G:/作品/userguide/src/Zh_CN.html/#librarydependencies">Library dependencies（库依赖）</a>  <dt><a href="file:///G:/作品/userguide/src/Zh_CN.html/#eclipsesetup">Eclipse setup（Eclipse下的安装）</a>  <dt><a href="file:///G:/作品/userguide/src/Zh_CN.html/#inspecting.database">Inspecting the database（检查数据库）</a></dt></dl> <h4><a name="demo.setup"></a>Demo setup（安装演示）</h4> <p>Setup is an ant script located in directory <code>setup</code> that helps you get up and running with Activiti quickly. <p>安装是一个放置在目录里的脚本。它帮助用户快速建立并运行Activiti。 <p>To run the script, you'll need a working <a href="http://java.sun.com/javase/downloads/index.jsp">Java runtime</a> and <a href="http://ant.apache.org/bindownload.cgi">Ant</a> installation. Also make sure that the <em>JAVA_HOME</em> and <em>ANT_HOME</em> system variables are correctly set. The way to do this depends on your operating system, but the <a href="http://ant.apache.org/manual/install.html">manual of ant</a> gives a description on how to do this. The demo setup script is tested with Ant 1.7.1. <p>为了运行脚本，需要一个可以工作的安装。也要确保<em>JAVA_HOME</em> 和 <em>ANT_HOME</em>系统变量设置正确。虽然具体的设置方式根据操作系统不同而相异，但是为如何完成这些设置提供了描述。演示安装脚本在下测试通过。 <p>To configure setup for your environment, update property files <code>build.properties</code> and <code>build.{your-database}.properties</code> . Check those files for more information on configurable properties and potential values. <p>为了针对你的环境配置安装，请更新属性文件<code>build.properties</code> 和 <code>build.{your-database}.properties</code>。为了获取更多可配置属性和潜在的值的信息，请仔细检查这些文件。 <p>The easiest target to get started is open a command prompt in de <code>setup</code> folder and type: <p>入门最容易的目标是在setup文件夹打开一个命令提示并键入：<pre>ant demo.start</pre>
<p>This target will start tomcat and if you're using h2, it will also start the h2 database. The first time when that is executed, it will also perform the installation:
<p>这个目标将启动Tomcat。如果正在使用H2数据库，它也将启动H2数据库。若是第一次执行安装，它也将执行下列安装：
<ul>
<li>
<p>(*) Build the webapps. All libraries are stored in <code>${actviti.home}/setup/files/dependencies/libs</code> The webapps without the libs are stored in <code>${actviti.home}/setup/files/webapps</code>. Building the webapps means that webapps are combined with the necessary libraries in <code>${actviti.home}/setup/build/webapps</code>
<p>(*)构建webapps。所有的库保存在<code>${actviti.home}/setup/files/dependencies/libs</code>。没带库的保存在<code>${actviti.home}/setup/files/webapps</code>。构建意味着在组合webapp和必须的库在<code>${actviti.home}/setup/build/webapps</code>目录里。</p>
<li>
<p>(*) Install the H2 in ${activiti.home}/apps/h2. This only happens if you're using h2 as your database. H2 is the default database.
<p>(*) 将H2安装至目录里。只是采用H2数据库时才发生。H2是缺省的数据库。</p>
<li>
<p>Start the H2 database. Again, this is only done if using h2 as the database. If you're using a different database it is assumed that it is already up and running.
<p>启动H2数据库。对了，如果采用H2数据库时，才完成这一步。如果采用不同的数据库，那么假定数据库已经启动并运行了。</p>
<li>
<p>(*) Create the Activiti tables in the database
<p>(*) 在数据库里建立Activiti库表</p>
<li>
<p>(*) Insert the demo users and groups in the Activiti identity tables (see below)
<p>(*) 将示例用户和组插入到 Activiti identity表（见下）。</p>
<li>
<p>(*) Deploy the example processes to the Activiti Engine DB
<p>(*) 将示例流程部署至Activiti Engine DB。</p>
<li>
<p>(*) Download Tomcat if not available in the ${downloads.dir}
<p>(*) 如果在目录里面没有Tomcat，就下载Tomcat</p>
<li>
<p>(*) Install Tomcat in ${activiti.home}/apps/apache-tomcat-${tomcat.version}
<p>(*) 将Tomcat安装至${activiti.home}/apps/apache-tomcat-${tomcat.version}</p>
<li>
<p>(*) Create an Activiti configuration jar
<p>建立一个 Activiti 配置jar包</p>
<li>
<p>(*) Deploy the REST interface webapp into tomcat
<p>(*)部署REST接口webapp值Tomcat</p>
<li>
<p>(*) Download the Activiti Modeler webapp to ${activiti.home}/webapps
<p>(*) 将Activiti Modeler webapp下载至${activiti.home}/webapps目录。</p>
<li>
<p>(*) Deploy the Probe, Explorer and Modeler webapps into tomcat.
<p>(*) 将Probe, Explorer and Modeler webapps部署至Tomcat。</p>
<li>
<p>Start tomcat
<p>启动Tomcat</p></li></ul>
<p>(*) only performed the first time when running <code>ant demo.start</code>
<p>After running this target H2 and Tomcat will be running in the background. To stop those processes run <code>ant demo.stop</code>.
<p>The other targets in that build script can also be called individually and they will take the configurable properties into account. Run <code>ant -p</code> for more details.
<p>在运行目标H2之后，Tomcat将在后台运行。为了停止这些进程，请运行 <code>ant demo.stop</code>。在构建脚本里的其它目标也能够单个调用。它们将考虑考虑可配置属性。详情可以运行<code>ant -p</code> 得到。
<p>These are the demo users:
<p>这些事示例用户：
<p><a name="id507751"></a>
<p><b>Table 1.1. The demo users（示例用户）</b>
<p>UserId<br>Password<br>Security roles
<p>kermit<br>kermit<br>admin
<p>gonzo<br>gonzo<br>manager
<p>fozzie<br>fozzie<br>user
<p>Now you can access following web applications:
<p>现在，你能访问下列web 应用程序:
<p><a name="id507835"></a>
<p><b>Table 1.2. The webapp tools（webapp工具）</b>
<p>Webapp Name<br>URL<br>Description
<p>Activiti Probe<br><a href="http://localhost:8080/activiti-probe">http://localhost:8080/activiti-probe</a><br>The admin management console. Use this tool to see if the configured process engine is correctly initialized, DB tables contents.
<p>Activiti Explorer<br><a href="http://localhost:8080/activiti-explorer">http://localhost:8080/activiti-explorer</a><br>The process engine user console. Use this tool to view your personal and candidate task lists and to complete tasks.
<p>Activiti Cycle<br><a href="http://localhost:8080/activiti-cycle">http://localhost:8080/activiti-cycle</a><br>The process cycle layer. Use this to browse repositories, execute transformations between model formats.
<p>Activiti Modeler powered by Signavio<br><a href="http://localhost:8080/activiti-modeler">http://localhost:8080/activiti-modeler</a><br>The web based process designer tool. Use this tool to graphically author BPMN 2.0 compliant process definitions files.
<p>Note that the Activiti demo setup is a way of showing the capabilities and functionality of Activiti as easy and as fast as possible. This does however, <strong>not</strong> mean that it is the only way of using Activiti. As Activiti is 'just a jar', it can be embedded in any Java environment: with swing or on a Tomcat, JBoss, WebSphere, etc. Or you could very well choose to run Activiti as a typical, standalone BPM server. If it is possible in Java, it is possible with Activiti!
<p>注意Activiti示例安装时为了尽快，尽容易展现Activiti功能和能力的一种方式。但是这并不意味着这是采用Activiti的唯一方式。Activiti只是一个jar包，它可以嵌入到任何Java环境：Swing或者Tomcat，JBoss,WebSphere等等。或者你能选择将Activiti作为一个典型的，独立的BPM服务器。Java若在，Activiti就在！
<h4><a name="examples"></a>Example projects in the workspace（工作区里的示例项目）</h4>
<p>The distribution contains a workspace directory containing a couple of example java projects:
<p>发行包包含一个许多java项目的工作区目录。
<ul>
<li>
<p><strong>activiti-engine-examples</strong>: This set of examples show the most common usage of Activiti: BPMN process definitions and process executions are stored in a DB and the examples make use of the persistent API.
<p>This project contains the eclipse project files, an ant build file and a maven pom file. The ant build file is independent of the maven pom. Both are there to show how you can use ant and maven respectively for building and deploying processes as part of your build.
<p><strong>activiti-engine-examples</strong>: 把这一系列示例展示了Activiti的通用用法：保存在DB里的BPMN流程定义和流程执行。还有持久化API使用的示例。
<p>这个项目包含了eclipse的项目文件，一个ant构建文件和一个maven pom文件。ant 构建文件和maven pom文件相互独立。作为你的构建部分，为了构建和部署流程，两者展示了能够使用ant和maven进行构建。</p>
<li>
<p><strong>activiti-spring-examples</strong>: These examples show how you can use the Activiti Engine in a Spring environment.
<p><strong>activiti-spring-examples</strong>: 这些示例展示在Spring环境下如何使用Activiti引擎。</p>
<li>
<p><strong>activiti-groovy-examples</strong>: These examples show the library dependencies for groovy and an example process with groovy scripting.
<p><strong>activiti-groovy-examples</strong>: dd这些示例展示了groovy的依赖库和用groovy脚本处理的示例流程。</p>
<li>
<p><strong>activiti-jpa-examples</strong>: These examples show library dependencies and how you can work with JPA in Activiti.
<p><strong>activiti-jpa-examples</strong>: 这些示例展示了JPA的依赖库，以及在Activiti里采用JPA是如何工作的。</p>
<li>
<p><strong>activiti-cycle-examples</strong>: This is a project containing an demo example project for Activiti Cycle
<p><strong>activiti-cycle-examples</strong>: 这是一个包含针对Activiti Cycle的示例项目。</p>
<li>
<p><strong>activiti-modeler-examples</strong>: This is a file based model repository to which the Activiti Modeler is configured in the demo setup.
<p><strong>activiti-modeler-examples</strong>: 
<p><strong>activiti-modeler-examples</strong>: 这是一个在示例安装里配置Activiti Modeler所需的基于模型的仓库。</p></li></ul>
<p><a href="file:///G:/作品/userguide/src/Zh_CN.html/#eclipsesetup">the section called “Eclipse setup（Eclipse下的安装）”</a> shows how you can set up your eclipse environment to play with these example projects.
<p><a href="file:///G:/作品/userguide/src/Zh_CN.html/#eclipsesetup">the section called “Eclipse setup（Eclipse下的安装）”</a> 展示了如何安装eclipse环境来熟悉这些示例项目。
<p>As part of the <code>demo.start</code>, the examples will be inflated. This means that all the libs and configuration files will be put in place. If you don't run the <code>demo.start</code> and you want to inflate the examples with libs in the appropriate place, run this command in the setup directory:
<p>作为 <code>demo.start</code>的部分，将展开这些事例。 这意味着所有的库和配置文件将安置就位。如果不运行<code>demo.start</code>而将示例和库展开到合适的位置，运行安装目录下的这个命令：<pre>ant inflate.examples</pre>
<p>Once you've done that the <code>activiti-engine-examples</code> and <code>activiti-spring-examples</code> will contain <code>libs-runtime</code> and <code>libs-test</code> directories containing the runtime dependency jars and test time dependency jars respectively.
<p>一旦完，将包含 <code>activiti-engine-examples 成<code>activiti-spring-examples</code></code>目录。这些目录相应地包含而来运行时所依赖的jar包和测试时依赖的jar包。
<h4><a name="librarydependencies"></a>Library dependencies（库依赖）</h4>
<p>In order to prevent that the distribution file becomes too big by libraries that are included multiple times, all the libraries are grouped into a single directory somewhere in the <code>setup/files</code>.
<p>吧为了防止由于库包含多次而使发布文件变得太大，所有的库被分组到setup/files下单个的目录。
<p>The ant scripts in the <code>setup/build.xml</code> can inflate the examples (target <code>inflate.examples</code>) with the libs and they will include the appropriate libs when building the webapps.
<p>在 <code>setup/build.xml</code>文件里面的ant 脚本能够展开示例 (target <code>inflate.examples</code>) 及其库。当构建webapp时，它们将包含合适的库。
<p>All the libs are located in <code>setup/files/dependencies/libs</code> And the following files in <code>setup/files/dependencies</code> describe the library dependencies:
<p>所有库放置在 <code>setup/files/dependencies/libs</code> ，并且在<code>setup/files/dependencies</code> 目录里下列文件描述了库依赖：
<ul>
<li>
<p><code>libs.engine.runtime.txt</code>: The library runtime dependencies to run the Activiti Engine.
<p><code>libs.engine.runtime.txt</code>: 运行Activiti引擎的运行时依赖库。</p>
<li>
<p><code>libs.engine.runtime.test.txt</code>: The libraries that need to be added to the ones in <code>libs.engine.runtime.txt</code> to run the tests
<p><code>libs.engine.runtime.test.txt</code>: 为了运行测试，需要加入到<code>libs.engine.runtime.txt</code> 的库</p>
<li>
<p><code>libs.engine.runtime.feature.groovy.txt</code>: The libraries that need to be added to the ones in <code>libs.engine.runtime.txt</code> to use the groovy scripting capabilities.
<p><code>libs.engine.runtime.feature.groovy.txt</code>: 为了使用groovy脚本能力，需要加入到<code>libs.engine.runtime.txt</code> 的库。</p>
<li>
<p><code>libs.engine.runtime.txt</code>: The libraries that need to be added to the ones in <code>libs.engine.runtime.txt</code> to use the JPA variable reference capabilities.
<p><code>libs.engine.runtime.txt</code>: 为了使用JPA变量引用能力，需要加入到<code>libs.engine.runtime.txt</code> 的库。</p>
<li>
<p><code>libs.spring.runtime.txt</code>: The library runtime dependencies to run the Activiti Engine in a Spring environment. (This list includes the libs in <code>libs.engine.runtime.txt</code>)
<p><code>libs.spring.runtime.txt</code>: 在Spring环境下运行Activiti引擎的运行期依赖库。（这个列表包含了<code>libs.engine.runtime.txt</code>）</p>
<li>
<p><code>libs.spring.runtime.test.txt</code>: The libraries that need to be added to the ones in <code>libs.spring.runtime.txt</code> to run tests in a Spring environment
<p><code>libs.spring.runtime.test.txt</code>: 在Spring环境下，为了测试，需要加入到<code>libs.spring.runtime.txt</code> 下的库。</p>
<li>
<p><code>libs.cycle.runtime.test.txt</code>, <code>libs.webapp.rest.txt</code> and <code>libs.webapp.ui.txt</code>: The full list of libraries dependencies for the respective components cycle, the rest webapp and the UI webapps like Activiti Explorer, Activiti Probe and Activiti Cycle
<p><code>libs.cycle.runtime.test.txt</code>, <code>libs.webapp.rest.txt</code>和 <code>libs.webapp.ui.txt</code>: 相关组件cycle，rest webapp和像Activiti Explorer, Activiti Probe 和 Activiti Cycle之类的UI Webapp所需依赖库的全部列表。 </p></li></ul>
<h4><a name="eclipsesetup"></a>Eclipse setup（Eclipse下的安装）</h4>
<p>To run and play with the examples in your eclipse, follow these simple instructions:
<p>为了在eclipse里运行示例，遵从这些简单的指令：
<p>File --&gt; Import...
<p>File --&gt; Import...
<p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/1c1311a3ebca_1611/eclipsesetup.import.existing.projects_2.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="eclipsesetup.import.existing.projects" border="0" alt="eclipsesetup.import.existing.projects" src="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/1c1311a3ebca_1611/eclipsesetup.import.existing.projects_thumb.png" width="225" height="244"></a>
<p>Select <code>General --&gt; Existing Projects into Workspace</code> and click <code>Next</code>
<p>选择 <code>General --&gt; Existing Projects into Workspace</code>并点击<code>Next</code>
<p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/1c1311a3ebca_1611/eclipsesetup.import_2.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="eclipsesetup.import" border="0" alt="eclipsesetup.import" src="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/1c1311a3ebca_1611/eclipsesetup.import_thumb.png" width="244" height="136"></a>
<p>Click 'Browse...', select the directory <code>${activiti.home}/workspace</code> and you'll see the example projects being automatically selected.
<p>点击 'Browse...'，选择目录 <code>${activiti.home}/workspace</code> ，那么将自动选择示例项目。
<p>Then you can click <code>Finish</code> in the Import dialog and you're all set.
<p>吧然后你在输出对话框能点击按钮，所有都设置好了。
<p>For more convenience, open the ant view (Window --&gt; Show View --&gt; Ant) and drag the file <code>activiti-engine-examples/build.xml</code> into the ant window. Now you'll be able to activate the build targets by just double clicking on them.
<p>为了更加方便起见，打开ant视图（Window --&gt; Show View --&gt; Ant）并将文件拽至ant窗口。通过在它们上面双击，现在你能激活构建目标。
<p>If you want BPMN 2.0 XML auto-completion and validation while typing, you can add the BPMN 2.0 XML Schema to the XML catalog. Go to <code>Preferences --&gt; XML --&gt; XML Catalog --&gt; Add</code>, and select the XML Schema from the file system in the folder <code>docs/xsd/BPMN20.xsd</code>.
<p>如果你想当输入时，BPMN 2.0 XML自动完成和校验，可以将BPMN 2.0 XML Schema 加入到XML分类里面。导航至<code>Preferences --&gt; XML --&gt; XML Catalog --&gt; Add</code>，从文件系统里的文件夹里的<code>docs/xsd/BPMN20.xsd</code>选择XML Schema。
<p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/1c1311a3ebca_1611/eclipse.setup.xml.catalog_2.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="eclipse.setup.xml.catalog" border="0" alt="eclipse.setup.xml.catalog" src="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/1c1311a3ebca_1611/eclipse.setup.xml.catalog_thumb.png" width="244" height="160"></a>
<h4><a name="inspecting.database"></a>Inspecting the database（检查数据库）</h4>
<p>To check out the database while trying out the demo setup, run the following Ant target in the <em>setup</em> folder:
<p>当尝试示例安装时，为了检查数据库，运行在文件夹下的Ant目标：<pre>ant h2.console.start</pre>
<p>This will boot the H2 web console. Note that the Ant target doesn't return, so a <em>'CTRL + C'</em> is required to shutdown the console. Fill in the following URL in the <em>JDBC URL</em> field and click connect:
<p>这将引导H2 Web控制台。注意Ant 目标并不返回，所以为了关闭控制台，需要键入<em>'CTRL + C'</em>。在 <em>JDBC URL</em>字段里填入URL，并点击“connect”：<pre>jdbc:h2:tcp://localhost/activiti</pre>
<p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/1c1311a3ebca_1611/h2.console.login_2.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="h2.console.login" border="0" alt="h2.console.login" src="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/1c1311a3ebca_1611/h2.console.login_thumb.png" width="244" height="157"></a>
<p>You are now able to browse the Activiti database schema and check the content of the tables.
<p>现在你能浏览Activiti数据库结构并检查数据库表里面的内容。
<p>To change the database, see ???
<p>为了改变数据库，参见 ???。<img src ="http://www.blogjava.net/lewhwa/aggbug/339824.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lewhwa/" target="_blank">网路冷眼@BlogJava</a> 2010-12-05 01:35 <a href="http://www.blogjava.net/lewhwa/archive/2010/12/05/339824.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Activiti User Guide（Activiti用户指南)-Chapter 3. Configuration（配置）</title><link>http://www.blogjava.net/lewhwa/archive/2010/12/05/339823.html</link><dc:creator>网路冷眼@BlogJava</dc:creator><author>网路冷眼@BlogJava</author><pubDate>Sat, 04 Dec 2010 17:32:00 GMT</pubDate><guid>http://www.blogjava.net/lewhwa/archive/2010/12/05/339823.html</guid><wfw:comment>http://www.blogjava.net/lewhwa/comments/339823.html</wfw:comment><comments>http://www.blogjava.net/lewhwa/archive/2010/12/05/339823.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/lewhwa/comments/commentRss/339823.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lewhwa/services/trackbacks/339823.html</trackback:ping><description><![CDATA[<h4>Chapter 3. Configuration（配置）</h4>
<p><strong>Table of Contents</strong> </p>
<dl> <dt><a href="file:///G:/作品/userguide/src/Zh_CN.html/#configuration">Creating a ProcessEngine（建立一个流程引擎）</a>  </dt><dt><a href="file:///G:/作品/userguide/src/Zh_CN.html/#configurationRoot">ProcessEngineConfiguration bean</a>  </dt><dt><a href="file:///G:/作品/userguide/src/Zh_CN.html/#databaseConfiguration">Database configuration（数据库配置）</a>  </dt><dt><a href="file:///G:/作品/userguide/src/Zh_CN.html/#jobExecutorConfiguration">Job executor activation（作业执行器激活）</a>  </dt><dt><a href="file:///G:/作品/userguide/src/Zh_CN.html/#mailServerConfiguration">Mail server configuration（邮件服务器配置）</a>  </dt><dt><a href="file:///G:/作品/userguide/src/Zh_CN.html/#historyConfiguration">History configuration（历史配置）</a>  </dt><dt><a href="file:///G:/作品/userguide/src/Zh_CN.html/#supporteddatabases">Supported databases（支持的数据库）</a>  </dt><dt><a href="file:///G:/作品/userguide/src/Zh_CN.html/#changingTheDatabase">Changing the database（改变数据库）</a>  </dt><dt><a href="file:///G:/作品/userguide/src/Zh_CN.html/#downloadingTheOracleDriver">Downloading the Oracle driver（下载Oracle）</a></dt></dl>
<h4><a name="configuration"></a>Creating a ProcessEngine（建立一个流程引擎）</h4>
<p>The Activiti process engine is configured through a xml file called <code>activiti.cfg.xml</code>. Note that this is <strong>not</strong> applicable if you're using <a href="file:///G:/作品/userguide/src/Zh_CN.html/#">the Spring style of building a process engine</a>. </p>
<p>Activiti流程引擎通过一个叫做的xml文件来配置。注意你采用构建流程引擎的Spring风格的方式<a href="file:///G:/作品/userguide/src/Zh_CN.html/#">the Spring style of building a process engine</a>，这种方式并不适合 </p>
<p>The easiest way to obtain a <code>ProcessEngine</code>, is to use the <code>org.activiti.engine.ProcessEngines</code> class: </p>
<p>获取ProcessEngine最容易的方式是使用<code>org.activiti.engine.ProcessEngines</code>类：</p>
<pre>ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine()</pre>
<p>This will look for an <code>activiti.cfg.xml</code> file on the classpath and construct an engine based on the configuration in that file. The following snippet shows an example configuration. The following sections will give a detailed overview of the configuration properties.
</p>
<p>这将在classpath上寻找 <code>activiti.cfg.xml</code>文件，并在那个文件的配置之上构建一个引擎。下列片段显示了一个示例配置。下面部分将给出详细的配置特性的总体概观。</p>
<pre>&lt;beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans   http://www.springframework.org/schema/beans/spring-beans.xsd"&gt;
&lt;bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration"&gt;
&lt;property name="databaseType" value="h2" /&gt;
&lt;property name="jdbcUrl" value="jdbc:h2:mem:activiti;DB_CLOSE_DELAY=1000" /&gt;
&lt;property name="jdbcDriver" value="org.h2.Driver" /&gt;
&lt;property name="jdbcUsername" value="sa" /&gt;
&lt;property name="jdbcPassword" value="" /&gt;
&lt;property name="databaseSchemaUpdate" value="true" /&gt;
&lt;property name="jobExecutorActivate" value="false" /&gt;
&lt;property name="mailServerHost" value="mail.my-corp.com" /&gt;
&lt;property name="mailServerPort" value="5025" /&gt;
&lt;/bean&gt;
&lt;/beans&gt;</pre>
<p>Note that the configuration xml is in fact a Spring configuration. <strong>This does not mean that Activiti can only be used in a Spring environment!</strong> We are simply leveraging the parsing and dependency injection capabilitities of Spring internally for building up the engine.
</p>
<p>注意配置文件事实上是一个Spring配置。<strong>这并不意味着Activiti只能在Spring环境下使用! </strong>为了构建引擎，我们在内部简单地平衡了解析和Spring的依赖注入的能力。
</p>
<p>The ProcessEngineConfiguration object can also be created programmatically using the configuration file. It is also possible to use a different bean id (eg. see line 3).
</p>
<p>通过使用配置文件，也能通过编程方式建立ProcessEngineConfiguration对象。使用一个不同的bean id也是可能的。（例如，见第3行）。</p>
<pre>ProcessEngineConfiguration.createProcessEngineConfigurationFromResourceDefault();
ProcessEngineConfiguration.createProcessEngineConfigurationFromResource(String resource);
ProcessEngineConfiguration.createProcessEngineConfigurationFromResource(String resource, String beanName);
ProcessEngineConfiguration.createProcessEngineConfigurationFromInputStream(InputStream inputStream);
ProcessEngineConfiguration.createProcessEngineConfigurationFromInputStream(InputStream inputStream, String beanName);</pre>
<p>It is also possible not to use a configuration file, and create a configuration based on defaults (see <a href="file:///G:/作品/userguide/src/Zh_CN.html/#configurationClasses">the different supported classes</a> for more information).
</p>
<p>不使用配置文件也是可能的，基于缺省建立一个配置（详情参见不同支持的类（<a href="file:///G:/作品/userguide/src/Zh_CN.html/#configurationClasses">the different supported classes</a>））</p>
<pre>ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration();
ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration();</pre>
<p>All these <code>ProcessEngineConfiguration.createXXX()</code> methods return a <code>ProcessEngineConfiguration</code> that can further be tweaked if needed. After calling the <code>buildProcessEngine()</code> operation, a<code>ProcessEngine</code> is created:
</p>
<p>如果需要所有 <code>ProcessEngineConfiguration.createXXX()</code>的方法返回一个能进一步配置的<code>ProcessEngineConfiguration</code> 。在调用操作之后，建立一个<code>ProcessEngine</code> 。</p>
<pre>ProcessEngine processEngine = ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration()
.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_FALSE)
.setJdbcUrl("jdbc:h2:mem:my-own-db;DB_CLOSE_DELAY=1000")
.setJobExecutorActivate(true)
.buildProcessEngine();</pre>
<h4><a name="configurationRoot"></a>ProcessEngineConfiguration bean</h4>
<p>The <code>activiti.cfg.xml</code> must contain a bean that has the id <code>'processEngineConfiguration'</code>.
</p>
<p>dd <code>activiti.cfg.xml</code> 必须包括具有id <code>'processEngineConfiguration'</code>的bean。</p>
<pre> &lt;bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration"&gt;</pre>
<p>This bean is then used to construct the <code>ProcessEngine</code>. There are multiple classes available that can be used to define the <code>processEngineConfiguration</code>. These classes represent different environments, and set defaults accordingly. It's a best practice to select the class the matches (the most) your environment, to minimalise the number of properties needed to configure the engine. Following classes are currently available (more will follow in future releases):
</p>
<p>得到这个bean然后用来构建e <code>ProcessEngine</code>。可以定义<code>processEngineConfiguration</code>的类有多个。这些类表示不同的环境，响应地设置为缺省。为了减少需要配置引擎的属性数量，选择的类以匹配环境是最佳实践。当前可获得的类如下（将来的版本将推出新的类）
</p>
<p><a name="configurationClasses"></a>
</p>
<ul>
    <li>
    <p><strong>org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration</strong>: the process engine is used in a standalone way. Activiti will take care of the transactions. By default, the database will only be checked when the engine boots (and an exception is thrown if there is no Activiti schema or the schema version is incorrect).
    </p>
    <p><strong>org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration</strong>:以独立方式运行的流程引擎。Activiti将考虑事务。缺省地，只有在引擎引导时检查数据库（如果没有Activiti schema或者schema版本不正确，将抛出异常）。</p>
    </li>
    <li>
    <p><strong>org.activiti.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration</strong>: this is a convience class for unit testing purposes. Activiti will take care of the transactions. An H2 in-memory database is used by default. The database will be created and dropped when the engine boots and shuts down. When using this, probably no additional configuration is needed (except when using for example the job executor or mail capabilities).
    </p>
    <p><strong>org.activiti.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration</strong>: 这是一个针对单元测试目的的便捷类。Activiti将考虑事务。缺省使用H2内存数据库。当引擎引导并关闭时，数据库将被建立和删除。当使用时，可能需要额外的配置（当使用作业执行器或者邮件能力的示例除外）</p>
    </li>
    <li>
    <p><strong>org.activiti.spring.SpringProcessEngineConfiguration</strong>: To be used when the process engine is used in a Spring environment. See <a href="file:///G:/作品/userguide/src/Zh_CN.html/#">the Spring integration section</a> for more information.
    </p>
    <p><strong>org.activiti.spring.SpringProcessEngineConfiguration</strong>: 当在Spring环境下使用流程引擎时使用。详情参见Spring集成部分<a href="file:///G:/作品/userguide/src/Zh_CN.html/#">the Spring integration section</a>。</p>
    </li>
    <li>
    <p><strong>org.activiti.engine.impl.cfg.JtaProcessEngineConfiguration</strong>: (<a href="file:///G:/作品/userguide/src/Zh_CN.html/#">[EXPERIMENTAL]</a>) to be used when the engine runs in standalone mode, with JTA transactions.
    </p>
    <p><strong>org.activiti.engine.impl.cfg.JtaProcessEngineConfiguration</strong>: (<a href="file:///G:/作品/userguide/src/Zh_CN.html/#">[EXPERIMENTAL]</a>)当引擎以带有JTA事务的单独模式运行时使用。</p>
    </li>
</ul>
<h4><a name="databaseConfiguration"></a>Database configuration（数据库配置）</h4>
<p>There are two ways to configure the database that the Activiti engine will use. The first option is to define the jdbc properties of the database:
</p>
<p>有两种方式类配置引擎将使用的数据库。第一个选项是定义数据库的jdbc属性：
</p>
<ul>
    <li>
    <p><strong>jdbcUrl</strong>: jdbc url of the database.
    </p>
    <p><strong>jdbcUrl</strong>: 数据库的jdbc url。</p>
    </li>
    <li>
    <p><strong>jdbcDriver</strong>: implementation of the driver for the specific database type.
    </p>
    <p><strong>jdbcDriver</strong>: 特定数据库驱动的实现。</p>
    </li>
    <li>
    <p><strong>jdbcUsername</strong>: username to connect to the database.
    </p>
    <p><strong>jdbcUsername</strong>: 连接到数据的用户名。</p>
    </li>
    <li>
    <p><strong>jdbcPassword</strong>: password to connect to the database.
    </p>
    <p><strong>jdbcPassword</strong>: 连接到数据库的密码。</p>
    </li>
</ul>
<p>The datasource that is constructed based on the provided jdbc properties will have the default <a href="http://www.mybatis.org/">MyBatis</a> connection pool settings. Following attributes can optionally be set to tweak that connection pool (taken from the MyBatis documentation):
</p>
<p>基于所提供的jdbc属性所构建的数据源将有的连接池设置。
</p>
<ul>
    <li>
    <p><strong>jdbcMaxActiveConnections</strong>: The number of active connections that the connection pool at maximum at any time can contain. Default is 10.
    </p>
    <p><strong>jdbcMaxActiveConnections</strong>: 在任何时刻连接池最大能够包含的可以激活的连接数。缺省为10.</p>
    </li>
    <li>
    <p><strong>jdbcMaxIdleConnections</strong>: The number of idle connections that the connection pool at maximum at any time can contain.
    </p>
    <p><strong>jdbcMaxIdleConnections</strong>:在任何时刻连接池最大能够包含的空闲的连接数</p>
    </li>
    <li>
    <p><strong>jdbcMaxCheckoutTime</strong>: The amount of time in milliseconds a connection can be 'checked out' from the connection pool before it is forcefully returned. Default is 20000 (20 seconds).
    </p>
    <p><strong>jdbcMaxCheckoutTime</strong>: 在连接强制返回之前，能够从连接池检出一个连接所需的以毫秒计算的时间值。</p>
    </li>
    <li>
    <p><strong>jdbcMaxWaitTime</strong>: This is a low level setting that gives the pool a chance to print a log status and re-attempt the acquisition of a connection in the case that it&#8217;s taking unusually long (to avoid failing silently forever if the pool is misconfigured) Default is 20000 (20 seconds).
    </p>
    <p><strong>jdbcMaxWaitTime</strong>: 这是一个底层的设置，给连接池一个打印日志状态并重试连接获取的机会。在这种情况下通常占用很长时间（以避免如果连接池位置不好导致导致悄无声息地失败），缺省时20000（20秒）。</p>
    </li>
</ul>
<p>Example database configuration:
</p>
<p>示例数据库配置：</p>
<pre>&lt;property name="databaseType" value="h2" /&gt;
&lt;property name="jdbcUrl" value="jdbc:h2:mem:activiti;DB_CLOSE_DELAY=1000" /&gt;
&lt;property name="jdbcDriver" value="org.h2.Driver" /&gt;
&lt;property name="jdbcUsername" value="sa" /&gt;
&lt;property name="jdbcPassword" value="" /&gt;
</pre>
<p>Alternatively, a <code>javax.sql.DataSource</code> implementation can be used (eg. DBCP from ):
</p>
<p>可选，可以使用 <code>javax.sql.DataSource</code>的实现（例如<a href="http://commons.apache.org/dbcp/">Apache Commons</a>的DBCP）：</p>
<pre>&lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" &gt;
&lt;property name="driverClassName" value="com.mysql.jdbc.Driver" /&gt;
&lt;property name="url" value="jdbc:mysql://localhost:3306/activiti" /&gt;
&lt;property name="username" value="activiti" /&gt;
&lt;property name="password" value="activiti" /&gt;
&lt;property name="defaultAutoCommit" value="false" /&gt;
&lt;/bean&gt;
&lt;bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration"&gt;
&lt;property name="dataSource" ref="dataSource" /&gt;
...
</pre>
<p>Note that Activiti does not ship with a library that allows to define such datasource. So you have to make sure that the libraries (eg. from DBCP) are on your classpath.
</p>
<p>注意Activiti并不包含允许定义如此数据源的Java库。所以，确保这些（例如，从DBCP而来）在你的classpath里面。
</p>
<p>Following properties can be set, regardless of using the jdbc or datasource approach:
</p>
<p>不管采用jdbc还是数据源方法，可以设置下列属性：
</p>
<ul>
    <li>
    <p><strong>databaseType</strong>: indicates the type of database. <strong>This property is required when not using the default H2 database</strong> This setting will determine which create/drop scripts and queries will be used. See <a href="file:///G:/作品/userguide/src/Zh_CN.html/#supporteddatabases">the 'supported databases' section</a> for an overview of which types are supported.
    </p>
    <p><strong>databaseType</strong>: 指示数据库类型。当不是采用缺省的H2数据库时xuyao 需要。这个设置将决定将要使用哪个建立/删除脚本。要了解支持哪些类型的概要，请参见<a href="file:///G:/作品/userguide/src/Zh_CN.html/#supporteddatabases">the 'supported databases' section</a> 。</p>
    </li>
    <li>
    <p><strong>databaseSchemaUpdate</strong>: allows to set the strategy to handle the database schema on process engine boot and shutdown.
    </p>
    <p><strong>databaseSchemaUpdate</strong>：允许当流程引擎引导和关闭时，设置处理数据库结构采取的策略。
    </p>
    <ul>
        <li>
        <p><code>false</code> (default): Checks the version of the DB schema against the library when the process engine is being created and throws an exception if the versions don't match.
        </p>
        <p><code>false</code> （缺省）：当流程引擎建立时，检查DB和库的版本。如果版本不匹配，将抛出异常。</p>
        </li>
        <li>
        <p><code>true</code>: Upon building of the process engine, a check is performed and an update of the schema is performed if it is necessary. If the schema doesn't exist, it is created.
        </p>
        <p><code>true</code>:一旦流程引擎构建完成，执行一个检查。如果有必要，更新数据库的结构。如果结构不存在，就创建它。</p>
        </li>
        <li>
        <p><code>create-drop</code>: Creates the schema when the process engine is being created and drops the schema when the process engine is being closed.
        </p>
        <p><code>create-drop</code>：在流程引擎创建时创建结构；当流程引擎时到达删除结构。</p>
        </li>
    </ul>
    </li>
</ul>
<h4><a name="jobExecutorConfiguration"></a>Job executor activation（作业执行器激活）</h4>
<p>The JobExecutor is a component that manages a couple of threads to fire timers (and later also asynchronous messages). For unit testing scenarios, it is cumbersome to work with multiple threads. Therefor the API allows to query for (<code>ManagementService.createJobQuery</code>) and execute jobs (<code>ManagementService.executeJob</code>) through the API so that job execution can be controlled from within a unit test. To avoid that the job executor interferes, it can be turned off.
</p>
<p>作业执行器是一个管理点火定时器一对线程的组件（之后也叫异步消息）。对于单元测试场景，和多个线程一道工作是麻烦的。所以API允许通过API查询 (<code>ManagementService.createJobQuery</code>) 并执行作业 (<code>ManagementService.executeJob</code>) 以便从一个单元测试里控制作业执行。为了避免作业干扰，可以关掉它。
</p>
<p>By default, the JobExecutor is activated when the process engine boots. Specify
</p>
<p>缺省地，当流程引擎引导时激活JobExecutor。指定</p>
<pre>&lt;property name="jobExecutorActivate" value="false" /&gt;</pre>
<p>when you don't want the JobExecutor to be activated upon process engine boot.
</p>
<p>当流程引擎引导时，并不想激活 JobExecutor。
</p>
<h4><a name="mailServerConfiguration"></a>Mail server configuration（邮件服务器配置）</h4>
<p>Optional. Activiti supports sending e-mails in business processes. To actually send an e-mail, a valid SMTP mail server configuration is required. See the <a href="file:///G:/作品/userguide/src/Zh_CN.html/#">e-mail task</a> for the configuration options.
</p>
<p>可选。. Activiti 支持在业务流程里发送电子邮件。事实上，为了发送邮件，需要配置一个有效的SMTP邮件服务器配置。这个配置可选项参见<a href="file:///G:/作品/userguide/src/Zh_CN.html/#">e-mail task</a> 。
</p>
<h4><a name="historyConfiguration"></a>History configuration（历史配置）</h4>
<p>Optional. Allows to tweak settings that influence the <a href="file:///G:/作品/userguide/src/Zh_CN.html/#">history capabilities</a> of the engine. See <a href="file:///G:/作品/userguide/src/Zh_CN.html/#">history configuration</a> for more details.
</p>
<p>可选项。允许影响引擎的历史能力<a href="file:///G:/作品/userguide/src/Zh_CN.html/#">history capabilities</a>的设置。详情参见<a href="file:///G:/作品/userguide/src/Zh_CN.html/#">history configuration</a> 。</p>
<pre>&lt;property name="history" value="audit" /&gt;</pre>
<h4><a name="supporteddatabases"></a>Supported databases（支持的数据库）</h4>
<p>Following are the types (case sensitive!) that Activiti uses to refer to databases.
</p>
<p>下表是Activiti所使用的数据库表类型（大小写敏感的）。
</p>
<p><a name="databaseTypes"></a>
</p>
<p><strong>Table 1.1. Supported databases</strong>
</p>
<p>Activiti database type<br />
Versions tested<br />
Notes
</p>
<p>h2<br />
1.2.132<br />
Default configured database
</p>
<p>mysql<br />
5.1.11
</p>
<p>oracle<br />
10.2.0
</p>
<p>postgres<br />
8.4
</p>
<p>db2<br />
not yet supported (coming soon, see <a href="http://jira.codehaus.org/browse/ACT-330">ACT-330</a>)
</p>
<p>mssql<br />
not yet supported (coming soon)
</p>
<h4><a name="changingTheDatabase"></a>Changing the database（改变数据库）</h4>
<p>One of the things you probably want to do at some point, is configuring Activiti to use a different database. To configure the demo setup or to generate a configuration file for a different database, follow these steps:
</p>
<p>在某些点你可能想做的其中一件事是配置来使用不同的数据库。为了配置演示安装或者为不同数据库产生一个配置文件，遵从这些步骤：
</p>
<ul>
    <li>
    <p>Edit <code>setup/build.properties</code> and change the <code>db</code> parameter to your type of database {<code>oracle | mysql | postgresql | h2</code>}.
    </p>
    <p>编辑 <code>setup/build.properties</code> 并将<code>db</code>参数变为你的数据库的类型 {<code>oracle | mysql | postgresql | h2</code>}。</p>
    </li>
    <li>
    <p>Edit <code>setup/build.${db}.properties</code> and change the JDBC connection parameters to those of your database installation.
    </p>
    <p>编辑<code>setup/build.${db}.properties</code>并将JDBC连接参数变为你所安装数据库的那些参数。</p>
    </li>
</ul>
<p>To create a configuration file for your database based on the properties you've specified in the build.*.properties files run
</p>
<p>为了建立一个基于你所指定build.*.properties 文件的属性的配置文件。请运行</p>
<pre>ant cfg.create</pre>
<p>from within the <code>setup</code> folder. The generate configuration file can now be found in <code>setup/build/activiti-cfg</code>. Also, for convenience, a jar called containing the configuration file can be found in <code>setup/build</code>
</p>
<p>在<code>setup</code> 文件夹。产生的配置文件在<code>setup/build/activiti-cfg</code>里能够找到。 为了方便起见，一个叫<code>activiti-cfg.jar</code>的jar包包含了能够在<code>setup/build</code> 里找到的配置文件。
</p>
<p>If you want to run the demo setup on another database, first stop the demo setup with
</p>
<p>如果你想在另一个数据库上运行演示安装，首先用下面的命令停止示例安装 </p>
<pre>ant demo.stop demo.clean demo.start</pre>
<p>Then clean and re-start the demo setup with
</p>
<p>然后清除并重新启动演示安装：</p>
<pre>ant demo.clean demo.start</pre>
<h4><a name="downloadingTheOracleDriver"></a>Downloading the Oracle driver（下载Oracle）</h4>
<p>When you want to run the demo setup using oracle as datasource, an extra step is required BEFORE you call the ant target <code>demo.start</code>.
</p>
<p>当你想使用oracle作为数据源来运行演示安装，在调用ant目标 <code>demo.start</code><strong>之<strong>前</strong></strong>，必须要有额外的步骤：
</p>
<ul>
    <li>
    <p>Since we cannot redistribute the Oracle JDBC driver due to its licence, you should download it manually: <a href="http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-112010-090769.html">http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-112010-090769.html</a>. Make sure you download ojdbc5.jar (our tests run against 10g ojdbc using version 11.2.0.1).
    </p>
    <p>因为由于Oracle JDBC Driver的授权原因，我们不能重新分发它，所以你应当手动下载：<a href="http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-112010-090769.html">http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-112010-090769.html</a>。确保下载的是ojdbc5.jar（）</p>
    </li>
    <li>
    <p>Copy the downloaded ojdbc5.jar to <code>setup/files/dependencies/libs/</code> This filename is
    </p>
    <p>拷贝下载的ojdbc5.jar至setup/files/dependencies/libs/。</p>
    </li>
</ul><img src ="http://www.blogjava.net/lewhwa/aggbug/339823.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lewhwa/" target="_blank">网路冷眼@BlogJava</a> 2010-12-05 01:32 <a href="http://www.blogjava.net/lewhwa/archive/2010/12/05/339823.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Activiti User Guide（Activiti用户指南)-Chapter 4. Spring integration（Spring集成）</title><link>http://www.blogjava.net/lewhwa/archive/2010/12/05/339822.html</link><dc:creator>网路冷眼@BlogJava</dc:creator><author>网路冷眼@BlogJava</author><pubDate>Sat, 04 Dec 2010 17:30:00 GMT</pubDate><guid>http://www.blogjava.net/lewhwa/archive/2010/12/05/339822.html</guid><wfw:comment>http://www.blogjava.net/lewhwa/comments/339822.html</wfw:comment><comments>http://www.blogjava.net/lewhwa/archive/2010/12/05/339822.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/lewhwa/comments/commentRss/339822.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lewhwa/services/trackbacks/339822.html</trackback:ping><description><![CDATA[<h4>Chapter 4. Spring integration（Spring集成）</h4>
<p><strong>Table of Contents</strong> </p>
<dl> <dt><a href="file:///G:/作品/userguide/src/Zh_CN.html/#id502309">ProcessEngineFactoryBean</a>  </dt><dt><a href="file:///G:/作品/userguide/src/Zh_CN.html/#id502371">Transactions（事务）</a>  </dt><dt><a href="file:///G:/作品/userguide/src/Zh_CN.html/#springExpressions">Expressions（表达式）</a>  </dt><dt><a href="file:///G:/作品/userguide/src/Zh_CN.html/#id502543">Automatic resource deployment（自动资源部署）</a>  </dt><dt><a href="file:///G:/作品/userguide/src/Zh_CN.html/#springUnitTest">Unit testing（单元测试）</a></dt></dl>
<p>While you definitely can use Activiti without Spring, we've provided some very nice integration features that are explained in this chapter. </p>
<p>尽管你肯定能够不用使用Spring而使用Activiti，但是本章将解释一些优秀的Spring集成特性。 </p>
<h4><a name="id502309"></a>ProcessEngineFactoryBean</h4>
<p>The <code>ProcessEngine</code> can be configured as a regular Spring bean. The starting point of the integration is the class <code>org.activiti.spring.ProcessEngineFactoryBean</code>. That bean takes a process engine configuration and creates the process engine. This means that the way and all configuration properties documented in the <a href="file:///G:/作品/userguide/src/Zh_CN.html/#">configuration section</a> are exactly the same as for Spring: </p>
<p><code>ProcessEngine</code>能够配置为一个普通的Spring bean。集成的开始点是类org.activiti.spring.ProcessEngineFactoryBean。那个bean提取一个流程并建立流程引擎。这意味着方法和所有在配置部分的归档的配置属性，完全和Spring相同：</p>
<pre>&lt;bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration"&gt;
...
&lt;/bean&gt;
&lt;bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean"&gt;
&lt;property name="processEngineConfiguration" ref="processEngineConfiguration" /&gt;
&lt;/bean&gt;
</pre>
<p>Do note that the <code>processEngineConfiguration</code> bean now uses the <code>org.activiti.spring.SpringProcessEngineConfiguration</code> class.
</p>
<p>一定要注意：processEngineConfiguration bean现在使用<code>org.activiti.spring.SpringProcessEngineConfiguration</code> 类。
</p>
<h4><a name="id502371"></a>Transactions（事务）</h4>
<p>We'll explain the <code>SpringTransactionIntegrationTest</code> found in the spring examples of the distribution step by step. Here is the spring configuration file that we use in this example (located in SpringTransactionIntegrationTest-context.xml). The quoted section contains the dataSource, transactionManager, processEngine and the Activiti Engine services.
</p>
<p>我们将一步一步地解释在发行包中的Spring示例的<code>SpringTransactionIntegrationTest</code> 。这里是这个示例里所使用的配置文件(位置在SpringTransactionIntegrationTest-context.xml）。引号部分包含了数据源，事务管理器，流程引擎和Activiti引擎服务。</p>
<pre>&lt;beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans   http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/tx      http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"&gt;
&lt;bean id="dataSource" class="org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy"&gt;
&lt;property name="targetDataSource"&gt;
&lt;bean class="org.springframework.jdbc.datasource.SimpleDriverDataSource"&gt;
&lt;property name="driverClass" value="org.h2.Driver" /&gt;
&lt;property name="url" value="jdbc:h2:mem:activiti;DB_CLOSE_DELAY=1000" /&gt;
&lt;property name="username" value="sa" /&gt;
&lt;property name="password" value="" /&gt;
&lt;/bean&gt;
&lt;/property&gt;
&lt;/bean&gt;
&lt;bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"&gt;
&lt;property name="dataSource" ref="dataSource" /&gt;
&lt;/bean&gt;
&lt;bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration"&gt;
&lt;property name="databaseType" value="h2" /&gt;
&lt;property name="dataSource" ref="dataSource" /&gt;
&lt;property name="transactionManager" ref="transactionManager" /&gt;
&lt;property name="databaseSchemaUpdate" value="true" /&gt;
&lt;property name="jobExecutorActivate" value="false" /&gt;
&lt;/bean&gt;
&lt;bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean"&gt;
&lt;property name="processEngineConfiguration" ref="processEngineConfiguration" /&gt;
&lt;/bean&gt;
&lt;bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService" /&gt;
&lt;bean id="runtimeService" factory-bean="processEngine" factory-method="getRuntimeService" /&gt;
&lt;bean id="taskService" factory-bean="processEngine" factory-method="getTaskService" /&gt;
&lt;bean id="historyService" factory-bean="processEngine" factory-method="getHistoryService" /&gt;
&lt;bean id="managementService" factory-bean="processEngine" factory-method="getManagementService" /&gt;
...</pre>
<p>The remainder of that spring configuration file contains the beans and configuration that we'll use in this particular example:
</p>
<p>Spring配置文件的其余部分包含了bean和在这个示例所使用的配置：</p>
<pre>&lt;beans&gt;
...
&lt;tx:annotation-driven transaction-manager="transactionManager"/&gt;
&lt;bean id="userBean" class="org.activiti.spring.test.UserBean"&gt;
&lt;property name="runtimeService" ref="runtimeService" /&gt;
&lt;/bean&gt;
&lt;bean id="printer" class="org.activiti.spring.test.Printer" /&gt;
&lt;/beans&gt;</pre>
<p>First the application context is created with any of the Spring ways to do that. In this example you could use a classpath XML resource to configure our Spring application context:
</p>
<p>首先，用任何Spring方式建立应用程序上下文。在本例，能够使用一个classpath XML 资源来配置我们的Spring应用程序上下文：</p>
<pre>ClassPathXmlApplicationContext applicationContext =
new ClassPathXmlApplicationContext("org/activiti/examples/spring/SpringTransactionIntegrationTest-context.xml");</pre>
<p>or since it is a test:
</p>
<p>或者它是一个测试：</p>
<pre>@ContextConfiguration("classpath:org/activiti/spring/test/transaction/SpringTransactionIntegrationTest-context.xml")</pre>
<p>Then we can get the service beans and invoke methods on them. The ProcessEngineFactoryBean will have added an extra interceptor to the services that applies Propagation.REQUIRED transaction semantics on the Activiti service methods. So we can use for example the repositoryService to deploy a process like this:
</p>
<p>然后我们能够得到服务bean并调用它们之上的方法。将对一个应用繁殖的，在Activiti服务方法之上必要的事务语义服务增加一个额外的拦截器。所以我们能够像下面来部署一个流程来使用 repositoryService：</p>
<pre>RepositoryService repositoryService = (RepositoryService) applicationContext.getBean("repositoryService");
String deploymentId = repositoryService
.createDeployment()
.addClasspathResource("org/activiti/spring/test/hello.bpmn20.xml")
.deploy()
.getId();
</pre>
<p>The other way around also works. In this case, the Spring transaction will be around the userBean.hello() method and the Activiti service method invocation will join that same transaction.
</p>
<p>其它方法也可工作。在这种情况下， Spring事务将包围在方法附近。Activiti服务方法调用将加入同一事务。</p>
<pre>UserBean userBean = (UserBean) applicationContext.getBean("userBean");
userBean.hello();</pre>
<p>The UserBean looks like this. Remember from above in the Spring bean configuration we injected the repositoryService into the userBean.
</p>
<p>UserBean看起来如此。记得吗，在上面的Spring bean配置里，已将repositoryService注入到userBean。</p>
<pre>public class UserBean {
/** injected by Spring */
private RuntimeService runtimeService;
@Transactional
public void hello() {
// here you can do transactional stuff in your domain model
// and it will be combined in the same transaction as
// the startProcessInstanceByKey to the Activiti RuntimeService
runtimeService.startProcessInstanceByKey("helloProcess");
}
public void setRuntimeService(RuntimeService runtimeService) {
this.runtimeService = runtimeService;
}
}</pre>
<h4><a name="springExpressions"></a>Expressions（表达式）</h4>
<p>When using the ProcessEngineFactoryBean, by default, all <a href="file:///G:/作品/userguide/src/Zh_CN.html/#">expressions</a> in the BPMN processes will also 'see' the Spring beans. For example, the SpringTransactionIntegrationTest <code>hello.bpmn20.xml</code> shows how a method on a Spring bean can be invoked using a UEL method expression:
</p>
<p>当使用ProcessEngineFactoryBean时， 缺省地，在BPMN流程的所有表达式也将看见Spring beans。例如，SpringTransactionIntegrationTest <code>hello.bpmn20.xml</code>展示了如何能用一个UEL方法表达式调用 在Spring bean上一个方法。</p>
<pre>&lt;definitions id="definitions" ...&gt;
&lt;process id="helloProcess"&gt;
&lt;startEvent id="start" /&gt;
&lt;sequenceFlow id="flow1" sourceRef="start" targetRef="print" /&gt;
&lt;serviceTask id="print" <strong>activiti:expression="#{printer.printMessage()}"</strong> /&gt;
&lt;sequenceFlow id="flow2" sourceRef="print" targetRef="end" /&gt;
&lt;endEvent id="end" /&gt;
&lt;/process&gt;
&lt;/definitions&gt;</pre>
<p>Where <code>Printer</code> looks like this:
</p>
<p>这里 <code>Printer</code> 看起来如下：</p>
<pre>public class Printer {
public void printMessage() {
System.out.println("hello world");
}
}</pre>
<p>And the Spring bean configuration (also shown above) looks like this:
</p>
<p>Spring bean配置（如上所示）看起来如下：</p>
<pre>&lt;beans ...&gt;
...
&lt;bean id="printer" class="org.activiti.examples.spring.Printer" /&gt;
&lt;/beans&gt;</pre>
<h4><a name="id502543"></a>Automatic resource deployment（自动资源部署）</h4>
<p>Spring integration also has a special feature for deploying resources. In the process engine configuration, you can specify a set of resources. When the process engine is created, all those resources will be scanned and deployed. There is filtering in place that prevents duplicate deployments. Only when the resources actually have changed, will new deployments be deployed to the Activiti DB. This makes sense in a lot of use case, where the Spring container is rebooted often (eg testing).
</p>
<p>Spring集成也为部署资源提供一个特殊的特性。在流程引擎配置里，你能指定一系列资源。当建立资源引擎时，将扫描并部署所有这些资源。存在一个防止复制部署的过滤器。只有当资源实际上已经发生变化时，才将新的部署才部署到Activiti 数据库里。这个需要Spring容器需要经常重新引导（比如测试）的地方才有意义。
</p>
<p>Here's an example
</p>
<p>这里有个示例</p>
<pre>&lt;bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration"&gt;
...
<strong>&lt;property name="deploymentResources" value="classpath*:/org/activiti/spring/test/autodeployment/autodeploy.*.bpmn20.xml" /&gt;</strong>
&lt;/bean&gt;
&lt;bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean"&gt;
&lt;property name="processEngineConfiguration" ref="processEngineConfiguration" /&gt;
&lt;/bean&gt;</pre>
<h4><a name="springUnitTest"></a>Unit testing（单元测试）</h4>
<p>When integrating with Spring, business processes can be tested very easily using the standard <a href="file:///G:/作品/userguide/src/Zh_CN.html/#">Activiti testing facilities</a>. Following example shows how a business process is tested in a typical Spring-based unit test:
</p>
<p>当和Spring集成时，采用标准的测试设施<a href="file:///G:/作品/userguide/src/Zh_CN.html/#">Activiti testing facilities</a>让业务流程的测试轻而易举。下例展示在一个典型基于Spring的单元测试里面一个业务流程是如何测试的。</p>
<pre>@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:org/activiti/spring/test/junit4/springTypicalUsageTest-context.xml")
public class MyBusinessProcessTest {
@Autowired
private RuntimeService runtimeService;
@Autowired
private TaskService taskService;
@Autowired
@Rule
public ActivitiRule activitiSpringRule;
@Test
@Deployment
public void simpleProcessTest() {
runtimeService.startProcessInstanceByKey("simpleProcess");
Task task = taskService.createTaskQuery().singleResult();
assertEquals("My Task", task.getName());
taskService.complete(task.getId());
assertEquals(0, runtimeService.createProcessInstanceQuery().count());
}
}
</pre>
<p>Note that for this to work, you need to define a <em>org.activiti.engine.test.ActivitiRule</em> bean in the Spring configuration (which is injected by auto-wiring in the example above).
</p>
<p>注意：为了让这个能够工作，需要在Spring配置里面 定义一个<em>org.activiti.engine.test.ActivitiRule</em> bean（在上例里通过auto-wiring 注入）。</p>
<pre>&lt;bean id="activitiRule" class="org.activiti.engine.test.ActivitiRule"&gt;
&lt;property name="processEngine" ref="processEngine" /&gt;
&lt;/bean&gt;
</pre><img src ="http://www.blogjava.net/lewhwa/aggbug/339822.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lewhwa/" target="_blank">网路冷眼@BlogJava</a> 2010-12-05 01:30 <a href="http://www.blogjava.net/lewhwa/archive/2010/12/05/339822.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Activiti User Guide（Activiti用户指南)-Chapter 5. API</title><link>http://www.blogjava.net/lewhwa/archive/2010/12/05/339821.html</link><dc:creator>网路冷眼@BlogJava</dc:creator><author>网路冷眼@BlogJava</author><pubDate>Sat, 04 Dec 2010 17:27:00 GMT</pubDate><guid>http://www.blogjava.net/lewhwa/archive/2010/12/05/339821.html</guid><wfw:comment>http://www.blogjava.net/lewhwa/comments/339821.html</wfw:comment><comments>http://www.blogjava.net/lewhwa/archive/2010/12/05/339821.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/lewhwa/comments/commentRss/339821.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lewhwa/services/trackbacks/339821.html</trackback:ping><description><![CDATA[<h4>Chapter 5. API</h4>
<p><strong>Table of Contents</strong> </p>
<dl> <dt><a href="file:///G:/作品/userguide/src/Zh_CN.html/#apiEngine">Engine API（引擎API ）</a>  </dt><dt><a href="file:///G:/作品/userguide/src/Zh_CN.html/#id502179">Exception strategy（异常处理策略）</a>  </dt><dt><a href="file:///G:/作品/userguide/src/Zh_CN.html/#apiUnitTesting">Unit testing（单元测试）</a>  </dt><dt><a href="file:///G:/作品/userguide/src/Zh_CN.html/#id502462">The process engine in a webapplication（在Web应用里的流程引擎）</a>  </dt><dt><a href="file:///G:/作品/userguide/src/Zh_CN.html/#id502572">Process Virtual Machine API（流程虚拟机API）</a>  </dt><dt><a href="file:///G:/作品/userguide/src/Zh_CN.html/#apiExpressions">Expressions（表达式）</a></dt></dl>
<h4><a name="apiEngine"></a>Engine API（引擎API ）</h4>
<p>The engine API is the most common way of interacting with Activiti. The central starting point is the <code>ProcessEngine</code>, which can be created in several ways as described in the<a href="file:///G:/作品/userguide/src/Zh_CN.html/#">configuration section</a>. From the ProcessEngine, you can obtain the various services that contain the workflow/BPM methods. ProcessEngine and the services objects are thread safe. So you can keep a reference to 1 of those for a whole server. </p>
<p>引擎API是与Activiti交互的最公共的方式。 <code>ProcessEngine</code>是中心启动点。如在 <a href="file:///G:/作品/userguide/src/Zh_CN.html/#">configuration section</a>章节里描述的那样，它可以用几种方法建立。从 <code>ProcessEngine </code>里能够获得包括工作流/BPM方法的各种各样的服务。 因为<code>ProcessEngine</code>和服务对象是线程安全的，所以能够为整个服务器范围保留这些服务的引用为1。 </p>
<p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/7b1a493cfcdf_13FC/api.services%5B5%5D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="api.services[5]" border="0" alt="api.services[5]" src="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/7b1a493cfcdf_13FC/api.services%5B5%5D_thumb.png" width="499" height="211" /></a></p>
<pre>ProcessEngine processEngine = new ProcessEngineBuilder()
.configureFromPropertiesResource(configurationResource)
.buildProcessEngine();
RuntimeService runtimeService = processEngine.getRuntimeService();
RepositoryService repositoryService = processEngine.getRepositoryService();
TaskService taskService = processEngine.getTaskService();
ManagementService managementService = processEngine.getManagementService();
IdentityService identityService = processEngine.getIdentityService();
HistoryService historyService = processEngine.getHistoryService();
FormService formService = processEngine.getFormService();</pre>
<p>The names of the service are quite self-explanatory. For detailed information on the services and the engine API, see<a href="file:///G:/作品/userguide/src/javadocs/index.html"> the javadocs</a>.
</p>
<p>服务名是自解释的，相当明了。要了解服务和引擎API的详情，参见<a href="file:///G:/作品/userguide/src/javadocs/index.html"> the javadocs</a>.
</p>
<h4><a name="id502179"></a>Exception strategy（异常处理策略）</h4>
<p>The base exception in Activiti is the <code>org.activiti.engine.ActivitiException</code>, an unchecked exception. This exception can be thrown at all times by the API, but 'expected' exceptions that happen in specific methods are documented in the <a href="file:///G:/作品/userguide/src/javadocs/index.html">the javadocs</a>. For example, an extract from <code>TaskService</code>:
</p>
<p>Activiti的基本异常是org.activiti.engine.ActivitiException, 一个unchecked异常。尽管在所有时间API都可抛出这个异常，但是 某些方法产生'expected'异常。在 <a href="file:///G:/作品/userguide/src/javadocs/index.html">the javadocs</a>里面对这种异常进行了文档化。例如，下面是一个从 <code>TaskService</code> 抽取一段代码：</p>
<pre> /**
* Called when the task is successfully executed.
* @param taskId the id of the task to complete, cannot be null.
* @throws ActivitiException when no task exists with the given id.
*/
void complete(String taskId);
</pre>
<p>In the example above, when an id is passed for which no task exists, an exception will be thrown. Also, since the javadoc <strong>explicitly states that taskId cannot be null, an<code>ActivitiException</code> will be thrown when <code>null</code> is passed</strong>.
</p>
<p>在上例，当传递一个不存在的任务的id，将会抛出一个异常。当然，javadoc <strong>明明白白说明taskId不能为null，当传递null时，将抛出 </strong><code>ActivitiException</code> 。
</p>
<p>Even though we want to avoid a big exception hierarchy, the following subclasses were added which are thrown in specific cases:
</p>
<p>尽管我们竭力避免一个庞大的异常层次体系，但还是在特殊情况下增加了如下的子类。
</p>
<ul>
    <li>
    <p><code>ActivitiWrongDbException: </code>Thrown when the Activiti engine discovers a mismatch between the database schema version and the engine version.
    </p>
    <p><code>ActivitiWrongDbException: </code>当Activiti引擎发现数据库结构版本和引擎版本之间不匹配时，将抛出这个异常。</p>
    </li>
    <li>
    <p><code>ActivitiOptimisticLockingException: </code>Thrown when an optimistic locking occurs in the datastore caused by concurrent access of the same data entry.
    </p>
    <p><code>ActivitiOptimisticLockingException: </code>当数据库里由对相同的数据项并发访问导致乐观锁定时发生。</p>
    </li>
</ul>
<h4><a name="apiUnitTesting"></a>Unit testing（单元测试）</h4>
<p>Business processes are an integral part of software projects and they should be tested in the same way normal application logic is tested: with unit tests. Since Activiti is an embeddable Java engine, writing unit test for business processes is as simple as writing regular unit tests.
</p>
<p>业务流程是软件项目的一个集成部分，那么应当采用正常应用逻辑测试 ：采用单元测试。因为Activiti是一个嵌入式Java引擎，所以编写业务流程的单元测试像编写正常的单元测试一样简单。
</p>
<p>Activiti supports both Junit versions 3 and 4 style of unit testing. In the Junit 3 style, the <em>org.activiti.engine.test.ActivitiTestCase</em> must be extended. This will make the processEngine and the services available through protected member fields. In the <em>setup()</em> of the test, the processEngine will be initialized by default with the <em>activiti.cfg.xml</em>resource on the classpath. To specify a different configuration file, override the <em>getConfigurationResource()</em> method. Process engines are be cached statically over multiple unit tests when the configuration resource is the same.
</p>
<p>Activiti支持单元测试的Junit版本3和4风格。在Junit 3风格里，必须扩展<em>org.activiti.engine.test.ActivitiTestCase</em>。这将使得通过保护成员字段获得流程引擎和服务。在测试的setup()里，缺省地流程引擎将通过classpath上的 <em>activiti.cfg.xml</em> 资源初始化流程引擎。为了指定不同的 配置文件，覆盖 <em>getConfigurationResource()</em> 方法。当配置资源是相同时，流程引擎静态地缓存多个单元测试。
</p>
<p>By extending <em>ActivitiTestCase</em>, you can annotate test methods with <em>org.activiti.engine.test.Deployment</em>. Before the test is run, a resource file of the form<em>testClassName.testMethod.bpmn20.xml</em> in the same package as the test class, will be deployed. At the end of the test, the deployment will be deleted, including all related process instances, tasks, etc. The <em>Deployment</em> annotation also supports setting the resource location explicitly. See <a href="file:///G:/作品/userguide/src/javadocs/org/activiti/engine/test/Deployment.html">the Javadocs</a> for more details.
</p>
<p>通过扩展 <em>ActivitiTestCase</em> ，你能用org.activiti.engine.test.Deployment标注测试方法。在运行测试以前，将同一包里部署的 <em>testClassName.testMethod.bpmn20.xml</em>作为测试类。在测试结束，将删除包括所有相关的流程实例，任务等等部署。<em>Deployment</em> 标注也支持显式设置资源的位置。详情参见 <a href="file:///G:/作品/userguide/src/javadocs/org/activiti/engine/test/Deployment.html">the Javadocs</a>。
</p>
<p>Taking all that in account, a Junit 3 style test looks as follows.
</p>
<p>将上面所有的情况考虑进去，Junit 3风格的测试方式如下所示。</p>
<pre>public class MyBusinessProcessTest extends ActivitiTestCase {
@Deployment
public void testSimpleProcess() {
runtimeService.startProcessInstanceByKey("simpleProcess");
Task task = taskService.createTaskQuery().singleResult();
assertEquals("My Task", task.getName());
taskService.complete(task.getId());
assertEquals(0, runtimeService.createProcessInstanceQuery().count());
}
}
</pre>
<p>To get the same functionality when using the Junit 4 style of writing unit tests, the <em>org.activiti.engine.test.ActivitiRule</em> Rule must be used. Through this rule, the process engine and services are available through getters. As with the <em>ActivitiTestCase</em> (see above), including this Rule will enable the use of the <em>org.activiti.engine.test.Deployment</em>annotation (see above for an explanation of its use and configuration) and it will look for the default configuration file on the classpath. Process engines are statically cached over multiple unit tests when using the same configuration resource.
</p>
<p>当使用Junit 4风格编写单元测试时，为了获得相同的功能，必须使用 <em>org.activiti.engine.test.ActivitiRule</em> 规则。采用这个规则，通过getter获得流程引擎和服务。采用 <em>ActivitiTestCase</em>（如上），包括使用 <em>org.activiti.engine.test.Deployment</em> （它的使用和配置如上）标注的这个规则，它将在classpath上寻找缺省的配置。当使用相同配置资源时，流程引擎静态地缓存多个单元测试。
</p>
<p>Following code snippet shows an example of using the Junit 4 style of testing and the usage of the <em>ActivitiRule</em>.
</p>
<p>下面代码片段展示了采用的Junit 4风格的测试和 <em>ActivitiRule</em>用法的示例。</p>
<pre>public class MyBusinessProcessTest {
@Rule
public ActivitiRule activitiRule = new ActivitiRule();
@Test
@Deployment
public void ruleUsageExample() {
RuntimeService runtimeService = activitiRule.getRuntimeService();
runtimeService.startProcessInstanceByKey("ruleUsage");
TaskService taskService = activitiRule.getTaskService();
Task task = taskService.createTaskQuery().singleResult();
assertEquals("My Task", task.getName());
taskService.complete(task.getId());
assertEquals(0, runtimeService.createProcessInstanceQuery().count());
}
}
</pre>
<h4><a name="id502462"></a>The process engine in a webapplication（在Web应用里的流程引擎）</h4>
<p>The <code>ProcessEngine</code> is a thread-safe class and can easily be shared among multiple threads. In a webapplication, this means it is possible to create the process engine when the container boots and shut down the engine when the container goes down.
</p>
<p><code>ProcessEngine</code> 是一个线程安全的类并能在多个线程里面轻易共享。在一个Web应用里面，这意味着当容器引导和关闭引擎时，可能建立这个流程引擎。
</p>
<p>The following code snippet how this is done in a regular Servlet environment, using a ServletContextListener:
</p>
<p>下列代码通过使用 ServletContextListener，展示了在一个普通的 Servlet 环境下如何完成这个工作的。</p>
<pre>public class ProcessEnginesServletContextListener implements ServletContextListener {
public void contextInitialized(ServletContextEvent servletContextEvent) {
ProcessEngines.init();
}
public void contextDestroyed(ServletContextEvent servletContextEvent) {
ProcessEngines.destroy();
}
}</pre>
<p>The contextInitialized will delegate to <code>ProcessEngines.init()</code>. That will look for <code>activiti.cfg.xml</code> resource files on the classpath, and create a <code>ProcessEngines</code> for the given configurations (eg. multiple jars with a configuration file). If you have multiple such resource files on the classpath, make sure they all have different names. When the process engine is needed, it can be fetched using
</p>
<p>将contextInitialized委托给 <code>ProcessEngines.init()</code>。它将在classpath上寻找 <code>activiti.cfg.xml</code> 资源文件，并且为给定的配置建立 <code>ProcessEngines</code>。如果在classpath上具有多个如此的资源文件，确保它们都具有不同的名字。当需要流程引擎时，它将采用下面的方法来取得</p>
<pre>ProcessEngines.getDefaultProcessEngine()</pre>
<p>or
</p>
<p>或</p>
<pre>ProcessEngines.getProcessEngine("myName");</pre>
<p>Of course, it is also possible to use any of the variants of creating a process engine, as described in the <a href="file:///G:/作品/userguide/src/Zh_CN.html/#">configuration section</a>.
</p>
<p>当然，采用建立流程引擎的变体也是可能的。如 <a href="file:///G:/作品/userguide/src/Zh_CN.html/#">configuration section</a>所示。
</p>
<p>The contextDestroyed of the context-listener delegates to <code>ProcessEngines.destroy()</code>. That will properly close all initialized process engines.
</p>
<p>context-listener 的contextDestroyed 委托给<code>ProcessEngines.destroy()</code>
</p>
<p>。那将正常关闭所有以初始化的流程引擎。
</p>
<h4><a name="id502572"></a>Process Virtual Machine API（流程虚拟机API）</h4>
<p>The API exposes the POJO core of the Process Virtual Machine. Reading and playing with it is interesting for education purposes to understand the internal workings of Activiti. And the POJO API can also be used to build new process languages.
</p>
<p>流程虚拟机（Process Virtual Machine ）API暴露流程虚拟机的POJO核心。为了理解Activiti的内部工作机制的教育目的，阅读并把玩API是有趣的。 并且POJO API也能用来构建新的流程语言。
</p>
<p>For example:
</p>
<p>例如：</p>
<pre>PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder()
.createActivity("a")
.initial()
.behavior(new WaitState())
.transition("b")
.endActivity()
.createActivity("b")
.behavior(new WaitState())
.transition("c")
.endActivity()
.createActivity("c")
.behavior(new WaitState())
.endActivity()
.buildProcessDefinition();
PvmProcessInstance processInstance = processDefinition.createProcessInstance();
processInstance.start();
PvmExecution activityInstance = processInstance.findExecution("a");
assertNotNull(activityInstance);
activityInstance.signal(null, null);
activityInstance = processInstance.findExecution("b");
assertNotNull(activityInstance);
activityInstance.signal(null, null);
activityInstance = processInstance.findExecution("c");
assertNotNull(activityInstance);</pre>
<h4><a name="apiExpressions"></a>Expressions（表达式）</h4>
<p>Activiti uses UEL for expression-resolving. UEL stands for <em>Unified Expression Language</em> and is part of the EE6 specification ()see <a href="http://docs.sun.com/app/docs/doc/820-7627/gjddd?l=en&amp;a=view">the EE6 specification</a> for detailed information). To support all features of latest UEL spec on ALL environements, we use a modified version of JUEL.
</p>
<p>Activiti使用UEL进行表达式解析。UEL代表统一表达式（<em>Unified Expression Language</em> ），它是JAVA EE 6规范（ <a href="http://docs.sun.com/app/docs/doc/820-7627/gjddd?l=en&amp;a=view">the EE6 specification</a> ）的一部分。为了在所有环境支持最新的UEL规范，我们采用了JUEL的修改版本。
</p>
<p>Expressions can be used in for example <a href="file:///G:/作品/userguide/src/Zh_CN.html/#">Java Service tasks</a>, <a href="file:///G:/作品/userguide/src/Zh_CN.html/#">Execution Listeners</a>, <a href="file:///G:/作品/userguide/src/Zh_CN.html/#">Task Listeners</a> and <a href="file:///G:/作品/userguide/src/Zh_CN.html/#">Conditional sequence flows</a>. Although there are 2 types of expressions, value-expression and method-expression, activiti makes abstraction of this and they can both be used where an <code>expression</code> is needed.
</p>
<p>表达式能够在下列示例中使用： <a href="file:///G:/作品/userguide/src/Zh_CN.html/#">Java Service tasks</a>, <a href="file:///G:/作品/userguide/src/Zh_CN.html/#">Execution Listeners</a>, <a href="file:///G:/作品/userguide/src/Zh_CN.html/#">Task Listeners</a> 和 <a href="file:///G:/作品/userguide/src/Zh_CN.html/#">Conditional sequence flows</a>。尽管存在两种表达式：值表达式和方法表达式。但是，Activiti对此进行了抽象，在需要表达式的地方两者均可使用。
</p>
<ul>
    <li>
    <p><strong>Value expression</strong>: resolves to a value. By default, all process variables are available to use. Also all spring-beans (if using Spring) are available to use in expressions. On top of that, the <code>DelegateExecution</code> is also available in the expression-context and can be accessed using the name <code>execution</code>. <strong>Since the execution is exposed as <code>execution</code>, all variables and spring-beans with name <code>execution</code> are hidden and cannot be used in an expression.</strong> Some examples:
    </p>
    <p><strong>值表达式（Value expression）</strong>: 解析为一个值。缺省地，所有的流程均可使用。表达式里也可使用所有的spring bean（如果使用Spring）。<strong>在此之上，在表达式上下文里也可获得DelegateExecution。因为，执行暴露为<code>execution</code>，带有名称<code>execution</code>的所有变量和spring-beans将被隐藏，并且不能在表达式里使用</strong>。例如：</p>
    <pre>${myVar}
    ${myBean.myProperty}</pre>
    </li>
    <li>
    <p><strong>Method expression</strong>: invokes a method, with or without parameters. <strong>When invoking a method without parameters, be sure to add empty parentheses after the method-name.</strong> The passed parameters can be literal values or expressions that are resolved themselves. Examples:
    </p>
    <p>方法表达式：调用一个方法，带不带参数均可。当 调用没有参数的方法，确保在方法名之后加入空括号。这些传入的参数可以字面值或者被解析解释的表达式。例如：
    </p>
    <p><strong>Method expression</strong>:
    </p>
    <p>方法表达式：</p>
    <pre>${printer.print()}
    ${myBean.addNewOrder('orderName')}
    ${myBean.doSomething(myVar, execution)}
    </pre>
    </li>
</ul>
<p>Note that these expressions support resolving primitives (incl. comparing them), beans, lists, arrays and maps.
</p>
<p>注意这些表达式支持解析原型（包括对它们进行比较），beans，列表，数组和map.
</p>
<p>For more concrete usage and examples, check out <a href="file:///G:/作品/userguide/src/Zh_CN.html/#">Expressions in Spring</a>, <a href="file:///G:/作品/userguide/src/Zh_CN.html/#">Java Service tasks</a>, <a href="file:///G:/作品/userguide/src/Zh_CN.html/#">Execution Listeners</a>, <a href="file:///G:/作品/userguide/src/Zh_CN.html/#">Task Listeners</a> or <a href="file:///G:/作品/userguide/src/Zh_CN.html/#">Conditional sequence flows</a>.
</p>
<p>为了更多的具体的用法和示例，请浏览 <a href="file:///G:/作品/userguide/src/Zh_CN.html/#">Expressions in Spring</a>，<a href="file:///G:/作品/userguide/src/Zh_CN.html/#">Java Service tasks</a>，<a href="file:///G:/作品/userguide/src/Zh_CN.html/#">Execution Listeners</a>， <a href="file:///G:/作品/userguide/src/Zh_CN.html/#">Task Listeners</a> 或者<a href="file:///G:/作品/userguide/src/Zh_CN.html/#">Conditional sequence flows</a>。
</p><img src ="http://www.blogjava.net/lewhwa/aggbug/339821.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lewhwa/" target="_blank">网路冷眼@BlogJava</a> 2010-12-05 01:27 <a href="http://www.blogjava.net/lewhwa/archive/2010/12/05/339821.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Activiti User Guide（Activiti用户指南)-Chapter 6. Deployment（部署）</title><link>http://www.blogjava.net/lewhwa/archive/2010/12/05/339820.html</link><dc:creator>网路冷眼@BlogJava</dc:creator><author>网路冷眼@BlogJava</author><pubDate>Sat, 04 Dec 2010 17:23:00 GMT</pubDate><guid>http://www.blogjava.net/lewhwa/archive/2010/12/05/339820.html</guid><wfw:comment>http://www.blogjava.net/lewhwa/comments/339820.html</wfw:comment><comments>http://www.blogjava.net/lewhwa/archive/2010/12/05/339820.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/lewhwa/comments/commentRss/339820.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lewhwa/services/trackbacks/339820.html</trackback:ping><description><![CDATA[<h4>Chapter 6. Deployment（部署）</h4>
<p><strong>Table of Contents</strong> </p>
<dl> <dt><a href="file:///G:/作品/userguide/src/Zh_CN.html/#id490697">Business archives（业务档案）</a>  </dt><dt><a href="file:///G:/作品/userguide/src/Zh_CN.html/#id490742">Java classes（Java类）</a>  </dt><dt><a href="file:///G:/作品/userguide/src/Zh_CN.html/#id490772">Deploying programmatically（编程式部署）</a>  </dt><dt><a href="file:///G:/作品/userguide/src/Zh_CN.html/#id490799">Deploying with ant（以ant方式部署）</a>  </dt><dt><a href="file:///G:/作品/userguide/src/Zh_CN.html/#id490829">Deploying with Activiti Probe（以Activiti Probe部署)</a>  </dt><dt><a href="file:///G:/作品/userguide/src/Zh_CN.html/#versioningOfProcessDefinitions">Versioning of process definitions（流程定义的版本管理）</a></dt></dl>
<h4><a name="id490697"></a>Business archives（业务档案）</h4>
<p>To deploy processes, they have to be wrapped in a business archive. A business archive is the unit of deployment to an Activiti Engine. Basically a business archive is equivalent to a zip file. It can contain BPMN 2.0 processes, task forms, rules and any other type of file. In general, a business archive contains a collection of named resources. </p>
<p>为了部署流程，必须将流程打包为流程档案。一个流程档案是Activiti引擎的部署单元。基本来说，一个流程档案等价于一个zip文件。它包含了BPMN 2.0流程，任务表单，规则和其它文件类型。通常，流程档案包含一个命名资源的集合。 </p>
<p>When a business archive is deployed, it is scanned for BPMN files with a extension. Each of those will be parsed and potentially contains multiple process definitions. </p>
<p>当部署业务档案时，以<code>.bpmn20.xml</code> 扩展名为的BPMN文件方式扫描来扫描它。每个BMPN文件被扫描，它包含多个流程定义。 </p>
<p>Note that Java classes present in the business archive <strong>will not be added to the classpath.</strong> All custom classes used in process definitions in the business archive (for example Java service tasks or event listener implementations) should be present on the activiti-engine's classpath in order to run the processes. </p>
<p>注意业务档案存在的Java类<strong>将不会加入到classpath</strong>。为了运行流程，业务档案里面的流程定义的所有定制类（例如Java服务类或者事件监听器实现）应当包含在Activiti引擎的classpath里面。 </p>
<h4><a name="id490742"></a>Java classes（Java类）</h4>
<p>All custom classes that are used in your process (eg. JavaDelegates used in servicetaks or event-listeners, TaskListeners, ...) should be present on the engine's classpath when an instance of the process is started. It's not nessecairy to have those classes on the classpath when deploying the process-definition into the engine. </p>
<p>当启动一个流程实例（例如serviceTask或者event-listener，TaskListener）时，定义在流程里面的所有定制类应当包含在引擎的classpath上面 。当把流程定义部署到引擎时，不必将哪些类放到classpath上。 </p>
<p>When you are using the demo setup and you want to add your custom classes, you should add a jar containing your classes to the activiti-rest webapp lib. Don't forget to include the dependencies of your custom classes (if any) as wel. This is the same location where the activiti-engine jar is located. You can find this folder inside your distro at the folowing location: </p>
<p>当正在使用demo setup并要加入你自己的定制类时，你应当将包含这些类的jar包添加至activiti-rest webapp lib里面。也不要忘记包含定制类的依赖包（如果有的话），这个和activiti-engine.jar位置相同。在发行版本中的如下位置找到这个文件夹：</p>
<pre>${activiti distro}/apps/apache-tomcat-6.0.29/webapps/activiti-rest/lib/</pre>
<h4><a name="id490772"></a>Deploying programmatically（编程式部署）</h4>
<p>Deploying a business archive from a zip file can be done like this:
</p>
<p>以如下方式完成从zip文件来部署流程档案：</p>
<pre>String barFileName = "path/to/process-one.bar";
ZipInputStream inputStream = new ZipInputStream(new FileInputStream(barFileName));
repositoryService.createDeployment()
.name("process-one.bar")
.addZipInputStream(inputStream)
.deploy();
</pre>
<p>It's also possible to build a deployment from individual resources. See javadocs for more details.
</p>
<p>也可能从单个资源来构建部署。详情参见javadoc。
</p>
<h4><a name="id490799"></a>Deploying with ant（以ant方式部署）</h4>
<p>To deploy a business archive with ant, first the <code>deploy-bar</code> task needs to be defined. Make sure that the configuration jar is on the classpath, as well as the Activiti jar and all its dependencies:
</p>
<p>为了以ant方式来部署业务档案，首先需要定义 <code>deploy-bar</code> 任务。确保配置jar包，Activiti jar及其所有的依赖都在classpath路径里面。</p>
<pre>&lt;taskdef name="deploy-bar" classname="org.activiti.engine.impl.ant.DeployBarTask"&gt;
&lt;classpath&gt;
&lt;fileset dir="..."&gt;
&lt;include name="activiti-cfg.jar"/&gt;
&lt;include name="your-db-driver.jar"/&gt;
&lt;/fileset&gt;
&lt;fileset dir="${activiti.home}/lib"&gt;
&lt;include name="activiti-engine-${activiti.version}.jar"/&gt;
&lt;include name="ibatis-sqlmap-*.jar"/&gt;
&lt;/fileset&gt;
&lt;/classpath&gt;
&lt;/taskdef&gt;
&lt;deploy-bar file=".../yourprocess.bar" /&gt;</pre>
<h4><a name="id490829"></a>Deploying with Activiti Probe（以Activiti Probe部署)</h4>
<p>It's possible to deploy process definitions through probe, this is described in <a href="file:///G:/作品/userguide/src/Zh_CN.html/#">Activiti Probe - Deployments</a>.
</p>
<p>通过Probe也可以部署流程定义，这在<a href="file:///G:/作品/userguide/src/Zh_CN.html/#">Activiti Probe - Deployments</a>里面描述。
</p>
<h4><a name="versioningOfProcessDefinitions"></a>Versioning of process definitions（流程定义的版本管理）</h4>
<p>BPMN doesn't have a notion of versioning. And that is good because the executable BPMN process file will probably live in an SVN repository as part of your development project. Versions of process definitions are created during deployment. During deployment, Activiti will assign a version to the <code>ProcessDefinition</code> before it is stored in the Activiti DB.
</p>
<p>BPMN没有版本管理的概念。这是好事，因为可执行的BPMN流程文件将作为开发项目的一部分驻留在一个SVN的仓库里，所以在部署时，才建立流程定义的版本。在部署期间，在<code>ProcessDefinition</code> 保存到Activiti DB之前，Activiti将为它分布一个版本号。
</p>
<p>For each process definition in a business archive the following steps are performed to initialize the properties <code>key</code>, <code>version</code>, <code>name</code> and <code>id</code>:
</p>
<p>对于业务档案里的每个流程定义，执行下列步骤初始化 <code>key</code>, <code>version</code>, <code>name</code> 和 <code>id</code> 这些属性：
</p>
<ul>
    <li>
    <p>The process <code>id</code> attribute is used as the process definition <code>key</code> property
    </p>
    <p>流程<code>id</code> 属性 用作为流程定义的<code>key</code>特性</p>
    </li>
    <li>
    <p>The process <code>name</code> attribute is used as the process definition <code>name</code> property. If the name attribute is not specified, then id attribute is used as the name.
    </p>
    <p>流程<code>name</code> 属性 用作为流程定义的特性 <code>name</code> 。如果没有指定name属性，那么id属性作为名称使用。</p>
    </li>
    <li>
    <p>The first time a process with a particular key is deployed, version 1 is assigned. For all subsequent deployments of process definitions with the same key, the version will be set 1 higher then the max currently deployed version. The key property is used to distinct process definitions.
    </p>
    <p>当一个带有特殊key的流程第一次部署时，版本分配为1。对带有相同key的流程定义，在后续部署时，每部署一次，在当前最大部署版本号上加1。key特性用来区分流程定义。</p>
    </li>
    <li>
    <p>The id property is set to {processDefinitionKey}:{processDefinitionVersion}
    </p>
    <p>id特性设置为{processDefinitionKey}:{processDefinitionVersion}</p>
    </li>
</ul><img src ="http://www.blogjava.net/lewhwa/aggbug/339820.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lewhwa/" target="_blank">网路冷眼@BlogJava</a> 2010-12-05 01:23 <a href="http://www.blogjava.net/lewhwa/archive/2010/12/05/339820.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Activiti User Guide（Activiti用户指南)-Chapter 7. BPMN</title><link>http://www.blogjava.net/lewhwa/archive/2010/12/05/339819.html</link><dc:creator>网路冷眼@BlogJava</dc:creator><author>网路冷眼@BlogJava</author><pubDate>Sat, 04 Dec 2010 17:19:00 GMT</pubDate><guid>http://www.blogjava.net/lewhwa/archive/2010/12/05/339819.html</guid><wfw:comment>http://www.blogjava.net/lewhwa/comments/339819.html</wfw:comment><comments>http://www.blogjava.net/lewhwa/archive/2010/12/05/339819.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/lewhwa/comments/commentRss/339819.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lewhwa/services/trackbacks/339819.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: Chapter 7. BPMN Table of Contents  What is BPMN?（何为BPMN）  Examples（示例）  Defining a process（定义一个流程）  Getting started: 10 minute tutorial（开始：10分钟教程）   Use case（用例）  Process diagram（流程图）  XML representat...&nbsp;&nbsp;<a href='http://www.blogjava.net/lewhwa/archive/2010/12/05/339819.html'>阅读全文</a><img src ="http://www.blogjava.net/lewhwa/aggbug/339819.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lewhwa/" target="_blank">网路冷眼@BlogJava</a> 2010-12-05 01:19 <a href="http://www.blogjava.net/lewhwa/archive/2010/12/05/339819.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Activiti User Guide（Activiti用户指南)-Chapter 08. Forms（表单）</title><link>http://www.blogjava.net/lewhwa/archive/2010/11/28/339265.html</link><dc:creator>网路冷眼@BlogJava</dc:creator><author>网路冷眼@BlogJava</author><pubDate>Sun, 28 Nov 2010 11:49:00 GMT</pubDate><guid>http://www.blogjava.net/lewhwa/archive/2010/11/28/339265.html</guid><wfw:comment>http://www.blogjava.net/lewhwa/comments/339265.html</wfw:comment><comments>http://www.blogjava.net/lewhwa/archive/2010/11/28/339265.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/lewhwa/comments/commentRss/339265.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lewhwa/services/trackbacks/339265.html</trackback:ping><description><![CDATA[<h4>Chapter 08. Forms（表单）</h4>
<p><strong>Table of Contents</strong> </p>
<dl> <dt><a href="#buildInFormRendering">Build-in form rendering（内置表单渲染）</a>  </dt><dt><a href="#externalFormRendering">External form rendering（外部表单渲染）</a>  </dt><dt><a href="#formProperties">Form properties（表单属性）</a></dt></dl>
<p>Activiti provides a convenient and flexible way to add forms for the manual steps of your business processes. We support two strategies to work with forms: Build-in form rendering and external form rendering </p>
<p>Activiti为你的业务流程的手动步骤提供了一个方便和灵活的增加表单的方法。我们为表单的工作支持两种策略：内置渲染和外部渲染。 </p>
<h4><a name="buildInFormRendering"></a>Build-in form rendering（内置表单渲染）</h4>
<p>Build-in form rendering is the simplest to get started with. We'll explain it with an example. </p>
<p>最简单的开始的方式是内置表单的渲染。我们将以一个示例进行解释。 </p>
<p>The demo setup script installs the <em>vacationRequest</em> business process as an example of using task forms through Activiti Explorer. Please check the example for the complete source code. The business process diagram looks like this: </p>
<p>作为通过Activiti Explorer使用任务表单的一个示例，demo setup脚本安装了业务流程。请检查示例的完整的源代码。业务流程图如下所示： </p>
<p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/c82d37528810_11530/taskform.vacation.request.model_4.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="taskform.vacation.request.model" border="0" alt="taskform.vacation.request.model" src="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/c82d37528810_11530/taskform.vacation.request.model_thumb_1.png" width="738" height="295" /></a> </p>
<p>To use the build-in rendering, the form files have to be included in the deployment. That can be done programmatically like this: </p>
<p>为了使用内置的渲染，在部署中必须包括表单文件。通过如下的编程方式来完成：</p>
<pre>Deployment deployment = repositoryService.createDeployment()
.addClasspathResource("org/activiti/examples/taskforms/VacationRequest.bpmn20.xml")
.addClasspathResource("org/activiti/examples/taskforms/approve.form")
.addClasspathResource("org/activiti/examples/taskforms/request.form")
.addClasspathResource("org/activiti/examples/taskforms/adjustRequest.form")
.deploy();
</pre>
<p>Or that can be done with an ant task by first building a business archive zip file that contains the process and forms like above and then deploy it like this:
</p>
<p>或者，首先通过构建一个包含如上所示的流程和表单的业务档案zip文件，然后，如下部署这个文件。这些通过一个ant任务来完成。</p>
<pre>&lt;taskdef name="deploy-bar" classname="org.activiti.engine.impl.ant.DeployBarTask"&gt;
&lt;classpath&gt;
&lt;pathelement path="files/demo"/&gt;
&lt;fileset dir="build"&gt;
&lt;include name="activiti-cfg.jar"/&gt;
&lt;/fileset&gt;
&lt;fileset dir="${activiti.home}/examples/activiti-engine-examples/libs-runtime" /&gt;
&lt;fileset dir="${activiti.home}/examples/activiti-engine-examples/libs-test" /&gt;
&lt;/classpath&gt;
&lt;/taskdef&gt;
&lt;deploy-bar file="${activiti.home}/setup/build/activiti-examples.bar" /&gt;</pre>
<p>The BPMN 2.0 specification does not specify how tasks or task forms should be rendered, as such forms are defined using Activiti specific constructs. There is the attribute<code>userTask</code>sthat can be specified on <code>startEvent</code>s and <code>userTask</code>s.
</p>
<p>BPMN 2.0 规范并没有指明任务或者任务表单应当如何渲染，使用Activiti特定的构造型来定义如此的表单。在和 <code>startEvent</code>s和 <code>userTask</code>之上能够制定这个属性 <code>userTask</code>。</p>
<pre>&lt;startEvent id="request"
<strong>activiti:formKey="org/activiti/examples/taskforms/request.form</strong>" /&gt;
&lt;sequenceFlow id="flow1" sourceRef="request" targetRef="handleRequest" /&gt;
&lt;userTask id="handleRequest" name="Handle vacation request"
<strong>activiti:formKey="org/activiti/examples/taskforms/approve.form"</strong> &gt;
&lt;documentation&gt;
Vacation request by ${employeeName}
&lt;/documentation&gt;
...
&lt;/userTask&gt;</pre>
<p>The <code>activiti:formKey</code> attribute can contain any text value which you use to identify your form in case you do your own form rendering. But the build-in form rendering expects the <code>activiti:formKey</code> to be a reference to a resource in the same business archive (= deployment).
</p>
<p>当你采用自己的渲染时，属性能够包含你所用来表明你的表单的任何文本值。但是内置的表单渲染器猜想<code>activiti:formKey</code> 引用到同一业务档案（=部署）的一个资源。
</p>
<p>Activiti Explorer uses the build-in form rendering engines. Currently, there is only one form rendering engine configured, which is Juel. So it resolves resource files as <a href="http://download.oracle.com/javaee/5/tutorial/doc/bnahq.html">a Juel expression</a> and the resulting HTML String is sent to the client. In the future, we hope to add a FreeMarker form engine, but that will require more library dependencies so we opt for Juel as the default form engine.
</p>
<p>Activiti Explorer使用内置的表单渲染引擎。当前，只有一个以配置的表单渲染器。这个渲染器叫Juel。所以它把资源文件解析为<a href="http://download.oracle.com/javaee/5/tutorial/doc/bnahq.html">a Juel expression</a> 。解析结果 HTML String 被发送到客户。未来，我们希望加入表单引擎，但是它需要更多的库依赖，所以我们优选把Juel作为缺省的表单引擎。
</p>
<p>Here is the rendered form defined in resource <code>org/activiti/examples/taskforms/request.form</code>. Its a form to capture the data necessary to start a new process instance.
</p>
<p>这里是在资源<code>org/activiti/examples/taskforms/request.form</code>里定义的渲染过的表单。它是一个捕获启动一个新的流程实例所必须的数据的表单。
</p>
<p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/c82d37528810_11530/taskform.example_4.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="taskform.example" border="0" alt="taskform.example" src="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/c82d37528810_11530/taskform.example_thumb_1.png" width="715" height="679" /></a>
</p>
<p>And here is the contents of that form file:
</p>
<p>这里是那个表单文件的内容：</p>
<pre>&lt;h1&gt;Vacation Request&lt;/h1&gt;
Employee Name:&lt;br/&gt;
&lt;input type="text" name="employeeName" value="" /&gt;
&lt;input type="hidden" name="employeeName_required" value="true" /&gt;
Number of days:&lt;br/&gt;
&lt;input type="number" name="numberOfDays" value="1" /&gt;
&lt;input type="hidden" name="numberOfDays_type" value="Integer" /&gt;
First day of vacation:&lt;br/&gt;
&lt;input type="date" name="startDate" /&gt;
&lt;input type="hidden" name="startDate_type" value="Date" /&gt;
Date of return to work:&lt;br/&gt;
&lt;input type="date" name="returnDate" /&gt;
&lt;input type="hidden" name="returnDate_type" value="Date" /&gt;
Vacation pay requested
&lt;input type="checkbox" name="vacationPay"/&gt; Vacation pay requested
&lt;input type="hidden" name="vacationPay_boolean" value="true"/&gt;
Motivation:&lt;br/&gt;
&lt;textarea name="vacationMotivation" value=""&gt;&lt;/textarea&gt;</pre>
<p><a href="file:///G:/作品/userguide/src/Zh_CN.html/#"><strong>&lt;EXPERIMENTAL&gt;</strong> </a>The hidden fields provide extra information to the Activiti Explorer client application. So the Javascript in the browser will use the hidden fields and enhance the corresponding input fields. For example, it's possible to specify that a certain text field is a date and Activiti Explorer will add a date picker.
</p>
<p><a href="file:///G:/作品/userguide/src/Zh_CN.html/#"><strong>&lt;EXPERIMENTAL&gt;</strong> </a>隐藏字段提供Activiti Explorer 客户应用程序的额外信息。这样浏览器将使用这些隐藏字段并加强相应输入字段。例如，制定某一文本字段是date，Activiti Explorer 将加入一个日期选取器是可能的。
</p>
<ul>
    <li>
    <p>Variable names must be camel-cased.
    </p>
    <p>变量名必须是骆驼方式的。</p>
    </li>
    <li>
    <p>The default type of the process variable that is stored is <em>string</em>. Use a hidden field with the input variable name followed by <em>'_type'</em> to define the type (and hence also the conversion from the HTML input to the variable):
    </p>
    <p>保存的流程变量的缺省值是 <em>string</em>。使用一个输入变量后面跟有<em>'_type'</em> 的隐藏字段来定义类型（这样将HTML的输入约定为这个变量）：</p>
    <pre>&lt;input type="hidden" name="numberOfDays<strong>_type</strong>" value="Integer" /&gt;</pre>
    <p>Currently supported are <em>String, Integer, Boolean, Date</em>.
    </p>
    <p>当前支持的类型为：<em>String, Integer, Boolean, Date</em>。</p>
    </li>
    <li>
    <p>Input variables can be made required by adding a hidden field with the input variable name followed by '_required':
    </p>
    <p>通过使用一个输入变量后面跟有<em>'_type'</em> 的隐藏字段来产生必须的输入变量。</p>
    <pre>&lt;input type="hidden" name="employeeName_required" value="true" /&gt;</pre>
    </li>
    <li>
    <p>In Activiti-Explorer, the <em>Date</em> type validates to ISO 8601 (<em>YYYY-MM-DD</em>). This field will also use any native date picker tools in the browser (using the HTML5 <em>input type="date"</em>) and fall back on a pop-up date picker using the YUI calendar widget. It is, of course still possible to manually enter your own date, which is validated as you type.
    </p>
    <p>在Activiti-Explorer里，Date类型用ISO 8601 (<em>YYYY-MM-DD</em>)来验证。这个字段也将使用浏览器里的任何本地日期拾取器（使用HTML5的<em>input type="date"</em>）。通过YUI calendar widget返回一个弹出日期拾取器。当然，也可能手动输入你自己的日期，由你输入的验证方法。</p>
    </li>
    <li>
    <p>The Integer form field in the demo has also been enhanced to make use of HTML5 <em>input type=number</em>, which provides native validation and custom input fields in the supported browser(s), although Activiti-Explorer provides client side validation as well.
    </p>
    <p>在demo里面的Integer表单字段也已经被加强产生HTML 5 <em>input type=number</em>。尽管Activiti-Explorer 提供客户端验证，但是在可支持HTML5的浏览器也提供内置验证和定制输入字段。</p>
    </li>
</ul>
<p>It is expected that Activiti Explorer in the future will use <code>FormService.getStartFormData</code> instead of these hidden field values to enhance the form input fields. That's why the hidden fields part is marked as experimental. <a href="file:///G:/作品/userguide/src/Zh_CN.html/#"><strong>&lt;/EXPERIMENTAL&gt;</strong></a>
</p>
<p>可以预料， Activiti Explorer 在未来将会使用 <code>FormService.getStartFormData</code>来代替这些隐藏字段值来加强表单输入字段。那是为什么隐藏字段被标记为实验性的原因。. <a href="file:///G:/作品/userguide/src/Zh_CN.html/#"><strong>&lt;/EXPERIMENTAL&gt;</strong></a>
</p>
<p>Use <code>FormService.getRenderedStartForm</code> to get the rendered form string with the API:
</p>
<p>通过API，使用 <code>FormService.getRenderedStartForm</code> 来获取渲染表单字符串。</p>
<pre>String FormService.getRenderedStartForm(String processDefinitionId)</pre>
<p>Use <code>FormService.submitStartFormData</code> to start a new process instance with the properties that the user provided as input for the form:
</p>
<p>以一个用户为表单输入的属性，采用 <code>FormService.submitStartFormData</code>来启动一个新的流程实例。</p>
<pre>ProcessDefinition FormService.submitStartFormData(String processDefinitionId, Map&lt;String, String&gt; properties)</pre>
<p>To learn about the difference between starting a new process instance with this <code>FormService</code> method in comparison with the <code>ProcessInstance RuntimeService.startProcessInstanceById(String processDefinitionId)</code>, read <a href="file:///G:/作品/userguide/src/Zh_CN.html/#formProperties">the section called &#8220;Form properties（表单属性）&#8221;</a>
</p>
<p>为了了解和 <code>ProcessInstance RuntimeService.startProcessInstanceById(String processDefinitionId)</code>比较，以这个 <code>FormService</code> 方法启动一个新的流程实例之间的差异，请参见 read <a href="file:///G:/作品/userguide/src/Zh_CN.html/#formProperties">the section called &#8220;Form properties（表单属性）&#8221;</a> 。
</p>
<p>After submitting the form, a process instance is started and now someone of the management team needs to handle the request.
</p>
<p>在提交这个表单之后，一个流程实例被启动。管理小组的有些人需要处理这个请求。
</p>
<p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/c82d37528810_11530/taskform.vacation.request.management.group_4.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="taskform.vacation.request.management.group" border="0" alt="taskform.vacation.request.management.group" src="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/c82d37528810_11530/taskform.vacation.request.management.group_thumb_1.png" width="423" height="145" /></a>
</p>
<p>The corresponding user task has a task form attached to it, which uses the variables which were given as input by the employee in the start form. These variables are referenced as expressions and are resolved at runtime to their text representation.
</p>
<p>相关的用户任务具有和它绑定的任务表单。。这些作为表达式引用，在运行期解析为它们的文本表示。</p>
<pre>&lt;h1&gt;Vacation Approval&lt;/h1&gt;
&lt;p&gt;
${employeeName} would like to take ${numberOfDays} day(s) of vacation.
&lt;/p&gt;
&lt;p&gt;
Motivation: ${vacationMotivation}
&lt;/p&gt;
&lt;p&gt;
Do you approve this?
&lt;select name="<strong>vacationApproved</strong>"&gt;
&lt;option value="true"&gt;Yes&lt;/option&gt;
&lt;option value="false"&gt;No&lt;/option&gt;
&lt;/select&gt;
&lt;input type="hidden" name="vacationApproved_type" value="Boolean" /&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;label&gt;
Motivation:&lt;br/&gt;
&lt;textarea name="managerMotivation" value=""&gt;&lt;/textarea&gt;
&lt;/label&gt;
&lt;/p&gt;</pre>
<p>The manager will now indicate in the form whether the vacation request is approved or not, by selecting the appropriate input in the form.
</p>
<p>通过在表单里面选择合适的输入，经理将在表单里面指示休假请求是否批注。
</p>
<p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/c82d37528810_11530/taskform.vacation.request.approve.form_4.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="taskform.vacation.request.approve.form" border="0" alt="taskform.vacation.request.approve.form" src="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/c82d37528810_11530/taskform.vacation.request.approve.form_thumb_1.png" width="646" height="469" /></a>
</p>
<p>The result is stored in as a process variable, which is then used in the exclusive gateway after the form is submitted.
</p>
<p>结果作为一个流程变量保存，在表单提交之后在总网关里使用。</p>
<pre>&lt;sequenceFlow id="flow5" sourceRef="requestApprovedDecision" targetRef="adjustVacationRequestTask"&gt;
&lt;conditionExpression xsi:type="tFormalExpression"&gt;${!<strong>vacationApproved</strong>}&lt;/conditionExpression&gt;
&lt;/sequenceFlow&gt;
</pre>
<p>Depending on the input of the manager in the user task, the employee will now get a new task in his personal task list, stating that the vacation request was disapproved and it needs can be refilled if wanted.
</p>
<p>依赖在用户任务里面经理的输入，雇员现在将在他的个人任务列表里面得到一个新的任务。说明休假请求被拒绝。如果再想休假，需要重填。
</p>
<p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/c82d37528810_11530/taskform.vacation.request.adjust.form_4.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="taskform.vacation.request.adjust.form" border="0" alt="taskform.vacation.request.adjust.form" src="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/c82d37528810_11530/taskform.vacation.request.adjust.form_thumb_1.png" width="455" height="500" /></a>
</p>
<p>The employee can now choose to resend the vacation request, which brings process execution again in the user task for the manager. Or the employee can throw away the request, ending the process.
</p>
<p>雇员现在能够选择重发休假请求。这样让经理的用户流程重新执行。或者雇员可以抛弃这个请求，终止这个流程。</p>
<pre>&lt;h1&gt;Adjust vacation Request&lt;/h1&gt;
&lt;p&gt;
Your manager has disapproved your vacation request for ${numberOfDays} days. &lt;br/&gt;
Reason: ${managerMotivation}
&lt;/p&gt;
&lt;p&gt;
Number of days:&lt;br/&gt;
&lt;input type="text" name="numberOfDays" value="${numberOfDays}" /&gt;
&lt;input type="hidden" name="numberOfDays_type" value="Integer" /&gt;
&lt;/p
...</pre>
<h4><a name="externalFormRendering"></a>External form rendering（外部表单渲染）</h4>
<p>Above we showed the build-in task form rendering. But the API also allows for you to perform your own task form rendering outside of the Activiti Engine. These steps explain the hooks that you can use to render your task forms yourself.
</p>
<p>上面我们展示了内置的任务表单渲染。但是API也允许你从 Activiti Engine之外执行你自己的任务表单渲染器。这些步骤解释了你能使用的渲染你的任务表单的钩子。
</p>
<p>Essentially, all the data that's needed to render a form is assembled in one of these two service methods: <code>StartFormData FormService.getStartFormData(String processDefinitionId)</code> and<code>TaskFormdata FormService.getTaskFormData(String taskId)</code>.
</p>
<p>必要的，渲染一个表单所需的所有数据被组装在这连个服务方法的其中之一：<code>StartFormData FormService.getStartFormData(String processDefinitionId)</code> 和<code>TaskFormdata FormService.getTaskFormData(String taskId)</code>
</p>
<p>Submitting form properties can be done with <code>ProcessInstance FormService.submitStartFormData(String processDefinitionId, Map&lt;String,String&gt; properties)</code> and <code>void FormService.submitStartFormData(String taskId, Map&lt;String,String&gt; properties)</code>
</p>
<p>通过<code>ProcessInstance FormService.submitStartFormData(String processDefinitionId, Map&lt;String,String&gt; properties)</code> 和 <code>void FormService.submitStartFormData(String taskId, Map&lt;String,String&gt; properties)</code>方法能够完成提交表单的属性。
</p>
<p>To learn about how form properties map to process variables, see <a href="file:///G:/作品/userguide/src/Zh_CN.html/#formProperties">the section called &#8220;Form properties（表单属性）&#8221;</a>
</p>
<p>为了学习表单属性如何映射到流程变量，参见<a href="file:///G:/作品/userguide/src/Zh_CN.html/#formProperties">the section called &#8220;Form properties（表单属性）&#8221;</a> 。
</p>
<p>You can just stick any form template resource inside the business archives that you deploy (in case you want to store them versioned with the process). It will be available as a resource in the deployment. You can use the <code>String ProcessDefinition.getDeploymentId()</code> and <code>InputStream RepositoryService.getResourceAsStream(String deploymentId, String resourceName);</code> to obtain the file that you included in the deployments. That could be your form template definition file.
</p>
<p>Btw, you can use this capability of accessing the deployment resources beyond task forms for any other purposes as well.
</p>
<p>随便，为了其它任何目的，你能使用出除了任务表单之外访问部署资源的能力。
</p>
<p>The attribute <code>&lt;userTask activiti:formKey="..."</code> is exposed by the API through <code>String FormService.getStartFormData(String processDefinitionId).getFormKey()</code> and <code>String FormService.getTaskFormData(String taskId).getFormKey()</code>. You could for instance store a generic key in the form attribute and apply an algorithm or transformation to get to the actual template that needs to be used. This might be handy when you want to render different forms for different UI technologies like e.g. one form for usage in a web app of normal screen size, one form for mobile phone's small screens and maybe even a template for a IM form or an email form.
</p>
<p>属性 <code>&lt;userTask activiti:formKey="..."</code> 通过 <code>String FormService.getStartFormData(String processDefinitionId).getFormKey()</code> 和 <code>String FormService.getTaskFormData(String taskId).getFormKey()</code>被API 暴露。你可能为实例在表单里面保存一个通用键，应用一个算法或者转换来得到实际所需的模板。当你想从不同的UI技术渲染不同的表单，这可能方便。例如，一个表单用来在正常屏幕大小的Web应用使用；一个表单在手机小屏幕使用，甚至是IM表单或者email表单的一个模板。
</p>
<h4><a name="formProperties"></a>Form properties（表单属性）</h4>
<p>All information relevant to a business process is either included in the process variables themselves or referenced through the process variables. Activiti supports complex Java objects to be stored as process variables like <code>Serializable</code> objects, JPA entities or whole XML documents as <code>String</code>s.
</p>
<p>与业务流程相关的所有信息既可包含流程变量自己，也可通过流程变量包括它们的引用。Activiti支持将复杂的Java对象保存为像 <code>Serializable</code> 对象，JPA实体或者作为String 的整个XML文档的流程变量。
</p>
<p>Starting a process and completing tasks is where people are involved into a process. Communicating with people requires forms to be rendered in some UI technology. In order to facilitate multiple UI technologies easy, the process definition can includes the logic of transforming of the complex Java typed objects in the process variables to a<code>Map&lt;String,String&gt;</code> of properties.
</p>
<p>启动一个流程和完成任务是人们介入到流程的地方。和人通信需要采用一些UI技术来渲染表单。为了让多个UI技术和平共处，流程定义能够包含转化逻辑：将流程变量里面的复杂对象传化为一个属性的<code>Map&lt;String,String&gt;</code> 。
</p>
<p>Any UI technology can then build a form on top of those properties. The properties can provide a dedicated (and more limited) view on the process variables. The properties needed to display a form are available in the FormData returnvalues of <code>StartFormData FormService.getStartFormData(String processDefinitionId)</code> and <code>TaskFormdata FormService.getTaskFormData(String taskId)</code>. Those properties are obtained from the process variables.
</p>
<p>然后任何UI技术能在这些属性之上构建一个表单。这些属性能在这些流程变量之上提供一个专有（有更多限制）视图。显示一个表单所需的属性在返回<code>StartFormData FormService.getStartFormData(String processDefinitionId)</code> 和 <code>TaskFormdata FormService.getTaskFormData(String taskId)</code>. 的FormData 值里。这些属性从流程变量取得。
</p>
<p>By default, the build-in form engines, will 'see' the properties as well as the process variables. So there is no need to declare task form properties if they match 1-1 with the process variables. For example, with the following declaration:
</p>
<p>缺省地，内置的表单引擎，将&#8216;看见&#8216;属性，正如看见流程变量一样。所以，如果任务表单属性和流程变量是1-1的匹配关系，没有必要对它声明。</p>
<pre>&lt;startEvent id="start" /&gt;</pre>
<p>A form will see all the process variables but the <code>formService.getStartFormData(String processDefinitionId).getFormProperties()</code> will be empty.
</p>
<p>In the above case, all the submitted properties will be stored as process variables. This means that by simply adding a new inputfield in the form, a new variable can be stored.
</p>
<p>表单将看见所有的流程变量，而 <code>formService.getStartFormData(String processDefinitionId).getFormProperties()</code> 将为空。
</p>
<p>Properties are derived from process variables, but they don't have to be stored as process variables. For example, a process variable could be a JPA entity of class Address. And a form property <code>StreetName</code> used by the UI technology could be linked with an expression <code>#{address.street}</code>
</p>
<p>尽管属性从流程变量继承而来，但是它们不必存储为流程变量。例如，一个流程变量可能是一个类Address的JPA实体。并且，由UI技术使用的表单属性 <code>StreetName</code> 能够和一个表达式<code>#{address.street}</code> 连接。
</p>
<p>Analogue, the properties that a user is supposed to submit in a form can be stored as a process variable or as a nested property in one of the process variables with a UEL value expression like e.g. <code>#{address.street}</code> .
</p>
<p>Analogue the default behavior of properties that are submitted is that they will be stored as process variables unless a <code>formProperty</code> declaration specifies otherwise.
</p>
<p>Also type conversions can be applied as part of the processing between form properties and process variables.
</p>
<p>类型约定能够应用作为表单属性和流程变量之间处理环节的部分。
</p>
<p>For example:
</p>
<p>例如：</p>
<pre>&lt;userTask id="task"
&lt;extensionElements&gt;
&lt;activiti:formProperty id="room" /&gt;
&lt;activiti:formProperty id="duration" type="long"/&gt;
&lt;activiti:formProperty id="speaker" variable="SpeakerName" writable="false" /&gt;
&lt;activiti:formProperty id="street" expression="#{address.street}" required="true" /&gt;
&lt;/extensionElements&gt;
&lt;/userTask&gt;</pre>
<ul>
    <li>
    <p>Form property <code>room</code> will be mapped to process variable <code>room</code> as a String.
    </p>
    <p>表单属性 <code>room</code> ：将作为一个String映射为流程变量 <code>room</code>。</p>
    </li>
    <li>
    <p>Form property <code>duration</code> will be mapped to process variable <code>duration</code> as a java.lang.Long
    </p>
    <p>表单属性 <code><code>duration</code> </code>：将作为一个java.lang.Long映射为流程变量 <code>duration</code>。</p>
    </li>
    <li>
    <p>Form property <code>speaker</code> will be mapped to process variable <code>SpeakerName</code>. It will only be available in the TaskFormData. If property speaker is submitted, an ActivitiException will be thrown. Analogue, with attribute <code>readable="false"</code>, a property can be excluded from the FormData, but still be processed in the submit.
    </p>
    <p>表单属性会将 <code>speaker</code> 映射为流程变量 <code>SpeakerName</code>。他只能在TaskFormData获得。如果提交属性speaker，那么将会抛出ActivitiException。模拟地，带有属性 <code>readable="false"</code>，尽管一个属性将会从 FormData排除在外，但是在提交里面仍将处理。</p>
    </li>
    <li>
    <p>Form property <code>street</code> will be mapped to Java bean property <code>street</code> in process variable <code>address</code> as a String. And required="true" will throw an exception during the submit if the property is not provided.
    </p>
    <p>表单属性 <code>street</code>在流程变量里面将会作为String映射为Java bean 属性 <code>street</code> 。如果没有提供这个属性，在提交期间， required="true" 将抛出一个异常。</p>
    </li>
</ul>
<p>It's also possible to provide type meta data as part of the FormData that is returned from methods <code>StartFormData FormService.getStartFormData(String processDefinitionId)</code> and<code>TaskFormdata FormService.getTaskFormData(String taskId)</code>
</p>
<p>提供类型元数据作为从<code>StartFormData FormService.getStartFormData(String processDefinitionId)</code> 和 <code>TaskFormdata FormService.getTaskFormData(String taskId)</code>返回的FormData 的部分也是有可能的。
</p>
<p>We support following form property types:
</p>
<p>我们支持下列表单属性类型：
</p>
<ul>
    <li>
    <p><code>string</code> (org.activiti.engine.impl.form.StringFormType)</p>
    </li>
    <li>
    <p><code>long</code> (org.activiti.engine.impl.form.LongFormType)</p>
    </li>
    <li>
    <p><code>enum</code> (org.activiti.engine.impl.form.EnumFormType)</p>
    </li>
    <li>
    <p><code>date</code> (org.activiti.engine.impl.form.DateFormType)</p>
    </li>
</ul>
<p>For each form property declared, the following <code>FormProperty</code> information will be made available through <code>List&lt;FormProperty&gt; formService.getStartFormData(String processDefinitionId).getFormProperties()</code> and <code>List&lt;FormProperty&gt; formService.getTaskFormData(String taskId).getFormProperties()</code>
</p>
<p>对于每个声明的表单属性，通过 <code>List&lt;FormProperty&gt; formService.getStartFormData(String processDefinitionId).getFormProperties()</code> 和and <code>List&lt;FormProperty&gt; formService.getTaskFormData(String taskId).getFormProperties()</code> 产生如下的 <code>FormProperty</code>信息。</p>
<pre>public interface FormProperty {
/** the key used to submit the property in {@link FormService#submitStartFormData(String, java.util.Map)}
* or {@link FormService#submitTaskFormData(String, java.util.Map)} */
String getId();
/** the display label */
String getName();
/** one of the types defined in this interface like e.g. {@link #TYPE_STRING} */
FormType getType();
/** optional value that should be used to display in this property */
String getValue();
/** is this property read to be displayed in the form and made accessible with the methods
* {@link FormService#getStartFormData(String)} and {@link FormService#getTaskFormData(String)}. */
boolean isReadable();
/** is this property expected when a user submits the form? */
boolean isWritable();
/** is this property a required input field */
boolean isRequired();
}</pre>
<p>For example:
</p>
<p>例如：</p>
<pre>&lt;startEvent id="start"&gt;
&lt;extensionElements&gt;
&lt;activiti:formProperty id="speaker"
name="Speaker"
variable="SpeakerName"
type="string" /&gt;
&lt;activiti:formProperty id="start"
type="date"
datePattern="dd-MMM-yyyy" /&gt;
&lt;activiti:formProperty id="direction" type="enum"&gt;
&lt;activiti:value id="left" name="Go Left" /&gt;
&lt;activiti:value id="right" name="Go Right" /&gt;
&lt;activiti:value id="up" name="Go Up" /&gt;
&lt;activiti:value id="down" name="Go Down" /&gt;
&lt;/activiti:formProperty&gt;
&lt;/extensionElements&gt;
&lt;/startEvent&gt;</pre>
<p>All that information is accessible through the API. The type names can be obtained with <code>formProperty.getType().getName()</code>. And even the date pattern is available with<code>formProperty.getType().getInformation("datePattern")</code> and the enumeration values are accessible with <code>formProperty.getType().getInformation("values")</code>
</p>
<p>通过API来访问那个信息。通过<code>formProperty.getType().getName()</code> 获取类型名；通过<code>formProperty.getType().getInformation("datePattern")</code>获取时间模式；通过<code>formProperty.getType().getInformation("values")</code> 获取枚举值。
</p><img src ="http://www.blogjava.net/lewhwa/aggbug/339265.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lewhwa/" target="_blank">网路冷眼@BlogJava</a> 2010-11-28 19:49 <a href="http://www.blogjava.net/lewhwa/archive/2010/11/28/339265.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Activiti User Guide（Activiti用户指南)-Chapter 09. JPA</title><link>http://www.blogjava.net/lewhwa/archive/2010/11/28/339263.html</link><dc:creator>网路冷眼@BlogJava</dc:creator><author>网路冷眼@BlogJava</author><pubDate>Sun, 28 Nov 2010 11:39:00 GMT</pubDate><guid>http://www.blogjava.net/lewhwa/archive/2010/11/28/339263.html</guid><wfw:comment>http://www.blogjava.net/lewhwa/comments/339263.html</wfw:comment><comments>http://www.blogjava.net/lewhwa/archive/2010/11/28/339263.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/lewhwa/comments/commentRss/339263.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lewhwa/services/trackbacks/339263.html</trackback:ping><description><![CDATA[<h4>Chapter 09. JPA</h4>
<p><strong>Table of Contents</strong> </p>
<dl> <dt><a href="#id480309">Requirements（需求）</a>  </dt><dt><a href="#jpaconfiguration">Configuration（配置）</a> </dt><dd> <dl> <dt><a href="#id480450">JPA using ProcessEngineBuilder（使用ProcessEngineBuilder的JPA）</a>  </dt><dt><a href="#jpaconfigurationspring">JPA using Spring（使用Sping的JPA）</a></dt></dl> </dd><dt><a href="#id480869">Usage（用法）</a> </dt><dd> <dl> <dt><a href="#id480875">Simple Example（简单示例）</a>  </dt><dt><a href="#id481107">Query JPA process variables（查询流程变量）</a>  </dt><dt><a href="#id481241">Advanced example using Spring beans and JPA（使用Spring beans和JPA的高级示例）</a></dt></dl></dd></dl>
<p>You can use JPA-Entities as process variables, allowing you to: </p>
<p>你能使用作为流程变量的JPA-实体，允许: </p>
<ul>
    <li>
    <p>Updating existing JPA-entities based on process variables, that can be filled in on a form in a userTask or generated in a serviceTask. </p>
    <p>更新存在基于流程变量的JPA-实体，它被填充在userTask的表单里面，或者在serviceTask里面产生。</p>
    </li>
    <li>
    <p>Reusing existing domain model without having to write explicit services to fetch the entities and update the values </p>
    <p>复用已存在的领域模型，不必编写显式获取这些实体和更新这些数值。</p>
    </li>
    <li>
    <p>Make decisions (gateways) based on properties of existing entities. </p>
    <p>基于存在实体属性作决定（网关）</p>
    </li>
    <li>
    <p>...</p>
    </li>
</ul>
<h4><a name="id480309"></a>Requirements（需求）</h4>
<p>Only entities that comply to the following are supported: </p>
<p>只支持遵从下面标准的实体： </p>
<ul>
    <li>
    <p>Entities should be configured using JPA-annotations, we support both field and property-access. Mapped super classes can also be used. </p>
    <p>应当使用JPA-标注配置实体，我们支持字段和属性方法。也能够使用已映射的超类。</p>
    </li>
    <li>
    <p>Entity should have a primary key annotated with <code>@Id</code>, compound primary keys are not supported (<code>@EmbeddedId</code> and <code>@IdClass</code>). The Id field/property can be of any type supported in the JPA-spec: Primitive types and their wrappers (excluding boolean), <code>String</code>, <code>BigInteger</code>, <code>BigDecimal</code>, <code>java.util.Date</code> and <code>java.sql.Date</code>. </p>
    <p>实体应当具有标注为@Id的主键，不支持组合主键 (<code>@EmbeddedId</code> and <code>@IdClass</code>)。Id 字段/属性能够是JPA规范里任何支持的类型:原子类型和它们的包装类（wrapper)（排除boolean），, <code>String</code>, <code>BigInteger</code>, <code>BigDecimal</code>, <code>java.util.Date</code> and <code>java.sql.Date</code>。</p>
    </li>
</ul>
<h4><a name="jpaconfiguration"></a>Configuration（配置）</h4>
<p>To be able to use JPA-entities, the engine must have a reference to an <code>EntityManagerFactory</code>. When JPA is enabled on the engine, JPA-entities used as variables will be detected automatically and will be handled accordingly. </p>
<p>为了能够使用JPA-实体，引擎必须具有一个到<code>EntityManagerFactory</code>的引用。当在引擎上启用了JPA，作为变量的JPA-实体将被自动检测并作相应的处理。 </p>
<h5><a name="id480450"></a>JPA using ProcessEngineBuilder（使用ProcessEngineBuilder的JPA）</h5>
<p>When creating the <code>ProcessEngine</code> using the <code>ProcessEngineBuilder</code>, the method <code>enableJPA</code> should be called. </p>
<p>当使用 <code>ProcessEngineBuilder</code>建立 <code>ProcessEngine</code> 时，必须调用方法<code>enableJPA</code> 。</p>
<pre>ProcessEngine engine = new ProcessEngineBuilder()
.configureFromPropertiesResource("activiti.properties")
.enableJPA(entityManagerFactory, true, true)
.buildProcessEngine();
</pre>
<p>This method accepts the following parameters:
</p>
<p>这个方法接受下列参数：
</p>
<ul>
    <li>
    <p><strong><code>entityManagerFactory: </code></strong>An instance of <code>javax.persistence.EntityManagerFactory</code> that will be used to load the Entities and flushing the updates.
    </p>
    <p><strong><code>entityManagerFactory: </code></strong>一个<code>javax.persistence.EntityManagerFactory</code>的实例，用作载入实体并刷新更新。</p>
    </li>
    <li>
    <p><strong><code>handleTransaction: </code></strong>Flag indicating that the engine should begin and commit/rollback the transaction on the used <code>EntityManager</code> instances. Set to false when <code>Java Transaction API (JTA)</code> is used.
    </p>
    <p><strong><code>handleTransaction: </code></strong>指示引擎应当开始和提交/回滚所使用 <code>EntityManager</code>的实例的事务标志。当使用时设置<code>Java Transaction API (JTA)</code> 为false。</p>
    </li>
    <li>
    <p><strong><code>closeEntityManager: </code></strong>Flag indicating that the engine should close the <code>EntityManager</code> instance that was obtained from the <code>EntityManagerFactory</code>. Set to false when the <code>EntityManager</code>is container-managed (e.g. when using an Extended Persistence Context which isn't scoped to a single transaction').
    </p>
    <p><strong><code>closeEntityManager: </code></strong>指示引擎应当关闭从 <code>EntityManagerFactory</code>获得的实例 <code>EntityManager</code> 的标志。当<code>EntityManager</code>是容器托管的设置为false（例如，当使用不是作用到单个事物的扩展持久化上下文）</p>
    </li>
</ul>
<h5><a name="jpaconfigurationspring"></a>JPA using Spring（使用Sping的JPA）</h5>
<p>The <code>EntityManagerFactory</code> should be set using the <code>ProcessEngineFactoryBean</code>, which is described in <a href="file:///G:/作品/userguide/src/Zh_CN.html/#jpaconfiguration">the section called &#8220;Configuration（配置）&#8221;</a> As an example, we use OpenJPA as persistence-provider using a H2 datasource. The example below is only an extract from a spring configuration-file and only contains relevant beans.
</p>
<p>应当使用 <code>ProcessEngineFactoryBean</code>设置<code>EntityManagerFactory</code> ，在<a href="file:///G:/作品/userguide/src/Zh_CN.html/#jpaconfiguration">the section called &#8220;Configuration（配置）&#8221;</a>描述。作为示例，我们使用OpenJPA作为使用H2数据源的持久化提供者。如下的示例只从一个Spring配置文件提取出来，并包含了相关的bean.</p>
<pre>&lt;bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"&gt;
&lt;property name="dataSource" ref="dataSource"/&gt;
&lt;property name="jpaVendorAdapter"&gt;
&lt;bean class="org.springframework.orm.jpa.vendor.OpenJpaVendorAdapter"&gt;
&lt;property name="databasePlatform" value="org.apache.openjpa.jdbc.sql.H2Dictionary" /&gt;
&lt;/bean&gt;
&lt;/property&gt;
&lt;/bean&gt;
&lt;bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean"&gt;
&lt;property name="dataBaseType" value="h2" /&gt;
&lt;property name="dataSource" ref="dataSource" /&gt;
&lt;property name="transactionManager" ref="transactionManager" /&gt;
&lt;property name="dbSchemaStrategy" value="create-drop" /&gt;
&lt;property name="mailServerHost" value="localhost" /&gt;
&lt;property name="mailServerPort" value="5025" /&gt;
&lt;property name="jpaEntityManagerFactory" ref="entityManagerFactory" /&gt;
&lt;property name="jpaHandleTransaction" value="true" /&gt;
&lt;property name="jpaCloseEntityManager" value="true" /&gt;
&lt;/bean&gt;
</pre>
<ul>
    <li>
    <p><strong><code>jpaEntityManagerFactory: </code></strong>An reference to a bean implementing <code>javax.persistence.EntityManagerFactory</code> that will be used to load the Entities and flushing the updates.
    </p>
    <p><strong><code>jpaEntityManagerFactory: </code></strong>一个指向实现<code>javax.persistence.EntityManagerFactory</code>的bean的引用，用来载入和刷新更新。</p>
    </li>
    <li>
    <p><strong><code>jpaHandleTransaction: </code></strong>Flag indicating that the engine should begin and commit/rollback the transaction on the used <code>EntityManager</code> instances. Set to false when <code>Java Transaction API (JTA)</code> is used.
    </p>
    <p><strong><code>jpaHandleTransaction: </code></strong>指示引擎应当开始和提交/回滚所使用 <code>EntityManager</code>的实例的事务标志。当使用时设置<code>Java Transaction API (JTA)</code> 为false。</p>
    </li>
    <li>
    <p><strong><code>jpaCloseEntityManager: </code></strong>Flag indicating that the engine should close the <code>EntityManager</code> instance that was obtained from the <code>jpaCloseEntityManager</code>. Set to false when the<code>EntityManager</code> is container-managed (e.g. when using an Extended Persistence Context which isn't scoped to a single transaction').
    </p>
    <p><strong><code>jpaCloseEntityManager:</code></strong>
    </p>
    <p><strong><code>closeEntityManager: </code></strong>指示引擎应当关闭从 <code>EntityManagerFactory</code>获得的实例 <code>EntityManager</code> 的标志。当<code>EntityManager</code>是容器托管的设置为false（例如，当使用不是作用到单个事物的扩展持久化上下文）。</p>
    </li>
</ul>
<h4><a name="id480869"></a>Usage（用法）</h4>
<h5><a name="id480875"></a>Simple Example（简单示例）</h5>
<p>Examples for using JPA variables can be found in <code>JPAVariableTest</code>. We'll explain <code>JPAVariableTest.testUpdateJPAEntityValues</code> step by step.
</p>
<p>在 <code>JPAVariableTest</code>里能找到使用JPA变量的示例。将一步一步解释<code>JPAVariableTest.testUpdateJPAEntityValues</code> 。
</p>
<p>First of all, we create a <code>EntityManagerFactory</code> for our persistence-unit, which is based on <code>META-INF/persistence.xml</code>. This contains classes which should be included in the persistence unit and some vendor-specific configuration.
</p>
<p>首先，我们为我们的持久化单元建立 <code>EntityManagerFactory</code> ，这基于<code>META-INF/persistence.xml</code>。这包含了了持久化单元所需的类和一些数据库供应商相关的配置。
</p>
<p>The <code>EntityManagagerFactory</code> is set on the engine to enable JPA support. Please note that this is done using a shortcut for testing purposes, and should actually be set properly using one of the methods described in <a href="file:///G:/作品/userguide/src/Zh_CN.html/#jpaconfiguration">the section called &#8220;Configuration（配置）&#8221;</a>.
</p>
<p>引擎设置 EntityManagagerFactory来支持JPA。请注意：基于测试目的，通过快捷方式来完成，实际上，通过使用在<a href="file:///G:/作品/userguide/src/Zh_CN.html/#jpaconfiguration">the section called &#8220;Configuration（配置）&#8221;</a>描述的方法之一来合理设置。
</p>
<p>We are using a simple entity in the test, having an id and <code>String</code> value property, which is also persisted. Before running the test, we create an entity and save this.
</p>
<p>在测试里面，我们正使用一个简单实体。这个实体具有一个id和<code>String</code> 值属性。实体也要被持久化。在运行测试之前，我们建立一个实体并保存它。</p>
<pre>@Entity(name = "JPA_ENTITY_FIELD")
public class FieldAccessJPAEntity {
@Id
@Column(name = "ID_")
private Long id;
private String value;
public FieldAccessJPAEntity() {
// Empty constructor needed for JPA
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
</pre>
<p>We start a new process instance, adding the entity as a variable. As with other variables, they are stored in the persistent storage of the engine. When the variable is requested the next time, it will be loaded from the <code>EntityManager</code> based on the class and Id stored.
</p>
<p>我们启动一个新的流程实例，增加实体作为一个变量。和其它变量一样，它们保存在引擎的持久化存储区。当下次请求这个变量时，将从基于类和保存的Id的EntityManager载入。</p>
<pre>Map&lt;String, Object&gt; variables = new HashMap&lt;String, Object&gt;();
variables.put("entityToUpdate", entityToUpdate);
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("UpdateJPAValuesProcess", variables);
</pre>
<p>The first node in our process definition contains a <code>serviceTask</code> that will invoke the method <code>setValue</code> on <code>entityToUpdate</code>, which resolves to the JPA variable we set earlier when starting the process instance and will be loaded from the <code>EntityManager</code> associated with the current engine's context'.
</p>
<p>我们流程定义的第一个节点包含一个<code>serviceTask</code>。它将调用在 <code>entityToUpdate</code>之上的方法<code>setValue</code> 。 当启动这个流程实例时，它将解析我们先前设置的JPA变量。JPA变量从当前流程上下文关联的<code>EntityManager</code> 载入。</p>
<pre>&lt;serviceTask id='theTask' name='updateJPAEntityTask' activiti:expression="${entityToUpdate.setValue('updatedValue')}" /&gt;
</pre>
<p>When the service-task is finished, the process instance waits in a userTask defined in the process definition, which allows us to inspect the process instance. At this point, the<code>EntityManager</code> has been flushed and the changes to the entity have been pushed to the database. When we get the value of the variable <code>entityToUpdate</code>, it's loaded again and we get the entity with it's <code>value</code> property set to <code>updatedValue</code>.
</p>
<p>当服务任务完成时，流程实例在流程定义里定义的userTask。userTask允许我们检查这个流程实例。在这时，<code>EntityManager</code> 已经被刷新并且实体变更已经被推送到数据库。当我们获取变量<code>entityToUpdate</code>的值时，它再次载入。我们取得的 <code>updatedValue</code>的<code>value</code> 属性。</p>
<pre>// Servicetask in process 'UpdateJPAValuesProcess' should have set value on entityToUpdate.
Object updatedEntity = runtimeService.getVariable(processInstance.getId(), "entityToUpdate");
assertTrue(updatedEntity instanceof FieldAccessJPAEntity);
assertEquals("updatedValue", ((FieldAccessJPAEntity)updatedEntity).getValue());
</pre>
<h5><a name="id481107"></a>Query JPA process variables（查询流程变量）</h5>
<p>You can query for <code>ProcessInstance</code>s and <code>Execution</code>s that have a certain JPA-entity as variable value. <strong>Note that only <code>variableValueEquals(name, entity)</code> is supported for JPA-Entities on <code>ProcessInstanceQuery</code> and <code>ExecutionQuery</code></strong>. Methods <code>variableValueNotEquals</code>, <code>variableValueGreaterThan</code>, <code>variableValueGreaterThanOrEqual</code>, <code>variableValueLessThan</code> and <code>variableValueLessThanOrEqual</code> are unsupported and will throw an <code>ActivitiException</code> when an JPA-Entity is passed as value.
</p>
<p>你能够查询 <code>ProcessInstance</code>s 和 <code>Execution</code>具有某个作为变量值的JPA-bean。注意：对于在 <code>ProcessInstanceQuery</code> 和 <code>ExecutionQuery</code>上的JPA实体只支持 <code>variableValueEquals(name, entity)</code>。当JPA实体作为值传送时，不支持方法<code>variableValueNotEquals</code>, <code>variableValueGreaterThan</code>, <code>variableValueGreaterThanOrEqual</code>, <code>variableValueLessThan</code>和 and <code>variableValueLessThanOrEqual</code> 将抛出一个 <code>ActivitiException</code>异常。</p>
<pre> ProcessInstance result = runtimeService.createProcessInstanceQuery().variableValueEquals("entityToQuery", entityToQuery).singleResult();
</pre>
<h5><a name="id481241"></a>Advanced example using Spring beans and JPA（使用Spring beans和JPA的高级示例）</h5>
<p>A more advanced example, <code>JPASpringTest</code>, can be found in <code>activiti-spring-examples</code>. It describes the following simple use case:
</p>
<p>一个更加高级的示例，JPASpringTest ，能够在<code>activiti-spring-examples</code> 找到。它描述了下列简单的用例:
</p>
<ul>
    <li>
    <p>An existing Spring-bean which uses JPA entities already exists which allows for Loan Requests to be stored.
    </p>
    <p>使用已存在JPA实体的已存在的Spring-bean允许保存Loan Request.</p>
    </li>
    <li>
    <p>Using Activiti, we can use the existing entities, obtained through the existing bean, and use them as variable in our process.
    </p>
    <p>使用Activiti，我们能够使用存在的实体，通过存在的bean来获取这个实体，并在我们的流程里面以变量方式使用它们。
    </p>
    <p>Process is defined in the following steps:
    </p>
    <p>流程在下列步骤定义：
    </p>
    <ul>
        <li>
        <p>Service task that creates a new LoanRequest, using the existing <code>LoanRequestBean</code> using variables received when starting the process (e.g. could come from a start form). The created entity is stored as a variable, using <code>activiti:resultVariableName</code> which stores the expression result as a variable.
        </p>
        <p>建立一个新的的服务任务，通过</p>
        </li>
        <li>
        <p>UserTask that allows a manager to review the request and approve/disapprove, which is stored as a boolean variable <code>approvedByManager</code>
        </p>
        <p>允许经理审阅请求并且批准/否决的UserTask，它作为一个布尔值<code>approvedByManager</code>保存。</p>
        </li>
        <li>
        <p>ServiceTask that updates the loan request entity so the entity is in sync with the process.
        </p>
        <p>因为ServiceTask更新贷款请求实体，所以这个实体和流程同步。</p>
        </li>
        <li>
        <p>Depending on the value of the entity property <code>approved</code>, an exclusive gateway is used to make a decision about what path to take next: When the request is approved, process ends, otherwise, an extra task will become available (Send rejection letter), so the customer can be notified manually by a rejection letter.
        </p>
        <p>依赖实体属性 <code>approved</code>的值，所使用的一个总开关下一步作出决策：当请求被批准，流程结束，否则，另外的任务将成为可能（发送拒绝函），这样通过拒绝函手动通知客户。</p>
        </li>
    </ul>
    </li>
</ul>
<p>Please note that the process doesn't contain any forms, since it is only used in a unit test.
</p>
<p>请注意这个流程不包括任何表单，因为它只是作为单元测试使用。
</p>
<p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/4f3592fc3438_113A1/jpa.spring.example.process_4.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="jpa.spring.example.process" border="0" alt="jpa.spring.example.process" src="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/4f3592fc3438_113A1/jpa.spring.example.process_thumb_1.png" width="780" height="285" /></a></p>
<pre>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;definitions id="taskAssigneeExample"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:activiti="http://activiti.org/bpmn"
targetNamespace="org.activiti.examples"&gt;
&lt;process id="LoanRequestProcess" name="Process creating and handling loan request"&gt;
&lt;startEvent id='theStart' /&gt;
&lt;sequenceFlow id='flow1' sourceRef='theStart' targetRef='createLoanRequest' /&gt;
&lt;serviceTask id='createLoanRequest' name='Create loan request'
activiti:expression="${loanRequestBean.newLoanRequest(customerName, amount)}"
activiti:resultVariableName="loanRequest"/&gt;
&lt;sequenceFlow id='flow2' sourceRef='createLoanRequest' targetRef='approveTask' /&gt;
&lt;userTask id="approveTask" name="Approve request" /&gt;
&lt;sequenceFlow id='flow3' sourceRef='approveTask' targetRef='approveOrDissaprove' /&gt;
&lt;serviceTask id='approveOrDissaprove' name='Store decision'
activiti:expression="${loanRequest.setApproved(approvedByManager)}" /&gt;
&lt;sequenceFlow id='flow4' sourceRef='approveOrDissaprove' targetRef='exclusiveGw' /&gt;
&lt;exclusiveGateway id="exclusiveGw" name="Exclusive Gateway approval" /&gt;
&lt;sequenceFlow id="endFlow1" sourceRef="exclusiveGw" targetRef="theEnd"&gt;
&lt;conditionExpression xsi:type="tFormalExpression"&gt;${loanRequest.approved}&lt;/conditionExpression&gt;
&lt;/sequenceFlow&gt;
&lt;sequenceFlow id="endFlow2" sourceRef="exclusiveGw" targetRef="sendRejectionLetter"&gt;
&lt;conditionExpression xsi:type="tFormalExpression"&gt;${!loanRequest.approved}&lt;/conditionExpression&gt;
&lt;/sequenceFlow&gt;
&lt;userTask id="sendRejectionLetter" name="Send rejection letter" /&gt;
&lt;sequenceFlow id='flow5' sourceRef='sendRejectionLetter' targetRef='theOtherEnd' /&gt;
&lt;endEvent id='theEnd' /&gt;
&lt;endEvent id='theOtherEnd' /&gt;
&lt;/process&gt;
&lt;/definitions&gt;
</pre>
<p>Although the example above is quite simple, it shows the power of using JPA combined with Spring and parametrized method-expressions. The process requires no custom java-code at all (except for the Spring-bean off course) and speeds up development drastically.
</p>
<p>尽管上例相当简单，但是它展示了组合Spring和参数化方法表达式JPA的威力。流程不需要任何Java代码（当然Spring是例外），并及大地加速了开发。
</p><img src ="http://www.blogjava.net/lewhwa/aggbug/339263.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lewhwa/" target="_blank">网路冷眼@BlogJava</a> 2010-11-28 19:39 <a href="http://www.blogjava.net/lewhwa/archive/2010/11/28/339263.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Activiti User Guide（Activiti用户指南)-Chapter 10. History(历史)</title><link>http://www.blogjava.net/lewhwa/archive/2010/11/28/BPM-Activiti-History.html</link><dc:creator>网路冷眼@BlogJava</dc:creator><author>网路冷眼@BlogJava</author><pubDate>Sun, 28 Nov 2010 11:32:00 GMT</pubDate><guid>http://www.blogjava.net/lewhwa/archive/2010/11/28/BPM-Activiti-History.html</guid><wfw:comment>http://www.blogjava.net/lewhwa/comments/339262.html</wfw:comment><comments>http://www.blogjava.net/lewhwa/archive/2010/11/28/BPM-Activiti-History.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/lewhwa/comments/commentRss/339262.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lewhwa/services/trackbacks/339262.html</trackback:ping><description><![CDATA[<h4>Chapter 10. History(历史)</h4>
<p><strong>Table of Contents</strong> </p>
<dl> <dt><a href="#historyConfig">History configuration（历史配置）</a>  </dt><dt><a href="#historyFormAuditPurposes">History for audit purposes(审计目的的历史)</a></dt></dl>
<p>History is the component that captures what happened during process execution and stores it permanently. In contrast to the runtime data, the history data will remain present in the DB also after process instances have completed. </p>
<p>历史是在流程执行过程中抓取的事件以及把事件永久存储的部件。与运行时数据相比较，历史数据既将当前的数据也将流程已经完成的数据保留在数据库中。 </p>
<p>There are 3 history entities: <code>HistoricProcessInstance</code>s containing information about current and past process instances, <code>HistoricActivityInstance</code>s containing information about a single execution of an activity and <code>HistoricDetail</code> containing various kinds of information related to either a historic process instances or an activity instance. </p>
<p>存在3种历史实体：HistoricProcessInstance包含与当前和过去流程示例相关的信息；HistoricActivityInstance包含与一个活动的当个执行相关的信息；HistoricActivityInstance包含与历史流程实例或者一个活动示例相关的不同的信息。 </p>
<p>In the API, the HistoryService exposes this information by offering methods <code>createHistoricProcessInstanceQuery</code>, <code>createHistoricActivityInstanceQuery</code> and <code>createHistoricDetailQuery</code>. </p>
<p>在API里，历史服务（HistoryService）通过提供<code>createHistoricProcessInstanceQuery</code>, <code>createHistoricActivityInstanceQuery</code> and <code>createHistoricDetailQuery</code>方法暴露这个信息。 </p>
<p>Since the DB contains historic entities for past as well as ongoing instances, you might want to consider querying these tables in order to minimize access to the runtime process instance data and that way keeping the runtime execution performant. </p>
<p>因为DB包含过去的，正运行示例的历史实体，所以为了最小化访问运行流程实例的数据，你也许考虑查询这些库表。这种方式保留了运行期执行的效率。 </p>
<p>Later on, this information will be exposed in Activiti Explorer and Activiti Probe. Also, it will be the information from which the reports will be generated. </p>
<p>最后，这个信息将会在 Activiti Explorer和 and Activiti Probe里面暴露。这将是报告将会产生信息的来源。 </p>
<h4><a name="historyConfig"></a>History configuration（历史配置）</h4>
<p>In the activiti.cfg.xml configuration file, you can configure the level of history archiving that needs to happen: </p>
<p>在activiti.cfg.xml配置文件，你能配置需要的历史归档的级别：</p>
<pre>&lt;activiti-cfg&gt;
&lt;history level="audit" /&gt;
...
&lt;/activiti-cfg&gt;
</pre>
<p>Or if you're using the spring style of configuration:
</p>
<p>或者如果你正使用Spring风格的配置方式：</p>
<pre>&lt;bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean"&gt;
&lt;property name="historyLevel" value="audit" /&gt;
...
&lt;/bean&gt;</pre>
<p>Following history levels can be configured:
</p>
<p>可以配置如下的历史级别：
</p>
<ul>
    <li>
    <p><code>none</code>: skips all history archiving. This is the most performant for runtime process execution, but no historical information will be available.
    </p>
    <p>忽略所有的历史归档。尽管对于运行期流程执行来说这是性能最高的，但是没有历史信息保留。</p>
    </li>
    <li>
    <p><code>activity</code>: archives all process instances and activity instances. No details will be archived
    </p>
    <p>归档所有流程实例和活动实例。不归档细节。</p>
    </li>
    <li>
    <p><code>audit</code>: This is the default. It archives all process instances, activity instances and all form properties that are submitted so that all user interaction through forms is traceable and can be audited.
    </p>
    <p>这是缺省级别。它归档所有流程实例，活动实例和提交的表单属性。以至于通过表单的所有用户交互都是可跟踪并可以被审计。</p>
    </li>
    <li>
    <p><code>full</code>: This is the highest level of history archiving and hence the slowest. This level stores all information as in the <code>audit</code> level plus all other possible details like process variable updates.
    </p>
    <p>这是历史归档的最高级别。所以是最慢的。这个水平保存audit级别的所有信息加上像流程变量的所有其它可能的细节。</p>
    </li>
</ul>
<h4><a name="historyFormAuditPurposes"></a>History for audit purposes(审计目的的历史)</h4>
<p>When <a href="file:///G:/作品/userguide/src/Zh_CN.html/#">configuring</a> at least <code>audit</code> level for configuration. Then all properties submitted through methods <code>FormService.submitStartFormData(String processDefinitionId, Map&lt;String, String&gt; properties)</code> and <code>FormService.submitTaskFormData(String taskId, Map&lt;String, String&gt; properties)</code> are recorded.
</p>
<p>当配置<a href="file:///G:/作品/userguide/src/Zh_CN.html/#">configuring</a> 至少为audit级别时，那么通过<code>FormService.submitStartFormData(String processDefinitionId, Map&lt;String, String&gt; properties)</code> 和 <code>FormService.submitTaskFormData(String taskId, Map&lt;String, String&gt; properties)</code> 方法提交的所有属性将会被记录。
</p>
<p><strong>[KNOWN LIMITATION]</strong> Currently the forms as worked out in Activiti Explorer do not yet use the <code>submitStartFormData</code> and <code>submitTaskFormData</code>. So the form properties are not yet archived when using the forms in Activity Explorer. @see <a href="http://jira.codehaus.org/browse/ACT-294">ACT-294</a>
</p>
<p><strong>[KNOWN LIMITATION]</strong> 当前在工作的表单 还没有使用 <code>submitStartFormData</code> 和 <code>submitTaskFormData</code>。所以当在使用表单时，表单属性还未被归档。@参见 <a href="http://jira.codehaus.org/browse/ACT-294">ACT-294</a>
</p>
<p>Form properties can be retrieved with the query API like this:
</p>
<p>表单特性能够像下面以查询API方式检索：</p>
<pre>historyService
.createHistoricDetailQuery()
.onlyFormProperties()
...
.list();</pre>
<p>In that case only historic details of type <code>HistoricFormProperty</code> are returned.
</p>
<p>在那种情况下，只返回 <code>HistoricFormProperty</code>类型的历史细节。
</p>
<p>If you've set the authenticated user before calling the submit methods with <code>IdentityService.setAuthenticatedUserId(String)</code> then that authenticated user who submitted the form will be accessible in the history as well with <code>HistoricProcessInstance.getStartFormUserId()</code> for start forms and <code>HistoricActivityInstance.getAssignee()</code> for task forms.
</p>
<p>如果在调用带有<code>IdentityService.setAuthenticatedUserId(String)</code> 提交方法之前，你已经设置认证用户，那么提交这个表单的那个认证用户将会在历史里可访问。带有<code>HistoricProcessInstance.getStartFormUserId()</code> 访问启动表单，带有<code>HistoricActivityInstance.getAssignee()</code> 访问任务表单。</p><img src ="http://www.blogjava.net/lewhwa/aggbug/339262.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lewhwa/" target="_blank">网路冷眼@BlogJava</a> 2010-11-28 19:32 <a href="http://www.blogjava.net/lewhwa/archive/2010/11/28/BPM-Activiti-History.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Activiti User Guide（Activiti用户指南)-Chapter 11. Eclipse Designer(Eclipse 设计器)（根据5.0Release修订）</title><link>http://www.blogjava.net/lewhwa/archive/2010/11/28/339261.html</link><dc:creator>网路冷眼@BlogJava</dc:creator><author>网路冷眼@BlogJava</author><pubDate>Sun, 28 Nov 2010 11:26:00 GMT</pubDate><guid>http://www.blogjava.net/lewhwa/archive/2010/11/28/339261.html</guid><wfw:comment>http://www.blogjava.net/lewhwa/comments/339261.html</wfw:comment><comments>http://www.blogjava.net/lewhwa/archive/2010/11/28/339261.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/lewhwa/comments/commentRss/339261.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lewhwa/services/trackbacks/339261.html</trackback:ping><description><![CDATA[<h4>Chapter 11. Eclipse Designer(Eclipse 设计器)</h4> <h4><b>Table of Contents</b></h4> <dl> <dt><a href="#eclipseDesignerInstallation">Installation</a>  <dt><a href="#eclipseDesignerEditorFeatures">Activiti Designer editor features（特性）</a>  <dt><a href="#eclipseDesignerBPMNFeatures">Activiti Designer BPMN features（Activiti设计器BPMN特性）</a>  <dt><a href="#id500902">Extending Activiti Designer（扩展Activiti设计器）</a> <dd> <dl> <dt><a href="file#id500936">Customizing the palette（定制面板）</a>  <dt><a href="#id502000">Exporting to custom output formats（输出定制的格式）</a></dt></dl></dd></dl> <p>Activiti comes with an Eclipse plugin, the Activiti Eclipse Designer, that can be used to graphically model, test and deploy BPMN 2.0 processes Eclipse. The Activiti Eclipse Designer is started and maintained by Tijs Rademakers, Tiese Barrell, Ron van Liempd and Yvo Swillens. <p>Activiti携带了能够在Eclipse里面用来对BPMN 2.0流程进行图形化建模的Eclipse插件。Activiti Eclipse Designer由Tijs Rademakers, Tiese Barrell, Ron van Liempd 和 Yvo Swillens发起并维护。 <h4><a name="eclipseDesignerInstallation"></a>Installation</h4> <p>The following installation instructions are verified on <a href="http://www.eclipse.org/downloads/">Eclipse Classic Helios</a>. <p>下列安装指令在 <a href="http://www.eclipse.org/downloads/">classic Eclipse Helios</a> 环境里面得到验证。 <p>Go to <strong>Help -&gt; Install New Software</strong>. In the following panel, click on <em>Add</em> button and fill in the following fields: <p>到 <strong>Help -&gt; Install New Software</strong>.在下面面板里面，点击 Add 按钮并填充下面的字段： <ul> <li> <p><strong>Name: </strong>Activiti BPMN 2.0 designer</p> <li> <p><strong>Location: </strong>http://activiti.org/designer/update/</p></li></ul> <p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/8da407249130_10FDE/designer.add.update.site_7.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="designer.add.update.site" border="0" alt="designer.add.update.site" src="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/8da407249130_10FDE/designer.add.update.site_thumb_2.png" width="566" height="549"></a> <p>Make sure the <strong>"Contact all updates sites.."</strong> checkbox is not checked, because all the necessary plugins can be downloaded from the Activiti update site. <p>确保选择 <strong>"Contact all updates sites.."</strong>复选框，这是因为所有必要的插件从Activiti的更新站点下载。  <h4><a name="eclipseDesignerEditorFeatures"></a>Activiti Designer editor features（特性）</h4> <ul> <li> <p>Create Activiti projects and diagrams. <p>建立Activiti项目和流程图。 <p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/8da407249130_10FDE/designer.create.activiti.project_7.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="designer.create.activiti.project" border="0" alt="designer.create.activiti.project" src="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/8da407249130_10FDE/designer.create.activiti.project_thumb_2.png" width="463" height="469"></a></p> <li> <p>The Activiti project is generated as a Maven project. To configure the dependencies you need to run <em>mvn eclipse:eclipse</em> and the project dependencies will be configured as expected. <p>Activiti项目作为一个Maven项目而产生。为了配置所需的依赖，请运行 <em>mvn eclipse:eclipse</em>，那么项目依赖的配置将如你所愿。 <p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/8da407249130_10FDE/designer.project.maven_4.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="designer.project.maven" border="0" alt="designer.project.maven" src="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/8da407249130_10FDE/designer.project.maven_thumb_1.png" width="407" height="296"></a></p> <li> <p>A BPMN 2.0 XML file and an image of the process are automatically generated after each save of the Activiti diagram (the automatic generation can be switched of in the Eclipse preferences in the Activiti tab). <p>在Activiti流程图每次保存时将自动产生BPMN 2.0 XML文件和流程的图像（在Eclipse的preferences的Activiti标签页里可以关闭自动产生的选项）。 <p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/8da407249130_10FDE/designer.export.to.bpmn20_7.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="designer.export.to.bpmn20" border="0" alt="designer.export.to.bpmn20" src="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/8da407249130_10FDE/designer.export.to.bpmn20_thumb_2.png" width="385" height="170"></a></p> <li> <p>Generate a unit test (right click on a BPMN 2.0 XML file in the package explorer and select <em>generate unit test</em>) A unit test is generated with an Activiti configuration that runs on an embedded H2 database. You can now run the unit test to test your process definition. <p>产生单元测试（右击包导航器的BPMN 2.0 XML文件并选择产生单元测试（<em>generate unit test</em>））。Activiti配置产生的单元测试运行在嵌入式H2的数据库之上。现在能够运行单元测试来测试流程定义。 <p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/8da407249130_10FDE/designer.unittest.generate_4.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="designer.unittest.generate" border="0" alt="designer.unittest.generate" src="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/8da407249130_10FDE/designer.unittest.generate_thumb_1.png" width="454" height="188"></a></p> <li> <p>The BPMN 2.0 XML is opened in a Activiti XML editor which provides content assist. Note that there are 2 main XSDs configured, the BPMN 2.0 spec XSD and the Activiti extensions XSD. These two XSDs are not yet alligned in a good manneer. <p>Activiti XML编辑器提供内容辅助功能。可以在Activiti XML编辑器里面打开BPMN 2.0 XML文件。注意存在两种可配置的XSD：符合BPMN 2.0规范的XSD和Activiti扩展的XSD。这两个还没有以良好的方式齐头并进。 <p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/8da407249130_10FDE/designer.xml.contentassist_4.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="designer.xml.contentassist" border="0" alt="designer.xml.contentassist" src="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/8da407249130_10FDE/designer.xml.contentassist_thumb_1.png" width="970" height="433"></a></p> <li> <p>A basic validation is performed after each save of the Activiti diagram and the errors are mentioned in the Eclipse problem view. <p>当Activiti流程图每次保存时，完成基本的校验。校验错误显示在Eclipse 问题视图里。 <p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/8da407249130_10FDE/designer.problem.view_4.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="designer.problem.view" border="0" alt="designer.problem.view" src="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/8da407249130_10FDE/designer.problem.view_thumb_1.png" width="769" height="142"></a></p> <li> <p>A basic deployment editor is available when right-clicking on an Activiti diagram in the package explorer. You see a Deployment property at the end of the pop-up items. The deployment editor currently supports saving a BAR file, and will be extended in the next release to also deploy the BAR file to the Activiti engine. <p>当右击包导航器的Activiti的流程图时，将显示一个基本的部署编辑器。在弹出项的的最下端将显示一个"Deployment"属性。部署编辑器当前支持保存为一个BAR文件。在下一个版本将扩展为将BAR文件部署到Activiti引擎。 <p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/8da407249130_10FDE/designer.deployment.editor_4.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="designer.deployment.editor" border="0" alt="designer.deployment.editor" src="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/8da407249130_10FDE/designer.deployment.editor_thumb_1.png" width="1126" height="513"></a></p></li></ul> <h4><a name="eclipseDesignerBPMNFeatures"></a>Activiti Designer BPMN features（Activiti设计器BPMN特性）</h4> <ul> <li> <p>Support for start event, end event, sequence flow, parallel gateway, exclusive gateway, embedded subprocess, script task, user task, service task, mail task and manual tasks. <p>支持启动事件，结束事件，顺序流，并行网关，唯一网关，嵌入式子流程，脚本任务，用户任务，服务任务，邮件任务和手动任务。 <p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/8da407249130_10FDE/designer.model.process_7.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="designer.model.process" border="0" alt="designer.model.process" src="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/8da407249130_10FDE/designer.model.process_thumb_2.png" width="914" height="467"></a></p> <li> <p>Java class or expression configuration is supported for the Java service task. In addition field extensions can be configured. <p>支持对Java服务任务进行Java类或者表达式配置。能够配置另外的字段扩展。 <p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/8da407249130_10FDE/designer.servicetask.property_4.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="designer.servicetask.property" border="0" alt="designer.servicetask.property" src="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/8da407249130_10FDE/designer.servicetask.property_thumb_1.png" width="1124" height="404"></a></p> <li> <p>Support for additional Activiti extensions like the Mail task, the candidate configuration of User tasks and Script task configuration. <p>支持像Mail任务的Activiti扩展任务，用户任务的候选人配置和脚本任务配置。</p> <li> <p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/8da407249130_10FDE/designer.mailtask.property_4.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="designer.mailtask.property" border="0" alt="designer.mailtask.property" src="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/8da407249130_10FDE/designer.mailtask.property_thumb_1.png" width="1121" height="596"></a></p> <li> <p>Support for conditions on sequence flows. <p>支持顺序流之上的条件表达式。 <p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/8da407249130_10FDE/designer.sequence.condition_4.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="designer.sequence.condition" border="0" alt="designer.sequence.condition" src="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/8da407249130_10FDE/designer.sequence.condition_thumb_1.png" width="564" height="355"></a></p></li></ul> <h4><a name="id500902"></a>Extending Activiti Designer（扩展Activiti设计器）</h4> <p>You can extend the default functionality offered by Activiti Designer. This section documents which extensions are available, how they can be used and provides some usage examples. Extending Activiti Designer is useful in cases where the default functionality doesn't suit your needs, you require additional capabilities or have domain specific requirements when modelling business processes. Extension of Activiti Designer falls into two distinct categories, extending the palette and extending output formats. Each of these extension ways requires a specific approach and different technical expertise. <p>你能够扩展由Activiti Designer提供的缺省功能。本章为哪些扩展可用，如何使用这些扩展问题提供一些有用的示例。在缺省功能不适合你的需求，你需要额外的能力，或者当对业务流程建模时具有领域特定的需求的地方，正是扩展Activiti Designer扩展有用武之地。Activiti Designer扩展有两个明显的分类：扩展面板和扩展输入格式。每个扩展方式需要特定的方法和不同的技术技巧。 <h5>Note</h5> <p>Extending Activiti Designer requires technical knowledge and more specifically, knowledge of programming in Java. Depending on the type of extension you want to create, you might also need to be familiar with Maven, Eclipse, OSGi, Eclipse extensions and SWT. <p><strong>注意</strong> <p>扩展需要技术基础和更特别的Java编程基础。依赖ni ddddd所想建立的扩展类型，你也许需要熟悉Maven，Eclipse，OSGi，Eclipse扩展和SWT。 <h5><a name="id500936"></a>Customizing the palette（定制面板）</h5> <p>You can customize the palette that is offered to users when modelling processes. The palette is the collection of shapes that can be dragged onto the canvas in a process diagram and is displayed to the right hand side of the canvas. As you can see in the default palette, the default shapes are grouped into compartments (these are called "drawers") for Events, Gateways and so on. There are two options built-in to Activiti Designer to customize the drawers and shapes in the palette: <p>当建模时，你可以给用户提供一个定制的面板。面板是能够拉至 <ul> <li> <p>Adding your own shapes / nodes to existing or new drawers <p>增加你自己的图形或者节点到已存在或新的抽屉上。</p> <li> <p>Disabling any or all of the default BPMN 2.0 shapes offered by Activiti Designer, with the exception of the connection and selection tools <p>j禁止任何Activiti Designer提供的缺省BPMN 2.0图形，连接和选择</p></li></ul> <p>In order to customize the palette, you create a JAR file that is added to a specific installation of Activiti Designer (more on <a href="file:///G:/作品/userguide/src/Zh_CN.html/#applyingExtensionToDesigner">how to do that</a> later). Such a JAR file is called an<em>extension</em>. By writing classes that are included in your extension, Activiti Designer understands which customizations you wish to make. In order for this to work, your classes should implement certain interfaces. There is an integration library available with those interfaces and base classes to extend which you should add to your project's classpath. <p>未来定制调色板，你建立一个可以添加到Activiti Designer（后面将更多介绍<a href="file:///G:/作品/userguide/src/Zh_CN.html/#applyingExtensionToDesigner">how to do that</a> ）里的JAR的文件。这样的JAR文件叫一个扩展（<em>extension</em>） 。 <h5>Note</h5> <p>You can setup your project in whichever tool you prefer and build the JAR with your build tool of choice. For the instructions below, a setup is assumed with Eclipse Helios, using Maven (3.x) as build tool, but any setup should enable you to create the same results. <p>注意 <p>ni你能够设置你喜欢的工具来设置你的项目。用这个工具来构建这个JAR包。对于下列指令，假定用Eclipse Helios设置，采用Maven（3.x）作为构建工具，但是任何设置建立相同的结果。 <h6><a name="id501018"></a>Extension setup (Eclipse/Maven)（扩展设置(Eclipse/Maven))</h6> <p>Download and extract <a href="http://www.eclipse.org/downloads">Eclipse</a> (Galileo or Helios should both work) and a recent version (3.x) of <a href="http://maven.apache.org/download.html">Apache Maven</a>. If you use a 2.x vesion of Maven, you will run into problems when building your project, so make sure your version is up to date. We assume you are familiar with using basic features and the Java editor in Eclipse. It's up to you whether your prefer to use Eclipse's features for Maven or run Maven commands from a command prompt. <p>下载并抽取 和最新版本。如果你使用Maven 2.x版本，在构建项目时将带来问题，所以确保它的版本及时更新。我们假定你熟悉Eclipse里面的基本特性和Java编辑器。是否你钟情在Eclipse里面使用Maven或者在命令行提示下使用Maven，完全取决于你。 <p>Create a new project in Eclipse. This can be a general project type. Create a <code>pom.xml</code> file at the root of the project to contain the Maven project setup. Also create folders for the <code>src/main/java</code> and <code>src/main/resources</code> folders, which are Maven conventions for your Java source files and resources respectively. Open the <code>pom.xml</code> file and add the following lines: <p>在Eclipse里面建立一个新项目。这个项目可以是一个一般类型的项目。为了包含Maven项目设置，在项目的根目录下建立一个pom.xml文件夹。也要建立 <code>src/main/java</code> 和 <code>src/main/resources</code>文件夹，这是Maven对Java源代码文件和相关资源文件的约定。打开pom.xml文件并增加下列行：<pre>&lt;project 
  xmlns="http://maven.apache.org/POM/4.0.0" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;

 &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;

 &lt;groupId&gt;org.acme&lt;/groupId&gt;
 &lt;artifactId&gt;money-tasks&lt;/artifactId&gt;
 &lt;version&gt;1.0.0&lt;/version&gt;
 &lt;packaging&gt;jar&lt;/packaging&gt;
 &lt;name&gt;Acme Corporation Money Tasks&lt;/name&gt;
...
&lt;/pom&gt;</pre>
<p>As you can see, this is just a basic pom.xml file that defines a <code>groupId</code>, <code>artifactId</code> and <code>version</code> for the project. We will create a customization that includes a single custom node for our money business.
<p>正如你所见，这只是定义了项目的 一个基本的pom.xml文件。我们
<p>Add the integration library to your project's dependencies by including this dependency in your <code>pom.xml</code> file:
<p>通过在pom.xml文件里包含项目的依赖库，将集成的库加到项目里面。<pre>&lt;dependencies&gt;
 &lt;dependency&gt;
  &lt;groupId&gt;org.activiti.designer&lt;/groupId&gt;
  &lt;artifactId&gt;org.activiti.designer.integration&lt;/artifactId&gt;
  &lt;version&gt;&lt;!-- Current Activiti Designer Version --&gt;&lt;/version&gt;
  &lt;scope&gt;compile&lt;/scope&gt;
 &lt;/dependency&gt;
&lt;/dependencies&gt;</pre>
<h5>Warning</h5>
<p>At the moment, the dependency is not available from the Activiti Maven repository. To use it, you should download it <a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/8da407249130_10FDE/org.activiti.designer.integration-0.6.0.jar">from here</a> and place it in your local Maven repository.
<p>此时，还未从Activiti的Maven仓库获得依赖。为了使用它，从这里下载 <a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/8da407249130_10FDE/org.activiti.designer.integration-0.6.0_1.jar">from here</a>，并把它放到你本地的Maven仓库里。
<p>Finally, in the<code> pom.xml</code> file, add the configuration for the <code>maven-compiler-plugin</code> so the Java source level is at least 1.5 (see snippet below). You will need this in order to use annotations. You can also include instructions for Maven to generate the JAR's <code>MANIFEST.MF</code> file. This is not required, but you can use a specific property in the manifest to provide a name for your extension (this name may be shown at certain places in the designer and is primarily intended for future use if you have several extensions in the designer). If you wish to do so, include the following snippet in <code>pom.xml</code>:
<p>最后，因为<pre>&lt;build&gt;
 &lt;plugins&gt;
        &lt;plugin&gt;
   &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
   &lt;configuration&gt;
    &lt;source&gt;1.5&lt;/source&gt;
    &lt;target&gt;1.5&lt;/target&gt;
    &lt;showDeprecation&gt;true&lt;/showDeprecation&gt;
    &lt;showWarnings&gt;true&lt;/showWarnings&gt;
    &lt;optimize&gt;true&lt;/optimize&gt;
   &lt;/configuration&gt;
  &lt;/plugin&gt;
  &lt;plugin&gt;
   &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
   &lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt;
   &lt;version&gt;2.3.1&lt;/version&gt;
   &lt;configuration&gt;
    &lt;archive&gt;
     &lt;index&gt;true&lt;/index&gt;
     &lt;manifest&gt;
      &lt;addClasspath&gt;false&lt;/addClasspath&gt;
      &lt;addDefaultImplementationEntries&gt;true&lt;/addDefaultImplementationEntries&gt;
     &lt;/manifest&gt;
     &lt;manifestEntries&gt;
      &lt;ActivitiDesigner-Extension-Name&gt;Acme Money&lt;/ActivitiDesigner-Extension-Name&gt;
     &lt;/manifestEntries&gt;
    &lt;/archive&gt;
   &lt;/configuration&gt;
  &lt;/plugin&gt;
 &lt;/plugins&gt;
&lt;/build&gt;</pre>
<p>The name for the extension is described by the <code>ActivitiDesigner-Extension-Name</code> property. The only thing left to do now is tell Eclipse to setup the project according to the instructions in <code>pom.xml</code>. So open up a command shell and go to the root folder of your project in the Eclipse workspace. Then execute the following Maven command:
<p>扩展名由<code>ActivitiDesigner-Extension-Name</code> 属性描述。唯一剩下的d事实告诉Eclipse根据文件里指令建立这个项目。所以打开一个命令shell并到Eclipse工作区的项目根文件夹。执行下面的Maven命令：<pre>mvn eclipse:eclipse</pre>
<p>Wait until the build is successful. Refresh the project (use the project's context menu (right-click) and select <code>Refresh</code>). You should now have the <code>src/main/java</code> and <code>src/main/resources</code>folders as source folders in the Eclipse project.
<p>等到构建成功完成。刷新项目（使用项目的上下文菜单（右击）并选择“刷新”（<code>Refresh</code>））。现在你应当在Eclipse项目里看见文件夹<code>src/main/java</code> 和 <code>src/main/resources</code>作为源代码文件夹。
<h5>Note</h5>
<p>You can of course also use the <a href="http://www.eclipse.org/m2e">m2eclipse</a> plugin and simply enable Maven dependency management from the context menu (right-click) of the project. Then choose <code>Maven</code> &gt; <code>Update project configuration</code> from the project's context menu. That should setup the source folders as well.
<p>你当然也可使用 <a href="http://www.eclipse.org/m2e">m2eclipse</a> 插件。简单地从上项目下文菜单（右击）启动Maven依赖管理。然后从项目的上下文菜单选择“ <code>Maven</code> &gt; <code>Update project configuration</code> ”。也要设置设置源代码。
<p>That's it for the setup. Now you're ready to start creating customizations to Activiti Designer!
<p>设置就这样弄好了。建立Activiti Designer的定制的准备工作就绪。
<h6><a name="applyingExtensionToDesigner"></a>Applying your extension to Activiti Designer（应用对Activiti Designer的扩展）</h6>
<p>You might be wondering how you can add your extension to Activiti Designer so your customizations are applied. These are the steps to do just that:
<p>你可能疑惑如何才能把自己的定制加入到Activiti Designer以便让自己的定制起作用呢。那么采取这些步骤可以解决：
<ul>
<li>
<p>Once you've created your extension JAR (for instance, by performing a mvn install in your project to build it with Maven), you need to transfer the extension to the computer where Activiti Designer is installed;
<p>一旦你建立自己的扩展JAR（例如，通过Maven在你的项目里执行一个mvn install 来构建）。你需要将这个扩展放到Activiti Designer安装的地方。</p>
<li>
<p>Store the extension somewhere on the hard drive where it will be able to remain and remember the location;
<p>ddd将扩展存储在硬盘的某个地方，在那可以保存扩展。</p>
<li>
<p>Start Activiti Designer and from the menu, select <code>Window</code> &gt; <code>Preferences</code>
<p>首先启动Activiti Designer，然后在菜单里选择 <code>Window</code> &gt; <code>Preferences</code>.</p>
<li>
<p>In the preferences screen, type <code>user</code> as keyword. You should see an option to access the <code>User Libraries</code> in Eclipse in the <code>Java</code> section.
<p>在preferences 屏幕，键入 <code>user</code> 作为关键字。你应当在Eclipse的Java部分看见访问 <code>User Libraries</code> 的选项。
<p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/8da407249130_10FDE/designer.preferences.userlibraries_4.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="designer.preferences.userlibraries" border="0" alt="designer.preferences.userlibraries" src="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/8da407249130_10FDE/designer.preferences.userlibraries_thumb_1.png" width="372" height="251"></a></p>
<li>
<p>Select the User Libraries item and a tree view shows up to the right where you can add libraries. You should see the default group where you can add extensions to Activiti Designer (depending on your Eclipse installation, you might see several others as well).
<p>选择 User Libraries 项，在右端将显示一个树形视图，在此可以添加你自己的Java库。你应当能看见扩展加入到Activiti Designer 的缺省组（依赖于你的Eclipse的安装，你可能看到其它的情况）。
<p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/8da407249130_10FDE/designer.preferences.userlibraries.activiti.empty_6.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="designer.preferences.userlibraries.activiti.empty" border="0" alt="designer.preferences.userlibraries.activiti.empty" src="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/8da407249130_10FDE/designer.preferences.userlibraries.activiti.empty_thumb_2.png" width="856" height="443"></a></p>
<li>
<p>Select the <code>Activiti Designer Extensions</code> group and click the <code>Add JARs...</code> button. Navigate to to folder where your extension is stored and select the extension file you want to add. After completing this, your preferences screen should show the extension as part of the <code>Activiti Designer Extensions</code> group, as shown below.
<p>选择组<code>Activiti Designer Extensions</code>组并点击 <code>Add JARs...</code>按钮。导航至你自己扩展所保存的文件夹并选择所要添加的扩展。完成之后，你的 preference屏幕应当显示作为 <code>Activiti Designer Extensions</code> 组的一部分的扩展，如下所示。
<p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/8da407249130_10FDE/designer.preferences.userlibraries.activiti.moneytasks_4.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="designer.preferences.userlibraries.activiti.moneytasks" border="0" alt="designer.preferences.userlibraries.activiti.moneytasks" src="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/8da407249130_10FDE/designer.preferences.userlibraries.activiti.moneytasks_thumb_1.png" width="856" height="424"></a></p>
<li>
<p>Click the <code>OK</code> button to save and close the preferences dialog. The <code>Activiti Designer Extensions</code> group is automatically added to new Activiti projects you create. You can see the user library as entry in the project's tree in the Navigator or Package Explorer. If you already had Activiti projects in the workspace, you should also see the new extensions show up in the group. An example is shown below.
<p>点击OK按钮，保存并关闭preference对话框。组自动添加到你所建的Activiti项目里面。在Navigator或者Package Explorer视图上的项目树书上，用户库作为一个条目显示。如果你在工作区上存在一个Activiti项目，那么你应当看见在组里显示的新的扩展。示例如下所示。
<p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/8da407249130_10FDE/designer.userlibraries.project_4.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="designer.userlibraries.project" border="0" alt="designer.userlibraries.project" src="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/8da407249130_10FDE/designer.userlibraries.project_thumb_1.png" width="433" height="192"></a></p></li></ul>
<p>Diagrams you open will now have the shapes from the new extension in their palette (or shapes disabled, depending on the customizations in your extension). If you already had a diagram opened, close and reopen it to see the changes in the palette.
<p>打开的流程图的有一个新的扩展，并能看见图形（依赖于你的定制，这些图形可能被禁止）。如果流程图已经打开，关闭并重新打开，观察面板发生的变化。
<h6><a name="id501543"></a>Adding shapes to the palette（把图形加到面板）</h6>
<p>With your project set up, you can now easily add shapes to the palette. Each shape you wish to add is represented by a class in your JAR. Take note that these classes are not the classes that will be used by the Activiti engine during runtime. In your extension you describe the properties that can be set in Activiti Designer for each shape. From these shapes, your refer to the runtime class that should be used by the engine. This class should implement JavaDelegate as for any ServiceTask in Activiti.
<p>一旦项目设置好，你能轻易把图形添加到面板。你想加入的图形在Jar包里用一个类来表示。注意这些类不是Activiti引擎在运行期间所使用的类。在扩展里，描述了在Activiti Designer里可以设置的属性。通过这些图形，引用应当有引擎所使用的运行期类。这些类应当为Activiti里的ServiceTask实现JavaDelegte接口。
<p>A shape's class is a simple Java class, to which a number of annotations are added. The class should implement the <code>CustomServiceTask</code> interface, but you shouldn't implement this interface yourself. Extend the <code>AbstractCustomServiceTask</code> base class instead (at the moment you MUST extend this class directly, so no abstract classes in between). In the Javadoc for that class you can find instructions on the defaults it provides and when you should override any of the methods it already implements.
<p>图形类是一个简单的Java类，加入了注释。尽管这个类应当实现接口，但是不应当你自己实现这个接口。而应当扩展这个基类作为代替（目前你必须直接扩展这个类，所以没有抽象类）。在那个类的Javadoc里面，可以找它提供的缺省功能的指令。你应当复写它已经实现的任何方法。<pre>/**
 * @author John Doe
 * @version 1
 * @since 1.0.0
 */
public class AcmeMoneyTask extends AbstractCustomServiceTask {
...
}</pre>
<p>You will need to implement the <code>getName()</code> method to determine the name the node will have in the palette. You can also put the nodes in their own drawer and provide an icon. Override the appropriate methods from <code>AbstractCustomServiceTask</code>. If you want to provide an icon, make sure it's in the <code>src/main/resources</code> package in your JAR. The path you supply is relative to that folder.
<p>需要实现 <code>getName()</code>方法来决定将在面板中节点的名称。你也能将节点放置到它们的抽屉里并提供一个图标。复写AbstractCustomServiceTask类里合适的方法。如果你想提供一个图标，确定它在JAR包里的<code>src/main/resources</code>包。提供的路径是相对路径。
<p>You can add properties to the shape by adding members to the class and annotating them with the <code>@Property</code> annotation like this:
<p>通过向类加入成员并以如下方式用 <code>@Property</code> 标注标注它们可以给图形增加属性。<pre>@Property(type = PropertyType.TEXT, displayName = "Account Number")
@Help(displayHelpShort = "Provide an account number", displayHelpLong = HELP_ACCOUNT_NUMBER_LONG)
private String accountNumber;</pre>
<p>At the moment, there are just two <code>PropertyType</code> values you can use, <code>TEXT</code> and <code>MULTILINE_TEXT</code>. Future releases will allow you to use other types. You can make a field required by setting the required attribute to true. A message and red background will appear if the user doesn't fill out the field.
<p>当前，只存在两种可以使用的<code>PropertyType</code> 值： <code>TEXT</code>和<code>MULTILINE_TEXT</code>。未来版本将允许你使用其它的类型。通过设置必选的属性为true让字段必选。如果用户没有填充字段，将出现一个消息，背景为红色。
<p>As you can see, there's also an <code>@Help</code> annotation that's used to provide the user some guidance when filling out the field. You can also use the <code>@Help</code> annotation on the class itself - this information is shown at the top of the property sheet presented to the user.
<p>如你所见，当填充字段时，也有一个标注用来提供给用户一些指南的的 <code>@Help</code>标注。也可在类自身使用 <code>@Help</code> 标注--这个信息在属性表上提供给用户信息。
<p>Below is the listing for a further elaboration of the <code>MoneyTask</code>. A comment field has been added and you can see an icon is included for the node.
<p>为了获得MoneyTask的详情，以下是列表。已经加入注释字段，并且在节点能看见图标。<pre>/**
 * @author John Doe
 * @version 1
 * @since 1.0.0
 */
@Runtime(delegationClass = "org.acme.runtime.AcmeMoneyJavaDelegation")
@Help(displayHelpShort = "Creates a new account", displayHelpLong = "Creates a new account using the account number specified")
public class AcmeMoneyTask extends AbstractCustomServiceTask {

 private static final String HELP_ACCOUNT_NUMBER_LONG = "Provide a number that is suitable as an account number.";

 @Property(type = PropertyType.TEXT, displayName = "Account Number", required = true)
 @Help(displayHelpShort = "Provide an account number", displayHelpLong = HELP_ACCOUNT_NUMBER_LONG)
 private String accountNumber;

 @Property(type = PropertyType.MULTILINE_TEXT, displayName = "Comments")
 @Help(displayHelpShort = "Provide comments", displayHelpLong = "You can add comments to the node to provide a brief description.")
 private String comments;

 /*
  * (non-Javadoc)
  * 
  * @see org.activiti.designer.integration.servicetask.AbstractCustomServiceTask #contributeToPaletteDrawer()
  */
 @Override
 public String contributeToPaletteDrawer() {
  return "Acme Corporation";
 }

 @Override
 public String getName() {
  return "Money node";
 }

 /*
  * (non-Javadoc)
  * 
  * @see org.activiti.designer.integration.servicetask.AbstractCustomServiceTask #getSmallIconPath()
  */
 @Override
 public String getSmallIconPath() {
  return "icons/coins.png";
 }
}</pre>
<p>If you extend Activiti Designer with this shape, The palette and corresponding node will look like this:
<p>如果用这个图形扩展Activiti Designer，面板及其相关节点如下所示：
<p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/8da407249130_10FDE/designer.palette.add.money_4.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="designer.palette.add.money" border="0" alt="designer.palette.add.money" src="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/8da407249130_10FDE/designer.palette.add.money_thumb_1.png" width="374" height="217"></a>
<p>The properties screen for the money task is shown below. Note the required message for the <code>accountNumber</code> field.
<p>money任务的属性屏幕如下所示。注意 <code>accountNumber</code>字段的必填的消息。
<p align="center"><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/8da407249130_10FDE/designer.palette.add.money.properties.required_4.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="designer.palette.add.money.properties.required" border="0" alt="designer.palette.add.money.properties.required" src="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/8da407249130_10FDE/designer.palette.add.money.properties.required_thumb_1.png" width="1028" height="372"></a>
<p>The help for fields is offered by the buttons to the right of each property. Clicking on the button shows a popup as displayed below.
<p>在每个属性的右侧的按钮提供字段的帮助信息。点击按钮将显示如下弹出的信息。
<p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/8da407249130_10FDE/designer.palette.add.money.help_4.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="designer.palette.add.money.help" border="0" alt="designer.palette.add.money.help" src="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/8da407249130_10FDE/designer.palette.add.money.help_thumb_1.png" width="962" height="232"></a>
<p>The final step for your shape is to indicate the class that is instantiated by the Activiti engine when it reaches your node when executing a process instance. To do this, you use the <code>@Runtime</code> annotation. The <code>delegationClass</code> attribute you return should contain the canonical name of the runtime class. Note that the runtime class shouldn't be in your extension JAR, as it's dependent on the Activiti libraries.
<p>当执行一个流程实例时，Activiti引擎到达你的节点。图形的最终步骤指明被Activiti引擎实例化的那个类。可以 <code>@Runtime</code> 标注来完成这个功能。返回属性应当包含运行时期的正规名称。注意运行时期类不应当在扩展JAR包里，因为它依赖于Activiti类库。<pre>@Runtime(delegationClass = "org.acme.runtime.AcmeMoneyJavaDelegation")</pre>
<h6><a name="id501831"></a>Disabling default shapes in the palette（禁止面板里的缺省图形）</h6>
<p>This customization requires you to include a class in your extension that implements the <code>DefaultPaletteCustomizer</code> interface. You should not implement this interface directly, but subclass the <code>AbstractDefaultPaletteCustomizer</code> base class. Currently, this class provides no functionality, but future versions of the <code>DefaultPaletteCustomizer</code> interface will offer more capabilities for which this base class will provide some sensible defaults so it's best to subclass so your extension will be compatible with future releases.
<p>这个定制需要你在扩展里包含实现接口的类。你不应当直接实现这个接口，而是子类化<code>AbstractDefaultPaletteCustomizer</code> 基类。当前，接口的未来版本将提供为那些基类通过更多功能，所以最好子类化，这样，你的扩展将会和未来的版本。
<p>Extending the <code>AbstractDefaultPaletteCustomizer</code> class requires you to implement one method, <code>disablePaletteEntries()</code>, from which you must return a list of <code>PaletteEntry</code> values. For each of the default shapes, you can disable it by adding its corresponding <code>PaletteEntry</code> value to your list. Note that if you remove shapes from the default set and there are no remaining shapes in a particular drawer, that drawer will be removed from the palette in its entirety. If you wish to disable all of the default shapes, you only need to add<code>PaletteEntry.ALL</code> to your result. As an example, the code below disables the Manual task and Script task shapes in the palette.
<p>扩展 <code>AbstractDefaultPaletteCustomizer</code>类需要你实现一个<code>disablePaletteEntries()</code>方法，你必须返回一个 <code>PaletteEntry</code>值列表。对于每个缺省图形，通过增加相关的 <code>PaletteEntry</code>值到你的列表，你能禁止它。注意如果从缺省集合里删除图形，特别的抽屉里没有任何图形，那么这个抽屉也将从面板中删除。如果你想禁止所有缺省的图形，你只需要把加入<code>PaletteEntry.ALL</code> 到结果。作为一个示例，下列代码禁止了面板中的手动任务和脚本任务。<pre>public class MyPaletteCustomizer extends AbstractDefaultPaletteCustomizer {

 /*
  * (non-Javadoc)
  *
  * @see org.activiti.designer.integration.palette.DefaultPaletteCustomizer#disablePaletteEntries()
  */
 @Override
 public List&lt;PaletteEntry&gt; disablePaletteEntries() {
  List&lt;PaletteEntry&gt; result = new ArrayList&lt;PaletteEntry&gt;();
  result.add(PaletteEntry.MANUAL_TASK);
  result.add(PaletteEntry.SCRIPT_TASK);
  return result;
 }

}</pre>
<p>The result of applying this extension is shown in the picture below. As you can see, the manual task and script task shapes are no longer available in the <code>Tasks</code> drawer.
<p>这个扩展的应用效果如下图所示。如你所见，手动任务和脚本任务的图形不在Task抽屉上获取。
<p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/8da407249130_10FDE/designer.palette.disable.manual.and.script_4.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="designer.palette.disable.manual.and.script" border="0" alt="designer.palette.disable.manual.and.script" src="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/8da407249130_10FDE/designer.palette.disable.manual.and.script_thumb_1.png" width="234" height="214"></a>
<p>To disable all of the default shapes, you could use something similar to the code below.
<p>为了禁止所有的缺省图形，你可以应当使用和下列相似的代码。<pre>public class MyPaletteCustomizer extends AbstractDefaultPaletteCustomizer {

 /*
  * (non-Javadoc)
  *
  * @see org.activiti.designer.integration.palette.DefaultPaletteCustomizer#disablePaletteEntries()
  */
 @Override
 public List&lt;PaletteEntry&gt; disablePaletteEntries() {
  List&lt;PaletteEntry&gt; result = new ArrayList&lt;PaletteEntry&gt;();
  result.add(PaletteEntry.ALL);
  return result;
 }

}</pre>
<p>The result will look like this (notice that the drawers the default shapes were in are no longer in the palette):
<p>结果将如下相似（注意缺省图形原来所在的抽屉也不在面板里面了）。
<p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/8da407249130_10FDE/designer.palette.disable.all_4.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="designer.palette.disable.all" border="0" alt="designer.palette.disable.all" src="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/8da407249130_10FDE/designer.palette.disable.all_thumb_1.png" width="249" height="216"></a>
<h5><a name="id502000"></a>Exporting to custom output formats（输出定制的格式）</h5>
<p>You can extend Activiti Designer to publish to additional formats when saving diagrams. These extensions are called <code>Export Marshallers</code> and are invoked automatically by Activiti Designer on each save action by the user. This behavior can be enabled or disabled by setting a preference in Eclipse's preferences dialog for each format to be saved.
<p>当你保存流程图时，你能够扩展Activiti Designer 发表另外的格式。这些扩展被称为。当用户每次采取保存的行为时，由Activiti Designer自动调用。
<p>You can compare these extensions to the BPMN 2.0 export and process image saving that's performed during save actions by default in Activiti Designer. In fact, these functions use exactly the same extension features you can use to save to your own formats.
<p>你能将这些功能和BPMN 2.0输出和流程图像进行比较。缺省地，后者在Activiti Designer里在保存动作期间完成。 
<p>事实上，这些功能完全使用你能使用的相同的扩展特性。它通常保存为你自己的格式。
<p>To create an <code>Export Marshaller</code>, you need to create a different kind of extension than for extending the palette. The reason for this is simple: from your code you will need access to more APIs than are offered by the integration library. In particular, you will need classes that are available in Eclipse itself. The way to implement an <code>Export Marshaller</code>is therefore to create an Eclipse plugin (which you can do by using Eclipse's PDE support) and package it in a custom Eclipse product. It's beyond the scope of this user guide to explain all the details involved in developing Eclipse plugins, so the instructions below are limited to the functionality for extending Activiti Designer.
<p>为了建立一个输出解组（ <code>Export Marshaller</code>)，你需要建立不同种类的扩展，而不是扩展面板。这个原因是简单的：从代码观点来看，你将需要比访问比集成库需要更多的API。特别地，你将需要Eclipse里能够获取的类。实现一个<code>Export Marshaller</code> 方法是建立一个Eclipse的插件（通过Eclipse的PDE支持），并且在一个定制的Eclipse产品里将它打包。解释所有关于开发Eclipse 插件的细节超过了本用户指南的范围，所以下列指令被限制为扩展Activiti Designer的功能。
<p>Your bundle should be dependent on the following libraries:
<p>你的bundle应当依赖下列库：
<p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/8da407249130_10FDE/designer.export.dependencies_4.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="designer.export.dependencies" border="0" alt="designer.export.dependencies" src="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/8da407249130_10FDE/designer.export.dependencies_thumb_1.png" width="470" height="337"></a>
<p>Create an extension to the <code>org.activiti.designer.eclipse.extension.export.ExportMarshaller</code> extension point. For this extension point, you are required to subclass the <code>AbstractExportMarshaller</code>class. This abstract base class provides you with a number of useful methods when marshalling to your own format, such as adding markers to Eclipse's problems view and saving resources to the workspace.
<p>建立一个<code>org.activiti.designer.eclipse.extension.export.ExportMarshaller</code> 扩展点的扩展。对于这个扩展点，需要子类化 <code>AbstractExportMarshaller</code>这个类。当自己的格式时这个抽象基类提供了大量的有用的方法，诸如在Eclipse Problem视图添加标记，并把资源保存到工作区里面。
<p>You are required to implement some methods, such as <code>getMarshallerName()</code> and <code>getFormatName()</code>. These methods are used to display options to the user and to show information in progress dialogs, so make sure the descriptions you return reflect the functionality you are implementing.
<p>需要实现诸如这样<code>getMarshallerName()</code> 和 <code>getFormatName()</code>的方法。这些方法用来显示用户的选项和显示进度对话框的信息，这样确保返回的描述反应了所实现的功能。
<p>The bulk of your work is performed in the <code>marshallDiagram(Diagram diagram, IProgressMonitor monitor)</code> method. You are provided with the diagram object, which contains all of the information about the objects in the diagram (BPMN constructs) and the graphical representation. If you want to access the diagram through its resource in Eclipse or you want to transform the diagram using XSLT, there are methods to get to <code>Resources</code> and <code>InputStreams</code> for the diagram in the <code>AbstractExportMarshaller</code> class.
<p>工作的大部分在 <code>marshallDiagram(Diagram diagram, IProgressMonitor monitor)</code>方法里面执行。提供了流程图对象，它包含关于流程图(BPMN构件）对象和图形表示的所有信息。如果你想通过Eclipse里的一样访问流程图，或者你想采用XSLT来转换流程图，在<code>AbstractExportMarshaller</code> 类里有为流程图获取<code>Resources</code> 和的 <code>InputStreams</code>方法。
<p>It's probably a good idea to invoke <code>clearProblems()</code> as one of the first things you do; this will clear any previous markers for your marshaller. You should also use the progress monitor provided to report your progress back to the user. If you need examples on how to do this, take a look at the code of Activiti Designer itself.
<p>首先调用 <code>clearProblems()</code> 方法可能是个好主意；这将清除 marshaller先前的标记。你也应当所提供的进度监视器，向用户报告进展情况。如果需要如何完成这样功能的示例，请参考Activiti Designer 自身的代码。
<ul>
<li>
</li></ul><img src ="http://www.blogjava.net/lewhwa/aggbug/339261.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lewhwa/" target="_blank">网路冷眼@BlogJava</a> 2010-11-28 19:26 <a href="http://www.blogjava.net/lewhwa/archive/2010/11/28/339261.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Activiti User Guide（Activiti用户指南)-Chapter 12. Activiti Modeler(Activiti建模器)</title><link>http://www.blogjava.net/lewhwa/archive/2010/11/28/BPM-Activiti-Modeler.html</link><dc:creator>网路冷眼@BlogJava</dc:creator><author>网路冷眼@BlogJava</author><pubDate>Sun, 28 Nov 2010 11:16:00 GMT</pubDate><guid>http://www.blogjava.net/lewhwa/archive/2010/11/28/BPM-Activiti-Modeler.html</guid><wfw:comment>http://www.blogjava.net/lewhwa/comments/339260.html</wfw:comment><comments>http://www.blogjava.net/lewhwa/archive/2010/11/28/BPM-Activiti-Modeler.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/lewhwa/comments/commentRss/339260.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lewhwa/services/trackbacks/339260.html</trackback:ping><description><![CDATA[<h4>Chapter 12. Activiti Modeler(Activiti建模器)</h4>
<p><strong>Table of Contents</strong> </p>
<dl> <dt><a href="#id478324">Changing the location of the process model repository(变更流程模型仓库的位置)</a>  </dt><dt><a href="#id478371">Changing the host of the Modeler(变更建模器的主机)</a></dt></dl>
<p>The Activiti Modeler is a web based process editor that can be used to author BPMN 2.0 process graphically using nothing more then a browser. The process files are stored by the server on a the file system, such that they are easily accessible and can be imported without hassles into any Java IDE. </p>
<p>Activiti建模器(Activiti Modeler)是一个用来仅在浏览器里面以图形化编辑BPMN 2.0流程的，基于Web的流程编辑器。通过服务器流程文件存在文件系统，所以很容易对它们进行访问，并无忧输入到任何JavaIDE里面。 </p>
<p>Bugs and issues can be reported on the <a href="http://code.google.com/p/signavio-core-components/issues/list">Signavio core components issue tracker</a>. </p>
<p>可以将缺陷和问题报告到<a href="http://code.google.com/p/signavio-core-components/issues/list">Signavio core components issue tracker</a>. </p>
<p>The Activiti Modeler is automatically installed during the <a href="file:///G:/作品/userguide/src/Zh_CN.html/#">demo setup</a>. </p>
<p>在<a href="file:///G:/作品/userguide/src/Zh_CN.html/#">demo setup</a>过程中自动安装Activiti Modeler。 </p>
<p><a href="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/21faf6b261c1_10E28/activiti-modeler_4.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px; padding-top: 0px" title="activiti-modeler" border="0" alt="activiti-modeler" src="http://www.blogjava.net/images/blogjava_net/lewhwa/Windows-Live-Writer/21faf6b261c1_10E28/activiti-modeler_thumb_1.png" width="826" height="482" /></a> </p>
<h4><a name="id478324"></a>Changing the location of the process model repository(变更流程模型仓库的位置)</h4>
<p>After running the demo setup, process XML files are stored in the <em>apps/activiti-model-repository</em> folder. The location of the file-based repository can be switched by changing the <strong>fileSystemRootDirectory</strong> property in the <strong>(exploded)activiti-modeler.war/WEB-INF/classes/configuration.properties</strong> file. </p>
<p>在运行演示创建的过程之后，流程XML文件将会保存在apps/activiti-model-repository文件夹。通过变更在<strong>(exploded)activiti-modeler.war/WEB-INF/classes/configuration.properties</strong>文件里的<strong> fileSystemRootDirectory </strong>属性，来切换基于文件的仓库位置。 </p>
<h4><a name="id478371" style="width: 20px; height: 20px; text-indent: 20px; background-image: url(http://www.blogjava.net/CuteSoft_Client/CuteEditor/Load.ashx?type=image&amp;file=anchor.gif); background-repeat: no-repeat no-repeat; "></a>Changing the host of the Modeler(变更建模器的主机)</h4>
<p>After running the demo setup, the Activiti Modeler will accessible only on the <em>localhost</em> address. When you want to change the host of the Modeler, e.g. to run it centrally on a server, change the <strong>host</strong> property in the <strong>(exploded)activiti-modeler.war/WEB-INF/classes/configuration.properties</strong> file. </p>
<p>在运行演示创建之后，将只能从localhost地址访问Activiti Modeler。当你想变更Modeler的主机，例如，在一个服务器上集中运行。那么，请你变更在<strong>(exploded)activiti-modeler.war/WEB-INF/classes/configuration.properties</strong> 文件的<strong>host</strong>属性。</p>
<pre>&gt; cat configuration.properties
host = http://192.168.1.101:8080
fileSystemRootDirectory = /Users/jbarrez/Development/model-repo</pre><img src ="http://www.blogjava.net/lewhwa/aggbug/339260.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lewhwa/" target="_blank">网路冷眼@BlogJava</a> 2010-11-28 19:16 <a href="http://www.blogjava.net/lewhwa/archive/2010/11/28/BPM-Activiti-Modeler.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>