-
1. Re: process image display highlights wrong end node if task
dleerob Oct 15, 2007 4:45 AM (in response to ramsub)AFAIK, If a task that has more than one transition ends, and you havent specified which transition to take, (eg: taskInstance.end("MyTransition");), the default transition will be taken, and that default is the first transition defined in the processdefinition.xml.
So it sounds like the task instance isn't being ended correctly, or is not being ended with a transition name.
Why it's doing this, is anyones guess, unless we can see what you are doing. Perhaps you should post the code that you use to end the task, so we can take a look, or create a unit test to display the behaviour, then im sure someone can help you. -
2. Re: process image display highlights wrong end node if task
ramsub Oct 15, 2007 9:18 AM (in response to ramsub)Actually, If I had specified the wrong transition, it would have gone to the wrong node - but I don't find that happening ! The transition name is correct, and it also goes to the right node - as evidenced by my logs, where I print the name of the last node from my action handler on event 'process-end'.
As for my code - it's very simple:public class GenericAssignmentHandler implements AssignmentHandler { public void assign(Assignable assignable, ExecutionContext executionContext) throws Exception { ... ... if (startAndEndTask) { log.info("-----------starting and ending task-------------"); // start and finish the task right here. ((TaskInstance) assignable).start(); ((TaskInstance) assignable) .end("Approved"); } log.info("------------done assignment handler----------"); }
And my process definition looks like:<?xml version="1.0" encoding="UTF-8"?> <process-definition xmlns="" name="NewSimpleProcess"> <start-state name="start"> <transition name="" to="Level1Approval"></transition> </start-state> <task-node name="Level1Approval"> <task name="Level1ApprovalTask"> <assignment class="GenericAssignmentHandler"> </assignment> </task> <transition name="Approved" to="Level2Approval"></transition> <transition name="Denied" to="Denied"></transition> </task-node> <task-node name="Level2Approval"> <task name="Level2ApprovalTask"> <assignment class="GenericAssignmentHandler"> </task> <transition name="Denied" to="Denied"></transition> <transition name="Approved" to="Approved"></transition> </task-node> <end-state name="Approved"></end-state> <end-state name="Denied"></end-state> <event type="process-end"> <action class="GenericProcessEndHandler"> </action> </event> </process-definition>
Now, if I place transition Denied before Approved in my last node, it highlights denied, and if Approved appears first, it highlights approved !! And I *am* passing the transition name when I end the task. Am I making some obvious blunder here ? -
3. Re: process image display highlights wrong end node if task
kukeltje Oct 15, 2007 4:42 PM (in response to ramsub)I cannot imagine BL demands ending a task in an assignmenthandler. Besides that, ending tasks in assignmenthandlers feels wrong. I'd personally model it completely different, e.g. a decision with to legs, one to the task and one that bypasses it.
-
4. Re: process image display highlights wrong end node if task
ramsub Oct 16, 2007 1:11 AM (in response to ramsub)Let me explain the business case in more detail - We have a series of such similar (same assignment handler class) task nodes in our process definition - At each task node, the assignment handler talks finds out who the assisgnees are and assisgns them. The assignees may be different at each task node.
If, say, assignee A completes the task at one node, and further down, the same assignee again resolves as one of the assignees, then the task should be considered "implicitly" finished by him - This was the reason why I was having a check in my assignment handler and ending the task right there.
If not in the assignment handler - is there anywhere else, or on some other event, that I can end the task ?
We may have as many as 10 - 15 task nodes - If I were to have a decision before each such task node, wouldn't that make it look more complicated ? Is there a better way out ?