com.gisgraphy.webapp.action
Class BaseAction

java.lang.Object
  extended by com.opensymphony.xwork2.ActionSupport
      extended by com.gisgraphy.webapp.action.BaseAction
All Implemented Interfaces:
com.opensymphony.xwork2.Action, com.opensymphony.xwork2.LocaleProvider, com.opensymphony.xwork2.TextProvider, com.opensymphony.xwork2.Validateable, com.opensymphony.xwork2.ValidationAware, java.io.Serializable
Direct Known Subclasses:
FileUploadAction, PasswordHintAction, ReloadAction, SignupAction, UserAction

public class BaseAction
extends com.opensymphony.xwork2.ActionSupport

Implementation of ActionSupport that contains convenience methods for subclasses. For example, getting the current user and saving messages/errors. This class is intended to be a base class for all Action classes.

Author:
Matt Raible
See Also:
Serialized Form

Field Summary
protected  java.lang.String cancel
          Indicator if the user clicked cancel
static java.lang.String CANCEL
          Constant for cancel result String
protected  java.lang.String delete
          Set to "delete" when a "delete" request parameter is passed in
protected  java.lang.String from
          Indicator for the page the user came from.
protected  org.apache.commons.logging.Log log
          Transient log to prevent session synchronization issues - children can use instance for logging.
protected  MailEngine mailEngine
          MailEngine for sending e-mail
protected  org.springframework.mail.SimpleMailMessage mailMessage
          A message pre-populated with default data
protected  RoleManager roleManager
          The RoleManager
protected  java.lang.String save
          Set to "save" when a "save" request parameter is passed in
protected  java.lang.String templateName
          Velocity template to use for e-mailing
protected  UserManager userManager
          The UserManager
 
Fields inherited from class com.opensymphony.xwork2.ActionSupport
LOG
 
Fields inherited from interface com.opensymphony.xwork2.Action
ERROR, INPUT, LOGIN, NONE, SUCCESS
 
Constructor Summary
BaseAction()
           
 
Method Summary
 java.lang.String cancel()
          Simple method that returns "cancel" result
protected  java.util.Map getConfiguration()
          Convenience method to get the Configuration HashMap from the servlet context.
protected  javax.servlet.http.HttpServletRequest getRequest()
          Convenience method to get the request
protected  javax.servlet.http.HttpServletResponse getResponse()
          Convenience method to get the response
protected  javax.servlet.http.HttpSession getSession()
          Convenience method to get the session.
protected  void saveMessage(java.lang.String msg)
          Save the message in the session, appending if messages already exist
protected  void sendUserMessage(User user, java.lang.String msg, java.lang.String url)
          Convenience method to send e-mail to users
 void setDelete(java.lang.String delete)
           
 void setFrom(java.lang.String from)
          Convenience method for setting a "from" parameter to indicate the previous page.
 void setMailEngine(MailEngine mailEngine)
           
 void setMailMessage(org.springframework.mail.SimpleMailMessage mailMessage)
           
 void setRoleManager(RoleManager roleManager)
           
 void setSave(java.lang.String save)
           
 void setTemplateName(java.lang.String templateName)
           
 void setUserManager(UserManager userManager)
           
 
Methods inherited from class com.opensymphony.xwork2.ActionSupport
addActionError, addActionMessage, addFieldError, clearActionErrors, clearErrors, clearErrorsAndMessages, clearFieldErrors, clearMessages, clone, doDefault, execute, getActionErrors, getActionMessages, getErrorMessages, getErrors, getFieldErrors, getLocale, getText, getText, getText, getText, getText, getText, getText, getText, getText, getTexts, getTexts, hasActionErrors, hasActionMessages, hasErrors, hasFieldErrors, hasKey, input, pause, setActionErrors, setActionMessages, setFieldErrors, validate
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CANCEL

public static final java.lang.String CANCEL
Constant for cancel result String

See Also:
Constant Field Values

log

protected final transient org.apache.commons.logging.Log log
Transient log to prevent session synchronization issues - children can use instance for logging.


userManager

protected UserManager userManager
The UserManager


roleManager

protected RoleManager roleManager
The RoleManager


cancel

protected java.lang.String cancel
Indicator if the user clicked cancel


from

protected java.lang.String from
Indicator for the page the user came from.


delete

protected java.lang.String delete
Set to "delete" when a "delete" request parameter is passed in


save

protected java.lang.String save
Set to "save" when a "save" request parameter is passed in


mailEngine

protected MailEngine mailEngine
MailEngine for sending e-mail


mailMessage

protected org.springframework.mail.SimpleMailMessage mailMessage
A message pre-populated with default data


templateName

protected java.lang.String templateName
Velocity template to use for e-mailing

Constructor Detail

BaseAction

public BaseAction()
Method Detail

cancel

public java.lang.String cancel()
Simple method that returns "cancel" result

Returns:
"cancel"

saveMessage

protected void saveMessage(java.lang.String msg)
Save the message in the session, appending if messages already exist

Parameters:
msg - the message to put in the session

getConfiguration

protected java.util.Map getConfiguration()
Convenience method to get the Configuration HashMap from the servlet context.

Returns:
the user's populated form from the session

getRequest

protected javax.servlet.http.HttpServletRequest getRequest()
Convenience method to get the request

Returns:
current request

getResponse

protected javax.servlet.http.HttpServletResponse getResponse()
Convenience method to get the response

Returns:
current response

getSession

protected javax.servlet.http.HttpSession getSession()
Convenience method to get the session. This will create a session if one doesn't exist.

Returns:
the session from the request (request.getSession()).

sendUserMessage

protected void sendUserMessage(User user,
                               java.lang.String msg,
                               java.lang.String url)
Convenience method to send e-mail to users

Parameters:
user - the user to send to
msg - the message to send
url - the URL to the application (or where ever you'd like to send them)

setUserManager

public void setUserManager(UserManager userManager)

setRoleManager

public void setRoleManager(RoleManager roleManager)

setMailEngine

public void setMailEngine(MailEngine mailEngine)

setMailMessage

public void setMailMessage(org.springframework.mail.SimpleMailMessage mailMessage)

setTemplateName

public void setTemplateName(java.lang.String templateName)

setFrom

public void setFrom(java.lang.String from)
Convenience method for setting a "from" parameter to indicate the previous page.

Parameters:
from - indicator for the originating page

setDelete

public void setDelete(java.lang.String delete)

setSave

public void setSave(java.lang.String save)


Copyright © 2010. All Rights Reserved.