Announcement Announcement Module
Collapse
No announcement yet.
flowScope problem Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • flowScope problem

    Hi all,

    I have been having a lot of difficulty moving an object in and out of flowScope through one of my flows. There are three stages to the flow - enter basic details, select a forecast strategy and complete the forecast. All three stages use the same object, stored in my flowScope as yearlyForecast.

    My flow definition looks like this:
    Code:
    <flow ... namespace details removed>
    	<input name="id" value="requestScope.id" />
    	
    	<!-- determine whether to create or edit -->
    	<decision-state id="createOrEdit">
            <if test="id == null" then="create" else="edit" />
        </decision-state>
    
        <action-state id="create">
            <evaluate expression="forecastsService.initialiseForecast()" result="flowScope.yearlyForecast" />
            <transition to="enterYearlyForecastInformation" />
        </action-state>
        
        <action-state id="edit">
            <evaluate expression="forecaster.getYearlyForecast(id)" result="flowScope.yearlyForecast" />
            <transition to="enterYearlyForecastInformation" />
        </action-state>
    	
    	<!-- initialise reference data -->   
        <view-state id="enterYearlyForecastInformation" view="forecasts/yearly-forecast" model="yearlyForecast">
        	<on-render>
        		<evaluate expression="refdataDataService.listHotels()" result="requestScope.hotels" />
        	</on-render>
            <transition on="save" to="enterRoomNightsAndRate">
            	<evaluate expression="forecastsService.createYearlyForecast(yearlyForecast)" result="flowScope.yearlyForecast" />
            </transition>
        </view-state>
    	
    	<view-state id="enterRoomNightsAndRate" view="forecasts/room-nights-and-rate" model="yearlyForecast">
            <transition on="save" to="enterMonthlyForecast">
            	<evaluate expression="forecastsService.saveRoomNightsAndRate(yearlyForecast)" result="flowScope.yearlyForecast" />
            </transition>
        </view-state>
        
        <view-state id="enterMonthlyForecast" view="forecasts/monthly-forecast" model="yearlyForecast">
            <transition on="confirm" to="monthlyForecastComplete" />
        </view-state>
    	
        <end-state id="monthlyForecastComplete">
        	<output name="yearlyForecast" value="flowScope.yearlyForecast" /> 
        </end-state>
    
    </flow>
    The initial forecast is created and the view displays. When I post the form back, binding works successfully (I can see from debug). The service saves the details to the db successfully too and I return the newly saved object from the createYearlyForecast method. However, when I move to the next JSP, none of the data from the saved object is available.

    Does anyone know where I might be going wrong? I've looked at several examples and the reference documentation which point to the approach I've taken being the correct one.

    Presumably when each time I set a result back into flowScope.yearlyForecast the old object is replaced? Likewise I presume that using the spring tags and binding to say yearlyForecast.id should return the value correctly?

    Thanks to anyone who can offer me some assistance
    Mark
Working...
X