You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sk...@apache.org on 2008/07/25 15:50:02 UTC

svn commit: r679804 - /myfaces/orchestra/trunk/flow/src/main/java/org/apache/myfaces/orchestra/flow/FlowHandler.java

Author: skitching
Date: Fri Jul 25 06:50:02 2008
New Revision: 679804

URL: http://svn.apache.org/viewvc?rev=679804&view=rev
Log:
Add call to FlowNavigator.callFlow, to support flows in modal dialogs.
Add sanity check for presence of child contexts.

Modified:
    myfaces/orchestra/trunk/flow/src/main/java/org/apache/myfaces/orchestra/flow/FlowHandler.java

Modified: myfaces/orchestra/trunk/flow/src/main/java/org/apache/myfaces/orchestra/flow/FlowHandler.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/flow/src/main/java/org/apache/myfaces/orchestra/flow/FlowHandler.java?rev=679804&r1=679803&r2=679804&view=diff
==============================================================================
--- myfaces/orchestra/trunk/flow/src/main/java/org/apache/myfaces/orchestra/flow/FlowHandler.java (original)
+++ myfaces/orchestra/trunk/flow/src/main/java/org/apache/myfaces/orchestra/flow/FlowHandler.java Fri Jul 25 06:50:02 2008
@@ -215,6 +215,8 @@
 
             child.setAttribute("flowInfo", flowInfo);
             cm.activateConversationContext(child);
+
+            nav.callFlow(outcome);
         }
     }
 
@@ -346,6 +348,32 @@
             log.debug("processAccept: Error: invocation of flow without caller declaration");
             throw new OrchestraException("Invocation of flow without caller declaration");
         }
+        
+
+        if (isInFlow)
+        {
+            // We can safely fetch the current conversation context this without checking for
+            // nulls; flowInfo is non-null so they must exist.
+            ConversationManager cm = ConversationManager.getInstance();
+            ConversationContext context = cm.getCurrentConversationContext();
+
+            // Sanity check: verify that the current context has no children. If it
+            // does, then presumably someone has used a back button to go from a 
+            // nested flow to a parent flow. Possibly we could handle this by just
+            // discarding the children, but for now report an error.
+            //
+            // Note that the case of the user simply clicking a link that goes outside
+            // the current flow is handled in isAbnormalFlowExit; this is just for cases
+            // where the viewId and the contextId have changed together which should only
+            // happen for back-button or maybe bookmarks.
+            //
+            // Hmm..should we do this for any context, not just when isInFlow is true?
+            // Or should the orchestra core check for this? 
+            if (context.hasChildren())
+            {
+                throw new OrchestraException("Child flow not properly terminated.");
+            }
+        }
     }
 
     /**