Hi Esteban,
Thanks a lot for your reply.
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.
Just for information , I do not use the Servlet HumanTaskServiceServlet in my application as mechanism for plugging cutomized task service.
Actually I am using spring configuration on my application , so at startup I am creating the task service using the code below :
public void initialize(){
MyOwnEscalationHandler Myhandler = new MyOwnEscalationHandler();
taskService = new TaskService(emf, SystemEventListenerFactory.getSystemEventListener(),Myhandler);// register my handler in the task service
}
The class MyOwnEscalationHandler is the following
public class MyOwnEscalationHandler implements
EscalatedDeadlineHandler {
@Override
public void executeEscalatedDeadline(Task task, Deadline deadline,
Content content, TaskService service) {
// TODO Auto-generated method stub
if ( deadline == null || deadline.getEscalations() == null) {
System.out.println("**********No escalation detected**********");
return;
}
for ( Escalation escalation : deadline.getEscalations() ) {
System.out.println("Deadline detected processing action ");
System.out.println("The task has expired , I am executing my own Deadline handler**********");
// we won't impl constraints for now
//escalation.getConstraints()
// run reassignment first to allow notification to be send to new potential owners
if ( !escalation.getReassignments().isEmpty()) {
// get first and ignore the rest.
Reassignment reassignment = escalation.getReassignments().get( 0 );
task.getTaskData().setStatus( Status.Ready );
List potentialOwners = new ArrayList( reassignment.getPotentialOwners() );
task.getPeopleAssignments().setPotentialOwners( potentialOwners );
task.getTaskData().setActualOwner(new User("Administrator"));
}
for ( Notification notification : escalation.getNotifications() ) {
System.out.println("****** Notify by emaill**********");
}
}
deadline.setEscalated( true );
}
}
Best regards,