<%@ include file = "EgMonitorTracker.jsp" %>
<%@ page errorPage = "EgProbsM.jsp"%>
<%@ page import = "egurkha.reporter.*" %>
<%@ page import = "com.egurkha.*" %>
<%@ page import = "com.egurkha.monitor.*" %>
<%@ page import="com.egurkha.admin.EgMaintenanceUtility"%>
<%@ page import = "java.util.*" %>
<%@ page import = "com.egurkha.ini.*" %>
<%@ page import = "com.eg.EgURLEncoder"%>
<%@ page import = "com.eg.EgConfigChangeThread"%>
<%@ page import = "java.net.URLDecoder"%>
<%@ page import = "com.egurkha.ini.IniUI" %>
<%@ page import="com.eg.IniFile"%>
<%@ page import = "com.egurkha.util.DateUtil"%>
<%@ page import = "com.eg.MappingNameSorter"%>
<%@ page import = "com.eg.EgName"%>
<%@ page import = "com.eg.EgInstallInfo"%>
<%@ page import = "com.eg.EgMaintenanceInfo"%>
<%@ page import = "com.eg.EgDateInfo"%>
<%@ page import = "com.eg.EgMappingInfo"%>
<%@ page import = "com.eg.eGComponentCategory"%>
<%@ page import = "com.eg.EgAggregateInfo" %>
<%@ page import = "com.eg.EgSpecsInfo" %>
<%@ page import = "com.egurkha.config.TimeLineBean"%>
<%@ page import = "com.egurkha.util.DateUtil"%>
<%@ page import = "com.egurkha.EgUserRole"%>
<%@ taglib prefix="egui" uri="../WEB-INF/eg-taglib.tld"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="net.sf.json.*"%>
<%@ page import="egurkha.reporter.ErUserData"%>
<%@ page import="com.eg.EgAlarmTable"%>


