@WebMethod public ModelAndView logout() { ModelAndView mv = new ModelAndView(); ThreadSession.getHttpSession().removeAttribute("user"); ThreadSession.getHttpSession().removeAttribute(MakesiteConstant.Session_Auth_List); mv.redirect = ThreadSession.HttpServletRequest.get().getServletContext().getContextPath() + "/index.jsp"; String serverName = DataHelper.getServerName(ThreadSession.HttpServletRequest.get()); if (onlineUserCountMap.containsKey(serverName)) { onlineUserCountMap.put(serverName, onlineUserCountMap.get(serverName) - 1); } return mv; }
@WebMethod public ModelAndView getUserTree(String _site) { ModelAndView mv = new ModelAndView(); List<Group> groups = dao.listByParams(Group.class, "from Group where parentId is null and _site=?", _site); JSONArray arr = new JSONArray(); for (Group g : groups) { JSONObject jobj = new JSONObject(); jobj.put("name", g.name); jobj.put("id", g.id); jobj.put("key", "group_" + g.id); jobj.put("isParent", true); jobj.put("type", "group"); JSONArray children = getChildrenOfGroup(g.id, _site); if (!children.isEmpty()) { jobj.put("children", children); } arr.add(jobj); } mv.returnText = arr.toString(); return mv; }