Class GenericWebEvent

  • All Implemented Interfaces:
    WebEvent, WebEventTags, java.lang.Cloneable
    Direct Known Subclasses:
    FolderViewTransform.ClientEvent, GenericMultipleEvents, ServletEvent

    public class GenericWebEvent
    extends java.lang.Object
    implements WebEvent, WebEventTags, java.lang.Cloneable
    This class provides a skeletal implemenation of the interface WebEvent, to minimize any effort to implement this interface. It also provides extra functionalities to better serve your needs when working with WebEvent.

    The clone method returns a shallow cloning of an instance of this class, except all the WebEvent.Argument.

    Since:
    MicroStrategy Web 7.3.1 or earlier
    • Field Detail

      • URL_EVENT_NAME

        public static java.lang.String URL_EVENT_NAME
        The event name used in a URL link
      • URL_EVENT_ORDER_NAME

        public static java.lang.String URL_EVENT_ORDER_NAME
        The event name used in a URL link
      • URL_SOURCE_NAME

        public static java.lang.String URL_SOURCE_NAME
        The event source name used in a URL link
      • URL_DEFAULT_EVENT_LIST

        public static java.lang.String URL_DEFAULT_EVENT_LIST
        Since:
        MicroStrategy Web 8.0.0
    • Constructor Detail

      • GenericWebEvent

        public GenericWebEvent()
        Constructs a GenericWebEvent with empty arguments.
      • GenericWebEvent

        public GenericWebEvent​(int id,
                               java.lang.String name)
        Since:
        MicroStrategy Web 9.0.0
    • Method Detail

      • setTargetWindow

        public void setTargetWindow​(java.lang.String target)
        Description copied from interface: WebEvent
        Sets the target attribute for this event. This is useful in redirecting the result of an action into a separate browser When a link for this event is generated, the target attribute is included if a non null value is set.
        Specified by:
        setTargetWindow in interface WebEvent
      • getTargetWindow

        public java.lang.String getTargetWindow()
        Description copied from interface: WebEvent
        returns the target specified for this event
        Specified by:
        getTargetWindow in interface WebEvent
        Returns:
        the target associated with this event.
      • validateRequiredArguments

        public void validateRequiredArguments()

        Checks to see if all the required arguments specified have an argument, if not, an IllegalArgumentException is thrown.

        Since:
        MicroStrategy Web 8.0.0
      • init

        protected void init​(EventInfo info)
        Since:
        MicroStrategy Web 9.0.0
      • getID

        public int getID()
        Returns the event id of the current WebEvent.
        Specified by:
        getID in interface WebEvent
        Returns:
        the event id of the current WebEvent.
      • setID

        public void setID​(int id)
        Sets an event id to the current WebEvent.
        Specified by:
        setID in interface WebEvent
        Parameters:
        id - an event id to set.
      • getName

        public java.lang.String getName()
        Returns the name of the current WebEvent.
        Specified by:
        getName in interface WebEvent
        Returns:
        the name of the current WebEvent.
      • setName

        protected void setName​(java.lang.String name)
        Sets a name to the current WebEvent.
        Parameters:
        name - the event name to set.
      • getArgumentName

        public java.lang.String getArgumentName​(int id)
        Returns the argument name with the specified id at index 0. A WebEventHandler uses this argument name to retrieve its value from an RequestKeys instance.

        This method call is equivalent to call its overloaded method getArgumentName(id, 0). But the name returned does not have the suffix, i.e. the underscore character and the value of index (0 in this case).

        Specified by:
        getArgumentName in interface WebEvent
        Parameters:
        id - the argument ID.
        Returns:
        the argument name with the specified id at index 0. null if there is no such an argument existing.
      • getArgumentName

        public java.lang.String getArgumentName​(int id,
                                                int index)
        Returns the argument name with the specified id at the specified index. A WebEventHandler uses this argument name to retrieve its value from an RequestKeys instance.

        By default, if the an argument name at the given index is null, this method returns the string concatenation of the argument name at index 0, the underscore character '_', and the index value, i.e. arg_1. If the argument name at index 0 is also null, then a null string is returned.

        Specified by:
        getArgumentName in interface WebEvent
        Parameters:
        id - an argument ID.
        index - the index to an argument name.
        Returns:
        the argument name with the specified id and index.
      • setArgumentValue

        public void setArgumentValue​(int id,
                                     java.lang.String value)
        Sets a value to the argument with the specified id at index 0. A new argument with null name is created if there is no such an argument at index 0.
        Specified by:
        setArgumentValue in interface WebEvent
        Parameters:
        id - an argument ID.
        value - the argument value to set.
      • setArgumentValue

        public void setArgumentValue​(int id,
                                     int index,
                                     java.lang.String value)
        Sets a value to the argument with the specified id at the specified index. A new argument is created if there is no such an argument.

        The name of the new argument by default is the string concatenation of the argument name at index 0, the character underscore '_' and the index value, i.e. arg_1. If the argument at index 0 does not exist either, null is assigned.

        Specified by:
        setArgumentValue in interface WebEvent
        Parameters:
        id - an argument ID.
        index - an index where the value is set.
        value - an argument value to set.
      • putArgument

        public void putArgument​(int id,
                                java.lang.String name)
        Specified by:
        putArgument in interface WebEvent
        Since:
        MicroStrategy Web 9.0.0
      • putArgument

        public void putArgument​(int id,
                                java.lang.String name,
                                int required)
        Specified by:
        putArgument in interface WebEvent
        Since:
        MicroStrategy Web 9.0.0
      • putArgument

        public void putArgument​(int id,
                                java.lang.String name,
                                java.lang.String value)
        Specified by:
        putArgument in interface WebEvent
        Since:
        MicroStrategy Web 9.0.0
      • getArgumentValue

        public java.lang.String getArgumentValue​(int argumentID,
                                                 int index)
        Description copied from interface: WebEvent
        Returns the current value of the argument. The default value is returned if one is specified in the definition of this event.

        If not, the value set explicitly is returned.

        If the argument is not found or no value is set, null is returned

        Specified by:
        getArgumentValue in interface WebEvent
        Parameters:
        argumentID - ID of the argument
        index - the index into the set of argument values
        Returns:
        the value of the argument
      • getArgumentValue

        public java.lang.String getArgumentValue​(int argumentID)
        Description copied from interface: WebEvent
        Returns the current value of the argument. The default value is returned if one is specified in the definition of this event.

        If not, the value set explicitly is returned. If the value is set with multiple indices, then the value at index 0 is returned

        If the argument is not found or no value is set, null is returned

        Specified by:
        getArgumentValue in interface WebEvent
        Parameters:
        argumentID - the ID of the argument
        Returns:
        the value of the argument
      • getArgumentValueCount

        public int getArgumentValueCount​(int argumentID)
        Description copied from interface: WebEvent
        Returns the number of values at different indices for the argument.
        Specified by:
        getArgumentValueCount in interface WebEvent
        Parameters:
        argumentID - ID of the argument
        Returns:
        the count of the values
      • initFromKeys

        public void initFromKeys​(RequestKeys keys)
        Description copied from interface: WebEvent
        Initialize the event with the given request keys
        Specified by:
        initFromKeys in interface WebEvent
        Parameters:
        keys - the request keys to be used by this event
      • getSource

        public WebComponent getSource()
        Returns the event source, a WebComponent object which knows how to generate and handle this event.
        Specified by:
        getSource in interface WebEvent
        Returns:
        source a WebComponent object.
      • setSource

        public void setSource​(WebComponent source)
        Sets a WebComponent instance which knows how to generate and handle this WebEvent.
        Specified by:
        setSource in interface WebEvent
        Parameters:
        source - a WebComponent instance.
      • getSourcePath

        public java.lang.String getSourcePath()
        Returns the path of a WebComponent which knows how to generate and handle this WebEvent.
        Specified by:
        getSourcePath in interface WebEvent
        Returns:
        the path of a WebComponent
      • setSourcePath

        public void setSourcePath​(java.lang.String source)
        Sets the path of a WebComponent which knows how to generate and handle this WebEvent.
        Specified by:
        setSourcePath in interface WebEvent
        Parameters:
        source - the path of a WebComponent
      • areAllBitsSet

        public static boolean areAllBitsSet​(int intVal,
                                            int bits)
        Returns whether all the specified bits in intVal are set.
        Parameters:
        intVal - target for checking.
        bits - required to be set.
        Returns:
        whether all the bits are set on intVal.
        Since:
        MicroStrategy Web 8.0.0
      • isAnyBitSet

        public static boolean isAnyBitSet​(int intVal,
                                          int bits)
        Returns whether any of the specified bits in intVal are set.
        Parameters:
        intVal - target for checking.
        bits - bits required to be set.
        Returns:
        whether any of the bits are set on intVal.
        Since:
        MicroStrategy Web 8.0.0
      • initFromXML

        public boolean initFromXML​(java.lang.String xml)
        Deprecated.
        GenericWebEvent is not responsible for parsing the xml from the events-definition, instead use the EventHandlersCatalog to parse the XML and create this instance passing an EventInfo class as part of the constructor.
        Initializes this event based on its specified XML definition.
        Specified by:
        initFromXML in interface WebEvent
        Parameters:
        xml - an XML string representing a WebEvent.
        Returns:
        true if initialization succeeds; false otherwise.
      • initFromXML

        public boolean initFromXML​(org.w3c.dom.Element node)
        Deprecated.
        GenericWebEvent is not responsible for parsing the xml from the events-definition, instead use the EventHandlersCatalog to parse the XML and create this instance passing an EventInfo class as part of the constructor.
        Initializes this event based on its XML representation rooted at the specified node.

        Notice. This method is not a part of the interface. Its signature can be changed or it can be removed completely in future releases.

        Parameters:
        node - a org.w3c.dom.node representing an event.
        Returns:
        true if initialization succeeds.
      • setHandlerType

        protected void setHandlerType​(int type)
        Sets the type of the WebEventHandler by which this event is supported. Callers use the combination of event handler type and event ID to uniquely identify a WebEvent.
        Parameters:
        type - the event handler type.
      • getHandlerType

        protected int getHandlerType()
        Returns the type of the WebEventHandler by which this event is supported. Callers use the combination of event handler type and event ID to uniquely identify a WebEvent.
        Returns:
        the event handler type.
      • clone

        public java.lang.Object clone()
        Clone the current WebEvent. Except its list of WebEvent.Argument, every thing else is shallow cloning.
        Overrides:
        clone in class java.lang.Object
        Returns:
        the cloned object.
      • getArguments

        public java.util.Enumeration getArguments()
        Returns an Enumeration over all the WebEvent.Argument in this WebEvent. The enumeration is backed up this event.
        Specified by:
        getArguments in interface WebEvent
        Returns:
        an Enumeration over all the WebEvent.Argument.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
        Since:
        MicroStrategy Web 8.0.0
      • getDeprecatedMessage

        public java.lang.String getDeprecatedMessage()
        Returns the deprecation message.
        Specified by:
        getDeprecatedMessage in interface WebEvent
        Returns:
        further instructions if this event has been been deprecated
        Since:
        MicroStrategy Web 8.0.0
      • setDeprecationMessage

        protected void setDeprecationMessage​(java.lang.String message)
        Sets a deprecation message.
        Parameters:
        message - the deprecation message
        Since:
        MicroStrategy Web 8.0.0
      • getFlatState

        public java.lang.String getFlatState()
        Description copied from interface: WebEvent

        FlatStateSerializer representation of event. Structure is as follows:

        id:nextStr, src:nextStr, [argName:nextStr, argValue:nextStr]*

        Specified by:
        getFlatState in interface WebEvent
        Returns:
        the flat state of this event.
        Since:
        MicroStrategy Web 8.0.0