Package com.microstrategy.web.beans
Class ExpressionPromptEventHandlerImpl
- java.lang.Object
-
- com.microstrategy.web.beans.GenericEventHandler
-
- com.microstrategy.web.beans.SysEventHandler
-
- com.microstrategy.web.beans.ExpressionPromptEventHandlerImpl
-
- All Implemented Interfaces:
EnumPromptBeanEvents
,WebEventHandler
,WebEventTags
,java.lang.Cloneable
public class ExpressionPromptEventHandlerImpl extends SysEventHandler
- Since:
- MicroStrategy Web 9.0.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.microstrategy.web.beans.GenericEventHandler
GenericEventHandler.GenericEventKeys
-
-
Field Summary
Fields Modifier and Type Field Description protected WebEvent
_event
protected RequestKeys
_keys
protected int
_position
protected static java.lang.String
IMAGE_SUFFIX_X
protected static java.lang.String
IMAGE_SUFFIX_Y
protected static java.lang.String
NONE_OPTION_ID
protected static java.lang.String
POSITION_MARK
protected static java.lang.String
WILDCARD
-
Fields inherited from class com.microstrategy.web.beans.SysEventHandler
DEFAULT_CONFIG_PATH
-
Fields inherited from class com.microstrategy.web.beans.GenericEventHandler
_extraEvents, layerOfHandleRequest, MULTIPLE_EVENT_SOURCE_SUFFIX, NO_EVENT_ID
-
Fields inherited from interface com.microstrategy.web.beans.EnumPromptBeanEvents
PROMPT_EVENT_ADD_UNITS, PROMPT_EVENT_ANSWER_PROMPT, PROMPT_EVENT_ARGUMENT_ANSWER, PROMPT_EVENT_ARGUMENT_ANSWER_BY_ID, PROMPT_EVENT_ARGUMENT_ANSWER_FORMAT, PROMPT_EVENT_ARGUMENT_ANSWER_OPTIONS, PROMPT_EVENT_ARGUMENT_BLOCK_BEGIN, PROMPT_EVENT_ARGUMENT_BLOCK_COUNT, PROMPT_EVENT_ARGUMENT_MATCH_CASE, PROMPT_EVENT_ARGUMENT_PROMPT_ANSWER_AUTO_CLOSE, PROMPT_EVENT_ARGUMENT_PROMPT_ANSWER_ID, PROMPT_EVENT_ARGUMENT_PROMPT_ANSWER_IS_DEFAULT, PROMPT_EVENT_ARGUMENT_PROMPT_ANSWER_NAME, PROMPT_EVENT_ARGUMENT_PROMPT_SAVE_ANSWER_ACTION, PROMPT_EVENT_ARGUMENT_SEARCH_STRING, PROMPT_EVENT_ARGUMENT_UNITS_TO_ADD, PROMPT_EVENT_ARGUMENT_UNITS_TO_REMOVE, PROMPT_EVENT_CANCEL_PROMPT, PROMPT_EVENT_INCREMENTAL_FETCH, PROMPT_EVENT_REMOVE_UNITS, PROMPT_EVENT_VALUE_ANSWER_ACTION_ADD, PROMPT_EVENT_VALUE_ANSWER_ACTION_DELETE
-
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 ExpressionPromptEventHandlerImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
applyLocalSettings(WebObjectSource wos)
Sets minimal flags on the WebObjectSourceprotected boolean
checkClearAnswer(java.lang.String answer)
Based on the Prompt answer option and the answer string, this method calls clear prompt answer.protected WebPromptAnswer
getAnswerByID()
protected int
getAnswerFormat(int position)
Returns the answer Format being used from the request keysprotected int
getAppendedIntValue(java.lang.String str, int defVal)
Return the integer value from the string.protected java.lang.String
getIncrementalFetchParameter(int arg, int position)
Returns the incremental fetch parameter value.protected int
getIntValue(java.lang.String str, int defaultVal)
Returns the integer value from the stringprotected int
getIntValue(java.lang.String str, java.lang.String msg)
Returns the int value based on the String.protected WebObjectInfo
getObject(com.microstrategy.web.beans.AbstractPromptEventHandlerImpl.MdObject mObj)
Returns theWebObjectInfo
associated with the MdObjectprotected WebObjectsFactory
getObjectsFactory()
Returns theWebObjectsFactory
associated with the session.protected WebObjectSource
getObjectSource()
Returns theWebObjectSource
from theWebObjectsFactory
protected WebPromptAnswer
getPromptAnswer()
protected WebSessionInfo
getSessionInfo()
Returns theWebSessionInfo
object associated with the prompt This method throws anIllegalStateException
if the session is null.protected java.lang.String[]
getValuesFromRequest(int arg, int index, java.lang.String delim)
Returns a string array containing values corresponding to the argument from the request keys collection.protected boolean
handleCancelPrompt()
Cancels the web promptprotected void
initUsingKeys(RequestKeys keys)
Initialize the event handler using the request keys Sets up protected variables _keys, _event,_positionboolean
processRequest(RequestKeys keys)
Logic to process the event.protected void
savePromptAnswer()
protected void
setReuseOnPromptAnswer(WebPromptAnswer pa, WebUserAnswers userAnswers)
protected void
setSavedPromptAnswer(WebPromptAnswer pa)
-
Methods inherited from class com.microstrategy.web.beans.SysEventHandler
getCatalog, getWebEvent, getWebEvents, initEvents, initEvents, newDefaultEventInstance, newWebEvent
-
Methods inherited from class com.microstrategy.web.beans.GenericEventHandler
addEvent, addEvent, addEvents, addEventsFromRequestKeys, addEventsFromXML, appendRemainingEvent, clone, delegateRequest, getEventID, getEventTarget, getHandlerType, getName, getNextSourceName, getNextSourceName, getOrderedEvents, getPendingEvents, getSupportedWebComponentType, getWebComponent, getWebEvent, getWebEvent, getWebEventsFromRequest, handleRequest, isInitialized, isMyEvent, markInitailized, processExtraEvents, processMultipleEvents, processMultipleEvents, setHandlerType, setName, setWebComponent, validateRequiredArgument
-
-
-
-
Field Detail
-
_event
protected WebEvent _event
-
_keys
protected RequestKeys _keys
-
_position
protected int _position
-
NONE_OPTION_ID
protected static final java.lang.String NONE_OPTION_ID
- See Also:
- Constant Field Values
-
IMAGE_SUFFIX_X
protected static final java.lang.String IMAGE_SUFFIX_X
- See Also:
- Constant Field Values
-
IMAGE_SUFFIX_Y
protected static final java.lang.String IMAGE_SUFFIX_Y
- See Also:
- Constant Field Values
-
POSITION_MARK
protected static final java.lang.String POSITION_MARK
- See Also:
- Constant Field Values
-
WILDCARD
protected static final java.lang.String WILDCARD
- See Also:
- Constant Field Values
-
-
Method Detail
-
processRequest
public boolean processRequest(RequestKeys keys) throws WebException
Description copied from class:GenericEventHandler
Logic to process the event. Specific event handler implementation extending this class will need to override the default behavior.- Specified by:
processRequest
in interfaceWebEventHandler
- Overrides:
processRequest
in classGenericEventHandler
- Parameters:
keys
- the RequestKeys object containing event ID, sources, and any other information.- Returns:
- true if handling succeeds; false if the event is ignored and not handled.
- Throws:
WebException
- thrown if handling of the request fails.
-
initUsingKeys
protected void initUsingKeys(RequestKeys keys)
Initialize the event handler using the request keys Sets up protected variables _keys, _event,_position- Parameters:
keys
- - the request keys
-
setSavedPromptAnswer
protected void setSavedPromptAnswer(WebPromptAnswer pa) throws WebObjectsException
- Throws:
WebObjectsException
-
handleCancelPrompt
protected boolean handleCancelPrompt()
Cancels the web prompt- Returns:
- - true if there is no exception
-
getValuesFromRequest
protected java.lang.String[] getValuesFromRequest(int arg, int index, java.lang.String delim)
Returns a string array containing values corresponding to the argument from the request keys collection.- Parameters:
arg
- - the argument id for the argumentindex
- - the position in the collectiondelim
- - the delimiter string. If the delimiter is specified, argument value is separated by the delimiter.- Returns:
- the string array of values
-
getIntValue
protected int getIntValue(java.lang.String str, java.lang.String msg) throws WebException
Returns the int value based on the String. If there is an error, throws a WebException with the error message.- Parameters:
str
- - String to parse.msg
- - Error message when there is a parsing error.- Returns:
- the parsed integer value from the string
- Throws:
WebException
- - when the String could not be converted to integer.
-
getAppendedIntValue
protected int getAppendedIntValue(java.lang.String str, int defVal)
Return the integer value from the string. If the string has a prefix, it removes the prefix and returns the appended integer value- Parameters:
str
- - the String to parsedefVal
- - the default value if the parsing fails- Returns:
- the integer value which is appended at the end of the string
-
getIntValue
protected int getIntValue(java.lang.String str, int defaultVal)
Returns the integer value from the string- Parameters:
str
- - the String to be parseddefaultVal
- - the default value to be returned if the parsing fails- Returns:
- - the integer value from the parsed string
-
getIncrementalFetchParameter
protected java.lang.String getIncrementalFetchParameter(int arg, int position)
Returns the incremental fetch parameter value. The value can be either a prefixed key or it could be just a value.- Parameters:
arg
- - int the event argument id.position
- - the position of the argument.- Returns:
- String the value for the parameter.
-
getAnswerFormat
protected int getAnswerFormat(int position) throws WebException
Returns the answer Format being used from the request keys- Parameters:
position
- the prompt position- Returns:
- int value from
EnumPromptAnswerFormat
- Throws:
WebException
- - if the answer format is unrecognized
-
getSessionInfo
protected WebSessionInfo getSessionInfo()
Returns theWebSessionInfo
object associated with the prompt This method throws anIllegalStateException
if the session is null.- Returns:
WebSessionInfo
object associated with the prompt
-
getObjectSource
protected WebObjectSource getObjectSource()
Returns theWebObjectSource
from theWebObjectsFactory
- Returns:
- the
WebObjectSource
from theWebObjectsFactory
-
applyLocalSettings
protected void applyLocalSettings(WebObjectSource wos)
Sets minimal flags on the WebObjectSource- Parameters:
wos
- -WebObjectSource
-
getObjectsFactory
protected WebObjectsFactory getObjectsFactory()
Returns theWebObjectsFactory
associated with the session.- Returns:
WebObjectsFactory
-
getObject
protected WebObjectInfo getObject(com.microstrategy.web.beans.AbstractPromptEventHandlerImpl.MdObject mObj) throws WebObjectsException
Returns theWebObjectInfo
associated with the MdObject- Parameters:
mObj
- - MdObject- Returns:
- the
WebObjectInfo
- Throws:
WebObjectsException
- if the object cannot be retrieved
-
checkClearAnswer
protected boolean checkClearAnswer(java.lang.String answer)
Based on the Prompt answer option and the answer string, this method calls clear prompt answer.- Parameters:
answer
- - answer for the prompt- Returns:
- true if the method is successful
-
setReuseOnPromptAnswer
protected void setReuseOnPromptAnswer(WebPromptAnswer pa, WebUserAnswers userAnswers)
-
getAnswerByID
protected WebPromptAnswer getAnswerByID()
-
getPromptAnswer
protected WebPromptAnswer getPromptAnswer()
-
savePromptAnswer
protected void savePromptAnswer() throws WebException
- Throws:
WebException
-
-