-
1. Re: JBPM how to signal a transition from Node Action Expression
gnagy.greg.webhejj.hu Sep 13, 2008 4:19 PM (in response to c0upal)If you specify an action on the node itself, you need to take care of execution propagation yourself. Unless you want to influence transitions, simply add the action on an event like
node-enter
and not worry about activating the transition.<node name="foo"> <event type="node-enter"> <action expression="#{controlBean.testAction}"></action> </event> </node>
See also section 10.5 of the JBPM 3.2 documentation.
If you really need an action on the node to control the transitions, consider implementing
org.jbpm.graph.def.ActionHandler;
where you have access to the execution context, and then can perform something like:executionContext.getNode().leave(executionContext, transition);
-
2. Re: JBPM how to signal a transition from Node Action Expression
jensaug.jens.augustsson.eu Jun 17, 2010 11:26 AM (in response to c0upal)Thanks Gergely, nice trick!
-
3. Re: JBPM how to signal a transition from Node Action Expression
uesker Sep 16, 2010 1:35 PM (in response to c0upal)Hi!
I have a similar issue... but at the end of action method, I need to return to a specific page.
This is a fragment of xhtml page
<h:selectOneListbox value="#{chooseMetodologyAction.methodology}" size="1"> <f:selectItem itemValue="Quasi Systematic Review" itemLabel="Quasi Systematic Review"/> <f:selectItem itemValue="Systematic Review" itemLabel="Systematic Review"/> </h:selectOneListbox> <div style="clear:both"/> </div> </rich:panel> <div class="actionButtons"> <h:commandButton value="#{messages['button.next']}" action="#{chooseMetodologyAction.execute}"> <f:param name="taskId" value="#{taskInstance.id}"/> </h:commandButton>
So, based on methodology value, I redirect the process to run on different paths
<task-node name="fill methodology"> <task name="methodology" description="#{messages['srprocess.choosemethodology.description']}"> <assignment pooled-actors="researcher"/> </task> <transition name="Systematic Review" to="fill meta analysis" /> <transition name="Quasi Systematic Review" to="fill primary question" /> </task-node>
The problem is that I can´t return a string on execute method (defined in ActionHandler interface)
@Name("chooseMetodologyAction") @Scope(ScopeType.PAGE) public class ChooseMetodologyAction implements ActionHandler, Serializable { /** * */ private static final long serialVersionUID = 4304516385829464005L; private static final Object SYSTEMATIC_REVIEW = null; private String methodology; public String getMethodology() { return methodology; } public void setMethodology(String methodology) { this.methodology = methodology; } @EndTask public String endChooseMetodology() { //TODO: Choose correct path! return "/listActivities.xhtml"; } public void execute(ExecutionContext executionContext) throws Exception { if (methodology.equals(ChooseMetodologyAction.SYSTEMATIC_REVIEW)) { executionContext.getNode().leave(executionContext, "Yes"); } else { executionContext.getNode().leave(executionContext, "No"); } //return "/listActivities.xhtml"; } }
What can I do to choose a transition and redirect to listActivitives.xhtml?
Thanks!
PS: Apologies for anything written wrong... I don´t have to much practice writing in english
-
4. Re: JBPM how to signal a transition from Node Action Expression
uesker Sep 16, 2010 6:22 PM (in response to c0upal)Hi!
I remember that I can inject Transition component like this.@Name("chooseMetodologyAction") @Scope(ScopeType.PAGE) public class ChooseMetodologyAction implements Serializable { /** * */ private static final long serialVersionUID = 4304516385829464005L; private static final Object SYSTEMATIC_REVIEW = "Systematic Review"; private static final Object QUASI_SYSTEMATIC_REVIEW = "Quasi Systematic Review"; private String methodology; @In private StatusMessages statusMessages; @In private Transition transition; public String getMethodology() { return methodology; } public void setMethodology(String methodology) { this.methodology = methodology; } @EndTask public String endChooseMetodology() { if (methodology.equals(ChooseMetodologyAction.SYSTEMATIC_REVIEW)) { transition.setName("Systematic Review"); } else if (methodology.equals(ChooseMetodologyAction.QUASI_SYSTEMATIC_REVIEW)){ transition.setName("Quasi Systematic Review"); } return "/listActivities.xhtml"; } }