Package com.dotmarketing.portlets.usermanager.struts

Examples of com.dotmarketing.portlets.usermanager.struts.UserManagerListSearchForm


  public static UserFilter getUserFilter(String inode) {
    return (UserFilter) InodeFactory.getInode(inode, UserFilter.class);
  }

  public static List<UserProxy> getUserProxiesFromFilter(UserFilter uf) throws Exception {
    UserManagerListSearchForm userForm = new UserManagerListSearchForm();
    BeanUtils.copyProperties(userForm, uf);
    List<UserProxy> userProxies = new ArrayList<UserProxy>();
    List allUsers = UserManagerListBuilderFactory.doSearch(userForm);
    Iterator it = allUsers.iterator();
    for (int i = 0; it.hasNext(); i++) {
View Full Code Here


    try
    {
      HttpSession session = WebContextFactory.get().getSession();

      //Get all the user of the filter
      UserManagerListSearchForm searchFormFullCommand = (UserManagerListSearchForm) session.getAttribute(WebKeys.USERMANAGERLISTPARAMETERS);
      searchFormFullCommand.setStartRow(0);
      searchFormFullCommand.setMaxRow(0);
      List matches = UserManagerListBuilderFactory.doSearch(searchFormFullCommand);

      //Get the Iterator and the userIds
      Iterator it = matches.iterator();
      for (int i = 0; it.hasNext(); i++)
View Full Code Here

    try
    {
      HttpSession session = WebContextFactory.get().getSession();

      //Get all the user of the filter
      UserManagerListSearchForm searchFormFullCommand = (UserManagerListSearchForm) session.getAttribute(WebKeys.USERMANAGERLISTPARAMETERS);
      searchFormFullCommand.setStartRow(0);
      searchFormFullCommand.setMaxRow(0);
      List matches = UserManagerListBuilderFactory.doSearch(searchFormFullCommand);

      //Get the Iterator and the userIds
      Iterator it = matches.iterator();
      for (int i = 0; it.hasNext(); i++)
View Full Code Here

      HttpServletRequest req = WebContextFactory.get().getHttpServletRequest();
      User currentUser = com.liferay.portal.util.PortalUtil.getUser(req);
      List<String> userIds =  new ArrayList<String>();

      //Get all the user of the filter
      UserManagerListSearchForm searchFormFullCommand = (UserManagerListSearchForm) session.getAttribute(WebKeys.USERMANAGERLISTPARAMETERS);
      searchFormFullCommand.setStartRow(0);
      searchFormFullCommand.setMaxRow(0);
      List matches = UserManagerListBuilderFactory.doSearch(searchFormFullCommand);

      //Get the Iterator and the userIds
      Iterator it = matches.iterator();
      for (int i = 0; it.hasNext(); i++)
View Full Code Here

    if(isFullCommand(req))
    {
      HttpSession session = ((ActionRequestImpl) req).getHttpServletRequest().getSession();

      //Get all the user of the filter
      UserManagerListSearchForm searchFormFullCommand = (UserManagerListSearchForm) session.getAttribute(WebKeys.USERMANAGERLISTPARAMETERS);
      searchFormFullCommand.setStartRow(0);
      searchFormFullCommand.setMaxRow(0);
      List matches = UserManagerListBuilderFactory.doSearch(searchFormFullCommand);

      //Create the String buffer
      StringBuffer userFullCommandSB = new StringBuffer();
View Full Code Here

                User user = retrieveMember(userId, userForm);
                Address address = retrieveAddress(user.getUserId());
                UserProxy userProxy = com.dotmarketing.business.APILocator.getUserProxyAPI().getUserProxy(user,APILocator.getUserAPI().getSystemUser(), false);

                UserManagerListSearchForm searchForm = new UserManagerListSearchForm();
                BeanUtils.copyProperties(searchForm, user);
                BeanUtils.copyProperties(searchForm, address);
                BeanUtils.copyProperties(searchForm, userProxy);

                if(UtilMethods.isSet(httpReq.getSession().getAttribute(WebKeys.WEBEVENTS_REG_USER))){
View Full Code Here

        // Getting the http request
        ActionRequestImpl reqImpl = (ActionRequestImpl) req;
        HttpServletRequest httpReq = reqImpl.getHttpServletRequest();

    String cmd = req.getParameter(com.liferay.portal.util.Constants.CMD);
    UserManagerListSearchForm searchForm = (UserManagerListSearchForm) form;

    _retrieveProperties(req, res, config, form);
    req.setAttribute(WebKeys.MAILING_LIST_VIEW, new ArrayList());
    if (com.liferay.portal.util.Constants.VIEW.equals(cmd)) {
      // viewing user filter
      try {
        _getUserFilter(form, req, res);

        req.setAttribute(WebKeys.USER_FILTER_LIST_INODE, searchForm.getUserFilterListInode());
        req.setAttribute(WebKeys.USER_FILTER_LIST_TITLE, searchForm.getUserFilterTitle());
        req.setAttribute(WebKeys.USERMANAGERLISTFORM, form);
        searchForm = (UserManagerListSearchForm) form;
        ViewUserManagerListAction._doSearch(searchForm, req, res);
       
        String referrer = req.getParameter("referrer");
        if (UtilMethods.isSet(referrer)) {
          res.sendRedirect(SecurityUtils.stripReferer(httpReq, referrer));
        } else {
          setForward(req, "portlet.ext.userfilter.edit_userfilter");
          return;
        }
      } catch (Exception e) {
        SessionMessages.add(req, "error", "message.userfilter.error.getting");
        _handleException(e, req);
      }
    }
    else if ("deleteUserFilter".equals(cmd)) {
      // deleting user filter
      try {

        _deleteUserFilter(form, req, res);

        String redirect = req.getParameter("redirect");
            redirect = URLDecoder.decode(redirect, "UTF-8");
            _sendToReferral(req, res, redirect);
            return;
      } catch (Exception e) {
        SessionMessages.add(req, "error", "message.userfilter.error.deleting_user_filter");
        _handleException(e, req);
      }
    }
    else if (com.liferay.portal.util.Constants.SAVE.equals(cmd)) {
      // Save / Update user filter
      try {
        _save(form, req, res);

        _getUserFilter(form, req, res);
       
        req.setAttribute(WebKeys.USER_FILTER_LIST_INODE, searchForm.getUserFilterListInode());
        req.setAttribute(WebKeys.USER_FILTER_LIST_TITLE, searchForm.getUserFilterTitle());
        req.setAttribute(WebKeys.USERMANAGERLISTFORM, form);
        searchForm = (UserManagerListSearchForm) form;
        ViewUserManagerListAction._doSearch(searchForm, req, res);

        String referrer = req.getParameter("referrer");
        if (UtilMethods.isSet(referrer)) {
          res.sendRedirect(SecurityUtils.stripReferer(httpReq, referrer));
        } else {
          setForward(req, "portlet.ext.userfilter.edit_userfilter");
          return;
        }
      } catch (Exception e) {
        SessionMessages.add(req, "error", "message.userfilter.error.creating");
        _handleException(e, req);
      }
    }
    else if (com.liferay.portal.util.Constants.SEARCH.equals(cmd)) {
      // Searching
      try {
        ViewUserManagerListAction._doSearch(searchForm, req, res);
        req.setAttribute(WebKeys.USER_FILTER_LIST_INODE, searchForm.getUserFilterListInode());
        req.setAttribute(WebKeys.USER_FILTER_LIST_TITLE, searchForm.getUserFilterTitle());
        req.setAttribute(WebKeys.USERMANAGERLISTFORM, form);
        setForward(req, "portlet.ext.userfilter.edit_userfilter");
        return;
      } catch (Exception e) {
        SessionMessages.add(req, "error", "message.userfilter.error.deleting_user");
        _handleException(e, req);
      }
    }
    else if (com.liferay.portal.util.Constants.DELETE.equals(cmd)) {
      // Deleting user
      try {
        _delete(form, req, res);

        if (UtilMethods.isSet(req.getParameter("returnPath"))) {
          setForward(req, SecurityUtils.stripReferer(httpReq, req.getParameter("returnPath")));
        }
        else {
          _getUserFilter(form, req, res);
         
          req.setAttribute(WebKeys.USER_FILTER_LIST_INODE, searchForm.getUserFilterListInode());
          req.setAttribute(WebKeys.USER_FILTER_LIST_TITLE, searchForm.getUserFilterTitle());
          req.setAttribute(WebKeys.USERMANAGERLISTFORM, form);
          searchForm = (UserManagerListSearchForm) form;
        }

        ViewUserManagerListAction._doSearch(searchForm, req, res);
        req.setAttribute(WebKeys.USERMANAGERLISTFORM, form);

        String referrer = req.getParameter("referrer");
        if (UtilMethods.isSet(referrer)) {
          res.sendRedirect(SecurityUtils.stripReferer(httpReq, referrer));
        } else {
          setForward(req, "portlet.ext.userfilter.edit_userfilter");
          return;
        }
      } catch (Exception e) {
        SessionMessages.add(req, "error", "message.userfilter.error.deleting_user");
        _handleException(e, req);
      }
    }
    else if (com.liferay.portal.util.Constants.EDIT.equals(cmd)) {
      _getUserFilter(form, req, res);
     
      req.setAttribute(WebKeys.USER_FILTER_LIST_INODE, searchForm.getUserFilterListInode());
      req.setAttribute(WebKeys.USER_FILTER_LIST_TITLE, searchForm.getUserFilterTitle());
      searchForm = (UserManagerListSearchForm) form;
      ViewUserManagerListAction._doSearch(searchForm, req, res);
      req.setAttribute(WebKeys.USERMANAGERLISTFORM, form);

      setForward(req, "portlet.ext.userfilter.edit_userfilter");
View Full Code Here

  //Adding / Saving User Filter
  private void _save(ActionForm form, ActionRequest req, ActionResponse res)
  throws Exception {
    User user = _getUser(req);
    PermissionAPI perAPI = APILocator.getPermissionAPI();
    UserManagerListSearchForm mlForm = (UserManagerListSearchForm) form;
    UserFilter uf;
    if (InodeUtils.isSet(mlForm.getUserFilterListInode())) {
      uf = (UserFilter) InodeFactory.getInode(mlForm.getUserFilterListInode(), UserFilter.class);

      //removing permissions on the user filter\
      perAPI.removePermissions(uf);
    }
    else {
      uf = new UserFilter();
    }

    BeanUtils.copyProperties(uf, mlForm);
    uf.setCategories(mlForm.getCategoriesStr());
    HibernateUtil.startTransaction();
    HibernateUtil.saveOrUpdate(uf);
    HibernateUtil.commitTransaction();

    // read permission
    String[] readPermissions = req.getParameterValues("readRole");
    // write permission
    String[] writePermissions = req.getParameterValues("writeRole");
    //adding roles to user filter
    Permission permission = null;
    if (readPermissions != null) {
      for (int n = 0; n < readPermissions.length; n++) {
        permission = new Permission(uf.getInode(), readPermissions[n], PERMISSION_READ);
        perAPI.save(permission, uf, user, false);
      }
    }

    if (writePermissions != null) {
      for (int n = 0; n < writePermissions.length; n++) {
        permission = new Permission(uf.getInode(), writePermissions[n],  PERMISSION_WRITE);
        perAPI.save(permission, uf, user, false);
      }
    }
    mlForm.setUserFilterListInode(uf.getInode());
    SessionMessages.add(req, "message", "message.userfilter.save");
  }
View Full Code Here

  //Getting User Filter
  private void _getUserFilter(ActionForm form, ActionRequest req, ActionResponse res)
  throws Exception {
    String inode = req.getParameter("inode");
    UserManagerListSearchForm searchForm = (UserManagerListSearchForm) form;

    if (!InodeUtils.isSet(inode)) {
      inode = searchForm.getUserFilterListInode();
    }
   
    if (InodeUtils.isSet(inode)) {
      UserFilter uf = UserFilterFactory.getUserFilter(inode);
 
      searchForm.setUserFilterListInode(inode);
 
      BeanUtils.copyProperties(searchForm, uf);
      searchForm.setCategories(uf.getCategoriesArray());
    }
  }
View Full Code Here

        HttpServletRequest request = ((RenderRequestImpl) req).getHttpServletRequest();

        String cmd = req.getParameter("cmd");

        UserManagerListSearchForm searchForm = (UserManagerListSearchForm) form;

        String userId = request.getParameter("userId");
        if (userId != null && !userId.equalsIgnoreCase("")) {
            String[] arrayUserIds = new String[1];
            arrayUserIds[0] = userId;
            searchForm.setArrayUserIds(arrayUserIds);
        }

        try {

            User user = com.liferay.portal.util.PortalUtil.getUser(req);
            List list = null;
            List roles = APILocator.getRoleAPI().loadRolesForUser(user.getUserId());
            Iterator rolesIt = roles.iterator();
            boolean isMarketingAdmin = false;
            while (rolesIt.hasNext()) {
                Role role = (Role) rolesIt.next();
                if (role.getName().equals(Config.getStringProperty("MAILINGLISTS_ADMIN_ROLE"))) {
                    isMarketingAdmin = true;
                    break;
                }
            }
            if (isMarketingAdmin) {
                list = MailingListFactory.getAllMailingLists();
            } else {
                list = MailingListFactory.getMailingListsByUser(user);
                list.add(MailingListFactory.getUnsubscribersMailingList());
            }

            req.setAttribute(WebKeys.MAILING_LIST_VIEW, list);

            if ("load".equals(cmd)) {

                try {
                    return mapping.findForward("portlet.ext.usermanager.load_users");
                } catch (Exception e) {
                    _handleException(e, req, mapping);
                }
            }

            UserManagerPropertiesFactory._getFieldDisplayConfiguration(req);
            if ("config".equals(cmd)) {
                try {
                    return mapping.findForward("portlet.ext.usermanager.edit_usermanagerfields");
                } catch (Exception e) {
                    _handleException(e, req, mapping);
                }
            }
            if ("saveFile".equals(cmd)) {
                try {
                    UserManagerPropertiesFactory._add(req, res, config, form);
                    UserManagerPropertiesFactory._save(req, res, config, form);
                } catch (Exception ae) {
                    _handleException(ae, req, mapping);
                }
                return mapping.findForward("portlet.ext.usermanager.edit_usermanagerfields");
            }

            // Delete usermanager
            if (com.liferay.portal.util.Constants.DELETE.equals(cmd)) {
                try {
                    _delete(form, req, res);
                    cmd = com.liferay.portal.util.Constants.SEARCH;
                } catch (Exception e) {
                    _handleException(e, req, mapping);
                }
            }

            HttpSession sess = ((RenderRequestImpl) req).getHttpServletRequest().getSession();

            if (!Validator.validate(request, searchForm, mapping)) {
                if (req.getWindowState().equals(WindowState.NORMAL)) {
                    return mapping.findForward("portlet.ext.usermanager.view");
                } else {
                    if (cmd != null && cmd.equals(com.liferay.portal.util.Constants.SEARCH)) {
                        _doSearch(searchForm, req, res);
                    }
                    req.setAttribute(WebKeys.USERMANAGERLISTFORM, searchForm);

                    return mapping.findForward("portlet.ext.usermanager.view_usermanagerlist");
                }
            }
            if (req.getWindowState().equals(WindowState.NORMAL)) {
                req.setAttribute(WebKeys.USERMANAGERLISTFORM, searchForm);
                return mapping.findForward("portlet.ext.usermanager.view");
            } else {
                if (searchForm.getPage() == 0) {
                    if (sess.getAttribute(WebKeys.USERMANAGERLISTFORM) != null) {
                        searchForm = (UserManagerListSearchForm) sess.getAttribute(WebKeys.USERMANAGERLISTFORM);
                        form = searchForm;
                        if (cmd == null) {
                            _doSearch(searchForm, req, res);
View Full Code Here

TOP

Related Classes of com.dotmarketing.portlets.usermanager.struts.UserManagerListSearchForm

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.