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/11/07 16:18:26 UTC

svn commit: r712157 - in /myfaces/orchestra/trunk/flow/src/main/java/org/apache/myfaces/orchestra/flow: FlowHandler.java FlowInfo.java FlowNavigationHandler.java FlowPhaseTracker.java

Author: skitching
Date: Fri Nov  7 07:18:09 2008
New Revision: 712157

URL: http://svn.apache.org/viewvc?rev=712157&view=rev
Log:
Use java1.5 features

Modified:
    myfaces/orchestra/trunk/flow/src/main/java/org/apache/myfaces/orchestra/flow/FlowHandler.java
    myfaces/orchestra/trunk/flow/src/main/java/org/apache/myfaces/orchestra/flow/FlowInfo.java
    myfaces/orchestra/trunk/flow/src/main/java/org/apache/myfaces/orchestra/flow/FlowNavigationHandler.java
    myfaces/orchestra/trunk/flow/src/main/java/org/apache/myfaces/orchestra/flow/FlowPhaseTracker.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=712157&r1=712156&r2=712157&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 Nov  7 07:18:09 2008
@@ -21,7 +21,6 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -279,7 +278,7 @@
 
         // With the child conversationContext currently active, read
         // all the output parameters
-        Map map = flowInfo.getFlowAccept().readReturnParams(facesContext);
+        Map<String, Object> map = flowInfo.getFlowAccept().readReturnParams(facesContext);
 
         // Mark flowInfo as committed.
         flowInfo.commit(map);
@@ -417,7 +416,7 @@
             facesContext.getExternalContext().getRequestMap().remove(FlowConfig.CONFIG_KEY);
 
             // fetch parameters from caller into a map
-            Map data = flowCall.readSendParams(facesContext);
+            Map<String,Object> data = flowCall.readSendParams(facesContext);
 
             // Only when the triggering commandButton is immediate should we save the viewRoot.
             if (PhaseId.APPLY_REQUEST_VALUES == FlowPhaseTracker.getCurrentPhase())
@@ -605,7 +604,7 @@
         flowInfo.setAcceptInfo(newViewId, flowPath, flowAccept);
 
         // push parameters from caller to callee
-        Map argsIn = flowInfo.getArgsIn();
+        Map<String,Object> argsIn = flowInfo.getArgsIn();
         flowAccept.writeAcceptParams(facesContext, argsIn);
 
         ExternalContext externalContext = facesContext.getExternalContext();
@@ -676,7 +675,7 @@
     private static void setNewViewInfo(String viewId, String viewUrl)
     {
         FacesContext fc = FacesContext.getCurrentInstance();
-        Map reqMap = fc.getExternalContext().getRequestMap();
+        Map<String, Object> reqMap = fc.getExternalContext().getRequestMap();
         reqMap.put("orchestraFlowId", viewId);
         reqMap.put("orchestraFlowUrl", viewUrl);
     }
@@ -940,19 +939,17 @@
                 + "] does not match FlowAccept service [" + flowAccept.getService() + "]");
         }
 
-        List errors = new ArrayList();
+        List<String> errors = new ArrayList<String>();
 
         // check input params
-        List callParamNames = new ArrayList();
-        for(Iterator i = flowCall.getParams().iterator(); i.hasNext(); )
+        List<String> callParamNames = new ArrayList<String>();
+        for(FlowParamSend p : flowCall.getParams())
         {
-            FlowParamSend p = (FlowParamSend) i.next();
             callParamNames.add(p.getName());
         }
 
