Announcement Announcement Module
Collapse
No announcement yet.
Pass an object between flows Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Pass an object between flows

    Hello everybody!

    I really new in spring stuff and I have a problem like in the this thread: http://forum.springsource.org/showthread.php?t=85654

    In my case, I wanna pass an object (POJO) between different flows by using the input and output tags. I tested it so far and read some other thinks in the net. It seems that it does not work for normal flow except between a flow and it sub-flows. Is this correct?

    What is the best practice to do this?

    (Maybe, I took an object that is annotated by @Component and @SessionAttributes and put all my data into it, so that I access with all the other flows. Maybe this is not good in the point of view of a flow.)


    ~Chris

  • #2
    An obvious way to do what you are trying to do would be to place your object into the session upon the completion of the flow. Whenever the other flow starts (and it doesn't have to be redirected to immediately) it could query the session for that attribute. Something like that.

    Comment


    • #3
      Thank you! It works fine now.

      I created a Container Class:
      ##############################
      @Repository
      @SessionAttributes
      public class Container implements Serializable {

      private static final long serialVersionUID = 4267043106253030222L;

      private Table maintable;

      public Table getMaintable() {
      return maintable;
      }

      public void setMaintable(Table maintable) {
      this.maintable = maintable;
      }

      }

      ###################################
      And get this object on start of every workflow

      .....
      <on-start>
      <set name="flowScope.catalogueTable" value="CatalogueService.catalogueTable" />
      <evaluate expression="CatalogueService.createSearchTable()"
      result="flowScope.searchtable" />
      <evaluate expression="container.getMaintable()" result="flowScope.maintable" />
      </on-start>
      ....

      Comment

      Working...
      X