<%
try
{
	response.setHeader("Cache-Control","no-store");
	response.setHeader("Pragma","no-cache");
	response.setDateHeader ("Expires", -1);
	response.setContentType("application/json");
	
	UserRegistry registry    = UserRegistry.getInstance();
	User user = registry.getUser(session.getId());
	eGComponentCategory egComCategory=eGComponentCategory.getInstance();
	IniUI ui = (IniUI)com.egurkha.ini.IniUI.getInstance();
	//EgAggregateInfo aggInfo=new EgAggregateInfo("manager");
	EgSpecsInfo specsInfo = new EgSpecsInfo("manager");
	//ErUtils erUtils =  new ErUtils();
	session.removeAttribute("layer");
	session.removeAttribute("test");
	Hashtable ht_changeHash = EgConfigChangeThread.ht_changeHash;
	ComponentListData d = null;
	ComponentListResult r = null;

	String isServiceBusiDash = request.getParameter("isServiceBusiDash"); 
	String service = request.getParameter("service"); 
	String fromPage = request.getParameter("fromPage"); 
	String fromSearch = request.getParameter("fromSearch"); 
	
	String componentListRefresh = request.getParameter("componentListRefresh"); 
	String componentType=request.getParameter("componentType");
	String manyComponentTypes=request.getParameter("manyComponentTypes");
	String manyComponentTitle=request.getParameter("manyComponentTitle");
	String ltest=request.getParameter("ltest");
	String monitorsBy=request.getParameter("monitorsBy");
	manyComponentTypes = (manyComponentTypes==null || manyComponentTypes.equalsIgnoreCase("null"))?"":manyComponentTypes;
	manyComponentTitle = (manyComponentTitle==null || manyComponentTitle.equalsIgnoreCase("null"))?"":manyComponentTitle;
	ArrayList manyComponentTypesList=new ArrayList();
	if(manyComponentTypes!=null && manyComponentTypes.trim().length()>0)
	{
		manyComponentTypesList = (ArrayList)com.egurkha.util.StringUtils.egTokenizer(manyComponentTypes, "|",false,true,true);		//param 3-->includeEmpty,4-->unique,5-->trim
	}
	
	com.eg.IniFile iniMsDashboard = new com.eg.IniFile(EgInstallInfo.getInstallDir() + "/manager/config/eg_msdashboard.ini", false);	
	com.eg.IniFile iniDashboardCon = new com.eg.IniFile(EgInstallInfo.getInstallDir() + "/manager/config/eg_dashboardConfig.ini", false);
	
	ArrayList emulationComps = com.egurkha.util.StringUtils.egTokenizer((iniDashboardCon.getValue("Support_Emulation_Types","ComponentTypes")),",",false,true,true);

	ArrayList msCompList= new ArrayList();
	Hashtable msDashboardLinkHash = new Hashtable();

	boolean isRedirectUrlpresent = false;
	String msCompListStr = (String)iniDashboardCon.getValue("URL_TO_DASHBOARD","Component_Type_List");
	if(msCompListStr != null && msCompListStr.trim().length()>0)
	{
		msCompList = (ArrayList)com.egurkha.util.StringUtils.egTokenizer(msCompListStr,",",true,false,true);
		for(int i=0;i<msCompList.size();i++)
		{
			String compTypeStr = (String)msCompList.get(i);
			String redirectUrl = iniDashboardCon.getValue("InfraDashboard_compType_redirectURL",compTypeStr);
			if(redirectUrl != null && redirectUrl.trim().length()>0)
			{
				msDashboardLinkHash.put(compTypeStr,redirectUrl);
			}
		}

		if(msDashboardLinkHash.size()>0)
			isRedirectUrlpresent = true;
	}

	String s_iniFile = EgInstallInfo.getInstallDir()+ "/manager/config/eg_customdashboard.ini";
	IniFile customDashboardINI = new IniFile(s_iniFile);
	String showPerformanceDashboard=customDashboardINI.getValue("DASHBOARD_SETTINGS","showPerformanceDashboard");
	String performanceDashboardURL="";
	boolean isShowPerformanceDashboard=false;
	if((fromMobile==null || !fromMobile.equals("yes")) && (showPerformanceDashboard!=null && showPerformanceDashboard.equalsIgnoreCase("yes")))
	{
		String userId=user.getLoginID();
		String configuredTemplates=customDashboardINI.getValue("COMPONENT_TYPE_TEMPLATE_MAPPING",componentType);
		ArrayList configuredTemplatesList=new ArrayList();
		StringTokenizer stkTemplates=new StringTokenizer(configuredTemplates,",");
		while(stkTemplates.hasMoreTokens())
		{
			String templateName=stkTemplates.nextToken();
			if(templateName!=null && !templateName.startsWith(userId+"_"))
			{
				continue;
			}
			configuredTemplatesList.add(templateName);
		}
		
		if(configuredTemplatesList!=null && !configuredTemplatesList.isEmpty())
		{
			isShowPerformanceDashboard=true;
		}
		performanceDashboardURL="/final/monitor/MyDashboard.jsp?comesFrom=myDashboard&action=showMyDashboard&templateOnChange=true&componentDashboard=true&componentsForDashboard=";
	}
	customDashboardINI=null;

	String view=request.getParameter("view");
	view=(view==null || view.trim().length()==0 || view.equalsIgnoreCase("undefined"))?"List":view;
	String viewId=request.getParameter("viewId");
	viewId=(viewId==null || viewId.trim().length()==0 || viewId.equalsIgnoreCase("undefined"))?"":viewId;
	String viewPageTitle=request.getParameter("viewPageTitle");
	viewPageTitle=(viewPageTitle==null || viewPageTitle.trim().length()==0 || viewPageTitle.equalsIgnoreCase("undefined"))?"Components in all States":viewPageTitle;
	String viewTreeTitle=request.getParameter("viewTreeTitle");
	viewTreeTitle=(viewTreeTitle==null || viewTreeTitle.trim().length()==0 || viewTreeTitle.equalsIgnoreCase("undefined"))?"Component":viewTreeTitle;
	
	String treeTitle=request.getParameter("treeTitle");
	treeTitle=(treeTitle==null || treeTitle.trim().length()==0 || treeTitle.equalsIgnoreCase("undefined"))?"Component":treeTitle;

	String selectedState=request.getParameter("selectedState");
	selectedState=(selectedState==null || selectedState.trim().length()==0 || selectedState.equalsIgnoreCase("undefined"))?"":selectedState;
	
	componentType=(componentType==null || componentType.trim().length()==0 || componentType.equalsIgnoreCase("undefined"))?"":componentType;
	String filterBy=request.getParameter("filterBy");
	filterBy=(filterBy==null || filterBy.trim().length()==0 || filterBy.equalsIgnoreCase("undefined"))?"":filterBy;
	String subFilter=request.getParameter("subFilter");
	subFilter=(subFilter==null || subFilter.trim().length()==0 || subFilter.equalsIgnoreCase("undefined"))?"":subFilter;
	String componentNameSearch=request.getParameter("componentNameSearch");
	componentNameSearch=(componentNameSearch==null || componentNameSearch.trim().length()==0 || componentNameSearch.equalsIgnoreCase("undefined"))?"":componentNameSearch;
	String fromPageView=request.getParameter("fromPageView");
	fromPageView=(fromPageView==null || fromPageView.trim().length()==0 || fromPageView.equalsIgnoreCase("undefined"))?"Menu":fromPageView;
	String action=request.getParameter("action");
	action=(action==null || action.trim().length()==0 || action.equalsIgnoreCase("undefined"))?"":action;
	String stateName=request.getParameter("stateName");
	stateName=(stateName==null || stateName.trim().length()==0 || stateName.equalsIgnoreCase("undefined"))?"":stateName;

	boolean isFromMsDashboard = false;
	String msDashboardLink=request.getParameter("msDashboardLink");
	msDashboardLink=(msDashboardLink==null || msDashboardLink.trim().length()==0 || msDashboardLink.equalsIgnoreCase("undefined"))?"":msDashboardLink;

	if(msDashboardLink.equalsIgnoreCase("true"))	
		isFromMsDashboard = true;
	String PagesComesfrom=request.getParameter("monCmd");

	String isfromZoneDash = request.getParameter("isfromZoneDash");
	String fromDashboard = request.getParameter("fromDashboard");
	String from = request.getParameter("from");
	
	if (fromMobile!=null && fromMobile.equals("yes")|| componentListRefresh!=null && componentListRefresh.equals("yes"))
	{
		d = (ComponentListData) request.getAttribute("data");
		r = (ComponentListResult) request.getAttribute("result");

	}
	else
	{
		d = (ComponentListData) session.getAttribute("data");
		r = (ComponentListResult) session.getAttribute("result");
	}
	
	
	if (d.menuName!= null && !d.menuName.equalsIgnoreCase("undefined") &&  d.menuName.equalsIgnoreCase("agg"))
	{
		if(session!=null)
		{
			session.setAttribute("Page_IdentifierM", request.getRequestURI());
			session.setAttribute("Source","Aggregate"); // for eg help
		}
	}
	else if (d.menuName!= null && !d.menuName.equalsIgnoreCase("undefined") &&  d.menuName.equalsIgnoreCase("network"))
	{
		if(view!=null && !view.equalsIgnoreCase("undefined") && view.equalsIgnoreCase("metric"))
		{
			if(session!=null)
			{
				session.setAttribute("Page_IdentifierM", request.getRequestURI());
				session.setAttribute("Source","MetricViewNetwork"); // for eg help
			}
		}
		else
		{
			if(session!=null)
			{
				session.setAttribute("Page_IdentifierM", request.getRequestURI());
				session.setAttribute("Source","ListViewNetwork"); // for eg help
			}
		}
	}
	else
	{
		if(view!=null && !view.equalsIgnoreCase("undefined") && view.equalsIgnoreCase("metric"))
		{
			if(session!=null)
			{
				session.setAttribute("Page_IdentifierM", request.getRequestURI());
				session.setAttribute("Source","MetricViewComponent"); // for eg help
			}
		}
		else
		{
			if(session!=null)
			{
				session.setAttribute("Page_IdentifierM", request.getRequestURI());
				session.setAttribute("Source","ListViewComponent"); // for eg help
			}
		}
	}

	String uiFile = "eg_ui.ini";
	String s_iniFile_dir = EgInstallInfo.getInstallDir()+ "/manager/config/";
	IniFile iniFile = new IniFile(s_iniFile_dir + uiFile);

	String thisLanguage = ui.getDefaultLanguage();
	
	String compImage_ex="";
	IniFile iniObject = new IniFile(EgInstallInfo.getInstallDir() + "/manager/config/eg_udtests.ini",true);
	
	if(d.site==null)
		d.site="NULL"; 
	//String QueryStr = (String)request.getQueryString();

	EgComponent component = null;
	EgComponentList componentList = null;
	EgComponentList sComponentList = null;
	
	
	
	int i = 0;
	int j = 0;
	int l = 0;
	String otherStates[] = new String[2];
	otherStates = new String[]{"All States","Abnormal"};
	if(d.searchIndComps!=null && d.searchIndComps.equalsIgnoreCase("null"))
	{
		d.searchIndComps=null;
	}

	String check = (d.searchIndComps == null)?"":"checked=checked"; 
	
	long refreshFrequency = 60 * 1000L;
	String refFreq = d.user.getRefreshFrequency();
	if(refFreq!=null && refFreq.length()>0)
	{
		refreshFrequency =  Long.valueOf(refFreq).longValue() * 1000L;
	}
	
	String title ="";
	if((d.from.equals("ZoneDashboard") || d.from.equals("componentList") || d.from.equals("TreeMenu")) && (d.action.equals("component") || d.action.equals("search")))
	{
		if(d.zoneName != null && d.zoneName.length()>0)
		{
			title=mappingInfo.getTextDescription("monitor.servers.Components For the Zone")+" :" +d.zoneName;
		}
		else
		{
			if(d.menuName !=null && d.menuName.equalsIgnoreCase("agg"))
			{
				title=mappingInfo.getTextDescription("monitor.servers.AGGREGATES");
			}
			else if(d.menuName !=null && d.menuName.equals("network"))
			{
				title=mappingInfo.getTextDescription("monitor.servers.NETWORK DEVICES");
			}
			else
			{
				//title=mappingInfo.getTextDescription("monitor.servers.SERVERS");
				title=mappingInfo.getTextDescription("monitor.servers.COMPONENTS IN ALL STATES");
			}
		}
	}
	else
	{
		if(d.menuName !=null && d.menuName.equalsIgnoreCase("agg"))
		{
			title=mappingInfo.getTextDescription("monitor.servers.AGGREGATES");
		}
		else if(d.menuName !=null && d.menuName.equals("network"))
		{
			title=mappingInfo.getTextDescription("monitor.servers.NETWORK DEVICES");
		}
		else
		{
			//title=mappingInfo.getTextDescription("monitor.servers.SERVERS");
			title=mappingInfo.getTextDescription("monitor.servers.COMPONENTS IN ALL STATES");
		}
	}

	String zes = request.getParameter("zes");//is it from zoneElementStatus?
	String zName = request.getParameter("zName");//zoneName
	String isTreeFlag = request.getParameter("isTreeFlag");
	if(zes != null && zName != null)
	{
		title = mappingInfo.getTextDescription("monitor.servers.Aggregate Components For the Zone")+" : "+ zName;
	}

	String userViewAgg = request.getParameter("agg_type");
	if(userViewAgg != null && userViewAgg.equals("true"))
	{
		userViewAgg = "true";
		title=mappingInfo.getTextDescription("monitor.servers.Aggregate Component Server");
	}
	else
	{
		userViewAgg = "false";
	}
	String thisTitle = "header.jsp?title="+title+"&backButton=true";
	EgDateInfo dateInfo=new EgDateInfo();
	EgMaintenanceInfo egM=new EgMaintenanceInfo("manager");
	EgMaintenanceUtility maintenanceUtil=new EgMaintenanceUtility();
	
	int compNameLength = 32;
	int compHeadLength = 32;
	
	String fromHomepage = request.getParameter("fromHomepage");
	fromHomepage = (fromHomepage!=null && !fromHomepage.equalsIgnoreCase("") && !fromHomepage.equalsIgnoreCase("null") && !fromHomepage.equalsIgnoreCase("undefined"))?fromHomepage:"";
	
	if(d.from!=null && d.from.trim().equalsIgnoreCase("MainDashboard"))
	{
		if(fromHomepage==null || fromHomepage.trim().length()==0)
		{
			fromHomepage="true";
		}
	}

	String zoneName = request.getParameter("zoneName");
	isFromMenu = request.getParameter("isFromMenu");
	String isFromZoneInfra = request.getParameter("isFromZoneInfra");
	String isLogonType = request.getParameter("isLogonType");
	String isFromZoneMenu = request.getParameter("isFromZoneMenu");


	String parentZone = request.getParameter("parentZone");
	parentZone = (parentZone!=null && !parentZone.equalsIgnoreCase("") && !parentZone.equalsIgnoreCase("null") && !parentZone.equalsIgnoreCase("undefined"))?parentZone:"";

	MappingNameSorter sorter = new MappingNameSorter(thisLanguage);
	ArrayList serverList = new ArrayList();
	String iniFileDir = EgInstallInfo.getInstallDir()+ "/manager/config/";
	IniFile egUI = new IniFile(iniFileDir + uiFile);
	String currentDateFormat = egUI.getValue("CURRENT_DATE_FORMAT","selectedDateFormat");

	JSONObject json = new JSONObject();
	JSONObject hiddenFields = new JSONObject();
	JSONObject screenLabels = new JSONObject();
	JSONObject searchFields = new JSONObject();
	JSONObject listFields = new JSONObject();
	JSONObject formFields = new JSONObject();

	screenLabels.put("Title",title);
	screenLabels.put("backButtonText",mappingInfo.getTextDescription("monitor.common.Back"));
	screenLabels.put("searchResultText",mappingInfo.getTextDescription("monitor.global.Search Results For")+" ");
	//screenLabels.put("refreshFrequency",refreshFrequency);
	boolean showSearch = true;
	if(fromPageView.equalsIgnoreCase("zoneDashboard") && view.equalsIgnoreCase("List"))
		showSearch=false;
	if(d.userName!=null && !d.userName.equalsIgnoreCase("undefined") && !d.userName.equalsIgnoreCase("null") && !d.userName.equalsIgnoreCase(""))
	{

	}
	else if(r.showSearch)
	{
		formFields.put("method","get");
		formFields.put("action","../servlet/com.eg.EgMonitorController");
		if(d.menuName!=null && d.menuName.equals("agg"))
		{
			hiddenFields.put("from","MainDashboard");
		}
		else if(d.menuName!=null && d.menuName.equals("network"))
		{
			hiddenFields.put("from","MainDashboard");
		}
		else{
			hiddenFields.put("from","componentList");
		}
		
		hiddenFields.put("monCmd","componentList");
		hiddenFields.put("action","search");
		
		if(d.from!=null && (d.from.equals("ZoneDashboard") || d.from.equals("TreeMenu")) || (d.partOf!=null && d.partOf.equals("zone")))
		{
			if(d.zoneName!=null)
			{
				hiddenFields.put("zoneName",d.zoneName);
				hiddenFields.put("partOf","zone");
			}
		}
		if(d.userName!=null)
		{
			hiddenFields.put("userName",d.userName);
		}
		if(d.menuName!=null)
		{
			hiddenFields.put("menuName",d.menuName);
		}
		if(d.includeBoth!=null)
		{
			hiddenFields.put("includeBoth",d.includeBoth);
		}

		JSONArray componentSearchArray = new JSONArray();
		searchFields.put("searchStateLabel",mappingInfo.getTextDescription("monitor.common.State"));

		JSONObject optionValues = new JSONObject();
		JSONArray options = new JSONArray();
		for(i=0; i < otherStates.length; i++)
		{
			if(otherStates[i].equals(d.searchStateString))
			{
				optionValues.put("name",mappingInfo.getTextDescription("monitor.servers."+otherStates[i]));
				searchFields.put("searchStateStringSelected",otherStates[i]);
				optionValues.put("value",otherStates[i]);
			}
			else
			{
				optionValues.put("name",mappingInfo.getTextDescription("monitor.servers."+otherStates[i]));
				optionValues.put("value",otherStates[i]);
			}
			options.add(optionValues);
		}
		for(i = 0; i < r.availStateList.size(); i++)
		{
			String dState = State.getState ((String)r.availStateList.get(i)).getDisplayName();
			String aState = (String)r.availStateList.get(i);
			if(d.searchStateString!=null && d.searchStateString.equals(aState))
			{
				optionValues.put("name",mappingInfo.getLabelDescription(aState));
				optionValues.put("value",aState);
				searchFields.put("searchStateStringSelected",aState);
			}
			else
			{
				optionValues.put("name",mappingInfo.getLabelDescription(aState));
				optionValues.put("value",aState);
			}
			options.add(optionValues);
		}
		searchFields.put("searchStateString",options);
		searchFields.put("searchNameLabel",mappingInfo.getTextDescription("monitor.remotecontrol.Nick Name"));
		searchFields.put("searchNameString",(d.searchNameString==null)?"":d.searchNameString);
		searchFields.put("searchTypeLabel",mappingInfo.getTextDescription("monitor.common.Type"));
		
		JSONObject typeOptionValues = new JSONObject();
		JSONArray typeOptions = new JSONArray();
		if(r.availTypeList!=null && r.availTypeList.size()>1)
		{
			if(d.selTypeString != null && (d.selTypeString.equals("AllServers")))
			{
				typeOptionValues.put("name",mappingInfo.getTextDescription("monitor.servers.All Types"));
				searchFields.put("selTypeStringSelected","AllServers");
				typeOptionValues.put("value","AllServers");
			}
			else
			{
				typeOptionValues.put("name",mappingInfo.getTextDescription("monitor.servers.All Types"));
				typeOptionValues.put("value","AllServers");
			}
		}
		else
		{
			typeOptionValues.put("name",mappingInfo.getTextDescription("monitor.servers.All Types"));
			typeOptionValues.put("value","AllServers");
		}

		typeOptions.add(typeOptionValues);

		if(manyComponentTypesList!=null && manyComponentTypesList.size()>0)
		{
			typeOptionValues = new JSONObject();
			typeOptionValues.put("name",manyComponentTitle+" "+mappingInfo.getTextDescription("monitor.servers.Component Types"));
			typeOptionValues.put("value",manyComponentTypes);

			if(d.selTypeString != null && (d.selTypeString.equals(manyComponentTypes)))
			{
				searchFields.put("selTypeStringSelected",manyComponentTypes);
			}
			typeOptions.add(typeOptionValues);
		}

		for(i = 0;i < r.availTypeList.size(); i++)
		{
			String type = (String)r.availTypeList.get(i);
			serverList.add(type);
		}
		serverList = sorter.getSortedCompTypeList(serverList);
		String tempVal = "";
		String tempDis = "";
		EgName nameObj = null;
		for(int x=0; x<serverList.size(); x++)
		{
			nameObj = (EgName)serverList.get(x); 
			tempVal = nameObj.getActualName();
			tempDis = nameObj.getLocalName();
			if(d.selTypeString !=null && d.selTypeString.equals(tempVal))
			{
				typeOptionValues.put("name",tempDis);
				typeOptionValues.put("value",tempVal);
				searchFields.put("selTypeStringSelected",tempVal);
			}
			else
			{
				typeOptionValues.put("name",tempDis);
				typeOptionValues.put("value",tempVal);
			}
			typeOptions.add(typeOptionValues);
		}
		searchFields.put("selTypeString",typeOptions);
		

		String stype = "";
		if(d.selTypeString == null || !d.selTypeString.equals("AllServers"))
		{
			stype = "disabled";
		}
		
		searchFields.put("typeLabel",mappingInfo.getTextDescription("monitor.servers.Search Types"));
		searchFields.put("typeString",(d.searchTypeString ==null)?"":d.searchTypeString);
		searchFields.put("searchIndComps",mappingInfo.getTextDescription("monitor.servers.Show All Components"));
		searchFields.put("submitBtnText",mappingInfo.getTextDescription("monitor.common.Submit"));

		if(manyComponentTypesList==null || manyComponentTypesList.size()==0)
		{
			if(showSearch)
				json.put("SearchLabels",searchFields);
		}
	}
	if(!r.typeList.isEmpty())
	{
		JSONObject componentListLabels = new JSONObject();
		JSONArray componentListArray = new JSONArray();
		String listTitle="";
		if(d.action.equalsIgnoreCase("componentState"))
		{
			if(userViewAgg.equals("true") || d.from.equalsIgnoreCase("MainDashboard") && d.menuName !=null && d.menuName.equalsIgnoreCase("agg"))
			{
				listTitle=mappingInfo.getTextDescription("monitor.servers.Aggregate Components in")+" "+mappingInfo.getTextDescription("monitor.servers."+d.state.getDisplayName())+" "+mappingInfo.getTextDescription("monitor.common.State");
			}
			else if(userViewAgg.equals("true") || d.from.equalsIgnoreCase("MainDashboard") && d.menuName !=null && d.menuName.equalsIgnoreCase("network"))
			{
				listTitle=mappingInfo.getTextDescription("monitor.servers.Network Components in")+" "+mappingInfo.getTextDescription("monitor.servers."+d.state.getDisplayName())+" "+mappingInfo.getTextDescription("monitor.common.State");
			}
			else
			{
				listTitle=mappingInfo.getTextDescription("monitor.groups.Components in")+" "+mappingInfo.getTextDescription("monitor.servers."+d.state.getDisplayName())+" "+mappingInfo.getTextDescription("monitor.common.State");
			}

			if(d.zoneName != null && (d.from.equalsIgnoreCase("ZoneDashboard") || d.from.equalsIgnoreCase("MainDashboard") || fromPageView.equalsIgnoreCase("Zone") || fromPageView.equalsIgnoreCase("ZoneMap") || fromPageView.equalsIgnoreCase("HomeZone") || (d.from.equalsIgnoreCase("componentList") && d.partOf!=null )))
			{
				listTitle+=" "+mappingInfo.getTextDescription("monitor.servers.For the Zone")+" : "+d.zoneName;
			}
			else
			{
				listTitle+=" ";
			}

			if(d.from.equalsIgnoreCase("SegmentDashboard"))
			{
				listTitle+=" "+mappingInfo.getTextDescription("monitor.servers.For the Segment")+" : "+d.segmentName;
			}
			else
			{
				listTitle+=" ";
			}
			if(d.from.equalsIgnoreCase("ServiceDashboard"))
			{
				listTitle+=" "+mappingInfo.getTextDescription("monitor.servers.For the Service")+" : "+d.serviceName;
			}
			else
			{
				listTitle+=" ";
			}
			if(d.userName!=null && !d.userName.equalsIgnoreCase("undefined") && !d.userName.equalsIgnoreCase("null") && !d.userName.equalsIgnoreCase(""))
			{
				listTitle+=" "+mappingInfo.getTextDescription("monitor.servers.and User")+" : "+d.userName;
			}
			else if (d.userName!=null && fromPageView!=null && fromPageView.equalsIgnoreCase("UserView"))
			{
				listTitle+=" "+mappingInfo.getTextDescription("monitor.servers.and User")+" : "+d.userName;
			}
			else
			{
				listTitle+=" ";
			}

			if(fromPageView != null && fromPageView.equalsIgnoreCase("CitrixDashboard")){
				if(filterBy != null && filterBy.equalsIgnoreCase("Service"))
					listTitle = "Performance Metrics for "+mappingInfo.getComponentTypeDescription(componentType)+" in Service:"+subFilter;
				else if(filterBy != null && filterBy.equalsIgnoreCase("Segment"))
					listTitle = "Performance Metrics for "+mappingInfo.getComponentTypeDescription(componentType)+" in Segment:"+subFilter;
				else if(filterBy != null && filterBy.equalsIgnoreCase("Zone"))
					listTitle = "Performance Metrics for "+mappingInfo.getComponentTypeDescription(componentType)+" in Segment:"+subFilter;
				else
					listTitle = "Performance Metrics for "+mappingInfo.getComponentTypeDescription(componentType);
			}

			listFields.put("ListTitle",listTitle);
		}
		else if(d.action.equalsIgnoreCase("componentTypeState"))
		{
			if(d.from.equalsIgnoreCase("MainDashboard") && d.menuName !=null && d.menuName.equalsIgnoreCase("agg"))
			{
				listTitle+=" " +mappingInfo.getComponentTypeDescription(d.componentType)+" " +mappingInfo.getLabelDescription("monitor.servers.Component(s) in")+" "+mappingInfo.getTextDescription("monitor.servers."+d.state.getDisplayName()+ " " +"state");
			}
			else if(d.from.equalsIgnoreCase("MainDashboard") && d.menuName !=null && d.menuName.equalsIgnoreCase("network"))
			{
				listTitle+=" " +mappingInfo.getComponentTypeDescription(d.componentType)+" " +mappingInfo.getLabelDescription("monitor.servers.Component(s) in")+" "+mappingInfo.getTextDescription("monitor.servers."+d.state.getDisplayName()+ " " +"state");
			}
			else
			{
				if(d.componentType!=null)
				{
					listTitle+=" " +mappingInfo.getComponentTypeDescription(d.componentType)+" "+mappingInfo.getLabelDescription("monitor.servers.Components in "+" " +d.state.getDisplayName()+" State");
				}
				else
				{
					listTitle+=" "+mappingInfo.getLabelDescription("monitor.servers.Components in "+" " +d.state.getDisplayName()+" State");
				}
			}

			if(d.from.equalsIgnoreCase("ZoneDashboard") || fromPageView.equalsIgnoreCase("Zone") || fromPageView.equalsIgnoreCase("ZoneMap") || fromPageView.equalsIgnoreCase("HomeZone") || (d.from.equalsIgnoreCase("componentList") && d.partOf!=null ))
			{
				listTitle+=" "+mappingInfo.getTextDescription("monitor.servers.For the zone")+" : "+d.zoneName;	
			}
			else
			{
				listTitle+=" ";
			}

			if(d.from.equalsIgnoreCase("SegmentDashboard"))
			{
				listTitle+=" "+mappingInfo.getTextDescription("monitor.servers.For the Segment")+" : "+d.segmentName;
			}
			else
			{
				listTitle+=" ";
			}

			if(d.from.equalsIgnoreCase("ServiceDashboard"))
			{
				listTitle+=" "+mappingInfo.getTextDescription("monitor.servers.For the Service")+" : "+d.serviceName;
			}
			else
			{
				listTitle+=" ";
			}

			if(d.userName!=null && !d.userName.equalsIgnoreCase("undefined") && !d.userName.equalsIgnoreCase("null") && !d.userName.equalsIgnoreCase(""))
			{
				listTitle+=" "+mappingInfo.getTextDescription("monitor.servers.and User")+" : "+d.userName;
			}
			else if (d.userName!=null && fromPageView!=null && fromPageView.equalsIgnoreCase("UserView"))
			{
				listTitle+=" "+mappingInfo.getTextDescription("monitor.servers.and User")+" : "+d.userName;
			}
			else
			{
				listTitle+=" ";
			}

			if(fromPageView != null && fromPageView.equalsIgnoreCase("CitrixDashboard")){
				if(filterBy != null && filterBy.equalsIgnoreCase("Service"))
					listTitle = "Performance Metrics for "+mappingInfo.getComponentTypeDescription(componentType)+" in Service:"+subFilter;
				else if(filterBy != null && filterBy.equalsIgnoreCase("Segment"))
					listTitle = "Performance Metrics for "+mappingInfo.getComponentTypeDescription(componentType)+" in Segment:"+subFilter;
				else if(filterBy != null && filterBy.equalsIgnoreCase("Zone"))
					listTitle = "Performance Metrics for "+mappingInfo.getComponentTypeDescription(componentType)+" in Segment:"+subFilter;
				else
					listTitle = "Performance Metrics for "+mappingInfo.getComponentTypeDescription(componentType);
			}

			listFields.put("ListTitle",listTitle);
		}
		else if(d.action.equalsIgnoreCase("componentType"))
		{
			if(d.from.equalsIgnoreCase("MainDashboard") && d.menuName !=null && d.menuName.equalsIgnoreCase("agg"))
			{
				listTitle=mappingInfo.getTextDescription("monitor.servers.Aggregate Components in All States");
			}
			else if(d.from.equalsIgnoreCase("MainDashboard") && d.menuName !=null && d.menuName.equalsIgnoreCase("network"))
			{
				listTitle=mappingInfo.getTextDescription("monitor.servers.Network Components in All States");
			}
			else
			{
				//listTitle+=" ";
				//listTitle=mappingInfo.getTextDescription("monitor.servers.Components in All States");
				if(d.componentType!=null && d.componentType.trim().length()>0)
				{
					if(manyComponentTypesList!=null && manyComponentTypesList.size()>0)
					{
						listTitle=manyComponentTitle+" "+mappingInfo.getTextDescription("monitor.servers.Components in All States");
					}
					else
					{
						listTitle=mappingInfo.getComponentTypeDescription(d.componentType)+" "+mappingInfo.getTextDescription("monitor.servers.Components in All States");
					}
				}
				else
				{
					if(manyComponentTypesList!=null && manyComponentTypesList.size()>0)
					{
						listTitle=manyComponentTitle+" "+mappingInfo.getTextDescription("monitor.servers.Components in All States");
					}
					else
						listTitle=mappingInfo.getTextDescription("monitor.servers.Components in All States");
				}
			}

			if(d.from.equalsIgnoreCase("ZoneDashboard") || fromPageView.equalsIgnoreCase("Zone") || fromPageView.equalsIgnoreCase("ZoneMap") || fromPageView.equalsIgnoreCase("HomeZone") || (d.from.equalsIgnoreCase("componentList") && d.partOf!=null ))		//	Kaliraj 
			{
				listTitle=" " +mappingInfo.getComponentTypeDescription(d.componentType)+" " +mappingInfo.getTextDescription("monitor.servers.Components For the Zone")+" : "+d.zoneName;
			}
			else
			{
				listTitle+=" ";
			}

			if(d.from.equalsIgnoreCase("SegmentDashboard"))
			{
				listTitle+=" "+mappingInfo.getTextDescription("monitor.servers.For the Segment")+" : "+d.segmentName;
			}
			else
			{
				listTitle+=" ";
			}

			if(d.from.equalsIgnoreCase("ServiceDashboard"))
			{
				listTitle+=" "+mappingInfo.getTextDescription("monitor.servers.For the Service")+" : "+d.serviceName;
			}
			else
			{
				listTitle+=" ";
			}

			if(d.userName!=null && !d.userName.equalsIgnoreCase("undefined") && !d.userName.equalsIgnoreCase("null") && !d.userName.equalsIgnoreCase(""))
			{
				listTitle+=" "+mappingInfo.getTextDescription("monitor.servers.and User")+" : "+d.userName;
			}
			else if (d.userName!=null && fromPageView!=null && fromPageView.equalsIgnoreCase("UserView"))
			{
				listTitle+=" "+mappingInfo.getTextDescription("monitor.servers.and User")+" : "+d.userName;
			}
			else
			{
				listTitle+=" ";
			}

			if(fromPageView != null && fromPageView.equalsIgnoreCase("CitrixDashboard")){
				if(filterBy != null && filterBy.equalsIgnoreCase("Service"))
					listTitle = "Performance Metrics for "+mappingInfo.getComponentTypeDescription(componentType)+" in Service:"+subFilter;
				else if(filterBy != null && filterBy.equalsIgnoreCase("Segment"))
					listTitle = "Performance Metrics for "+mappingInfo.getComponentTypeDescription(componentType)+" in Segment:"+subFilter;
				else if(filterBy != null && filterBy.equalsIgnoreCase("Zone"))
					listTitle = "Performance Metrics for "+mappingInfo.getComponentTypeDescription(componentType)+" in Segment:"+subFilter;
				else
					listTitle = "Performance Metrics for "+mappingInfo.getComponentTypeDescription(componentType);
			}
			listFields.put("ListTitle",listTitle);
		}
		else
		{
			if(d.from.equalsIgnoreCase("componentList") && d.partOf!=null )
			{
				listTitle+=" "+mappingInfo.getTextDescription("monitor.servers.Components for the zone")+" : "+d.zoneName;	
			}
			else{
				if(d.searchStateString!=null && (d.searchStateString.equals("All States") || d.searchStateString.equals("AllStates")))
				{
					if(userViewAgg.equals("true") || d.from.equalsIgnoreCase("MainDashboard") && d.menuName !=null && d.menuName.equalsIgnoreCase("agg"))
					{
						listTitle=mappingInfo.getTextDescription("monitor.servers.Aggregate Components in All States");
					}
					else if(userViewAgg.equals("true") || d.from.equalsIgnoreCase("MainDashboard") && d.menuName !=null && d.menuName.equalsIgnoreCase("network"))
					{
						listTitle=mappingInfo.getTextDescription("monitor.servers.Network Components in All States");
					}
					else
					{
						if(d.action!=null && d.action.equals("search") && d.menuName!=null && d.menuName.equalsIgnoreCase("agg") )
						{
							listTitle=mappingInfo.getTextDescription("monitor.servers.Aggregate Components in All States");
						}
						else if(d.action!=null && d.action.equals("search") && d.menuName!=null && d.menuName.equalsIgnoreCase("network"))
						{
							listTitle=mappingInfo.getTextDescription("monitor.servers.Network Components in All States");
						}
						else
						{
							//listTitle=mappingInfo.getTextDescription("monitor.servers.Components in All States");
							if(d.componentType!=null && d.componentType.trim().length()>0)
							{
								if(manyComponentTypesList!=null && manyComponentTypesList.size()>0)
								{
									listTitle=manyComponentTitle+" "+mappingInfo.getTextDescription("monitor.servers.Components in All States");
								}
								else
								{
									listTitle=mappingInfo.getComponentTypeDescription(d.componentType)+" "+mappingInfo.getTextDescription("monitor.servers.Components in All States");
								}
							}
							else if(d.action!=null && d.action.equalsIgnoreCase("globalsearch") && d.searchNameString!=null && d.searchNameString.length()>0 )
							{
								listTitle=mappingInfo.getTextDescription("monitor.servers.Search Results For \"Component")+" "+d.searchNameString+"\"";
							}
							else
							{
								if(manyComponentTypesList!=null && manyComponentTypesList.size()>0)
								{
									listTitle=manyComponentTitle+" "+mappingInfo.getTextDescription("monitor.servers.Components in All States");
								}
								else
								{
									listTitle=mappingInfo.getTextDescription("monitor.servers.Components in All States");
								}
							}
						}
					}

					if(d.userName!=null && !d.userName.equalsIgnoreCase("undefined") && !d.userName.equalsIgnoreCase("null") && !d.userName.equalsIgnoreCase(""))
					{
						listTitle+=" "+mappingInfo.getTextDescription("monitor.servers. For the User")+" : "+d.userName;
					}
					else if (d.userName!=null && fromPageView!=null && fromPageView.equalsIgnoreCase("UserView"))
					{
						listTitle+=" "+mappingInfo.getTextDescription("monitor.servers. For the User")+" : "+d.userName;
					}
				}
				else if(d.searchStateString!=null && !d.searchStateString.equals(""))
				{
					if(d.from.equalsIgnoreCase("MainDashboard") && d.menuName !=null && d.menuName.equalsIgnoreCase("agg"))
					{
						listTitle=" "+mappingInfo.getTextDescription("monitor.servers.Aggregate Components in");
					}
					else if(d.from.equalsIgnoreCase("MainDashboard") && d.menuName !=null && d.menuName.equalsIgnoreCase("network"))
					{
						listTitle=" "+mappingInfo.getTextDescription("monitor.servers.Network Components in");
					}
					else
					{
						if(d.action!=null && d.action.equals("search") && d.menuName!=null && d.menuName.equalsIgnoreCase("agg"))
						{
							listTitle=mappingInfo.getTextDescription("monitor.servers.Aggregate Components in");
						}
						else if(d.action!=null && d.action.equals("search") && d.menuName!=null && d.menuName.equalsIgnoreCase("network"))
						{
							listTitle=mappingInfo.getTextDescription("monitor.servers.Network Components in");
						}
						else
						{
						listTitle=" "+mappingInfo.getTextDescription("monitor.servers.Components in");
						}
					}
					if(d.searchStateString.equals("Abnormal"))
					{
						listTitle+=" "+mappingInfo.getTextDescription("monitor.servers.Abnormal");
					}
					else
					{
						if(d.searchStateString.equals("All States") || d.searchStateString.equals("AllStates"))
						{
							listTitle+=" "+mappingInfo.getTextDescription("monitor.servers.All States");
						}
						else
						{
							listTitle+=" "+mappingInfo.getLabelDescription(d.searchStateString); //Kaliraj 
						}
					}
					if(d.searchStateString!=null && !(d.searchStateString.equals("All States") || d.searchStateString.equals("AllStates")))
					{
						listTitle+=" "+mappingInfo.getTextDescription("monitor.common.State");
					}
					if(d.userName!=null && !d.userName.equalsIgnoreCase("undefined") && !d.userName.equalsIgnoreCase("null") && !d.userName.equalsIgnoreCase(""))
					{
						listTitle+=" "+mappingInfo.getTextDescription("monitor.servers. For the User")+" : "+d.userName;
					}
					else if (d.userName!=null && fromPageView!=null && fromPageView.equalsIgnoreCase("UserView"))
					{
						listTitle+=" "+mappingInfo.getTextDescription("monitor.servers. For the User")+" : "+d.userName;
					}
				}
			}
			if(fromPageView != null && fromPageView.equalsIgnoreCase("CitrixDashboard")){
				if(filterBy != null && filterBy.equalsIgnoreCase("Service"))
					listTitle = "Performance Metrics for "+mappingInfo.getComponentTypeDescription(componentType)+" in Service:"+subFilter;
				else if(filterBy != null && filterBy.equalsIgnoreCase("Segment"))
					listTitle = "Performance Metrics for "+mappingInfo.getComponentTypeDescription(componentType)+" in Segment:"+subFilter;
				else if(filterBy != null && filterBy.equalsIgnoreCase("Zone"))
					listTitle = "Performance Metrics for "+mappingInfo.getComponentTypeDescription(componentType)+" in Segment:"+subFilter;
				else
					listTitle = "Performance Metrics for "+mappingInfo.getComponentTypeDescription(componentType);
			}
			listFields.put("ListTitle",listTitle);
		}
		componentList = r.componentList;
		int typeCount = r.typeList.size();
		ArrayList serverList1 = new ArrayList();
		for(int x = 0; x < typeCount; x++)
		{
			String type1 = (String) r.typeList.get(x);
			serverList1.add(type1);
		}
		serverList1 = sorter.getSortedCompTypeList(serverList1);
		String type = "";
		String tempDis1 = "";
		EgName nameObj1 = null;
		String currdate = dateInfo.egetDate(false);
		
		JSONArray componentsTypesArray = new JSONArray();
		
		for( l=0; l<serverList1.size(); l++)
		{
			ArrayList compStateList=new ArrayList();
			JSONObject componentsTypes = new JSONObject();
			nameObj1 = (EgName)serverList1.get(l); 
			type = nameObj1.getActualName();//Actual value
			if(d.selTypeString != null && d.selTypeString.equals(manyComponentTypes) && manyComponentTypesList!=null && manyComponentTypesList.size()>0 && !manyComponentTypesList.contains(type))
			{
				continue;
			}
			tempDis1 = nameObj1.getLocalName();//Language based value
			boolean space=(l+1)< typeCount;
			int checkCount=0;
			if(r.showImage)
				checkCount=9;
			else
				checkCount=3;
			String stype = type;
			String ext = (type.endsWith("_ex") || type.startsWith("Agg_"))?".png":".png";	// Kaliraj
			sComponentList = componentList.searchForParticularType(type);
			
			if(l==0)
			{
				String typeTitle=mappingInfo.getTextDescription("monitor.common.Component")+"				    "+mappingInfo.getTextDescription("monitor.common.Type");
				listFields.put("ComponentTypeTitle",typeTitle);
				listFields.put("AvaliableListTitle",mappingInfo.getTextDescription("monitor.common.Available Components"));
			}
			if(r.showImage)
			{
				if (tempDis1.length()>compHeadLength)
				{
					String strName =tempDis1;
					if (strName.endsWith(EgConstants.NULL_PORT) && (strName.indexOf(EgConstants.NULL_PORT) > -1))
					{
						strName = Server.getServerNameWithoutPort(strName, false);
					}
					if(tempDis1!=null && tempDis1.trim().length()>compHeadLength)
						tempDis1 = tempDis1.substring(0,compHeadLength)+" ..";
					componentsTypes.put("name",tempDis1);
					componentsTypes.put("title",strName);
					//componentsTypes.put("nameLength",Integer.toString(compHeadLength));
				}
				else
				{
					componentsTypes.put("name",tempDis1);
					componentsTypes.put("title",tempDis1);
				}

				if(type.startsWith("Agg_"))
				{
					componentsTypes.put("type","/final/images/"+monitor_Skin+"/component_icons/AGGREGATES.png");
				}
				else if(type.endsWith("_ex"))
				{
					compImage_ex=iniObject.getValue("COMP_DISPLAYIMAGE_NICK",type);
					if(compImage_ex.equals("others"))
					{
						componentsTypes.put("type","/final/images/"+monitor_Skin+"/ic_images/others.png");
					}
					else
					{
						componentsTypes.put("type","/final/images/"+monitor_Skin+"/ic_images/"+compImage_ex+".png");
					}
				}
				else
				{
					//componentsTypes.put("type","/final/images/component_icons/"+type+ext);
					String comGroupName = egComCategory.getCategoryforCompType(type);
					componentsTypes.put("type","/final/images/"+monitor_Skin+"/component_icons/"+comGroupName+".png");
				}
				componentsTypes.put("showImg","true");
			}
			else
			{
				if (tempDis1.length()>compHeadLength)
				{
					String strName =tempDis1;
					if (strName.endsWith(EgConstants.NULL_PORT) && (strName.indexOf(EgConstants.NULL_PORT) > -1))
					{
						strName = Server.getServerNameWithoutPort(strName, false);
					}
					if(tempDis1!=null && tempDis1.trim().length()>compHeadLength)
						tempDis1 = tempDis1.substring(0,compHeadLength)+" ..";
					componentsTypes.put("name",tempDis1);
					componentsTypes.put("title",strName);
					//componentsTypes.put("nameLength",Integer.toString(compHeadLength));
				}
				else
				{
					componentsTypes.put("name",tempDis1);
					componentsTypes.put("title",tempDis1);
				}
				componentsTypes.put("type",type+ext);
			}
			int count=sComponentList.size();
			if (count <= checkCount)
			{
				count = checkCount;
			}
			else if(count%3 > 0)
			{
				if(checkCount==3)
					count = count + 3 - count % 3;
				else
					count = count + 3 - count % 9;
			}
			if(sComponentList != null)
			{
				JSONArray componentsNamesArray = new JSONArray();
				for(j = 0; (j < sComponentList.size() || j < count) ; j++)
				{
					if (j%3 == 0)
					{

					}
					if ( j < sComponentList.size())
					{
						JSONObject componentsName = new JSONObject();
						component = (EgComponent)sComponentList.get(j);
						String trgthost=component.getName();
						if(trgthost!=null && trgthost.indexOf(":")>-1)
							trgthost=trgthost.substring(0,trgthost.indexOf(":"));
						trgthost=trgthost+":NULL";
						EgUserRole userRole = u_ser.getUserRole();
						boolean hasConfigSupport = userRole.hasAnyConfigRole(EgUserPermission.CONFIG);

						boolean configChanged = false;
						if(!EgInstallInfo.isSuperManager)
						{
							configChanged = ((ht_changeHash.containsKey(component.getName())  || ht_changeHash.containsKey(trgthost)) &&EgInstallInfo.isConfigSupported && hasConfigSupport);
						}
						boolean isTestRelevantForServer = false;
						if(configChanged)
						{
							ArrayList temp_list=(ArrayList) ht_changeHash.get(component.getName());
							if(temp_list==null || temp_list.size()==0)
								temp_list= (ArrayList) ht_changeHash.get(trgthost);

							if(temp_list!=null && temp_list.size()>0)
							{
								for(int k=0;k<temp_list.size();k++)
								{
									String temp_test_name=(String)temp_list.get(k);
									if(temp_test_name!=null && temp_test_name.trim().length()>0)
									{
										isTestRelevantForServer = specsInfo.isTestRelevantForServer(component.getType(),temp_test_name);
									}
									if(isTestRelevantForServer)
										break;
								}
								
								if(isTestRelevantForServer)
									configChanged=true;
								else
									configChanged=false;
							}
							else
								configChanged=false;
						}
						State temp_state=component.getState();

						componentsName.put("stateName","state_"+component.getState());
						compStateList.add(temp_state.getName());
						String serverName=component.getName();
						String sid="";
						StringTokenizer  tok=new StringTokenizer(serverName,":");    
						int  tokens=tok.countTokens();
						String sname=tok.nextToken();
						String portno=tok.nextToken();
						if(tokens==3)
							sid=tok.nextToken();

						//boolean isHostMaintenance=egM.isItMaintenanceTime(currdate,sname,"","",true);
						//boolean isComponentMaintenance=egM.isItMaintenanceTime(currdate,sname,portno,sid,true);

						boolean  isHostMaintenance=false;
						boolean  isComponentMaintenance=false;

						Hashtable resHostHash=null;
						Hashtable resCompHash=null;

						if(view!=null && !view.equalsIgnoreCase("undefined") && view.equalsIgnoreCase("list"))
						{
							resHostHash=(Hashtable)egM.getMaintenanceTimePeriod(currdate,sname,"","",true);
							resCompHash=(Hashtable)egM.getMaintenanceTimePeriod(currdate,sname,portno,sid,true);
						}

						if(resHostHash!=null)
						{
							isHostMaintenance = ((Boolean)resHostHash.get("isUnderMaintenance")).booleanValue();
						}

						if(resCompHash!=null)
						{
							isComponentMaintenance = ((Boolean)resCompHash.get("isUnderMaintenance")).booleanValue();
						}
						List  maintenaceTimePeriod=new ArrayList();
						List temp=null;
						if(isHostMaintenance)
						{
							/*temp=egM.getMaintenancePeriods(sname,"","",true);
							if(temp!=null && temp.size()>0)
								maintenaceTimePeriod.addAll(temp);
							temp=egM.getUnplannedMaintenancePeriods(sname,"","",true);
							if(temp!=null && temp.size()>0)
								maintenaceTimePeriod.addAll(temp);*/

							temp=(List)resHostHash.get("MaintenancePeriods");
							if(temp!=null && temp.size()>0)
								maintenaceTimePeriod.addAll(temp);
						}
						if(isComponentMaintenance)
						{
							/*temp=egM.getMaintenancePeriods(sname,portno,sid,true);
							if(temp!=null && temp.size()>0)
							{
								maintenaceTimePeriod.addAll(temp);
							}
							temp=egM.getUnplannedMaintenancePeriods(sname,portno,sid,true);
							if(temp!=null && temp.size()>0)
								maintenaceTimePeriod.addAll(temp);*/

							temp=(List)resCompHash.get("MaintenancePeriods");
							if(temp!=null && temp.size()>0)
								maintenaceTimePeriod.addAll(temp);
						}
						int noOfLines=maintenaceTimePeriod.size();

						String maintenaceTimePeriodStr="";
						if(isHostMaintenance || isComponentMaintenance)
						{
							maintenaceTimePeriodStr=maintenanceUtil.convertMaintenacevectorToString(maintenaceTimePeriod,user);
						}

						if(d.menuName == null)
						{
							if (component.getName().length()>compNameLength)
							{
								String strName =component.getName();
								String strDisplayName = component.getDisplayName();
								if (strName.endsWith(EgConstants.NULL_PORT) && (strName.indexOf(EgConstants.NULL_PORT) > -1))
								{
									strName = Server.getServerNameWithoutPort(strName, false);
								}
								int compNameLengthMain=25;
								if(isHostMaintenance || isComponentMaintenance)
								{
									compNameLengthMain = compNameLength-4;
								}
								if(configChanged)
								{
									compNameLengthMain = compNameLengthMain-4;
								}
								if(strDisplayName!=null && strDisplayName.trim().length()>compNameLength)
									strDisplayName = strDisplayName.substring(0,compNameLength)+"...";

								//String link = "/final/servlet/com.eg.EgDashboardController?site="+EgURLEncoder.encode(d.site,"UTF-8")+"&from=list&comptype="+EgURLEncoder.encode(component.getType(),"UTF-8")+"&host="+EgURLEncoder.encode(component.getName(),"UTF-8")+"&tab=LayerModel&fromHomepage="+fromHomepage;

								String link = "";
								if(isShowPerformanceDashboard)
								{
									link=performanceDashboardURL+EgURLEncoder.encode(component.getType()+":"+component.getName(),"UTF-8");
								}
								else
								{

									//service=%20ser1&monCmd=componentList&isServiceBusiDash=true&from=MainDashboard&action=componentType&componentType=Generic_Emulation&searchIndComps=true&com.eg.CSRF_NONCE=E375855505D962AE46AAC92806A76373

									//if(component.getType().equalsIgnoreCase("Emulated_client") || component.getType().equalsIgnoreCase("Generic_Emulation"))
									if(emulationComps.contains(component.getType()))
										link = "/final/monitor/sessionSimulation.jsp?compName="+EgURLEncoder.encode(component.getName(),"UTF-8")+"&site="+EgURLEncoder.encode(d.site,"UTF-8")+"&compType="+EgURLEncoder.encode(component.getType(),"UTF-8")+"&from="+from+"&fromHomepage="+fromHomepage+"&treeTitle="+treeTitle+"&view="+view+"&viewId="+viewId+"&viewTreeTitle="+viewTreeTitle+"&filterBy="+filterBy+"&subFilter="+subFilter+"&componentNameSearch="+componentNameSearch+"&fromPageView="+fromPageView+"&selectedState="+selectedState+"&viewPageTitle="+EgURLEncoder.encode(viewPageTitle,"UTF-8")+"&action="+action+"&stateName="+stateName+"&isfromZoneDash="+isfromZoneDash+"&fromDashboard="+fromDashboard;
									else
										link="/final/servlet/com.eg.EgDashboardController?site="+EgURLEncoder.encode(d.site,"UTF-8")+"&from=list&comptype="+EgURLEncoder.encode(component.getType(),"UTF-8")+"&host="+EgURLEncoder.encode(component.getName(),"UTF-8")+"&tab=LayerModel&fromHomepage="+fromHomepage+"&treeTitle="+treeTitle+"&view="+view+"&viewId="+viewId+"&viewTreeTitle="+viewTreeTitle+"&filterBy="+filterBy+"&subFilter="+subFilter+"&componentNameSearch="+componentNameSearch+"&fromPageView="+fromPageView+"&selectedState="+selectedState+"&viewPageTitle="+EgURLEncoder.encode(viewPageTitle,"UTF-8")+"&action="+action+"&stateName="+stateName+"&isfromZoneDash="+isfromZoneDash+"&fromDashboard="+fromDashboard+"&PagesComesfrom="+PagesComesfrom+"&manyComponentTypes="+EgURLEncoder.encode(manyComponentTypes,"UTF-8")+"&manyComponentTitle="+manyComponentTitle+"&selTypeString="+EgURLEncoder.encode(d.selTypeString,"UTF-8")+"&searchStateString="+d.searchStateString+"&searchNameString="+EgURLEncoder.encode(d.searchNameString,"UTF-8")+"&searchIndComps="+d.searchIndComps+"&fromPage="+fromPage+"&fromSearch="+fromSearch;
								}
								
								if(parentZone!=null && parentZone.length()>0)
									link = link+"&parentZone="+parentZone;
								
								if(zoneName!=null && zoneName.length()>0)
									link = link+"&zoneName="+zoneName;
								if(isFromMenu!=null && isFromMenu.length()>0)
									link = link+"&isFromMenu="+isFromMenu;
								if(isFromZoneInfra!=null && isFromZoneInfra.length()>0)
									link = link+"&isFromZoneInfra="+isFromZoneInfra;
								if(isLogonType!=null && isLogonType.length()>0)
									link = link+"&isLogonType="+isLogonType;
								

								if(isRedirectUrlpresent && msDashboardLinkHash.containsKey(component.getType()))
								{
									String msRedirectUrl = (String)msDashboardLinkHash.get(component.getType());
									msRedirectUrl = msRedirectUrl +"&host="+EgURLEncoder.encode(component.getName(),"UTF-8")+"&from=list";

									if(isServiceBusiDash != null && isServiceBusiDash.equalsIgnoreCase("true"))	
									{
										msRedirectUrl = msRedirectUrl +"&isServiceBusiDash="+isServiceBusiDash+"&service="+service;
									}				

									componentsName.put("link",msRedirectUrl);										
								}
								else
									componentsName.put("link",link);

								componentsName.put("title",strName);
								componentsName.put("name",strDisplayName);
								componentsName.put("nameLength",Integer.toString(compNameLengthMain));

								if(isHostMaintenance || isComponentMaintenance)
								{
									componentsName.put("MaintenanceTime",maintenaceTimePeriodStr);
									componentsName.put("NoOfLines",noOfLines);
								}
								if(configChanged)//  Configuraion Image changes 111
								{
									componentsName.put("configChange",component.getName()+":"+component.getType());
								}
							}
							else
							{
								String strName =component.getName();
								if (strName.endsWith(EgConstants.NULL_PORT) && (strName.indexOf(EgConstants.NULL_PORT) > -1))
								{
									strName = Server.getServerNameWithoutPort(strName, false);
								}
								//String linkUrl = "/final/servlet/com.eg.EgDashboardController?site="+EgURLEncoder.encode(d.site,"UTF-8")+"&from=list&comptype="+EgURLEncoder.encode(component.getType(),"UTF-8")+"&host="+EgURLEncoder.encode(component.getName(),"UTF-8")+"&tab=LayerModel&fromHomepage="+fromHomepage;
								String linkUrl = "";
								if(isShowPerformanceDashboard)
								{
									linkUrl=performanceDashboardURL+EgURLEncoder.encode(component.getType()+":"+component.getName(),"UTF-8");
								}
								else
								{
									//if(component.getType().equalsIgnoreCase("Emulated_client")  || component.getType().equalsIgnoreCase("Generic_Emulation"))
									if(emulationComps.contains(component.getType()))
										linkUrl = "/final/monitor/sessionSimulation.jsp?compName="+EgURLEncoder.encode(component.getName(),"UTF-8")+"&site="+EgURLEncoder.encode(d.site,"UTF-8")+"&compType="+EgURLEncoder.encode(component.getType(),"UTF-8")+"&from="+from+"&fromHomepage="+fromHomepage+"&treeTitle="+treeTitle+"&view="+view+"&viewId="+viewId+"&viewTreeTitle="+viewTreeTitle+"&filterBy="+filterBy+"&subFilter="+subFilter+"&componentNameSearch="+componentNameSearch+"&fromPageView="+fromPageView+"&selectedState="+selectedState+"&viewPageTitle="+EgURLEncoder.encode(viewPageTitle,"UTF-8")+"&action="+action+"&stateName="+stateName+"&isfromZoneDash="+isfromZoneDash+"&fromDashboard="+fromDashboard;
									else
										linkUrl="/final/servlet/com.eg.EgDashboardController?site="+EgURLEncoder.encode(d.site,"UTF-8")+"&from=list&comptype="+EgURLEncoder.encode(component.getType(),"UTF-8")+"&host="+EgURLEncoder.encode(component.getName(),"UTF-8")+"&tab=LayerModel&fromHomepage="+fromHomepage+"&treeTitle="+treeTitle+"&view="+view+"&viewId="+viewId+"&viewTreeTitle="+viewTreeTitle+"&filterBy="+filterBy+"&subFilter="+subFilter+"&componentNameSearch="+componentNameSearch+"&fromPageView="+fromPageView+"&selectedState="+selectedState+"&viewPageTitle="+EgURLEncoder.encode(viewPageTitle,"UTF-8")+"&action="+action+"&stateName="+stateName+"&isfromZoneDash="+isfromZoneDash+"&fromDashboard="+fromDashboard+"&PagesComesfrom="+PagesComesfrom+"&manyComponentTypes="+EgURLEncoder.encode(manyComponentTypes,"UTF-8")+"&manyComponentTitle="+manyComponentTitle+"&selTypeString="+EgURLEncoder.encode(d.selTypeString,"UTF-8")+"&searchStateString="+d.searchStateString+"&searchNameString="+EgURLEncoder.encode(d.searchNameString,"UTF-8")+"&searchIndComps="+d.searchIndComps+"&fromPage="+fromPage+"&fromSearch="+fromSearch;
								}
								
								
								String paramForBackButton ="parentZone&zoneName&isFromMenu&isFromZoneInfra&isLogonType&isFromZoneMenu&ltest&monitorsBy";
								StringTokenizer paramForBack = new StringTokenizer(paramForBackButton,"&");
								String params="";
								while(paramForBack.hasMoreTokens())      
								{
									params = (String) paramForBack.nextToken();

									if(linkUrl.indexOf(params+"=")<0)
									{
										String requestParam=request.getParameter(params);
										if(requestParam!= null && requestParam.trim().length()>0 && !requestParam.equalsIgnoreCase("NULL"))
											linkUrl+="&"+params+"="+requestParam;
									}
								}
							
							
							
							
								if(isRedirectUrlpresent && msDashboardLinkHash.containsKey(component.getType()))
								{
									String msRedirectUrl = (String)msDashboardLinkHash.get(component.getType());
									msRedirectUrl = msRedirectUrl +"&host="+EgURLEncoder.encode(component.getName(),"UTF-8")+"&from=list";

									if(isServiceBusiDash != null && isServiceBusiDash.equalsIgnoreCase("true"))	
									{
										msRedirectUrl = msRedirectUrl +"&isServiceBusiDash="+isServiceBusiDash+"&service="+service;
									}				

									componentsName.put("link",msRedirectUrl);	
									
									
									//componentsName.put("link",msRedirectUrl+"&host="+EgURLEncoder.encode(component.getName(),"UTF-8")+"&from=list");										
								}
								else
									componentsName.put("link",linkUrl);

								componentsName.put("title",strName);
								componentsName.put("name",component.getDisplayName());

								if(isHostMaintenance || isComponentMaintenance)
								{
									componentsName.put("MaintenanceTime",maintenaceTimePeriodStr);
									componentsName.put("NoOfLines",noOfLines);
								}
								if(configChanged)//  Configure Image changes 222
								{
									componentsName.put("configChange",component.getName()+":"+component.getType());
								}
							}
						}
						else
						{
							if (component.getName().length()>compNameLength)
							{
								String strName =component.getName();
								String strDisplayName = component.getDisplayName();
								if (strName.endsWith(EgConstants.NULL_PORT) && (strName.indexOf(EgConstants.NULL_PORT) > -1))
								{
									strName = Server.getServerNameWithoutPort(strName, false);
								}

								int compNameLengthMain=25;
								if(isHostMaintenance || isComponentMaintenance)
								{
									compNameLengthMain = compNameLength-4;
								}
								if(configChanged)
								{
									compNameLengthMain = compNameLength-4;
								}
								if(strDisplayName!=null && strDisplayName.trim().length()>compNameLength)
									strDisplayName = strDisplayName.substring(0,compNameLength)+"...";
								
								String tempUrl = "";
								if(isShowPerformanceDashboard)
								{
									tempUrl=performanceDashboardURL+EgURLEncoder.encode(component.getType()+":"+component.getName(),"UTF-8");
								}
								else
								{
									tempUrl="/final/servlet/com.eg.EgDashboardController?from=list&site="+EgURLEncoder.encode(d.site,"UTF-8")+"&qctr=0&fromPage=componentList&newWindow=false&comptype="+EgURLEncoder.encode(component.getType(),"UTF-8")+"&host="+EgURLEncoder.encode(component.getName(),"UTF-8")+"&tab=LayerModel&fromHomepage="+fromHomepage+"&isfromZoneDash="+isfromZoneDash+"&fromDashboard="+fromDashboard+"&manyComponentTypes="+EgURLEncoder.encode(manyComponentTypes,"UTF-8")+"&manyComponentTitle="+manyComponentTitle+"&selTypeString="+EgURLEncoder.encode(d.selTypeString,"UTF-8");
								}

								if(parentZone!=null && parentZone.length()>0)
									tempUrl = tempUrl+"&parentZone="+parentZone;
							
								if(zoneName!=null && zoneName.length()>0)
									tempUrl = tempUrl+"&zoneName="+zoneName;
								if(isFromMenu!=null && isFromMenu.length()>0)
									tempUrl = tempUrl+"&isFromMenu="+isFromMenu;
								if(isFromZoneInfra!=null && isFromZoneInfra.length()>0)
									tempUrl = tempUrl+"&isFromZoneInfra="+isFromZoneInfra;
								if(isLogonType!=null && isLogonType.length()>0)
									tempUrl = tempUrl+"&isLogonType="+isLogonType;
								

								componentsName.put("link",tempUrl);
								componentsName.put("title",strName);
								componentsName.put("name",strDisplayName);
								componentsName.put("nameLength",Integer.toString(compNameLengthMain));

								if(isHostMaintenance || isComponentMaintenance)
								{
									componentsName.put("MaintenanceTime",maintenaceTimePeriodStr);
									componentsName.put("NoOfLines",noOfLines);
								}
								if(configChanged)//  Configure Image changes 444
								{
									componentsName.put("configChange",component.getName()+":"+component.getType());
								}
							}
							else
							{
								String tempLink ="";
								if(isShowPerformanceDashboard)
								{
									tempLink=performanceDashboardURL+EgURLEncoder.encode(component.getType()+":"+component.getName(),"UTF-8");
								}
								else
								{
									tempLink = "/final/servlet/com.eg.EgDashboardController?from=list&site="+EgURLEncoder.encode(d.site,"UTF-8")+"&qctr=0&fromPage=componentList&newWindow=false&comptype="+EgURLEncoder.encode(component.getType(),"UTF-8")+"&host="+EgURLEncoder.encode(component.getName(),"UTF-8")+"&tab=LayerModel&fromHomepage="+fromHomepage+"&isfromZoneDash="+isfromZoneDash+"&fromDashboard="+fromDashboard+"&manyComponentTypes="+EgURLEncoder.encode(manyComponentTypes,"UTF-8")+"&manyComponentTitle="+manyComponentTitle+"&selTypeString="+EgURLEncoder.encode(d.selTypeString,"UTF-8");
								}

								if(parentZone!=null && parentZone.length()>0)
									tempLink = tempLink+"&parentZone="+parentZone;
								
								if(zoneName!=null && zoneName.length()>0)
									tempLink = tempLink+"&zoneName="+zoneName;
								if(isFromMenu!=null && isFromMenu.length()>0)
									tempLink = tempLink+"&isFromMenu="+isFromMenu;
								if(isFromZoneInfra!=null && isFromZoneInfra.length()>0)
									tempLink = tempLink+"&isFromZoneInfra="+isFromZoneInfra;
								if(isLogonType!=null && isLogonType.length()>0)
									tempLink = tempLink+"&isLogonType="+isLogonType;
							

								componentsName.put("link",tempLink);
								componentsName.put("title",component.getDisplayName());
								componentsName.put("name",component.getDisplayName());
								if(isHostMaintenance || isComponentMaintenance)
								{
									componentsName.put("MaintenanceTime",maintenaceTimePeriodStr);
									componentsName.put("NoOfLines",noOfLines);
								}
								if(configChanged)//  Configure Image changes 555
								{
									componentsName.put("configChange",component.getName()+":"+component.getType());
								}
							}
						}
						componentsNamesArray.add(componentsName);
					}
					else{
						
					}
					if (j%3 == 2)
					{

					}
				}

				String typeState  = "GOOD";
				if(compStateList!=null && compStateList.size()>0)
				{
					Object[] stateArrays=compStateList.toArray();
					typeState  = EgAlarmTable.getHighestPriority(stateArrays);
				}

				componentsTypes.put("children",componentsNamesArray);
				componentsTypes.put("TypeState",typeState);
			}
			componentsTypesArray.add(componentsTypes);
		}
		listFields.put("ComponentList",componentsTypesArray);
	}
	if(r.typeList.isEmpty())
	{
		if(d.menuName!=null && d.menuName.equalsIgnoreCase("agg"))
		{
			json.put("error",mappingInfo.getTextDescription("monitor.servers.No Aggregate components found"));
		}
		else if(d.menuName!=null && d.menuName.equalsIgnoreCase("network"))
		{
			json.put("error",mappingInfo.getTextDescription("monitor.servers.No Network components found"));
		}
		else
		{
			json.put("error",mappingInfo.getTextDescription("monitor.servers.No components found"));
		}
	}
	json.put("HiddenFields",hiddenFields);
	json.put("ScreenLabels",screenLabels);
	json.put("FormFields",formFields);
	json.put("ListLabels",listFields);
	json.put("view",view);
	json.put("viewId",viewId);
	//viewPageTitle = viewPageTitle.replace(".","&#46");
	//json.put("viewPageTitle",mappingInfo.getTextDescription("monitor.servers."+viewPageTitle));
	json.put("viewPageTitle",viewPageTitle);
	json.put("viewTreeTitle",viewTreeTitle);
	json.put("componentType",componentType);
	json.put("manyComponentTypes",manyComponentTypes);
	json.put("manyComponentTitle",manyComponentTitle);
	json.put("selectedState",selectedState);
	json.put("filterBy",filterBy);
	json.put("subFilter",subFilter);
	json.put("componentNameSearch",componentNameSearch);
	json.put("fromPageView",fromPageView);
	json.put("action",action);
	json.put("stateName",stateName);
	json.put("fromHomepage",fromHomepage);
	json.put("userName",d.userName);
	//json.put("isFromMsDashboard",isFromMsDashboard);
	if(d.action!=null &&d.action.equalsIgnoreCase("globalsearch") || d.action.equalsIgnoreCase("globalsearchallcomponent") )
	{
	   if(request.getQueryString()!=null)
	   {
		  session.setAttribute("globalSearchLastSessionURL","/final/servlet/com.eg.EgMonitorController?"+request.getQueryString());
	   }
	   else
	   {
		session.setAttribute("globalSearchLastSessionURL","/final/servlet/com.eg.EgMonitorController?monCmd=componentList&from=TreeMenu&action=component&searchIndComps=checked");
	   } 
	}
	else
	{
		if(request.getQueryString()!=null)
		{
			String tmpuserName="";
			if(d.userName!=null && !d.userName.equalsIgnoreCase("undefined") && !d.userName.equalsIgnoreCase("null") && !d.userName.equalsIgnoreCase(""))
			{
				tmpuserName=d.userName;
			}
			//session.setAttribute("monitorLastSession","/final/servlet/com.eg.EgMonitorController?"+request.getQueryString());
			
			String fromTemVar="";
			if(fromPageView!=null && !fromPageView.equalsIgnoreCase("undefined") && !fromPageView.equalsIgnoreCase("null") && fromPageView.equalsIgnoreCase("Home"))
			{
				fromTemVar="MainDashboard";
			}
			else if(fromPageView!=null && !fromPageView.equalsIgnoreCase("undefined") && !fromPageView.equalsIgnoreCase("null") && (fromPageView.equalsIgnoreCase("Zone") || fromPageView.equalsIgnoreCase("HomeZone")))
			{
				fromTemVar="ZoneDashboard";
			}
			else if(fromPageView!=null && !fromPageView.equalsIgnoreCase("undefined") && !fromPageView.equalsIgnoreCase("null") && fromPageView.equalsIgnoreCase("Menu"))
			{
				fromTemVar="componentList";
			}
			
			if(filterBy!=null && filterBy.equalsIgnoreCase("zone") && subFilter!=null && subFilter.length()>0 && fromPageView!=null & (fromPageView.equalsIgnoreCase("Zone") || fromPageView.equalsIgnoreCase("HomeZone") || fromPageView.equalsIgnoreCase("zoneDashboard")))
			{
				if(fromPageView.equalsIgnoreCase("Zone") || fromPageView.equalsIgnoreCase("HomeZone"))
				{
				
				session.setAttribute("monitorLastSession","/final/servlet/com.eg.EgMonitorController?monCmd=componentList&from="+fromTemVar+"&action="+action+"&searchIndComps=true&viewId=components&viewPageTitle="+EgURLEncoder.encode(viewPageTitle,"UTF-8")+"&viewTreeTitle=Component&componentType="+EgURLEncoder.encode(componentType,"UTF-8")+"&fromPageView="+fromPageView+"&filterBy="+filterBy+"&stateName="+EgURLEncoder.encode(selectedState,"UTF-8")+"&selectedState="+EgURLEncoder.encode(selectedState,"UTF-8")+"&subFilter="+EgURLEncoder.encode(subFilter,"UTF-8")+"&zoneName="+EgURLEncoder.encode(subFilter,"UTF-8")+"&userName="+tmpuserName+"&isFromMenu=true&manyComponentTypes="+EgURLEncoder.encode(manyComponentTypes,"UTF-8")+"&manyComponentTitle="+manyComponentTitle+"&parentZone="+parentZone);
				}
				else if (fromPageView.equalsIgnoreCase("zoneDashboard"))
				{
					session.setAttribute("monitorLastSession","/final/servlet/com.eg.EgMonitorController?monCmd=componentList&from=componentList&action="+action+"&searchIndComps=true&viewId=components&viewPageTitle="+EgURLEncoder.encode(viewPageTitle,"UTF-8")+"&viewTreeTitle=Component&fromPageView="+fromPageView+"&filterBy="+filterBy+"&subFilter="+EgURLEncoder.encode(subFilter,"UTF-8")+"&zoneName="+EgURLEncoder.encode(subFilter,"UTF-8")+"&userName="+tmpuserName+"&isFromMenu=false&fromPageView=zoneDashboard&includeBoth=true&partOf=yes");
				}
			}
			else if(componentType!=null && !componentType.equalsIgnoreCase("undefined") && !componentType.equalsIgnoreCase("null") && componentType.length()>0 && fromPageView!=null && fromPageView.equalsIgnoreCase("Home"))
			{
				session.setAttribute("monitorLastSession","/final/servlet/com.eg.EgMonitorController?monCmd=componentList&from="+fromTemVar+"&action="+d.action+"&searchIndComps=true&viewId=components&viewPageTitle="+EgURLEncoder.encode(viewPageTitle,"UTF-8")+"&viewTreeTitle=Component&componentType="+EgURLEncoder.encode(componentType,"UTF-8")+"&fromPageView="+fromPageView+"&filterBy="+filterBy+"&stateName="+EgURLEncoder.encode(selectedState,"UTF-8")+"&selectedState="+EgURLEncoder.encode(selectedState,"UTF-8")+"&userName="+tmpuserName+"&isFromMenu=true"+"&manyComponentTypes="+EgURLEncoder.encode(manyComponentTypes,"UTF-8")+"&manyComponentTitle="+manyComponentTitle);
			}
			else if(componentType==null || componentType.equalsIgnoreCase("undefined") || componentType.equalsIgnoreCase("null") || componentType.length()==0)
			{
				if(d.selTypeString != null && d.selTypeString.length()>0)
				{
					//session.setAttribute("monitorLastSession","/final/servlet/com.eg.EgMonitorController?from=MainDashboard&monCmd=componentList&action=component&searchStateString=All States&searchNameString=&selTypeString="+d.selTypeString+"&searchTypeString=&searchIndComps=on&treeOpen=false&searchIndComps=on&componentListRefresh=yes");
					 if (d.menuName!= null && !d.menuName.equalsIgnoreCase("undefined") &&  d.menuName.equalsIgnoreCase("network"))
					{
						session.setAttribute("monitorLastSession","/final/servlet/com.eg.EgMonitorController?monCmd=componentList&from=componentList&action=search&isFromMenu=true&searchStateString="+d.searchStateString+"&searchNameString="+d.searchNameString+"&selTypeString="+d.selTypeString+"&searchTypeString="+d.searchTypeString+"&searchIndComps="+d.searchIndComps+"&treeOpen=false&menuName=network"+"&manyComponentTypes="+EgURLEncoder.encode(manyComponentTypes,"UTF-8")+"&manyComponentTitle="+manyComponentTitle);
					}
					else
					{
						String url = "/final/servlet/com.eg.EgMonitorController?monCmd=componentList&from=componentList&action=search&isFromMenu=true&searchStateString="+d.searchStateString+"&searchNameString="+d.searchNameString+"&selTypeString="+EgURLEncoder.encode(d.selTypeString,"UTF-8")+"&searchTypeString="+d.searchTypeString+"&searchIndComps="+d.searchIndComps+"&treeOpen=false"+"&manyComponentTypes="+EgURLEncoder.encode(manyComponentTypes,"UTF-8")+"&manyComponentTitle="+manyComponentTitle;
						if (d.menuName!= null && !d.menuName.equalsIgnoreCase("undefined"))
							url += "&menuName="+d.menuName;
						session.setAttribute("monitorLastSession",url);
					}					
				}
				else
				{
					 if (d.menuName!= null && !d.menuName.equalsIgnoreCase("undefined") &&  d.menuName.equalsIgnoreCase("network"))
					{
						session.setAttribute("monitorLastSession","/final/servlet/com.eg.EgMonitorController?monCmd=componentList&from="+d.from+"&action=component&searchIndComps=checked&isFromMenu=true&menuName=network");
					}
					else
					{
						String url = "/final/servlet/com.eg.EgMonitorController?monCmd=componentList&from="+d.from+"&action=component&searchIndComps=checked&isFromMenu=true";
						if (d.menuName!= null && !d.menuName.equalsIgnoreCase("undefined"))
							url += "&menuName="+d.menuName;
						session.setAttribute("monitorLastSession",url);
					}					
				}
			}
		}
		else
		{
			session.setAttribute("monitorLastSession","/final/servlet/com.eg.EgMonitorController?monCmd=componentList&from=TreeMenu&action=component&searchIndComps=checked");
		}
	}
	json.put("MonitorSkin",monitor_Skin);
	response.getWriter().write(json.toString());
}
catch(Exception t){
	t.printStackTrace();
	response.getWriter().write(t.toString());
}
%>

