Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.jeteam.bean.user.web
Class UserCRUDDispatchAction  view UserCRUDDispatchAction download UserCRUDDispatchAction.java

java.lang.Object
  extended byorg.apache.struts.action.Action
      extended byorg.apache.struts.actions.DispatchAction
          extended byorg.jeteam.bean.common.web.AbstractCRUDDispatchAction
              extended byorg.jeteam.bean.user.web.UserCRUDDispatchAction

public class UserCRUDDispatchAction
extends org.jeteam.bean.common.web.AbstractCRUDDispatchAction


Field Summary
 
Fields inherited from class org.apache.struts.actions.DispatchAction
clazz, log, messages, methods, types
 
Fields inherited from class org.apache.struts.action.Action
defaultLocale, servlet
 
Constructor Summary
UserCRUDDispatchAction()
           
 
Method Summary
 org.apache.struts.action.ActionForward create(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Reads the user name, password, first name, last name, email and description properties from the form bean and creates a new user from it.
private  org.jeteam.bean.project.ProjectDTO[] getProjects(UserCRUDDispatchForm dataForm)
          Retrieves the selected projects from the form bean and returns the associated DTOs.
private  org.jeteam.bean.security.RoleDTO[] getRoles(UserCRUDDispatchForm dataForm)
          Retrieves the selected roles from the form bean and returns the associated DTOs.
private  org.jeteam.bean.user.UserDTO getUser(UserCRUDDispatchForm dataForm)
          Gets the user as a DTO from the form bean.
 org.apache.struts.action.ActionForward goCreate(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Sets the roles and projects into the form bean and forwards to "create".
 org.apache.struts.action.ActionForward goRead(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Sets the users in the form bean and forwards to "read".
 org.apache.struts.action.ActionForward goRemove(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Sets the users in the form bean and forwards to "remove".
 org.apache.struts.action.ActionForward goUpdate(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Sets the users, roles and projects in the form bean and forwards to "update".
 org.apache.struts.action.ActionForward populate(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Populates the form with the values of the user DTO instance corresponding with the current user name.
 org.apache.struts.action.ActionForward read(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Reads the user name from the form bean and loads all data associated to this user in the same bean.
 org.apache.struts.action.ActionForward remove(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Reads the list of users from the form bean and uses the specified user name in that bean to remove that specific user from the list.
private  void setRequestParameterValue(javax.servlet.http.HttpServletRequest request, UserCRUDDispatchForm dataForm)
          Reads the request and looks for a parameter with key "item", if found this value will be set as the user's username in the form bean.
 org.apache.struts.action.ActionForward unspecified(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          This is the default executor for this dispatch action, it will simply return the "home" forward.
 org.apache.struts.action.ActionForward update(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Reads the user name, description, email, first name and last name from the form bean and updates the specified user with this new information.
 
Methods inherited from class org.apache.struts.actions.DispatchAction
cancelled, dispatchMethod, execute, getMethod, getMethodName, getParameter
 
Methods inherited from class org.apache.struts.action.Action
addErrors, addMessages, execute, generateToken, getDataSource, getDataSource, getErrors, getLocale, getMessages, getResources, getResources, getServlet, isCancelled, isTokenValid, isTokenValid, resetToken, saveErrors, 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
 

Constructor Detail

UserCRUDDispatchAction

public UserCRUDDispatchAction()
Method Detail

unspecified

public org.apache.struts.action.ActionForward unspecified(org.apache.struts.action.ActionMapping mapping,
                                                          org.apache.struts.action.ActionForm form,
                                                          javax.servlet.http.HttpServletRequest request,
                                                          javax.servlet.http.HttpServletResponse response)
                                                   throws java.lang.Exception
This is the default executor for this dispatch action, it will simply return the "home" forward.


populate

public org.apache.struts.action.ActionForward populate(org.apache.struts.action.ActionMapping mapping,
                                                       org.apache.struts.action.ActionForm form,
                                                       javax.servlet.http.HttpServletRequest request,
                                                       javax.servlet.http.HttpServletResponse response)
                                                throws java.lang.Exception
Populates the form with the values of the user DTO instance corresponding with the current user name.

Forwards to "update".


goRead

public org.apache.struts.action.ActionForward goRead(org.apache.struts.action.ActionMapping mapping,
                                                     org.apache.struts.action.ActionForm form,
                                                     javax.servlet.http.HttpServletRequest request,
                                                     javax.servlet.http.HttpServletResponse response)
                                              throws java.lang.Exception
Sets the users in the form bean and forwards to "read".

If there is a request parameter with key "userName" or the form bean has a non-null "userName" property this method will execute a call to read(...) to populate the form bean with the properties of the user associated with the specified user name, prior to forwarding.


goCreate

public org.apache.struts.action.ActionForward goCreate(org.apache.struts.action.ActionMapping mapping,
                                                       org.apache.struts.action.ActionForm form,
                                                       javax.servlet.http.HttpServletRequest request,
                                                       javax.servlet.http.HttpServletResponse response)
                                                throws java.lang.Exception
Sets the roles and projects into the form bean and forwards to "create".


goUpdate

public org.apache.struts.action.ActionForward goUpdate(org.apache.struts.action.ActionMapping mapping,
                                                       org.apache.struts.action.ActionForm form,
                                                       javax.servlet.http.HttpServletRequest request,
                                                       javax.servlet.http.HttpServletResponse response)
                                                throws java.lang.Exception
Sets the users, roles and projects in the form bean and forwards to "update".


goRemove

public org.apache.struts.action.ActionForward goRemove(org.apache.struts.action.ActionMapping mapping,
                                                       org.apache.struts.action.ActionForm form,
                                                       javax.servlet.http.HttpServletRequest request,
                                                       javax.servlet.http.HttpServletResponse response)
                                                throws java.lang.Exception
Sets the users in the form bean and forwards to "remove".


read

public org.apache.struts.action.ActionForward read(org.apache.struts.action.ActionMapping mapping,
                                                   org.apache.struts.action.ActionForm form,
                                                   javax.servlet.http.HttpServletRequest request,
                                                   javax.servlet.http.HttpServletResponse response)
                                            throws java.lang.Exception
Reads the user name from the form bean and loads all data associated to this user in the same bean.

Always forwards to "read" (in case of success or failure).


create

public org.apache.struts.action.ActionForward create(org.apache.struts.action.ActionMapping mapping,
                                                     org.apache.struts.action.ActionForm form,
                                                     javax.servlet.http.HttpServletRequest request,
                                                     javax.servlet.http.HttpServletResponse response)
                                              throws java.lang.Exception
Reads the user name, password, first name, last name, email and description properties from the form bean and creates a new user from it. In case of success it forwards to "home", otherwise it forwards to "failure".


remove

public org.apache.struts.action.ActionForward remove(org.apache.struts.action.ActionMapping mapping,
                                                     org.apache.struts.action.ActionForm form,
                                                     javax.servlet.http.HttpServletRequest request,
                                                     javax.servlet.http.HttpServletResponse response)
                                              throws java.lang.Exception
Reads the list of users from the form bean and uses the specified user name in that bean to remove that specific user from the list. Fowards to "home" in case of success, to "failure" otherwise.


update

public org.apache.struts.action.ActionForward update(org.apache.struts.action.ActionMapping mapping,
                                                     org.apache.struts.action.ActionForm form,
                                                     javax.servlet.http.HttpServletRequest request,
                                                     javax.servlet.http.HttpServletResponse response)
                                              throws java.lang.Exception
Reads the user name, description, email, first name and last name from the form bean and updates the specified user with this new information. Forwards to "home" in case of success, to "failure" otherwise.

Please note that the user name cannot be changed.


getUser

private final org.jeteam.bean.user.UserDTO getUser(UserCRUDDispatchForm dataForm)
Gets the user as a DTO from the form bean.

The user name String value is used to lookup the corresponding DTO instance, this one is returned. In case none is found this method returns null.


getProjects

private final org.jeteam.bean.project.ProjectDTO[] getProjects(UserCRUDDispatchForm dataForm)
Retrieves the selected projects from the form bean and returns the associated DTOs.

For all selected project names a lookup is performed to find the corresponding DTO instance. This method never returns null, in case no project is returned the array will be of size 0.


getRoles

private final org.jeteam.bean.security.RoleDTO[] getRoles(UserCRUDDispatchForm dataForm)
Retrieves the selected roles from the form bean and returns the associated DTOs.

For all selected role names a lookup is performed to find the corresponding DTO instance. This method never returns null, in case no role is returned the array will be of size 0.


setRequestParameterValue

private final void setRequestParameterValue(javax.servlet.http.HttpServletRequest request,
                                            UserCRUDDispatchForm dataForm)
Reads the request and looks for a parameter with key "item", if found this value will be set as the user's username in the form bean.