Class GenericWebEvent
- java.lang.Object
-
- com.microstrategy.web.beans.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 interfaceWebEvent, to minimize any effort to implement this interface. It also provides extra functionalities to better serve your needs when working withWebEvent.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 Summary
Fields Modifier and Type Field Description static java.lang.StringURL_DEFAULT_EVENT_LISTstatic java.lang.StringURL_EVENT_NAMEThe event name used in a URL linkstatic java.lang.StringURL_EVENT_ORDER_NAMEThe event name used in a URL linkstatic java.lang.StringURL_SOURCE_NAMEThe event source name used in a URL link-
Fields inherited from interface com.microstrategy.web.beans.WebEventTags
ATT_ARGUMENT_ENUMERATOR, ATT_ARGUMENT_ID, ATT_ARGUMENT_INDEX, ATT_ARGUMENT_NAME, ATT_ARGUMENT_REQUIRED, ATT_ARGUMENT_TYPE, ATT_ARGUMENT_VALIDATOR, ATT_ARGUMENT_VALUE, ATT_EVENT_DEPRECATED, ATT_EVENT_ENUMERATOR, ATT_EVENT_HANDLER_ENUMERATOR, ATT_EVENT_HANDLER_NAME, ATT_EVENT_HANDLER_TYPE, ATT_EVENT_ID, ATT_EVENT_NAME, ATT_EVENT_TARGET, TAG_ARGUMENT, TAG_ARGUMENTS, TAG_EVENT, TAG_EVENT_HANDLER, TAG_EVENT_HANDLERS, TAG_EVENTS
-
-
Constructor Summary
Constructors Constructor Description GenericWebEvent()Constructs aGenericWebEventwith empty arguments.GenericWebEvent(int id, java.lang.String name)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static booleanareAllBitsSet(int intVal, int bits)Returns whether all the specified bits in intVal are set.java.lang.Objectclone()Clone the currentWebEvent.java.lang.StringgetArgumentName(int id)Returns the argument name with the specifiedidat index 0.java.lang.StringgetArgumentName(int id, int index)Returns the argument name with the specifiedidat the specifiedindex.java.util.EnumerationgetArguments()Returns an Enumeration over all theWebEvent.Argumentin thisWebEvent.java.lang.StringgetArgumentValue(int argumentID)Returns the current value of the argument.java.lang.StringgetArgumentValue(int argumentID, int index)Returns the current value of the argument.intgetArgumentValueCount(int argumentID)Returns the number of values at different indices for the argument.java.lang.StringgetDeprecatedMessage()Returns the deprecation message.java.lang.StringgetFlatState()FlatStateSerializerrepresentation of event.protected intgetHandlerType()Returns the type of theWebEventHandlerby which this event is supported.java.lang.StringgetHiddenInputs(int paramType, int howMuchChildState)Deprecated.Replaced byParameterBuilder.addEventInfo(WebEvent, int, int).intgetID()Returns the event id of the currentWebEvent.java.lang.StringgetName()Returns the name of the currentWebEvent.WebComponentgetSource()Returns the event source, aWebComponentobject which knows how to generate and handle this event.java.lang.StringgetSourcePath()Returns the path of aWebComponentwhich knows how to generate and handle this WebEvent.java.lang.StringgetTargetWindow()returns the target specified for this eventjava.lang.StringgetURLLink()Deprecated.Replaced byParameterBuilder.addEventInfo(WebEvent, int, int).java.lang.StringgetURLLink(int paramType)Deprecated.Replaced byParameterBuilder.addEventInfo(WebEvent, int, int).java.lang.StringgetURLParameters()Deprecated.Replaced byParameterBuilder.addEventInfo(WebEvent, int, int).java.lang.StringgetURLParameters(int paramType)Deprecated.Replaced byParameterBuilder.addEventInfo(WebEvent, int, int).java.lang.StringgetURLParameters(int paramType, int howMuchChildState)Deprecated.Replaced byParameterBuilder.addEventInfo(WebEvent, int, int).protected voidinit(EventInfo info)voidinitFromKeys(RequestKeys keys)Initialize the event with the given request keysbooleaninitFromXML(java.lang.String xml)Deprecated.GenericWebEvent is not responsible for parsing the xml from the events-definition, instead use theEventHandlersCatalogto parse the XML and create this instance passing anEventInfoclass as part of the constructor.booleaninitFromXML(org.w3c.dom.Element node)Deprecated.GenericWebEvent is not responsible for parsing the xml from the events-definition, instead use theEventHandlersCatalogto parse the XML and create this instance passing anEventInfoclass as part of the constructor.static booleanisAnyBitSet(int intVal, int bits)Returns whether any of the specified bits in intVal are set.voidputArgument(int id, java.lang.String name)voidputArgument(int id, java.lang.String name, int required)voidputArgument(int id, java.lang.String name, java.lang.String value)voidsetArgumentValue(int id, int index, java.lang.String value)Sets a value to the argument with the specifiedidat the specifiedindex.voidsetArgumentValue(int id, java.lang.String value)Sets a value to the argument with the specifiedidat index 0.protected voidsetDeprecationMessage(java.lang.String message)Sets a deprecation message.protected voidsetHandlerType(int type)Sets the type of theWebEventHandlerby which this event is supported.voidsetID(int id)Sets an event id to the currentWebEvent.protected voidsetName(java.lang.String name)Sets a name to the currentWebEvent.voidsetSource(WebComponent source)Sets aWebComponentinstance which knows how to generate and handle this WebEvent.voidsetSourcePath(java.lang.String source)Sets the path of aWebComponentwhich knows how to generate and handle this WebEvent.voidsetTargetWindow(java.lang.String target)Sets the target attribute for this event.java.lang.StringtoString()voidvalidateRequiredArguments()Checks to see if all the required arguments specified have an argument, if not, anIllegalArgumentExceptionis thrown.
-
-
-
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
-
-
Method Detail
-
setTargetWindow
public void setTargetWindow(java.lang.String target)
Description copied from interface:WebEventSets 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:
setTargetWindowin interfaceWebEvent
-
getTargetWindow
public java.lang.String getTargetWindow()
Description copied from interface:WebEventreturns the target specified for this event- Specified by:
getTargetWindowin interfaceWebEvent- 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
IllegalArgumentExceptionis 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 currentWebEvent.
-
setID
public void setID(int id)
Sets an event id to the currentWebEvent.
-
getName
public java.lang.String getName()
Returns the name of the currentWebEvent.
-
setName
protected void setName(java.lang.String name)
Sets a name to the currentWebEvent.- Parameters:
name- the event name to set.
-
getArgumentName
public java.lang.String getArgumentName(int id)
Returns the argument name with the specifiedidat index 0. AWebEventHandleruses this argument name to retrieve its value from anRequestKeysinstance.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:
getArgumentNamein interfaceWebEvent- 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 specifiedidat the specifiedindex. AWebEventHandleruses this argument name to retrieve its value from anRequestKeysinstance.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:
getArgumentNamein interfaceWebEvent- 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 specifiedidat index 0. A new argument withnullname is created if there is no such an argument at index 0.- Specified by:
setArgumentValuein interfaceWebEvent- 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 specifiedidat the specifiedindex. 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:
setArgumentValuein interfaceWebEvent- 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:
putArgumentin interfaceWebEvent- Since:
- MicroStrategy Web 9.0.0
-
putArgument
public void putArgument(int id, java.lang.String name, int required)- Specified by:
putArgumentin interfaceWebEvent- Since:
- MicroStrategy Web 9.0.0
-
putArgument
public void putArgument(int id, java.lang.String name, java.lang.String value)- Specified by:
putArgumentin interfaceWebEvent- Since:
- MicroStrategy Web 9.0.0
-
getArgumentValue
public java.lang.String getArgumentValue(int argumentID, int index)Description copied from interface:WebEventReturns 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:
getArgumentValuein interfaceWebEvent- Parameters:
argumentID- ID of the argumentindex- 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:WebEventReturns 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:
getArgumentValuein interfaceWebEvent- Parameters:
argumentID- the ID of the argument- Returns:
- the value of the argument
-
getArgumentValueCount
public int getArgumentValueCount(int argumentID)
Description copied from interface:WebEventReturns the number of values at different indices for the argument.- Specified by:
getArgumentValueCountin interfaceWebEvent- Parameters:
argumentID- ID of the argument- Returns:
- the count of the values
-
initFromKeys
public void initFromKeys(RequestKeys keys)
Description copied from interface:WebEventInitialize the event with the given request keys- Specified by:
initFromKeysin interfaceWebEvent- Parameters:
keys- the request keys to be used by this event
-
getSource
public WebComponent getSource()
Returns the event source, aWebComponentobject which knows how to generate and handle this event.
-
setSource
public void setSource(WebComponent source)
Sets aWebComponentinstance which knows how to generate and handle this WebEvent.
-
getSourcePath
public java.lang.String getSourcePath()
Returns the path of aWebComponentwhich knows how to generate and handle this WebEvent.- Specified by:
getSourcePathin interfaceWebEvent- Returns:
- the path of a WebComponent
-
setSourcePath
public void setSourcePath(java.lang.String source)
Sets the path of aWebComponentwhich knows how to generate and handle this WebEvent.- Specified by:
setSourcePathin interfaceWebEvent- 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
-
getURLLink
@Deprecated public java.lang.String getURLLink()
Deprecated.Replaced byParameterBuilder.addEventInfo(WebEvent, int, int).Returns a URL link representing the currentWebEvent. 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)- Specified by:
getURLLinkin interfaceWebEvent- Returns:
- an URL link representing this event.
- See Also:
ContainerServices.newURIParameterBuilder(),ContainerServices.newHiddenInputParameterBuilder()
-
getURLLink
@Deprecated public java.lang.String getURLLink(int paramType)
Deprecated.Replaced byParameterBuilder.addEventInfo(WebEvent, int, int).Returns a URL link representing the currentWebEventwith the specifiedparamType.This method is equivalent to call
getURLLink(paramType, EnumWebPersistableState.TYPICAL_STATE_INFO)- Specified by:
getURLLinkin interfaceWebEvent- Parameters:
paramType- a bitwise value indicating what to include in the generated URL link.- Returns:
- an URL link representing this event.
- See Also:
ContainerServices.newURIParameterBuilder(),ContainerServices.newHiddenInputParameterBuilder()
-
getHiddenInputs
@Deprecated public java.lang.String getHiddenInputs(int paramType, int howMuchChildState)Deprecated.Replaced byParameterBuilder.addEventInfo(WebEvent, int, int).Returns HTML form hidden inputs for the currentWebEvent. The format is like: <INPUT TYPE=HIDDEN NAME="" VALUE="" ID="" >.If the
paramTypeis equal toEnumParameterType.ParameterTypeEventOnly, no source component's state is included; otherwise, the states of the sourceWebComponentalong with all its descendants are included.- Specified by:
getHiddenInputsin interfaceWebEvent- Parameters:
paramType- a bitwise value fromEnumParameterTypeindicating what to include in the generated URL link.howMuchChildState- how much state ofEnumWebPersistableStateto return from its children- Returns:
- HTML form hidden inputs for the current WebEvent.
- See Also:
ContainerServices.newURIParameterBuilder(),ContainerServices.newHiddenInputParameterBuilder()
-
initFromXML
@Deprecated public boolean initFromXML(java.lang.String xml)
Deprecated.GenericWebEvent is not responsible for parsing the xml from the events-definition, instead use theEventHandlersCatalogto parse the XML and create this instance passing anEventInfoclass as part of the constructor.Initializes this event based on its specified XML definition.- Specified by:
initFromXMLin interfaceWebEvent- Parameters:
xml- an XML string representing aWebEvent.- Returns:
- true if initialization succeeds; false otherwise.
-
initFromXML
@Deprecated public boolean initFromXML(org.w3c.dom.Element node)
Deprecated.GenericWebEvent is not responsible for parsing the xml from the events-definition, instead use theEventHandlersCatalogto parse the XML and create this instance passing anEventInfoclass as part of the constructor.Initializes this event based on its XML representation rooted at the specifiednode.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- aorg.w3c.dom.noderepresenting an event.- Returns:
- true if initialization succeeds.
-
setHandlerType
protected void setHandlerType(int type)
Sets the type of theWebEventHandlerby which this event is supported. Callers use the combination of event handler type and event ID to uniquely identify aWebEvent.- Parameters:
type- the event handler type.
-
getHandlerType
protected int getHandlerType()
Returns the type of theWebEventHandlerby which this event is supported. Callers use the combination of event handler type and event ID to uniquely identify aWebEvent.- Returns:
- the event handler type.
-
getURLParameters
@Deprecated public java.lang.String getURLParameters()
Deprecated.Replaced byParameterBuilder.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)- Specified by:
getURLParametersin interfaceWebEvent- Returns:
- an URL link for arguments.
- See Also:
ContainerServices.newURIParameterBuilder(),ContainerServices.newHiddenInputParameterBuilder()
-
getURLParameters
@Deprecated public java.lang.String getURLParameters(int paramType)
Deprecated.Replaced byParameterBuilder.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 fromEnumParameterTypeindicating what to include.- Returns:
- an URL link for arguments.
- See Also:
ContainerServices.newURIParameterBuilder(),ContainerServices.newHiddenInputParameterBuilder()
-
getURLParameters
@Deprecated public java.lang.String getURLParameters(int paramType, int howMuchChildState)Deprecated.Replaced byParameterBuilder.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 fromEnumParameterTypeindicating what to include.howMuchChildState- a flag fromEnumWebPersistableStateindicating how much children state to include.- Returns:
- a URL link for arguments.
- See Also:
ContainerServices.newURIParameterBuilder(),ContainerServices.newHiddenInputParameterBuilder()
-
clone
public java.lang.Object clone()
Clone the currentWebEvent. Except its list ofWebEvent.Argument, every thing else is shallow cloning.- Overrides:
clonein classjava.lang.Object- Returns:
- the cloned object.
-
getArguments
public java.util.Enumeration getArguments()
Returns an Enumeration over all theWebEvent.Argumentin thisWebEvent. The enumeration is backed up this event.- Specified by:
getArgumentsin interfaceWebEvent- Returns:
- an Enumeration over all the
WebEvent.Argument.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object- Since:
- MicroStrategy Web 8.0.0
-
getDeprecatedMessage
public java.lang.String getDeprecatedMessage()
Returns the deprecation message.- Specified by:
getDeprecatedMessagein interfaceWebEvent- 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:WebEventFlatStateSerializerrepresentation of event. Structure is as follows:id:nextStr, src:nextStr, [argName:nextStr, argValue:nextStr]*
- Specified by:
getFlatStatein interfaceWebEvent- Returns:
- the flat state of this event.
- Since:
- MicroStrategy Web 8.0.0
-
-