锘??xml version="1.0" encoding="utf-8" standalone="yes"?> 9.1. Tasks 浠誨姟 Tasks can be defined in task-nodes and in the process-definition. The most common way is to define one or more tasks in a task-node. In that case the task-node represents a task to be done by the user and the process execution should wait until the actor completes the task. When the actor completes the task, process execution should continue. When more tasks are specified in a task-node, the default behaviour is to wait for all the tasks to complete. Tasks can also be specified on the process-definition. Tasks specified on the process definition can be looked up by name and referenced from within task-nodes or used from inside actions. In fact, all tasks (also in task-nodes) that are given a name can be looked up by name in the process-definition. Task names must be unique in the whole process definition. Tasks can be given a priority. This priority will be used as the initial priority for each task instance that is created for this task. TaskInstances can change this initial priority afterwards. 9.2. Task instances The jBPM task list mechanism can combine jBPM tasks with other tasks, even when those tasks are unrelated to a process execution. That way jBPM developers can easily combine jBPM-process-tasks with tasks of other applications in one centralized task-list-repository. 榪欎釜jBPM浠誨姟鍒楄〃鏈哄埗鍙互緇勫悎jBPM浠誨姟鍜屽叾浠栦換鍔★紝鐢氳嚦褰撹繖浜涗換鍔′簬嫻佺▼鎵ц鏃犲叧銆傞偅縐嶆柟娉昷BPM寮鍙戣呭彲浠ュ緢瀹規(guī)槗鐨勫湪涓涓泦涓殑浠誨姟鍒楄〃浠撳簱涓粍鍚坖BPM嫻佺▼浠誨姟鍜屽叾浠栧簲鐢ㄧ▼搴忋?/P>
9.2.1. Task instance life cycle Note that for flexibility, assignment is not part of the life cycle. So task instances can be assigned or not assigned. Task instance assignment does not have an influence on the task instance life cycle. 娉ㄦ剰瀵歸傚簲鎬с佸媧句笉鏄敓鍛藉懆鏈熺殑緇勬垚閮ㄥ垎銆傛墍浠ヤ換鍔″疄渚嬪彲浠ヨ濮旀淳鎴栬呬笉濮旀淳銆備換鍔″疄渚嬪媧懼湪鐢熷懡鍛ㄦ湡浠誨姟瀹炰緥涓病鏈夊獎鍝嶃?/P>
Task instances are typically created by the process execution entering a task-node (with the method TaskMgmtInstance.createTaskInstance(...)). Then, a user interface component will query the database for the tasklists using the TaskMgmtSession.findTaskInstancesByActorId(...). Then, after collecting input from the user, the UI component calls TaskInstance.assign(String), TaskInstance.start() or TaskInstance.end(...). TaskMgmtInstance.createTaskInstance(...) Currently, completed task instances are marked with an end date so that they are not fetched with subsequent錛堥殢鍚庯級 queries for tasks lists. But they remain in the JBPM_TASKINSTANCE table. JBPM_TASKINSTANCE. 9.2.2. Task instances and graph execution 浠誨姟瀹炰緥鍜屽浘褰㈡墽琛?BR>Task instances are the items in an actor's tasklist. Task instances can be signalling. A signalling task instance is a task instance that, when completed, can send a signal to its token to continue the process execution. Task instances can be blocking, meaning that the related token (=path of execution) is not allowed to leave the task-node before the task instance is completed. By default task instances are signalling and non-blocking. In case錛堜互闃詫級 more than one task instance are associated with a task-node, the process developer can specify how completion of the task instances affects continuation of the process. Following is the list of values that can be given to the signal-property of a task-node. last: This is the default. Proceeds execution when the last task instance is completed. When no tasks are created on entrance of this node, execution is continued. public class CreateTasks implements ActionHandler { // now, 2 task instances are created for the same task. The API method for marking task instances as completed is TaskInstance.end(). Optionally, you can specify a transition in the end method. In case the completion of this task instance triggers continuation of the execution, the task-node is left over錛堝歡榪燂級 the specified transition.
name="className" //瀛愮被鐨勫叏鍚?BR> discriminator-value="discriminator-value"銆//杈ㄥ埆鏍囪瘑錛屼竴涓敤浜庡尯鍒嗘瘡涓嫭绔嬬殑瀛愮被鐨勫?BR> proxy="proxyInterface" //鎸囧畾涓涓被鎴栨帴鍙o紝鍦ㄥ歡榪熷姞杞芥椂浣滀負(fù)浠g悊浣跨敤
lazy="true|false"
dynamic-update="true|false"
dynamic-insert="true|false"
entity-name="entityName"
node="element-name">
<property ..../>
......
</subclass>
銆銆2.姣忎釜瀛愮被閮藉簲璇ュ畾涔夊畠鑷繁鐨勬寔涔呭寲灞炴у拰瀛愮被銆?lt;version>鍜?lt;id>灞炴у彲浠ヤ粠鏍圭埗綾葷戶鎵夸笅鍘匯傚湪涓媯電戶鎵挎爲(wèi)涓婄殑姣忎釜瀛愮被閮藉繀欏誨畾涔変竴涓敮涓鐨刣iscriminator-value銆傚鏋滄病鏈夋寚瀹氾紝灝變細(xì)浣跨敤Java綾葷殑鍏ㄩ檺瀹氬悕銆?BR>銆銆3.蹇呴』鍦ㄥ瓙綾葷殑褰卞皠涓寚瀹歟xtends灞炴ф潵鎸囧畾宸插獎灝勭殑瓚呯被銆?BR>
銆(浜?鍦╦BPM涓殑浣跨敤
銆1.鍦╦BPM鐨刣efinition緇勭殑綾繪満鏋勪腑灝遍噰鐢ㄤ笂榪扮殑鎶鏈傚叾涓璏oduleDefinition鏄綔涓烘娊璞$埗綾誨瓨鍦ㄧ殑錛岃孋ontextDefinition銆丗ileDefinition銆丩oggingDefinition銆丼chedulerDefinition銆丮gmtDefinition綾繪槸鍋氫負(fù)subclass瀛樺湪鐨勩?BR>銆2.鍦ㄧ埗綾諱腑浣跨敤浜哾iscriminator閴村埆鍣ㄧ殑鎶鏈細(xì)鍦ㄧ戶鎵跨瓥鐣ヤ腑鐨勨?STRONG>涓涓璞$戶鎵挎爲(wèi)搴斿搴斾竴涓〃鈥濈殑絳栫暐涓紝<discriminator>鍏冪礌鏄繀欏葷殑銆傞壌鍒櫒瀛楁鍖呭惈鏍囧織鍊鹼紝鐢ㄤ簬鍛婄煡鎸佷箙灞傚簲璇ヤ負(fù)鏌愪釜鐗瑰畾鐨勮鍒涘緩鍝竴涓被鍒殑瀹炰緥銆備緥濡傦細(xì)
鐖剁被鐨勫獎灝勭墖孌碉細(xì)
<discriminator type="char" column="CLASS_"/>
<!-- M : org.jbpm.module.def.ModuleDefinition -->
<!-- C : org.jbpm.context.def.ContextDefinition -->
<!-- F : org.jbpm.file.def.FileDefinition -->
<!-- L : org.jbpm.logging.def.LoggingDefinition -->
<!-- I : org.jbpm.scheduler.def.SchedulerDefinition -->
<!-- T : org.jbpm.taskmgmt.def.TaskMgmtDefinition -->
<!-- : -->
<!-- : -->
銆3.閴村埆鍣ㄥ瓧孌電殑瀹為檯鍊兼槸鏍規(guī)嵁<class>鍜?lt;subclass>鍏冪礌涓殑discriminator-value灞炴у緱鏉ョ殑銆?BR>銆渚嬪錛?BR>銆銆鐖跺獎灝勬枃浠訛細(xì)
銆銆<class name="org.jbpm.module.def.ModuleDefinition"
table="JBPM_MODULEDEFINITION"
abstract="true"
discriminator-value="M"
lazy="false">
瀛愬獎灝勬枃浠訛細(xì)
銆銆<subclass name="org.jbpm.context.def.ContextDefinition"
extends="org.jbpm.module.def.ModuleDefinition"
discriminator-value="C"
lazy="false">
</subclass>
銆銆public static String getString(String key)
銆銆public static String getString( String key, String defaultValue )銆//濡傛灉娌℃湁榪欎釜鍊鹼紝榛樿榪斿洖鐨勬槸defaultValue
銆銆public static long getLong( String key, long defaultValue )
銆銆public static boolean getBoolean(String key, boolean defaultValue)
銆銆public static Object getObject(String key)
銆銆public static Object getObject(String key, Object defaultValue)
銆銆榪欎簺涓鴻幏鍙朣tring銆乴ong銆乥oolean銆丱bject鎻愪緵鍩虹鐨勬敮鎸侊紝涓轟互鍚庣殑鎿嶄綔鎻愪緵浜嗗緢澶氱殑鏂逛究銆?/P>
The core business of jBPM is the ability to persist the execution of a process. A situation in which this feature is extremely useful is the management of tasks and tasklists for people. jBPM allows to specify a piece of software describing an overall process which can have wait states for human tasks.
jBPM鐨勬牳蹇冮昏緫鏄湁鑳藉姏鎸佷箙鍖栨祦紼嬬殑鎵ц銆備竴涓負(fù)浜轟滑鐢ㄦ潵綆$悊浠誨姟鍜屼換鍔″垪琛ㄧ殑鐗瑰緛鐨勬儏褰㈡槸闈炲父鏈夌敤鐨勩俲BPM鍏佽鎸囧畾涓浜涜蔣浠舵弿榪頒竴涓叏闈㈢殑嫻佺▼錛屽畠鍙互涓轟漢浠誨姟鎷ユ湁絳夊緟鐘舵併?/P>
Tasks are part of the process definition and they define how task instances must be created and assigned during process executions.
浠誨姟鏄祦紼嬪畾涔夌殑涓閮ㄥ垎錛屽茍涓斾粬浠畾涔変簡浠誨姟瀹炰緥濡備綍鍦ㄦ祦紼嬫墽琛屼腑蹇呴』琚垱寤哄茍涓斿媧俱?/P>
浠誨姟鍙互鍦╰ask-nodes鍜宲rocess-definition涓瀹氫箟銆傛渶甯哥敤鐨勬柟寮忔槸鍦╰ask-node涓畾涔変竴涓垨澶氫釜浠誨姟銆傚鏋滄槸閭f牱鐨勮瘽錛宼ask-node琛ㄧ幇涓涓換鍔¤鐢ㄦ埛鎵ц騫朵笖嫻佺▼鎵ц搴旇絳夊緟鐭ラ亾actor瀹屾垚榪欎釜浠誨姟銆傚綋榪欎釜actor瀹屾垚榪欎釜浠誨姟錛屾祦紼嬪畾涔夊簲璇ョ戶緇傚綋鏇村浠誨姟鍦╰ask-node琚畾涔夛紝緙虹渷鐨勮涓烘槸絳夊緟鎵鏈変換鍔$殑瀹屾垚銆?/P>
浠誨姟涔熻瀹氫箟鍦╬rocess-definition涓傛寚瀹氬湪嫻佺▼瀹氫箟涓婄殑浠誨姟鍙互閫氳繃鍚嶇О鏌ヨ騫朵笖鍙傝冧粠鍐呴儴鐨則ask-nodes鎴栬呬粠鍐呴儴actions涓嬌鐢ㄣ備簨瀹炰笂錛屾墍鏈夌殑緇欏畾鍚嶇О浠誨姟錛堜篃鍦╰ask-nodes錛夊彲浠ュ湪嫻佺▼瀹氫箟涓氳繃鍚嶅瓧鏌ヨ銆?/P>
浠誨姟鍚嶇О鍦ㄦ暣涓祦紼嬪畾涔変腑鏄潪閲嶅銆備換鍔″彲浠ヨ鎸囧畾涓涓紭鍏堟潈銆傝繖涓紭鍏堟潈?yōu)畣琚娇鐢ㄥ湪鍒濆鍖栦紭鍏堟潈湄?fù)姣忎釜涓轟換鍔″垱寤虹殑嫻佺▼瀹炰緥銆備換鍔″疄渚嬬劧鍚庡彲浠ヤ慨鏀瑰垵濮嬪寲浼樺厛鏉?/P>
A task instance can be assigned to an actorId (java.lang.String). All task instances are stored in one table of the database (JBPM_TASKINSTANCE). By querying this table for all task instances for a given actorId, you get the task list for that perticular user.
涓涓換鍔″疄渚嬪彲浠ヨ濮旀淳緇欎竴涓猘ctorId(java.lang.String).鎵鏈変換鍔″疄渚嬭鍌ㄥ瓨鍦ㄦ暟鎹簱鐨勪竴涓〃涓?JBPM_TASKINGSTANCE)銆傞氳繃緇欏畾鐨刟ctorId鏉ュ鎵鏈夌殑浠誨姟瀹炰緥鏌ヨ榪欎釜琛紝浣犱負(fù)鐗瑰畾鐢ㄦ埛寰楀埌浠誨姟鍒楄〃銆?/P>
The task instance lifecycle is straightforward: After creation, task instances can optionally be started. Then, task instances can be ended, which means that the task instance is marked as completed.
浠誨姟瀹炰緥鐢熷懡鍛ㄦ湡鏄畝鍗曠殑錛氬垱寤轟箣鍚庯紝浠誨姟瀹炰緥鍙互闅忔剰鍦板紑濮嬨傛帴鐫錛屼換鍔″疄渚嬪彲浠ヨ緇堢粨錛岃繖鎰忓懗鐫浠誨姟瀹炰緥鍐呮爣蹇椾負(fù)瀹屾垚銆?/P>
TaskMgmtSession.findTaskInstancesByActorId(...)
TaskInstance.assign(String)
TaskInstance.start()
TaskInstance.end()
A task instance maintains it's state by means of date-properties : create, start and end. Those properties can be accessed by their respective getters on the TaskInstance.
涓涓換鍔″疄渚嬬淮鎶ゅ畠鐨勭姸鎬佸熷姪浜庢棩鏈熷睘鎬э細(xì)create,start 鍜宔nd. 榪欎簺灞炴у彲浠ュ湪浠誨姟瀹炰緥涓氳繃浠栦滑鍒嗗埆鐨刧etter鑾峰緱閫氶亾銆?/P>
last-wait: Proceeds execution when the last task instance is completed. When no tasks are created on entrance of this node, execution waits in the task node till tasks are created.
first: Proceeds execution when the first task instance is completed. When no tasks are created on entrance of this node, execution is continued.
first-wait: Proceeds execution when the first task instance is completed. When no tasks are created on entrance of this node, execution waits in the task node till tasks are created.
unsynchronized: Execution always continues, regardless wether tasks are created or still unfinished.
never: Execution never continues, regardless wether tasks are created or still unfinished.
Task instance creation might be based upon a runtime calculation. In that case, add an ActionHandler on the node-enter event of the task-node and set the attribute create-tasks="false". Here is an example of such an action handler implementation:
public void execute(ExecutionContext executionContext) throws Exception {
Token token = executionContext.getToken();
TaskMgmtInstance tmi = executionContext.getTaskMgmtInstance();
TaskNode taskNode = (TaskNode) executionContext.getNode();
Task changeNappy = taskNode.getTask("change nappy");
tmi.createTaskInstance(changeNappy, token);
tmi.createTaskInstance(changeNappy, token);
}
}
As shown in the example the tasks to be created can be specified in the task-node. They could also be specified in the process-definition and fetched from the TaskMgmtDefinition. TaskMgmtDefinition extends the ProcessDefinition with task management information.
token
node
task
taskInstance
<process-definition>
<event type="node-enter">
<script>
System.out.println("this script is enering node"+node);
</script>
</event>
...
</process-definition>
涓哄畾鍒剁己鐪佸姞杞借涓哄茍涓斿偍瀛樺彉閲忚繘script錛屽彉閲忓厓绱犲彲浠ヨ鐢ㄦ潵浣滀負(fù)script鐨勫瓙鍏冪礌銆傞偅鏍鳳紝鑴氭湰琛ㄨ揪寮忎笉寰椾笉琚斁鍏ヤ竴涓剼鏈殑瀛愬厓绱?expression
<prcession-definition>
<event type="process-end">
<expression>
a = b+c;
</expression>
<variable name="XXX" access="write" mapped-name="a"/>
<variable name="YYY" access="read" mapped-name="b"/>
<variable name="ZZZ" access="read" mapped-name="c"/>
</event>
</prcession-definition>
鍦ㄨ剼鏈紑濮嬩箣鍓嶏紝榪欎釜嫻佺▼鍙橀噺YYY鍜孼ZZ灝嗗垎鍒綔涓鴻剼鏈彉閲廱鍜宑浣垮叾鍚堟硶銆傛墍鏈夎剼鏈畬鎴愪箣鍚庯紝鑴氭湰鍙橀噺鍊糰琚瓨鍌ㄨ繘嫻佺▼鍙橀噺XXX.
濡傛灉access鍙橀噺灞炴у寘鍚?read"錛岃繖涓祦紼嬪彉閲忓湪鑴氭湰璧嬪間箣鍓嶅皢琚姞杞戒綔涓轟竴涓剼鏈彉閲忋傚鏋渁ccess鍙橀噺灞炴у寘鍚?write"錛岃繖涓祦紼嬪彉閲忓湪鑴氭湰璧嬪間互鍚庡皢琚姞杞戒綔涓轟竴涓剼鏈彉閲忋?/P>
7.3.3. Nodetype state 鑺傜偣綾誨瀷銆鐘舵?BR>A state is a bare-bones wait state. The difference with a task node is that no task instances will be created in any task list. This can be usefull if the process should wait for an external system. E.g. upon entry of the node (via an action on the node-enter event), a message could be sent to the external system. After that, the process will go into a wait state. When the external system send a response message, this can lead to a token.signal(), which triggers resuming of the process execution.
銆銆涓涓姸鎬佹槸瑁擱絳夊緟鐘舵併傝繖涓笉鍚屼竴涓換鍔¤妭鐐圭殑鏄病鏈変換鍔″疄渚嬪皢琚垱寤哄湪浠誨姟浠誨姟鍒楄〃涓傝繖鍙互鏄湁鐢ㄧ殑錛屽鏋滄祦紼嬪簲褰撲負(fù)澶栭儴緋葷粺絳夊緟銆備緥濡傦紝鍦ㄨ妭鐐瑰疄浣撲箣涓婏紙渚濋潬鍦ㄨ妭鐐硅繘鍏ヤ簨浠剁殑涓涓姩浣滐級錛屼竴涓秷鎭皢琚彂閫佸埌澶栭儴緋葷粺銆傛瘯绔燂紝榪欎釜嫻佺▼灝嗚繘鍏ョ瓑寰呯姸鎬併傚綋澶栭儴緋葷粺鍙戦佷竴涓繑鍥炰俊鎭紝榪欏彲浠ュ鑷磘oken.signal(),榪欏皢瑙﹀彂涓涓祦紼嬫墽琛岀殑鎭㈠銆?/P>
7.3.4. Nodetype decision銆鑺傜偣綾誨瀷銆鍐沖畾
Actually there are 2 ways to model a decision. The distinction between the two is based on *who* is making the decision. Should the decision made by the process (read: specified in the process definition). Or should an external entity provide the result of the decision.
銆銆瀹為檯涓婅繖閲屾湁涓ょ鏂規(guī)硶鏉ュ垱寤轟竴涓喅瀹氥備袱鑰呯殑鍖哄埆鏄熀璋佸湪鍋氳繖涓喅瀹氥傘搴旇琚祦紼嬫潵鍐沖畾銆傦紙闄愬畾鍦ㄦ祦紼嬪畾涔変腑錛夋垨鑰呭簲璇ヤ竴涓閮ㄥ疄浣撴敮鎸佸喅瀹氱殑緇撴灉銆?/P>
When the decision is to be taken by the process, a decision node should be used. There are basically 2 ways to specify the decision criteria. Simplest is by adding condition elements on the transitions. Conditions are beanshell script expressions that return a boolean. At runtime the decision node will loop over its leaving transitions (in the order as specified in the xml), and evaluate each condition. The first transition for which the conditions resolves to 'true' will be taken. Alternatively, an implementation of the DecisionHandler can be specified. Then the decision is calculated in a java class and the selected leaving transition is returned by the decide-method of the DecisionHandler implementation.
銆銆褰撹繖涓喅瀹氳嫻佺▼鎵ц錛屼竴涓喅瀹氳妭鐐瑰簲璇ヨ浣跨敤銆傝繖閲屾湁涓や釜鍩烘湰鏂規(guī)硶鏉ラ檺瀹氬喅瀹氭爣鍑嗐傛渶綆鍗曟槸鍦ㄨ穬榪佷笂澧炲姞鏉′歡鍥犵礌銆傛潯浠舵槸Beanshell鑴氭湰琛ㄨ揪寮忚繑鍥炰竴涓猙oolean鍊箋傚湪榪愯鏃惰繖涓喅瀹氳妭鐐瑰皢寰幆紱誨紑璺冭縼錛堥『搴忓拰xml瀹氫箟鐨勪竴鏍鳳級銆備竴涓狣ecisionHandler鐨勫疄鐜拌瀹氫箟鏄彲閫夋嫨鐨勩傞偅涔堬紝鍐沖畾琚綆楀湪java綾諱腑騫朵笖閫夋嫨紱誨紑璺冭縼琚獶ecisionHandler瀹炵幇鐨勫喅瀹氭柟娉曡繑鍥炪?/P>
When the decision is taken by an external party (meaning: not part of the process definition), you should use multiple transitions leaving a state or wait state node. Then the leaving transition can be provided in the external trigger that resumes execution after the wait state is finished. E.g. Token.signal(String transitionName) and TaskInstance.end(String transitionName).
銆銆褰撹繖涓喅瀹氳澶栭儴鎵ц錛堟剰鍛崇潃錛氫笉鏄祦紼嬪畾涔夐儴鍒嗭級錛屼綘搴旇浣跨敤澶氳穬榪佺寮涓涓姸鎬佹垨絳夊緟鑺傜偣銆傞偅涔堣繖涓寮璺冭縼鍦ㄥ閮ㄧ殑闄ゆ硶鍣ㄥ彲浠ヨ鏀寔鎭㈠鎵ц錛屽湪絳夊緟鐘舵佸畬鎴愬悗銆備緥濡傦紝Token.signal(String transitionName) 鍜孴askInstance.end(String transitionName).
7.3.5. Nodetype fork 鑺傜偣綾誨瀷銆鍙?BR>A fork splits one path of execution into multiple concurrent paths of execution. The default fork behaviour is to create a child token for each transition that leaves the fork, creating a parent-child relation between the token that arrives in the fork.
涓涓弶鍒嗙涓涓礬寰勬墽琛屽埌澶氫釜騫惰鐨勬墽琛岃礬寰勩傝繖涓己鐪佺殑鍙夎涓烘槸涓烘瘡涓寮鍙夎穬榪佸垱寤轟竴涓瓙token錛屽垱寤轟竴涓埌杈懼弶涓埗錛嶅瓙鍏崇郴銆?/P>
7.3.6. Nodetype join 鑺傜偣綾誨瀷銆鍚堝茍
The default join assumes that all tokens that arrive in the join are children of the same parent. This situation is created when using the fork as mentioned above and when all tokens created by a fork arrive in the same join. A join will end every token that enters the join. Then the join will examine the parent-child relation of the token that enters the join. When all sibling tokens have arrived in the join, the parent token will be propagated over the (unique!) leaving transition. When there are still sibling tokens active, the join will behave as a wait state.
緙虹渷鐨勫悎騫跺亣璁炬墍鏈夌殑token鍒拌揪鍚堝茍鐐癸紝榪欎簺閮介兘鏄浉鍚岀埗鐨勫瓙銆傝繖涓儏褰㈣鍒涘緩濡傛垜浠互涓婃彁鍒扮殑浣跨敤鍙夊茍涓斿綋鎵鏈夎fork鍒涘緩鐨勬墍鏈塼oken鍒拌揪鐩稿悓鐨刯oin.銆涓涓猨oin灝嗙粨鏉熸瘡涓繘鍏oin鐨則oken.銆閭d箞榪欎釜join灝嗘鏌ヨ繘鍏oin鐨則oken鐖訛紞瀛愬叧緋匯傚綋鎵鏈夌殑鍏勫紵濮愪滑tokens嬋媧伙紝榪欎釜紱誨紑鐨勮穬榪乯oin灝嗕紶鎾傚綋榪欓噷榪樻湁鍏勫紵tokens嬋媧伙紝榪欎釜join灝嗕綔涓轟竴涓瓑寰呯姸鎬併?/P>
7.3.7. Nodetype node銆鑺傜偣綾誨瀷銆鑺傜偣
The type node serves the situation where you want to write your own code in a node. The nodetype node expects one subelement action. The action is executed when the execution arrives in the node. The code you write in the actionhandler can do anything you want but it is also responsible for propagating the execution.
鑺傜偣綾誨瀷鏈嶅姟鍦ㄤ綘鎯沖啓浣犺嚜宸辯殑浠g爜鍦ㄨ妭鐐逛腑銆傝繖涓妭鐐圭被鍨嬭妭鐐規(guī)湡寰呬竴涓瓙鍏冪礌琛屼負(fù)銆傝繖涓涓鴻鎵ц褰撴墍鏈夋墽琛屽埌杈捐繖涓妭鐐廣傚湪actionHandler涓綘鍐欑殑浠g爜鍙互鍋氫綘鎯沖仛鐨勪換浣曚簨鎯咃紝褰撴椂瀹冩槸涔熸槸涓涓矗浠諱負(fù)鎵ц浼犳挱銆?/P>
This node can be used if you want to use a JavaAPI to implement some functional logic that is important for the business analyst. By using a node, the node is visible in the graphical representation of the process. For comparison, actions --covered next-- will allow you to add code that is invisible in the graphical representation of the process, in case that logic is not important for the business analyst.
榪欎釜鑺傜偣鍙互琚嬌鐢紝濡傛灉浣犲皢浣跨敤JavaAPI鏉ュ疄鐜頒竴浜涘姛鑳介昏緫錛屽閫昏緫鍒嗘瀽鏄噸瑕佺殑. 浣滀負(fù)浣跨敤涓涓猲ode,node 鏄彲浠ヨ鐨勫湪嫻佺▼鍥懼艦琛ㄧ幇涓備負(fù)瀵規(guī)瘮錛宎ctions-convered next--灝嗗厑璁稿湪嫻佺▼鍥懼艦琛ㄧ幇涓鍔犱笉鍙鐨勪唬鐮侊紝涓囦竴瀵逛綘閫昏緫鍒嗘瀽鏄笉閲嶈鐨?/P>
signal()
provides a signal to the token. this method activates this token and leaves the current state over the default transition.
鍑嗗涓涓俊鍙風(fēng)粰鏍囪銆傝繖涓柟娉曟縺媧昏繖涓爣璁板茍涓旂寮褰撳墠鐨勭姸鎬佽秺榪囩己鐪佺殑璺冭縼銆?BR>------------------------------------
Class ProcessInstance
is one execution of a ProcessDefinition. To create a new process execution of a process definition, just use the ProcessInstance(ProcessDefinition).
鏄竴涓祦紼嬪畾涔夌殑鎵ц銆?BR>ProcessInstance(ProcessDefinition)
---------------------------------------
Class ProcssDefinition
鍒涘緩涓涓狿rocessDefinition
parseParResource(String parResource)
parseParZipInputStream(ZipInputStream zipInputStream)
parseXmlInputStream(InputStream inputStream)
parseXmlReader(Reader reader)
parseXmlResource(String resource)
parseXmlString(String string)
-----------------------------
Class ContextInstance
maintains all the key-variable pairs for a process instance. You can obtain a ContextInstance from a processInstance from a process instance like this :
ProcessInstance processInstance = ...;
ContextInstance contextInstance = processInstance.getContextInstance();
涓烘祦紼嬪疄渚嬬淮鎸佹墍鏈夌殑key-variable瀵廣?/P>
ContextInstance contextInstance = ProcessInstance.getContextInstance();
contextInstance.setVariable("amount",new Integer(500));
contextInstance.setVariable("reason","I met my deadline");
--------------------------
浠誨姟鑺傜偣錛?BR><task-node name="t">
<task name="change nappy">
<assignment class="org.jbpm.tutorial.taskmgmt.NappyAssignmentHandler"/>
</task>
<transition to="end">
</task-node>
TaskInstance taskInstance = (TaskInstance)processInstance.getTaskMgmtInstance().getTaskInstances().iterator().next();
taskInstance.end(); //鏍囧織榪欎釜浠誨姟宸茬粡緇撴潫
--------------------------------------------