[jboss-user] [JBoss Seam] - New conversation variable stack component (proposal)
do-not-reply at jboss.com
Sat Feb 17 18:07:34 EST 2007
Was going to put this in JIRA (will shortly) but I thought I'd float the idea here first to kick it around a bit.
At the moment it is quite tricky and/or cumbersome to pass arbitrary values up and down a nested conversation stack (@Begin(nested = true)) in a generic manner.
In the simplest terms I often want to be able to pass information up (to parents) or down (to nested children) in the conversation stack.
Currently this is usually achieved by an action method in a component setting/accessing a variable on itself or another component (for passing information "up") or by using request parameters/page parameters.
This is fine for tightly coupled pages/components that "know" about each other and what will be in scope when, but for loosely coupled pages/components in a generic framework this doesn't work so well. (Like the Seam framework with generic EntityHome and Query components).
For example creating or editing an entity that has a many-to-one association may require navigating to a search page for the "one" side of relationship to be selected. Combos boxes are not always sufficient due to lack of searching and large numbers of items. Similarly after editing and saving an entity it may be useful to pass information about the new entity state up to the search that originated the edit. These are simple examples but you get the idea (I hope!)
A possible approach to solve this would involve introducing a "NestedConversationStack" component. The component would be conversation scoped and would allow addition and retrieval of variables by key at any level of the conversation stack. A more advanced implementation might involve a sub-scoping of a variable when it is added to only allow conversations above/below the current one to be able to access the variable. (possible sub-scoping options might be ALL, CHILD, PARENT, DESCENDENTS, ANCESTORS)
A more thorough example...
User opens Entity A Search. Conversation (1) begins.
Selects an existing item to edit (would probably use a request parameter but could insert the required entity id into the stack with CHILD scope)
Redirect to Entity A Detail. Nested conversation (2) begins. Detail component extracts entity id and loads entity from DB.
User clicks a button to go to a sub-search for an associated to Entity B. (insert arbitrary restrictions on which B entities are allowed, like a filter, into the stack with CHILD scope)
Redirect to Entity B Search. Nested conversation (3) begins. (search component extracts filter and applies to search).
User selects an Entity B and clicks OK. (insert selected entity into stack with PARENT scope).
Nested conversation (3) ends. Redirect back to Entity A Detail. (extracts selected entity and updates association to Entity B).
User clicks OK. Data saved to DB. (could insert the updated entity here with PARENT scope if the search was interested).
Nested conversation (2) ends. Redirect back to Entity A Search.
Eventually conversation (1) ends or times out and the component will be destroyed.
My motivation for this is because I am building a mini-framework (similar to Seam framework) as a platform for building web products on. The idea being the framework handles most of the tedium of data binding/validation and the tricky stuff like conversation handling/page redirects etc. The big piece I have missing is a method for arbitrary information passing between the different pages (99% of which are some derative of a search or detail page and will use the framework) in a generic fashion when a nested conversation is active Search -> Detail -> Search -> Search etc.
Any feedback or thoughts on this appreciated.
Any clarification needed pls ask and I will attempt to explain better! :)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4018315#4018315
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4018315
More information about the jboss-user