[jboss-user] [JBoss jBPM] - Re: taskInstance.cancel() still fires events

dleerob do-not-reply at jboss.com
Tue Apr 8 05:58:01 EDT 2008


I found quite a simple way to make sure a "task-end" event does not get fired when cancelling a task instance. I remove the event, cancel the task instance, and then add the event back.
Simply use code similair to the following:
taskInstance.setSignalling(false);
  | 				Task task = taskInstance.getTask();
  | 				Event endTaskEvent = task.getEvent(Event.EVENTTYPE_TASK_END);
  | 				if (endTaskEvent != null) {
  | 					task.removeEvent(endTaskEvent);					
  | 				}
  | 				taskInstance.cancel();
  | 				if (endTaskEvent != null) {
  | 					task.addEvent(endTaskEvent);					
  | 				}

It seems to work fine for me. Can anyone see anything wrong with doing it this way? It doesn't seem to update the database with new events or actions or anything, as you are adding back the same event object.

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

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



More information about the jboss-user mailing list