This content has been marked as final.
Show 3 replies
-
1. Re: Task Assignment results in two tasks with same id
koen.aers Dec 19, 2005 4:56 PM (in response to michaelholtzman)Can you show us the processdefinition and the code of the assignmenthandler that you have written?
Regards,
Koen -
2. Re: Task Assignment results in two tasks with same id
michaelholtzman Dec 19, 2005 5:53 PM (in response to michaelholtzman)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
-
3. Re: Task Assignment results in two tasks with same id
boerse Feb 16, 2006 3:39 PM (in response to michaelholtzman)Hi Michael, your code is great and for one user works fine, but when i assign in the websale app (for example) to bernie, cookie monster a task, it does not say "task assignet to bernie, cookie", it doesn't say anything and the tasks are not assigned, am i doing anything wrong? Thanx