com.gisgraphy.webapp.action

## Class BaseAction

- java.lang.Object
- - com.opensymphony.xwork2.ActionSupport
  - - 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, Serializable
  Direct Known Subclasses:
    EditAlternateNameAction, EditFeatureAction, EditStreetAction, EditZipCodeAction, 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

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected String` | `cancel` Indicator if the user clicked cancel
    `static String` | `CANCEL` Constant for cancel result String
    `protected String` | `delete` Set to "delete" when a "delete" request parameter is passed in
    `protected 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 String` | `save` Set to "save" when a "save" request parameter is passed in
    `protected 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

    Constructors
    Constructor and Description
    `BaseAction()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `cancel()` Simple method that returns "cancel" result
    `protected 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(String msg)` Save the message in the session, appending if messages already exist
    `protected void` | `sendUserMessage(User user, String msg, String url)` Convenience method to send e-mail to users
    `void` | `setDelete(String delete)`
    `void` | `setFrom(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(String save)`
    `void` | `setTemplateName(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 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 String cancel

      Indicator if the user clicked cancel

    - #### from

          protected String from

      Indicator for the page the user came from.

    - #### delete

          protected String delete

      Set to "delete" when a "delete" request parameter is passed in

    - #### save

          protected 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 String templateName

      Velocity template to use for e-mailing

  - ### Constructor Detail

    - #### BaseAction

          public BaseAction()

  - ### Method Detail

    - #### cancel

          public String cancel()

      Simple method that returns "cancel" result
      Returns:
        "cancel"

    - #### saveMessage

          protected void saveMessage(String msg)

      Save the message in the session, appending if messages already exist
      Parameters:
        `msg` - the message to put in the session

    - #### getConfiguration

          protected 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,
                             String msg,
                             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(String templateName)

    - #### setFrom

          public void setFrom(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(String delete)

    - #### setSave

          public void setSave(String save)

Copyright © 2015. All rights reserved.