Announcement Announcement Module
Collapse
No announcement yet.
How to tell when you are leaving the flow without calling going to an end-state Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to tell when you are leaving the flow without calling going to an end-state

    I have a few flows and want to be able to tell when the user navigates to another flow so that I can save their information from the flow they just left.

    I tried this:
    Code:
    <end-actions>
    	<action bean="formAction" method="saveInfo" />
    </end-actions>
    This only seems to get called when an event causes the user to go to an end-state. Is there any way to tell if the user is simply leaving a flow without entering an end-state?

  • #2
    Is there any way to tell if the user is simply leaving a flow without entering an end-state?
    you leave your flow in the end-state

    maybe in your actions classes you can create a message variable to be displayed in the next view with a desired value

    just in the bold part
    Code:
    <end-actions>
    	<action bean="formAction" method="saveInfo" />
    </end-actions>

    regards

    Comment


    • #3
      First off, thanks for your response...

      Originally posted by dr_pompeii View Post
      you leave your flow in the end-state
      maybe in your actions classes you can create a message variable to be displayed in the next view with a desired value

      just in the bold part
      Code:
      <end-actions>
      	<action bean="formAction" method="saveInfo" />
      </end-actions>

      regards
      I am not sure I understand what you mean? Please explain. I am in the middle of a flow when the user clicks on a link that takes them to a new (different too) flow. Can I only do this with a listener? Seems like an "<exit-flow>" event would be useful in this case.

      Comment


      • #4
        hi testing123

        I am in the middle of a flow when the user clicks on a link that takes them to a new (different too) flow.
        it seems a case for subflows, remember that any flow can be another subflow for other flow

        again this link that you said show load or show a view or jsp right?, of course after of the render-actions

        so before of exit of your previous state(view) (transition) you can save and load some information for the next view

        HTH

        regards

        Comment


        • #5
          testing123,

          Maybe you should put the maxConversations property of conversationManager to 1. (See Erwin's excellent tip at http://www.ervacon.com/products/swf/tips/tip2.html). This should terminate old flow (conversation) when you start new one. But you still have the problem of attaching some kind of listener, so your flows will respond to conversation being ended. I'm currently unable to look this up for you, so you'll have to read the docs or wait for somebody smarter to come along and give you a tip

          Regards,
          Igor.

          Comment


          • #6
            maybe I need a container flow

            Thanks again for your response.

            Originally posted by dr_pompeii View Post
            it seems a case for subflows, remember that any flow can be another subflow for other flow
            Not really because they are two entirely different flows. For example one flow fills out information so that it can be calculated. The other flow is a search for calculations. Let's say they are filling out a some info then decide to just search for an old one that was similar. When the finish the search I do not want them in the middle of the enter info flow. They are separate. I guess I could have one large containing flow that has subflows for all the current flows that I have. Is that normal?

            Originally posted by dr_pompeii View Post
            so before of exit of your previous state(view) (transition) you can save and load some information for the next view
            Lets say I have the container flow like I spoke of before. I am in the enter information subflow, then the click the search link. How do you jump from one subflow to another subflow? Do I need to make a bunch of end-states that take them back to the container flow and then some how(not sure how to do this) direct them to the new flow?

            Comment


            • #7
              Originally posted by imilina View Post
              But you still have the problem of attaching some kind of listener, so your flows will respond to conversation being ended.
              Exactly, so it doesn't really buy me anything. Besides I need at least two conversations running at the same time. Thanks for the response.

              Comment


              • #8
                I guess I'll just use an end-state

                I guess I will just add an end-state so that when the search link is pressed it will end the flow and call my end-actions, then I will call a flowRedirect:mysearchflow. I was hoping there was some way to tell when you started executing a new flow. Thanks for all your help!

                Comment


                • #9
                  Originally posted by testing123 View Post
                  I guess I will just add an end-state so that when the search link is pressed it will end the flow and call my end-actions, then I will call a flowRedirect:mysearchflow.
                  That should work.
                  Originally posted by testing123 View Post
                  I was hoping there was some way to tell when you started executing a new flow.
                  Well, there is - the FlowExecutionListener has the methods which you can use to listen and respond to the lifecycle of flow executions, but I'm not sure that they're suitable for your use case.

                  First, simply starting a new flow (via link) will not end your current flow - unless you use maxConversations property as I mentioned earlier.

                  Second, even if starting a new flow does end your current flow, and you implement flow execution listener - you will find yourself writing your application (and possibly business) logic burried inside listener, which is IMHO certainly not a good idea; listeners should be used for cross cutting behaviour, not business logic. And besides, just by looking at your xml flow definition you cannot see which listener(s) apply to that particular flow.

                  Regards,
                  Igor.

                  Comment

                  Working...
                  X