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.String
URL_DEFAULT_EVENT_LIST
static java.lang.String
URL_EVENT_NAME
The event name used in a URL linkstatic java.lang.String
URL_EVENT_ORDER_NAME
The event name used in a URL linkstatic java.lang.String
URL_SOURCE_NAME
The 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 aGenericWebEvent
with 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 boolean
areAllBitsSet(int intVal, int bits)
Returns whether all the specified bits in intVal are set.java.lang.Object
clone()
Clone the currentWebEvent
.java.lang.String
getArgumentName(int id)
Returns the argument name with the specifiedid
at index 0.java.lang.String
getArgumentName(int id, int index)
Returns the argument name with the specifiedid
at the specifiedindex
.java.util.Enumeration
getArguments()
Returns an Enumeration over all theWebEvent.Argument
in thisWebEvent
.java.lang.String
getArgumentValue(int argumentID)
Returns the current value of the argument.java.lang.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.java.lang.String
getDeprecatedMessage()
Returns the deprecation message.java.lang.String
getFlatState()
FlatStateSerializer
representation of event.protected int
getHandlerType()
Returns the type of theWebEventHandler
by which this event is supported.java.lang.String
getHiddenInputs(int paramType, int howMuchChildState)
Deprecated.Replaced byParameterBuilder.addEventInfo(WebEvent, int, int)
.int
getID()
Returns the event id of the currentWebEvent
.java.lang.String
getName()
Returns the name of the currentWebEvent
.WebComponent
getSource()
Returns the event source, aWebComponent
object which knows how to generate and handle this event.java.lang.String
getSourcePath()
Returns the path of aWebComponent
which knows how to generate and handle this WebEvent.java.lang.String
getTargetWindow()
returns the target specified for this eventjava.lang.String
getURLLink()
Deprecated.Replaced byParameterBuilder.addEventInfo(WebEvent, int, int)
.java.lang.String
getURLLink(int paramType)
Deprecated.Replaced byParameterBuilder.addEventInfo(WebEvent, int, int)
.java.lang.String
getURLParameters()
Deprecated.Replaced byParameterBuilder.addEventInfo(WebEvent, int, int)
.java.lang.String
getURLParameters(int paramType)
Deprecated.Replaced byParameterBuilder.addEventInfo(WebEvent, int, int)
.java.lang.String
getURLParameters(int paramType, int howMuchChildState)
Deprecated.Replaced byParameterBuilder.addEventInfo(WebEvent, int, int)
.protected void
init(EventInfo info)
void
initFromKeys(RequestKeys keys)
Initialize the event with the given request keysboolean
initFromXML(java.lang.String xml)
Deprecated.GenericWebEvent is not responsible for parsing the xml from the events-definition, instead use theEventHandlersCatalog
to parse the XML and create this instance passing anEventInfo
class as part of the constructor.boolean
initFromXML(org.w3c.dom.Element node)
Deprecated.GenericWebEvent is not responsible for parsing the xml from the events-definition, instead use theEventHandlersCatalog
to parse the XML and create this instance passing anEventInfo
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, java.lang.String name)
void
putArgument(int id, java.lang.String name, int required)
void
putArgument(int id, java.lang.String name, java.lang.String value)
void
setArgumentValue(int id, int index, java.lang.String value)
Sets a value to the argument with the specifiedid
at the specifiedindex
.void
setArgumentValue(int id, java.lang.String value)
Sets a value to the argument with the specifiedid
at index 0.protected void
setDeprecationMessage(java.lang.String message)
Sets a deprecation message.protected void
setHandlerType(int type)
Sets the type of theWebEventHandler
by which this event is supported.void
setID(int id)
Sets an event id to the currentWebEvent
.protected void
setName(java.lang.String name)
Sets a name to the currentWebEvent
.void
setSource(WebComponent source)
Sets aWebComponent
instance which knows how to generate and handle this WebEvent.void
setSourcePath(java.lang.String source)
Sets the path of aWebComponent
which knows how to generate and handle this WebEvent.void
setTargetWindow(java.lang.String target)
Sets the target attribute for this event.java.lang.String
toString()
void
validateRequiredArguments()
Checks to see if all the required arguments specified have an argument, if not, anIllegalArgumentException
is 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: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 interfaceWebEvent
-
getTargetWindow
public java.lang.String getTargetWindow()
Description copied from interface:WebEvent
returns the target specified for this event- Specified by:
getTargetWindow
in 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
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 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 specifiedid
at index 0. AWebEventHandler
uses this argument name to retrieve its value from anRequestKeys
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 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 specifiedid
at the specifiedindex
. AWebEventHandler
uses this argument name to retrieve its value from anRequestKeys
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 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 specifiedid
at index 0. A new argument withnull
name is created if there is no such an argument at index 0.- Specified by:
setArgumentValue
in 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 specifiedid
at 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:
setArgumentValue
in 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:
putArgument
in interfaceWebEvent
- Since:
- MicroStrategy Web 9.0.0
-
putArgument
public void putArgument(int id, java.lang.String name, int required)
- Specified by:
putArgument
in interfaceWebEvent
- Since:
- MicroStrategy Web 9.0.0
-
putArgument
public void putArgument(int id, java.lang.String name, java.lang.String value)
- Specified by:
putArgument
in interfaceWebEvent
- 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 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: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 interfaceWebEvent
- 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 interfaceWebEvent
- 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 interfaceWebEvent
- Parameters:
keys
- the request keys to be used by this event
-
getSource
public WebComponent getSource()
Returns the event source, aWebComponent
object which knows how to generate and handle this event.
-
setSource
public void setSource(WebComponent source)
Sets aWebComponent
instance which knows how to generate and handle this WebEvent.
-
getSourcePath
public java.lang.String getSourcePath()
Returns the path of aWebComponent
which knows how to generate and handle this WebEvent.- Specified by:
getSourcePath
in interfaceWebEvent
- Returns:
- the path of a WebComponent
-
setSourcePath
public void setSourcePath(java.lang.String source)
Sets the path of aWebComponent
which knows how to generate and handle this WebEvent.- Specified by:
setSourcePath
in 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
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:
getURLLink
in interfaceWebEvent
- Returns:
- an URL link representing this event.
- See Also:
ContainerServices.newURIParameterBuilder()
,ContainerServices.newHiddenInputParameterBuilder()
-
getURLLink
public java.lang.String getURLLink(int paramType)
Deprecated.Replaced byParameterBuilder.addEventInfo(WebEvent, int, int)
.Returns a URL link representing the currentWebEvent
with the specifiedparamType
.This method is equivalent to call
getURLLink(paramType, EnumWebPersistableState.TYPICAL_STATE_INFO)
- Specified by:
getURLLink
in 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
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
paramType
is equal toEnumParameterType.ParameterTypeEventOnly
, no source component's state is included; otherwise, the states of the sourceWebComponent
along with all its descendants are included.- Specified by:
getHiddenInputs
in interfaceWebEvent
- Parameters:
paramType
- a bitwise value fromEnumParameterType
indicating what to include in the generated URL link.howMuchChildState
- how much state ofEnumWebPersistableState
to return from its children- Returns:
- HTML form hidden inputs for the current WebEvent.
- See Also:
ContainerServices.newURIParameterBuilder()
,ContainerServices.newHiddenInputParameterBuilder()
-
initFromXML
public boolean initFromXML(java.lang.String xml)
Deprecated.GenericWebEvent is not responsible for parsing the xml from the events-definition, instead use theEventHandlersCatalog
to parse the XML and create this instance passing anEventInfo
class as part of the constructor.Initializes this event based on its specified XML definition.- Specified by:
initFromXML
in interfaceWebEvent
- Parameters:
xml
- an XML string representing aWebEvent
.- 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 theEventHandlersCatalog
to parse the XML and create this instance passing anEventInfo
class 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.node
representing an event.- Returns:
- true if initialization succeeds.
-
setHandlerType
protected void setHandlerType(int type)
Sets the type of theWebEventHandler
by 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 theWebEventHandler
by 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
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:
getURLParameters
in interfaceWebEvent
- Returns:
- an URL link for arguments.
- See Also:
ContainerServices.newURIParameterBuilder()
,ContainerServices.newHiddenInputParameterBuilder()
-
getURLParameters
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 fromEnumParameterType
indicating what to include.- Returns:
- an URL link for arguments.
- See Also:
ContainerServices.newURIParameterBuilder()
,ContainerServices.newHiddenInputParameterBuilder()
-
getURLParameters
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 fromEnumParameterType
indicating what to include.howMuchChildState
- a flag fromEnumWebPersistableState
indicating 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:
clone
in classjava.lang.Object
- Returns:
- the cloned object.
-
getArguments
public java.util.Enumeration getArguments()
Returns an Enumeration over all theWebEvent.Argument
in thisWebEvent
. The enumeration is backed up this event.- Specified by:
getArguments
in interfaceWebEvent
- Returns:
- an Enumeration over all the
WebEvent.Argument
.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
- Since:
- MicroStrategy Web 8.0.0
-
getDeprecatedMessage
public java.lang.String getDeprecatedMessage()
Returns the deprecation message.- Specified by:
getDeprecatedMessage
in 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:WebEvent
FlatStateSerializer
representation of event. Structure is as follows:id:nextStr, src:nextStr, [argName:nextStr, argValue:nextStr]*
- Specified by:
getFlatState
in interfaceWebEvent
- Returns:
- the flat state of this event.
- Since:
- MicroStrategy Web 8.0.0
-
-