1 14 package org.jahia.admin.users; 15 16 import java.io.IOException ; 17 import javax.servlet.ServletException ; 18 import javax.servlet.http.HttpServletRequest ; 19 import javax.servlet.http.HttpServletResponse ; 20 import javax.servlet.http.HttpSession ; 21 22 import org.jahia.bin.JahiaAdministration; 23 import org.jahia.data.JahiaData; 24 import org.jahia.data.viewhelper.principal.PrincipalViewHelper; 25 import org.jahia.params.ParamBean; 26 import org.jahia.registries.ServicesRegistry; 27 import org.jahia.resourcebundle.JahiaResourceBundle; 28 import org.jahia.services.sites.JahiaSite; 29 import org.jahia.services.usermanager.JahiaUserManagerService; 30 31 39 public class GroupMembersTool 40 { 41 private static final String CLASS_NAME = GroupMembersTool.class.getName(); 42 private static final String JSP_PATH = JahiaAdministration.JSP_PATH; 43 44 private JahiaSite jahiaSite; 45 46 public static final String ENGINE_LAUNCHER_NAME = CLASS_NAME; 47 48 55 public GroupMembersTool(HttpServletRequest request, HttpServletResponse response, 56 HttpSession session) 57 { 58 jahiaSite = (JahiaSite)session.getAttribute(ParamBean.SESSION_SITE); 60 requestDispatcher(request, response, session); 62 } 63 64 71 public void requestDispatcher(HttpServletRequest request, 72 HttpServletResponse response, 73 HttpSession session) 74 { 75 String operation = request.getParameter("subaction"); 76 if (operation.equals("display")) { 77 displayGroupMembersTool(request, response, session); 78 } else if (operation.equals("search")) { 79 displayGroupMembersTool(request, response, session); 80 } 81 } 82 83 92 private void doRedirect(HttpServletRequest request, 93 HttpServletResponse response, 94 HttpSession session, 95 String target ) 96 { 97 try { 98 JahiaAdministration.doRedirect(request, response, session, target); 99 } catch (IOException ie) { 100 logger.error("Error", ie); 101 } catch (ServletException se) { 102 logger.error("Error", se.getRootCause()); 103 } 104 } 105 106 113 private void displayGroupMembersTool(HttpServletRequest request, 114 HttpServletResponse response, 115 HttpSession session) 116 { 117 logger.debug("Started"); 118 JahiaUserManagerService uMgr = ServicesRegistry.getInstance().getJahiaUserManagerService(); 119 request.setAttribute("providerList", uMgr.getProviderList()); 120 request.setAttribute("resultList", PrincipalViewHelper.getSearchResult(request, jahiaSite.getID())); 121 request.setAttribute("userSearch", JSP_PATH + "user_management/user_search.jsp"); 122 request.setAttribute("jspSource", JSP_PATH + "group_management/group_members_tool.jsp"); 123 JahiaData jData = (JahiaData)request.getAttribute ("org.jahia.data.JahiaData"); 124 ParamBean jParams = null; 125 if (jData != null) { 126 jParams = jData.params (); 127 } 128 session.setAttribute("jahiaDisplayMessage", 129 JahiaResourceBundle.getAdminResource("org.jahia.admin.copyright", 130 jParams, jParams.getLocale())); 131 doRedirect(request, response, session, JSP_PATH + "adminpopup.jsp"); 132 } 133 134 private static org.apache.log4j.Logger logger = 135 org.apache.log4j.Logger.getLogger(GroupMembersTool.class); 136 137 } 138 | Popular Tags |