We do lots of linking and chainning of actions.  SubmitAction (validate input), 
SaveAction (saves data), HistoryAction (log history), etc.  

The code we use to chain actions together is basically:

        public void doPerform(RunData data, Context context)
        throws Exception
        {
                String METHOD_NAME = CLASS_NAME + "doPerform(RunData, Context)";
                SubmitAction submitAction = null;

                Log.debug(METHOD_NAME + " - starting");

        // run the intake validation service

        try
        {
            Log.info(METHOD_NAME + " - validating input form");
            FormValidation.validateGeneralTab(context);

            submitAction = new SubmitAction();
            submitAction.doPerform(data, context);
        }

       // Error handling

        catch (IllegalArgumentException e)
        {
                        Log.info(METHOD_NAME + " - input form failed validation");
            this.setTemplate(data, "first,Entry.vm");
        }
        catch (Exception e)
        {
                throw(e);
        }
        finally
        {
                Log.debug(METHOD_NAME + " - ending");
        }
        }

and so on and so forth.


> -----Original Message-----
> From: Eric Pugh [mailto:[EMAIL PROTECTED]
> Sent: Friday, April 02, 2004 5:08 AM
> To: Turbine Users List
> Subject: RE: Action->Action flow
> 
> 
> I actually could be wrong..   Not sure..   I'd recommend 
> writing a unit test
> that does that, and then step through and see where it goes!  
> there are some
> examples of executing actions in the unit tests..
> 
> Eric
> 
> > -----Original Message-----
> > From: Robles, Rogelio [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, April 01, 2004 10:13 PM
> > To: 'Turbine Users List'
> > Subject: RE: Action->Action flow
> >
> >
> >
> > So there's no way in Turbine to forward to the controller a
> > destination like
> > an Action or Screen? chaining them?
> >
> > Why data.setAction("secondAction") in the first aciont, 
> can't (or should
> > not) do the trick ?
> >
> > Rogelio
> >
> > > -----Original Message-----
> > > From: Eric Pugh [mailto:[EMAIL PROTECTED]
> > > Sent: Thursday, April 01, 2004 6:54 AM
> > > To: Turbine Users List
> > > Subject: RE: Action->Action flow
> > >
> > >
> > > Here you go:
> > >
> > >  VelocityAction action = (VelocityAction) ActionLoader
> > >                         
> .getInstance().getInstance("CreateReactions");
> > >                 action.doPerform(data, context);
> > >
> > > However, Oron is right..  You should have VERY little code in
> > > an action as actions are hard to unit test.  (You are writing
> > > unit tests right :-) )
> > >
> > > Eric
> > >
> > > > -----Original Message-----
> > > > From: Vjeran Marcinko [mailto:[EMAIL PROTECTED]
> > > > Sent: Thursday, April 01, 2004 4:30 PM
> > > > To: Turbine Users List
> > > > Subject: Re: Action->Action flow
> > > >
> > > >
> > > > Hi Oron.
> > > >
> > > > I am aware that such way only small amount of code will 
> be repeated
> > > > (doService and setting template), but I really wanted not
> > > to have any
> > > > copies, but to reuse Action class maximally. Anyway, as I have
> > > > understanding of Turbine, flow from :
> > > > Action->Action
> > > > Screen->Action
> > > > Screen->Screen
> > > > isn't possible.
> > > > Only Action->Screen is allowed, which is limiting in some cases.
> > > >
> > > > Thanx anyway for advice.
> > > >
> > > > ----- Original Message -----
> > > > From: "Oron O Adam" <[EMAIL PROTECTED]>
> > > > To: "'Turbine Users List'" <[EMAIL PROTECTED]>
> > > > Sent: Thursday, April 01, 2004 4:24 PM
> > > > Subject: RE: Action->Action flow
> > > >
> > > >
> > > > > Hi Vjeran
> > > > >
> > > > > Seems to me if you make your actions thin and put the logic in
> > > > some joint
> > > > > service class you will have
> > > > >
> > > > > Action a code
> > > > > {
> > > > > if(need to display screen)
> > > > > {
> > > > > setTemplate(additional screen)
> > > > > }
> > > > > else  // no need for screen
> > > > > {
> > > > > doService
> > > > > setTemplate(some final screen)
> > > > > }
> > > > >
> > > > > }
> > > > >
> > > > > Action b code
> > > > > {
> > > > > doService()
> > > > > settemplate(some final screen)
> > > > > }
> > > >
> > > >
> > > >
> > > 
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: 
> [EMAIL PROTECTED]
> > > > For additional commands, e-mail:
> > > [EMAIL PROTECTED]
> > >
> > >
> > > 
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: 
> [EMAIL PROTECTED]
> > > For additional commands, e-mail: 
> [EMAIL PROTECTED]
> > >
> >
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: 
> [EMAIL PROTECTED]
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to