Announcement Announcement Module
Collapse
No announcement yet.
sub-flow inheritance not working in SWF 2.0.5 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • sub-flow inheritance not working in SWF 2.0.5

    I have one parent flow and 2 subflows in it.

    All the subflows need to serve some global menu click actions, so I put those common menuclick actions in the common-flow definition as global transitions to go the common endstates that all the subflows are supposed to serve.

    Code:
    <flow abstract="true"...>
    <!-- these will serve the global menuActions -->
       <global-transitions>
          <transition on="menu1ClickAction" to="menu1ClickAction-EndState" />
          <transition on="menu2ClickAction" to="menu2ClickAction-EndState" />
      </global-transitions>
    
    <!--this common-subflow will serve to receive the above common end states-->
       <subflow-state id="common-subflow" >
             <transition on="menu1ClickAction-EndState" to="subflow1" />
             <transition on="menu2ClickAction-EndState" to="subflow2" />
       </subflow-state>
    
    </flow>
    the main flow is inheriting from the common-flow definition
    and its subflows are inheriting from the common-subflow

    Code:
    <flow parent="common-flow" ...>
      <view-state ... />
    
      <subflow id=''subflow1" parent="common-flow#common-subflow"/>
      <subflow id=''subflow2" parent="common-flow#common-subflow"/>
      <subflow id=''subflow3" parent="common-flow#common-subflow"/>
    </flow>
    I was assuming that when I am in subflow2 and the menu1ClickAction happens, I should get forwarded to the subflow1 in this case, but I get a nullpointer exception in
    Code:
    org.springframework.webflow.engine.builder.model.FlowModelFlowBuilder.parseSubflowExpression(FlowModelFlowBuilder.java:713)
    because this function is called by FlowModelBuilder.parseAndAddSubflowState() function which passes it
    state.getSubflow() parameter which for common-subflow state is NULL - I understand that since I have not provided the value for subflow attribute in the common-subflow element but shouldn't the child get this value after the merge algorithm is applied on the parent and the child.

    Is it a bug or something that I am missing ? ( I have SWF 2.0.5 jars.)
    Please help.

  • #2
    We are doing something similar using this approach:

    Global Transitions Flow:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <flow xmlns="http://www.springframework.org/schema/webflow"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://www.springframework.org/schema/webflow http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd"
          abstract="true">
    
    	<global-transitions>
    		<transition on="home" to="home" />
    		<transition on="info" to="info" />
    		<transition on="order" to="order" />
    	</global-transitions>	
    		
    </flow>

    Flow:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <flow xmlns="http://www.springframework.org/schema/webflow"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://www.springframework.org/schema/webflow http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd"
          parent="global">
          
          <view-state id="home">
          </view-state>	      	           
          
          <view-state id="info">
          </view-state>
          
          <subflow-state id="order" subflow="order" >
          </subflow>
    </flow>

    Subflow:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <flow xmlns="http://www.springframework.org/schema/webflow"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://www.springframework.org/schema/webflow http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd"
          parent="global">
          
          <view-state id="enter_order">
          	     <transition on="submit" to="home">
          </view-state>	      	     
          	     
    		
          <end-state id="home" />
          <end-state id="info" />
          <end-state id="order" />
    </flow>
    Hope that helps.

    Comment


    • #3
      Hi,

      Please create a JIRA issue at jira.springframework.org if you suspect you have discovered a bug!

      Keith

      Comment


      • #4
        help with menu navigation

        Hi splashout,

        thanks for your example. I'm new with webflow and new with english. I'm looking for a full example with menu navigation. Do you have only one flow definition file (with view-state home, info, order, ...) and many subflow definition files?

        Thanks for your Tipps
        Torsten

        Comment


        • #5
          In the example given, the global transitions represent menu navigation -- you should be able to add as many global transitions as you need to support your navigation. We are only using only one sub-flow, but I see no reason why you couldn't use more following the same pattern. There are probably other ways to do this -- I have never tried your notation:
          Code:
          <subflow id=''subflow1" parent="common-flow#common-subflow"/>
          I'm also pretty new to webflow, so I apoligize if I can't provide more information.

          Comment


          • #6
            Originally posted by Keith Donald View Post
            Hi,

            Please create a JIRA issue at jira.springframework.org if you suspect you have discovered a bug!

            Keith
            I have created the bug
            http://jira.springframework.org/browse/SWF-979
            since subflow inheritance is not working as expected.

            Comment

            Working...
            X