com.bea.wli.worklist.api.events.handler
Interface EventHandler


public interface EventHandler

Represents the configuration of a Worklist event handler. This interface can be used to view or edit this configuration at runtime and apply any changes in configuration to the running state of a Worklist system instance running in a WebLogic server.

NOTE: Some objects within this handler or its heirarchy of child objects cannot be removed or renamed at runtime. Any object type that has this restriction defines an isRemovable() method to determine if the object can be removed in the scope of the current edit session. You should check the return value of isRemovable before removing an object that may not be removable. If you attempt to remove a non-removable object, an IllegalStateException will be thrown.


Method Summary
 EventSubscription addEventSubscription(String name)
          Add a named event subscription to this handler.
 void addHandledTaskPlanId(TaskPlanId taskPlanId)
           
 EventSubscription getEventSubscription(String name)
          Get the event subscription with the given name.
 String[] getEventSubscriptionNames()
          Get all subscription names.
<T extends EventSubscriptionConfiguration>
List<T>
getEventSubscriptions(Class<T> subsType)
          Get all the EventSubscriptionConfiguration instances (as the specific subscription type given by subsType) that have been configured to apply to any event type.
 List<EventSubscriptionConfiguration> getEventSubscriptions(TaskEvent.Type type)
          Return a list of EventSubscriptionConfiguration objects that have been configured to apply to the given type of event.
<T extends EventSubscriptionConfiguration>
List<T>
getEventSubscriptions(TaskEvent.Type type, Class<T> subsType)
          Get all the EventSubscriptionConfiguration instances (as the specific subscription type given by subsType) that have been configured to apply to the given event type.
 Set<TaskPlanId> getHandledTaskPlanIds()
          Get the task plans (by id) for which this handler applies.
 String getName()
          Unique name for this handler within the host application.
 boolean handlesEventType(TaskEvent.Type type)
          Indicates if this handler has been configured to do anything with the given type of event.
 boolean hasEventSubscription(String name)
           
 boolean isDisabled()
          If true, this handler is disabled, and is ignored by the runtime listeners intended to respond to the subscriptions it contains.
 boolean isGlobalHandler()
          If true, this handler applies to all task plans.
 void removeEventSubscription(String name)
          NOTE: An event subscription may or may not be removable from an edit session at runtime.
 void removeHandledTaskPlanId(TaskPlanId taskPlanId)
           
 void renameEventSubscription(String oldName, String newName)
          NOTE: An event subscription may or may not be removable from an edit session at runtime.
 void setDisabled(boolean disabled)
           
 void setGlobalHandler(boolean global)
           
 void writeToDescriptorStream(OutputStream descriptorStream, String encoding)
          Write the contents of this handler out as XML.
 

Method Detail

getName

String getName()
Unique name for this handler within the host application. Note that there is not setter for name. EventHandler instances get their name from the .handler file in the host application. Thus, renaming handlers is a design-time activity (and not a management-time activity).


isDisabled

boolean isDisabled()
If true, this handler is disabled, and is ignored by the runtime listeners intended to respond to the subscriptions it contains. It may be useful to temporarily disable an event handler for testing purposes or to override one of the global handlers


setDisabled

void setDisabled(boolean disabled)

isGlobalHandler

boolean isGlobalHandler()
If true, this handler applies to all task plans. If false, the getHandledTaskPlanIds() method defines the task plans for which this handler applies.


setGlobalHandler

void setGlobalHandler(boolean global)

getHandledTaskPlanIds

Set<TaskPlanId> getHandledTaskPlanIds()
Get the task plans (by id) for which this handler applies. If the isGlobalHandler() method returns true, this method is ignored.


addHandledTaskPlanId

void addHandledTaskPlanId(TaskPlanId taskPlanId)

removeHandledTaskPlanId

void removeHandledTaskPlanId(TaskPlanId taskPlanId)

getEventSubscriptionNames

String[] getEventSubscriptionNames()
Get all subscription names. These subscriptions can be of any type whose interface extends EventSubscription.

Returns:

hasEventSubscription

boolean hasEventSubscription(String name)

getEventSubscription

EventSubscription getEventSubscription(String name)
                                       throws UnknownObjectException
Get the event subscription with the given name.

Throws:
UnknownObjectException - If no subscription by the given name exists in this handler.

getEventSubscriptions

List<EventSubscriptionConfiguration> getEventSubscriptions(TaskEvent.Type type)
Return a list of EventSubscriptionConfiguration objects that have been configured to apply to the given type of event.

Parameters:
type - The event type for which the returned EventSubscriptionConfiguration list should apply. Pass null here to get all EventSubscriptionConfigurations for all event types.
Returns:
A list or null if no subscriptions for the type were found.

getEventSubscriptions

<T extends EventSubscriptionConfiguration> List<T> getEventSubscriptions(TaskEvent.Type type,
                                                                         Class<T> subsType)
Get all the EventSubscriptionConfiguration instances (as the specific subscription type given by subsType) that have been configured to apply to the given event type.

Returns:
A list or null if no subscriptions for the event and subscription type were found.

getEventSubscriptions

<T extends EventSubscriptionConfiguration> List<T> getEventSubscriptions(Class<T> subsType)
Get all the EventSubscriptionConfiguration instances (as the specific subscription type given by subsType) that have been configured to apply to any event type.

Returns:
A list or null if no subscriptions for the subscription type were found.

handlesEventType

boolean handlesEventType(TaskEvent.Type type)
Indicates if this handler has been configured to do anything with the given type of event.


addEventSubscription

EventSubscription addEventSubscription(String name)
                                       throws DuplicateObjectException
Add a named event subscription to this handler. The name must not match any subscription that already exists on this handler.

Throws:
DuplicateObjectException

removeEventSubscription

void removeEventSubscription(String name)
NOTE: An event subscription may or may not be removable from an edit session at runtime. You should check the return value of the isRemovable method on the EventSubscription instance before attempting to remove a subscription from this EventHandler. Attempting to remove a non-removable event subscription will result in an IllegalStateException.

Throws:
IllegalStateException - If the subscription with the given name is not removable.

renameEventSubscription

void renameEventSubscription(String oldName,
                             String newName)
NOTE: An event subscription may or may not be removable from an edit session at runtime. You should check the return value of the isRemovable method on the EventSubscription instance before attempting to rename a subscription in this EventHandler. Attempting to rename a non-removable event subscription will result in an IllegalStateException.

Throws:
IllegalStateException - If the subscription with the given name is not removable.

writeToDescriptorStream

void writeToDescriptorStream(OutputStream descriptorStream,
                             String encoding)
                             throws IOException
Write the contents of this handler out as XML. This method requires you to specify a character encoding because a great number of problems occur if you use default encodings across descriptors and (for example) new String(byte[]). BEA recommends the use of the UTF-8 encoding unless you have a specific desire to use a different encoding.

Parameters:
descriptorStream - The output stream into which the XML content will be written.
encoding - The character encoding (as a valid Java charset name) to use when generating the XML content for the handler. If null, a system-defined default encoding is used (though this is not recommended).
Throws:
IOException