You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2013/02/20 21:39:14 UTC

svn commit: r1448385 - in /myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/application: Application.java ConfigurableNavigationHandler.java ConfigurableNavigationHandlerWrapper.java NavigationHandler.java NavigationHandlerWrapper.java

Author: lu4242
Date: Wed Feb 20 20:39:14 2013
New Revision: 1448385

URL: http://svn.apache.org/r1448385
Log:
MYFACES-3691 Implement Faces Flows (add methods to Application and NavigationHandler)

Added:
    myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/application/ConfigurableNavigationHandlerWrapper.java   (with props)
    myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/application/NavigationHandlerWrapper.java   (with props)
Modified:
    myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/application/Application.java
    myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/application/ConfigurableNavigationHandler.java
    myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/application/NavigationHandler.java

Modified: myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/application/Application.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/application/Application.java?rev=1448385&r1=1448384&r2=1448385&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/application/Application.java (original)
+++ myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/application/Application.java Wed Feb 20 20:39:14 2013
@@ -44,6 +44,7 @@ import javax.faces.el.VariableResolver;
 import javax.faces.event.ActionListener;
 import javax.faces.event.SystemEvent;
 import javax.faces.event.SystemEventListener;
+import javax.faces.flow.FlowHandler;
 import javax.faces.validator.Validator;
 
 /**
@@ -1224,4 +1225,34 @@ public abstract class Application
         }
         unsubscribeFromEvent(systemEventClass, null, listener);
     }
+    
+    /**
+     * @since 2.2
+     * @return 
+     */
+    public FlowHandler getFlowHandler()
+    {
+        Application application = getMyfacesApplicationInstance();
+        if (application != null)
+        {
+            return application.getFlowHandler();
+        }
+        throw new UnsupportedOperationException();
+    }
+    
+    /**
+     * @since 2.2
+     * @param newHandler 
+     */
+    public void setFlowHandler(FlowHandler flowHandler)
+    {
+        Application application = getMyfacesApplicationInstance();
+        if (application != null)
+        {
+            application.setFlowHandler(flowHandler);
+            return;
+        }
+        throw new UnsupportedOperationException();
+
+    }
 }

Modified: myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/application/ConfigurableNavigationHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/application/ConfigurableNavigationHandler.java?rev=1448385&r1=1448384&r2=1448385&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/application/ConfigurableNavigationHandler.java (original)
+++ myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/application/ConfigurableNavigationHandler.java Wed Feb 20 20:39:14 2013
@@ -22,6 +22,7 @@ import java.util.Map;
 import java.util.Set;
 
 import javax.faces.context.FacesContext;
+import javax.faces.flow.Flow;
 
 /**
  * @author Simon Lessard (latest modification by $Author$)
@@ -47,4 +48,13 @@ public abstract class ConfigurableNaviga
     {
         handleNavigation(FacesContext.getCurrentInstance(), null, outcome);
     }
+    
+    /**
+     * @since 2.2
+     * @param context
+     * @param flow 
+     */
+    public void inspectFlow(FacesContext context, Flow flow)
+    {
+    }
 }

Added: myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/application/ConfigurableNavigationHandlerWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/application/ConfigurableNavigationHandlerWrapper.java?rev=1448385&view=auto
==============================================================================
--- myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/application/ConfigurableNavigationHandlerWrapper.java (added)
+++ myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/application/ConfigurableNavigationHandlerWrapper.java Wed Feb 20 20:39:14 2013
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package javax.faces.application;
+
+import java.util.Map;
+import java.util.Set;
+import javax.faces.FacesWrapper;
+import javax.faces.context.FacesContext;
+import javax.faces.flow.Flow;
+
+/**
+ *
+ * @since 2.2
+ */
+public abstract class ConfigurableNavigationHandlerWrapper extends ConfigurableNavigationHandler
+    implements FacesWrapper<ConfigurableNavigationHandler>
+{
+
+    @Override
+    public NavigationCase getNavigationCase(FacesContext context, String fromAction, String outcome)
+    {
+        return getWrapped().getNavigationCase(context, fromAction, outcome);
+    }
+
+    @Override
+    public Map<String, Set<NavigationCase>> getNavigationCases()
+    {
+        return getWrapped().getNavigationCases();
+    }
+
+    @Override
+    public void handleNavigation(FacesContext context, String fromAction, String outcome)
+    {
+        getWrapped().handleNavigation(context, fromAction, outcome);
+    }
+
+    @Override
+    public void performNavigation(String outcome)
+    {
+        getWrapped().performNavigation(outcome);
+    }
+
+    @Override
+    public void inspectFlow(FacesContext context, Flow flow)
+    {
+        getWrapped().inspectFlow(context, flow);
+    }
+
+    @Override
+    public void handleNavigation(FacesContext context, String fromAction, String outcome, String toFlowDocumentId)
+    {
+        getWrapped().handleNavigation(context, fromAction, outcome, toFlowDocumentId);
+    }
+
+    public abstract ConfigurableNavigationHandler getWrapped();
+}

Propchange: myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/application/ConfigurableNavigationHandlerWrapper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/application/NavigationHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/application/NavigationHandler.java?rev=1448385&r1=1448384&r2=1448385&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/application/NavigationHandler.java (original)
+++ myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/application/NavigationHandler.java Wed Feb 20 20:39:14 2013
@@ -31,4 +31,18 @@ public abstract class NavigationHandler
     public abstract void handleNavigation(FacesContext context,
                                           String fromAction,
                                           String outcome);
+    
+    /**
+     * @since 2.2
+     * @param context
+     * @param fromAction
+     * @param outcome
+     * @param toFlowDocumentId 
+     */
+    public void handleNavigation(FacesContext context,
+                                 String fromAction,
+                                 String outcome,
+                                 String toFlowDocumentId)
+    {
+    }
 }

Added: myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/application/NavigationHandlerWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/application/NavigationHandlerWrapper.java?rev=1448385&view=auto
==============================================================================
--- myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/application/NavigationHandlerWrapper.java (added)
+++ myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/application/NavigationHandlerWrapper.java Wed Feb 20 20:39:14 2013
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package javax.faces.application;
+
+import javax.faces.FacesWrapper;
+import javax.faces.context.FacesContext;
+
+/**
+ *
+ * @since 2.2
+ */
+public abstract class NavigationHandlerWrapper extends NavigationHandler
+    implements FacesWrapper<NavigationHandler>
+{
+
+    @Override
+    public void handleNavigation(FacesContext context, String fromAction, String outcome)
+    {
+        getWrapped().handleNavigation(context, fromAction, outcome);
+    }
+    
+    @Override
+    public void handleNavigation(FacesContext context,
+                                 String fromAction,
+                                 String outcome,
+                                 String toFlowDocumentId)
+    {
+        getWrapped().handleNavigation(context, fromAction, outcome, toFlowDocumentId);
+    }
+    
+    public abstract NavigationHandler getWrapped();
+}

Propchange: myfaces/core/branches/2.2.x/api/src/main/java/javax/faces/application/NavigationHandlerWrapper.java
------------------------------------------------------------------------------
    svn:eol-style = native