List Variables

List variables do not appear in the state editor. You can use list variables to save lists of the BeanConverterInterface type to session variables.

As an example, the AbstractDynamicMenu class uses a list variable to persist an SMS menu. The BeanConverterInterface specifies that a bean must provide string serialization and deserialization logic. Each BeanConverterInterface item is saved as a session variable with a unique name.

package com.sybase365.mobiliser.brand.plugins.smapp.beans;   
public interface BeanConverterInterface<T> {     
  T convert(String value);     
  String convert(T object);   
} 
Note: Strings returned by the convert(T object) method must be less than 1000 characters.

The SessionVariableAttribute class has two methods: getList and setList. The getList method retrieves a list from the database. When setList is called, the list is saved to a session variable, which requires a database connection.

Note: Lists are saved outside of transactions. Therefore, if an exception occurs, the method throws a DBException, and a partial list may be saved. It is up to the state implementation that uses this attribute to retry.

Most state implementations do not need list variables. They are needed only if a state can transition into an internal waiting condition by calling waitForMessage. For example, list variables are most commonly used when sending SMS messages. Calling waitForMessage causes the application to hibernate until the response arrives. The list variable is saved to a session variable, so it is available when the application is reactivated.

Related concepts
Input and Output Parameters
Custom State Variables
Defining Input Variables
Defining Output Variables
Accessing Input Variables
Extending the AbstractDynamicMenu Class