Class EventMap

  • All Implemented Interfaces:
    ConfigurationElement, ConfigurationFile, java.lang.Cloneable

    public class EventMap
    extends AbstractConfigurationElement
    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
    Since:
    MicroStrategy Web 7.3.1 or earlier
    • Field Detail

      • ATT_ID

        public static final java.lang.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.
        See Also:
        Constant Field Values
      • ATT_ROOT_ONLY

        public static final java.lang.String ATT_ROOT_ONLY
        Since:
        MicroStrategy Web 8.0.1
        See Also:
        Constant Field Values
    • Constructor Detail

      • EventMap

        public EventMap()
        Since:
        MicroStrategy Web 9.0.0
      • EventMap

        public EventMap​(org.w3c.dom.Node root)
        Creates an EventMap with the information in the xml node.
        Parameters:
        root - An XML Node with the information for this event map.
      • EventMap

        public EventMap​(int eventId,
                        int mapId,
                        java.lang.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.
    • Method Detail

      • getEventId

        public int getEventId()
        Returns:
        the id of the event to be mapped
      • setEventId

        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
        Since:
        MicroStrategy Web 9.0.0
      • getMapId

        public int getMapId()
        Returns:
        the id of the event to map to
      • setMapId

        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
        Since:
        MicroStrategy Web 9.0.0
      • getTarget

        public java.lang.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
      • setTarget

        public void setTarget​(java.lang.String value)
        Set the target of the event map to the given value
        Parameters:
        value - The value for the target on the event map
        Since:
        MicroStrategy Web 9.0.0
      • isRootOnly

        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
        Since:
        MicroStrategy Web 8.0.1
      • setRootOnly

        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.
        Since:
        MicroStrategy Web 9.0.0
      • addEventMapArgument

        public void addEventMapArgument​(EventMap.EventMapArgument eventMapArgument)
        Since:
        MicroStrategy Web 9.0.0
      • map

        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.
      • getKeyAttribute

        protected java.lang.String getKeyAttribute()
        Description copied from class: AbstractConfigurationElement
        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.
        Specified by:
        getKeyAttribute in class AbstractConfigurationElement
        Since:
        MicroStrategy Web 9.0.0
      • getKey

        public java.lang.Object getKey()
        Description copied from class: AbstractConfigurationElement
        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.
        Specified by:
        getKey in interface ConfigurationElement
        Overrides:
        getKey in class AbstractConfigurationElement
        Returns:
        If getKeyAttribute() is empty returns null, otherwise it returns the value of the given attribute.
        Since:
        MicroStrategy Web 9.0.0
      • setKey

        public void setKey​(org.w3c.dom.Element element)
        Description copied from class: AbstractConfigurationElement
        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.
        Overrides:
        setKey in class AbstractConfigurationElement
        Since:
        MicroStrategy Web 9.0.0