Nested conversation and flush mode
abafna.bafna.amit.gmail.com Jun 1, 2009 9:58 PMAll,
I have a screen where I display all the users and few of the user properties that can be edited dynamically on this screen. User (webadmin) can press add user button on the top to add a new user or click on username to edit additional properties not available on user list screen. User add/edit screen performs validations before persisting or updating.
When users presses add button or clicks on username to edit a user, I am nesting the conversation and redirecting webadmin to user add/update screen. User add/update screen is backed by a user entity home component. After all the checks, I am persisting / updating the data and ending the nested conversation.
Since, a few validations need to be performed on user screen before user properties can be updated, I need the flush mode to be manual. However, on user list screen, I need flush mode to be auto to allow for dynamic updates for available properties.
Please see the code snippet below. It is not working as expected. How can I switch the flush mode to MANUAL when nesting the conversation and back to AUTO when ending the nested conversation without using @Begin in my Java code?
I tried @Begin(nested=true, flushMode=FlushModeType.MANUAL) on the first method being called on entity home component and it worked as expected but I want to keep navigation controls out of Java code. Is this possible?
userList.xhtml
... <s:button id="addUserButton" value="Add User" view="/userAccount.xhtml" propagation="nest"> <f:param name="userId"/> <f:param name="fromView" value="userList" /> </s:button> ...
pages.xml
<page view-id="/userList.xhtml" login-required="true"> <begin-conversation join="true"/> <description>Conv #{conversation.id} @ #{currentTime} - User List</description> <restrict>#{s:hasRole('webadmin')}</restrict> </page> <page view-id="/userAccount.xhtml" login-required="true" action="#{userHome.checkData}"> <begin-conversation nested="true" flush-mode="manual"/> <description>Conv #{conversation.id} @ #{currentTime} - Add/edit user</description> <param name="userId" value="#{userHome.id}" converterId="javax.faces.Long" /> <param name="fromView"/> <navigation> <rule if-outcome="invalid"> <end-conversation before-redirect="true"/> <redirect view-id="/error.xhtml" /> </rule> <rule if-outcome="success"> <end-conversation before-redirect="true"/> <redirect view-id="/#{empty fromView ? 'mySavedReports' : fromView}.xhtml" /> </rule> </navigation> </page>
Any one any suggestions?
Thanks
Amit