⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 presentlistaction.java

📁 这是一个轻便的j2ee的web应用框架,是一个在多个项目中运用的实际框架,采用struts,hebinate,xml等技术,有丰富的tag,role,navigation,session,dictio
💻 JAVA
字号:
/*
 * Created on 2004-4-5
 *
 * To change the template for this generated file go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
package com.esimple.service.query.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.esimple.framework.web.action.BaseAction;
import com.esimple.framework.web.action.BaseForm;
import com.esimple.service.rbac.*;
import com.esimple.service.query.*;
import com.esimple.service.query.config.*;
import com.esimple.framework.web.taglib.rich.*;
/**
 * @author lijing
 *
 * To change the template for this generated type comment go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
public class PresentListAction extends BaseAction {
	private static final String TARGET = "topFrame";

	public String execute(
		BaseForm form,
		HttpServletRequest request,
		HttpServletResponse response)
		throws Exception {
		String groupid = form.getValueAsString("GROUP_ID");
		User user = (User) request.getSession().getAttribute(User.SESSION_KEY);
		QueryAdmin admin =
			(QueryAdmin) servlet.getServletContext().getAttribute(
				"QUERY_ADMIN");
		if (admin == null) {
			return FORWARD_FAILURE;
		}
		QueryGroupConfig groupconfig = admin.getGroup(groupid);
		TreeModel treemodel = generateTreeModel(groupconfig, user);
		request.setAttribute("treemodel", treemodel);
		return "querylist";
	}
	/**
	 * 
	 * @param groupconfig
	 * @return
	 */
	public TreeModel generateTreeModel(
		QueryGroupConfig groupconfig,
		User user) {
		if (groupconfig == null || user == null) {
			return null;
		}

		TreeModel group = new TreeModel(groupconfig.getLabel(), "#", "");

		for (int i = 0; i < groupconfig.getCatalogList().size(); i++) {
			CatalogConfig catalogconfig =
				(CatalogConfig) groupconfig.getCatalogList().get(i);
			if (user.hasRole(catalogconfig.getRole())) {

				TreeModel catalog =
					new TreeModel(catalogconfig.getLabel(), "#", "");
				group.addTreeModel(catalog);

				for (int j = 0; j < catalogconfig.getQueryList().size(); j++) {
					String queryid =
						(String) catalogconfig.getQueryList().get(j);

					TreeModel query =
						new TreeModel(
							catalogconfig.getQueryName(queryid),
							"/jsp/queryservice/queryCondition.jsp?queryid="
								+ queryid
								+ "&role="
								+ catalogconfig.getRole(),
							TARGET);
					catalog.addTreeModel(query);
				}
			}
		}
		return group;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -