You can use customized notification event handlers within
your application environment to deal with escalations in your human
task model.
About this task
To implement notification event handlers, you can use either
the NotificationEventHandlerPlugin interface, or you can extend the
default com.ibm.task.spi.NotificationEventHandler service provider
interface (SPI) implementation class.To configure an event and
add it to your business application model, follow these instructions.
Procedure
- Implement an event handler according to the steps below.
You can package the implementation class of the com.ibm.task.spi.NotificationEventHandlerPlugin
into the same application as your human task, or you can put it into
a dependent utility project. This section describes how you add the
notification event handler implementation class to the same application
as the human task.
- In the Java™ perspective,
right-click your Java module,
and select .
- In the New Java Class wizard, choose
a Package and a Name for your new Class and click Add beside
the Interfaces field.
- In the Implemented Interfaces Selection window, begin
typing
notif until a list of matching types appear,
choose NotificationEventHandlerPlugin, and
click Finish.
Here is an example of an implementation of the escalationNotification
method.
public void escalationNotification(Task task, Escalation escalation) {
System.out.println("--- Notification event received: " + DateFormat.getDateTimeInstance().format( new Date(System.currentTimeMillis())));;
if(task != null)
{
System.out.println("Task template name: " + task.getTaskTemplateName());
System.out.println("Task name: " + task.getName());
System.out.println("Event handler name: " + task.getEventHandlerName());
System.out.println("Is escalated: " + task.isEscalated());
}
else
{
System.out.println("Task is null");
}
System.out.println("Notification event received.");
if(escalation != null)
{
System.out.println("Escalation name: " + escalation.getName());
System.out.println("Escalate within: " + escalation.getDurationUntilEscalated());
System.out.println("Repeat notification every: " + escalation.getDurationUntilRepeated());
}
else
{
System.out.println("Escalation is null");
}
System.out.println("--- End notification event");
- Create a service provider configuration file for the plug-in.
This configuration file provides the mechanism for identifying
and loading the plug-in, and conforms to the Java 2 service provider interface specification.
- In the META-INF/services/ directory of your JAR file,
create a file with the name
com.ibm.task.spi.plug-in_nameNotificationEventHandlerPlugin,
where plug-in_name is the name of the plug-in. For example, if your
plug-in is called HelpDeskRequest (event handler
name) and it implements the com.ibm.task.spi.NotificationEventHandlerPlugin interface,
the name of the configuration file is com.ibm.task.spi.HelpDeskRequestNotificationEventHandlerPlugin.
- In the first line of the file that is neither a comment
line nor a blank line, specify the fully qualified name of your plug-in
class. For example, if your plug-in class is called
MyEventHandler,
and it is in the com.customer.plugins package, then
the first line of the configuration file must contain the following
entry: com.customer.plugins.MyEventHandler.
- Declare a notification event handler for your task as described
here:
- In the human task editor click the Details tab.
- In the Event handler name field,
enter a name for your notification event handler.
Note: This
name is not the name of the implementation class, it is the name that
you gave the event handler.
- Click Save.
- Add your plug-in to your application:
- Switch to the Resource perspective.
- In the Navigator, expand your business integration project.
- In the META-INF folder, create a new folder services.
- Right-click the services folder and select .
- In the File name field of the New
File wizard, enter com.ibm.task.spi.EventHandlerNameNotificationEventHandlerPlugin
Where EventHandlerName is the event handler
name you have specified for your task.
- Click Finish. The editor opens
for the new file. In the editor, add a line with the fully qualified
class name of your implementation class: bpc.samples.plugin.EscalationNotificationPlugin.
- Click Save.
- Specify an escalation with a notification type Event:
- Switch to the Business Integration perspective and open
your task in the human task editor.
- In the Escalation settings section, select the escalation.
- Click the Details tab.
- Configure the escalation as needed (for help, see the
Related tasks section below). For Notification type,
choose Event from the list of available options.
- Save your work.
This topic only applies to BAW, and is located in the BAW repository. Last updated on 2025-03-13 12:15