[jbpm-dev] [Design of JBoss jBPM] - Re: Cancelling a task fires task-end event

kukeltje do-not-reply at jboss.com
Mon Oct 6 16:52:36 EDT 2008


anonymous wrote : it is almost impossible to come up with a task lifecycle that satisfies all use cases. typically companies have their own view upon the task lifecycle. 

Sure, but therefore we should at least support the task-cancel event. I in fact have a real nice use case. For the blog I'm writing an article on 'escalation' of task with lots of info declared in the process definition (that is where it belongs). 
The escalation tasks are not any where in the graph, they are separate nodes since they can be called from everywhere. Someone just has to act on it (e.g. changing the priority of the task that is overdue) but I do want this task (the one that is overdue) to just stay where it is.  The task that is created this way, e.g. for the manager, is what I call ad-hoc tasks. 

Since I cannot act on a transition (there are no outgoing transitions), not on a node leave (the token always stays in the node, it is just ended), I can only run some code on a task-end. In this task-end, I declare that the priority of the task that is overdue should change to a fixed value, or a value set in the task-form. The task-node looks like this:


  | <task-node name='task escalated'>
  | 	<task name='escalated task 0' swimlane='escalationSwimlane'
  | 		signalling='false'>
  | 		<!--
  | 			If task has no outgoing transitions, 
  | 			signalling gives an error IF
  | 			the task is signalling
  | 		-->
  | 		<controller>
  | 			<variable name='newPriority' />			
  | 		</controller>
  | 	</task>
  | 	<event type='task-end'>
  | 		<action class='net.vankuijk.jbpm.utils.ChangeTaskPriority'>
  | 			<taskNodeName>task</taskNodeName>
  | 			<!-- 
  | 			     if the value of priority can be parsed as an int, 
  | 			     it is used that way, 
  | 			     otherwise it is tried as a process variable 
  | 			-->
  | 			<priority>newPriority</priority> 
  | 		</action>
  | 	</event>
  | </task-node>
  | 

But if the task that is overdue is carried out befiore the priority changes, it should be cancelled. That is easy BUT..... the task-end event fires and with the use of a variable priority I can do some checks on the value of the variable, but with a fixed value I cannot differentiate between an end (manager did something) and a cancel... 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4180665#4180665

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4180665



More information about the jbpm-dev mailing list