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/08/30 04:40:15 UTC
svn commit: r1518884 - in
/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces:
application/NavigationHandlerImpl.java flow/FlowHandlerImpl.java
flow/_FlowContextualInfo.java
Author: lu4242
Date: Fri Aug 30 02:40:14 2013
New Revision: 1518884
URL: http://svn.apache.org/r1518884
Log:
MYFACES-3764 Implement FlowHandler.getLastDisplayedViewId(FacesContext context) logic
Modified:
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/NavigationHandlerImpl.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/flow/FlowHandlerImpl.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/flow/_FlowContextualInfo.java
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/NavigationHandlerImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/NavigationHandlerImpl.java?rev=1518884&r1=1518883&r2=1518884&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/NavigationHandlerImpl.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/NavigationHandlerImpl.java Fri Aug 30 02:40:14 2013
@@ -391,6 +391,25 @@ public class NavigationHandlerImpl
return navigationCase;
}
+ private Flow calculateTargetFlow(FacesContext facesContext, String outcome,
+ FlowHandler flowHandler, Flow currentFlow, String toFlowDocumentId)
+ {
+ Flow targetFlow = null;
+ if (toFlowDocumentId != null)
+ {
+ targetFlow = flowHandler.getFlow(facesContext, toFlowDocumentId, outcome);
+ }
+ if (targetFlow == null && currentFlow != null)
+ {
+ targetFlow = flowHandler.getFlow(facesContext, currentFlow.getDefiningDocumentId(), outcome);
+ }
+ if (targetFlow == null)
+ {
+ targetFlow = flowHandler.getFlow(facesContext, "", outcome);
+ }
+ return targetFlow;
+ }
+
public NavigationCase getNavigationCommand(
FacesContext facesContext, NavigationContext navigationContext, String fromAction, String outcome,
String toFlowDocumentId)
@@ -405,20 +424,9 @@ public class NavigationHandlerImpl
Flow currentFlow = navigationContext.getCurrentFlow(facesContext);
// JSF 2.2 section 7.4.2: "... When outside of a flow, view identifier
// has the additional possibility of being a flow id.
- Flow targetFlow = null;
+ Flow targetFlow = calculateTargetFlow(facesContext, outcome, flowHandler, currentFlow, toFlowDocumentId);
FlowCallNode targetFlowCallNode = null;
- if (toFlowDocumentId != null)
- {
- targetFlow = flowHandler.getFlow(facesContext, toFlowDocumentId, outcome);
- }
- if (targetFlow == null && currentFlow != null)
- {
- targetFlow = flowHandler.getFlow(facesContext, currentFlow.getDefiningDocumentId(), outcome);
- }
- if (targetFlow == null)
- {
- targetFlow = flowHandler.getFlow(facesContext, "", outcome);
- }
+
boolean startFlow = false;
boolean checkFlowNode = false;
if (currentFlow != null)
@@ -542,8 +550,7 @@ public class NavigationHandlerImpl
flowCallNode.getCalledFlowId(facesContext));
if (targetFlow == null && !"".equals(calledFlowDocumentId))
{
- targetFlow = flowHandler.getFlow(facesContext,
- "",
+ targetFlow = flowHandler.getFlow(facesContext, "",
flowCallNode.getCalledFlowId(facesContext));
}
if (targetFlow != null)
@@ -611,10 +618,10 @@ public class NavigationHandlerImpl
navigationContext.addTargetFlow(currentFlow, null);
outcomeToGo = fromOutcome;
// The part where FlowHandler.NULL_FLOW is passed as documentId causes the effect of
- // do not take into account the documentId of the returned flow in the command. In theory
- // there is no Flow with defining documentId as FlowHandler.NULL_FLOW. It has sense
- // because the one who specify the return rules should be the current flow after it is
- // returned.
+ // do not take into account the documentId of the returned flow in the command. In
+ // theory there is no Flow with defining documentId as FlowHandler.NULL_FLOW. It has
+ // sense because the one who specify the return rules should be the current flow
+ // after it is returned.
navigationCase = getNavigationCommand(facesContext,
navigationContext, actionToGo, outcomeToGo, FlowHandler.NULL_FLOW);
if (navigationCase != null)
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/flow/FlowHandlerImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/flow/FlowHandlerImpl.java?rev=1518884&r1=1518883&r2=1518884&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/flow/FlowHandlerImpl.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/flow/FlowHandlerImpl.java Fri Aug 30 02:40:14 2013
@@ -19,7 +19,6 @@
package org.apache.myfaces.flow;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -254,7 +253,8 @@ public class FlowHandlerImpl extends Flo
// sourceFlow should match.
FlowReference sourceFlowReference = new FlowReference(
sourceFlow.getDefiningDocumentId(), sourceFlow.getId());
- if ( sourceFlowReference.equals(currentFlowStack.get(currentFlowStack.size()-1).getFlowReference()) )
+ if ( sourceFlowReference.equals(
+ currentFlowStack.get(currentFlowStack.size()-1).getFlowReference()) )
{
Map<String, Object> outboundParameters = doBeforeEnterFlow(context,
targetFlow, !outboundCallNodeProcessed ? outboundCallNode : null);
@@ -538,7 +538,8 @@ public class FlowHandlerImpl extends Flo
context.getAttributes().put(RETURN_MODE, Boolean.TRUE);
}
- _FlowContextualInfo flowReference = popFlowReferenceReturnMode(context, clientWindow, CURRENT_FLOW_REQUEST_STACK);
+ _FlowContextualInfo flowReference = popFlowReferenceReturnMode(context,
+ clientWindow, CURRENT_FLOW_REQUEST_STACK);
pushFlowReferenceReturnMode(context, clientWindow, FLOW_RETURN_STACK, flowReference);
}
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/flow/_FlowContextualInfo.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/flow/_FlowContextualInfo.java?rev=1518884&r1=1518883&r2=1518884&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/flow/_FlowContextualInfo.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/flow/_FlowContextualInfo.java Fri Aug 30 02:40:14 2013
@@ -62,11 +62,13 @@ class _FlowContextualInfo implements Ser
return false;
}
final _FlowContextualInfo other = (_FlowContextualInfo) obj;
- if (this.flowReference != other.flowReference && (this.flowReference == null || !this.flowReference.equals(other.flowReference)))
+ if (this.flowReference != other.flowReference && (this.flowReference == null ||
+ !this.flowReference.equals(other.flowReference)))
{
return false;
}
- if ((this.lastDisplayedViewId == null) ? (other.lastDisplayedViewId != null) : !this.lastDisplayedViewId.equals(other.lastDisplayedViewId))
+ if ((this.lastDisplayedViewId == null) ? (other.lastDisplayedViewId != null) :
+ !this.lastDisplayedViewId.equals(other.lastDisplayedViewId))
{
return false;
}