Package evolaris.platform.um.web.form

Examples of evolaris.platform.um.web.form.UserSetEnterOrEditForm


   *      org.apache.struts.action.ActionForm,
   *      javax.servlet.http.HttpServletRequest,
   *      javax.servlet.http.HttpServletResponse)
   */
  public ActionForward create(ActionMapping mapping, ActionForm form,HttpServletRequest req, HttpServletResponse resp)  {
    UserSetEnterOrEditForm userSetEnterOrEditForm = (UserSetEnterOrEditForm) form;
    Group group = this.getCurrentGroup(req);
    UserSet userSet = new UserSet();
    userSet.setGroup(group);
    userSet.setDescription(userSetEnterOrEditForm.getDescription());
    userSet.setName(userSetEnterOrEditForm.getUserSetName());
    userSet.setHidden(userSetEnterOrEditForm.getHidden()==true?1:0);
    checkAccessRights(req, userSet.getGroup());
    UserSetManager userSetManager = new UserSetManager(locale,session);
    userSetManager.createUserSet(userSet);
    LOGGER.info("User " + req.getUserPrincipal().getName().toLowerCase() + ": Created user set `"+ userSet.getName() + "`" + " in group `" + group.getGroupname() + "`");
    return mapping.findForward("created");
View Full Code Here


   *      org.apache.struts.action.ActionForm,
   *      javax.servlet.http.HttpServletRequest,
   *      javax.servlet.http.HttpServletResponse)
   */
  public ActionForward modify(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) {
    UserSetEnterOrEditForm userSetEnterOrEditForm = (UserSetEnterOrEditForm) form;
    UserSetManager userSetManager = new UserSetManager(locale,session);
    Long id = userSetEnterOrEditForm.getId();
    UserSet userSet = userSetManager.getUserSet(id);
    if (userSet == null){
      throw new InputException(getResources(req).getMessage(locale, "um.userSetNotFound",  id));
    }
    checkAccessRights(req, userSet.getGroup());
    userSet.setName(userSetEnterOrEditForm.getUserSetName());
    userSet.setDescription(userSetEnterOrEditForm.getDescription());
    userSet.setHidden(userSetEnterOrEditForm.getHidden()==true?1:0);
    userSetManager.modifyUserSet(userSet);
    return mapping.findForward("modified");
  }
View Full Code Here

   *      javax.servlet.http.HttpServletRequest,
   *      javax.servlet.http.HttpServletResponse)
   */
  public ActionForward edit(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) {
    UserSetManager userSetManager = new UserSetManager(locale,session);
    UserSetEnterOrEditForm userSetEnterOrEditForm = (UserSetEnterOrEditForm) form;
    String idParameter = req.getParameter("id");
    long id = Long.valueOf(idParameter);
    LOGGER.info("User " + req.getUserPrincipal().getName().toLowerCase() + ": Requested ID  parameter = `"+ idParameter + "`");
    UserSet userSet = userSetManager.getUserSet(id);
    if (userSet == null){
      throw new InputException(getResources(req).getMessage(locale, "um.userSetNotFound",  id));
    }
    checkAccessRights(req, userSet.getGroup());
    userSetEnterOrEditForm.setId(id);
    userSetEnterOrEditForm.setDescription(userSet.getDescription());
    userSetEnterOrEditForm.setUserSetName(userSet.getName());
    userSetEnterOrEditForm.setHidden(userSet.getHidden()==1?true:false);
    return mapping.findForward("edit");
  }
