org.apache.struts.apps.mailreader.actions
Class BaseAction

java.lang.Object
  extended by org.apache.struts.action.Action
      extended by org.apache.struts.actions.BaseAction
          extended by org.apache.struts.actions.DispatchAction
              extended by org.apache.struts.actions.MappingDispatchAction
                  extended by org.apache.struts.apps.mailreader.actions.BaseAction
Direct Known Subclasses:
LocaleAction, LogoffAction, LogonAction, MainMenuAction, RegistrationAction, SubscriptionAction, WelcomeAction

public abstract class BaseAction
extends MappingDispatchAction

Base Action for MailReader application.

All the BaseAction helper methods are prefixed with "do" so that they can be easily distinguished from Struts and Servlet API methods. BaseAction subclasses may also have prive "do" helpers of their own.

Methods are kept in alphabetical order, to make them easier to find.

Version:
$Rev: 471754 $ $Date: 2006-11-06 08:55:09 -0600 (Mon, 06 Nov 2006) $

Field Summary
protected  Log log
           The Log instance for this application.
static String PASSWORD
           Name of password field ["password"].
static String TASK
           Name of task field ["task"].
static String USERNAME
           Name of username field ["username"].
 
Fields inherited from class org.apache.struts.actions.DispatchAction
clazz, methods, types
 
Fields inherited from class org.apache.struts.actions.BaseAction
messages
 
Fields inherited from class org.apache.struts.action.Action
servlet
 
Constructor Summary
BaseAction()
           
 
Method Summary
protected  void doCancel(HttpSession session, String method, String key)
           Helper method to log event and cancel transaction.
protected  ActionForward doFindFailure(ActionMapping mapping)
           Return the local or global forward named "failure" or null if there is no such forward.
protected  ActionForward doFindLogon(ActionMapping mapping)
           Return the local or global forward named "logon" or null if there is no such forward.
protected  ActionForward doFindSuccess(ActionMapping mapping)
           Return the mapping labeled "success" or null if there is no such mapping.
protected  String doGet(ActionForm form, String property)
           Helper method to fetch a String property from a DynaActionForm.
protected  Subscription doGetSubscription(HttpServletRequest request)
           Obtain the cached Subscription object, if any.
protected  Subscription doGetSubscription(HttpSession session)
           Obtain the cached Subscription object, if any.
protected  User doGetUser(HttpServletRequest request)
           Helper method to obtain User form session (if any).
protected  User doGetUser(HttpSession session)
           Helper method to obtain User form session (if any).
protected  UserDatabase doGetUserDatabase()
           Return a reference to the UserDatabase or null if the database is not available.
protected  ActionForward doInputForward(ActionMapping mapping, HttpServletRequest request, ActionMessages errors)
           Save any errors and the transactioonal token, and forward to the InputForard result.
protected  void doLogProcess(ActionMapping mapping, String method)
           Log a "processing" message for an Action.
protected  void doSaveToken(HttpServletRequest request)
           Helper method to log event and save token.
protected  void doSaveUser(User user)
           Persist the User object, including subscriptions, to the database.
protected  boolean doSet(ActionForm form, String property, String value)
           Helper method to inject a String property into a DynaActionForm.
 
Methods inherited from class org.apache.struts.actions.MappingDispatchAction
execute, getMethodName, getParameter, unspecified
 
Methods inherited from class org.apache.struts.actions.DispatchAction
cancelled, dispatchMethod, getMethod
 
Methods inherited from class org.apache.struts.action.Action
addErrors, addMessages, execute, generateToken, getErrors, getLocale, getMessages, getResources, getResources, getServlet, isCancelled, isTokenValid, isTokenValid, resetToken, saveErrors, saveErrors, saveMessages, saveMessages, saveToken, setLocale, setServlet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

USERNAME

public static String USERNAME

Name of username field ["username"].


PASSWORD

public static String PASSWORD

Name of password field ["password"].


TASK

public static final String TASK

Name of task field ["task"].

See Also:
Constant Field Values

log

protected Log log

The Log instance for this application.

Constructor Detail

BaseAction

public BaseAction()
Method Detail

doCancel

protected void doCancel(HttpSession session,
                        String method,
                        String key)

Helper method to log event and cancel transaction.

Parameters:
session - Our HttpSession
method - Method being processed
key - Attrkibute to remove from session, if any

doFindFailure

protected ActionForward doFindFailure(ActionMapping mapping)

Return the local or global forward named "failure" or null if there is no such forward.

Parameters:
mapping - Our ActionMapping
Returns:
Return the mapping named "failure" or null if there is no such mapping.

doFindLogon

protected ActionForward doFindLogon(ActionMapping mapping)

Return the local or global forward named "logon" or null if there is no such forward.

Parameters:
mapping - Our ActionMapping
Returns:
Return the mapping named "logon" or null if there is no such mapping.

doFindSuccess

protected ActionForward doFindSuccess(ActionMapping mapping)

Return the mapping labeled "success" or null if there is no such mapping.

Parameters:
mapping - Our ActionMapping
Returns:
Return the mapping named "success" or null if there is no such mapping.

doGet

protected String doGet(ActionForm form,
                       String property)

Helper method to fetch a String property from a DynaActionForm.

Values are returned trimmed of leading and trailing whitespace. Zero-length strings are returned as null.

Parameters:
form - Our DynaActionForm
property - The name of the property
Returns:
The value or null if an error occurs

doGetSubscription

protected Subscription doGetSubscription(HttpSession session)

Obtain the cached Subscription object, if any.

Parameters:
session - Our HttpSession
Returns:
Cached Subscription object or null

doGetSubscription

protected Subscription doGetSubscription(HttpServletRequest request)

Obtain the cached Subscription object, if any.

Parameters:
request - Our HttpServletRequest
Returns:
Cached Subscription object or null

doGetUserDatabase

protected UserDatabase doGetUserDatabase()

Return a reference to the UserDatabase or null if the database is not available.

Returns:
a reference to the UserDatabase or null if the database is not available

doGetUser

protected User doGetUser(HttpSession session)

Helper method to obtain User form session (if any).

Parameters:
session - Our HttpSession
Returns:
User object, or null if there is no user.

doGetUser

protected User doGetUser(HttpServletRequest request)

Helper method to obtain User form session (if any).

Parameters:
request - Our HttpServletRequest
Returns:
User object, or null if there is no user.

doInputForward

protected ActionForward doInputForward(ActionMapping mapping,
                                       HttpServletRequest request,
                                       ActionMessages errors)

Save any errors and the transactioonal token, and forward to the InputForard result.

Parameters:
mapping - Our ActionMapping
request - Our HttpServletRequest
errors - Our ActionMessages collectoin
Returns:
The InputForward for this mappintg

doLogProcess

protected void doLogProcess(ActionMapping mapping,
                            String method)

Log a "processing" message for an Action.

Parameters:
mapping - Our ActionMapping
method - Name of method being processed

doSaveToken

protected void doSaveToken(HttpServletRequest request)

Helper method to log event and save token.

Parameters:
request - Our HttpServletRequest

doSaveUser

protected void doSaveUser(User user)
                   throws ServletException

Persist the User object, including subscriptions, to the database.

Parameters:
user - Our User object
Throws:
ServletException - On any error

doSet

protected boolean doSet(ActionForm form,
                        String property,
                        String value)

Helper method to inject a String property into a DynaActionForm.

Parameters:
form - Our DynaActionForm
property - The name of the property
value - The value for the property
Returns:
True if the assignment succeeds


Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.