Announcement Announcement Module
No announcement yet.
Persisting conversations in SWF 1.0.5 Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Persisting conversations in SWF 1.0.5

    Hello everyone,

    I am currently working on a demo-project that include SWF 1.0.5. Using an example by Erwin Vervaet in 'Working with Spring Web Flow book' i have been able to persist users conversations (instances of a flow definition) on a database, but that seems to bring more considerations, like the one mentioned on thread 64381 of this forum:

    In one hand, you have an easy way to start a conversation, let the user go around the flow, pause his visit and resume it sometime later. But you know that a process can change in time, and if it can it will. So this brings another issue:

    What about versioning of the already persistent conversations, if a flow change, there could be users that paused their visit on one state, and probably that state does not exist anymore.

    There are some walkarounds to this issue, like catching the IllegalStateException launched when the state is not found, and then moving the user to the first state using a FlowExecutionExceptionHandler:

    	 * Selects a view used to communicate the exception to the user.
    	 * If this method return null, other exception handlers will still get a chance to handle the exception
    	public ViewSelection handle(FlowExecutionException exception,
    			RequestControlContext context) {
    		if (exception.getCause() instanceof IllegalStateException){
    			String message = exception.getCause().getMessage();
    			if (message.equalsIgnoreCase("Current state is not a view state - cannot refresh; perhaps an unhandled exception occured in another state?")){
    				System.out.println("<<<< This state is no longer available...");
    				System.out.println("Sending to an available state...");
    				ViewSelection view = ((ViewState)context.getActiveFlow().getStartState()).enter(context);
    				return view;
    		return null;
    This way we are keeping the user's already entered data, but this is not as clean as desired. Maybe someone have experienced this issue and could share his/her experience?.

    Thanks in advance!,