Abstract implementation of the dynamic menu state.
public class AbstractDynamicMenu
All public members of the AbstractDynamicMenu class, including all inherited members.
Name | Description |
---|---|
Current customer Customer of this session. | |
Return the input attributes specified by the state. | |
Get the instance name. | |
Return the output attributes specified by the state. | |
The state name is used for display on the state editor. | |
Notes on the default behaviour of the dynamic menu. | |
To indicate whether the state can be used as the follow-up state. | |
Default implementation is empty. | |
This method is called by the processing engine when the state is activated from external source, for example, incoming SMS message. | |
This method is always called by the processing engine when the state is activated by the follow-up transition. | |
Set the SMPP acknowledgement request flag for the current session. | |
Set the instance name. | |
No default implementation. | |
No default implementation. | |
Indicate whether this state support encryption. | |
Indicates if the state supports dynamic (Dyn) transition. | |
Support fail transition. | |
Indicate if the state supports transfer flow to another application. | |
Support OK transition. | |
Support Send SMS message textbox toggle. |
All package members of the AbstractDynamicMenu class, including all inherited members.
Name | Description |
---|---|
The state unique ID. |
All protected members of the AbstractDynamicMenu class, including all inherited members.
Name | Description |
---|---|
Return a list of menu item that will be used to construct the SMS menu message. | |
Helper method in state development. | |
Helper method in state development. | |
Helper method in state development. | |
When the menu contains a single item, the state will automatically proceed to the continueDyn(1) transition by default. | |
Provide subclasses the option to extend or override the default Page functionality. | |
Determine the follow-up transition that match the message in the state processing context. | |
Determine the follow-up transition that match the type provided in the input parameter. | |
Line break characters are used in the SMS menu message. | |
Maximum number of menu items to display or send as SMS menu message including the pagination "9: More" and "0: Exit" items. | |
Get the menu list. | |
Provide subclasses the option to set some default message options based on the current page before sending the message. | |
String showing: Menu index and description, for exit from the menu. | |
String showing: Menu index and description, for paging the menu, or pagination to the next page. | |
Index recognized by the algorithm for pagination to the next page. | |
Get the value of session attribute (SessionAttribute) based on the specified key. | |
Get session attributes for the current state in the current session. | |
Session ID that the application is running. | |
Process the SMS message by replacing all the session variables with the actual session variable value. | |
Return an array of Attribute specified in the subclass. | |
Returns the complete set of Attribute as specificed by this class and the subclass. | |
Helper method in state development. | |
Allow the subclass to perform all the necessary initialization including constructing the menu list. | |
Indicate whether the current state is encrypted. | |
Process incoming message. | |
Contains the actual processing logic for constructing the menu list. | |
Saving attributes that has holdValue (see OutputAttribute#getHoldValue()) in bulk for better performance. | |
Save the input parameters to the session attribute (SessionAttribute). | |
Save the session attributes in the Map of the current state in the current session to database. | |
This method is called after a selection is made from the menu, allowing the subclass to prepare the OutputAttributes (if needed) before transition to the follow-up state. | |
Send SMS from the current session. | |
Set a new menu list and save it into the session attribute. | |
Selection for whether to show the exit menu item. | |
Instance name. | |
Selected key. | |
Selected value. |
Typically extended by the states that needs to return a list of items. The list is sent to the mobile handset as Send SMS, and in the form of a menu, as shown on the following example.
Transactions: 1. 26 Jan 2012 09:16 - USD 10.00 Pay cab 2. 26 Jan 2012 10:10 - USD 3.45 Starbucks 3. 26 Jan 2012 12:25 - USD 20.00 Lunch 4. 26 Jan 2012 13:30 - USD 3.00 Starbucks 9: More 0: Exit |
The menu item can be selected by sending reply with the menu item number. Example, 1, 2, 3, or 4, to select the item; 9 will be shown when they are more items and selecting 9 will show them, 0 is for exiting from the menu and proceed to the alternative flow. Typically, when the menu item is selected, a more detailed information of the selected item will be sent as SMS.
If there are more items then those displayed, the paging menu item will be displayed. For the above example, it is "9: More". When 9 is sent back as the reply, the menu will refreshed showing the next page of the menu, and so on. The menu index is always starting from 1. When the menu reaches the end, and the 9 is sent back as a reply again, the menu will rotate back to the first page.
The state can be configured to show the exit menu item. In the above case, it's the "0: Exit". When 0 is sent back as a reply, nothing is selected so the state will continue the transition that is associated with the dynamic "EXIT" value. In some application flows, when a selection is required, the exit menu item can be suppressed by setting "No" to the "Show Exit menu" drop down box in the state editor.
Three Attribute are automatically registered by this class, including:
SelectionBoxAttribute - to specify whether to Show Exit menu item
OutputAttribute - to specify the variable name to store the selected menu KEY
OutputAttribute - to specify the variable name to store the selected menu VALUE
The life cycle of AbstractDynamicMenu is based on the life cycle of the SmappStatePlugin and StatePlugin with the following customizations to meet the menu functionalities.
AbstractDynamicMenu is just an abstract implementation of a state that can Send SMS in the form menu. The subclass provides implementation of getting the list for the menu. The processMessageLogic(SmappStateProcessingContext) and processStateLogic(SmappStateProcessingContext, SmappStateProcessingAction) methods have been final because they have the implementation for the menu functionalities. The subclass need to implement the following abstract methods instead: init(SmappStateProcessingAction), constructMenuList(), getStateAttributeList(), and saveSessionVariables(String, String).
init(SmappStateProcessingAction) method will be called by the processStateLogic(SmappStateProcessingContext, SmappStateProcessingAction).Please refer to the method description for details.
constructMenuList() and saveSessionVariables(String, String) methods will be called by both the processMessageLogic(SmappStateProcessingContext) and processStateLogic(SmappStateProcessingContext, SmappStateProcessingAction) methods.Please refer to the method description for details.
getStateAttributeList() is called from the getStateAttributes() that will aggregate the attributes returned by the getStateAttributeList() with some attributes defined in this abstract class for the menu, such as the input attribute for specifying whether to show the exit menu item, the output attributes for the key and value of the selected menu item.
The AbstractDynamicMenu state will initially be activated by the follow-up transition from a previous state, so the processing engine will call the processStateLogic(SmappStateProcessingContext, SmappStateProcessingAction) method. The init and constructMenuList method will be called sequentially to initialize and construct the menu. Eventually the menu will be sent out as SMS message, and the processing engine will be set to action.waitForMessage() waiting for the reply message. In this case, the user selects a menu item.
In the special case when the constructMenuList returns a single item only, the state will immediately call the saveSessionVariables(String, String) method proceed with the the default continueDyn(1) follow-up transition. The state can customized the default behavior by overriding the continueWhenSingleEntry(SmappState) method.
When the reply message arrives, the processing engine will trigger the AbstractDynamicMenu state using the external activation, hence calling the processMessageLogic(SmappStateProcessingContext) method.The constructMenuList method will be called again to assemble the menu that will be used to interpret the user selected menu index. If the selection is one of the valid menu item, saveSessionVariables(String, String) method will be called allowing the state to prepare all the select item details for output, and proceed with the follow-up transition as returned by the saveSessionVariables method. If null is null, the default OK follow-up transition will be used.
constructMenuList method
continueWhenSingleEntry method
createPage method
getLineBreak method
getMaxMenuItems method
getMenuListFromSession method
getMessageOptions method
getPaginationExit method
getPaginationNext method
getPaginationNextIndex method
getStateAttributeList method
getStateAttributes method
getStateNotes method
init method
processMessageLogic method
processStateLogic method
saveSessionVariables method
setMenuListToSession method
supportsFailTransition method
supportsOkTransition method
supportsSendSmsMessage method
inShowExitMenu variable
outKey variable
outValue variable
![]() |
Discuss this page in DocCommentXchange.
|
Copyright © 2012, Sybase, Inc. - Brand Mobiliser API 1.3.0 - October 24, 2012 |