jsr344-experts@javaserverfaces-spec-public.java.net

[jsr344-experts] Re: [730-Flows] Return node handling

From: Edward Burns <edward.burns_at_oracle.com>
Date: Sat, 16 Mar 2013 09:41:34 -0700

>>>>> On Fri, 15 Mar 2013 20:16:06 -0700, Edward Burns <edward.burns_at_oracle.com> said:

>>>>> On Tue, 12 Mar 2013 22:50:55 -0500, Leonardo Uribe <lu4242_at_gmail.com> said:
LU> Unfortunately, the solution proposed is limited to work in just 1 or
LU> 2 nesting levels, because structurally it can't deal with the
LU> problem. Why? because the outer flow has its own navigation rules
LU> and the algorithm should detect that and apply the algorithm using
LU> those rules and so on to the top.

EB> Thanks for playing this out so explicitly. I'm going to code up your
EB> example and see what I can come up with.

SECTION: API changes
--------------------
M jsf-api/src/main/java/javax/faces/flow/FlowHandler.java
M applicationIntegration.fm

Leonardo brought up a very good point. The current system of using a
boolean to represent return mode only works when there are only two
levels of returning. Instead of using a boolean to represent return
mode, use an integer that is incremented and decremented as necessary.
This allows us to continue to hide the stack inside the FlowHandler,
which I think is very desirable.

- remove setReturnMode(boolean)

- replace it with:

    /**
     * <p class="changed_added_2_2">Enable the correct handling of navigation
     * when processing a return node. The default {_at_link javax.faces.application.NavigationHandler}
     * specification requires calling this method before processing
     * the navigation rules for the flow return, and calling {_at_link #popReturnMode},
     * from a {_at_code finally} block, immediately afterward.</p>
     *
     * @param context the {_at_code FacesContext} for the current request.

     * @param returnMode the return mode for the current flow.
     *
     * @throws NullPointerException if {_at_code context} is {_at_code null}.
     *
     * @since 2.2
     */
    
    public abstract void pushReturnMode(FacesContext context);

    /**
     * <p class="changed_added_2_2">Enable the correct handling of navigation
     * when processing a return node. The default {_at_link javax.faces.application.NavigationHandler}
     * specification requires calling this method from a {_at_code finally} block,
     * immediately attempting to process the navigation rules in the context
     * of a flow return.</p>
     *
     * @param context the {_at_code FacesContext} for the current request.

     * @param returnMode the return mode for the current flow.
     *
     * @throws NullPointerException if {_at_code context} is {_at_code null}.
     *
     * @since 2.2
     */
    
    public abstract void popReturnMode(FacesContext context);

SECTION: Modified Files
----------------------------
M jsf-ri/src/main/java/com/sun/faces/application/NavigationHandlerImpl.java
M jsf-ri/src/main/java/com/sun/faces/flow/builder/FlowCallBuilderImpl.java
M jsf-ri/src/main/java/com/sun/faces/flow/FlowHandlerImpl.java

- Account for the changes.

SECTION: Test content
---------------------

A test/web-profile/flow/nested_flows
A test/web-profile/flow/nested_flows/nbactions.xml
A test/web-profile/flow/nested_flows/src
A test/web-profile/flow/nested_flows/src/test
A test/web-profile/flow/nested_flows/src/test/java
A test/web-profile/flow/nested_flows/src/test/java/com
A test/web-profile/flow/nested_flows/src/test/java/com/sun
A test/web-profile/flow/nested_flows/src/test/java/com/sun/faces
A test/web-profile/flow/nested_flows/src/test/java/com/sun/faces/test
A test/web-profile/flow/nested_flows/src/test/java/com/sun/faces/test/webprofile
A test/web-profile/flow/nested_flows/src/test/java/com/sun/faces/test/webprofile/flow
A test/web-profile/flow/nested_flows/src/test/java/com/sun/faces/test/webprofile/flow/basic_faces_flow_call
A test/web-profile/flow/nested_flows/src/test/java/com/sun/faces/test/webprofile/flow/nested_flows
A test/web-profile/flow/nested_flows/src/test/java/com/sun/faces/test/webprofile/flow/nested_flows/NestedFlowsIT.java
A test/web-profile/flow/nested_flows/src/main
A test/web-profile/flow/nested_flows/src/main/java
A test/web-profile/flow/nested_flows/src/main/resources
A test/web-profile/flow/nested_flows/src/main/webapp
A test/web-profile/flow/nested_flows/src/main/webapp/index.xhtml
A test/web-profile/flow/nested_flows/src/main/webapp/WEB-INF
A test/web-profile/flow/nested_flows/src/main/webapp/WEB-INF/faces-config.xml
A test/web-profile/flow/nested_flows/src/main/webapp/WEB-INF/beans.xml
A test/web-profile/flow/nested_flows/src/main/webapp/WEB-INF/web.xml
A test/web-profile/flow/nested_flows/src/main/webapp/WEB-INF/glassfish-web.xml
A test/web-profile/flow/nested_flows/src/main/webapp/flow1
A test/web-profile/flow/nested_flows/src/main/webapp/flow1/flow1.xhtml
A test/web-profile/flow/nested_flows/src/main/webapp/flow1/return2.xhtml
A test/web-profile/flow/nested_flows/src/main/webapp/flow2
A test/web-profile/flow/nested_flows/src/main/webapp/flow2/flow2.xhtml
A test/web-profile/flow/nested_flows/src/main/webapp/flow3
A test/web-profile/flow/nested_flows/src/main/webapp/flow3/flow3.xhtml
A test/web-profile/flow/nested_flows/pom.xml

