Back Forum Reply New

How to keep the current state of the main flow after returned from subflow?

We have an application where main flow is a view. Action that user takes on the main view may or may not affect the content of the view. These action trigger subflows.
What I want is that when I come back from sub flow I want my current state to be the active state. Currently I am trying to achieve this by on transition I set next state to be the same state. Example:

lt;view-state id=quot;generateReportquot; view=quot;/mGPquot;gt;
lt;transition on=quot;exportExcelquot; to=quot;exportExcelquot;/gt;
lt;transition on=quot;exportPdfquot; to=quot;exportPdfquot;/gt;
lt;transition on=quot;exportPrintquot; to=quot;exportPrintquot;/gt;
lt;transition on=quot;preferencesquot; to=quot;preferencesquot;gt;
lt;/view-stategt;lt;subflow-state id=quot;preferencesquot; flow=quot;preferences-flowquot;gt;
lt;attribute-mappergt;
lt;input-mappergt;
lt;mapping source=quot;flowScope.webReportFlowStateBeanquot; target=quot;webReportFlowStateBeanquot;/gt;
lt;/input-mappergt;
lt;/attribute-mappergt;
lt;transition on=quot;endPreferencesquot; to=quot;generateReportquot;/gt;
lt;/subflow-stategt;

Example above work fine except it re posts to servlet defined in the view. I want to avoid this. All I want is when subflow return set my last state to be the active state. Do not execute the servlet code.

Is this possible?


Originally Posted by mcevikceExample above work fine except it re posts to servlet defined in the view.

What do you mean by this? That the view state quot;generateReportquot; is entered and view quot;/mGPquot; is re-displayed? But this is how it is supposed to be - quot;/mGPquot; view will be displayed with your last flow state.

The only problem I can see is that you don't submit all data the user entered in your quot;/mGPquot; html page before making quot;preferencesquot; transition. In that case when returning form subflow, quot;/mGPquot; view would be rendered with initial values...Regards,
Igor.

Here is how the application works:
mGP servlet will render and out put a report in DHTML(This is a costly process since we render huge reports). Then user can click on actions such as save preferences. This action will start a sub flow and pop up another window. Once user saves his/her preference window will close and we return to main flow. At this point setting transition to quot;generateReportquot; will submit to mGP servlet which will re render the report again. I want to avoid this.
There is no need to submit the mGP servlet again since report is already generated.

Currently with the setup described above when we return from the sub flow following:
lt;transition on=quot;endPreferencesquot; to=quot;generateReportquot;/gt;
invokes a submit to mGP then all that costly report generation is triggered again.

I hope this makes it clear.

I see. Do you use continuations in your webflow config? If so, than one possible solution would be to omit:

Code:
lt;transition on=quot;endPreferencesquot; to=quot;generateReportquot;/gt;
transition in your subflow element. (I'm not actually sure if this transition can be fully omitted, if not than just put some dummy transition that does not match your subflow's end state)

By doing this, after user closes its quot;preferencesquot; popup window, one continuation of your main flow will be quot;stuckquot; inside quot;preferencesquot; subflow state, but in your browser will be displayed the report previously generated - which has its continuation state inactive inside flow execution. You will be able to continue using links and buttons on your quot;reportquot; page as this will be continuing your old continuation state.

Of course, for this to work, you will have to keep your data in CONVERSATION, not FLOW scope, as all continuations share data in this scope.
¥
Back Forum Reply New