public class

GenericWebEvent

extends Object
implements WebEvent WebEventTags Cloneable
java.lang.Object
   ↳ com.microstrategy.web.beans.GenericWebEvent
Known Direct Subclasses

Class Overview

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.

Summary

[Expand]
Inherited Constants
From interface com.microstrategy.web.beans.WebEventTags
Fields
public static String URL_DEFAULT_EVENT_LIST
public static String URL_EVENT_NAME The event name used in a URL link
public static String URL_EVENT_ORDER_NAME The event name used in a URL link
public static String URL_SOURCE_NAME The event source name used in a URL link
Public Constructors
GenericWebEvent()
Constructs a GenericWebEvent with empty arguments.
GenericWebEvent(int id, String name)
Public Methods
static boolean areAllBitsSet(int intVal, int bits)
Returns whether all the specified bits in intVal are set.
Object clone()
Clone the current WebEvent.
String getArgumentName(int id)
Returns the argument name with the specified id at index 0.
String getArgumentName(int id, int index)
Returns the argument name with the specified id at the specified index.
String getArgumentValue(int argumentID)
Returns the current value of the argument.
String getArgumentValue(int argumentID, int index)
Returns the current value of the argument.
int getArgumentValueCount(int argumentID)
Returns the number of values at different indices for the argument.
Enumeration getArguments()
Returns an Enumeration over all the WebEvent.Argument in this WebEvent.
String getDeprecatedMessage()
Returns the deprecation message.
String getFlatState()

FlatStateSerializer representation of event.

String getHiddenInputs(int paramType, int howMuchChildState)
This method is deprecated. Replaced by addEventInfo(WebEvent, int, int).
int getID()
Returns the event id of the current WebEvent.
String getName()
Returns the name of the current WebEvent.
WebComponent getSource()
Returns the event source, a WebComponent object which knows how to generate and handle this event.
String getSourcePath()
Returns the path of a WebComponent which knows how to generate and handle this WebEvent.
String getTargetWindow()
returns the target specified for this event
String getURLLink(int paramType)
This method is deprecated. Replaced by addEventInfo(WebEvent, int, int).
String getURLLink()
This method is deprecated. Replaced by addEventInfo(WebEvent, int, int).
String getURLParameters()
This method is deprecated. Replaced by addEventInfo(WebEvent, int, int).
String getURLParameters(int paramType, int howMuchChildState)
This method is deprecated. Replaced by addEventInfo(WebEvent, int, int).
String getURLParameters(int paramType)
This method is deprecated. Replaced by addEventInfo(WebEvent, int, int).
void initFromKeys(RequestKeys keys)
Initialize the event with the given request keys
boolean initFromXML(Element node)
This method is 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.
boolean initFromXML(String xml)
This method is 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.
static boolean isAnyBitSet(int intVal, int bits)
Returns whether any of the specified bits in intVal are set.
void putArgument(int id, String name, String value)
void putArgument(int id, String name, int required)
void putArgument(int id, String name)
void setArgumentValue(int id, int index, String value)
Sets a value to the argument with the specified id at the specified index.
void setArgumentValue(int id, String value)
Sets a value to the argument with the specified id at index 0.
void setID(int id)
Sets an event id to the current WebEvent.
void setSource(WebComponent source)
Sets a WebComponent instance which knows how to generate and handle this WebEvent.
void setSourcePath(String source)
Sets the path of a WebComponent which knows how to generate and handle this WebEvent.
void setTargetWindow(String target)
Sets the target attribute for this event.
String toString()
void validateRequiredArguments()

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

Protected Methods
int getHandlerType()
Returns the type of the WebEventHandler by which this event is supported.
void init(EventInfo info)
void setDeprecationMessage(String message)
Sets a deprecation message.
void setHandlerType(int type)
Sets the type of the WebEventHandler by which this event is supported.
void setName(String name)
Sets a name to the current WebEvent.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.microstrategy.web.beans.WebEvent

Fields

public static String URL_DEFAULT_EVENT_LIST

public static String URL_EVENT_NAME

The event name used in a URL link

public static String URL_EVENT_ORDER_NAME

The event name used in a URL link

public static String URL_SOURCE_NAME

The event source name used in a URL link

Public Constructors

public GenericWebEvent ()

Constructs a GenericWebEvent with empty arguments.

public GenericWebEvent (int id, String name)

Public Methods

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.

public Object clone ()

Clone the current WebEvent. Except its list of WebEvent.Argument, every thing else is shallow cloning.

Returns
  • the cloned object.

public 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).

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.

public 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.

Parameters
id an argument ID.
index the index to an argument name.
Returns
  • the argument name with the specified id and index.

public String getArgumentValue (int argumentID)

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

Parameters
argumentID the ID of the argument
Returns
  • the value of the argument

public String getArgumentValue (int argumentID, int index)

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

Parameters
argumentID ID of the argument
index the index into the set of argument values
Returns
  • the value of the argument

public int getArgumentValueCount (int argumentID)

Returns the number of values at different indices for the argument.

Parameters
argumentID ID of the argument
Returns
  • the count of the values

public Enumeration getArguments ()

