My group is thinking of 4 new scopes.
1) Workflow scope - last as long as the set of steps in a task you are
completeing
2) our own HttpSession object
3) publication scope
4) publication group scope
We are a publishing company with many reports and magazines
----- Original Message -----
From: "Ted Husted" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, June 13, 2001 8:40 AM
Subject: Workflow Context
> Something that has come up now and again is the idea of a "workflow"
> context - more than a single request but less than a session.
>
> Towards that end, I've been experimenting with placing a Hashtable in
> the session where I can store objects between requests, and remove them
> when the mutli-request task is complete. I'm calling this a "Registry".
>
> My current test case is leaving an input form to go off and look up some
> foreign keys, and then have the keys filled in when you get back.
>
> To do this, I put an extra submit button next to the foreign keys. When
> the action sees one of these come in, it puts the ActionForm in the
> registry, and forwards to a search form for the key.
>
> String pickDonor = request.getParameter("pickDonor");
> if (pickDonor!=null) {
> servlet.log("item.Access: Saving itemForm in Registry",2);
> registry.put(formName,thisForm);
> return mapping.findForward("pickDonor");
> }
>
> The data access Actions in the application register a form's key
> property when appropriate:
>
> // Remove or update donor key
> if (task.equals("delete"))
> registry.remove(formKey);
> else
> registry.setString(formKey,thisForm.getKey());
>
> This is stateless and happens whenever the key is accessed.
>
> Later, when they request an input form, the Action checks the registry:
>
> // -- Check registry; repopulate bean if form not finished
> if (registry.containsKey(formName)) {
> servlet.log("item.Input: Restoring itemForm from Registry",2);
> Form itemForm = (Form) registry.remove(formName);
> try {
> BeanUtils.populate(thisForm,itemForm.getMap());
> }
> // :TODO: Generate "unexpected error" message
> catch (IllegalAccessException iae) {;}
> catch (InvocationTargetException ite) {;}
> thisForm.resetKeys(mapping,request);
> }
>
> You will note that the final trick is a "resetKeys()" method on the
> ActionForm, which sets any foreign keys it is watching from the
> registry, or to a default value is there is no registry key.
>
> The registry is being setup when they login. If I keep this structure, I
> could also keep the loginBean there so that my application just has the
> one session object to manage.
>
> I'll be testing and refining this approach more today, and just wondered
> if anyone else is working in this area.
>
> -- Ted Husted, Husted dot Com, Fairport NY USA.
> -- Custom Software ~ Technical Services.
> -- Tel 716 737-3463.
> -- http://www.husted.com/about/struts/
>