<!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="https://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: Human task escalation understanding
</h3>
<span style="margin-bottom: 10px;">
created by <a href="https://community.jboss.org/people/javajbpmuser">javajbpmuser</a> in <i>jBPM</i> - <a href="https://community.jboss.org/message/803857#803857">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 Esteban,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Thanks a lot for your reply. </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>It is definitely provides me the solution how to customize escalation event . Actually here is the solution I set up according to what you explained before , it is working fine  and  I am giving the java code that can help other members  to define quickly a customized escalation.</p><p>Just for information , I do not  use the Servlet HumanTaskServiceServlet  in my application as mechanism for plugging cutomized task service. </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Actually I am using spring configuration on my application , so at startup I am creating the task service using the code below :</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>public void initialize(){</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>MyOwnEscalationHandler Myhandler = new MyOwnEscalationHandler();</p><p>taskService = new TaskService(emf, SystemEventListenerFactory.getSystemEventListener(),Myhandler);// register my handler in the task service</p><p>}</p><p>The class MyOwnEscalationHandler is the following </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><strong style="color: #7f0055; font-size: 10.0pt; font-family: Consolas;">public</strong> <strong style="color: #7f0055; font-size: 10.0pt; font-family: Consolas;">class</strong><span style="font-size: 10.0pt; font-family: Consolas; color: black;"> MyOwnEscalationHandler </span><strong style="color: #7f0055; font-size: 10.0pt; font-family: Consolas;">implements</strong></p><p><span style="font-size: 10.0pt; font-family: Consolas; color: black;">EscalatedDeadlineHandler {</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>       <span style="font-size: 10.0pt; font-family: Consolas; color: #646464;">@Override</span></p><p>       <strong style="color: #7f0055; font-size: 10.0pt; font-family: Consolas;">public</strong> <strong style="color: #7f0055; font-size: 10.0pt; font-family: Consolas;">void</strong><span style="font-size: 10.0pt; font-family: Consolas; color: black;"> executeEscalatedDeadline(Task task, Deadline deadline,</span></p><p><span style="font-size: 10.0pt; font-family: Consolas; color: black;"> Content content, TaskService service) {</span></p><p> <span style="font-size: 10.0pt; font-family: Consolas; color: #3f7f5f;">// </span><strong style="color: #7f9fbf; font-size: 10.0pt; font-family: Consolas;">TODO</strong><span style="font-size: 10.0pt; font-family: Consolas; color: #3f7f5f;"> Auto-generated method stub</span></p><p> <strong style="color: #7f0055; font-size: 10.0pt; font-family: Consolas;">if</strong><span style="font-size: 10.0pt; font-family: Consolas; color: black;"> ( deadline == </span><strong style="color: #7f0055; font-size: 10.0pt; font-family: Consolas;">null</strong><span style="font-size: 10.0pt; font-family: Consolas; color: black;"> || deadline.getEscalations() == </span><strong style="color: #7f0055; font-size: 10.0pt; font-family: Consolas;">null</strong><span style="font-size: 10.0pt; font-family: Consolas; color: black;">) {</span></p><p><span style="font-size: 10.0pt; font-family: Consolas; color: black;"> System.</span><em style="color: #0000c0; font-size: 10.0pt; font-family: Consolas;">out</em><span style="font-size: 10.0pt; font-family: Consolas; color: black;">.println(</span><span style="font-size: 10.0pt; font-family: Consolas; color: #2a00ff;">"**********No escalation detected**********"</span><span style="font-size: 10.0pt; font-family: Consolas; color: black;">);</span></p><p> <strong style="color: #7f0055; font-size: 10.0pt; font-family: Consolas;">return</strong>;</p><p><span style="font-size: 10.0pt; font-family: Consolas; color: black;">        }</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p> <strong style="color: #7f0055; font-size: 10.0pt; font-family: Consolas;">for</strong><span style="font-size: 10.0pt; font-family: Consolas; color: black;"> ( Escalation escalation : deadline.getEscalations() ) {</span></p><p><span style="font-size: 10.0pt; font-family: Consolas; color: black;"> System.</span><em style="color: #0000c0; font-size: 10.0pt; font-family: Consolas;">out</em><span style="font-size: 10.0pt; font-family: Consolas; color: black;">.println(</span><span style="font-size: 10.0pt; font-family: Consolas; color: #2a00ff;">"Deadline detected  processing action "</span><span style="font-size: 10.0pt; font-family: Consolas; color: black;">);</span></p><p><span style="font-size: 10.0pt; font-family: Consolas; color: black;"> System.</span><em style="color: #0000c0; font-size: 10.0pt; font-family: Consolas;">out</em><span style="font-size: 10.0pt; font-family: Consolas; color: black;">.println(</span><span style="font-size: 10.0pt; font-family: Consolas; color: #2a00ff;">"The task has expired , I am executing my own Deadline handler**********"</span><span style="font-size: 10.0pt; font-family: Consolas; color: black;">);</span></p><p> <span style="font-size: 10.0pt; font-family: Consolas; color: #3f7f5f;">// we won't <span style="text-decoration: underline;">impl</span> constraints for now</span></p><p> <span style="font-size: 10.0pt; font-family: Consolas; color: #3f7f5f;">//escalation.getConstraints()</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p> <span style="font-size: 10.0pt; font-family: Consolas; color: #3f7f5f;">// run reassignment first to allow notification to be send to new potential owners</span></p><p> <strong style="color: #7f0055; font-size: 10.0pt; font-family: Consolas;">if</strong><span style="font-size: 10.0pt; font-family: Consolas; color: black;"> ( !escalation.<span style="background: silver;">getReassignments</span>().isEmpty()) {</span></p><p> <span style="font-size: 10.0pt; font-family: Consolas; color: #3f7f5f;">// get first and ignore the rest.</span></p><p><span style="font-size: 10.0pt; font-family: Consolas; color: black;"> Reassignment reassignment = escalation.<span style="background: silver;">getReassignments</span>().get( 0 );</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-size: 10.0pt; font-family: Consolas; color: black;">                task.getTaskData().setStatus( Status.</span><em style="color: #0000c0; font-size: 10.0pt; font-family: Consolas;">Ready</em><span style="font-size: 10.0pt; font-family: Consolas; color: black;"> );</span></p><p><span style="font-size: 10.0pt; font-family: Consolas; color: black;"> <span style="text-decoration: underline;">List</span> potentialOwners = </span><strong style=": ; color: #7f0055; font-size: 10.0pt; font-family: Consolas; text-decoration: underline;">new</strong><span style="color: black; font-size: 10.0pt; text-decoration: underline; font-family: Consolas;"> ArrayList( reassignment.getPotentialOwners() )</span>;</p><p><span style="font-size: 10.0pt; font-family: Consolas; color: black;"> task.getPeopleAssignments().setPotentialOwners( <span style="text-decoration: underline;">potentialOwners</span> );</span></p><p><span style="font-size: 10.0pt; font-family: Consolas; color: black;"> task.getTaskData().setActualOwner(</span><strong style="color: #7f0055; font-size: 10.0pt; font-family: Consolas;">new</strong><span style="font-size: 10.0pt; font-family: Consolas; color: black;"> User(</span><span style="font-size: 10.0pt; font-family: Consolas; color: #2a00ff;">"Administrator"</span><span style="font-size: 10.0pt; font-family: Consolas; color: black;">));</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span style="font-size: 10.0pt; font-family: Consolas; color: black;"> }       </span></p><p>            <strong style="color: #7f0055; font-size: 10.0pt; font-family: Consolas;">for</strong><span style="font-size: 10.0pt; font-family: Consolas; color: black;"> ( Notification <span style="text-decoration: underline;">notification</span> : escalation.getNotifications() ) {</span></p><p><span style="font-size: 10.0pt; font-family: Consolas; color: black;"> System.</span><em style="color: #0000c0; font-size: 10.0pt; font-family: Consolas;">out</em><span style="font-size: 10.0pt; font-family: Consolas; color: black;">.println(</span><span style="font-size: 10.0pt; font-family: Consolas; color: #2a00ff;">"****** Notify by emaill**********"</span><span style="font-size: 10.0pt; font-family: Consolas; color: black;">);</span></p><p><span style="font-size: 10.0pt; font-family: Consolas; color: black;"> }        </span></p><p><span style="font-size: 10.0pt; font-family: Consolas; color: black;">            }</span></p><p><span style="font-size: 10.0pt; font-family: Consolas; color: black;"> deadline.setEscalated( </span><strong style="color: #7f0055; font-size: 10.0pt; font-family: Consolas;">true</strong><span style="font-size: 10.0pt; font-family: Consolas; color: black;"> );</span></p><p><span style="font-size: 10.0pt; font-family: Consolas; color: black;">        }</span></p><p><span style="font-size: 10.0pt; font-family: Consolas; color: black;">       }</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Best regards,</p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="https://community.jboss.org/message/803857#803857">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in jBPM at <a href="https://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>