- New test content.
Sending jsf-api/src/main/java/javax/faces/flow/FlowHandler.java
Sending jsf-ri/src/main/java/com/sun/faces/application/NavigationHandlerImpl.java
Sending jsf-ri/src/main/java/com/sun/faces/flow/FlowHandlerImpl.java
Sending jsf-ri/src/main/java/com/sun/faces/flow/builder/FlowCallBuilderImpl.java
Adding test/web-profile/flow/nested_flows
Adding test/web-profile/flow/nested_flows/nbactions.xml
Adding test/web-profile/flow/nested_flows/pom.xml
Adding test/web-profile/flow/nested_flows/src
Adding test/web-profile/flow/nested_flows/src/main
Adding test/web-profile/flow/nested_flows/src/main/java
Adding test/web-profile/flow/nested_flows/src/main/resources
Adding test/web-profile/flow/nested_flows/src/main/webapp
Adding test/web-profile/flow/nested_flows/src/main/webapp/WEB-INF
Adding test/web-profile/flow/nested_flows/src/main/webapp/WEB-INF/beans.xml
Adding test/web-profile/flow/nested_flows/src/main/webapp/WEB-INF/faces-config.xml
Adding test/web-profile/flow/nested_flows/src/main/webapp/WEB-INF/glassfish-web.xml
Adding test/web-profile/flow/nested_flows/src/main/webapp/WEB-INF/web.xml
Adding test/web-profile/flow/nested_flows/src/main/webapp/flow1
Adding test/web-profile/flow/nested_flows/src/main/webapp/flow1/flow1.xhtml
Adding test/web-profile/flow/nested_flows/src/main/webapp/flow1/return2.xhtml
Adding test/web-profile/flow/nested_flows/src/main/webapp/flow2
Adding test/web-profile/flow/nested_flows/src/main/webapp/flow2/flow2.xhtml
Adding test/web-profile/flow/nested_flows/src/main/webapp/flow3
Adding test/web-profile/flow/nested_flows/src/main/webapp/flow3/flow3.xhtml
Adding test/web-profile/flow/nested_flows/src/main/webapp/index.xhtml
Adding test/web-profile/flow/nested_flows/src/test
Adding test/web-profile/flow/nested_flows/src/test/java
Adding test/web-profile/flow/nested_flows/src/test/java/com
Adding test/web-profile/flow/nested_flows/src/test/java/com/sun
Adding test/web-profile/flow/nested_flows/src/test/java/com/sun/faces
Adding test/web-profile/flow/nested_flows/src/test/java/com/sun/faces/test
Adding test/web-profile/flow/nested_flows/src/test/java/com/sun/faces/test/webprofile
Adding test/web-profile/flow/nested_flows/src/test/java/com/sun/faces/test/webprofile/flow
Adding test/web-profile/flow/nested_flows/src/test/java/com/sun/faces/test/webprofile/flow/basic_faces_flow_call
Adding test/web-profile/flow/nested_flows/src/test/java/com/sun/faces/test/webprofile/flow/nested_flows
Adding test/web-profile/flow/nested_flows/src/test/java/com/sun/faces/test/webprofile/flow/nested_flows/NestedFlowsIT.java
Sending test/web-profile/flow/pom.xml
Transmitting file data .................
Committed revision 11757.

--