Returns an Enumeration over all the WebEvent.Argument in this WebEvent. The enumeration is backed up this event.

Returns
  • an Enumeration over all the WebEvent.Argument.

public String getDeprecatedMessage ()

Returns the deprecation message.

Returns
  • further instructions if this event has been been deprecated

public String getFlatState ()

FlatStateSerializer representation of event. Structure is as follows:

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

Returns
  • the flat state of this event.

public String getHiddenInputs (int paramType, int howMuchChildState)

This method is deprecated.
Replaced by addEventInfo(WebEvent, int, int).

Returns HTML form hidden inputs for the current WebEvent. The format is like: <INPUT TYPE=HIDDEN NAME="" VALUE="" ID="" >.

If the paramType is equal to EnumParameterType.ParameterTypeEventOnly, no source component's state is included; otherwise, the states of the source WebComponent along with all its descendants are included.

Parameters
paramType a bitwise value from EnumParameterType indicating what to include in the generated URL link.
howMuchChildState how much state of EnumWebPersistableState to return from its children
Returns
  • HTML form hidden inputs for the current WebEvent.

public int getID ()

Returns the event id of the current WebEvent.

Returns
  • the event id of the current WebEvent.

public String getName ()

Returns the name of the current WebEvent.

Returns
  • the name of the current WebEvent.

public WebComponent getSource ()

Returns the event source, a WebComponent object which knows how to generate and handle this event.

Returns
  • source a WebComponent object.

public String getSourcePath ()

Returns the path of a WebComponent which knows how to generate and handle this WebEvent.

Returns
  • the path of a WebComponent

public String getTargetWindow ()

returns the target specified for this event

Returns
  • the target associated with this event.

public String getURLLink (int paramType)

This method is deprecated.
Replaced by addEventInfo(WebEvent, int, int).

Returns a URL link representing the current WebEvent with the specified paramType.

This method is equivalent to call getURLLink(paramType, EnumWebPersistableState.TYPICAL_STATE_INFO)

Parameters
paramType a bitwise value indicating what to include in the generated URL link.
Returns
  • an URL link representing this event.

public String getURLLink ()

This method is deprecated.
Replaced by addEventInfo(WebEvent, int, int).

Returns a URL link representing the current WebEvent. The generated URL link includes the target name, event id, event source, as well as non-null arguments.

This method is equivalent to call getURLLink(EnumParameterType.ParameterTypeSystem + EnumParameterType.ParameterTypeUserNonNull, EnumWebPersistableState.TYPICAL_STATE_INFO)

Returns
  • an URL link representing this event.

public String getURLParameters ()

This method is deprecated.
Replaced by addEventInfo(WebEvent, int, int).

Returns a URL link including event id, event source and user arguments whose value is not null, but excluding the source component's state.

This method call is equivalent to call getURLParameters(EnumParameterType.ParameterTypeSystem + EnumParameterType.ParameterTypeUserNonNull)

Returns
  • an URL link for arguments.

public String getURLParameters (int paramType, int howMuchChildState)

This method is deprecated.
Replaced by addEventInfo(WebEvent, int, int).

Returns a URL link including event id, event source or user arguments based on the parameter, also including the states of the source component and its children.

Parameters
paramType a bitwise value from EnumParameterType indicating what to include.
howMuchChildState a flag from EnumWebPersistableState indicating how much children state to include.
Returns
  • a URL link for arguments.

public String getURLParameters (int paramType)

This method is deprecated.
Replaced by addEventInfo(WebEvent, int, int).

Returns a URL link including event id, event source or user arguments based on the parameter, but excluding the source component's state.

Parameters
paramType a bitwise value from EnumParameterType indicating what to include.
Returns
  • an URL link for arguments.

public void initFromKeys (RequestKeys keys)

Initialize the event with the given request keys

Parameters
keys the request keys to be used by this event

public boolean initFromXML (Element node)

This method is 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.

public boolean initFromXML (String xml)

This method is 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.

Parameters
xml an XML string representing a WebEvent.
Returns
  • true if initialization succeeds; false otherwise.

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.

public void putArgument (int id, String name, String value)

public void putArgument (int id, String name, int required)

public void putArgument (int id, String name)

public void setArgumentValue (int id, int index, 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.

Parameters
id an argument ID.
index an index where the value is set.
value an argument value to set.

public void setArgumentValue (int id, 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.

Parameters
id an argument ID.
value the argument value to set.

public void setID (int id)

Sets an event id to the current WebEvent.

Parameters
id an event id to set.

public void setSource (WebComponent source)

Sets a WebComponent instance which knows how to generate and handle this WebEvent.

Parameters
source a WebComponent instance.

public void setSourcePath (String source)

Sets the path of a WebComponent which knows how to generate and handle this WebEvent.

Parameters
source the path of a WebComponent

public void setTargetWindow (String target)

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.

public String toString ()

public void validateRequiredArguments ()

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

Protected Methods

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.

protected void init (EventInfo info)

protected void setDeprecationMessage (String message)

Sets a deprecation message.

Parameters
message the deprecation message

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.

protected void setName (String name)

Sets a name to the current WebEvent.

Parameters
name the event name to set.