com.gisgraphy.webapp.action

## Class UserAction

- java.lang.Object
- - com.opensymphony.xwork2.ActionSupport
  - - com.gisgraphy.webapp.action.BaseAction
    - - com.gisgraphy.webapp.action.UserAction

- All Implemented Interfaces:
    com.opensymphony.xwork2.Action, com.opensymphony.xwork2.LocaleProvider, com.opensymphony.xwork2.Preparable, com.opensymphony.xwork2.TextProvider, com.opensymphony.xwork2.Validateable, com.opensymphony.xwork2.ValidationAware, Serializable

      public class UserAction
      extends BaseAction
      implements com.opensymphony.xwork2.Preparable

  Action for facilitating User Management feature.
  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from class com.gisgraphy.webapp.action.BaseAction

      `cancel, CANCEL, delete, from, log, mailEngine, mailMessage, roleManager, save, templateName, 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
    `UserAction()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `cancel()` Sends users to "mainMenu" when !
    `String` | `delete()` Delete the user passed in.
    `String` | `edit()` Grab the user from the database based on the "id" passed in.
    `String` | `execute()` Default: just returns "success"
    `User` | `getUser()`
    `List<User>` | `getUsers()` Holder for users to display on list screen
    `String` | `list()` Fetch all users from database and put into local "users" variable for retrieval in the UI.
    `void` | `prepare()` Grab the entity from the database before populating with request parameters
    `String` | `save()` Save user
    `void` | `setId(String id)`
    `void` | `setUser(User user)`

    - ### Methods inherited from class com.gisgraphy.webapp.action.BaseAction

      `getConfiguration, getRequest, getResponse, getSession, saveMessage, sendUserMessage, setDelete, setFrom, setMailEngine, setMailMessage, setRoleManager, setSave, setTemplateName, setUserManager`

    - ### Methods inherited from class com.opensymphony.xwork2.ActionSupport

      `addActionError, addActionMessage, addFieldError, clearActionErrors, clearErrors, clearErrorsAndMessages, clearFieldErrors, clearMessages, clone, doDefault, 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`

- - ### Constructor Detail

    - #### UserAction

          public UserAction()

  - ### Method Detail

    - #### prepare

          public void prepare()

      Grab the entity from the database before populating with request parameters
      Specified by:
        `prepare` in interface `com.opensymphony.xwork2.Preparable`

    - #### getUsers

          public List<User> getUsers()

      Holder for users to display on list screen
      Returns:
        list of users

    - #### setId

          public void setId(String id)

    - #### getUser

          public User getUser()

    - #### setUser

          public void setUser(User user)

    - #### delete

          public String delete()

      Delete the user passed in.
      Returns:
        success

    - #### edit

          public String edit()
                      throws IOException

      Grab the user from the database based on the "id" passed in.
      Returns:
        success if user found
      Throws:
        `IOException` - can happen when sending a "forbidden" from response.sendError()

    - #### execute

          public String execute()

      Default: just returns "success"
      Specified by:
        `execute` in interface `com.opensymphony.xwork2.Action`
      Overrides:
        `execute` in class `com.opensymphony.xwork2.ActionSupport`
      Returns:
        "success"

    - #### cancel

          public String cancel()

      Sends users to "mainMenu" when !from.equals("list"). Sends everyone else to "cancel"
      Overrides:
        `cancel` in class `BaseAction`
      Returns:
        "mainMenu" or "cancel"

    - #### save

          public String save()
                      throws IOException

      Save user
      Returns:
        success if everything worked, otherwise input
      Throws:
        `IOException` - when setting "access denied" fails on response

    - #### list

          public String list()

      Fetch all users from database and put into local "users" variable for retrieval in the UI.
      Returns:
        "success" if no exceptions thrown

Copyright © 2015. All rights reserved.