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

  • Session variables, int and Object types


    I'm going to save my entity ID into the session in one of action states:
    <evaluate expression="persistantService.saveOrUpdate(flowSco pe.entity)"/>
    <evaluate expression="externalContext.sessionMap.put('entity Id', flowScope.entity.Id)"/>
    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')"
    <action-state id="findExistingEntity">
    <evaluate expression="persistantService.findEntityById(exter nalContext.sessionMap.entityId)"
    result="flowScope.entity" />
    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?