-
1. Re: jBPM Java implementation; what does the ExecutionContext
estaub May 27, 2008 12:57 PM (in response to hazica)ExecutionContext is used to provide context for ActionHandlers. It is best not to think of it as a long-lived object - more as a "face" that JBPM exposes to ActionHandlers and other bits of client code that it calls into.
It is at least token-specific - I don't THINK more than one can exist for a given token at one time, but I'm not sure - there might be weird cases (say, when doing a join) where there might be.
Does that help?
-Ed Staub -
2. Re: jBPM Java implementation; what does the ExecutionContext
hazica May 28, 2008 3:15 AM (in response to hazica)Thank you for your quick reply, Ed.
Even though "at least token-specific" doesn't rule out "at most ProcessInstance-specific", I tend to concur with you on this one. What you are saying makes sense, especially when one analyses the fields of ExecutionContext: Token, Event, Action, Node, Transition, etc. Also, one of the two constructors only takes a Token as a parameter.
That being said, I think I can now manage to ask a more concrete question:
In one of the tutorials, the one with the task assignment, the task node is defined like this:[...] <task-node name='t'> <task name='change nappy'> <assignment class='[...].NappyAssignmentHandler'> </task> </task-node> [...]
Then, the token starts moving through the workflow, arrives at our task node t. Then, a TaskInstance object is created and... _then something magic happens_ ... and the actor we specified in the implementation of NappyAssignmentHandler appears to be a field of our TaskInstance (actorId), even though the only thing we did in NappyAssignmentHandler was this:public void assign(Assignable assignable, ExecutionContext executionContext){ assignable.setActorId("papa"); }
I don't see any direct assignment of "papa" to TaskInstance.actorId happening anywhere. Nor do I see any indirect, multi-stage version of this assignment. And anyway, how the hell did the executionContext or the assignable Parameters get their values? Was this done by the XML Parser? Is the ExecutionContext relevant for the values of TaskInstance fields? Or am I on the completely wrong path here?
I'd really appreciate it if someone would explain to me how these "magic tricks" are performed.
Thanks for reading! -
3. Re: jBPM Java implementation; what does the ExecutionContext
estaub May 29, 2008 12:50 PM (in response to hazica)I don't do tasks, so I can't help much with specifics.
But the engine is supposed to set up the ExecutionContext so that everything is correct for the given ActionHandler context - so this is expected.
As for HOW - I don't know - I'd have to research it. You're probably just missing something. It sounds like you're into the engine source code - just keep breakpointing, "divide and conquer" till you see where it's happening... or just be happy that it does! ;-) -
4. Re: jBPM Java implementation; what does the ExecutionContext
hazica Jun 2, 2008 6:37 AM (in response to hazica)Indeed, breakpointing might help me figure out how this thing works. I'm on it.