-        for(Iterator i = flowAccept.getParams().iterator(); i.hasNext(); )
+        for(FlowParamAccept p : flowAccept.getParams())
         {
-            FlowParamAccept p = (FlowParamAccept) i.next();
             String name = p.getName();
             if (!callParamNames.remove(name) && (p.getDflt() == null))
             {
@@ -972,16 +969,14 @@
         }
 
         // check return params
-        List returnParamNames = new ArrayList();
-        for(Iterator i = flowAccept.getReturns().iterator(); i.hasNext(); )
+        List<String> returnParamNames = new ArrayList<String>();
+        for(FlowReturnSend p : flowAccept.getReturns())
         {
-            FlowReturnSend p = (FlowReturnSend) i.next();
             returnParamNames.add(p.getName());
         }
 
-        for(Iterator i = flowCall.getReturns().iterator(); i.hasNext(); )
+        for(FlowReturnAccept p : flowCall.getReturns())
         {
-            FlowReturnAccept p = (FlowReturnAccept) i.next();
             String name = p.getName();
             if (!returnParamNames.remove(name))
             {

Modified: myfaces/orchestra/trunk/flow/src/main/java/org/apache/myfaces/orchestra/flow/FlowInfo.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/flow/src/main/java/org/apache/myfaces/orchestra/flow/FlowInfo.java?rev=712157&r1=712156&r2=712157&view=diff
==============================================================================
--- myfaces/orchestra/trunk/flow/src/main/java/org/apache/myfaces/orchestra/flow/FlowInfo.java (original)
+++ myfaces/orchestra/trunk/flow/src/main/java/org/apache/myfaces/orchestra/flow/FlowInfo.java Fri Nov  7 07:18:09 2008
@@ -47,10 +47,10 @@
     private FlowCall flowCall;
 
     // values being passed from caller to callee
-    private Map argsIn;
+    private Map<String,Object> argsIn;
 
     // values being returned from callee to caller
-    private Map argsOut;
+    private Map<String,Object> argsOut;
 
     // Javascript to render when closing a flow that was run as
     // a modal dialog.
@@ -94,7 +94,7 @@
             String callerViewId,
             UIViewRoot callerViewRoot,
             FlowCall flowCall,
-            Map argsIn)
+            Map<String, Object> argsIn)
     {
         this.callerOutcome = callerOutcome;
         this.callerViewId = callerViewId;
@@ -148,7 +148,7 @@
      * "restart"; note however that if any of these objects are mutable then
      * on restart the modified versions are passed to the called flow. 
      */
-    public Map getArgsIn()
+    public Map<String,Object> getArgsIn()
     {
         return argsIn;
     }
@@ -161,7 +161,7 @@
      * caller's view is restored. The return value is null until the
      * flow has committed. 
      */
-    public Map getArgsOut()
+    public Map<String, Object> getArgsOut()
     {
         return argsOut;
     }
@@ -241,7 +241,7 @@
         return state;
     }
     
-    public void commit(Map argsOut)
+    public void commit(Map<String, Object> argsOut)
     {
         this.argsOut = argsOut;
         state = STATE_COMMITTED;

Modified: myfaces/orchestra/trunk/flow/src/main/java/org/apache/myfaces/orchestra/flow/FlowNavigationHandler.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/flow/src/main/java/org/apache/myfaces/orchestra/flow/FlowNavigationHandler.java?rev=712157&r1=712156&r2=712157&view=diff
==============================================================================
--- myfaces/orchestra/trunk/flow/src/main/java/org/apache/myfaces/orchestra/flow/FlowNavigationHandler.java (original)
+++ myfaces/orchestra/trunk/flow/src/main/java/org/apache/myfaces/orchestra/flow/FlowNavigationHandler.java Fri Nov  7 07:18:09 2008
@@ -43,6 +43,7 @@
      * Ensure that the FlowHandler gets the chance to run after the navigation outcome has been
      * determined.
      */
+    @Override
     public void handleNavigation(FacesContext facesContext, String fromAction, String outcome)
     {
         // TODO: what about restoring state that is not in the view tree, eg FacesMessage objects

Modified: myfaces/orchestra/trunk/flow/src/main/java/org/apache/myfaces/orchestra/flow/FlowPhaseTracker.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/flow/src/main/java/org/apache/myfaces/orchestra/flow/FlowPhaseTracker.java?rev=712157&r1=712156&r2=712157&view=diff
==============================================================================
--- myfaces/orchestra/trunk/flow/src/main/java/org/apache/myfaces/orchestra/flow/FlowPhaseTracker.java (original)
+++ myfaces/orchestra/trunk/flow/src/main/java/org/apache/myfaces/orchestra/flow/FlowPhaseTracker.java Fri Nov  7 07:18:09 2008
@@ -47,7 +47,7 @@
 
     public void beforePhase(PhaseEvent event)
     {
-        Map reqScope = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
+        Map<String, Object> reqScope = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
         reqScope.put(PHASE_KEY, event.getPhaseId());
     }
 
@@ -57,7 +57,7 @@
 
     public static PhaseId getCurrentPhase()
     {
-        Map reqScope = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
+        Map<String, Object> reqScope = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
         PhaseId phaseId = (PhaseId) reqScope.get(PHASE_KEY);
         return phaseId;
     }