presentlistaction.java

来自「这是一个轻便的j2ee的web应用框架,是一个在多个项目中运用的实际框架,采用s」· Java 代码 · 共 86 行

JAVA
86
字号
/*
 * 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 + =
减小字号Ctrl + -
显示快捷键?