public class

EventMap

extends AbstractConfigurationElement
java.lang.Object
   ↳ com.microstrategy.utils.config.AbstractConfigurationElement
     ↳ com.microstrategy.web.app.EventMap

Class Overview

This class represents an event Map. An Event map is used to have one WebBean handle an event that was not originated by itself, based on the information of another event.
These maps are defined on the page config, as children of the page node.
This class can be initialized receiving an XML Node with the following structure:

 <event-map id="eventId" map-id="mapId" target="targetBean">
   <argument id="argId" map-id="mapId" />
   <argument id="argId2" map-id="mapId2" />
   ...
</event-map>
It provides a map() method that returns a WebEvent, applying the map as defined for this EventMap

Summary

Nested Classes
class EventMap.EventMapArgument Represents an argument that will be mapped as part of an event-map. 
Constants
String ATT_ID Returns a Hashmap with the list of arguments.
String ATT_MAP_ID
String ATT_ROOT_ONLY
String ATT_TARGET
String NODE_EVENT
[Expand]
Inherited Constants
From class com.microstrategy.utils.config.AbstractConfigurationElement
Public Constructors
EventMap()
EventMap(Node root)
Creates an EventMap with the information in the xml node.
EventMap(int eventId, int mapId, String target)
Constructor for an EventMap with the given the arguments.
Public Methods
void addEventMapArgument(EventMap.EventMapArgument eventMapArgument)
AbstractConfigurationElement.FilteredList getArguments()
int getEventId()
Object getKey()
Default implementation for getKey().
int getMapId()
String getTarget()
Returns the target of this map.
boolean isRootOnly()
Returns whether this map applies to events from all sources or only those whose source is the root of the beans hierarchy
WebEvent map(RequestKeys requestKeys, PageComponent page)
void setEventId(int value)
Set the event id of the event map to the given value
void setKey(Element element)
Default implementation for setKey().
void setMapId(int value)
Set the map id of the event map to the given value
void setRootOnly(boolean value)
Set this event map to be root only or otherwise
void setTarget(String value)
Set the target of the event map to the given value
Protected Methods
String getKeyAttribute()
This method must return the attribute that uniquely identifies this element among its siblings; if no single attribute can be used, return null and override the getKey and setKey methods.
boolean isKeyAttribute(String name)
Returns true is the name is that of the key attribute.
[Expand]
Inherited Methods
From class com.microstrategy.utils.config.AbstractConfigurationElement
From class java.lang.Object
From interface com.microstrategy.utils.config.ConfigurationElement
From interface com.microstrategy.utils.config.ConfigurationFile

Constants

public static final String ATT_ID

Returns a Hashmap with the list of arguments. It's not intended to be used as a public field. It has package visibility only for Unittesting purposes.

Constant Value: "id"

public static final String ATT_MAP_ID

Constant Value: "map-id"

public static final String ATT_ROOT_ONLY

Constant Value: "root-only"

public static final String ATT_TARGET

Constant Value: "target"

public static final String NODE_EVENT

Constant Value: "event-map"

Public Constructors

public EventMap ()

public EventMap (Node root)

Creates an EventMap with the information in the xml node.

Parameters
root An XML Node with the information for this event map.

public EventMap (int eventId, int mapId, String target)

Constructor for an EventMap with the given the arguments.

Parameters
eventId The original event
mapId The Id of the event to map to
target The name of the bean that should handle the request.

Public Methods

public void addEventMapArgument (EventMap.EventMapArgument eventMapArgument)

public int getEventId ()

Returns
  • the id of the event to be mapped

public Object getKey ()

Default implementation for getKey(). It assumes a single attribute can be used to uniquely identify this element among its siblings; the attribute to use is specified by the getKeyAttribute() method.

Returns
  • If getKeyAttribute() is empty returns null, otherwise it returns the value of the given attribute.

public int getMapId ()

Returns
  • the id of the event to map to

public String getTarget ()

Returns the target of this map. The target should be a bean children of the current page. You must specify the complete path of the target, if the bean is the bean is a child of another bean, i.e.:
bean.child.child.target

Returns
  • the path fo the target bean of this event-map

public boolean isRootOnly ()

Returns whether this map applies to events from all sources or only those whose source is the root of the beans hierarchy

Returns
  • true for root event maps

public WebEvent map (RequestKeys requestKeys, PageComponent page)

Parameters
requestKeys The RequestKeys instance with the current request information
page the current Page component from which the Event should be generated.
Returns
  • A WebEvent mapped from this EventMap information. It will return null if either the target bean is not found or if neither of the events (the source or target) are defined.

public void setEventId (int value)

Set the event id of the event map to the given value

Parameters
value The value for the event id on the event map

public void setKey (Element element)

Default implementation for setKey(). It assumes a single attribute can be used to uniquely identify this element among its siblings and adds this attribute to the given element; the attribute to use is specified by the getKeyAttribute() method.

public void setMapId (int value)

Set the map id of the event map to the given value

Parameters
value The value for the map id on the event map

public void setRootOnly (boolean value)

Set this event map to be root only or otherwise

Parameters
value The boolean value for the rootOnly attribute on the event map.

public void setTarget (String value)

Set the target of the event map to the given value

Parameters
value The value for the target on the event map

Protected Methods

protected String getKeyAttribute ()

This method must return the attribute that uniquely identifies this element among its siblings; if no single attribute can be used, return null and override the getKey and setKey methods.

protected boolean isKeyAttribute (String name)

Returns true is the name is that of the key attribute.