Announcement Announcement Module
Collapse
No announcement yet.
Session variables, int and Object types Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Session variables, int and Object types

    Hi,

    I'm going to save my entity ID into the session in one of action states:
    <on-exit>
    <evaluate expression="persistantService.saveOrUpdate(flowSco pe.entity)"/>
    <evaluate expression="externalContext.sessionMap.put('entity Id', flowScope.entity.Id)"/>
    </on-exit>
    Actually, entity.Id field - is int.

    On the start of the flow i'm trying to get entityId from the session, if it exists, load it from storage, else - create new one. Here how I suppose to do it:
    <decision-state id="test">
    <if test="externalContext.sessionMap.contains('entityI d')"
    then="findExistingEntity"
    else="creteNewEntity"/>
    </decision-state>
    <action-state id="findExistingEntity">
    <evaluate expression="persistantService.findEntityById(exter nalContext.sessionMap.entityId)"
    result="flowScope.entity" />
    </action-state>
    PS: for some reasons I can see that there is a space in variables names when preview this post, but actually it does not exist. The "flowScope.entity" - the full name that is used to pass data between states.

    The problem is that persistantService.findEntityById accepts int, but not Object or Integer that are taken from session.
    How can I resolve it? How can I convert externalContext.sessionMap.entityId to int?
    Or probably there is another way, to test that entity is saved and load it from persistant storage?
Working...
X