-
1. Re: start-state
vtysh Jul 10, 2007 2:26 AM (in response to ricardomarques)Maybe you should signal to the process instance after creation to move from start state to first task node? Or try to add some actions to start-state, for example on node enter and perform signaling in it. But it is only in theory, i didn't use models without a task in start state.
-
-
3. Re: start-state
syngolis Jul 10, 2007 2:54 AM (in response to ricardomarques)hmm...
Maybe I am wrong, but I tested the node-enter behaviour on start-state and it seems, that this event is never executed:<process-definition xmlns="" name="test5"> <start-state name="start"> <task name="task"></task> <event type="node-enter"> <script> <expression> System.out.println("NODE-ENTER"); </expression> </script> </event> <event type="node-leave"> <script> <expression> System.out.println("NODE-LEAVE"); </expression> </script> </event> <transition name="" to="end1"></transition> </start-state> <end-state name="end1"></end-state> </process-definition>
I get only "NODE-LEAVE" output on my console. Is that correct?!? -
4. Re: start-state
vtysh Jul 10, 2007 3:25 AM (in response to ricardomarques)Seems that start-state doesn't have a node-enter event.
For ricardomarques: maybe you should use StartProcessInstanceCommand instead NewProcessInstanceCommand with cmd.setCreateStartTask(false); -
5. Re: start-state
syngolis Jul 10, 2007 3:43 AM (in response to ricardomarques)That's not really a good solution because you can't specify the behaviour by processdefinition.
While searching the source code i found:public static final String[] supportedEventTypes = new String[]{ Event.EVENTTYPE_NODE_LEAVE, Event.EVENTTYPE_AFTER_SIGNAL };
for start-state. So there really seems to be no ENTER event. But why? Anybody knows? -
6. Re: start-state
vtysh Jul 10, 2007 4:10 AM (in response to ricardomarques)You can use NewProcessInstanceCommand with createStartTask as true, if returned value will be null then you will know, that process doesn't contain a start task. Then you can use SignalCommand or some other one to move process from start state to first task node.
-
7. Re: start-state
syngolis Jul 10, 2007 4:18 AM (in response to ricardomarques)Ok. Should work this way.
-
8. Re: start-state
koen.aers Jul 10, 2007 7:17 AM (in response to ricardomarques)The node enter event gets fired when the token enters a node. As for the start-state, the token never enters it. Rather the token is *positioned* in the start-state when the process starts executing. So the event you want to look at is the process-start event.
Btw. Performing a signal on the current token from an action handler is not a good practice. Action handlers that are configured on events should not try to modify the execution of the token.
Regards,
Koen -
9. Re: start-state
estaub Jul 10, 2007 7:46 AM (in response to ricardomarques)"koen.aers@jboss.com" wrote:
Performing a signal on the current token from an action handler is not a good practice.
Koen,
You mean that to apply only to event-handling ActionHandlers, correct?
Node-execution ActionHandlers can signal, yes?
Thanks,
-Ed Staub -
10. Re: start-state
syngolis Jul 10, 2007 9:23 AM (in response to ricardomarques)Thank you for the hint! Process-Start-Event works fine.
Anyway, there seems to be no elegant way to skip the start-state except the programmatically
way that was mentioned by vtysh. And since there is no role assignment possible in start-state,
every workflow has to be signalled by initiator.
(Would be nice if there were a few more possibilites to use the start-state than now) -
11. Re: start-state
ricardomarques Jul 10, 2007 10:57 AM (in response to ricardomarques)"vtysh" wrote:
You can use NewProcessInstanceCommand with createStartTask as true, if returned value will be null then you will know, that process doesn't contain a start task. Then you can use SignalCommand or some other one to move process from start state to first task node.
i have take your idea and my my own Command based on NewProcessInstanceCommand to do this, this part is working now.
thanks for the feedback -
12. Re: start-state
kukeltje Jul 10, 2007 5:50 PM (in response to ricardomarques)@ed: Yes, correct...
-
13. Re: start-state
koen.aers Jul 11, 2007 3:36 AM (in response to ricardomarques)Node-execution ActionHandlers should typically not call signal() but leaveNode(). The differences are minor though, if I remember correctly signal() only wraps leaveNode() adding the before-signal and after-signal event handling. But normally these events should not be handled on the node level.
Thanks,
Koen -
14. Re: start-state
koen.aers Jul 11, 2007 3:39 AM (in response to ricardomarques)As for skipping the start-state. You can start the process in any node from jPDL 3.2 on. Just do not model a start-state and add initial="true" as an attribute on the node (state, mail-node, process-state, etc) that you want to be the first node in the process-definition.
Regards,
Koen