protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String strUserId = req.getParameter("userId"); Object userId = WebUtil.convertUserId(req, strUserId); UserManager userManager = WebUtil.getUserManager(req); User user = new User(); user.setId(userId); user = userManager.selectById(user); UserRoleManager userRoleManager = WebUtil.getUserRoleManager(req); Collection assignedRoles = userRoleManager.getRoles(userId); Set assignedRoleIds = new HashSet(); for (Iterator iter = assignedRoles.iterator(); iter.hasNext(); ) { Role role = (Role) iter.next(); assignedRoleIds.add(new Integer(role.getId())); } // search key String searchName = req.getParameter("name"); if (searchName != null) { searchName = new String(searchName.getBytes("ISO-8859-1"), "UTF-8"); } RoleManager roleMng = WebUtil.getRoleManager(req); Collection roles = null; if (StringUtil.isEmpty(searchName)) { roles = roleMng.getAllRoles(); } else { roles = roleMng.getLikelyRoles(searchName); } req.setAttribute("roles", roles); req.setAttribute("assignedRoleIds", assignedRoleIds); req.setAttribute("user", user); WebUtil.forward(req, resp, "/ralasafe/user/userRoles.jsp"); }
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String oper = req.getParameter("oper"); String tableAlias = req.getParameter("tableAlias"); String columnName = req.getParameter("columnName"); QueryDesignHandler handler = getHandler(req); req.setAttribute("handler", handler); if (log.isDebugEnabled()) { log.debug( "oper=" + oper + ", query=" + handler.getQuery().getName() + ", tableAlias=" + tableAlias + ", columnName=" + columnName); } if ("designTables".equals(oper)) { WebUtil.forward(req, resp, "/ralasafe/query/tables.jsp"); return; } else if ("viewTable".equals(oper)) { Table[] tables = handler.getQuery().getQueryTypeSequence().getFrom().getTable(); for (int i = 0; i < tables.length; i++) { Table table = tables[i]; if (table.getAlias().equals(tableAlias)) { req.setAttribute("table", table); i = tables.length; } } WebUtil.forward(req, resp, "/ralasafe/query/table.jsp"); return; } else if ("getColumn".equals(oper)) { Column column = handler.getColumn(tableAlias, columnName); String[][] mappingClassPropertyAndTypes = handler.getMappingClassPropertyAndTypes(); req.setAttribute("column", column); req.setAttribute("mappingClassPropertyAndTypes", mappingClassPropertyAndTypes); WebUtil.forward(req, resp, "/ralasafe/query/editColumn.jsp"); return; } else if ("getGroupColumn".equals(oper)) { Column column = handler.getGroupColumn(tableAlias, columnName); req.setAttribute("column", column); WebUtil.forward(req, resp, "/ralasafe/query/editGroupColumn.jsp"); return; } else if ("getOrderColumn".equals(oper)) { Column column = handler.getOrderColumn(tableAlias, columnName); req.setAttribute("column", column); WebUtil.forward(req, resp, "/ralasafe/query/editOrderColumn.jsp"); return; } else if ("designGroup".equals(oper)) { WebUtil.forward(req, resp, "/ralasafe/query/group.jsp"); return; } else if ("designOrder".equals(oper)) { WebUtil.forward(req, resp, "/ralasafe/query/order.jsp"); return; } else if ("designWhere".equals(oper)) { WebUtil.forward(req, resp, "/ralasafe/query/where.jsp"); return; } else if ("whereExprContextMenu".equals(oper)) { String nodeId = req.getParameter("nodeId"); Object item = handler.getWhereExprItem(nodeId); req.setAttribute("item", item); WebUtil.forward(req, resp, "/ralasafe/query/whereExprContextMenu.jsp"); return; } else if ("loadWhereExprForm".equals(oper)) { String nodeId = req.getParameter("nodeId"); // String pId=req.getParameter( "pId" ); String exprType = req.getParameter("exprType"); if (!StringUtil.isEmpty(nodeId)) { Object obj = handler.getWhereExprItem(nodeId); ExpressionGroupTypeItem item = (ExpressionGroupTypeItem) obj; req.setAttribute("item", item); Object choiceValue = item.getChoiceValue(); if (choiceValue instanceof BinaryExpression) { exprType = "binary"; } else if (choiceValue instanceof InExpression || choiceValue instanceof NotInExpression) { exprType = "in"; } else if (choiceValue instanceof IsNullExpression || choiceValue instanceof IsNotNullExpression) { exprType = "null"; } } String[] userFields = WebUtil.getUserType(req).getUserMetadata().getUserFields(); req.setAttribute("userFields", userFields); if ("binary".equals(exprType)) { WebUtil.forward(req, resp, "/ralasafe/query/editWhereBinaryExpr.jsp"); } else if ("in".equals(exprType)) { WebUtil.forward(req, resp, "/ralasafe/query/editWhereInExpr.jsp"); } else if ("null".equals(exprType)) { WebUtil.forward(req, resp, "/ralasafe/query/editWhereNullExpr.jsp"); } return; } else if ("return".equals(oper)) { String gotoPage = handler.getManagePage(); // remove handler from session req.getSession().removeAttribute(getHandlerAttributeKey(req)); // goto manage page resp.sendRedirect(gotoPage); return; } else { WebUtil.forward(req, resp, "/ralasafe/query/design.jsp"); return; } }