View Full Code Here

    return delete(mapping, form, req,true);
  }
 
  // common delete method
  private ActionForward delete(ActionMapping mapping, ActionForm form, HttpServletRequest req,boolean withUsers) {
    UserSetEnterOrEditForm userSetEnterOrEditForm = (UserSetEnterOrEditForm) form;
    UserSetManager userSetManager = new UserSetManager(locale,session);
    Long id = userSetEnterOrEditForm.getId();
    UserSet userSet = userSetManager.getUserSet(id);
    if (userSet == null){
      throw new InputException(getResources(req).getMessage(locale, "um.userSetNotFound",  id));
    }
    checkAccessRights(req, userSet.getGroup());
View Full Code Here

    return createWithOrWithoutUsers(mapping, form, req, resp, true);
  }

  // Creates duplicated user set with or without users
  private ActionForward createWithOrWithoutUsers(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp, boolean includeUserAssignments) {
    UserSetEnterOrEditForm userSetEnterOrEditForm = (UserSetEnterOrEditForm) form;
    long originalUserSetId = userSetEnterOrEditForm.getOriginalId();
    UserSetManager userSetManager = new UserSetManager(locale,session);
    UserSet originalUserSet = userSetManager.getUserSet(originalUserSetId);
    if (originalUserSet == null){
      throw new InputException(getResources(req).getMessage(locale, "um.userSetNotFound",  originalUserSetId));
    }
    checkAccessRights(req, originalUserSet.getGroup());
    Group group = new GroupManager(locale,session).getGroup(userSetEnterOrEditForm.getGroupId());
    boolean differentGroup = group != originalUserSet.getGroup();
    if (includeUserAssignments && differentGroup && !userSetEnterOrEditForm.isConfirmationPending() && originalUserSet.getUsers().size() >= 1){
      userSetEnterOrEditForm.setConfirmationPending(true);
      String reallyDuplicate1 = getResources(req).getMessage(locale,"um.reallyDuplicate1");
      String reallyDuplicate2 = getResources(req).getMessage(locale,"um.reallyDuplicate2");
      req.setAttribute("generalError",reallyDuplicate1 + " " + originalUserSet.getUsers().size() + " " + reallyDuplicate2);
      return mapping.findForward("confirm");
    }
    userSetEnterOrEditForm.setConfirmationPending(false);
    UserSet newUserSet = userSetManager.duplicate(originalUserSet,group,userSetEnterOrEditForm.getUserSetName(),includeUserAssignments);
    checkAccessRights(req, newUserSet.getGroup());
    newUserSet.setDescription(userSetEnterOrEditForm.getDescription());
    newUserSet.setHidden(userSetEnterOrEditForm.getHidden()==true?1:0);
    userSetManager.modifyUserSet(newUserSet);
    setCurrentGroup(req, resp, group); // switch group in global group selection
    return mapping.findForward("created");
  }
View Full Code Here

   *      javax.servlet.http.HttpServletResponse)
   */
  public ActionForward edit(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) {
    GroupManager groupManager = new GroupManager(locale,session);
    UserSetManager userSetManager = new UserSetManager(locale,session);
    UserSetEnterOrEditForm userSetEnterOrEditForm = (UserSetEnterOrEditForm) form;
    if (!userSetEnterOrEditForm.isConfirmationPending()){
      String idParameter = req.getParameter("id");
      long id = Long.valueOf(idParameter);
      UserSet userSet = userSetManager.getUserSet(id);
      if (userSet == null){
        throw new InputException(getResources(req).getMessage(locale, "um.userSetNotFound",  id));
      }
      checkAccessRights(req,userSet.getGroup());
      userSetEnterOrEditForm.setOriginalId(id);
      userSetEnterOrEditForm.setId(id);
      userSetEnterOrEditForm.setDescription(userSet.getDescription());
      userSetEnterOrEditForm.setHidden(userSet.getHidden()==1?true:false);
      userSetEnterOrEditForm.setUserSetName(req.isUserInRole(UserManagerBase.ADMINISTRATOR) ? userSet.getName() :  getResources(req).getMessage(locale, "um.Copy") + ": " + userSet.getName());
      Group group = userSet.getGroup();
      userSetEnterOrEditForm.setGroupId(group.getId());
      userSetEnterOrEditForm.setGroupname(group.getGroupname());
      Group[] groups = groupManager.getGroups();
      req.getSession().setAttribute("groups", groups)// must be in session, because the form may be redisplayed on validation errors
    }
    return mapping.findForward("edit");
  }
View Full Code Here

TOP

Related Classes of evolaris.platform.um.web.form.UserSetEnterOrEditForm

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.