java.lang.Object | |
↳ | com.microstrategy.web.beans.GenericEventHandler |
![]() |
This class provides the default implementation of the interface WebEventHandler.
The clone
method provides a shallow cloning of the contained
collection of WebEvent
, as well as the associated
WebComponent
.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
class | GenericEventHandler.GenericEventKeys | This inner class is an implementation of the request keys specific for an event. |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | MULTIPLE_EVENT_SOURCE_SUFFIX | ||||||||||
int | NO_EVENT_ID | This constant represents the ID returned by the getEventID method when there is no event in the request |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
protected List<WebEvent> | _extraEvents | ||||||||||
protected int | layerOfHandleRequest |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
GenericEventHandler()
Constructs a
GenericEventHandler with empty collection of
WebEvent. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void |
addEvent(WebEvent event)
Adds a
WebEvent instance into the current event handler. | ||||||||||
void |
addEvents(Element node)
This method is deprecated.
The GenericEventHandler is not responsible to read the xml structure,
therefore this method is not used anymore.
Events should be added to an event handler using the Web Customization Editor | ||||||||||
void |
addEventsFromXML(String eventsXML)
This method is deprecated.
The GenericEventHandler is not responsible to read the xml structure,
therefore this method is not used anymore.
Events should be added to an event handler using the Web Customization Editor | ||||||||||
void |
appendRemainingEvent(WebEvent event)
Append an remaining event at the end of the remaining events' list.
| ||||||||||
Object |
clone()
Clone the current event handler instance.
| ||||||||||
boolean |
delegateRequest(RequestKeys keys)
The default implementation of this method simply delegates the event to
the next source component specified in the static field
GenericWebEvent.URL_SOURCE_NAME . | ||||||||||
int |
getHandlerType()
Returns the
type of the current
WebEventHandle . | ||||||||||
String |
getName()
Returns the name of this event handler
| ||||||||||
String |
getNextSourceName(RequestKeys keys)
Returns the next component name in the event component path.
| ||||||||||
static String |
getNextSourceName(String currentBeanPath, String eventFullPath)
Returns the next source component which will handle the event.
| ||||||||||
SimpleList |
getPendingEvents()
Returns the list of events that were not processed.
| ||||||||||
Class |
getSupportedWebComponentType()
Returns the
WebComponent class by default. | ||||||||||
WebComponent |
getWebComponent()
Returns the
WebComponent object associated with the current
event handler. | ||||||||||
WebEvent |
getWebEvent(int eventID)
Returns the specified
WebEvent instance which this event handler
supports. | ||||||||||
Enumeration |
getWebEvents()
Returns an enumeration over the
WebEvent suppored by this event
handler. | ||||||||||
Enumeration |
getWebEventsFromRequest(RequestKeys keys)
Returns an enumeration over the
WebEvent suppored by this event
handler that are present in the request keys provided. | ||||||||||
boolean |
handleRequest(RequestKeys keys)
Handles the
WebEvent specified in the RequestKeys object. | ||||||||||
void | processExtraEvents() | ||||||||||
static void |
processMultipleEvents(String flatState, MultipleEventHandler handler)
This method is deprecated.
Use
processMultipleEvents(String, MultipleEventHandler, String)
| ||||||||||
static void |
processMultipleEvents(String flatState, MultipleEventHandler handler, String componentPath)
Processes multiple events encoded via the
FlatStateSerializer . | ||||||||||
boolean |
processRequest(RequestKeys keys)
Logic to process the event.
| ||||||||||
void |
setName(String name)
Sets the name to this event handler
| ||||||||||
void |
setWebComponent(WebComponent component)
Sets a
WebComponent instance on this event handler. |
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void |
addEvent(Element eventNode)
This method is deprecated.
The GenericEventHandler is not responsible to read the xml structure,
therefore this method is not used anymore.
Events should be added to an event handler using the Web Customization Editor | ||||||||||
static int |
getEventID(RequestKeys keys)
Retrieves the event id passed in from the
RequestKeys . | ||||||||||
WebComponent | getEventTarget(RequestKeys keys) | ||||||||||
WebEvent |
getWebEvent(int eventID, RequestKeys keys)
This method should be used when the eventID passed in is different
from the one that is included as a value in the keys parameter
| ||||||||||
WebEvent |
getWebEvent(RequestKeys keys)
Decodes the
WebEvent from the RequestKeys . | ||||||||||
boolean |
isInitialized()
Returns
true after the markInitailized() has been called. | ||||||||||
boolean | isMyEvent(RequestKeys keys) | ||||||||||
void |
markInitailized()
Call this method to mark this event-handler instance as initialized.
| ||||||||||
void |
setHandlerType(int type)
Sets the
type of the current event
handler. | ||||||||||
void |
validateRequiredArgument(String argName, String argValue)
A helper method which ensures that the
argValue
corresponding to argName is not null and not empty. |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
This constant represents the ID returned by the getEventID method when there is no event in the request
Constructs a GenericEventHandler
with empty collection of
WebEvent.
Adds a WebEvent
instance into the current event handler.
event | the WebEvent instance to be added.
|
---|
This method is deprecated.
The GenericEventHandler is not responsible to read the xml structure,
therefore this method is not used anymore.
Events should be added to an event handler using the Web Customization Editor
Adds one or more GenericWebEvent
into the current event handler.
The root node of event definition XML passed in might be either
TAG_EVENTS
or TAG_EVENT
.
node | the root node of the XML representation of web events. |
---|
This method is deprecated.
The GenericEventHandler is not responsible to read the xml structure,
therefore this method is not used anymore.
Events should be added to an event handler using the Web Customization Editor
Adds one or more GenericWebEvent
into the current event handler.
The root node of event definition XML passed in might be either
TAG_EVENTS
or TAG_EVENT
.
eventsXML | the XML representation of web events. |
---|
Append an remaining event at the end of the remaining events' list.
Such remaining event will be processed at the end.
event | the WebEvent object.
|
---|
Clone the current event handler instance. This is a shallow cloning
since the events it holds and the associated WebComponent
are not deeply cloned.
GenericEventHandler
.
The default implementation of this method simply delegates the event to
the next source component specified in the static field
GenericWebEvent.URL_SOURCE_NAME
.
keys | the RequestKeys object containing event ID, sources, and any other information. |
---|
processRequest
or one of its children.WebException |
---|
Returns the type
of the current
WebEventHandle
.
Returns the name of this event handler
Returns the next component name in the event component path.
keys | request keys |
---|
Returns the next source component which will handle the event. The next
source is calculated by finding out the next component following the
segement currentBeanPath
in the eventFullPath
.
For example, if
then this method returns
String currentBeanPath = "servlet.page";
String eventFullPath = "servlet.page.bean1.bean2";
bean1
to the caller.
currentBeanPath | the path of the current component which is handling the event. |
---|---|
eventFullPath | the full path of the event to be handled. |
Returns the list of events that were not processed.
While handling the request, if after processing an event the page is not
in Succesfull state, the EventHandler stops processing the rest of the events.
This list resturns those events that remain pending.
handleRequest()
.
If handelRequest()
was not invoked, it returns null.
Returns the WebComponent
class by default. Subclasses should
override this to return their respective WebComponent
or WebBean
int.
Class
of the WebComponent
this event
handler is associated with.
Returns the WebComponent
object associated with the current
event handler.
Returns the specified WebEvent
instance which this event handler
supports.
eventID | the event id of the WebEvent. |
---|
Returns an enumeration over the WebEvent
suppored by this event
handler. The WebEvent
are returned in no particular order.
WebEvent
supported.
Returns an enumeration over the WebEvent
suppored by this event
handler that are present in the request keys provided. The WebEvent
are returned in no particular order.
keys | the RequestKeys object. |
---|
WebEvent
supported.
Handles the WebEvent
specified in the RequestKeys
object.
By default, this method will invoke processRequest(RequestKeys)
followed by delegateRequest(RequestKeys)
.
keys | the RequestKeys object containing event ID, sources, and any other information. |
---|
WebException | thrown if handling of the request fails. |
---|
Processes multiple events encoded via the FlatStateSerializer
.
flatState | state encoded using the FlatStateSerializer algorithm. |
---|---|
handler | event handler to pocess request |
Logic to process the event. Specific event handler implementation extending this class will need to override the default behavior.
keys | the RequestKeys object containing event ID, sources, and any other information. |
---|
WebException |
---|
Sets the name to this event handler
name | a new name of this event handler |
---|
Sets a WebComponent
instance on this event handler.
A WebComponent must maintain a one-one relationship with
an event handler instance. After this method call, the
WebComponent previously associated with this event handler
should have a null instance of WebEventHandler
, and the
event handler instance previously associate the specified
WebComponent
should have a null WebComponent
.
This method calls the method setWebEventHandler(WebEventHandler)
.
Therefore, any WebComponent
implementation should pay
attention to avoid cyclic reference to each other between an event
handler and a web component.
component | a new WebComponent object. |
---|
MSTRUncheckedException | thrown if component is not an instance of the class returned by getSupportedWebComponentType()
|
---|
This method is deprecated.
The GenericEventHandler is not responsible to read the xml structure,
therefore this method is not used anymore.
Events should be added to an event handler using the Web Customization Editor
Add one GenericWebEvent
into the current event handler.
eventNode | the root node of a single event. |
---|
Retrieves the event id passed in from the RequestKeys
.
keys | the RequestKeys object. |
---|
NO_EVENT_ID
if the request
does not contain any event ID.
This method should be used when the eventID passed in is different from the one that is included as a value in the keys parameter
Decodes the WebEvent
from the RequestKeys
.
keys | request keys |
---|
WebEvent
Returns true
after the markInitailized()
has been called.
It's used to identify if this instance has been initialized with the list
of events it supports.
Call this method to mark this event-handler instance as initialized.
Sets the type
of the current event
handler.
type | the type of the current event handler. |
---|
A helper method which ensures that the argValue
corresponding to argName
is not null and not empty.
argName | the event argument name. |
---|---|
argValue | the event argument value to ve validated |
WebException | thrown if argValue is a null string or empty string. |
---|