<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>
                                <td>
                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>
                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
Re: Jump to end state from Node
</h3>
<span style="margin-bottom: 10px;">
created by <a href="http://community.jboss.org/people/sasir">Sasi R</a> in <i>jBPM Development</i> - <a href="http://community.jboss.org/message/605904#605904">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p> Martin,</p><p>Thanks a lot for replying in detail</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>We have below process definition which has Node-Enter action as shown below. As soon as we start the process it will go to Node1 and from there we want to control the execution (Jump to End state by avoid execution of Node2/Node3. However in some scenarios we want to Jump to Node3) </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>But following code is not working as expected and its always executing all the nodes.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>public class AutomationHandler implements ActionHandler {</p><p><strong style="color: #7f0055; font-size: 10pt; font-family: 'Courier New';">public</strong> <strong style="color: #7f0055; font-size: 10pt; font-family: 'Courier New';">void</strong><span style="font-size: 10pt; color: black; font-family: 'Courier New';"> execute(ExecutionContext executionContext) </span><strong style="color: #7f0055; font-size: 10pt; font-family: 'Courier New';">throws</strong><span style="font-size: 10pt; color: black; font-family: 'Courier New';"> Exception</span></p><p><span style="font-size: 10pt; color: black; font-family: 'Courier New';">      {</span></p><p>                  </p><p><span style="font-size: 10pt; color: black; font-family: 'Courier New';">              System.</span><em style="color: #0000c0; font-size: 10pt; font-family: 'Courier New';">out</em><span style="font-size: 10pt; color: black; font-family: 'Courier New';">.println(</span><strong style="color: #7f0055; font-size: 10pt; font-family: 'Courier New';">new</strong><span style="font-size: 10pt; color: black; font-family: 'Courier New';"> Date()+</span><span style="font-size: 10pt; color: #2a00ff; font-family: 'Courier New';">"Inside AutomationHandler::execute()"</span><span style="font-size: 10pt; color: black; font-family: 'Courier New';">);</span></p><p>              </p><p><span style="font-size: 10pt; color: black; font-family: 'Courier New';">                    System.</span><em style="color: #0000c0; font-size: 10pt; font-family: 'Courier New';">out</em><span style="font-size: 10pt; color: black; font-family: 'Courier New';">.println(</span><span style="font-size: 10pt; color: #2a00ff; font-family: 'Courier New';">"########Going to End State###########"</span><span style="font-size: 10pt; color: black; font-family: 'Courier New';">);</span></p><p><span style="font-size: 10pt; color: black; font-family: 'Courier New';">                          EndState endState = (EndState)executionContext.getNode().getProcessDefinition().getNode(</span><span style="font-size: 10pt; color: #2a00ff; font-family: 'Courier New';">"end-state"</span><span style="font-size: 10pt; color: black; font-family: 'Courier New';">);</span></p><p><span style="font-size: 10pt; color: black; font-family: 'Courier New';">                          Token token  = executionContext.getToken();</span></p><p style="margin-left: 2in;"><span style="font-size: 10pt; color: black; font-family: 'Courier New';">  token.setNode(endState);</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"><span style="font-size: 10pt; color: black; font-family: 'Courier New';"> </span> </p><p><span style="font-size: 10pt; color: black; font-family: 'Courier New';">                          //token.signal("trans4");</span></p><p><span style="font-size: 10pt; color: black; font-family: 'Courier New';">                          //token.end();</span></p><p><span style="font-size: 10pt; color: black; font-family: 'Courier New';">                              </span></p><p style="margin-left: 0.5in; text-indent: 0.5in;"><span style="font-size: 10pt; color: black; font-family: 'Courier New';">  System.</span><em style="color: #0000c0; font-size: 10pt; font-family: 'Courier New';">out</em><span style="font-size: 10pt; color: black; font-family: 'Courier New';">.println(</span><strong style="color: #7f0055; font-size: 10pt; font-family: 'Courier New';">new</strong><span style="font-size: 10pt; color: black; font-family: 'Courier New';"> Date()+</span><span style="font-size: 10pt; color: #2a00ff; font-family: 'Courier New';">"Inside AutomationHandler::execute()"</span><span style="font-size: 10pt; color: black; font-family: 'Courier New';">);</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"><span style="font-size: 10pt; color: black; font-family: 'Courier New';"> </span> </p><p><span style="font-size: 10pt; color: black; font-family: 'Courier New';">}</span></p><p><span style="font-size: 10pt; color: black; font-family: 'Courier New';">}</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Process definition xml</p><p>********************************</p><p><?xml version="1.0" encoding="UTF-8"?></p><p><process-definition  xmlns="urn:jbpm.org:jpdl-3.2"  name="automationtest"></p><p> <description><br/>  automationtest<br/> </description></p><p><br/> <start-state name="start-state"><br/>  <transition to="node1" name="trans1"></transition><br/>  <event type="process-start"><br/>   <script name="Allocation Event Started"><br/>    System.out.println(&quot;Event Creation Started &quot;+node);<br/>   </script><br/>  </event><br/> </start-state></p><p><br/> <node name="node1"><br/>  <event type="node-enter"><br/>   <action class="com.citi.automation.build.jbpm.handler.AutomationHandler"><br/>    <unixCommand><br/>     echo &quot;Hello World&quot;<br/>    </unixCommand><br/>    <expectedRetunCodes><br/>     A,B,C<br/>    </expectedRetunCodes><br/>    <successCondition><br/>     ExecuteCommand2<br/>    </successCondition><br/>    <errorCondition><br/>     End<br/>    </errorCondition><br/>   </action><br/>  </event><br/>  <transition to="node2" name="trans2"></transition><br/>  <transition to="end-state" name="trans4"></transition><br/> </node></p><p> <node name="node2"><br/>  <event type="node-enter"><br/>   <action class="com.citi.automation.build.jbpm.handler.AutomationHandler"><br/>    <unixCommand><br/>     echo &quot;sleeping&quot;; sleep 60<br/>    </unixCommand><br/>    <expectedRetunCodes><br/>     A,D,E<br/>    </expectedRetunCodes><br/>    <successCondition><br/>     ExecuteCommand3<br/>    </successCondition><br/>    <errorCondition><br/>     End<br/>    </errorCondition><br/>   </action><br/>  </event><br/>  <transition to="node3" name="trans3"></transition><br/> </node></p><p> <node name="node3"><br/>  <event type="node-enter"><br/>   <action class="com.citi.automation.build.jbpm.handler.AutomationHandler"><br/>    <unixCommand><br/>     echo &quot;Working&quot;<br/>    </unixCommand><br/>    <successCondition><br/>     ExecuteCommand4<br/>    </successCondition><br/>    <expectedRetunCodes><br/>     A,B,C<br/>    </expectedRetunCodes><br/>    <errorCondition><br/>     End<br/>    </errorCondition><br/>   </action><br/>  </event><br/>  <transition to="end-state" name="trans4"></transition><br/> </node></p><p><br/> <end-state name="end-state"><br/>  <event type="process-end"><br/>   <script name="Event End"><br/>    System.out.println(&quot;Event End &quot;+node);<br/>   </script><br/>  </event><br/> </end-state></p><p></process-definition></p><p>********************************</p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/605904#605904">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in jBPM Development at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2035">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>