struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hookom, Jacob" <Jacob.Hoo...@redline.mckhboc.com>
Subject RE: [OT] Workflow Proposal for Struts
Date Thu, 17 Jul 2003 14:02:11 GMT
I'm working on something similar for my company that works like ANT and is
loaded via the ServiceLocator pattern.  It allows you to say "for storing an
order, it is dependent on: validation, duplication check, and storage".
Dependency mapping allows you to add some granularity to your tasks, and
tasks (targets) are fired like the ServletFilter:

public void invoke(Context context, TaskChain chain) throws Exception
{
	ServiceRegistry sr = chain.getServiceRegistry();
	Service s = null;
	Call c = null;
	try
	{
		// do pre processing
		s = sr.createService("test");
		c = s.createCall("sampleTask");
		c.invoke(context);

		chain.invokeNext(context);

		// do post processing
	}
	catch (Exception e)
	{
		// do error handling
	}
	finally
	{
		s.close();
		c.close();
	}
}

Jacob Hookom
Senior Analyst/Programmer
McKesson Medical-Surgical
Golden Valley, Minnesota
http://www.mckesson.com

-----Original Message-----
From: Sloan Seaman [mailto:sloan@sgi.net]
Sent: Thursday, July 17, 2003 8:22 AM
To: Struts Users Mailing List
Subject: Re: [OT] Workflow Proposal for Struts

I'm working on getting the OK from my company to release the code (as it was
developed for one of our projects).  I'll keep you posted but it shouldn't
take long.  They have let me release stuff before...


The validation piece is the core of another system I've developed that does
a lot more.  If you just want the validation piece that is cool as it is
designed to be its own entity.

The other system, ActionMCP (Master Control Program (think Tron, the movie))
adds to the validation system by supporting configurable resource chaining.

Say you are using JDO and you don't want to have to getPersistenceManager()
in every action.  At the same time, you also have multiple objects that you
want to fire off and if one of them fails you want to rollback everything.
The objects that fire off, and their order can be set within struts as well
as being wrapped by jdo like so:

<action path="/test"
   className="com.symbol.mc.struts.mcp.ActionMCPMapping"
   type="com.symbol.mc.struts.mcp.ActionMCP"
   name="jdoTestBean"
   >
   <set-property property="ACTION_TYPE" value="JDO, PROCESSOR"/>
   <set-property property="ACTION_PROCESSOR"
value="com.symbol.mc.oms.common.struts.action.DollarSpent"/>
   <set-property property="ACTION_PROCESSOR"
value="com.symbol.mc.oms.common.struts.action.SaveDollar"/>
   <forward name="PAGE_ACTION_FAILURE" path="/testMdx.jsp"/>
   <forward name="PAGE_ACTION_SUCCESS" path="/mdx.jsp"/>
</action>

Doesn't show much really, but now, say I want the page to work only in a
secure env.

All you do is change ACTION_TYPE to:
<set-property property="ACTION_TYPE" value="SECURE, JDO, PROCESSOR"/>

objects in the list get wrapper by their predecessor.

Ok, so now you want to do Redirects (Something I have seen talked about a
lot in the forums but never really implemented ;))

Change ACTION_TYPE to:
<set-property property="ACTION_TYPE" value="SECURE, JDO, PROCESSOR, REMAP"/>
and add:
<set-property property="MAPPED_FORWARD"
value="PAGE_ACTION_SUCCESS:/app/test1:/app/test2"/>

This will take any request from /app/test1 and change the value of
PAGE_ACTION_SUCCESS to /app/test2 without having to change your Action's
code.

It does a lot of other things (Chaining, MDX, wait pages), but this email is
getting long...

--
Sloan


----- Original Message -----
From: "Sandeep Takhar" <sandeep_takhar@yahoo.com>
To: "Struts Users Mailing List" <struts-user@jakarta.apache.org>
Sent: Thursday, July 17, 2003 8:39 AM
Subject: Re: [OT] Workflow Proposal for Struts


> I like the idea of validation of struts-config.  Could
> you send me that if you don't mind?
>
> sandeep
> --- Sloan Seaman <sloan@sgi.net> wrote:
> > Jacob,
> >
> > Can't you pull off workflow (to some degree) with
> > action chaining?
> >
> > Here is the system I have devised (this is part of a
> > much larger
> > architecture that does a lot of other cool things
> > like validation of struts
> > config files to ensure that specified actions have
> > required forwards and
> > set-properties (nice for multi-developer env's)):
> >
> > Here is an example I have in my struts config:
> >  <action-mappings>
> >   <action path="/app/promoFlight/addChain"
> >
> >
> className="com.symbol.mc.struts.wrapper.chain.ChainActionMapping"
> >
> >
> type="com.symbol.mc.struts.wrapper.chain.ChainAction"
> >    name="addForm"
> >    >
> >    <set-property property="CHAIN_PROPERTY_NAME"
> > value="ACTION_POINT"/>
> >    <set-property property="CHAIN" value="Cancel:
> > /app/promoFlight/managePage"/>
> >    <set-property property="CHAIN" value="Create a
> > List:
> > /app/promoFlight/storePage"/>
> >    <set-property property="CHAIN" value="Add
> > Promotion Flight:
> > /app/promoFlight/add"/>
> >    <forward name="PAGE_ACTION_FAILURE"
> > path="/app/promoFlight/addPage.do"/>
> >   </action>
> >
> > The .jsp/html page then has a submit button named
> > ACTION_POINT.  This action
> > supports three different action points depending on
> > thier value.
> >
> > If Cancel, it goes to /app/promoFlight/managePage,
> > and so on.
> >
> > In case of an error in the ChainAction it uses
> > PAGE_ACTION_FAILURE.
> >
> > I can also set FORWARD_FAILURE_NAME which allows me
> > to specify the name of a
> > forward that, if returned from one of the chained
> > pages, will stop the
> > chain.
> >
> > This exists because not only can I just redirect to
> > a specific page, I can
> > do things like:
> > <set-property property="CHAIN" value="Cancel:
> > /app/promoFlight/managePage,
> > /app/promoFlight/savePage, etc"/>
> >
> > Is this what you are kinda looking for?
> >
> > --
> > Sloan
> >
> > ----- Original Message -----
> > From: "Hookom, Jacob"
> > <Jacob.Hookom@redline.mckhboc.com>
> > To: <struts-user@jakarta.apache.org>
> > Sent: Wednesday, July 16, 2003 5:11 PM
> > Subject: [OT] Workflow Proposal for Struts
> >
> >
> > >
> >
> http://jakarta.apache.org/struts/proposal-workflow.html
> > >
> > > Is there any pursuit in this or does it follow the
> > direction that 1.2 will
> > > be heading or is this the proposal for the
> > commons-workflow?
> > >
> > > Jacob Hookom
> > > Senior Analyst/Programmer
> > > McKesson Medical-Surgical
> > > Golden Valley, Minnesota
> > > http://www.mckesson.com
> > >
> > >
> > >
> >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > struts-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail:
> > struts-user-help@jakarta.apache.org
> > >
> > >
> >
> >
> >
> ________________________________________________________________________
> > This email has been scanned for all viruses by the
> > MessageLabs Email
> > Security System. For more information on a proactive
> > email security
> > service working around the clock, around the globe,
> > visit
> > http://www.messagelabs.com
> >
> ________________________________________________________________________
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> > struts-user-help@jakarta.apache.org
> >
>
>
> __________________________________
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> http://sbc.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>


________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs Email
Security System. For more information on a proactive email security
service working around the clock, around the globe, visit
http://www.messagelabs.com
________________________________________________________________________

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message