-
Feb 16th, 2011, 10:50 AM
#1
FlowExecutionListener - how to intercept and redirect user
What is the right way to intercept a flow and redirect the user to a different state?
I assume I will want to use FlowExecutionListener. I'd like to be able to signal a new event, regardless of what the user was doing. This looks like I want to use the resuming() method but I'm not sure how to signal an event when I just have a handle on the requestContext.
The scenario is, we have a large flow that is manipulating a particular object. This object has its own internal state that we manage as the user goes through the flow. It is possible for the internal state of this object to be changed outside of the flow, by a different process. We need to be able to detect this change, and redirect the flow user (I assume signal a new event) to a different flow state.
Thanks.
-
Feb 24th, 2011, 11:14 AM
#2
Here is what I ended up doing, for future readers (and for anyone who has suggestions):
In the pausing() method of my FlowExecutionListener, I examine the object and store the status on a flow scoped attribute.
In the resuming() method, I compare the status of the object with the value stored in flowScope -- if they are different an exception is thrown.
In my flow I defined a global transition to handle this exception, which redirects the user to the appropriate state based on the status change.
-
Oct 27th, 2011, 08:06 AM
#3
Hi,
your solution is cunning but a hack. I was wondering if someone else has figured out a more standard way of solving this problem in the meantime?
Cheers,
Michael
-
Jan 28th, 2013, 10:17 PM
#4
Hack or not, I think I need this same capability and found your example working for me too. To my surprise, though, throwing an Exception (necessarily an unchecked Exception, no?) from the requestSubmitted() method did not get handled by my on-exception clause, while doing it from the resume() method did. Something to do with in which part of the Post-Redirect-Get cycle those methods are called?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules