<!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">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;">
    [jBPM 4.3] Cancel Job/Timer
</h3>
<span style="margin-bottom: 10px;">
    reply from <a href="http://community.jboss.org/people/kafsinkaf">Melih Cetin</a> in <i>jBPM</i> - <a href="http://community.jboss.org/message/544824#544824">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Hi HuiSheng,</p><p><br/>The simplified process definition is:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span>&lt;process name="TimerTest" xmlns="</span><a class="jive-link-external-small" href="http://jbpm.org/4.3/jpdl" target="_blank">http://jbpm.org/4.3/jpdl</a><span>"&gt;</span><br/>&#160;&#160; &lt;start g="185,63,48,48" name="start"&gt;<br/>&#160;&#160;&#160;&#160;&#160; &lt;transition g="-44,-18" name="to task1" to="task1"/&gt;<br/>&#160;&#160; &lt;/start&gt;<br/>&#160;&#160; &lt;task g="162,161,92,52" name="task1" candidate-groups="sales-support"&gt;<br/>&#160;&#160;&#160;&#160;&#160; &lt;transition g="-43,-18" name="to state" to="state"/&gt;<br/>&#160;&#160; &lt;/task&gt;<br/>&#160;&#160; &lt;state g="162,232,92,52" name="state"&gt;<br/>&#160;&#160;&#160;&#160;&#160; &lt;on event="timeout"&gt;<br/>&#160;&#160;&#160;&#160;&#160; &lt;timer duedate="1 minute" repeat="1 minute"/&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;event-listener class="mytest.TimerTest"&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;property name="successTransition"&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;string value="toTask"/&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/property&gt; <br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/event-listener&gt;<br/>&#160;&#160;&#160;&#160;&#160; &lt;/on&gt;<br/>&#160;&#160;&#160;&#160;&#160; &lt;transition g="-44,-18" name="toTask" to="task"/&gt;<br/>&#160;&#160; &lt;/state&gt;<br/>&#160;&#160; &lt;task g="162,320,92,52" name="task" candidate-groups="sales-support"&gt;<br/>&#160;&#160;&#160;&#160;&#160; &lt;transition g="-42,-18" name="to end1" to="end"/&gt;<br/>&#160;&#160; &lt;/task&gt;<br/>&#160;&#160; &lt;end g="183,410,48,48" name="end"/&gt;<br/>&lt;/process&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>and the simplified event handler where we signal the execution is:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>public class TimerTest implements EventListener {<br/>&#160;&#160;&#160; static int cnt = 0;<br/>&#160;&#160;&#160; private String successTransition;<br/>&#160;&#160;&#160; <br/>&#160;&#160;&#160; public String getSuccessTransition() {<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; return successTransition;<br/>&#160;&#160;&#160; }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; public void setSuccessTransition(String successTransition) {<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; this.successTransition = successTransition;<br/>&#160;&#160;&#160; }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; public void notify(EventListenerExecution execution) throws Exception {<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; cnt++;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (cnt &gt; 2) {<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; progress(execution);<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br/>&#160;&#160;&#160; }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; public void progress(EventListenerExecution prmEventListenerExecution) {<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; org.jbpm.api.Configuration.getProcessEngine().getExecutionService().signalExecutionById(prmEventListenerExecution.getId(), successTransition);<br/>&#160;&#160;&#160; }</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/544824#544824">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in jBPM at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>