For beans to be persisted to session variable, it needs to implement the BeanConverterInterface.
public class GenericBean
All public members of the GenericBean class, including all inherited members.
Name | Description |
---|---|
Sortable by the unique Id, or GB_ID. | |
Called to transform the session variable value back into this bean. | |
Domain bean needs to be converted to HashMap, and use this method to transform into this GenericBean. | |
Key for field 1 Used for the HashMap input parameter for the parse(HashMap) method. | |
Key for field 2 Used for the HashMap input parameter for the parse(HashMap) method. | |
Key for field 3 Used for the HashMap input parameter for the parse(HashMap) method. | |
Key for field 4 Used for the HashMap input parameter for the parse(HashMap) method. | |
Key for field 5 Used for the HashMap input parameter for the parse(HashMap) method. | |
Key for field 6 Used for the HashMap input parameter for the parse(HashMap) method. | |
Key for field 7 Used for the HashMap input parameter for the parse(HashMap) method. | |
Key for field 8 Used for the HashMap input parameter for the parse(HashMap) method. | |
Key for field 9 Used for the HashMap input parameter for the parse(HashMap) method. | |
Key for field 10 Used for the HashMap input parameter for the parse(HashMap) method. | |
Key for the Unique ID Used for the HashMap input parameter for the parse(HashMap) method. |
So typically, like in the dynamic SMS menu that extends the AbstractDynamicMenu, a helper bean that implements the BeanConverterInterface is created. The bean (i.e., domain bean) is transformed to the helper bean and then serialize.
When domain bean is simple, containing fields of String type only, this helper GenericBean can be used instead of creating a custom bean. This bean contains a unique ID field, and 10 (0..9) properties.
Simple example of how to store list of GenericBean into session variable:
List beanList = new ArrayList<GenericBean>(); for (DomainObject dObj: domainObjList) { // Convert domain object to HashMap HashMap<String, String> objMap = convertDomainObjToMap(dObj); beanList.add(GenericBean.parse(objMap)); } // Store the list into session variable SessionVariableAttribute SessionVariableAttribute session = new SessionVariableAttribute("SESSION_LIST", ""); session.setList(beanList); |
To retrieve the list from session variable and convert back to GenericBean:
List beanList = new ArrayList<GenericBean>(); // Session variable defined earlier beanList = session.getList(new GenericBean()); |
compareTo method
convert method
equals method
getAttrib0 method
getAttrib1 method
getAttrib2 method
getAttrib3 method
getAttrib4 method
getAttrib5 method
getAttrib6 method
getAttrib7 method
getAttrib8 method
getAttrib9 method
getId method
hashCode method
parse method
setAttrib0 method
setAttrib1 method
setAttrib2 method
setAttrib3 method
setAttrib4 method
setAttrib5 method
setAttrib6 method
setAttrib7 method
setAttrib8 method
setAttrib9 method
setId method
GB_ATTRIB0 variable
GB_ATTRIB1 variable
GB_ATTRIB2 variable
GB_ATTRIB3 variable
GB_ATTRIB4 variable
GB_ATTRIB5 variable
GB_ATTRIB6 variable
GB_ATTRIB7 variable
GB_ATTRIB8 variable
GB_ATTRIB9 variable
GB_ID variable
![]() |
Discuss this page in DocCommentXchange.
|
Copyright © 2012, Sybase, Inc. - Brand Mobiliser API 1.3.0 - October 24, 2012 |