[ 
https://issues.apache.org/jira/browse/MYFACES-4553?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17681364#comment-17681364
 ] 

Volodymyr Siedlecki edited comment on MYFACES-4553 at 1/27/23 6:42 PM:
-----------------------------------------------------------------------

unrelated to the reported problem –, I don't think we are 100% spec compliant 
here? The spec says the following node steps *must* occur in this order, but we 
*start with the switch node, not the view node.* Might need to look at this 
more.

Looking at the older JSF 2.2 Spec since that's when the flow logic was 
introduced:

______
Requirements for Explicit Navigation in Faces Flow Call Nodes other than 
ViewNodes {color:#ff0000}[P1-start ExplicitNavigationNonViewFlowNode 
requirements] {color}*These steps must be performed in this order to determine
 * the vdl view identifier when navigating to a flow node that is not a view 
node. Algorithm for resolving a nodeId to a vdl view identifier.
If nodeId is a view node, let vdl view identifier be the value of nodeId and 
exit the algorithm. If the node is a SwitchNode, iterate over the 
NavigationCase instances returned from its getCases() method. For each, one 
call getCondition(). If the result is true, let nodeId be the value of its 
fromOutcome property. If the node is a MethodCallNode, let nodeId be the value 
invoking the value of its methodExpression property. If the result is null, let 
nodeId be the value of the MethodCallNode’s outcome property. If the node is a 
FlowCallNode, save it aside as facesFlowCallNode. Let flowId be the value of 
its calledFlowId property and flowDocumentId be the value of its 
calledFlowDocumentId property. If no flowDocumentId exists for the node, let it 
be the string resulting from flowId + “/” + flowId + “.xhtml”. Ask the 
FlowHandler for a Flow for this flowId, flowDocumentId pair. Obtain a reference 
to the start node and execute this algorithm again, on that start node. 
________


was (Author: volosied):
Hmm, I don't think we are 100% spec compliant here? The spec says the following 
node steps *must* occur in this order, but we *start with the switch node, not 
the view node.*  Might need to look at this more.

Looking at the older JSF 2.2 Spec since that's when the flow logic was 
introduced: 

______
Requirements for Explicit Navigation in Faces Flow Call Nodes other than 
ViewNodes {color:#ff0000}[P1-start ExplicitNavigationNonViewFlowNode 
requirements] {color}*These steps must be performed in this order to determine 
* the vdl view identifier when navigating to a flow node that is not a view 
node. Algorithm for resolving a nodeId to a vdl view identifier.
If nodeId is a view node, let vdl view identifier be the value of nodeId and 
exit the algorithm. If the node is a SwitchNode, iterate over the 
NavigationCase instances returned from its getCases() method. For each, one 
call getCondition(). If the result is true, let nodeId be the value of its 
fromOutcome property. If the node is a MethodCallNode, let nodeId be the value 
invoking the value of its methodExpression property. If the result is null, let 
nodeId be the value of the MethodCallNode’s outcome property. If the node is a 
FlowCallNode, save it aside as facesFlowCallNode. Let flowId be the value of 
its calledFlowId property and flowDocumentId be the value of its 
calledFlowDocumentId property. If no flowDocumentId exists for the node, let it 
be the string resulting from flowId + “/” + flowId + “.xhtml”. Ask the 
FlowHandler for a Flow for this flowId, flowDocumentId pair. Obtain a reference 
to the start node and execute this algorithm again, on that start node. 
________

> TCK spec/flows/intermediate failure: WELD-001303: No active contexts for 
> scope type jakarta.faces.flow.FlowScoped
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: MYFACES-4553
>                 URL: https://issues.apache.org/jira/browse/MYFACES-4553
>             Project: MyFaces Core
>          Issue Type: Bug
>    Affects Versions: 4.0.0-RC4
>            Reporter: Volodymyr Siedlecki
>            Priority: Major
>         Attachments: faces_flows_intermediate_web.war, flows.war
>
>
> {color:#0e101a}The WELD-001303 error occurs because we are not yet in a flow 
> officially (but will enter one). This means that the contextual storage for 
> the flow has yet to be created.  This cause the weld error as the 
> FlowScopeContext is not yet active – [see isActive 
> call.|https://github.com/apache/myfaces/blob/main/impl/src/main/java/org/apache/myfaces/flow/cdi/FlowScopeContext.java#L105]
> {color}
>  
> {color:#0e101a}So flow scope is not active, but MyFaces starts to look at the 
> nodes, it first checks the switch condition which references the flowScope 
> implicit object: 
> {color}
> {color:#0e101a}Application Switch Case: {color}
> [{color:#4a6ee0}[https://github.com/jakartaee/faces/blob/3fae98234692ec16545a6d27cf36fabaeb883f9b/tck/old-tck/source/src/web/jsf/spec/flows/intermediate/maintain-customer-record/maintain-customer-record-flow.xml#L39]{color}]
>  
> {color:#0e101a}MyFace Switch Case Check: {color}
> [{color:#4a6ee0}[https://github.com/apache/myfaces/blob/8956fd167f797a4e32511e268a6520715cb132a5/impl/src/main/java/org/apache/myfaces/application/NavigationHandlerImpl.java#L645]{color}]
>  
>  
> {color:#0e101a}This is a problem because the context for flowScope still 
> needs to be created, as mentioned above. This flow transition, which causes 
> the scope to be activated, doesn't happen until 
> [applyFlowTransition|https://github.com/apache/myfaces/blob/8956fd167f797a4e32511e268a6520715cb132a5/impl/src/main/java/org/apache/myfaces/application/NavigationHandlerImpl.java#L368]
>  (which is much later). {color}
>  
> {color:#0e101a}My only idea is to force a transition call before we check the 
> nodes, which causes myfaces unit test failures. 
> {color}
> {color:#0e101a}I also believe this is an issue in previous versions – we were 
> lucky since the flowScope implicit object was evaluated to null (since no 
> scope was active), and the "flowScope.customerId == null" check passed.{color}
>  
> {color:#0e101a}Unit Test Code:{color}
> *{color:#0e101a}spec/flows/intermediate:{color}*
> {color:#0e101a}Test: 
> {color}[{color:#4a6ee0}[https://github.com/jakartaee/faces/blob/4.0.1/tck/old-tck/source/src/com/sun/ts/tests/jsf/spec/flows/intermediate/URLClient.java#L59]{color}]
> {color:#0e101a}       
> {color}[{color:#4a6ee0}[https://github.com/jakartaee/faces/blob/4.0.1/tck/old-tck/source/src/com/sun/ts/tests/jsf/spec/flows/intermediate/URLClient.java#L91]{color}]
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to