Results 1 to 3 of 3

Thread: Pass an object between flows

Hybrid View

  1. #1
    Join Date
    Mar 2010
    Location
    Germany
    Posts
    5

    Question 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. #2
    Join Date
    Nov 2006
    Location
    Boston, MA
    Posts
    303

    Default

    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.

  3. #3
    Join Date
    Mar 2010
    Location
    Germany
    Posts
    5

    Default

    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>
    ....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •