Process Definition:
| <?xml version="1.0" encoding="UTF-8"?>
|
| <process-definition
| xmlns="http://jbpm.org/3/jpdl"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation="http://jbpm.org/3/jpdl
http://jbpm.org/xsd/jpdl-3.0.xsd"
| name="ValidateDeal">
|
| <start-state name="Start">
| <transition name="toGatherSummaryData"
to="GatherSummaryData"></transition>
| </start-state>
|
| <end-state name="End"></end-state>
| <node name="GatherSummaryData">
| <action class="com.olf.workflowmgr.action.AvsScriptActionHandler">
| <scriptName>bpm_demo_get_summary_data</scriptName>
| </action>
|
| <transition name="GetApproval"
to="WaitForManagerApproval"></transition>
| <transition name="Failed1" to="ScriptFailed1"></transition>
|
| <event type="node-enter">
| <action name="TranNumToArgt"
class="com.olf.workflowmgr.action.VariableToArgtActionHandler">
| <datatype>int</datatype>
| <variableName>TranNum</variableName>
| </action>
| </event>
| <event type="node-leave">
| <action name="SaveSummaryData"
class="com.olf.workflowmgr.action.ReturntToVariableActionHandler">
| <variableName>SummaryData</variableName>
| </action>
| </event>
| </node>
| <task-node name="WaitForManagerApproval">
| <task name="ManagerApproval" blocking="true">
| <assignment
class="com.olf.workflowmgr.action.TaskAssignmentHandler">
| <assignee>trader1</assignee>
| </assignment>
| </task>
| <transition name="CheckCredit" to="QuickCreditCheck"></transition>
| <transition name="NotApproved" to="End"></transition>
| </task-node>
| <node name="QuickCreditCheck">
| <action class="com.olf.workflowmgr.action.AvsScriptActionHandler">
| <scriptName>bpm_demo_quick_credit_check</scriptName>
| </action>
| <transition name="toCheckLimit" to="InExcession">
| <action name="SetExcession"
class="com.olf.workflowmgr.action.ReturntVarToVariableActionHandler">
| <variableName>Excession</variableName>
| <xPathExpression>//value[../name =
'Excession']/text()</xPathExpression>
| </action>
| </transition>
| </node>
| <decision name="InExcession">
| <transition name="toValidate" to="ValidateDeal">
| <condition>
| "False".equalsIgnoreCase( (String)Excession )
| </condition>
| </transition>
| <transition name="GetCreditApproval" to="CreditApproval"></transition>
| </decision>
| <node name="ValidateDeal">
| <action class="com.olf.workflowmgr.action.AvsScriptActionHandler">
| <scriptName>bpm_demo_validate_deal</scriptName>
| </action>
| <transition name="toEnd" to="End"></transition>
| </node>
| <task-node name="CreditApproval">
| <task name="CreditManagerApproval" blocking="true">
| <assignment
class="com.olf.workflowmgr.action.TaskAssignmentHandler">
| <assignee>trader1</assignee>
| </assignment>
| </task>
| <transition name="Validate" to="ValidateDeal"></transition>
| <transition name="CreditNotApproved" to="End"></transition>
| </task-node>
| <state name="ScriptFailed1">
| <transition name="Retry1" to="GatherSummaryData"></transition>
| </state>
|
| </process-definition>
|
Assignment Handler (the property assignee is set to "trader1"):
| package com.olf.workflowmgr.action;
|
| import org.jbpm.graph.exe.ExecutionContext;
| import org.jbpm.taskmgmt.exe.Assignable;
| import org.jbpm.taskmgmt.def.AssignmentHandler;
| import java.util.*;
|
| /**
| * Handler to assign a task to an actor or a pool of actors. The
| * assignee field is the actor id to assign to the task, or a
| * comma delimited list of actor ids to be assigned as a pool.
| *
| * @author mholtzman
| * @version 0.1
| */
| public class TaskAssignmentHandler implements AssignmentHandler {
|
| private String assignee;
|
| private static final long serialVersionUID = 1L;
|
| /**
| * Assigns the task.
| *
| * @param assignable
| * the task to assign
| * @param executionContext
| * the context
| */
| public void assign(Assignable assignable, ExecutionContext
executionContext) {
|
| if (assignee == null) return;
|
| int idx = assignee.indexOf(",");
| if (idx < 0) {
| assignable.setActorId(assignee);
| } else {
| String[] pool = assignee.split(",");
| assignable.setPooledActors(pool);
| }
| } // assign
|
| } // class TaskAssignmentHandler
|
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3913462#3913462
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3913462
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user