<%
/********************************************************************************************************
*	Name			:	comparisonLogonSimulator.jsp
*	Version			:	6.2
*	CreationDate	:	May 30 2016
*	Author			:	Saranya.N
*******************************************************************************************************/
%>
<%@ include file = "EgMonitorTracker.jsp" %>
<%@ taglib prefix = "egui" uri = "../WEB-INF/eg-taglib.tld"%>
<%@ page import = "com.egurkha.ini.IniUI"%>
<%@ page import = "com.egurkha.*"%>
<%@ page import = "com.egurkha.util.*"%>
<%@ page import = "com.eg.*"%>
<%@ page import = "com.egurkha.util.StringUtils"%>
<%@ page import = "com.egurkha.monitor.VmDashboardHelper"%>
<%@ page import = "com.egurkha.monitor.*"%>
<%@ page import = "com.egurkha.monitor.MonitorUtility"%>
<%@ page import = "com.egurkha.monitor.MonitorUtilities"%>
<%@ page import = "com.egurkha.monitor.ServicesDashboardBean"%>
<%@ page import = "com.egurkha.monitor.alarms.AlarmPriorities" %>
<%@ page import = "com.egurkha.User"%>
<%@ page import = "com.egurkha.UserRegistry"%>
<%@ page import = "java.util.Enumeration"%>
<%@ page import = "java.text.DecimalFormat"%>  
<%@ page import="net.sf.json.*"%>
<%@page import = "java.util.*"%>
<%@page import = "java.util.TreeMap"%>
<%@page import = "java.sql.*"%>
<%@page import = "java.text.*"%> 
<%@ page import = "com.eg.supermanager.*" %>
<%@ page import = "com.eg.EgInstallInfo" %>
<%@ page import = "com.eg.EgURLEncoder" %>
<%@ page import="com.egurkha.util.EgSorter"%>
<%@ page import="com.eg.EgExternalInfo"%>
<%@ page import="com.egurkha.admin.EgMaintenanceUtility"%>
<%@ page import = "com.eg.EgConfigChangeThread"%>
<%@ page import="egurkha.EgDbAdapterUI"%>
<%@ page import="com.eg.EgDbAdapterTypeUI"%>
<%@ page errorPage="EgProbsM.jsp" %>

<%@ page language="java" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" %>
<%
	if(EgInstallInfo.isSuperManager)
	{
		String currentSession = session.getId();
		String selected_Param=request.getParameter("selectedParam");
		if(selected_Param != null)
		{
			ArrayList managerIDs = EgElementInfo.getInstance().getManagerIDs("service",selected_Param);
			if(managerIDs != null && !managerIDs.isEmpty())
			{
				SmSessionData smsData = new SmSessionData(currentSession,managerIDs);
				EgThreadLocal egtl = new EgThreadLocal();
				egtl.set(smsData);
				new SMDateTimeConverter(managerIDs);
			}
		}
	}
	response.setHeader("Cache-Control","no-store");
	response.setHeader("Pragma","no-cache");
	response.setDateHeader ("Expires", -1);
	response.setContentType("application/json");
	request.setCharacterEncoding("UTF-8");
	int c = 0;
	int colCount = 0;
	boolean cell_color=false;
	String key = "";
	String stest = "";
	String smeasure = "";
	String sdispName = "";
	String unitMeasure = "";
	String displayUnit = "";
	String dbMeasure = "";
	String measureValue = "";
	String compType = "";
	String compName = "";
	String compState = "";
	String dispComp = "";
	String url = "";
	String Measureurl = "";
	String site = "";
	String testMeas[] = null;
	String widthOfTheHead="";
	String hostNameToken[]=null;
	String hostName = "";
	String hostPort  = "";
	String msmtHost = "";
	String db_Measureandtest="";
	EgDbInfo dbInfo = new EgDbInfo("manager");
	EgTablesInfo tablesInfo = new EgTablesInfo("manager");
	EgExternalInfo egExternalInfo=new EgExternalInfo("manager");
	EgDateInfo dateInfo=new EgDateInfo();
	EgMaintenanceInfo egM=new EgMaintenanceInfo("manager");
	EgMaintenanceUtility maintenanceUtil=new EgMaintenanceUtility();
	MonitorUtility monUtil = new MonitorUtility();

	IniUI iniUI = IniUI.getInstance();
	String thisLanguage = iniUI.getDefaultLanguage();
	//EgMappingInfo mappingInfo = new EgMappingInfo(thisLanguage);
	UserRegistry registry = UserRegistry.getInstance();
	User user = registry.getUser(session.getId());
	Map allTestList = user.getTests();
	String uiFile = "eg_ui.ini";
	String s_iniFile_dir = EgInstallInfo.getInstallDir()+ "/manager/config/";
	IniFile egUI = new IniFile(s_iniFile_dir + uiFile);
	//String s_iniFile_dir = EgInstallInfo.getInstallDir()+ "/manager/config/";
	com.eg.IniFile egDashConfig = new com.eg.IniFile(s_iniFile_dir+"eg_dashboardConfig.ini");
	com.eg.IniFile externalIni = new com.eg.IniFile(EgInstallInfo.getInstallDir() + "/manager/config/eg_external.ini", false);

	com.eg.IniFile iniFileforMonitors = new com.eg.IniFile(EgInstallInfo.getInstallDir() + "/manager/config/eg_extmondash.ini", false);

	List serverTypeList = null;

	EgSpecsInfo specsInfo = new EgSpecsInfo("manager");
	MonitorUtilities monUtilities = new MonitorUtilities(user);
	if (user!=null)
	{
		String userLang = user.getLanguage();
		if (userLang!=null && !userLang.equalsIgnoreCase("NULL"))
		{
			thisLanguage=userLang;
		}
		serverTypeList = user.getServerTypes();
	}
	boolean isUserLanguageEnglish=true;
	if(thisLanguage!=null && !thisLanguage.equals("en_US"))
	{
		isUserLanguageEnglish=false;
	}

	String qString = request.getQueryString();
	int headerLength=18;
	String selectedState = request.getParameter("selectedState");
	String selectedNode = request.getParameter("selectedParam");
	String treeTitle = request.getParameter("treeTitle");
	treeTitle=(treeTitle==null)?"":treeTitle;
	String filterBy = request.getParameter("filterBy");
	filterBy=(filterBy==null)?"ExternalMonitor":filterBy;
	String subFilter = request.getParameter("subFilter");
	subFilter=(subFilter==null || subFilter.trim().length()==0)?"-1":subFilter;
	String componentNameSearch = request.getParameter("componentNameSearch");
	componentNameSearch=(componentNameSearch==null || componentNameSearch.trim().length()==0 || componentNameSearch.equals("null"))?"":componentNameSearch;
	
	if(componentNameSearch!=null && componentNameSearch.trim().length()>0)
	{
		componentNameSearch=com.egurkha.util.StringUtils.replace(componentNameSearch,"|plus|","+");
		componentNameSearch=com.egurkha.util.StringUtils.decodeSecurityChar(componentNameSearch);
	}
	String simulationName = request.getParameter("simulationName");
	simulationName=(simulationName==null || simulationName.trim().length()==0 || simulationName.equals("null"))?"":simulationName;
	String measure_sort=request.getParameter("column");
	String sort_type=request.getParameter("sortOrder");
	String priority = request.getParameter("priority");
	String imageId=request.getParameter("imgId");
	String monitorsBy=request.getParameter("monitorsBy");
	monitorsBy=(monitorsBy==null)?"":monitorsBy;
	String locationBy=request.getParameter("locationBy");
	locationBy=(locationBy==null)?"":locationBy;
	String externalAgent=request.getParameter("externalAgent");
	String isFromInfraHome=request.getParameter("isFromInfraHome");
	String isFromMenu1=request.getParameter("isFromMenu");
	String isFromZoneInfra=request.getParameter("isFromZoneInfra");
	String fromExtComboChange=request.getParameter("fromExtComboChange");
	String ltype=request.getParameter("ltype");
	String ltest=request.getParameter("ltest");
	String fromHomepage=request.getParameter("fromHomepage");
	boolean isExchange = (ltest != null && ltest.equalsIgnoreCase("XchgLogonSimTest"));

	if((ltype == null || ltype.trim().length() == 0) && treeTitle != null && treeTitle.trim().length() > 0)
	{
		treeTitle = treeTitle.trim();
		if(treeTitle.equalsIgnoreCase("LogonSimulation"))
			ltype="citrix";
		else if(treeTitle.equalsIgnoreCase("horizonlogonSimualtion"))
			ltype="horizon";
	}
	
	String toFindLType = ltype;

	if((ltype == null || ltype.trim().length() == 0 || ltype.equalsIgnoreCase("null")) && (ltest != null && ltest.trim().length() > 0)){
		ltype = "";
		ArrayList serverList = specsInfo.getAllComponentTypesForTest(ltest);
		List usr_server = user.getServerTypes();
		if(serverList != null && serverList.size() > 0 && usr_server != null && usr_server.size() > 0){
			for(int k=0;k<serverList.size();k++){
				String serverType = (String)serverList.get(k);
				if(serverType != null && serverType.trim().length() > 0 && usr_server.contains(serverType))
				{
					ltype += serverType+",";

					if(k==0)
					{
						toFindLType = serverType;

					}
				}
			}
			if(ltype != null && ltype.endsWith(","))
				ltype = ltype.substring(0,ltype.trim().length()-1);
		}
	}

	String zoneName=request.getParameter("zoneName");
	boolean isFromZoneInfraHome = false;
	if(isFromZoneInfra != null && isFromZoneInfra.equalsIgnoreCase("true") && zoneName != null && zoneName.trim().length() > 0)
		isFromZoneInfraHome = true;

	HashMap testMeasureConversionMap = new HashMap();
	String[] testMeasureCon = egDashConfig.getVariables("ExtTestDashboard_Unit_Convert");
	Vector testMeasureConVal = egDashConfig.getAllValues("ExtTestDashboard_Unit_Convert");
	if(testMeasureCon != null && testMeasureCon.length > 0){
		for(int k=0;k<testMeasureCon.length;k++)
			testMeasureConversionMap.put(testMeasureCon[k],(String)testMeasureConVal.get(k));
	}

	
	String isfromCitrix=request.getParameter("isfromCitrix");
	String isfromRum=request.getParameter("isfromRum");
	String isFromZone = request.getParameter("isFromZone");
	String iszoneName = request.getParameter("iszoneName");
	String parentZone = request.getParameter("parentZone");
	String appliesTo=request.getParameter("appliesTo");
	String iniName=request.getParameter("iniName");
	String user_name=request.getParameter("user_name");
	String dashboard_mapping=request.getParameter("dashboard_mapping");
	String dashboard_name=request.getParameter("dashboard_name");
	String view_name=request.getParameter("view_name");
	String fromServiceDashboard=request.getParameter("fromServiceDashboard");
	String fromSerComboChange=request.getParameter("fromSerComboChange");
	String fromServiceHomePage=request.getParameter("fromServiceHomePage");
	String servicename=request.getParameter("servicename");
	boolean isLogonType = "true".equals(request.getParameter("isLogonType"))?true:false;
	
	String filter=request.getParameter("filter");
	String filterBy1 = request.getParameter("filterBy");
	String selectedRum=request.getParameter("selectedRum");	
	String isFromServiceMenu=request.getParameter("isFromServiceMenu");	
	String isFromZoneMain=request.getParameter("isFromZoneMain");	
	String isFromZoneMenu=request.getParameter("isFromZoneMenu");	
	String isFromServiceGroup=request.getParameter("isFromServiceGroup");
	
	boolean isCitraType = false;	
	String testNameMonitorBy = egDashConfig.getValue("New_View_External_Monitor",monitorsBy);
	if(testNameMonitorBy != null && testNameMonitorBy.trim().length()>0)
		isCitraType = true;

	boolean isLogonForService = false;
	if(dashboard_name != null && dashboard_name.trim().length()>0 && isFromServiceMenu != null && isFromServiceMenu.trim().length()>0)
		isLogonForService = true;

	if(fromServiceDashboard != null && servicename != null && servicename.length() > 0 && fromServiceDashboard.equalsIgnoreCase("true"))
	{
		
		if(simulationName != null && simulationName.length() > 0)
			session.setAttribute("selectedLogonComponent",simulationName);
		else if(componentNameSearch != null && componentNameSearch.length() > 0)
			session.setAttribute("selectedLogonComponent",componentNameSearch);
		if(externalAgent != null && externalAgent.length() > 0)
			session.setAttribute("selectedExternalAgent",externalAgent);
	}
	else
	{
		session.removeAttribute("selectedLogonComponent");
		session.removeAttribute("selectedExternalAgent");
	}


	List zoneComponents = null;
	List zoneCompNickList = new ArrayList();
	List zoneExternalAgentList = new ArrayList();
	if(isFromZoneInfraHome)
	{
		serverTypeList = new ArrayList();
		EgGroupInfo groupInfo = new EgGroupInfo();
		zoneComponents = groupInfo.getAllComponentsUnderZone(zoneName,true);
		if(zoneComponents != null && zoneComponents.size() > 0){
			for(int l=0;l<zoneComponents.size();l++){
				String zoneMname = (String)zoneComponents.get(l);
				String tempZoneName = zoneMname.substring(0,zoneMname.indexOf(":"));
				serverTypeList.add(tempZoneName);
				
				zoneMname = zoneMname.substring(zoneMname.indexOf(":")+1);
				zoneCompNickList.add(zoneMname);
				
				String tempCompZoneName = zoneMname.substring(0,zoneMname.indexOf(":"));

				String externalAgentsname=externalIni.getValue("Test_Mapping_Section",tempCompZoneName);			
				
				//zoneMname = zoneMname.substring(zoneMname.indexOf(":")+1,zoneMname.lastIndexOf(":"));
				ArrayList al_cols_extAgent = com.egurkha.util.StringUtils.egTokenizer(externalAgentsname, ",",true,false,true);//3-->includeEmpty,4-->unique,5-->trim
				if(al_cols_extAgent != null && al_cols_extAgent.size() > 0)
				{
					for(int h=0;h<al_cols_extAgent.size();h++)
					{
						String temP_externalAgentsname = (String)al_cols_extAgent.get(h);
						if(!zoneExternalAgentList.contains(temP_externalAgentsname))
							zoneExternalAgentList.add(temP_externalAgentsname);
					}
				}
			}
		}
	}
	boolean isFromInfra = false;
	if(isFromInfraHome != null && isFromInfraHome.equalsIgnoreCase("true"))
		isFromInfra = true;

	EgTablesInfo tables=new EgTablesInfo("manager");
	if(imageId==null)
	{
		imageId="";
	}

	//toFindLType = (toFindLType == null || toFindLType.trim().length()==0)?"citrix":toFindLType;
	String sessionUrl="/final/monitor/comparisonDashboard.jsp?";
		
	sessionUrl +="treeTitle="+treeTitle+"&isFromMenu="+isFromMenu1;

	if(externalAgent != null && externalAgent.trim().length() > 0)
		sessionUrl+="&externalAgent="+externalAgent;

	if(selectedState != null && selectedState.trim().length() > 0)
		sessionUrl+="&selectedState="+selectedState;
	if(isFromInfraHome != null && isFromInfraHome.trim().length() > 0)
		sessionUrl+="&isFromInfraHome="+isFromInfraHome;
	if(isFromZoneInfra != null && isFromZoneInfra.trim().length() > 0)
		sessionUrl+="&isFromZoneInfra="+isFromZoneInfra;
	if(zoneName != null && zoneName.trim().length() > 0)
		sessionUrl+="&zoneName="+zoneName;
	if(toFindLType != null && toFindLType.trim().length() > 0)
		sessionUrl+="&ltype="+toFindLType;
	if(ltest != null && ltest.trim().length() > 0)
		sessionUrl+="&ltest="+ltest;
	if(monitorsBy != null && monitorsBy.trim().length() > 0)
		sessionUrl+="&monitorsBy="+monitorsBy;


	
	String selectedTab = "ExternalMonitor";
	priority=(priority==null)?"":priority;
	ServicesDashboardBean serviceBean = new ServicesDashboardBean();
	EgList compList=new EgList();
	EgDiscInfo discInfo = new EgDiscInfo("manager");
	
	JSONObject json  = new JSONObject();
	JSONArray  columns = new JSONArray();
	JSONArray  measures = new JSONArray();
	JSONObject sortByMainOptions  = new JSONObject();
	JSONArray  selectOptions = new JSONArray();
	JSONArray  monitorselectOptions = new JSONArray();
	JSONArray  locationselectOptions = new JSONArray();
	JSONArray  sortByOptions = new JSONArray();
	JSONArray filterByOptions = new JSONArray();
	JSONObject jOpt = new JSONObject();
	JSONObject pageParams = new JSONObject();
	JSONObject monitorTypeOptions  = new JSONObject();
	JSONObject locationsTypeOPtions  = new JSONObject();
	JSONObject externalAgentObj  = new JSONObject();
	JSONArray  externalAgentArr = new JSONArray();
	JSONObject externalTestObj  = new JSONObject();
	JSONArray  externalTestArr = new JSONArray();
	request.setAttribute("jsonObject",json);
	request.setAttribute("category","service");
	request.setAttribute("itemName",selectedNode);

	MonitorDAOFactory monitorDaoFactory = MonitorDAOFactory.getInstance();
	EgServerDashBoardDAO dashboardDAO=monitorDaoFactory.getServerDashBoardDAO();
	boolean isSingleExtAgent = false;
	AlarmPriorities ap = AlarmPriorities.getInstance();
	int pages=0;
	int totalRecords=10000;
	int totalRecordsCount=0;
	int recount=0;
	int pagesizec=0;
	int pageSize = 0;
	
	String monitorBy_icon=egDashConfig.getValue("TREE_External_Descriptors_view",monitorsBy+":ICON");
	ArrayList iconList = new ArrayList();
	if(monitorBy_icon != null)
		iconList = com.egurkha.util.StringUtils.egTokenizer(monitorBy_icon, ",",true,false,true);//3-->includeEmpty,4-->unique,5-->trim
	
	
	String LogonSim_Default_Pagesize=egDashConfig.getValue("TREE_SYSTEM_SETTINGS","LogonSim_Default_Pagesize");
	if(LogonSim_Default_Pagesize != null && LogonSim_Default_Pagesize.trim().length() > 0)
		pageSize=Integer.parseInt(LogonSim_Default_Pagesize.trim());
	
	if(pageSize == 0)
	{
		String Default_Pagesize=egDashConfig.getValue("TREE_SYSTEM_SETTINGS","Default_Pagesize");
		Default_Pagesize=(Default_Pagesize==null || Default_Pagesize.trim().length()==0)?"10":Default_Pagesize;
		pageSize=Integer.parseInt(Default_Pagesize.trim());
	}

	
	/*
	Get the components under the service
	*/
	//String selectedSubFilterOption = null;
	EgList componentList =null;
	EgList searchApplicationComponent=null;
	List usr_server=user.getServers(false);
	List zones_list = new LinkedList();
	List services_list = new LinkedList();
	List segments_list = new LinkedList();
	List System_list = new LinkedList();
	zones_list.addAll(user.getZones());
	segments_list.addAll(user.getSegments());
	services_list.addAll(user.getServices());
	System_list.addAll(user.getServers(false));

	//List compTypeList = new ArrayList();
	String l_ctype = ltype;
	
	boolean isMultiCompType = false;
	if(monitorsBy != null && monitorsBy.trim().length()>0 && (monitorsBy.equalsIgnoreCase("HTTP") || monitorsBy.equalsIgnoreCase("NETWORK")))
	{
		isMultiCompType = true;
	}
	List testList = new ArrayList();

	String l_test = ltest;

	testList.add(l_test);

	EgUserRole userRole = user.getUserRole();
	boolean hasConfigSupport = userRole.hasAnyConfigRole(EgUserPermission.CONFIG);
	Hashtable ht_changeHash = EgConfigChangeThread.ht_changeHash;

	String monitorsTypeOptions[]=egDashConfig.getVariables("All_Monitor_Disp_Name");
	ArrayList monitorsTypeOptionsList = new ArrayList();
	if(monitorsTypeOptions!=null && monitorsTypeOptions.length>0)
	{
		ArrayList tlist = new ArrayList(Arrays.asList(monitorsTypeOptions));
		if(tlist!=null && tlist.size()>0)
			monitorsTypeOptionsList.addAll(tlist);
	}
	if(monitorsTypeOptionsList!=null && monitorsTypeOptionsList.size()>0)
	{
		EgSorter esort=new EgSorter(monitorsTypeOptionsList,1);
		monitorsTypeOptionsList=(ArrayList)esort.sort(1,"String","asc");
	}
	if(monitorsTypeOptionsList!=null && monitorsTypeOptionsList.size()>0)
	{
		/*jOpt  = new JSONObject();
		jOpt.put("value","-1");
		jOpt.put("name","selectMonitors");
		monitorselectOptions.add(jOpt);
		monitorTypeOptions.put("selectedMonitorsType","-1");*/
		for(int monT=0;monT<monitorsTypeOptionsList.size();monT++)
		{
			String monitorsTypeOptionVal = (String)monitorsTypeOptionsList.get(monT);
			String monitorsTypeOptionsVal=egDashConfig.getValue("All_Monitor_Disp_Name",monitorsTypeOptionVal);
			if(monitorsTypeOptionsVal!=null && monitorsTypeOptionsVal.length()>0)
			{
				jOpt = new JSONObject();
				jOpt.put("value",monitorsTypeOptionVal);
				jOpt.put("name",monitorsTypeOptionsVal);
				monitorselectOptions.add(jOpt);

				if(monitorsBy != null && monitorsBy.trim().equalsIgnoreCase(monitorsTypeOptionVal))
				{
					monitorTypeOptions.put("selectedMonitorsType",monitorsBy);
				}
				
			}
		}
	}
	
	monitorTypeOptions.put("monitorselectOptions",monitorselectOptions);
	
	Hashtable loct =new Hashtable();
	String locationsTypeOptionsVar[]=iniFileforMonitors.getVariables("Eg_External_Agents_Locations");
	if(locationsTypeOptionsVar!=null && locationsTypeOptionsVar.length>0)
	{
		for(int logT=0;logT<locationsTypeOptionsVar.length;logT++)
		{
			String locationsTypeOptionsVal=iniFileforMonitors.getValue("Eg_External_Agents_Locations",locationsTypeOptionsVar[logT]);
			if(locationsTypeOptionsVal!=null && locationsTypeOptionsVal.length()>0)
			{
				if(loct.containsKey(locationsTypeOptionsVal))
				{
					String old_val=(String)loct.get(locationsTypeOptionsVal);
					old_val=old_val+","+locationsTypeOptionsVar[logT];
					loct.put(locationsTypeOptionsVal,(String)old_val);
				}
				else
				{
					loct.put(locationsTypeOptionsVal,locationsTypeOptionsVar[logT]);
				}
			}
		}
	}
	if(loct!=null && loct.size()>0)
	{
		jOpt = new JSONObject();
		jOpt.put("value","all");
		jOpt.put("name","ALL");
		locationselectOptions.add(jOpt);
		locationsTypeOPtions.put("selectedLocationsType","all");
		Enumeration loctEnum = loct.keys();
		while (loctEnum.hasMoreElements()) 
		{
			String locKey = (String) loctEnum.nextElement();
			jOpt  = new JSONObject();
			jOpt.put("value",loct.get(locKey));
			jOpt.put("name",locKey);
			locationselectOptions.add(jOpt);

			if(locationBy.equals(loct.get(locKey)))
			{
				locationsTypeOPtions.put("selectedLocationsType",loct.get(locKey));
			}
			
		}
	}
	
	locationsTypeOPtions.put("locationselectOptions",locationselectOptions);

	String externalAgents[] = null;
	if(treeTitle != null && treeTitle.trim().length() > 0 && treeTitle.indexOf("logon") !=-1)
		externalAgents = externalIni.getVariables("Emulation_by_external_agents");
	else
		externalAgents = egExternalInfo.getAllExternalAgents();

	ArrayList userViseExtAgent = new ArrayList();
	ArrayList userVisecompName = new ArrayList();

	if(usr_server != null && usr_server.size() > 0){
		for(int p=0;p<usr_server.size();p++){
			String el = (String)usr_server.get(p);
			StringTokenizer st_server = new StringTokenizer(el,":");
			String type = "";
			String comp = "";
			String port = "";
			String sid = "";
			String toAdd = "";
			int cntTokens = st_server.countTokens();
			if(st_server.hasMoreTokens())
			{
				type = st_server.nextToken();
				comp = st_server.nextToken();
				port = st_server.nextToken();
				if(cntTokens == 4)
					sid = st_server.nextToken();
				if(type != null && (type.equalsIgnoreCase(l_ctype) || l_ctype.indexOf(type) != -1)){
					userVisecompName.add(comp+":"+port);
					if(!isLogonType && !userVisecompName.contains(comp+":"+"NULL"))
						userVisecompName.add(comp+":"+"NULL");
					String extUser = externalIni.getValue("Test_Mapping_Section",comp);
					ArrayList al_cols_extAgent = com.egurkha.util.StringUtils.egTokenizer(extUser, ",",true,false,true);//3-->includeEmpty,4-->unique,5-->trim
					if(al_cols_extAgent != null && al_cols_extAgent.size() > 0)
					{
						for(int h=0;h<al_cols_extAgent.size();h++)
							userViseExtAgent.add((String)al_cols_extAgent.get(h));
					}
					
				}
			}
		}
	}
	
	String errorMsg = mappingInfo.getTextDescription("monitor.serviceDashboard.No current data for simulations");
	if(!isCitraType)
		errorMsg = mappingInfo.getTextDescription("monitor.serviceDashboard.No data found");
	String tempFrom="MainDashboard";
	if(zoneName!=null && zoneName.trim().length()>0 && !zoneName.equalsIgnoreCase("NULL"))
	{
		tempFrom="ZoneDashboard";
	}
	String comp_list_url="../servlet/com.eg.EgMonitorController?monCmd=componentList&from="+tempFrom+"&action=componentTypeState&componentType="+EgURLEncoder.encode(l_ctype,"UTF-8")+"&searchIndComps=true&stateName="+selectedState+"&fromPageView=simulator";
	if(isMultiCompType)
		comp_list_url="../servlet/com.eg.EgMonitorController?monCmd=componentList&from="+tempFrom+"&action=componentTypeState&searchIndComps=true&stateName="+selectedState+"&fromPageView=simulator";

	String comp_list_url1="../servlet/com.eg.EgMonitorController?monCmd=componentList&from="+tempFrom+"&action=componentType&searchIndComps=true&viewId=components&viewPageTitle=title&viewTreeTitle=Component&componentType="+EgURLEncoder.encode(l_ctype,"UTF-8")+"&fromPageView=simulator&filterBy=Component";

	if(isMultiCompType)
		comp_list_url1="../servlet/com.eg.EgMonitorController?monCmd=componentList&from="+tempFrom+"&action=componentType&searchIndComps=true&viewId=components&viewPageTitle=title&viewTreeTitle=Component&fromPageView=simulator&filterBy=Component";

	String checkLogonType=request.getParameter("isLogonType");
	if(checkLogonType!=null && (checkLogonType.equalsIgnoreCase("true")||checkLogonType.equalsIgnoreCase("false")))
	{
		isFromMenu1="false";
	}
	if(isFromZoneMenu!=null && isFromZoneMenu.trim().length()>0 && isFromZoneMenu.equalsIgnoreCase("true") || (fromHomepage != null && fromHomepage.trim().length()>0  && fromHomepage.equalsIgnoreCase("true")))
	{
	
		isFromMenu1="false";
		checkLogonType="";
		
	}
	
	if(treeTitle != null && ltest != null && monitorsBy != null && checkLogonType != null){
		comp_list_url1+="&treeTitle="+treeTitle+"&ltest="+ltest+"&monitorsBy="+monitorsBy+"&isLogonType="+checkLogonType+"&isFromMenu=false";
		comp_list_url+="&treeTitle="+treeTitle+"&ltest="+ltest+"&monitorsBy="+monitorsBy+"&isLogonType="+checkLogonType+"&isFromMenu=false";
	}
	
	String paramForBackButton ="isFromZoneInfra&zoneName&parentZone&fromHomepage&isFromZoneMenu&selectedState";
	StringTokenizer paramForBack = new StringTokenizer(paramForBackButton,"&");
	String keyParam="";
	while(paramForBack.hasMoreTokens())
	{
		keyParam = (String) paramForBack.nextToken();
		String requestParam=request.getParameter(keyParam);
		if(requestParam!= null && !requestParam.equalsIgnoreCase("") && !requestParam.equalsIgnoreCase("NULL"))
		{
			comp_list_url+="&"+keyParam+"="+requestParam;
			comp_list_url1+="&"+keyParam+"="+requestParam;
		}
		
	}


	if((isfromCitrix != null && isfromCitrix.equalsIgnoreCase("true")) || (isfromRum != null && isfromRum.equalsIgnoreCase("true")))
	{
		errorMsg = mappingInfo.getTextDescription("monitor.serviceDashboard.No current data for simulations");
	}
	else
	{
		if(selectedState != null && selectedState.trim().length() > 0){
			//errorMsg +="<br><a href='"+comp_list_url+"'>Click here to view <u>Components List</u></a>";
			if(fromServiceDashboard != null && !fromServiceDashboard.equals("") && fromServiceDashboard.equalsIgnoreCase("true"))
				errorMsg +="<br><a href=\"javascript:void(0);\" onClick=\"javascript:OpenLayerModel(\'"+comp_list_url+"\',true);\">Click here to view <u>Components List</u></a>";
			else
				errorMsg +="<br><a href=\"javascript:void(0);\" onClick=\"javascript:OpenLayerModel(\'"+comp_list_url+"\',false);\">Click here to view <u>Components List</u></a>";
		}
		else{
			//errorMsg +="<br><a href='"+comp_list_url1+"'>Click here to view <u>Components List</u></a>";
			if(fromServiceDashboard != null && !fromServiceDashboard.equals("") && fromServiceDashboard.equalsIgnoreCase("true"))
				errorMsg +="<br><a href=\"javascript:void(0);\" onClick=\"javascript:OpenLayerModel(\'"+comp_list_url1+"\',true);\">Click here to view <u>Components List</u></a>";
			else
				errorMsg +="<br><a href=\"javascript:void(0);\" onClick=\"javascript:OpenLayerModel(\'"+comp_list_url1+"\',false);\">Click here to view <u>Components List</u></a>";
		}
	}
	int monitorComboWidth=250;
	if(userVisecompName.size() == 0)
		errorMsg = mappingInfo.getTextDescription("monitor.serviceDashboard.No Components Managed");
	
	if(externalAgents != null && externalAgents.length > 0){
		List externalAgentsListAll = Arrays.asList(externalAgents);
		Collections.sort(externalAgentsListAll);

		List externalAgentsList = new ArrayList();
		for(int p=0;p<externalAgentsListAll.size();p++){
			String agentInfo =  (String) externalAgentsListAll.get(p);
			
			if(fromExtComboChange != null && fromExtComboChange.equalsIgnoreCase("true"))
			{
				if(!userViseExtAgent.contains(agentInfo))
					continue;

				externalAgentsList.add(agentInfo);
				continue;
			}

			if(!userViseExtAgent.contains(agentInfo))
				continue;
			if(isFromZoneInfraHome && !zoneExternalAgentList.contains(agentInfo))
				continue;
			externalAgentsList.add(agentInfo);
		}
		if(externalAgentsList != null && externalAgentsList.size() > 1)
		{
			jOpt = new JSONObject();
			jOpt.put("value","all");
			jOpt.put("name","All");
			externalAgentArr.add(jOpt);
		}else
		{
			isSingleExtAgent = true;
		}

		if( /*(isFromInfra || isFromZoneInfraHome) &&*/ (externalAgent == null || externalAgent.trim().length() ==0)){
			externalAgent="all";
		}
		externalAgentObj.put("selectedextAgentType",externalAgent);

		for(int p=0;p<externalAgentsList.size();p++){
			String agentInfo =  (String) externalAgentsList.get(p);
			
			jOpt  = new JSONObject();
			jOpt.put("value",agentInfo);
			jOpt.put("name",agentInfo);
			externalAgentArr.add(jOpt);
			
			if(isSingleExtAgent){
				externalAgentObj.put("selectedextAgentType",agentInfo);
				externalAgent=agentInfo;
			}
		}
		externalAgentObj.put("externalAgentArr",externalAgentArr);
	}
	boolean isallTestList = false;
	if(allTestList!=null && allTestList.size()>0 )
		isallTestList = true;
	String enableSEUMDashboard = iniFileforMonitors.getValue("USER_SETTINGS","EnableSEUMDashboard");
	boolean isEnableSEUMDashboard = (enableSEUMDashboard.equalsIgnoreCase("true") || enableSEUMDashboard.equalsIgnoreCase("yes"))?true:false;
	//if(!isLogonType && (treeTitle != null && treeTitle.trim().length() > 0))
	{
		ArrayList allMonitorsList = new ArrayList();
		Hashtable monitorsAllTest = new Hashtable();		
		Hashtable monitorsSimulationTest = new Hashtable();			

		if(isEnableSEUMDashboard)
		{
			Vector params = egDashConfig.getAllValues("ExtTestDashboard");
			if(params != null && params.size() > 0){
				for(int p=0;p<params.size();p++){
					String test =  (String) params.get(p);
					String disp_test = mappingInfo.getTestDescription(test);
					if(test.equalsIgnoreCase("OraSqlNetTest") && serverTypeList.contains("Oracle_server"))		
						disp_test = mappingInfo.getTextDescription("monitor.endUserDashboard.Oracle");				
					else if(test.equalsIgnoreCase("MsSqlNetTest") && serverTypeList.contains("MS_sql_server"))		
						disp_test = mappingInfo.getTextDescription("monitor.endUserDashboard.Microsoft SQL");
					else if(test.equalsIgnoreCase("CitraTest"))
						disp_test = mappingInfo.getTextDescription("monitor.endUserDashboard.Client Session Simulation");
					else if(test.equalsIgnoreCase("GenericLogonSimTest"))
						disp_test = mappingInfo.getTextDescription("monitor.endUserDashboard.Web App Simulation");
					else if(test.equalsIgnoreCase("HttpTest"))
						disp_test = mappingInfo.getTextDescription("monitor.endUserDashboard.HTTP Access");
					else if(test.equalsIgnoreCase("NetworkTest"))
						disp_test = mappingInfo.getTextDescription("monitor.endUserDashboard.Network Access");
					else
						continue;

					allMonitorsList.add(disp_test);
					monitorsAllTest.put(disp_test,test);
				}
			}
		}
		String s_support_list[]= egDashConfig.getVariables("SIMULATION_SUPPORT");
		if(s_support_list!=null && s_support_list.length>0)
		{
			for(int monT=0;monT<s_support_list.length;monT++)
			{
				String s_support_type = s_support_list[monT];
				String s_support_type_name =egDashConfig.getValue("SIMULATION_SUPPORT",s_support_type);
				if(serverTypeList!=null && serverTypeList.size()>0 && serverTypeList.contains(s_support_type))
				{
					String comparison_tree_value = egDashConfig.getValue("TREE_PAGE_SETTINGS",s_support_type_name);
					String Stoken[] = StringUtils.getTokens(comparison_tree_value,"~$~");
					String test= null;
					String urlSt = Stoken[1];
					String test_name = urlSt.substring(urlSt.lastIndexOf("=")+1);
					test = test_name;

					if(monitorComboWidth<((Stoken[0].length()*7)+65))
						monitorComboWidth = (Stoken[0].length()*7)+65;
					
					monitorsSimulationTest.put(test,s_support_type_name);					
					monitorsAllTest.put(mappingInfo.getTextDescription("monitor.endUserDashboard."+Stoken[0]),test);
					allMonitorsList.add(mappingInfo.getTextDescription("monitor.endUserDashboard."+Stoken[0]));

				}
				else
				{
					String comparison_tree_value = egDashConfig.getValue("TREE_PAGE_SETTINGS",s_support_type_name);
					String Stoken[] = StringUtils.getTokens(comparison_tree_value,"~$~");
					String test= null;
					String urlSt = Stoken[1];
					String test_name = urlSt.substring(urlSt.lastIndexOf("=")+1);
					test = test_name;
					if(ltest != null && ltest.trim().equalsIgnoreCase(test))
					{
					  if(monitorComboWidth<((Stoken[0].length()*7)+66))
						 monitorComboWidth = (Stoken[0].length()*7)+66;
					   ltest = (String) mappingInfo.getTextDescription("monitor.endUserDashboard."+Stoken[0]);
					   externalAgent = "-1";
					   externalAgentObj.put("selectedextAgentType",externalAgent);
					}
				}
			}
		}
		if(allMonitorsList!=null && allMonitorsList.size()>0)
		{
			EgSorter esort=new EgSorter(allMonitorsList,1);
			allMonitorsList=(ArrayList)esort.sort(1,"String","asc");
		}

		if(allMonitorsList != null && allMonitorsList.size()>0 && monitorsAllTest != null && monitorsAllTest.size()>0)
		{
			boolean isMonitorsSimulation = false;
			if(monitorsSimulationTest != null && monitorsSimulationTest.size()>0)
				isMonitorsSimulation = true;
			
			List infoOrderList = com.egurkha.util.StringUtils.egTokenizer(egDashConfig.getValue("Search_hide","Tests"), ",", false,true,true);
		
			String isFromMenu2=isFromMenu1;
			if((fromHomepage != null && fromHomepage.equalsIgnoreCase("true")) ||( isFromZoneMenu!= null && isFromZoneMenu.equalsIgnoreCase("true")))
			{
				isFromMenu2="false";
				checkLogonType="";
			}
			else if(checkLogonType!= null && checkLogonType.trim().length()>0 && (checkLogonType.equalsIgnoreCase("true") ||checkLogonType.equalsIgnoreCase("false")))
			{
				isFromMenu2="true";
			}
		
			for(int i=0;i<allMonitorsList.size();i++)
			{
				String name = (String)allMonitorsList.get(i);
				if(monitorsAllTest.containsKey(name))
				{
					String testName = (String)monitorsAllTest.get(name);
					if(isMonitorsSimulation && monitorsSimulationTest.containsKey(testName))
					{
						String s_supportTypeName = (String)monitorsSimulationTest.get(testName);					

						jOpt  = new JSONObject();
						jOpt.put("url","/final/monitor/comparisonDashboard.jsp?treeTitle="+s_supportTypeName+"&isFromMenu="+isFromMenu2+"&isLogonType="+checkLogonType+"&zoneName="+zoneName+"&parentZone="+parentZone+"&isFromZoneMenu="+isFromZoneMenu+"&fromHomepage="+fromHomepage);
						jOpt.put("name",name);
						jOpt.put("value",testName);						
				
						externalTestArr.add(jOpt);

						if((ltest == null || ltest.trim().length() == 0) && testName != null && testName.trim().length() > 0){
							ltest = testName;
							externalTestObj.put("selectedExtTest",testName);
						}
						else if(ltest != null && ltest.trim().length() > 0)
							externalTestObj.put("selectedExtTest",ltest);
					}
					else
					{
						if((ltest != null && ltest.trim().equalsIgnoreCase(testName)) || isallTestList && allTestList.containsKey(testName))
						{
							jOpt  = new JSONObject();
							jOpt.put("value",testName);
							jOpt.put("name",name);
							String monitorBy = getMonitorBy(testName,egDashConfig);
							if(checkLogonType != null && checkLogonType.equalsIgnoreCase("true"))
								checkLogonType="false";
								
							jOpt.put("url","/final/monitor/comparisonDashboard.jsp?treeTitle=ExtTestDashboard&isFromMenu="+isFromMenu2+"&ltest="+testName+"&monitorsBy="+monitorBy+"&isLogonType="+checkLogonType+"&zoneName="+zoneName+"&parentZone="+parentZone+"&isFromZoneMenu="+isFromZoneMenu+"&fromHomepage="+fromHomepage);

							externalTestArr.add(jOpt);
							
							if(ltest == null || ltest.trim().length() == 0){
								ltest = testName;
								externalTestObj.put("selectedExtTest",testName);
							}
							else
								externalTestObj.put("selectedExtTest",ltest);
						}
					}									
					if(infoOrderList.contains(ltest))
						externalTestObj.put("showSearchCombo",false);
					else
						externalTestObj.put("showSearchCombo",true);					
				}
			}
		}		
		externalTestObj.put("externalTestArr",externalTestArr);
	}

	if (zones_list != null && zones_list.size() > 0)
	{
		jOpt = new JSONObject();
		jOpt.put("displayField", mappingInfo.getTextDescription("monitor.current.Zone"));
		jOpt.put("valueField", "zone");
		filterByOptions.add(jOpt);
	}
	if (segments_list != null && segments_list.size() > 0)
	{
		jOpt = new JSONObject();
		jOpt.put("displayField", mappingInfo.getTextDescription("monitor.current.Segment"));
		jOpt.put("valueField", "segment");
		filterByOptions.add(jOpt);
	}
	if (services_list != null && services_list.size() > 0)
	{
		jOpt = new JSONObject();
		jOpt.put("displayField", mappingInfo.getTextDescription("monitor.current.Service"));
		jOpt.put("valueField", "services");
		filterByOptions.add(jOpt);
	}
	if (System_list != null && System_list.size() > 0)
	{
		jOpt = new JSONObject();
		//jOpt.put("displayField", mappingInfo.getTextDescription("monitor.current.Component Type"));
		jOpt.put("displayField", mappingInfo.getTextDescription("monitor.current.ExternalMonitor"));
		jOpt.put("valueField", "ExternalMonitor");
		filterByOptions.add(jOpt);
	}

	if (!StringUtils.isNull(filterBy))
		pageParams.put("selectedFilterByOption", filterBy);
	else
		pageParams.put("selectedFilterByOption", treeTitle);

	json.put("filterByOptions", filterByOptions);
	json.put("monitorComboWidth",monitorComboWidth);
	pageParams.put("selectedPage", "ExternalMonitor");

	json.put("pageParams", pageParams);

	JSONArray subFilterOptions = new JSONArray();
	//pageParams.put("subFilterLabel", mappingInfo.getTextDescription("monitor.common.Sub Filter"));
	pageParams.put("isSubFilterOption",new Boolean(true));
	if (filterBy != null && filterBy.equals("zone"))
	{
		pageParams.put("subFilterLabel",mappingInfo.getTextDescription("monitor.common.Zone"));
		if (zones_list != null && zones_list.size() > 0)
		{
			String s_selectedOption = "";
			jOpt = new JSONObject();
			jOpt.put("displayField",mappingInfo.getTextDescription("monitor.common.Please choose a Zone"));
			jOpt.put("valueField", "-1");
			s_selectedOption ="-1";
			subFilterOptions.add(jOpt);

			for (int i = 0; i < zones_list.size(); i++)
			{
				String v_zone = (String) zones_list.get(i);
				jOpt = new JSONObject();
				jOpt.put("displayField", v_zone);
				jOpt.put("valueField", v_zone);
				subFilterOptions.add(jOpt);
				if (subFilter != null && subFilter.equals(v_zone))
				{
					s_selectedOption = v_zone;
				}
			}

			if (StringUtils.isNull(s_selectedOption))
			{
				//pageParams.put("selectedSubFilterOption", zones_list.get(0).toString());
				//selectedNode = zones_list.get(0).toString();
				pageParams.put("selectedSubFilterOption","-1");
				pageParams.put("isSubFilterOption",new Boolean(false));
				//subFilter = zones_list.get(0).toString();
			}
			else
			{
				pageParams.put("selectedSubFilterOption",s_selectedOption);
				pageParams.put("isSubFilterOption",new Boolean(false));
			}
		}
		else
		{
			jOpt = new JSONObject();
			jOpt.put("displayField", mappingInfo.getTextDescription("monitor.common.Not Available"));
			jOpt.put("valueField", "-1");
			subFilterOptions.add(jOpt);
			subFilter = "-1";
			pageParams.put("selectedSubFilterOption", "-1");
			//pageParams.put("selectedSubFilterOption", "Not Available");
		}
	}
	else if (filterBy != null && filterBy.equals("segment"))
	{
		pageParams.put("subFilterLabel", mappingInfo.getTextDescription("monitor.common.Segment"));
		if (segments_list != null && segments_list.size() > 0)
		{
			String s_selectedOption = "";

			jOpt = new JSONObject();
			jOpt.put("displayField",mappingInfo.getTextDescription("monitor.common.Please choose a Segment"));
			jOpt.put("valueField", "-1");
			subFilterOptions.add(jOpt);

			for (int i = 0; i < segments_list.size(); i++)
			{
				String v_segment = (String) segments_list.get(i);
				jOpt = new JSONObject();
				jOpt.put("displayField", v_segment);
				jOpt.put("valueField", v_segment);
				subFilterOptions.add(jOpt);
				if (subFilter != null && subFilter.equals(v_segment))
				{
					s_selectedOption = v_segment;
				}
			}
			if (StringUtils.isNull(s_selectedOption))
			{
				//pageParams.put("selectedSubFilterOption", segments_list.get(0).toString());
				pageParams.put("selectedSubFilterOption", "-1");
				pageParams.put("isSubFilterOption",new Boolean(false));
				//subFilter = segments_list.get(0).toString();
			}
			else
			{
				pageParams.put("selectedSubFilterOption",s_selectedOption);
				pageParams.put("isSubFilterOption",new Boolean(false));
			}
		}
		else
		{
			jOpt = new JSONObject();
			jOpt.put("displayField", mappingInfo.getTextDescription("monitor.common.Not Available"));
			jOpt.put("valueField", "-1");
			subFilterOptions.add(jOpt);
			subFilter = "-1";
			pageParams.put("selectedSubFilterOption", "-1");
		}
	}
	else if (filterBy != null && filterBy.equals("services"))
	{
		pageParams.put("subFilterLabel", mappingInfo.getTextDescription("monitor.common.Service"));
		if (services_list != null && services_list.size() > 0)
		{
			String s_selectedOption = "";
			jOpt = new JSONObject();
			jOpt.put("displayField",mappingInfo.getTextDescription("monitor.common.Please choose a Service"));
			jOpt.put("valueField", "-1");
			subFilterOptions.add(jOpt);

			for (int i = 0; i < services_list.size(); i++)
			{
				String v_service = (String) services_list.get(i);
				jOpt = new JSONObject();
				jOpt.put("displayField", v_service);
				jOpt.put("valueField", v_service);
				subFilterOptions.add(jOpt);
				if (subFilter != null && subFilter.equals(v_service))
				{
					s_selectedOption = v_service;
				}
			}
			if (StringUtils.isNull(s_selectedOption))
			{
				//pageParams.put("selectedSubFilterOption", services_list.get(0).toString());
				pageParams.put("selectedSubFilterOption", "-1");
				pageParams.put("isSubFilterOption",new Boolean(false));
				//subFilter = services_list.get(0).toString();
			}
			else
			{
				pageParams.put("selectedSubFilterOption", s_selectedOption);
				pageParams.put("isSubFilterOption",new Boolean(false));
			}
		}
		else
		{
			jOpt = new JSONObject();
			jOpt.put("displayField", mappingInfo.getTextDescription("monitor.common.Not Available"));
			jOpt.put("valueField", "-1");
			subFilterOptions.add(jOpt);
			subFilter = "-1";
			pageParams.put("selectedSubFilterOption", "-1");
		}
	}
	json.put("subFilterOptions",subFilterOptions);
	
	if(filterBy!=null && filterBy.equalsIgnoreCase("zone") )
	{
		if(componentNameSearch!=null && componentNameSearch.length()>0)
		{
			componentList = serviceBean.getComponentsForZone(filterBy,subFilter,"");
			//searchApplicationComponent=componentList.search(componentNameSearch);
			pageParams.put("searchnickname", componentNameSearch);
		}
		else
		{
			componentList = serviceBean.getComponentsForZone(filterBy,subFilter,"");
			pageParams.put("searchnickname", componentNameSearch);
		}
	}
	else if(filterBy!=null && filterBy.equalsIgnoreCase("segment") )
	{
		if(componentNameSearch!=null && componentNameSearch.length()>0)
		{
			componentList = serviceBean.getComponentsForSegment(filterBy,subFilter,"");
			//searchApplicationComponent=componentList.search(componentNameSearch);
			pageParams.put("searchnickname", componentNameSearch);
		}
		else
		{
			componentList = serviceBean.getComponentsForSegment(filterBy,subFilter,"");
			pageParams.put("searchnickname", componentNameSearch);
		}
	}
	else if(filterBy!=null && filterBy.equalsIgnoreCase("services") )
	{
		if(componentNameSearch!=null && componentNameSearch.length()>0)
		{
			componentList = serviceBean.getComponentsForSelection(filterBy,subFilter,"");
			//searchApplicationComponent=componentList.search(componentNameSearch);
			pageParams.put("searchnickname", componentNameSearch);
		}
		else
		{
			componentList = serviceBean.getComponentsForSelection(filterBy,subFilter,"");
			pageParams.put("searchnickname", componentNameSearch);
		}
	}
	else if(fromServiceDashboard != null && servicename != null && servicename.length() > 0 && fromServiceDashboard.equalsIgnoreCase("true"))
	{
		if(componentNameSearch!=null && componentNameSearch.length()>0)
		{
			componentList = serviceBean.getComponentsForSelection("service",servicename,"");
			//searchApplicationComponent=componentList.search(componentNameSearch);
			pageParams.put("searchnickname", componentNameSearch);
		}
		else
		{
			componentList = serviceBean.getComponentsForSelection("service",servicename,"");
			pageParams.put("searchnickname", componentNameSearch);
		}
	}
	else 
	{
		if(componentNameSearch!=null && componentNameSearch.length()>0 && !componentNameSearch.equalsIgnoreCase("null"))
		{
			componentList = serviceBean.getComponentsForUser(usr_server);
			//searchApplicationComponent=componentList.search(componentNameSearch);
			pageParams.put("searchnickname", componentNameSearch);
		}
		else
		{
			componentList = serviceBean.getComponentsForUser(usr_server);
			pageParams.put("searchnickname", componentNameSearch);
		}
	}

	//Hashtable temp_Table = serviceBean.getTestMeasureListforExternal(true,monitorsBy);
	Hashtable temp_Table = serviceBean.getTestMeasureListforExternal(true,monitorsBy,treeTitle);
	Hashtable measureList =new Hashtable();

	Hashtable clubMeasure =new Hashtable();
	ArrayList keyList=new ArrayList();
	ArrayList key_list=new ArrayList();
	List comNameSort=new ArrayList();
	Enumeration enumer; 
	if(temp_Table!=null && temp_Table.size()>0)
	{
		enumer = temp_Table.keys(); 
		while(enumer.hasMoreElements())
		{
			keyList=(ArrayList)enumer.nextElement();
			measureList=(Hashtable)temp_Table.get(keyList);
		}
	}
	
	for(int l=0;l<keyList.size();l++){
		String el = (String)keyList.get(l);
		ArrayList al_cols = com.egurkha.util.StringUtils.egTokenizer(el, ":",true,false,true);//3-->includeEmpty,4-->unique,5-->trim
		if(al_cols != null && al_cols.size() == 3)
		{
			el = el.toLowerCase();
			el = el.substring(0,el.lastIndexOf(":"));
			key_list.add(el);
		}
	}

	ArrayList removeList = new ArrayList();
	for(int l=0;l<key_list.size();l++){
		String el = (String)key_list.get(l);
		if(el != null )
		{
			String temp =el;
			temp = temp.trim();
			if(temp.indexOf("_availability") != -1 ){
				String duration_el = el.substring(0,el.lastIndexOf("_"))+"_duration";
				if(key_list.contains(duration_el)){
					clubMeasure.put(el,duration_el);
					removeList.add(duration_el);
				}
			}
			else if(temp.indexOf("_duration") != -1){
				String duration_el = el.substring(0,el.lastIndexOf("_"))+"_availability";
				if(key_list.contains(duration_el)){
					clubMeasure.put(el,duration_el);
					removeList.add(duration_el);
				}
			}
		}
	}
	key_list = new ArrayList();
	
	for(int l=0;l<keyList.size();l++){
		String el = (String)keyList.get(l);
		ArrayList al_cols = com.egurkha.util.StringUtils.egTokenizer(el, ":",true,false,true);//3-->includeEmpty,4-->unique,5-->trim
		if(al_cols != null && al_cols.size() == 3)
		{
			String temp_el = el.trim();
			temp_el = temp_el.toLowerCase();
			temp_el = temp_el.substring(0,temp_el.lastIndexOf(":"));
			if(removeList != null && removeList.contains(temp_el) && temp_el.endsWith("_duration"))
				continue;

			key_list.add(el);

		}else
			key_list.add(el);
	}

	keyList = new ArrayList(key_list);
	
	/*if(componentNameSearch!=null && componentNameSearch.length()>0 && !componentNameSearch.equalsIgnoreCase("null"))
	{
		componentList=new EgList();
		if(searchApplicationComponent!=null && searchApplicationComponent.size() > 0 )
		{
			componentList=searchApplicationComponent;
		}
	}*/
	
	Hashtable comp_info_el = new Hashtable();
	Hashtable tempMsmtHostInfo = new Hashtable();
	Hashtable tempCompMsmtHost = new Hashtable();
	String sortBy = request.getParameter("sortBy");
	String tmp_sortBy = request.getParameter("sortBy");

	if(sortBy != null && sortBy.equalsIgnoreCase("SCRIPTS"))
		sortBy = null;
	String sortType = sort_type;
	if(testNameMonitorBy != null && testNameMonitorBy.trim().length()>0)
	{
		if(ltest == null || ltest.trim().length()==0)
			ltest = testNameMonitorBy;			
		isCitraType = true;

		if(sortBy == null || sortBy.trim().length() == 0)
			sortBy = "TRGT_HOST,MSMT_TIME";
		if(sortBy != null && sortBy.equals("-2"))
			sortBy = "TRGT_HOST";
		if(sortBy != null && sortBy.equalsIgnoreCase("External Agent"))
			sortBy = "MSMT_HOST";
		if(sortType == null || sortType.trim().length() == 0)
			sortType = "ASC";		
	}
	else
	{
		if(sortBy == null || sortBy.trim().length() == 0)
			sortBy = "MSMT_TIME";
		if(sortBy != null && sortBy.equals("-2"))
			sortBy = "TRGT_HOST";
		if(sortBy != null && sortBy.equalsIgnoreCase("External Agent"))
			sortBy = "MSMT_HOST";
		if(sortType == null || sortType.trim().length() == 0)
			sortType = "ASC";
	}
	boolean isNonRunningCompListView = false;
	if(ltype != null && ltype.trim().length()>0 )
	{
		String nonRunningComp = egDashConfig.getValue("SYNTHETIC_MONITORING_NON_RUNNING_COMP_LIST",ltype);
		if(nonRunningComp != null && nonRunningComp.trim().length()>0 && nonRunningComp.equalsIgnoreCase("true"))
			isNonRunningCompListView = true;
	}
	if(componentList!=null)
	{
		ArrayList tempCompList = new ArrayList();
		if(isNonRunningCompListView && ltype != null && ltype.trim().length() > 0)
		  tempCompList = (ArrayList) user.getServersForType(ltype);	

		if(com.eg.EgInstallInfo.isSuperManager)
		{
			String currentSession = session.getId();
			if(EgManagersInfo.sessionManagerMap.containsKey(currentSession))
			{
				ArrayList managerIds = (ArrayList)EgManagersInfo.sessionManagerMap.get(currentSession);
				if(managerIds != null && !managerIds.isEmpty())
				{
					SmSessionData smsData = new SmSessionData(currentSession,managerIds);
					EgThreadLocal egtl = new EgThreadLocal();
					egtl.set(smsData);
				}
			}
		}
		Hashtable measureDataTotal = null;
		if(!isLogonType && sortBy != null && sortBy.trim().length() > 0 && sortType != null && sortType.trim().length() > 0){
			measureDataTotal = serviceBean.getTestMeasureDataforExternal(componentList,true,monitorsBy,locationBy,externalAgent,ltype,componentNameSearch+"||"+simulationName,sortBy,sortType);
		}
		else{
			measureDataTotal = serviceBean.getTestMeasureDataforExternal(componentList,true,monitorsBy,locationBy,externalAgent,ltype,componentNameSearch+"||"+simulationName);
		}

		Hashtable measureData = (Hashtable)measureDataTotal.get("data");
		Hashtable measureDataCitra = new Hashtable();
		if(monitorsBy !=null && isCitraType)
		{
			measureDataCitra = (Hashtable)measureDataTotal.get("dataCitra");	
		}
		ArrayList sortedMeasures = (ArrayList)measureDataTotal.get("sortedData");

		String selectedExtAgent = (String)measureDataTotal.get("extAgent");
		if(selectedExtAgent != null && selectedExtAgent.trim().length() > 0)
			externalAgentObj.put("selectedextAgentType",selectedExtAgent);
		
		String imgsrc="";

		/*if(monitorsBy != null && monitorsBy.equalsIgnoreCase("CITRA") && sortBy != null && sortBy.equalsIgnoreCase("TRGT_HOST"))
		{
			sortedMeasures = reorderSortedMeasure(sortedMeasures);
		}
		else
		{*/
			//if(userVisecompName != null && userVisecompName.size() > 0)

			ArrayList compTypeListForState = new ArrayList();
			ArrayList compNameListForState = new ArrayList();

			ArrayList temp_sortedMeasure = (ArrayList) sortedMeasures.clone();
			ArrayList newOrderList = new ArrayList();
			if(temp_sortedMeasure != null && temp_sortedMeasure.size() > 0){
				for(int u=0;u<temp_sortedMeasure.size();u++){
					ArrayList elements = (ArrayList)temp_sortedMeasure.get(u);
					ArrayList newElemetList = new ArrayList();
					for(int l=0;l<elements.size();l++){
						ArrayList innerEl = (ArrayList)elements.get(l);
						boolean addFlag = true;
						if(innerEl != null && innerEl.size() > 0){
							String info_elment = (String)innerEl.get(0);
							String sorted_key_elemet = (String)innerEl.get(1);
							String el_state = null;
							if(innerEl.size() == 3)
								el_state = (String)innerEl.get(2);
							String state_of_comp = "GOOD";
							ArrayList sorted_key_elemet_list = com.egurkha.util.StringUtils.egTokenizer(sorted_key_elemet, ":",true,false,true);//3-->includeEmpty,4-->unique,5-->trim

							if(sorted_key_elemet_list != null && sorted_key_elemet_list.size() == 7){
								String el_comp_name = (String)sorted_key_elemet_list.get(0);
								String el_port_name = (String)sorted_key_elemet_list.get(1);
								String el_comp_type_name = (String)sorted_key_elemet_list.get(2);
								
								String compWithPortURL = el_comp_name+":"+el_port_name;
								String _hostPort = discInfo.getPortForHost(el_comp_name,el_comp_type_name);
								if(_hostPort != null && _hostPort.trim().length()>0)
								{
									compWithPortURL = el_comp_name+":"+_hostPort;
								}

								if(compNameListForState.size()==0 || !compNameListForState.contains(compWithPortURL))
									compNameListForState.add(compWithPortURL);

								
								if(compTypeListForState.size()==0 || !compTypeListForState.contains(el_comp_type_name))
									compTypeListForState.add(el_comp_type_name);

								String el_layer_name = (String)sorted_key_elemet_list.get(3);
								String el_info_name = (String)sorted_key_elemet_list.get(4);
								String el_test_name = (String)sorted_key_elemet_list.get(5);
								String el_msmt_host_name = (String)sorted_key_elemet_list.get(6);

								if(userVisecompName != null && userVisecompName.size() > 0 && !userVisecompName.contains(el_comp_name+":"+el_port_name) )
									addFlag = false;
								
								if(isFromZoneInfraHome){
									if(!zoneCompNickList.contains(el_comp_name+":"+el_port_name))
										addFlag = false;
								}

								state_of_comp = ap.getAlarmPriority(el_comp_name+":"+el_port_name, el_comp_type_name,"NULL");
								if(state_of_comp == null )
									state_of_comp="GOOD";
							}

							if((isFromInfra || isFromZoneInfraHome) && selectedState != null && selectedState.trim().length() > 0){
								pageParams.put("fromPageView", "Home");
								if(!state_of_comp.equals(selectedState))
									addFlag = false;
							}
						}

						
						if(addFlag)
						{
							recount++;
							newElemetList.add(innerEl);
						}
					}
					newOrderList.add(newElemetList);
				}
			}

			sortedMeasures = null;
			sortedMeasures = newOrderList;
		//}		
		
		JSONObject countJson= new JSONObject();
		pagesizec=recount/pageSize;
		int tem = recount;
		int mod = tem%pageSize;
		if(mod > 0)
			pagesizec=pagesizec+1;
		countJson.put("recount",recount);
		countJson.put("pagesizec",pageSize);
		countJson.put("totalPages",pagesizec);
		if(pagesizec<=1)
			countJson.put("isHidePaging",new Boolean(true));
		else
			countJson.put("isHidePaging",new Boolean(false));
		String pageNoReq = request.getParameter("pageNo");
		if(pageNoReq==null || pageNoReq.trim().length()==0 || pageNoReq.equalsIgnoreCase("null"))
			pageNoReq="1";
		int pageStartIndex = 0;
		int pageEndIndex = pageSize;
		int pageNum = 1;
		try
		{
			pageNum = Integer.parseInt(pageNoReq.trim());
			pageNum = (pageNum == 0 )?1:pageNum;
			if(pageNum==1)
			{
				pageStartIndex=0;
				pageEndIndex = pageSize+pageStartIndex;
				//pageEndIndex = pageStartIndex+(pageSize-1);//10+10-1
			}
			else 
			{
				//pageStartIndex=((pageNum-1)*pageSize);//2-1*10
				//pageEndIndex = pageStartIndex+(pageSize-1);//10+10-1
				pageStartIndex = (pageNum*pageSize)-pageSize;
				pageEndIndex = pageSize+pageStartIndex;
			}
		}
		catch(Exception e)
		{
			pageNum=1;
		}
		
		
		boolean iconFlag = false;
		if(keyList != null && iconList!= null && keyList.size()==iconList.size())
			iconFlag = true;
		String icon_name="";
		TreeMap linksMap = new TreeMap();
		if(measureList!=null && measureList.size()>0)
		{
			JSONObject columnObj  = new JSONObject();
			if(isLogonType)
				columnObj.put("text",mappingInfo.getTextDescription("monitor.serviceDashboard.Simulation"));
			else
				columnObj.put("text",mappingInfo.getTextDescription("monitor.serviceDashboard.Components"));
			try
			{
				icon_name=(String)iconList.get(0);
			}
			catch(Exception eee){
				icon_name="";
			}
			columnObj.put("icon_name",icon_name);

			String SortForCompName="-2";
			if(measure_sort!=null && measure_sort.equalsIgnoreCase("-1"))
				SortForCompName="-2";
			if(measure_sort!=null && measure_sort.equalsIgnoreCase("-2"))
				SortForCompName="-1";
			columnObj.put("SortForCompName",SortForCompName);
			String SortTypeForCompName="ASC";
			if(sort_type!=null && sort_type.equalsIgnoreCase("DESC"))
			{
				SortTypeForCompName="ASC";
			}
			else if(sort_type!=null && sort_type.equalsIgnoreCase("ASC"))
			{
				SortTypeForCompName="DESC";
			}
			columnObj.put("SortTypeForCompName",SortTypeForCompName);
			//columnObj.put("SortTypeDirection",SortTypeForCompName);
			columns.add(columnObj);
			
			if(externalAgent != null && externalAgent.equalsIgnoreCase("all"))
			{
				keyList.add(0,"externalAgent:External Agent");
				iconList.add(0,"");
				iconList.add(1,"");
			}

			if(sort_type!=null && sort_type.length()>0)
			{
				if(sort_type.equalsIgnoreCase("ascending"))
				{
					imgsrc="/final/monitor/eg_images/arrow_up_black_small.gif";
				}
				else if(sort_type.equalsIgnoreCase("descending"))
				{
					imgsrc="/final/monitor/eg_images/arrow_down_black_small.gif";
				}
			}

			sortByMainOptions.put("sortByLabel",mappingInfo.getTextDescription("monitor.serviceDashboard.Sort By"));
			JSONObject Sortbytypeoption  = new JSONObject();
			Sortbytypeoption.put("value","-1");
			Sortbytypeoption.put("name",mappingInfo.getTextDescription("monitor.common.---State---"));
			sortByOptions.add(Sortbytypeoption);
			Sortbytypeoption  = new JSONObject();
			Sortbytypeoption.put("value","-2");
			Sortbytypeoption.put("name",mappingInfo.getTextDescription("monitor.common.---Component---"));
			sortByOptions.add(Sortbytypeoption);
			if(measure_sort!=null && measure_sort.equalsIgnoreCase("-2"))
				sortByMainOptions.put("sortBySelectedMeasure","-2");
			else if(measure_sort==null)
				sortByMainOptions.put("sortBySelectedMeasure","-1");

			com.eg.IniFile agentIni = new com.eg.IniFile(EgInstallInfo.getInstallDir() + "/manager/config/eg_agents.ini", false);

			com.eg.IniFile extMonIni = new com.eg.IniFile(EgInstallInfo.getInstallDir() + "/manager/config/eg_extmondash.ini", false);				
			String garphEntry = egDashConfig.getValue("TREE_External_Graph",monitorsBy);
			String sparkColor = egDashConfig.getValue("Grid_Graph_Details","Color");
			String sparkChartType =  egDashConfig.getValue("Grid_Graph_Details","ChartType");
			if(sparkColor != null && sparkColor.trim().length()==0)
				sparkColor = "#FF00FF";
			if(sparkChartType != null && sparkChartType.trim().length()==0)
				sparkChartType = "area";
			
			ArrayList garphEntry_list = new ArrayList();
			if(garphEntry != null && garphEntry.trim().length()>0)
			{
				garphEntry_list = com.egurkha.util.StringUtils.egTokenizer(garphEntry, ",",true,false,true);
				for(int entry=0;entry<garphEntry_list.size();entry++)
				{
					String garphKey = (String)garphEntry_list.get(entry);
					if(!keyList.contains(garphKey))
						keyList.add(garphKey);
				}				
			}
			
			if(measureList!=null && measureList.size() > 0)
			{
				int k=1;
				
				boolean isExternalAgentPresent = false;
				boolean isExternalAgentALL = false;
				if(externalAgent != null && externalAgent.trim().length()>0 && externalAgent.equalsIgnoreCase("ALL"))
					isExternalAgentALL = true;

				for(int i=0;i<keyList.size();i++)
				{
					key = (String)keyList.get(i);
					testMeas = StringUtils.getTokens(key,":");
					
					columnObj  = new JSONObject();

					if(isLogonType && testMeas.length >= 5){
						stest = testMeas[0];
						smeasure = testMeas[1];
						sdispName = testMeas[4];

						String db_Measure =  dbInfo.getColumnForMeasure(stest,smeasure);
						db_Measureandtest=stest+":"+db_Measure;
						if(measure_sort!=null && measure_sort.trim().length()>0 && measure_sort.equals(db_Measureandtest))
						{
							sortByMainOptions.put("sortBySelectedMeasure",db_Measureandtest);
						}

						Sortbytypeoption  = new JSONObject();
						Sortbytypeoption.put("value",db_Measureandtest);
						Sortbytypeoption.put("name",sdispName);
						sortByOptions.add(Sortbytypeoption);

						if(sdispName != null && sdispName.trim().length() > 0 && sdispName.equalsIgnoreCase("External Agent"))
							isExternalAgentPresent = true;

						columnObj.put("text",mappingInfo.getTextDescription("monitor.serviceDashboard."+sdispName));
						//columns.add(columnObj);
						k++;
					}
					else if(testMeas.length == 2)
					{
						sdispName = testMeas[1];
						Sortbytypeoption  = new JSONObject();
						Sortbytypeoption.put("value",sdispName);
						Sortbytypeoption.put("name",sdispName);
						sortByOptions.add(Sortbytypeoption);

						/*if(monitorsBy != null && monitorsBy.equalsIgnoreCase("CITRA") && sdispName.equalsIgnoreCase("External Agent"))
						{
							columnObj.put("text",mappingInfo.getTextDescription("monitor.serviceDashboard.External Agent/Location"));
						}
						else
							columnObj.put("text",mappingInfo.getTextDescription("monitor.serviceDashboard."+sdispName));*/

						if(sdispName != null && sdispName.trim().length() > 0 && sdispName.equalsIgnoreCase("External Agent"))
							isExternalAgentPresent = true;

						columnObj.put("text",mappingInfo.getTextDescription("monitor.serviceDashboard."+sdispName));

						if(sdispName != null && sdispName.trim().length() > 0 && !sdispName.equalsIgnoreCase("External Agent") && !sdispName.equalsIgnoreCase("DETAILS"))
							columnObj.put("tempInfo","info");
						
						//columns.add(columnObj);
						k++;
					}
					else{
						
						stest = testMeas[0];
						smeasure = testMeas[1];
						sdispName = testMeas[2];

						String db_Measure =  dbInfo.getColumnForMeasure(stest,smeasure);
						db_Measureandtest=stest+":"+db_Measure;
						if(measure_sort!=null && measure_sort.trim().length()>0 && measure_sort.equals(db_Measureandtest))
						{
							sortByMainOptions.put("sortBySelectedMeasure",db_Measureandtest);
						}

						Sortbytypeoption  = new JSONObject();
						Sortbytypeoption.put("value",db_Measureandtest);
						Sortbytypeoption.put("name",sdispName);
						sortByOptions.add(Sortbytypeoption);
						widthOfTheHead="80";
						dbMeasure =  dbInfo.getColumnForMeasure(stest,smeasure);
						if(dbMeasure!=null)
						{
							dbMeasure=stest+":"+dbMeasure;
						}
						String imgeId="sortImg"+k;
						if(sdispName != null && sdispName.trim().length() > 0 && sdispName.equalsIgnoreCase("External Agent"))
							isExternalAgentPresent = true;
						//check image name and current image id name
						if(imageId.equalsIgnoreCase(imgeId))
						{
							columnObj.put("text",mappingInfo.getTextDescription("monitor.serviceDashboard."+sdispName));
							//columns.add(columnObj);
						}
						else
						{
							columnObj.put("text",mappingInfo.getTextDescription("monitor.serviceDashboard."+sdispName));
							//columns.add(columnObj);
						}
						k++;
					}

					try
					{
						if(!isExternalAgentPresent)
						{
							if(isExternalAgentALL)
								icon_name=(String)iconList.get((i+2));						
							else
								icon_name=(String)iconList.get((i+1));
						}
						else
						{
							icon_name="";
							isExternalAgentPresent = false;
						}
					}
					catch(Exception eee){
						icon_name="";
					}

					columnObj.put("icon_name",icon_name);
					columns.add(columnObj);

				}
				
				for(int i=0;i<keyList.size();i++)
				{
					key = (String)keyList.get(i);
					String temp_arr[]=StringUtils.getTokens(key,":");
					int s=temp_arr.length;
					if(isLogonType && s >= 5){
						unitMeasure = (String)measureList.get(key);
						if(unitMeasure == null)
						{
							String s_test=temp_arr[0];
							String s_measure=temp_arr[1];
							unitMeasure = tablesInfo.getUnitForMeasure(s_test,s_measure);
						}
						columns.getJSONObject(i+1).put("unit","");
					}
					else if(s == 2){
						columns.getJSONObject(i+1).put("unit","");
					}
					else{
						String s_test=temp_arr[0];
						String s_measure=temp_arr[1];
						String key_club = s_test+":"+s_measure;

						if(!isLogonType || s==4)
						{
							unitMeasure = tablesInfo.getUnitForMeasure(s_test,s_measure);
						}
						else
						{
							unitMeasure = (String)measureList.get(key);
						}

						if(testMeasureConversionMap != null && testMeasureConversionMap.size() > 0 && testMeasureConversionMap.containsKey(key_club))
							unitMeasure = (String)testMeasureConversionMap.get(key_club);

						displayUnit = unitMeasure;
						widthOfTheHead="80";
						if(unitMeasure.equals("%")){
							
							displayUnit = unitMeasure;
							widthOfTheHead="100";
						}
						if(unitMeasure.equals("MB"))
							displayUnit = mappingInfo.getTextDescription("monitor.VirtualDashboard.GB");

						if(clubMeasure != null && clubMeasure.containsKey(key_club.toLowerCase()))
						{
							String tempDuarion = s_test+":"+s_measure.substring(0,s_measure.lastIndexOf("_"))+"_DURATION";
							tempDuarion = tempDuarion.toLowerCase();
							Iterator it = measureList.entrySet().iterator();
							
							while(it.hasNext()){
								Map.Entry en = (Map.Entry)it.next();
								String unit_key = (String)en.getKey();

								String tokensIn[] = StringUtils.getTokens(unit_key,":");
								unit_key = tokensIn[0]+":"+tokensIn[1];
								unit_key = unit_key.toLowerCase();
								if(unit_key.equals(tempDuarion))
								{
									displayUnit = (String) en.getValue();
									//displayUnit = "ms";
									displayUnit = "secs";
									break;
								}
							}
							
							columns.getJSONObject(i+1).put("unit",mappingInfo.getTextDescription("monitor.VirtualDashboard."+displayUnit));
							if(s_measure.equalsIgnoreCase("APP_LAUNCH_AVAILABILITY"))
							{
								if(isExchange)
									columns.getJSONObject(i+1).put("unit_avail",mappingInfo.getTextDescription("monitor.common.Access"));
								else
									columns.getJSONObject(i+1).put("unit_avail",mappingInfo.getTextDescription("monitor.common.Launch"));
							}
							else
								columns.getJSONObject(i+1).put("unit_avail",mappingInfo.getTextDescription("monitor.common.Availability"));
							columns.getJSONObject(i+1).put("unit_dura",mappingInfo.getTextDescription("monitor.common.Duration"));
						}
						else
						{
							if(key.startsWith("GenericLogonSimTest:Availability:TRANSACTION AVAILABLITY") || key.startsWith("CitraTest:Availability:TRANSACTION AVAILABLITY"))
								columns.getJSONObject(i+1).put("unit","");
							else
								columns.getJSONObject(i+1).put("unit","("+mappingInfo.getTextDescription("monitor.VirtualDashboard."+displayUnit)+")");
						}
					}
					
				}
			}
			if(monitorsBy != null && isCitraType && sortedMeasures != null && sortedMeasures.size()>0){
				int sortedMeas_count=sortedMeasures.size();
				recount = 0;

				Hashtable stateMeasure = monUtil.getComponentState(null,compTypeListForState,compNameListForState,null,testList,null,null,null);

				for(int u=0;u<sortedMeas_count;u++)
				{
					ArrayList elements = (ArrayList)sortedMeasures.get(u);
					for(int l=0;l<elements.size();l++)
					{
						measureValue = "";
						ArrayList innerEl = (ArrayList)elements.get(l);

						if(innerEl != null && innerEl.size() > 0){
							String info_elment = (String)innerEl.get(0);
							String sorted_key_elemet = (String)innerEl.get(1);
							String el_state = null;
							if(innerEl.size() == 3)
								el_state = (String)innerEl.get(2);
							ArrayList sorted_key_elemet_list = com.egurkha.util.StringUtils.egTokenizer(sorted_key_elemet, ":",true,false,true);//3-->includeEmpty,4-->unique,5-->trim
							
							boolean isNeedToAddMeasure = false;
							if(sorted_key_elemet_list != null && sorted_key_elemet_list.size() == 7){
								String el_comp_name = (String)sorted_key_elemet_list.get(0);
								String el_port_name = (String)sorted_key_elemet_list.get(1);
								String el_comp_type_name = (String)sorted_key_elemet_list.get(2);
								String el_layer_name = (String)sorted_key_elemet_list.get(3);
								String el_info_name = (String)sorted_key_elemet_list.get(4);
								String sid = "";
								if(el_info_name != null && el_info_name.trim().length() > 1 && !el_info_name.startsWith("+"))
									sid = el_info_name.substring(0,el_info_name.indexOf("+"));
								String el_test_name = (String)sorted_key_elemet_list.get(5);
								String el_msmt_host_name = (String)sorted_key_elemet_list.get(6);
								String temp_ext_agnet = el_msmt_host_name ;

								String infoName = el_info_name;
								String temp_info = el_info_name;
								String compWithPort = el_comp_name+":"+el_port_name;
								if(sid != null && sid.trim().length() > 1)
									compWithPort = compWithPort+":"+sid;
								stest = el_test_name;
								dispComp = compWithPort;
								Hashtable dataCitra=(Hashtable)measureDataCitra.get(el_comp_name);
								compName = compWithPort;
								compType = el_comp_type_name;
								//compTypeList = new ArrayList();
								//compTypeList.add(compType);
								//List compNameList = new ArrayList();
								//compNameList.add(compWithPort);
								//Hashtable stateMeasure = monUtil.getComponentState(null,compTypeList,compNameList,null,testList,null,null,null);
								JSONObject measure  = new JSONObject();
								String temp_site="NULL";
								String treeTitle_New=treeTitle;
								if(el_layer_name != null && el_layer_name.trim().length() > 0 && el_layer_name.indexOf(",") > 0){
									ArrayList layerList = tables.getLayersForComponent(compType);
									ArrayList testLayerList = com.egurkha.util.StringUtils.egTokenizer(el_layer_name, ",",false,false,true);//3-->includeEmpty,4-->unique,5-->trim
									if(layerList != null && layerList.size() > 0 && testLayerList != null && testLayerList.size() > 0){
										for(int k=0;k<layerList.size();k++){
											String lay = (String)layerList.get(k);
											if(lay != null && lay.trim().length() > 0 && testLayerList.contains(lay)){
												el_layer_name = lay;
												break;
											}
										}
									}
								}
								
								if(filterBy!=null && filterBy.length()>0 && subFilter!=null && subFilter.length()>0 && !isLogonForService)
								{
									if(isfromRum!= null && isfromRum.equalsIgnoreCase("true")){
										url = "/final/servlet/com.eg.EgDashboardController?from=list&site="+EgURLEncoder.encode(temp_site,"UTF-8")+"&qctr=2&comptype="+el_comp_type_name+"&host="+EgURLEncoder.encode(compWithPort,"UTF-8")+"&tab=LayerModel&toDashBoardLayer=true&treeTitle="+treeTitle_New+"&filterBy=Service&subFilter="+filterBy+"&componentNameSearch="+componentNameSearch+"&simulationName="+simulationName+"&fromp=ctxLogonDashboard&externalAgent="+externalAgent+"";
									}else{
										url = "/final/servlet/com.eg.EgDashboardController?from=list&site="+EgURLEncoder.encode(temp_site,"UTF-8")+"&qctr=2&comptype="+el_comp_type_name+"&host="+EgURLEncoder.encode(compWithPort,"UTF-8")+"&tab=LayerModel&toDashBoardLayer=true&treeTitle="+treeTitle_New+"&filterBy="+filterBy+"&subFilter="+subFilter+"&componentNameSearch="+componentNameSearch+"&simulationName="+simulationName+"&fromp=ctxLogonDashboard&externalAgent="+externalAgent;
									}
								}
								else if(isLogonForService)
								{
									if(isfromRum!= null && isfromRum.equalsIgnoreCase("true"))
									{
										url = "/final/servlet/com.eg.EgDashboardController?from=list&site="+EgURLEncoder.encode(temp_site,"UTF-8")+"&qctr=2&comptype="+el_comp_type_name+"&host="+EgURLEncoder.encode(compWithPort,"UTF-8")+"&tab=LayerModel&toDashBoardLayer=true&treeTitle="+treeTitle_New+"&componentNameSearch="+componentNameSearch+"&simulationName="+simulationName+"&externalAgent="+externalAgent+"&filter="+filter+"&filterBy="+filterBy1+"&selectedRum="+selectedRum+"&isFromServiceMenu="+isFromServiceMenu+"&isFromZoneMain="+isFromZoneMain+"&isFromZoneMenu="+isFromZoneMenu+"&isFromServiceGroup="+isFromServiceGroup+"&isRumLogon=true";
									}
									else
									{
										url = "/final/servlet/com.eg.EgDashboardController?from=list&site="+EgURLEncoder.encode(temp_site,"UTF-8")+"&qctr=2&comptype="+el_comp_type_name+"&host="+EgURLEncoder.encode(compWithPort,"UTF-8")+"&tab=LayerModel&toDashBoardLayer=true&treeTitle="+treeTitle_New+"&componentNameSearch="+componentNameSearch+"&simulationName="+simulationName+"&externalAgent="+externalAgent+"&filter="+filter+"&filterBy="+filterBy1+"&isFromServiceMenu="+isFromServiceMenu+"&isFromZoneMain="+isFromZoneMain+"&isFromZoneMenu="+isFromZoneMenu+"&isFromServiceGroup="+isFromServiceGroup+"&isCitrixLogon=true";
									}
								}
								else
								{
									url = "/final/servlet/com.eg.EgDashboardController?from=list&site="+EgURLEncoder.encode(temp_site,"UTF-8")+"&qctr=2&comptype="+el_comp_type_name+"&host="+EgURLEncoder.encode(compWithPort,"UTF-8")+"&tab=LayerModel&toDashBoardLayer=true&fromp=ctxLogonDashboard&treeTitle="+treeTitle_New+"&componentNameSearch="+componentNameSearch+"&simulationName="+simulationName+"&externalAgent="+externalAgent; 
								}
								if(el_info_name != null && el_info_name.trim().length() > 1 && !el_info_name.startsWith("+"))
									el_info_name = el_info_name.substring(el_info_name.indexOf("+"));

								String tmp_el_info_name=el_info_name;
								if(tmp_el_info_name!=null && tmp_el_info_name.startsWith("+"))
									tmp_el_info_name=tmp_el_info_name.substring(1);

								if(!isMultiCompType)
								{
									if(ltype != null && ltype.trim().length() > 0)
										url+="&ltype="+ltype;
								}

								if(ltest != null && ltest.trim().length() > 0)
									url+="&ltest="+ltest;
								if(monitorsBy != null && monitorsBy.trim().length() > 0)
									url+="&monitorsBy="+monitorsBy;


								url+="&layer="+el_layer_name+"&msmt_host="+el_msmt_host_name+"&tstate="+compState+"&port="+el_port_name;

								if(isFromInfraHome != null && isFromInfraHome.trim().length() > 0)
									url+="&isFromInfraHome="+isFromInfraHome;
								if(selectedState != null && selectedState.trim().length() > 0)
									url+="&selectedState="+selectedState;

								if(isFromZoneInfra != null && isFromZoneInfra.trim().length() > 0)
									url+="&isFromZoneInfra="+isFromZoneInfra;
								if(zoneName != null && zoneName.trim().length() > 0)
									url+="&zoneName="+zoneName;
								if(fromServiceDashboard != null && fromServiceDashboard.equalsIgnoreCase("true"))
									url+="&fromServiceDashboard="+fromServiceDashboard;
								if(isfromCitrix != null && isfromCitrix.equalsIgnoreCase("true"))
									url+="&isfromCitrix=true&iniName="+iniName+"&user_name="+user_name+"&dashboard_mapping="+dashboard_mapping+"&dashboard_name="+dashboard_name+"&view_name="+view_name+"&fromSerComboChange="+fromSerComboChange+"&fromServiceHomePage="+fromServiceHomePage+"&appliesTo="+appliesTo+"&isFromZone="+isFromZone+"&iszoneName="+iszoneName+"&parentZone="+parentZone+"&fromPageView=CitrixDashboard";
								if(isfromRum != null && isfromRum.equalsIgnoreCase("true"))
									url+="&isfromRum="+isfromRum+"&iniName="+iniName+"&user_name="+user_name+"&dashboard_mapping="+dashboard_mapping+"&dashboard_name="+dashboard_name+"&view_name="+view_name+"&fromSerComboChange="+fromSerComboChange+"&fromServiceHomePage="+fromServiceHomePage+"&appliesTo="+appliesTo+"&isFromZone="+isFromZone+"&iszoneName="+iszoneName+"&parentZone="+parentZone+"&fromPageView=RumDashboard";

								if(checkLogonType!= null && checkLogonType.trim().length() > 0)
									url+="&isLogonType="+checkLogonType;

								measure.put("systemIconClass","");
								measure.put("systemIconTitle","");

								String sessionTopologyUrl = "/final/monitor/sessionSimulation.jsp?compName="+EgURLEncoder.encode(compWithPort,"UTF-8")+"&site="+EgURLEncoder.encode(temp_site,"UTF-8")+"&compType="+el_comp_type_name+"&msmt_host="+el_msmt_host_name;
									
								if(treeTitle_New != null && treeTitle_New.trim().length() > 0)
									sessionTopologyUrl+="&treeTitle="+treeTitle_New;

								if(!isMultiCompType)
								{
									if(ltype != null && ltype.trim().length() > 0)
										sessionTopologyUrl+="&ltype="+ltype;
								}

								if(ltest != null && ltest.trim().length() > 0)
									sessionTopologyUrl+="&ltest="+ltest;
								if(monitorsBy != null && monitorsBy.trim().length() > 0)
									sessionTopologyUrl+="&monitorsBy="+monitorsBy;
								if(externalAgent != null && externalAgent.trim().length() > 0)
									sessionTopologyUrl+="&externalAgent="+externalAgent;
								if(isFromInfraHome != null && isFromInfraHome.trim().length() > 0)
									sessionTopologyUrl+="&isFromInfraHome="+isFromInfraHome;
								if(isFromMenu1 != null && isFromMenu1.trim().length() > 0)
									sessionTopologyUrl+="&isFromMenu="+isFromMenu1;
								if(selectedState != null && selectedState.trim().length() > 0)
									sessionTopologyUrl+="&selectedState="+selectedState;
								if(isFromZoneInfra != null && isFromZoneInfra.trim().length() > 0)
									sessionTopologyUrl+="&isFromZoneInfra="+isFromZoneInfra;
						
								if(zoneName != null && zoneName.trim().length() > 0)
									sessionTopologyUrl+="&zoneName="+zoneName;
								if(fromHomepage != null && fromHomepage.trim().length() > 0)
									sessionTopologyUrl+="&fromHomepage="+fromHomepage;
								if(parentZone != null && parentZone.trim().length() > 0)
									sessionTopologyUrl+="&parentZone="+parentZone;
								if(checkLogonType!= null && checkLogonType.trim().length() > 0)
									sessionTopologyUrl+="&isLogonType="+checkLogonType;
								//sessionTopologyUrl +="&isFromMetricsPage=true";
								measure.put("layerModelUrl",sessionTopologyUrl+"&fromp=ctxLogonDashboard");

								measure.put("systemTitle",Server.getServerNameWithoutPort(compWithPort, false));
								measure.put("system","<img style=\"margin-top:-4px;margin-right:5px;vertical-align:middle;\" src=\"/final/images/simulation_robo.png\"/><span>"+Server.getServerNameWithoutPort(compWithPort, false)+"</span>");
								
								String tempDispComp = dispComp;
								if(tempDispComp!=null && tempDispComp.indexOf(":") > -1)
								{
									tempDispComp = tempDispComp.substring(0,tempDispComp.indexOf(":"));
								}
								Hashtable graphData= new Hashtable();
								ArrayList scriptNameList= new ArrayList();
								String keyScriptList = "";
								if(tempDispComp != null && temp_ext_agnet != null && ltest != null){
									keyScriptList = tempDispComp+":"+temp_ext_agnet+":"+ltest+":SCRIPT:NAMELIST";
								}
								if(dataCitra.containsKey(keyScriptList))
								{									
									scriptNameList = (ArrayList)dataCitra.get(keyScriptList);
								}
								if(scriptNameList.size()==0)									
									graphData = (Hashtable)serviceBean.getGridGraphData(monitorsBy,ltest,tempDispComp,temp_ext_agnet);

								
								JSONObject sparkObj = new JSONObject();
								sparkObj.put("color",sparkColor);
								sparkObj.put("type",sparkChartType);

								String enum_state= "";
								int max_measure_width=0;
								int max_measure_width2=0;
								if(scriptNameList != null && scriptNameList.size()>0)
								{	
									List agents=egExternalInfo.getAgentsFor(stest,compType,hostName);
									if(agents!=null && agents.size()>0)
										msmtHost=(String)agents.get(0);
									else
										msmtHost=hostName;
									String Layer_name_str=tablesInfo.getLayerForTest(stest);
									StringTokenizer tokenLayer=new StringTokenizer(Layer_name_str,",");
									String layerName="HOST";
									for(int ss=0;ss<scriptNameList.size();ss++)
									{
										String tempScriptName = (String)scriptNameList.get(ss);
										String scriptUrl = url;
										scriptUrl = scriptUrl+"&test="+EgURLEncoder.encode(el_test_name+"- "+tempScriptName+":"+tmp_el_info_name,"UTF-8");

										graphData = (Hashtable)serviceBean.getGridGraphData(monitorsBy,ltest,tempDispComp,temp_ext_agnet,tempScriptName);
										for(int i=0;i<keyList.size();i++)
										{									
											key = (String)keyList.get(i);
											String temp_arr[]=StringUtils.getTokens(key,":");
											int s=temp_arr.length;
											
											if(s==2)
											{
												String ds_type  = temp_arr[0];
												smeasure = temp_arr[1];
												String sortty="ASC";
												if(sort_type!=null && sort_type.equalsIgnoreCase("DESC"))
												{
													sortty="ASC";
												}
												else if(sort_type!=null && sort_type.equalsIgnoreCase("ASC"))
												{
													sortty="DESC";
												}
												if(ds_type.equalsIgnoreCase("externalAgent"))
												{
													columns.getJSONObject(i+1).put("dataIndex",i+"MeasureValue");
													columns.getJSONObject(i+1).put("measureOrgName",smeasure);
													columns.getJSONObject(i+1).put("sortType",sortty);

													/*String loc = extMonIni.getValue("Eg_External_Agents_Locations",temp_ext_agnet);
													if(loc != null && loc.trim().length() > 0)
													{
														//measure.put(i+"MeasureValue","<div><img style=\"position: relative;top:4px;\" src=\"/final/images/clear.png\" class=\"iconLocator\">"+loc+"</div>");
														measure.put(i+"MeasureValue",loc);
													}
													else
														measure.put(i+"MeasureValue",temp_ext_agnet);*/

													measure.put(i+"MeasureValue",temp_ext_agnet);
													measure.put(i+"MeasureValueUrl",scriptUrl);
												}
												else if(ds_type.equalsIgnoreCase("Script")){
													columns.getJSONObject(i+1).put("dataIndex",i+"MeasureValue");
													//columns.getJSONObject(i+1).put("measureOrgName",tempScriptName);
													columns.getJSONObject(i+1).put("measureOrgName","SCRIPTS");
													columns.getJSONObject(i+1).put("sortType",sortty);	
													//columns.getJSONObject(i+1).put("sortable",false);
													String scriptTopologyUrl = sessionTopologyUrl;
													scriptTopologyUrl = scriptTopologyUrl +"&scriptName="+tempScriptName+"&fromp=ctxLogonDashboard";
													measure.put(i+"MeasureValue",tempScriptName);
													measure.put(i+"MeasureValueUrl",scriptTopologyUrl);
												}
												else										
												{								
													columns.getJSONObject(i+1).put("dataIndex",i+"MeasureValue");
													columns.getJSONObject(i+1).put("measureOrgName",smeasure);
													columns.getJSONObject(i+1).put("sortType",sortty);

													if(ds_type.equalsIgnoreCase("Descriptor"))
													{
														columns.getJSONObject(i+1).put("textType", "asFloat");
														//columns.getJSONObject(i+1).put("sortable",false);
													}

													if(dispComp!=null && dispComp.indexOf(":") > -1)
													{
														dispComp = dispComp.substring(0,dispComp.indexOf(":"));
													}													

													HashSet infoSucceed = null;
													String keyCheck = "";
													if(dispComp != null && temp_ext_agnet != null && ltest != null && tempScriptName != null){
														keyCheck = dispComp +":"+temp_ext_agnet+":"+ltest+":"+tempScriptName+":SCRIPT:INFO:SUCCEED";
													}
													if(dataCitra.containsKey(keyCheck))
														infoSucceed=(HashSet)dataCitra.get(keyCheck);	

													int succeedSize = 0;
													if(infoSucceed != null && infoSucceed.size()>0)
													{
														succeedSize = infoSucceed.size();
													}
													
													measure.put(i+"MeasureValue",succeedSize);
													measure.put(i+"MeasureValueUrl",scriptUrl);
													measure.put(i+"MeasureValue_org",""+succeedSize);
												}
											}
											else
											{
												
												if(s==4)
												{
													String s_test=temp_arr[0];
													String s_measure=temp_arr[1];
													unitMeasure = tablesInfo.getUnitForMeasure(s_test,s_measure);
												}
												else
												{
													unitMeasure = (String)measureList.get(key);
												}

												String org_mea="";
												stest = temp_arr[0];
												smeasure = temp_arr[1];	
												String graphMeasure = smeasure;
												org_mea = smeasure;
												sdispName = temp_arr[2];
												dbMeasure =  dbInfo.getColumnForMeasure(stest,smeasure);
												if(dbMeasure!=null && !dbMeasure.equals(""))
													smeasure = dbMeasure;
												if(smeasure!=null)
												{
													smeasure=stest+":"+smeasure;
												}
												graphMeasure = stest+":"+graphMeasure;
												if(dispComp!=null && dispComp.indexOf(":") > -1)
												{
													dispComp = dispComp.substring(0,dispComp.indexOf(":"));
												}
												
												if(temp_arr[3].equalsIgnoreCase("Graph"))
												{
													if(graphData.containsKey(graphMeasure))
													{
														ArrayList graphMeasureData = (ArrayList) graphData.get(graphMeasure);
														JSONArray sparkValue = new JSONArray();
														if(graphMeasureData.size()>1)
														{
															for(int j=0;j<graphMeasureData.size();j++)
															{
																sparkValue.add(new Double(Double.parseDouble(graphMeasureData.get(j).toString())));
															}
														}
														sparkObj.put("data",sparkValue);
													}
													else
													{
														JSONArray sparkValue = new JSONArray();
														sparkObj.put("data",sparkValue);
													}
												}											
																				
												String infoFirst = infoName;
												if(sdispName != null && sdispName.equalsIgnoreCase("Minimum response time"))
												{
													measureValue = (String)dataCitra.get(dispComp +"^"+smeasure+":Min");
													infoFirst = (String)dataCitra.get(dispComp +"^"+smeasure+":Min:Info");
												}
												else if(sdispName != null && sdispName.equalsIgnoreCase("Maximum response time"))
												{
													measureValue = (String)dataCitra.get(dispComp +"^"+smeasure+":Max");
													infoFirst = (String)dataCitra.get(dispComp +"^"+smeasure+":Max:Info");
												}
												else if(sdispName != null && (sdispName.equalsIgnoreCase("Total response time") ||sdispName.equalsIgnoreCase("TRANSACTION PROCESSING TIME") 
													||sdispName.equalsIgnoreCase("TRANSACTION AVAILABLITY") ||sdispName.equalsIgnoreCase("Availability")))												
												{
													measureValue = (String)dataCitra.get(dispComp +":"+temp_ext_agnet+":"+smeasure+":"+tempScriptName+":SCRIPT:TOTAL");
													
												}
												
												infoName = infoFirst;
												
												if(measureValue == null || measureValue.trim().length() == 0)
												{
													measureValue = "-";
												}

												if(measureValue != null && measureValue.trim().length() > 0 && !measureValue.equals("-") && testMeasureConversionMap != null && testMeasureConversionMap.size() > 0 && testMeasureConversionMap.containsKey(stest+":"+org_mea)){
													measureValue = monUtilities.convertValue(measureValue,unitMeasure,(String)testMeasureConversionMap.get(stest+":"+org_mea));
												}
												
												String org_measureValue = measureValue;
												String testToUtl="";
												hostNameToken=StringUtils.getTokens(compName,":");
												if(hostNameToken!=null && hostNameToken.length>0)
												{
													hostName = hostNameToken[0];
													hostPort = hostNameToken[1];
												}

												boolean portReleventForTest = specsInfo.isPortRelevantForTest(stest);
												String compNameToUrl=compName;
												if(!portReleventForTest)
												{
													hostPort="NULL";											
												}

												if(tokenLayer!=null)
												{
													while(tokenLayer.hasMoreTokens())
													{
														String l_name=(String)tokenLayer.nextToken();
														if(l_name!=null)
														{
															if(tablesInfo.isMeasureInLayer(stest,org_mea,l_name))
															{
																layerName=l_name;
																break;
															}
														}
													}
												}
												
												if(filterBy!=null && filterBy.length()>0 && subFilter!=null && subFilter.length()>0)
												{
													if(infoFirst != null && infoFirst.trim().length() > 1 && infoFirst.startsWith("+"))
													{
														infoFirst = infoFirst.substring(infoFirst.indexOf("+"));
														//testToUtl=stest+"-"+EgURLEncoder.encode(infoFirst,"UTF-8");
														testToUtl=EgURLEncoder.encode(stest+"- "+tempScriptName+":"+tmp_el_info_name,"UTF-8");

														Measureurl="/final/monitor/EgSiteInfraView.jsp?qctr=2&fromalarm=&host="+EgURLEncoder.encode(compNameToUrl,"UTF-8")+"&layer="+EgURLEncoder.encode(layerName,"UTF-8")+"&site="+site+"&msmt_host="+EgURLEncoder.encode(msmtHost,"UTF-8")+"&test="+testToUtl+"&comptype="+EgURLEncoder.encode(compType,"UTF-8")+"&tstate="+compState+"&newWindow=false&prevPage=MainDashBoard&treeTitle="+treeTitle_New+"&filterBy="+filterBy+"&subFilter="+subFilter+"&componentNameSearch="+componentNameSearch+"&simulationName="+simulationName+"&fromp=ComparisonDashboard&isFromZone="+isFromZone+"&iszoneName="+iszoneName+"&parentZone="+parentZone;
													}
													else 
													{
														testToUtl="null-+";
														Measureurl="/final/monitor/EgSiteInfraView.jsp?qctr=1&fromalarm=&host="+EgURLEncoder.encode(compNameToUrl,"UTF-8")+"&layer="+EgURLEncoder.encode(layerName,"UTF-8")+"&site="+site+"&msmt_host="+EgURLEncoder.encode(msmtHost,"UTF-8")+"&test="+testToUtl+"&comptype="+EgURLEncoder.encode(compType,"UTF-8")+"&tstate="+compState+"&newWindow=false&prevPage=MainDashBoard&treeTitle="+treeTitle_New+"&filterBy="+filterBy+"&subFilter="+subFilter+"&componentNameSearch="+componentNameSearch+"&simulationName="+simulationName+"&fromp=ComparisonDashboard&isFromZone="+isFromZone+"&iszoneName="+iszoneName+"&parentZone="+parentZone;
													}												
												}
												else
												{
													if(infoFirst != null && infoFirst.trim().length() > 1 && infoFirst.startsWith("+"))
													{													
														infoFirst = infoFirst.substring(infoFirst.indexOf("+"));
														//testToUtl=stest+"-"+EgURLEncoder.encode(infoFirst,"UTF-8");
														testToUtl=EgURLEncoder.encode(stest+"- "+tempScriptName+":"+tmp_el_info_name,"UTF-8");

														Measureurl="/final/monitor/EgSiteInfraView.jsp?qctr=2&fromalarm=&host="+EgURLEncoder.encode(compNameToUrl,"UTF-8")+"&layer="+EgURLEncoder.encode(layerName,"UTF-8")+"&site="+site+"&msmt_host="+EgURLEncoder.encode(msmtHost,"UTF-8")+"&test="+testToUtl+"&comptype="+EgURLEncoder.encode(compType,"UTF-8")+"&tstate="+compState+"&newWindow=false&prevPage=MainDashBoard&treeTitle="+treeTitle_New+"&componentNameSearch="+componentNameSearch+"&simulationName="+simulationName+"&fromp=ComparisonDashboard&isFromZone="+isFromZone+"&iszoneName="+iszoneName+"&parentZone="+parentZone;
													}
													else 
													{
														testToUtl="null-+";
														Measureurl="/final/monitor/EgSiteInfraView.jsp?qctr=1&fromalarm=&host="+EgURLEncoder.encode(compNameToUrl,"UTF-8")+"&layer="+EgURLEncoder.encode(layerName,"UTF-8")+"&site="+site+"&msmt_host="+EgURLEncoder.encode(msmtHost,"UTF-8")+"&test="+testToUtl+"&comptype="+EgURLEncoder.encode(compType,"UTF-8")+"&tstate="+compState+"&newWindow=false&prevPage=MainDashBoard&treeTitle="+treeTitle_New+"&componentNameSearch="+componentNameSearch+"&simulationName="+simulationName+"&fromp=ComparisonDashboard&isFromZone="+isFromZone+"&iszoneName="+iszoneName+"&parentZone="+parentZone;
													}												
												}
												columns.getJSONObject(i+1).put("textType", "asFloat");
												if(temp_arr[3].equalsIgnoreCase("Graph"))
												{
													columns.getJSONObject(i+1).put("dataIndex",i+"MeasureGraph");
													columns.getJSONObject(i+1).put("sortable",false);
													columns.getJSONObject(i+1).put("measureOrgName",smeasure+"_trend");
												}
												else
												{
													columns.getJSONObject(i+1).put("dataIndex",i+"MeasureValue");
													columns.getJSONObject(i+1).put("measureOrgName",smeasure);
												}
												
												String sortty="ASC";
												if(sort_type!=null && sort_type.equalsIgnoreCase("DESC"))
												{
													sortty="ASC";
												}
												else if(sort_type!=null && sort_type.equalsIgnoreCase("ASC"))
												{
													sortty="DESC";
												}
												columns.getJSONObject(i+1).put("sortType",sortty);
												
												if(temp_arr[3].equalsIgnoreCase("Graph"))
												{
													measure.put(i+"MeasureValue_org",org_measureValue.trim());									
													measure.put(i+"MeasureGraph",sparkObj);
												}
												else if(!temp_arr[3].equalsIgnoreCase("Graph"))
												{
													String tempVal = smeasure;
													String tempValLower = tempVal.toLowerCase();

													String meas_state = "GOOD";
													String meas_dur_state = "GOOD";
													if(clubMeasure != null && clubMeasure.containsKey(tempValLower))
													{
														String temp_duartion = tempVal.substring(0,tempVal.lastIndexOf("_"))+"_DURATION";
														String tempKeyMeasure = smeasure;
														tempKeyMeasure = tempKeyMeasure.substring(tempKeyMeasure.indexOf(":")+1);
														String tempDuarKeyMeasure = temp_duartion.substring(temp_duartion.indexOf(":")+1);
														
														if(stateMeasure != null && stateMeasure.size() > 0){
															Iterator iter = stateMeasure.entrySet().iterator();
															int test_inc = 0;
															while(iter.hasNext()){
																Map.Entry entry_state = (Map.Entry)iter.next();
																String el_State_key = (String)entry_state.getKey();
																String el_State_val = (String)entry_state.getValue();
																ArrayList al_state_keys = com.egurkha.util.StringUtils.egTokenizer(el_State_key, "^eg^",true,false,true);//3-->includeEmpty,4-->unique,5-->trim
																
																if(al_state_keys != null && al_state_keys.size() == 8){
																	String s_site_name = (String)al_state_keys.get(0);
																	String s_comp_type = (String)al_state_keys.get(1);
																	String s_comp_name = (String)al_state_keys.get(2);
																	String s_layer_name = (String)al_state_keys.get(3);
																	String s_test_name = (String)al_state_keys.get(4);
																	String s_msmt_name = (String)al_state_keys.get(5);
																	String s_info_name = (String)al_state_keys.get(6);
																	String s_meas_name = (String)al_state_keys.get(7);
																	
																	String tempInfo = (infoName != null && infoName.trim().length() > 0 && !infoName.startsWith("+"))?infoName:infoName.substring(1);

																	String tmp_info = tempScriptName+":"+tempInfo;
																	tmp_info = (tmp_info != null && tmp_info.trim().length() > 0 && !tmp_info.startsWith("+"))?("+"+tmp_info):tmp_info;
																	
																	if(s_comp_type.equals(compType) && s_comp_name.equals(compName) && s_test_name.equals(stest) && s_msmt_name.equals(temp_ext_agnet) && s_info_name.equalsIgnoreCase(tmp_info) && s_meas_name.equalsIgnoreCase(tempKeyMeasure) ){
																		meas_state = el_State_val;
																		test_inc++;
																	}
																	else if(s_comp_type.equals(compType) && s_comp_name.equals(compName) && s_test_name.equals(stest) && s_msmt_name.equals(temp_ext_agnet) && s_info_name.equalsIgnoreCase(tmp_info) && s_meas_name.equalsIgnoreCase(tempDuarKeyMeasure) ){
																		meas_dur_state = el_State_val;
																		test_inc++;
																	}

																	if(test_inc > 1)
																		break;
																}
															}
														}
														
														String temp_duartion_val="";
														String temp_duartion_val_alone="";

														if(temp_info != null)
														{
															if(dispComp!=null && dispComp.indexOf(":") > -1)
															{
																dispComp = dispComp.substring(0,dispComp.indexOf(":"));
															}
															if(sdispName != null && sdispName.equalsIgnoreCase("Minimum response time"))
															{
																temp_duartion_val = (String)dataCitra.get(dispComp +"^"+smeasure+":Min");
															}
															else if(sdispName != null && sdispName.equalsIgnoreCase("Maximum response time"))
															{
																temp_duartion_val = (String)dataCitra.get(dispComp +"^"+smeasure+":Max");
															}
															else if(sdispName != null && (sdispName.equalsIgnoreCase("Total response time") ||sdispName.equalsIgnoreCase("Availability") || sdispName.equalsIgnoreCase("TRANSACTION AVAILABLITY") ||sdispName.equalsIgnoreCase("TRANSACTION PROCESSING TIME")) )
																temp_duartion_val = (String)dataCitra.get(dispComp +":"+smeasure+":TOTAL");
														}
														
														//temp_duartion_val=monUtil.formatDbValue(temp_duartion_val,2);
														temp_duartion_val_alone = temp_duartion_val;
														temp_duartion_val_alone = (temp_duartion_val_alone == null)?"0":temp_duartion_val_alone;
														if(temp_duartion_val_alone.trim().equals("-"))
															temp_duartion_val_alone="0";
														temp_duartion_val = (temp_duartion_val == null)?"-":temp_duartion_val;
														int measl2_val = 0;
														/*if(temp_duartion_val != null && temp_duartion_val.indexOf(".") != -1)
															temp_duartion_val ="<span class='decimal-align'>"+temp_duartion_val.substring(0,temp_duartion_val.indexOf("."))+"</span><span class='decimal-align2'>"+temp_duartion_val.substring(temp_duartion_val.indexOf("."))+"</span>";
														else*/
															temp_duartion_val ="<span class='decimal-align'>"+temp_duartion_val+"</span>";			
													
														measure.put(i+"MeasureValue_org",new Float(temp_duartion_val_alone));
													}										 
													else{
														String disp = null;
														String tempKeyMeasure = smeasure;
														String linkParam = null;
														tempKeyMeasure = tempKeyMeasure.substring(tempKeyMeasure.indexOf(":")+1);
														if(!isLogonType){
															tempKeyMeasure = temp_arr[1];
															if(s > 3)
																disp = temp_arr[3];
															if(s > 4)
																linkParam = temp_arr[4];
														}
														if(linkParam != null && linkParam.trim().length() > 0){
															if(linkParam.startsWith("dLink")){
																linkParam = linkParam.substring(linkParam.indexOf("~!~")+3);
															}
														}
														
														if(stateMeasure != null && stateMeasure.size() > 0){
															Iterator iter = stateMeasure.entrySet().iterator();
															while(iter.hasNext()){
																Map.Entry entry_state = (Map.Entry)iter.next();
																String el_State_key = (String)entry_state.getKey();
																String el_State_val = (String)entry_state.getValue();
																ArrayList al_state_keys = com.egurkha.util.StringUtils.egTokenizer(el_State_key, "^eg^",true,false,true);//3-->includeEmpty,4-->unique,5-->trim
																
																if(al_state_keys != null && al_state_keys.size() == 8){
																	String s_site_name = (String)al_state_keys.get(0);
																	String s_comp_type = (String)al_state_keys.get(1);
																	String s_comp_name = (String)al_state_keys.get(2);
																	String s_layer_name = (String)al_state_keys.get(3);
																	String s_test_name = (String)al_state_keys.get(4);
																	String s_msmt_name = (String)al_state_keys.get(5);
																	String s_info_name = (String)al_state_keys.get(6);
																	String s_meas_name = (String)al_state_keys.get(7);
																	
																	String tempInfo = (infoName != null && infoName.trim().length() > 0 && !infoName.startsWith("+"))?infoName:infoName.substring(1);

																	String tmp_info = tempScriptName+":"+tempInfo;
																	tmp_info = (tmp_info != null && tmp_info.trim().length() > 0 && !tmp_info.startsWith("+"))?("+"+tmp_info):tmp_info;

																	if(s_comp_type.equals(compType) && s_comp_name.equals(compName) && s_test_name.equals(stest) && s_msmt_name.equals(temp_ext_agnet) && s_info_name.equalsIgnoreCase(tmp_info) && s_meas_name.equalsIgnoreCase(tempKeyMeasure) ){
																		meas_state = el_State_val;
																		break;
																	}
																	
																}
															}
														}
														String measure_val1=null;
														String measure_val2=null;
														String tem_val_F="";
														String tem_val_S="";
														int measure_width = 0;
														int measure_width2 = 0;
														if(!isLogonType){
															if(measureValue!= null && measureValue.trim().length() > 0 && measureValue.equalsIgnoreCase("-")){
																//measureValue = "<table style='table-layout:fixed;margin:auto'><tr><td width='50%' style='padding-top:0px'><div class='hyphenGray' style='margin:auto'></div></td></tr></table>";
																measureValue = "<table style='table-layout:fixed;margin:auto'><tr><td style='padding-top:0px'><div class='hyphenGray' style='margin:auto'></div></td></tr></table>";
															}
															else{
																measureValue = monUtil.formatDbValue(measureValue,4);
																String temp_duartion_val = measureValue;
																if(measureValue != null && measureValue.indexOf(".") != -1){
																	String dval = measureValue.substring(measureValue.indexOf(".")+1);
																	dval = dval.trim();
																	String temp_dval = "0";
																	if(dval != null && dval.length() > 1){
																		for(int k=1;k<dval.length();k++)
																			temp_dval += "0";
																	}
																	/*if(dval.equals(temp_dval))
																		temp_duartion_val ="<span class='decimal-align'>"+measureValue.substring(0,measureValue.indexOf("."))+"</span><span class='decimal-align2'></span>";
																	else
																		temp_duartion_val ="<span class='decimal-align'>"+measureValue.substring(0,measureValue.indexOf("."))+"</span><span class='decimal-align2'>"+"."+dval+"</span>";*/
																	
																	if(dval.equals(temp_dval))
																	{
																		measure_val1 = measureValue.substring(0,measureValue.indexOf("."));
																		measure_width = measure_val1.length() * 7;
																		
																		//temp_duartion_val ="<span class='decimal-align' width= '"+measure_width+"px'>"+measure_val1+"</span><span class='decimal-align2' width='30px'></span>";

																		if(max_measure_width>measure_width)
																			measure_width = max_measure_width;
																		else
																			max_measure_width = measure_width;
																			temp_duartion_val ="<span class='f11-normal' width= '"+measure_width+"px'>"+measure_val1+"</span><span width='30px'></span>";

																			//tem_val_F ="<span class='f11-normal' width= '"+measure_width+"px'>"+measure_val1+"</span>";
																			//tem_val_S ="<span class='f11-normal' width='"+measure_width2+"px'></span>";
																	}
																	else
																	{
																		if(measureValue.indexOf(".")>-1)
																		{
																			measure_val1 = measureValue.substring(0,measureValue.indexOf("."));
																			measure_width = measure_val1.length() * 7;

																			measure_val2 = measureValue.substring(measureValue.indexOf(".")+1);
																			measure_width2 =(measure_val2.length() * 7);
																		}
																		else
																		{
																			measure_width = measureValue.length() * 7;
																		}
																		
																		if(max_measure_width>measure_width)
																			measure_width = max_measure_width;
																		else if (max_measure_width<measure_width)
																			max_measure_width = measure_width;

																
																		if(max_measure_width2>measure_width2)
																			measure_width2 = max_measure_width2;
																		else if (max_measure_width2<measure_width2)
																			max_measure_width2 = measure_width2;
																		//temp_duartion_val ="<span class='decimal-align' width= '"+measure_width+"px'>"+measure_val1+"</span><span class='decimal-align2'  width='30px'>"+"."+dval+"</span>";
																		temp_duartion_val ="<span class='f11-normal' width= '"+measure_width+"px'>"+measure_val1+"</span><span class='f11-normal' width='"+measure_width2+"px'>"+"."+dval+"</span>";
																		//tem_val_F ="<span class='f11-normal' width= '"+measure_width+"px'>"+measure_val1+"</span>";

																		//tem_val_S ="<span class='f11-normal' width='"+measure_width2+"px'>"+"."+dval+"</span>";
																	}
																}
																else
																{
																	measure_width = measureValue.length() * 7;
																	//temp_duartion_val ="<span class='decimal-align'>"+measureValue+"</span>";
																	temp_duartion_val ="<span class='f11-normal'>"+measureValue+"</span>";
																	//tem_val_F ="<span class='f11-normal' width= '"+measure_width+"px'>"+measureValue+"</span>";
																	//tem_val_S ="<span class='f11-normal' width='30px'></span>";
																}
																if(disp != null && disp.trim().length() > 0 && disp.equalsIgnoreCase("Symbol")){
																	if(measureValue!= null && measureValue.trim().length() > 0 && !measureValue.startsWith("0"))
																		measureValue = " <div class='stateTick_"+meas_state+"' style='margin:auto;'></div>";
																	else if(measureValue!= null && measureValue.trim().length() > 0 && measureValue.startsWith("0") && meas_state.equalsIgnoreCase("GOOD"))
																		measureValue = " <div class='stateWrong_HIGH' style='margin:auto;'></div>";
																	else
																		measureValue = " <div class='stateWrong_"+meas_state+"' style='margin:auto;'></div>";
																}
																else if(disp != null && disp.trim().length() > 0 && disp.equalsIgnoreCase("bar"))
																{
																	//int table_width = 40+measure_width;
																	if(measureValue!= null && measureValue.trim().length() > 0 && !measureValue.equalsIgnoreCase("-"))
																	{
																		//measureValue = "<table width='"+table_width+"px' style='table-layout:fixed;margin:auto'><tr><td width='"+td_width+"px' style='padding-top:2px'><div class='stateBox_"+meas_state+"' style='margin-top: -3px; margin-left:"+data_margin_left+"'>"+temp_duartion_val+"</div></td></tr></table>";
																		//measureValue = "<div class='stateBox_"+meas_state+"' style='float:none;margin:auto;'><table width='"+table_width+"px' style='table-layout:fixed;margin:auto'><tr><td style='text-align:right;'>"+tem_val_F+"</td><td style='text-align:left;'>"+tem_val_S+"</td></tr></table></div>";
																		measureValue = "<div class='stateBox_"+meas_state+"' style='float:none;margin:auto;'><table width='95%' style='table-layout:fixed;margin:auto'><tr><td style='text-align:right;'>"+temp_duartion_val+"</td></tr></table></div>";
																	}														
																}
																else{
																	//int table_width = 40+measure_width;
																	//int td_width = 30+measure_width;
																	if(measureValue!= null && measureValue.trim().length() > 0 && !measureValue.equalsIgnoreCase("-") && meas_state != null && (  meas_state.equalsIgnoreCase("Good") || meas_state.equalsIgnoreCase("Normal"))){
																		measureValue = "<table width='95%'style='table-layout:fixed;margin:auto'><tr><td width='20px' style='padding-top:0px'><div class='stateTick_"+meas_state+"' style='margin:auto;'></div></td><td style='padding-top:2px'><div>"+temp_duartion_val+"</div></td></tr></table>";
																	}else{
																		measureValue = "<table width='95%' style='table-layout:fixed;margin:auto'><tr><td width='20px' style='padding-top:0px'><div class='stateWrong_"+meas_state+"' style='margin:auto;'></div></td><td style='padding-top:2px'><div>"+temp_duartion_val+"</div></td></tr></table>";
																	}
																}
																if(linkParam != null && linkParam.trim().length() > 0){
																	String tmp_info = infoName;
																	tmp_info = (tmp_info != null && tmp_info.trim().length() > 1 && !tmp_info.startsWith("+"))?("+"+tmp_info):tmp_info;
																	String keyMeasure = temp_arr[1]+"~"+sdispName;
																	String link = "/final/monitor/EgMeasureTopology.jsp?host="+el_comp_name+"&port="+el_port_name+"&testName="+stest+"&measures="+EgURLEncoder.encode(linkParam,"UTF-8")+"&info="+EgURLEncoder.encode(tmp_info,"UTF-8")+"&keyMeasure="+EgURLEncoder.encode(keyMeasure,"UTF-8");
																	String imgValue = "<div style=\"position:relative;height:15px;width:16px\"><img src=\"/final/images/spacer.gif\" class=\"iconDiagnosis\"  onClick=\'javascript:loadPopup(\""+link+"\");\' style=\"cursor:pointer\" data-qtip=\"Topology\" data-qclass=\"yellowTip\"/></div>";
																	measure.put(i+"MeasureValueImglink",imgValue);
																}
															}
														}											
														measure.put(i+"MeasureValue_org",org_measureValue.trim());
													}
													measure.put(i+"MeasureValue",measureValue);
													if(measureValue!=null && !measureValue.equals("-"))
													{
														if(isLogonType && unitMeasure.equals("%"))
														{
															try{
																int columnWidth = 100;
																Long temp_measure_value=new Long(Math.round(Double.parseDouble(measureValue)));
																long fillColorValue=temp_measure_value.longValue();
																long value1 = (fillColorValue*100)/columnWidth;
																measure.put(i+"MeasureValueWidth",value1);
															}catch(Exception ee){

															}
														}
														
														//measure.put(i+"MeasureValueUrl",Measureurl);
														measure.put(i+"MeasureValueUrl",scriptUrl);
													}
												}
												colCount++;
											}												
										}
										int a= ss;

										if(scriptNameList.size() == 1)
											isNeedToAddMeasure = true;
										else 
											measures.add(measure);
									}									
								}
								else if(componentNameSearch==null || componentNameSearch.length()==0 || componentNameSearch.equalsIgnoreCase("null"))
								{
									isNeedToAddMeasure = true;
									String tempUrl = url;
									tempUrl = tempUrl+"&test="+EgURLEncoder.encode(el_test_name+"- "+tmp_el_info_name,"UTF-8");
									String scriptNameKey = el_test_name+"::"+compWithPort;
									String scriptEntry = agentIni.getValue(temp_ext_agnet,scriptNameKey);
									String temData = scriptEntry;
									String scriptName="";
									boolean isMeasuresNull = false;
									try
									{
										if(el_test_name.equals("GenericLogonSimTest"))
										{
											if(scriptEntry != null && scriptEntry.indexOf("-Xml_location")>0 && scriptEntry.indexOf(".xml")>0)
											{
												temData = scriptEntry.substring(scriptEntry.indexOf("-Xml_location")+13,scriptEntry.indexOf(".xml")+4);
											}
											 scriptName = temData;
											if(temData.indexOf(".xml")>0)
											{
												scriptName = temData.substring(temData.lastIndexOf("\\")+1,temData.indexOf(".xml"));
											}
										}
										else
										{											
											
											if(scriptEntry != null && scriptEntry.indexOf("-scriptfiles")>0 && scriptEntry.indexOf("-outputfiles")>0)
											{
												temData = scriptEntry.substring(scriptEntry.indexOf("-scriptfiles")+12,scriptEntry.indexOf("-outputfiles"));
											}
											scriptName = temData;
											if(temData.indexOf(".exe")>0)
											{
												scriptName = temData.substring(temData.lastIndexOf("\\")+1,temData.indexOf(".exe"));
											}
											
											if(componentNameSearch != null && componentNameSearch.length() > 0 && scriptName.length() > 0 && scriptName.indexOf(componentNameSearch) == -1)
											{
												isMeasuresNull = true;
											}
										}

										if(!isMeasuresNull)
										{
											for(int i=0;i<keyList.size();i++)
											{
												key = (String)keyList.get(i);
												String temp_arr[]=StringUtils.getTokens(key,":");
												int s=temp_arr.length;
												
												if(s==2)
												{
													String ds_type  = temp_arr[0];
													smeasure = temp_arr[1];
													String sortty="ASC";
													if(sort_type!=null && sort_type.equalsIgnoreCase("DESC"))
													{
														sortty="ASC";
													}
													else if(sort_type!=null && sort_type.equalsIgnoreCase("ASC"))
													{
														sortty="DESC";
													}
													if(ds_type.equalsIgnoreCase("externalAgent")){
														columns.getJSONObject(i+1).put("textType", "asFloat");
														columns.getJSONObject(i+1).put("dataIndex",i+"MeasureValue");
														columns.getJSONObject(i+1).put("measureOrgName",smeasure);
														columns.getJSONObject(i+1).put("sortType",sortty);

														/*String loc = extMonIni.getValue("Eg_External_Agents_Locations",temp_ext_agnet);
														if(loc != null && loc.trim().length() > 0)
														{
															//measure.put(i+"MeasureValue","<div><img style=\"position: relative;top:4px;\" src=\"/final/images/clear.png\" class=\"iconLocator\">"+loc+"</div>");
															measure.put(i+"MeasureValue",loc);
														}
														else
															measure.put(i+"MeasureValue",temp_ext_agnet);*/

														measure.put(i+"MeasureValue",temp_ext_agnet);
														measure.put(i+"MeasureValueUrl",tempUrl);
													}
													else if(ds_type.equalsIgnoreCase("Script")){
														columns.getJSONObject(i+1).put("dataIndex",i+"MeasureValue");
														columns.getJSONObject(i+1).put("measureOrgName","SCRIPTS");
														columns.getJSONObject(i+1).put("sortType",sortty);
														//columns.getJSONObject(i+1).put("sortable",false);
														if(scriptName != null && scriptName.trim().length()>0)					
															measure.put(i+"MeasureValue",scriptName);
														else
															measure.put(i+"MeasureValue","-");

														String scriptTopologyUrl = sessionTopologyUrl;
														scriptTopologyUrl = scriptTopologyUrl +"&scriptName="+scriptName+"&fromp=ctxLogonDashboard";
														//measure.put(i+"MeasureValue",tempScriptName);
														measure.put(i+"MeasureValueUrl",scriptTopologyUrl);

														//measure.put(i+"MeasureValueUrl",tempUrl);
													}
													else										
													{								
														columns.getJSONObject(i+1).put("textType", "asFloat");
														columns.getJSONObject(i+1).put("dataIndex",i+"MeasureValue");
														columns.getJSONObject(i+1).put("measureOrgName",smeasure);
														columns.getJSONObject(i+1).put("sortType",sortty);
														
														/*if(ds_type.equalsIgnoreCase("Descriptor")) 
														{
															columns.getJSONObject(i+1).put("sortable",false);
														}*/
														if(dispComp!=null && dispComp.indexOf(":") > -1)
														{
															dispComp = dispComp.substring(0,dispComp.indexOf(":"));
														}											
														//HashSet Info=(HashSet)dataCitra.get(dispComp +":CitraTest:INFO");
														String succeedKey = "";
														if(dispComp != null && temp_ext_agnet != null && ltest != null){
															succeedKey = dispComp +":"+temp_ext_agnet+":"+ltest+":INFO:SUCCEED";
														}
														HashSet infoSucceed = new HashSet();

														if(dataCitra.containsKey(succeedKey))
															infoSucceed=(HashSet)dataCitra.get(succeedKey);	
														
														int succeedSize=0;
														if(infoSucceed != null && infoSucceed.size()>0)
														{
															succeedSize = infoSucceed.size();
														}
														
														
														measure.put(i+"MeasureValue",succeedSize);
														measure.put(i+"MeasureValueUrl",tempUrl);
														measure.put(i+"MeasureValue_org",""+succeedSize);
													}
												}
												else
												{
													if(s==4)
													{
														String s_test=temp_arr[0];
														String s_measure=temp_arr[1];
														unitMeasure = tablesInfo.getUnitForMeasure(s_test,s_measure);
													}
													else
													{
														unitMeasure = (String)measureList.get(key);
													}

													String org_mea="";
													stest = temp_arr[0];
													smeasure = temp_arr[1];	
													String graphMeasure = smeasure;
													org_mea = smeasure;
													sdispName = temp_arr[2];
													
													dbMeasure =  dbInfo.getColumnForMeasure(stest,smeasure);
													if(dbMeasure!=null && !dbMeasure.equals(""))
														smeasure = dbMeasure;
													if(smeasure!=null)
													{
														smeasure=stest+":"+smeasure;
													}
													graphMeasure = stest+":"+graphMeasure;
													if(dispComp!=null && dispComp.indexOf(":") > -1)
													{
														dispComp = dispComp.substring(0,dispComp.indexOf(":"));
													}										
													if(temp_arr[3].equalsIgnoreCase("Graph"))
													{
														if(graphData.containsKey(graphMeasure))
														{
															ArrayList graphMeasureData = (ArrayList) graphData.get(graphMeasure);
															JSONArray sparkValue = new JSONArray();
															if(graphMeasureData.size()>1)
															{
																for(int j=0;j<graphMeasureData.size();j++)
																{
																	sparkValue.add(new Double(Double.parseDouble(graphMeasureData.get(j).toString())));
																}
															}
															sparkObj.put("data",sparkValue);
														}
														else
														{
															JSONArray sparkValue = new JSONArray();
															sparkObj.put("data",sparkValue);
														}
													}
													
													//Citra Test code started
													String infoFirst = infoName;
													if(sdispName != null && sdispName.equalsIgnoreCase("Minimum response time"))
													{
														measureValue = (String)dataCitra.get(dispComp +"^"+smeasure+":Min");
														infoFirst = (String)dataCitra.get(dispComp +"^"+smeasure+":Min:Info");
													}
													else if(sdispName != null && sdispName.equalsIgnoreCase("Maximum response time"))
													{
														measureValue = (String)dataCitra.get(dispComp +"^"+smeasure+":Max");
														infoFirst = (String)dataCitra.get(dispComp +"^"+smeasure+":Max:Info");
													}
													else if(sdispName != null && (sdispName.equalsIgnoreCase("Total response time") ||sdispName.equalsIgnoreCase("TRANSACTION PROCESSING TIME") ||sdispName.equalsIgnoreCase("Availability") || sdispName.equalsIgnoreCase("TRANSACTION AVAILABLITY")) )
														measureValue = (String)dataCitra.get(dispComp +":"+temp_ext_agnet+":"+smeasure+":TOTAL");
													
													infoName = infoFirst;
													if(measureValue == null)
													{
														measureValue = "-";
													}

													if(measureValue != null && measureValue.trim().length() > 0 && !measureValue.equals("-") && testMeasureConversionMap != null && testMeasureConversionMap.size() > 0 && testMeasureConversionMap.containsKey(stest+":"+org_mea)){
														measureValue = monUtilities.convertValue(measureValue,unitMeasure,(String)testMeasureConversionMap.get(stest+":"+org_mea));
													}
													
													String org_measureValue = measureValue;
													String testToUtl="";
													hostNameToken=StringUtils.getTokens(compName,":");
													if(hostNameToken!=null && hostNameToken.length>0)
													{
														hostName = hostNameToken[0];
														hostPort = hostNameToken[1];
													}

													boolean portReleventForTest = specsInfo.isPortRelevantForTest(stest);
													String compNameToUrl=compName;
													if(!portReleventForTest)
													{
														hostPort="NULL";											
													}

													List agents=egExternalInfo.getAgentsFor(stest,compType,hostName);
													if(agents!=null && agents.size()>0)
														msmtHost=(String)agents.get(0);
													else
														msmtHost=hostName;
													String Layer_name_str=tablesInfo.getLayerForTest(stest);
													StringTokenizer tokenLayer=new StringTokenizer(Layer_name_str,",");
													String layerName="HOST";
													if(tokenLayer!=null)
													{
														while(tokenLayer.hasMoreTokens())
														{
															String l_name=(String)tokenLayer.nextToken();
															if(l_name!=null)
															{
																if(tablesInfo.isMeasureInLayer(stest,org_mea,l_name))
																{
																	layerName=l_name;
																	break;
																}
															}
														}
													}
													
													if(filterBy!=null && filterBy.length()>0 && subFilter!=null && subFilter.length()>0)
													{
														if(infoFirst != null && infoFirst.trim().length() > 1 && infoFirst.startsWith("+"))
														{
															infoFirst = infoFirst.substring(infoFirst.indexOf("+"));
															testToUtl=stest+"-"+EgURLEncoder.encode(infoFirst,"UTF-8");

															Measureurl="/final/monitor/EgSiteInfraView.jsp?qctr=2&fromalarm=&host="+EgURLEncoder.encode(compNameToUrl,"UTF-8")+"&layer="+EgURLEncoder.encode(layerName,"UTF-8")+"&site="+site+"&msmt_host="+EgURLEncoder.encode(msmtHost,"UTF-8")+"&test="+testToUtl+"&comptype="+EgURLEncoder.encode(compType,"UTF-8")+"&tstate="+compState+"&newWindow=false&prevPage=MainDashBoard&treeTitle="+treeTitle_New+"&filterBy="+filterBy+"&subFilter="+subFilter+"&componentNameSearch="+componentNameSearch+"&simulationName="+simulationName+"&fromp=ComparisonDashboard&isFromZone="+isFromZone+"&iszoneName="+iszoneName+"&parentZone="+parentZone;
														}
														else 
														{
															testToUtl="null-+";
															Measureurl="/final/monitor/EgSiteInfraView.jsp?qctr=1&fromalarm=&host="+EgURLEncoder.encode(compNameToUrl,"UTF-8")+"&layer="+EgURLEncoder.encode(layerName,"UTF-8")+"&site="+site+"&msmt_host="+EgURLEncoder.encode(msmtHost,"UTF-8")+"&test="+testToUtl+"&comptype="+EgURLEncoder.encode(compType,"UTF-8")+"&tstate="+compState+"&newWindow=false&prevPage=MainDashBoard&treeTitle="+treeTitle_New+"&filterBy="+filterBy+"&subFilter="+subFilter+"&componentNameSearch="+componentNameSearch+"&simulationName="+simulationName+"&fromp=ComparisonDashboard&isFromZone="+isFromZone+"&iszoneName="+iszoneName+"&parentZone="+parentZone;
														}												
													}
													else
													{
														if(infoFirst != null && infoFirst.trim().length() > 1 && infoFirst.startsWith("+"))
														{													
															infoFirst = infoFirst.substring(infoFirst.indexOf("+"));
															testToUtl=stest+"-"+EgURLEncoder.encode(infoFirst,"UTF-8");

															Measureurl="/final/monitor/EgSiteInfraView.jsp?qctr=2&fromalarm=&host="+EgURLEncoder.encode(compNameToUrl,"UTF-8")+"&layer="+EgURLEncoder.encode(layerName,"UTF-8")+"&site="+site+"&msmt_host="+EgURLEncoder.encode(msmtHost,"UTF-8")+"&test="+testToUtl+"&comptype="+EgURLEncoder.encode(compType,"UTF-8")+"&tstate="+compState+"&newWindow=false&prevPage=MainDashBoard&treeTitle="+treeTitle_New+"&componentNameSearch="+componentNameSearch+"&simulationName="+simulationName+"&fromp=ComparisonDashboard&isFromZone="+isFromZone+"&iszoneName="+iszoneName+"&parentZone="+parentZone;
														}
														else 
														{
															testToUtl="null-+";
															Measureurl="/final/monitor/EgSiteInfraView.jsp?qctr=1&fromalarm=&host="+EgURLEncoder.encode(compNameToUrl,"UTF-8")+"&layer="+EgURLEncoder.encode(layerName,"UTF-8")+"&site="+site+"&msmt_host="+EgURLEncoder.encode(msmtHost,"UTF-8")+"&test="+testToUtl+"&comptype="+EgURLEncoder.encode(compType,"UTF-8")+"&tstate="+compState+"&newWindow=false&prevPage=MainDashBoard&treeTitle="+treeTitle_New+"&componentNameSearch="+componentNameSearch+"&simulationName="+simulationName+"&fromp=ComparisonDashboard&isFromZone="+isFromZone+"&iszoneName="+iszoneName+"&parentZone="+parentZone;
														}												
													}
													columns.getJSONObject(i+1).put("textType", "asFloat");
													if(temp_arr[3].equalsIgnoreCase("Graph"))
													{
														columns.getJSONObject(i+1).put("dataIndex",i+"MeasureGraph");
														columns.getJSONObject(i+1).put("sortable",false);	
														columns.getJSONObject(i+1).put("measureOrgName",smeasure+"_trend");
													}
													else
													{
														columns.getJSONObject(i+1).put("dataIndex",i+"MeasureValue");
														columns.getJSONObject(i+1).put("measureOrgName",smeasure);
													}
													
													String sortty="ASC";
													if(sort_type!=null && sort_type.equalsIgnoreCase("DESC"))
													{
														sortty="ASC";
													}
													else if(sort_type!=null && sort_type.equalsIgnoreCase("ASC"))
													{
														sortty="DESC";
													}
													columns.getJSONObject(i+1).put("sortType",sortty);
													if(temp_arr[3].equalsIgnoreCase("Graph"))
													{
														measure.put(i+"MeasureValue_org",org_measureValue.trim());									
														measure.put(i+"MeasureGraph",sparkObj);
													}
													else if(!temp_arr[3].equalsIgnoreCase("Graph"))
													{
														String tempVal = smeasure;
														String tempValLower = tempVal.toLowerCase();

														String meas_state = "GOOD";
														String meas_dur_state = "GOOD";
														if(clubMeasure != null && clubMeasure.containsKey(tempValLower))
														{
															String temp_duartion = tempVal.substring(0,tempVal.lastIndexOf("_"))+"_DURATION";
															String tempKeyMeasure = smeasure;
															tempKeyMeasure = tempKeyMeasure.substring(tempKeyMeasure.indexOf(":")+1);
															String tempDuarKeyMeasure = temp_duartion.substring(temp_duartion.indexOf(":")+1);
															
															if(stateMeasure != null && stateMeasure.size() > 0){
																Iterator iter = stateMeasure.entrySet().iterator();
																int test_inc = 0;
																while(iter.hasNext()){
																	Map.Entry entry_state = (Map.Entry)iter.next();
																	String el_State_key = (String)entry_state.getKey();
																	String el_State_val = (String)entry_state.getValue();
																	ArrayList al_state_keys = com.egurkha.util.StringUtils.egTokenizer(el_State_key, "^eg^",true,false,true);//3-->includeEmpty,4-->unique,5-->trim
																	
																	if(al_state_keys != null && al_state_keys.size() == 8){
																		String s_site_name = (String)al_state_keys.get(0);
																		String s_comp_type = (String)al_state_keys.get(1);
																		String s_comp_name = (String)al_state_keys.get(2);
																		String s_layer_name = (String)al_state_keys.get(3);
																		String s_test_name = (String)al_state_keys.get(4);
																		String s_msmt_name = (String)al_state_keys.get(5);
																		String s_info_name = (String)al_state_keys.get(6);
																		String s_meas_name = (String)al_state_keys.get(7);
																		
																		if(s_comp_type.equals(compType) && s_comp_name.equals(compName) && s_test_name.equals(stest) && s_msmt_name.equals(temp_ext_agnet) && s_info_name.equalsIgnoreCase(infoName) && s_meas_name.equalsIgnoreCase(tempKeyMeasure) ){
																			meas_state = el_State_val;
																			test_inc++;
																		}
																		else if(s_comp_type.equals(compType) && s_comp_name.equals(compName) && s_test_name.equals(stest) && s_msmt_name.equals(temp_ext_agnet) && s_info_name.equalsIgnoreCase(infoName) && s_meas_name.equalsIgnoreCase(tempDuarKeyMeasure) ){
																			meas_dur_state = el_State_val;
																			test_inc++;
																		}

																		if(test_inc > 1)
																			break;
																	}
																}
															}
															
															String temp_duartion_val="";
															String temp_duartion_val_alone="";

															if(temp_info != null)
															{
																if(dispComp!=null && dispComp.indexOf(":") > -1)
																{
																	dispComp = dispComp.substring(0,dispComp.indexOf(":"));
																}
																if(sdispName != null && sdispName.equalsIgnoreCase("Minimum response time"))
																{
																	temp_duartion_val = (String)dataCitra.get(dispComp +"^"+smeasure+":Min");
																}
																else if(sdispName != null && sdispName.equalsIgnoreCase("Maximum response time"))
																{
																	temp_duartion_val = (String)dataCitra.get(dispComp +"^"+smeasure+":Max");
																}
																else if(sdispName != null && (sdispName.equalsIgnoreCase("Total response time") ||sdispName.equalsIgnoreCase("TRANSACTION PROCESSING TIME") ||sdispName.equalsIgnoreCase("Availability") || sdispName.equalsIgnoreCase("TRANSACTION AVAILABLITY")))
																	temp_duartion_val = (String)dataCitra.get(dispComp +":"+smeasure+":TOTAL");
															}
															
															temp_duartion_val_alone = temp_duartion_val;
															temp_duartion_val_alone = (temp_duartion_val_alone == null)?"0":temp_duartion_val_alone;
															if(temp_duartion_val_alone.trim().equals("-"))
																temp_duartion_val_alone="0";
															temp_duartion_val = (temp_duartion_val == null)?"-":temp_duartion_val;
															int measl2_val = 0;
															/*if(temp_duartion_val != null && temp_duartion_val.indexOf(".") != -1)
																temp_duartion_val ="<span class='decimal-align'>"+temp_duartion_val.substring(0,temp_duartion_val.indexOf("."))+"</span><span class='decimal-align2'>"+temp_duartion_val.substring(temp_duartion_val.indexOf("."))+"</span>";
															else*/
																temp_duartion_val ="<span class='decimal-align'>"+temp_duartion_val+"</span>";			
														
															measure.put(i+"MeasureValue_org",new Float(temp_duartion_val_alone));
														}										 
														else{
															String disp = null;
															String tempKeyMeasure = smeasure;
															String linkParam = null;
															tempKeyMeasure = tempKeyMeasure.substring(tempKeyMeasure.indexOf(":")+1);
															if(!isLogonType){
																tempKeyMeasure = temp_arr[1];
																if(s > 3)
																	disp = temp_arr[3];
																if(s > 4)
																	linkParam = temp_arr[4];
															}
															if(linkParam != null && linkParam.trim().length() > 0){
																if(linkParam.startsWith("dLink")){
																	linkParam = linkParam.substring(linkParam.indexOf("~!~")+3);
																}
															}
															
															if(stateMeasure != null && stateMeasure.size() > 0){
																Iterator iter = stateMeasure.entrySet().iterator();
																while(iter.hasNext()){
																	Map.Entry entry_state = (Map.Entry)iter.next();
																	String el_State_key = (String)entry_state.getKey();
																	String el_State_val = (String)entry_state.getValue();
																	ArrayList al_state_keys = com.egurkha.util.StringUtils.egTokenizer(el_State_key, "^eg^",true,false,true);//3-->includeEmpty,4-->unique,5-->trim
																	
																	if(al_state_keys != null && al_state_keys.size() == 8){
																		String s_site_name = (String)al_state_keys.get(0);
																		String s_comp_type = (String)al_state_keys.get(1);
																		String s_comp_name = (String)al_state_keys.get(2);
																		String s_layer_name = (String)al_state_keys.get(3);
																		String s_test_name = (String)al_state_keys.get(4);
																		String s_msmt_name = (String)al_state_keys.get(5);
																		String s_info_name = (String)al_state_keys.get(6);
																		String s_meas_name = (String)al_state_keys.get(7);

																		String tmp_info = infoName;
																		tmp_info = (tmp_info != null && tmp_info.trim().length() > 0 && !tmp_info.startsWith("+"))?("+"+tmp_info):tmp_info;

																		if(s_comp_type.equals(compType) && s_comp_name.equals(compName) && s_test_name.equals(stest) && s_msmt_name.equals(temp_ext_agnet) && s_info_name.equalsIgnoreCase(tmp_info) && s_meas_name.equalsIgnoreCase(tempKeyMeasure) ){
																			meas_state = el_State_val;
																			break;
																		}
																		
																	}
																}
															}
															String measure_val1=null;
															String measure_val2=null;
															String tem_val_F="";
															String tem_val_S="";
															int measure_width = 0;
															int measure_width2 = 0;
															if(!isLogonType){
																if(measureValue!= null && measureValue.trim().length() > 0 && measureValue.equalsIgnoreCase("-")){
																	//measureValue = "<table style='table-layout:fixed;margin:auto'><tr><td width='50%' style='padding-top:0px'><div class='hyphenGray' style='margin:auto'></div></td></tr></table>";
																	measureValue = "<table style='table-layout:fixed;margin:auto'><tr><td style='padding-top:0px'><div class='hyphenGray' style='margin:auto'></div></td></tr></table>";
																}
																else{
																	measureValue = monUtil.formatDbValue(measureValue,4);
																	String temp_duartion_val = measureValue;
																	if(measureValue != null && measureValue.indexOf(".") != -1){
																		String dval = measureValue.substring(measureValue.indexOf(".")+1);
																		dval = dval.trim();
																		String temp_dval = "0";
																		if(dval != null && dval.length() > 1){
																			for(int k=1;k<dval.length();k++)
																				temp_dval += "0";
																		}
																		/*if(dval.equals(temp_dval))
																			temp_duartion_val ="<span class='decimal-align'>"+measureValue.substring(0,measureValue.indexOf("."))+"</span><span class='decimal-align2'></span>";
																		else
																			temp_duartion_val ="<span class='decimal-align'>"+measureValue.substring(0,measureValue.indexOf("."))+"</span><span class='decimal-align2'>"+"."+dval+"</span>";*/
																		
																		if(dval.equals(temp_dval))
																		{
																			measure_val1 = measureValue.substring(0,measureValue.indexOf("."));
																			measure_width = measure_val1.length() * 7;
																			
																			//temp_duartion_val ="<span class='decimal-align' width= '"+measure_width+"px'>"+measure_val1+"</span><span class='decimal-align2' width='30px'></span>";

																			if(max_measure_width>measure_width)
																				measure_width = max_measure_width;
																			else
																				max_measure_width = measure_width;
																				temp_duartion_val ="<span width= '"+measure_width+"px'>"+measure_val1+"</span><span width='30px'></span>";

																				//tem_val_F ="<span width= '"+measure_width+"px'>"+measure_val1+"</span>";
																				//tem_val_S ="<span width='"+measure_width2+"px'></span>";
																		}
																		else
																		{
																			if(measureValue.indexOf(".")>-1)
																			{
																				measure_val1 = measureValue.substring(0,measureValue.indexOf("."));
																				measure_width = measure_val1.length() * 7;

																				measure_val2 = measureValue.substring(measureValue.indexOf(".")+1);
																				measure_width2 =(measure_val2.length() * 7);
																			}
																			else
																			{
																				measure_width = measureValue.length() * 7;
																			}
																			
																			if(max_measure_width>measure_width)
																				measure_width = max_measure_width;
																			else if (max_measure_width<measure_width)
																				max_measure_width = measure_width;

																	
																			if(max_measure_width2>measure_width2)
																				measure_width2 = max_measure_width2;
																			else if (max_measure_width2<measure_width2)
																				max_measure_width2 = measure_width2;
																			//temp_duartion_val ="<span class='decimal-align' width= '"+measure_width+"px'>"+measure_val1+"</span><span class='decimal-align2'  width='30px'>"+"."+dval+"</span>";
																			temp_duartion_val ="<span width= '"+measure_width+"px'>"+measure_val1+"</span><span width='"+measure_width2+"px'>"+"."+dval+"</span>";
																			//tem_val_F ="<span width= '"+measure_width+"px'>"+measure_val1+"</span>";

																			//tem_val_S ="<span width='"+measure_width2+"px'>"+"."+dval+"</span>";
																		}
																	}
																	else
																	{
																		measure_width = measureValue.length() * 7;
																		//temp_duartion_val ="<span class='decimal-align'>"+measureValue+"</span>";
																		temp_duartion_val ="<span>"+measureValue+"</span>";
																		//tem_val_F ="<span width= '"+measure_width+"px'>"+measureValue+"</span>";
																		//tem_val_S ="<span width='30px'></span>";
																	}
																	if(disp != null && disp.trim().length() > 0 && disp.equalsIgnoreCase("Symbol")){
																		if(measureValue!= null && measureValue.trim().length() > 0 && !measureValue.startsWith("0"))
																			measureValue = " <div class='stateTick_"+meas_state+"' style='margin:auto;'></div>";
																		else if(measureValue!= null && measureValue.trim().length() > 0 && measureValue.startsWith("0") && meas_state.equalsIgnoreCase("GOOD"))
																			measureValue = " <div class='stateWrong_HIGH' style='margin:auto;'></div>";
																		else
																			measureValue = " <div class='stateWrong_"+meas_state+"' style='margin:auto;'></div>";
																	}
																	else if(disp != null && disp.trim().length() > 0 && disp.equalsIgnoreCase("bar"))
																	{
																		//int table_width = 40+measure_width;
																		if(measureValue!= null && measureValue.trim().length() > 0 && !measureValue.equalsIgnoreCase("-"))
																		{
																			//measureValue = "<table width='"+table_width+"px' style='table-layout:fixed;margin:auto'><tr><td width='"+td_width+"px' style='padding-top:2px'><div class='stateBox_"+meas_state+"' style='margin-top: -3px; margin-left:"+data_margin_left+"'>"+temp_duartion_val+"</div></td></tr></table>";
																			//measureValue = "<div class='stateBox_"+meas_state+"' style='float:none;margin:auto;'><table width='"+table_width+"px' style='table-layout:fixed;margin:auto;line-height:13px'><tr><td style='text-align:right;'>"+tem_val_F+"</td><td style='text-align:left;'>"+tem_val_S+"</td></tr></table></div>";
																			measureValue = "<div class='stateBox_"+meas_state+"' style='float:none;margin:auto;'><table width='95%' style='table-layout:fixed;margin:auto;line-height:14px'><tr><td style='text-align:right;'>"+temp_duartion_val+"</td></tr></table></div>";
																		}														
																	}
																	else{
																		//int table_width = 40+measure_width;
																		//int td_width = 30+measure_width;
																		if(measureValue!= null && measureValue.trim().length() > 0 && !measureValue.equalsIgnoreCase("-") && meas_state != null && (  meas_state.equalsIgnoreCase("Good") || meas_state.equalsIgnoreCase("Normal"))){
																			measureValue = "<table width='100px'style='table-layout:fixed;margin:auto'><tr><td width='20px' style='padding-top:0px'><div class='stateTick_"+meas_state+"' style='margin:auto;'></div></td><td style='padding-top:2px'><div>"+temp_duartion_val+"</div></td></tr></table>";
																		}else{
																			measureValue = "<table width='100px' style='table-layout:fixed;margin:auto'><tr><td width='20px' style='padding-top:0px'><div class='stateWrong_"+meas_state+"' style='margin:auto;'></div></td><td style='padding-top:2px'><div>"+temp_duartion_val+"</div></td></tr></table>";
																		}
																	}
																	if(linkParam != null && linkParam.trim().length() > 0){
																		String tmp_info = infoName;
																		tmp_info = (tmp_info != null && tmp_info.trim().length() > 1 && !tmp_info.startsWith("+"))?("+"+tmp_info):tmp_info;
																		String keyMeasure = temp_arr[1]+"~"+sdispName;
																		String link = "/final/monitor/EgMeasureTopology.jsp?host="+el_comp_name+"&port="+el_port_name+"&testName="+stest+"&measures="+EgURLEncoder.encode(linkParam,"UTF-8")+"&info="+EgURLEncoder.encode(tmp_info,"UTF-8")+"&keyMeasure="+EgURLEncoder.encode(keyMeasure,"UTF-8");
																		String imgValue = "<div style=\"position:relative;height:15px;width:16px\"><img src=\"/final/images/spacer.gif\" class=\"iconDiagnosis\"  onClick=\'javascript:loadPopup(\""+link+"\");\' style=\"cursor:pointer\" data-qtip=\"Topology\" data-qclass=\"yellowTip\"/></div>";
																		measure.put(i+"MeasureValueImglink",imgValue);
																	}
																}
															}											
															measure.put(i+"MeasureValue_org",org_measureValue.trim());
														}
														measure.put(i+"MeasureValue",measureValue);
														if(measureValue!=null && !measureValue.equals("-"))
														{
															if(isLogonType && unitMeasure.equals("%"))
															{
																try{
																	int columnWidth = 100;
																	Long temp_measure_value=new Long(Math.round(Double.parseDouble(measureValue)));
																	long fillColorValue=temp_measure_value.longValue();
																	long value1 = (fillColorValue*100)/columnWidth;
																	measure.put(i+"MeasureValueWidth",value1);
																}catch(Exception ee){

																}
															}

															measure.put(i+"MeasureValueUrl",tempUrl);
														}
													}
													colCount++;
												}
											}
										}
										else
											measures = null;
									}
									catch(Exception e)
									{
										measures = null;
									}
								}
								if(measures!=null && isNeedToAddMeasure)
									measures.add(measure);															
							}
						}				
					}
				}
			}
			else if(sortedMeasures != null && sortedMeasures.size() > 0){
				int pageLe=-1;
				int sortedMeas_count=sortedMeasures.size();
				Hashtable result_dd = new Hashtable();
				int first_el_key=0;
				
				Hashtable stateMeasure = monUtil.getComponentState(null,compTypeListForState,compNameListForState,null,testList,null,null,null);

				for(int u=0;u<sortedMeas_count;u++){
					ArrayList elements = (ArrayList)sortedMeasures.get(u);
					int start = !isLogonType?pageStartIndex:0;
					for(int l=start;l<elements.size();l++){
						ArrayList innerEl = (ArrayList)elements.get(l);
						if(innerEl != null && innerEl.size() > 0){
							String info_elment = (String)innerEl.get(0);
							String sorted_key_elemet = (String)innerEl.get(1);
							String el_state = null;
							if(innerEl.size() == 3)
								el_state = (String)innerEl.get(2);
							ArrayList sorted_key_elemet_list = com.egurkha.util.StringUtils.egTokenizer(sorted_key_elemet, ":",true,false,true);//3-->includeEmpty,4-->unique,5-->trim

							if(sorted_key_elemet_list != null && sorted_key_elemet_list.size() == 7){
								pageLe++;
								//if(pageLe >= pageStartIndex && pageLe < pageEndIndex)
								if(true)
								{
									if(!isLogonType && l == pageEndIndex){
										break;
									}
									String el_comp_name = (String)sorted_key_elemet_list.get(0);
									String el_port_name = (String)sorted_key_elemet_list.get(1);
									String el_comp_type_name = (String)sorted_key_elemet_list.get(2);
									String el_layer_name = (String)sorted_key_elemet_list.get(3);
									String el_info_name = (String)sorted_key_elemet_list.get(4);
									String sid = "";
									if(el_info_name != null && el_info_name.trim().length() > 1 && !el_info_name.startsWith("+"))
										sid = el_info_name.substring(0,el_info_name.indexOf("+"));
									String el_test_name = (String)sorted_key_elemet_list.get(5);
									String el_msmt_host_name = (String)sorted_key_elemet_list.get(6);
									String temp_ext_agnet = el_msmt_host_name ;
									String infoName = el_info_name;
									String temp_info = el_info_name;
									String compWithPort = el_comp_name+":"+el_port_name;
									String compWithPortURL = el_comp_name+":"+el_port_name;
									String _hostPort = discInfo.getPortForHost(el_comp_name,el_comp_type_name);
									if(_hostPort != null && _hostPort.trim().length()>0)
									{
										compWithPortURL = el_comp_name+":"+_hostPort;
									}																	

									//if(sid != null && sid.trim().length() > 1)
										//compWithPort = compWithPort+":"+sid;	
									
									stest = el_test_name;
									dispComp = compWithPort;
									compName = compWithPortURL;
									compType = el_comp_type_name;
									//compTypeList = new ArrayList();
									//compTypeList.add(compType);
									String fulCompName = el_comp_type_name+":"+compWithPort;
									if(isNonRunningCompListView && tempCompList.contains(fulCompName))
									{
										tempCompList.remove(fulCompName);
									}

									//List compNameList = new ArrayList();
									//compNameList.add(compWithPortURL);
									boolean isLogOnFail = false;
									boolean isEnumFail=false;
									//Hashtable stateMeasure = monUtil.getComponentState(null,compTypeList,compNameList,null,testList,null,null,null);
									JSONObject measure  = new JSONObject();
									//boolean isEnumFail = false;
									String temp_site="NULL";
									String treeTitle_New=treeTitle;
									if(el_layer_name != null && el_layer_name.trim().length() > 0 && el_layer_name.indexOf(",") > 0){
										ArrayList layerList = tables.getLayersForComponent(compType);
										ArrayList testLayerList = com.egurkha.util.StringUtils.egTokenizer(el_layer_name, ",",false,false,true);//3-->includeEmpty,4-->unique,5-->trim
										if(layerList != null && layerList.size() > 0 && testLayerList != null && testLayerList.size() > 0){
											for(int k=0;k<layerList.size();k++){
												String lay = (String)layerList.get(k);
												if(lay != null && lay.trim().length() > 0 && testLayerList.contains(lay)){
													el_layer_name = lay;
													break;
												}
											}
										}
									}
									
									if(filterBy!=null && filterBy.length()>0 && subFilter!=null && subFilter.length()>0 && !isLogonForService)
									{
										if(isfromRum!= null && isfromRum.equalsIgnoreCase("true")){
											url = "/final/servlet/com.eg.EgDashboardController?from=list&site="+EgURLEncoder.encode(temp_site,"UTF-8")+"&qctr=2&comptype="+el_comp_type_name+"&host="+EgURLEncoder.encode(compWithPortURL,"UTF-8")+"&tab=LayerModel&toDashBoardLayer=true&treeTitle="+treeTitle_New+"&filterBy=Service&subFilter="+filterBy+"&componentNameSearch="+componentNameSearch+"&simulationName="+simulationName+"&fromp=ctxLogonDashboard&externalAgent="+externalAgent+"";
										}else{
											url = "/final/servlet/com.eg.EgDashboardController?from=list&site="+EgURLEncoder.encode(temp_site,"UTF-8")+"&qctr=2&comptype="+el_comp_type_name+"&host="+EgURLEncoder.encode(compWithPortURL,"UTF-8")+"&tab=LayerModel&toDashBoardLayer=true&treeTitle="+treeTitle_New+"&filterBy="+filterBy+"&subFilter="+subFilter+"&componentNameSearch="+componentNameSearch+"&simulationName="+simulationName+"&fromp=ctxLogonDashboard&externalAgent="+externalAgent;
										}
									}
									else if(isLogonForService)
									{
										if(isfromRum!= null && isfromRum.equalsIgnoreCase("true"))
										{
											url = "/final/servlet/com.eg.EgDashboardController?from=list&site="+EgURLEncoder.encode(temp_site,"UTF-8")+"&qctr=2&comptype="+el_comp_type_name+"&host="+EgURLEncoder.encode(compWithPortURL,"UTF-8")+"&tab=LayerModel&toDashBoardLayer=true&treeTitle="+treeTitle_New+"&componentNameSearch="+componentNameSearch+"&simulationName="+simulationName+"&externalAgent="+externalAgent+"&filter="+filter+"&filterBy="+filterBy1+"&selectedRum="+selectedRum+"&isFromServiceMenu="+isFromServiceMenu+"&isFromZoneMain="+isFromZoneMain+"&isFromZoneMenu="+isFromZoneMenu+"&isFromServiceGroup="+isFromServiceGroup+"&isRumLogon=true";
										}
										else
										{
											url = "/final/servlet/com.eg.EgDashboardController?from=list&site="+EgURLEncoder.encode(temp_site,"UTF-8")+"&qctr=2&comptype="+el_comp_type_name+"&host="+EgURLEncoder.encode(compWithPortURL,"UTF-8")+"&tab=LayerModel&toDashBoardLayer=true&treeTitle="+treeTitle_New+"&componentNameSearch="+componentNameSearch+"&simulationName="+simulationName+"&externalAgent="+externalAgent+"&filter="+filter+"&filterBy="+filterBy1+"&isFromServiceMenu="+isFromServiceMenu+"&isFromZoneMain="+isFromZoneMain+"&isFromZoneMenu="+isFromZoneMenu+"&isFromServiceGroup="+isFromServiceGroup+"&isCitrixLogon=true";
										}
									}
									else
									{
										url = "/final/servlet/com.eg.EgDashboardController?from=list&site="+EgURLEncoder.encode(temp_site,"UTF-8")+"&qctr=2&comptype="+el_comp_type_name+"&host="+EgURLEncoder.encode(compWithPortURL,"UTF-8")+"&tab=LayerModel&toDashBoardLayer=true&fromp=ctxLogonDashboard&treeTitle="+treeTitle_New+"&componentNameSearch="+componentNameSearch+"&simulationName="+simulationName+"&externalAgent="+externalAgent; 
									}
									if(el_info_name != null && el_info_name.trim().length() > 1 && !el_info_name.startsWith("+"))
										el_info_name = el_info_name.substring(el_info_name.indexOf("+"));

									String tmp_el_info_name=el_info_name;
									if(tmp_el_info_name!=null && tmp_el_info_name.startsWith("+"))
										tmp_el_info_name=tmp_el_info_name.substring(1);

									//url+="&test="+EgURLEncoder.encode(el_test_name+"- "+el_info_name,"UTF-8")+"&layer="+el_layer_name+"&msmt_host="+el_msmt_host_name+"&tstate="+compState+"&port="+el_port_name;

									if(!isMultiCompType)
									{
										if(ltype != null && ltype.trim().length() > 0)
											url+="&ltype="+ltype;
									}
									if(ltest != null && ltest.trim().length() > 0)
										url+="&ltest="+ltest;
									if(monitorsBy != null && monitorsBy.trim().length() > 0)
										url+="&monitorsBy="+monitorsBy;

									url+="&test="+EgURLEncoder.encode(el_test_name+"- "+tmp_el_info_name,"UTF-8")+"&layer="+el_layer_name+"&msmt_host="+el_msmt_host_name+"&tstate="+compState+"&port="+el_port_name;

									if(isFromInfraHome != null && isFromInfraHome.trim().length() > 0)
										url+="&isFromInfraHome="+isFromInfraHome;
									if(selectedState != null && selectedState.trim().length() > 0)
										url+="&selectedState="+selectedState;

									if(isFromZoneInfra != null && isFromZoneInfra.trim().length() > 0)
										url+="&isFromZoneInfra="+isFromZoneInfra;
									if(zoneName != null && zoneName.trim().length() > 0)
										url+="&zoneName="+zoneName;
									if(fromServiceDashboard != null && fromServiceDashboard.equalsIgnoreCase("true"))
										url+="&fromServiceDashboard="+fromServiceDashboard;
									if(isfromCitrix != null && isfromCitrix.equalsIgnoreCase("true"))
										url+="&isfromCitrix=true&iniName="+iniName+"&user_name="+user_name+"&dashboard_mapping="+dashboard_mapping+"&dashboard_name="+dashboard_name+"&view_name="+view_name+"&fromSerComboChange="+fromSerComboChange+"&fromServiceHomePage="+fromServiceHomePage+"&appliesTo="+appliesTo+"&isFromZone="+isFromZone+"&iszoneName="+iszoneName+"&parentZone="+parentZone+"&fromPageView=CitrixDashboard";
									if(isfromRum != null && isfromRum.equalsIgnoreCase("true"))
										url+="&isfromRum="+isfromRum+"&iniName="+iniName+"&user_name="+user_name+"&dashboard_mapping="+dashboard_mapping+"&dashboard_name="+dashboard_name+"&view_name="+view_name+"&fromSerComboChange="+fromSerComboChange+"&fromServiceHomePage="+fromServiceHomePage+"&appliesTo="+appliesTo+"&isFromZone="+isFromZone+"&iszoneName="+iszoneName+"&parentZone="+parentZone+"&fromPageView=RumDashboard";
								
									if(url.indexOf("&isFromZoneMenu=")<0)
									{
										if(isFromZoneMenu!=null && isFromZoneMenu.trim().length()>0)
											url+="&isFromZoneMenu="+isFromZoneMenu;
									}
								

									//url +="&ltype="+ltype;
									
									if(url.indexOf("&fromHomepage=")<0)
									{
										if(fromHomepage!=null && fromHomepage.trim().length()>0)
											url+="&fromHomepage="+fromHomepage;
									}
			
									if(url.indexOf("&parentZone=")<0)
									{	
										if(parentZone!=null && parentZone.trim().length()>0)
											url+="&parentZone="+parentZone;
									}
									if(url.indexOf("&isFromMenu=")<0)
									{	
										if(request.getParameter("isFromMenu")!=null && request.getParameter("isFromMenu").trim().length()>0)
											url+="&isFromMenu="+request.getParameter("isFromMenu");
									}
								
									measure.put("systemIconClass","");
									measure.put("systemIconTitle","");
									if(monitorsBy != null && monitorsBy.trim().equalsIgnoreCase("CITRA"))
									{
										String sessionTopologyUrl = "/final/monitor/sessionSimulation.jsp?compName="+EgURLEncoder.encode(compWithPort,"UTF-8")+"&site="+EgURLEncoder.encode(temp_site,"UTF-8")+"&compType="+el_comp_type_name;
										
										if(treeTitle_New != null && treeTitle_New.trim().length() > 0)
											sessionTopologyUrl+="&treeTitle="+treeTitle_New;

										if(!isMultiCompType)
										{
											if(ltype != null && ltype.trim().length() > 0)
												sessionTopologyUrl+="&ltype="+ltype;
										}

										if(ltest != null && ltest.trim().length() > 0)
											sessionTopologyUrl+="&ltest="+ltest;
										if(monitorsBy != null && monitorsBy.trim().length() > 0)
											sessionTopologyUrl+="&monitorsBy="+monitorsBy;
										if(externalAgent != null && externalAgent.trim().length() > 0)
											sessionTopologyUrl+="&externalAgent="+externalAgent;
										if(isFromInfraHome != null && isFromInfraHome.trim().length() > 0)
											sessionTopologyUrl+="&isFromInfraHome="+isFromInfraHome;
										if(isFromMenu1 != null && isFromMenu1.trim().length() > 0)
											sessionTopologyUrl+="&isFromMenu="+isFromMenu1;
										if(selectedState != null && selectedState.trim().length() > 0)
											sessionTopologyUrl+="&selectedState="+selectedState;
										if(isFromZoneInfra != null && isFromZoneInfra.trim().length() > 0)
											sessionTopologyUrl+="&isFromZoneInfra="+isFromZoneInfra;
										if(zoneName != null && zoneName.trim().length() > 0)
											sessionTopologyUrl+="&zoneName="+zoneName;
										
										if(parentZone != null && parentZone.trim().length() > 0)
											 sessionTopologyUrl+="&parentZone="+parentZone;
										if(fromHomepage!=null && fromHomepage.trim().length()>0)
											sessionTopologyUrl+="&fromHomepage="+fromHomepage;
										if(isFromZoneMenu!=null && isFromZoneMenu.trim().length()>0)
											sessionTopologyUrl+="&isFromZoneMenu="+isFromZoneMenu;

										//sessionTopologyUrl +="&isFromMetricsPage=true";
										measure.put("layerModelUrl",sessionTopologyUrl+"&fromp=ctxLogonDashboard");
									}
									else
										measure.put("layerModelUrl",url);

									measure.put("systemTitle",Server.getServerNameWithoutPort(compWithPort, false));
									measure.put("system",Server.getServerNameWithoutPort(compWithPort, false));
									
									String enum_state= "";
									int max_measure_width=0;
									int max_measure_width2=0;
									for(int i=0;i<keyList.size();i++)
									{
										key = (String)keyList.get(i);
										String temp_arr[]=StringUtils.getTokens(key,":");
										int s=temp_arr.length;

										if(isLogonType && s >= 5){
											
											String org_mea="";
											stest = temp_arr[0];
											smeasure = temp_arr[1];
											String ddMeasure = temp_arr[2];
											String ddinnerMeasure = temp_arr[3];
											org_mea = smeasure;
											sdispName = temp_arr[4];
											String url_info = el_info_name;
											if(url_info.startsWith("+"))
												url_info=url_info.substring(1);

											String layer =tables.getLayerForTest(stest);
											String dLink = "/final/monitor/EgDiagnosis.jsp?site=NULL&host="+el_comp_name+"&port="+el_port_name+"&test="+stest+"&isPopUp=true";

											String compddLink = dLink + "&info=*"+EgURLEncoder.encode(url_info,"UTF-8")+"&msmt_host="+EgURLEncoder.encode(temp_ext_agnet,"UTF-8")+"&from=0&measure="+smeasure+"&flag=1&firsttime=true&comptype="+EgURLEncoder.encode(compType,"UTF-8");
											
											String  aggLink="/final/monitor/dispAggComponentGraphs.jsp?site=NULL&host=" +EgURLEncoder.encode(el_comp_name,"UTF-8")+ "&port=" + el_port_name + "&layer=" +EgURLEncoder.encode(layer,"UTF-8")+ "&test=" + stest + "&comptype="+EgURLEncoder.encode(compType,"UTF-8");


											String aggregateLink=aggLink + "&info=*"+EgURLEncoder.encode(url_info,"UTF-8")+ "&gtype=1&measure="+smeasure+ "&msmt_host="+	EgURLEncoder.encode(temp_ext_agnet,"UTF-8")+"&state=any";

											String db_meas = dbInfo.getColumnForMeasure(stest, smeasure);
											db_meas = (db_meas == null || db_meas.trim().length() == 0)?smeasure:db_meas;

											String compgraphLink = "/final/monitor/dispComponentGraphs.jsp?site=NULL&host=" +el_comp_name+"&port="+el_port_name+"&layer="+layer+"&test="+stest+"&comptype="+EgURLEncoder.encode(compType,"UTF-8");

											String  graphLink = compgraphLink + "&info=*"+EgURLEncoder.encode(url_info,"UTF-8")+ "&gtype=1&measure="+db_meas+ "&msmt_host="+	EgURLEncoder.encode(temp_ext_agnet,"UTF-8")+"&state=any";
											

											String compsummarygraphLink ="/final/monitor/dispComponentSummaryGraphs.jsp?site=NULL&host=" +EgURLEncoder.encode(el_comp_name,"UTF-8")+ "&port=" + el_port_name + "&layer=" +EgURLEncoder.encode(layer,"UTF-8")+ "&test=" + stest + "&comptype="+EgURLEncoder.encode(compType,"UTF-8");
									
											String summarygraphLink = compsummarygraphLink + "&info=*"+EgURLEncoder.encode(url_info,"UTF-8")+ "&gtype=1&measure="+smeasure+ "&msmt_host="+	EgURLEncoder.encode(temp_ext_agnet,"UTF-8")+"&state=any";

											
											String comptrendgraphLink ="/final/monitor/dispComponentTrendGraphs.jsp?site=NULL&host=" +EgURLEncoder.encode(el_comp_name,"UTF-8")+ "&port=" + el_port_name + "&layer=" +EgURLEncoder.encode(layer,"UTF-8")+ "&test=" + stest + "&comptype="+EgURLEncoder.encode(compType,"UTF-8");

											String trendgraphLink = comptrendgraphLink + "&info=*"+EgURLEncoder.encode(url_info,"UTF-8")+ "&gtype=1&measure="+smeasure+ "&msmt_host="+	EgURLEncoder.encode(temp_ext_agnet,"UTF-8")+"&state=any";

											
											String historyLink="/final/monitor/dispComponentHistory.jsp?site=NULL&info=" + EgURLEncoder.encode(url_info,"UTF-8") + "&test=" + stest + "&component=" +EgURLEncoder.encode(compName+":"+compType,"UTF-8")+"&measure="+smeasure;
											
											String feedLink="/final/monitor/dispComponentFeedback.jsp?site=NULL&trgthost="+el_comp_name+"&port="+el_port_name+"&test="+stest+"&comptype="+EgURLEncoder.encode(compType,"UTF-8");
											
											String portForMsmtTime="NULL";
											String keyValue=el_comp_name+":"+portForMsmtTime+":"+stest+":"+temp_ext_agnet;
											if(compName!=null && compName.indexOf(":")>0)
											{		
												keyValue=compName+":"+stest+":"+temp_ext_agnet;
											}
											String msmtTimeStr=dashboardDAO.getMeasureLastMsmtTime(keyValue,url_info);
											String msmtTimeStr2="";
											try
											{
												SimpleDateFormat df=new SimpleDateFormat("MM/dd/yyyy*HH:mm:ss");
												SimpleDateFormat sdf2=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
												if(msmtTimeStr!=null && msmtTimeStr!="")
												{							
													java.util.Date msd=sdf2.parse(msmtTimeStr);
													msmtTimeStr2 =df.format(msd);
												}
											}
											catch(Exception eexx)
											{
												System.out.println("Exception--->"+eexx.getMessage());
												eexx.printStackTrace();
											}

											String feedbackLink =  feedLink+"&info=*"+EgURLEncoder.encode(url_info,"UTF-8")+ "&measure="+smeasure+ "&msmttime="+msmtTimeStr2 +"&msmt_host="+EgURLEncoder.encode(temp_ext_agnet,"UTF-8");
											
											linksMap.put(el_comp_name+temp_ext_agnet+infoName+smeasure+"compddlink", compddLink);

											linksMap.put(el_comp_name+temp_ext_agnet+infoName+smeasure+"compfeedbacklink", aggregateLink);

											linksMap.put(el_comp_name+temp_ext_agnet+infoName+smeasure+"compgraphlink", graphLink);

											linksMap.put(el_comp_name+temp_ext_agnet+infoName+smeasure+"compsummarygraphlink", summarygraphLink);

											linksMap.put(el_comp_name+temp_ext_agnet+infoName+smeasure+"comptrendgraphlink", trendgraphLink);

											linksMap.put(el_comp_name+temp_ext_agnet+infoName+smeasure+"comphistorylink", historyLink);

											linksMap.put(el_comp_name+temp_ext_agnet+infoName+smeasure+"compfeedbacklink", feedbackLink);


											columns.getJSONObject(i+1).put("textType", "asFloat");
											columns.getJSONObject(i+1).put("dataIndex",i+"MeasureValue");
											columns.getJSONObject(i+1).put("measureOrgName",smeasure);
											columns.getJSONObject(i+1).put("sortType","ASC");

											String key1 = temp_ext_agnet+":"+compName+":"+stest+":"+smeasure+":"+ddMeasure+":"+temp_info+":"+ddinnerMeasure;
											if(result_dd == null || result_dd.size() == 0)
											{
												//Hashtable result_dd_temp = getDDMeasureValue(stest,smeasure,compNameAlone,port_no_alone,null,ddMeasure,temp_info,true);
												Hashtable result_dd_temp = getDDMeasureValueNew(stest,smeasure,componentList,ddMeasure,true);
												result_dd.putAll(result_dd_temp);
											}
											if(result_dd != null && result_dd.containsKey(key1))
											{
												String cval = (String)result_dd.get(key1);
												cval = (cval==null)?"-":cval;

												cval = cval.trim();
												if(ddinnerMeasure.equalsIgnoreCase("Published Resource")){
													String t_info ="";
													if(temp_info != null && temp_info.trim().length() > 0)
														t_info = temp_info.substring(1);
													if(cval.indexOf(t_info) != -1)
													{
														cval = cval.substring(cval.indexOf(">")+1);
														measure.put(i+"MeasureValue",cval);
													}
													else
														measure.put(i+"MeasureValue","-");

													measure.put(i+"MeasureValueUrl",url);
												}else{
													measure.put(i+"MeasureValue",cval);
													measure.put(i+"MeasureValueUrl",url);
												}
											}
											else
												measure.put(i+"MeasureValue","-");

											colCount++;
										}
										else if(s==2){
											String ds_type  = temp_arr[0];
											smeasure = temp_arr[1];
											String sortty="ASC";
											if(sort_type!=null && sort_type.equalsIgnoreCase("DESC"))
											{
												sortty="ASC";
											}
											else if(sort_type!=null && sort_type.equalsIgnoreCase("ASC"))
											{
												sortty="DESC";
											}
											if(ds_type != null && ds_type.equalsIgnoreCase("dd_link")){
												columns.getJSONObject(i+1).put("textType", "asFloat");
												columns.getJSONObject(i+1).put("dataIndex",i+"MeasureValue");
												columns.getJSONObject(i+1).put("measureOrgName",smeasure);
												columns.getJSONObject(i+1).put("sortType","ASC");

												if(infoName.equalsIgnoreCase("-")){
													measure.put(i+"MeasureValue","");
												}else{
													//el_comp_name+":"+el_port_name;
													String enInfoName="";
													if(infoName!=null && infoName.trim().length()>0)
														{
															enInfoName=infoName;
															enInfoName = com.egurkha.util.StringUtils.replace(enInfoName,"#","|hash|");
															enInfoName=com.egurkha.util.StringUtils.replace(enInfoName,"+","|plus|");
															enInfoName=com.egurkha.util.StringUtils.replace(enInfoName,"&","|amp|");
															enInfoName=com.egurkha.util.StringUtils.replace(enInfoName,"%","|pct|");
														}
													String ddLink= "/final/monitor/componentMeasureTabSet.jsp?type="+toFindLType+"&site=NULL&host="+el_comp_name+"&port="+el_port_name+"&info="+temp_ext_agnet+"&orgInfo="+EgURLEncoder.encode(enInfoName,"UTF-8")+"&state=GOOD&messy=Logon_availability&clicked=dd&newWindow=true&from=cls&test="+l_test;

													
													measure.put(i+"MeasureValue","<div style=\"position:relative;height:15px;width:16px;top:2px\"><img src=\"/final/images/spacer.gif\" class=\"iconDiagnosis\"  hspace=\"3px\" onClick=\'javascript:loadPopup(\""+ddLink+"\");\' style=\"cursor:pointer\" data-qtip=\"Diagnosis\" data-qclass=\"yellowTip\"/></div>");
												}

											}
											else if(ds_type.equalsIgnoreCase("externalAgent")){
												columns.getJSONObject(i+1).put("textType", "asFloat");
												columns.getJSONObject(i+1).put("dataIndex",i+"MeasureValue");
												columns.getJSONObject(i+1).put("measureOrgName",smeasure);
												columns.getJSONObject(i+1).put("sortType",sortty);

												measure.put(i+"MeasureValue",temp_ext_agnet);

												measure.put(i+"MeasureValueUrl",url);
											}
											else{
												columns.getJSONObject(i+1).put("textType", "asFloat");
												columns.getJSONObject(i+1).put("dataIndex",i+"MeasureValue");
												columns.getJSONObject(i+1).put("measureOrgName",smeasure);
												columns.getJSONObject(i+1).put("sortType",sortty);
												String el_info = temp_info;
												if(el_info == null)
													el_info="-";
												el_info = el_info.trim();
												if(el_info.startsWith("+"))
													el_info = el_info.substring(1);

												infoName=el_info;
												if(!isLogonType)
													measure.put(i+"MeasureValue",el_info);
												else{
													//String layer_name =tables.getLayerForTest(l_test);
													String stateFromAlarmTable = EgAlarmTable.getTestPriority(compName,compType,el_layer_name,temp_info,l_test,temp_ext_agnet,"","yes");
													if(stateFromAlarmTable == null || stateFromAlarmTable.trim().length() == 0)
														stateFromAlarmTable="GOOD";
													measure.put(i+"MeasureValue","<div style='float:left;' class='state_"+stateFromAlarmTable+"'></div>&nbsp;"+el_info);
												}
												measure.put(i+"MeasureValueUrl",url);
												measure.put(i+"MeasureValue_org",first_el_key);
												first_el_key++;
												//measure.put("layerModelUrl",url);
											}
											colCount++;
										}
										else{

											if(s==4)
											{
												String s_test=temp_arr[0];
												String s_measure=temp_arr[1];
												unitMeasure = tablesInfo.getUnitForMeasure(s_test,s_measure);
											}
											else
											{
												unitMeasure = (String)measureList.get(key);
											}

											String org_mea="";
											stest = temp_arr[0];
											smeasure = temp_arr[1];
											org_mea = smeasure;
											sdispName = temp_arr[2];
											
											dbMeasure =  dbInfo.getColumnForMeasure(stest,smeasure);
											if(dbMeasure!=null && !dbMeasure.equals(""))
												smeasure = dbMeasure;
											if(smeasure!=null)
											{
												smeasure=stest+":"+smeasure;
											}

											/*if(dispComp!=null && dispComp.indexOf(":") > -1)
											{
												dispComp = dispComp.substring(0,dispComp.indexOf(":"));
											}*/

											String temp_dispComp = temp_ext_agnet+"||"+dispComp;

											HashSet Info=(HashSet)measureData.get(temp_dispComp +"^"+smeasure+":INFO");
											if(temp_info != null)
												measureValue = (String)measureData.get(temp_dispComp +"^"+smeasure+":"+temp_info);
											else
												measureValue = (String)measureData.get(temp_dispComp +"^"+smeasure);
											if(measureValue == null)
											{
												measureValue = "-";
											}

											if(measureValue != null && measureValue.trim().length() > 0 && !measureValue.equals("-") && testMeasureConversionMap != null && testMeasureConversionMap.size() > 0 && testMeasureConversionMap.containsKey(stest+":"+org_mea)){
												measureValue = monUtilities.convertValue(measureValue,unitMeasure,(String)testMeasureConversionMap.get(stest+":"+org_mea));
											}
											
											String org_measureValue = measureValue;
											String testToUtl="";
											hostNameToken=StringUtils.getTokens(compName,":");
											if(hostNameToken!=null && hostNameToken.length>0)
											{
												hostName = hostNameToken[0];
												hostPort = hostNameToken[1];
											}

											boolean portReleventForTest = specsInfo.isPortRelevantForTest(stest);
											String compNameToUrl=compName;
											if(!portReleventForTest)
											{
												hostPort="NULL";
												//compNameToUrl=hostName+":NULL";
											}

											List agents=egExternalInfo.getAgentsFor(stest,compType,hostName);
											if(agents!=null && agents.size()>0)
												msmtHost=(String)agents.get(0);
											else
												msmtHost=hostName;
											String Layer_name_str=tablesInfo.getLayerForTest(stest);
											StringTokenizer tokenLayer=new StringTokenizer(Layer_name_str,",");
											String layerName="HOST";
											if(tokenLayer!=null)
											{
												while(tokenLayer.hasMoreTokens())
												{
													String l_name=(String)tokenLayer.nextToken();
													if(l_name!=null)
													{
														if(tablesInfo.isMeasureInLayer(stest,org_mea,l_name))
														{
															layerName=l_name;
															break;
														}
													}
												}
											}
											
											if(filterBy!=null && filterBy.length()>0 && subFilter!=null && subFilter.length()>0)
											{
												if(Info!=null && Info.size()==1)
												{
													String infoFirst=Info.iterator().next().toString();
													if(infoFirst != null && infoFirst.trim().length() > 1 && !infoFirst.startsWith("+"))
														infoFirst = infoFirst.substring(infoFirst.indexOf("+"));
													testToUtl=stest+"-"+infoFirst;
													Measureurl="/final/monitor/EgSiteInfraView.jsp?qctr=2&fromalarm=&host="+EgURLEncoder.encode(compNameToUrl,"UTF-8")+"&layer="+EgURLEncoder.encode(layerName,"UTF-8")+"&site="+site+"&msmt_host="+EgURLEncoder.encode(msmtHost,"UTF-8")+"&test="+testToUtl+"&comptype="+EgURLEncoder.encode(compType,"UTF-8")+"&tstate="+compState+"&newWindow=false&prevPage=MainDashBoard&treeTitle="+treeTitle_New+"&filterBy="+filterBy+"&subFilter="+subFilter+"&componentNameSearch="+componentNameSearch+"&simulationName="+simulationName+"&fromp=ComparisonDashboard&isFromZone="+isFromZone+"&iszoneName="+iszoneName+"&parentZone="+parentZone;
												}
												else if(Info!=null && Info.size()>1)
												{
													testToUtl="null-+";
													Measureurl="/final/monitor/EgSiteInfraView.jsp?qctr=1&fromalarm=&host="+EgURLEncoder.encode(compNameToUrl,"UTF-8")+"&layer="+EgURLEncoder.encode(layerName,"UTF-8")+"&site="+site+"&msmt_host="+EgURLEncoder.encode(msmtHost,"UTF-8")+"&test="+testToUtl+"&comptype="+EgURLEncoder.encode(compType,"UTF-8")+"&tstate="+compState+"&newWindow=false&prevPage=MainDashBoard&treeTitle="+treeTitle_New+"&filterBy="+filterBy+"&subFilter="+subFilter+"&componentNameSearch="+componentNameSearch+"&simulationName="+simulationName+"&fromp=ComparisonDashboard&isFromZone="+isFromZone+"&iszoneName="+iszoneName+"&parentZone="+parentZone;
												}
												else
												{
													testToUtl="null-+";
													Measureurl="/final/monitor/EgSiteInfraView.jsp?qctr=1&fromalarm=&host="+EgURLEncoder.encode(compNameToUrl,"UTF-8")+"&layer="+EgURLEncoder.encode(layerName,"UTF-8")+"&site="+site+"&msmt_host="+EgURLEncoder.encode(msmtHost,"UTF-8")+"&test="+testToUtl+"&comptype="+EgURLEncoder.encode(compType,"UTF-8")+"&tstate="+compState+"&newWindow=false&prevPage=MainDashBoard&treeTitle="+treeTitle_New+"&filterBy="+filterBy+"&subFilter="+subFilter+"&componentNameSearch="+componentNameSearch+"&simulationName="+simulationName+"&fromp=ComparisonDashboard&isFromZone="+isFromZone+"&iszoneName="+iszoneName+"&parentZone="+parentZone;
												}
											}
											else
											{
												if(Info!=null && Info.size()==1)
												{
													//testToUtl=stest+"-"+(String)Info.toArray()[0];
													String infoFirst=Info.iterator().next().toString();
													if(infoFirst != null && infoFirst.trim().length() > 1 && !infoFirst.startsWith("+"))
														infoFirst = infoFirst.substring(infoFirst.indexOf("+"));
													testToUtl=stest+"-"+infoFirst;
													Measureurl="/final/monitor/EgSiteInfraView.jsp?qctr=2&fromalarm=&host="+EgURLEncoder.encode(compNameToUrl,"UTF-8")+"&layer="+EgURLEncoder.encode(layerName,"UTF-8")+"&site="+site+"&msmt_host="+EgURLEncoder.encode(msmtHost,"UTF-8")+"&test="+testToUtl+"&comptype="+EgURLEncoder.encode(compType,"UTF-8")+"&tstate="+compState+"&newWindow=false&prevPage=MainDashBoard&treeTitle="+treeTitle_New+"&componentNameSearch="+componentNameSearch+"&simulationName="+simulationName+"&fromp=ComparisonDashboard&isFromZone="+isFromZone+"&iszoneName="+iszoneName+"&parentZone="+parentZone;
												}
												else if(Info!=null && Info.size()>1)
												{
													testToUtl="null-+";
													Measureurl="/final/monitor/EgSiteInfraView.jsp?qctr=1&fromalarm=&host="+EgURLEncoder.encode(compNameToUrl,"UTF-8")+"&layer="+EgURLEncoder.encode(layerName,"UTF-8")+"&site="+site+"&msmt_host="+EgURLEncoder.encode(msmtHost,"UTF-8")+"&test="+testToUtl+"&comptype="+EgURLEncoder.encode(compType,"UTF-8")+"&tstate="+compState+"&newWindow=false&prevPage=MainDashBoard&treeTitle="+treeTitle_New+"&componentNameSearch="+componentNameSearch+"&simulationName="+simulationName+"&fromp=ComparisonDashboard&isFromZone="+isFromZone+"&iszoneName="+iszoneName+"&parentZone="+parentZone;
												}
												else
												{
													testToUtl="null-+";
													Measureurl="/final/monitor/EgSiteInfraView.jsp?qctr=1&fromalarm=&host="+EgURLEncoder.encode(compNameToUrl,"UTF-8")+"&layer="+EgURLEncoder.encode(layerName,"UTF-8")+"&site="+site+"&msmt_host="+EgURLEncoder.encode(msmtHost,"UTF-8")+"&test="+testToUtl+"&comptype="+EgURLEncoder.encode(compType,"UTF-8")+"&tstate="+compState+"&newWindow=false&prevPage=MainDashBoard&treeTitle="+treeTitle_New+"&componentNameSearch="+componentNameSearch+"&simulationName="+simulationName+"&fromp=ComparisonDashboard&isFromZone="+isFromZone+"&iszoneName="+iszoneName+"&parentZone="+parentZone;
												}
											}
											columns.getJSONObject(i+1).put("textType", "asFloat");
											columns.getJSONObject(i+1).put("dataIndex",i+"MeasureValue");
											columns.getJSONObject(i+1).put("measureOrgName",smeasure);
											String sortty="ASC";
											if(sort_type!=null && sort_type.equalsIgnoreCase("DESC"))
											{
												sortty="ASC";
											}
											else if(sort_type!=null && sort_type.equalsIgnoreCase("ASC"))
											{
												sortty="DESC";
											}
											columns.getJSONObject(i+1).put("sortType",sortty);

											String tempVal = smeasure;
											String tempValLower = tempVal.toLowerCase();

											String meas_state = "GOOD";
											String meas_dur_state = "GOOD";
											if(clubMeasure != null && clubMeasure.containsKey(tempValLower))
											{
												String temp_duartion = tempVal.substring(0,tempVal.lastIndexOf("_"))+"_DURATION";
												String tempKeyMeasure = smeasure;
												tempKeyMeasure = tempKeyMeasure.substring(tempKeyMeasure.indexOf(":")+1);
												String tempDuarKeyMeasure = temp_duartion.substring(temp_duartion.indexOf(":")+1);
												
												if(stateMeasure != null && stateMeasure.size() > 0){
													Iterator iter = stateMeasure.entrySet().iterator();
													int test_inc = 0;
													while(iter.hasNext()){
														Map.Entry entry_state = (Map.Entry)iter.next();
														String el_State_key = (String)entry_state.getKey();
														String el_State_val = (String)entry_state.getValue();
														ArrayList al_state_keys = com.egurkha.util.StringUtils.egTokenizer(el_State_key, "^eg^",true,false,true);//3-->includeEmpty,4-->unique,5-->trim
														
														if(al_state_keys != null && al_state_keys.size() == 8){
															String s_site_name = (String)al_state_keys.get(0);
															String s_comp_type = (String)al_state_keys.get(1);
															String s_comp_name = (String)al_state_keys.get(2);
															String s_layer_name = (String)al_state_keys.get(3);
															String s_test_name = (String)al_state_keys.get(4);
															String s_msmt_name = (String)al_state_keys.get(5);
															String s_info_name = (String)al_state_keys.get(6);
															String s_meas_name = (String)al_state_keys.get(7);
															
															if(s_comp_type.equals(compType) && s_comp_name.equals(compName) && s_test_name.equals(stest) && s_msmt_name.equals(temp_ext_agnet) && s_info_name.equalsIgnoreCase("+"+infoName) && s_meas_name.equalsIgnoreCase(tempKeyMeasure) ){
																meas_state = el_State_val;
																test_inc++;
															}
															else if(s_comp_type.equals(compType) && s_comp_name.equals(compName) && s_test_name.equals(stest) && s_msmt_name.equals(temp_ext_agnet) && s_info_name.equalsIgnoreCase("+"+infoName) && s_meas_name.equalsIgnoreCase(tempDuarKeyMeasure) ){
																meas_dur_state = el_State_val;
																test_inc++;
															}

															if(test_inc > 1)
																break;
														}
													}
												}
												
												String temp_duartion_val="";
												String temp_duartion_val_alone="";

												if(temp_info != null)
													temp_duartion_val = (String)measureData.get(temp_dispComp +"^"+temp_duartion+":"+temp_info);
												else
													temp_duartion_val = (String)measureData.get(temp_dispComp +"^"+temp_duartion);
												
												temp_duartion_val=monUtil.formatDbValue(temp_duartion_val,2);
												temp_duartion_val_alone = temp_duartion_val;
												temp_duartion_val_alone = (temp_duartion_val_alone == null)?"0":temp_duartion_val_alone;
												//if(temp_duartion_val_alone.trim().equals("-"))
													//temp_duartion_val_alone="0";
												temp_duartion_val = (temp_duartion_val == null)?"-":temp_duartion_val;
												int measl2_val = 0;
												if(temp_duartion_val != null && temp_duartion_val.indexOf(".") != -1)
													temp_duartion_val ="<span class='decimal-align'>"+temp_duartion_val.substring(0,temp_duartion_val.indexOf("."))+"</span><span class='decimal-align2'>"+temp_duartion_val.substring(temp_duartion_val.indexOf("."))+"</span>";
												else
													temp_duartion_val ="<span class='decimal-align'>"+temp_duartion_val+"</span>";
												
												if(smeasure != null && smeasure.indexOf("LOGON_AVAILABILITY") != -1){
													//measureValue
													if(measureValue!= null && measureValue.trim().length() > 0 && !measureValue.equalsIgnoreCase("-") &&  !measureValue.startsWith("0.0")){
														measureValue = "<table style='table-layout:fixed;margin:auto;margin-top: 1px;width: 100%;'><tr><td width='50%' style='padding-top:0px'><div class='stateTick_"+meas_state+"' style='margin:auto;'></div></td><td width='50%' style='padding-top:0px'><div class='stateBox_"+meas_dur_state+"' style='float:none;margin:auto;'>"+temp_duartion_val+"</div></td></tr></table>";
													}
													else if(measureValue!= null && measureValue.trim().length() > 0 &&  measureValue.startsWith("0.0") && !temp_duartion_val_alone.trim().equals("-"))
													{
														measureValue = "<table style='table-layout:fixed;margin:auto;margin-top: 1px;width: 100%;'><tr><td width='50%' style='padding-top:0px'><div class='stateWrong_HIGH' style='margin:auto;'></div></td><td width='50%' style='padding-top:0px'><div class='stateBox_"+meas_state+"' style='float:none;margin:auto;'>&nbsp;</div></td></tr></table>";
													}												
													else if(!measureValue.equalsIgnoreCase("-") && temp_duartion_val_alone.trim().equals("-"))
													{
														isLogOnFail = true;
														measureValue = "<table style='table-layout:fixed;margin:auto;margin-top: 1px;width: 100%;'><tr><td width='50%' style='padding-top:0px'><div class='stateWrong_"+meas_state+"' style='margin:auto'></div></td><td width='50%' style='padding-top:0px'><div class='stateBox_GRAY' style='float:none;margin:auto;'>&nbsp;</div></td></tr></table>";
													}
													else
													{
														isLogOnFail = true;
														measureValue = "<table style='table-layout:fixed;margin:auto;margin-top: 1px;width: 100%;'><tr><td width='50%' style='padding-top:0px'><div class='hyphenGray' style='margin:auto'></div></td><td width='50%' style='padding-top:0px'><div class='stateBox_GRAY' style='float:none;margin:auto;'>&nbsp;</div></td></tr></table>";
													}
												}else if(smeasure.indexOf("APP_LAUNCH_AVAILABILITY") != -1){
													if(isLogOnFail || isEnumFail)
													{
														measureValue = "<table style='table-layout:fixed;margin:auto;margin-top: 1px;width: 100%;'><tr><td width='50%' style='padding-top:0px'><div class='hyphenGray' style='margin:auto;'></div></td><td width='50%' style='padding-top:0px'><div class='stateBox_GRAY' style='float:none;margin:auto;'>&nbsp;</div></td></tr></table>";
													}
													else if(measureValue!= null && measureValue.trim().length() > 0 &&  !measureValue.startsWith("0.0") && !measureValue.equalsIgnoreCase("-"))
													{
														measureValue = "<table style='table-layout:fixed;margin:auto;margin-top: 1px;width: 100%;'><tr><td width='50%' style='padding-top:0px'><div class='stateTick_"+meas_state+"' style='margin:auto;'></div></td><td width='50%' style='padding-top:0px'><div class='stateBox_"+meas_dur_state+"' style='float:none;margin:auto;'>"+temp_duartion_val+"</div></td></tr></table>";
													}
													else if(measureValue!= null && measureValue.trim().length() > 0 &&  measureValue.startsWith("0.0"))
													{
														measureValue = "<table style='table-layout:fixed;margin:auto;margin-top: 1px;width: 100%;'><tr><td width='50%' style='padding-top:0px'><div class='stateWrong_HIGH' style='margin:auto;'></div></td><td width='50%' style='padding-top:0px'><div class='stateBox_"+meas_state+"' style='float:none;margin:auto;'>&nbsp;</div></td></tr></table>";
													}
													else if(!measureValue.equalsIgnoreCase("-"))
													{
														measureValue = "<table style='table-layout:fixed;margin:auto;margin-top: 1px;width: 100%;'><tr><td width='50%' style='padding-top:0px'><div class='stateWrong_"+meas_state+"' style='margin:auto;'></div></td><td width='50%' style='padding-top:0px'><div class='stateBox_"+meas_state+"' style='float:none;margin:auto;'>&nbsp;</div></td></tr></table>";
													}
													else
													{
														measureValue = "<table style='table-layout:fixed;margin:auto;margin-top: 1px;width: 100%;'><tr><td width='50%' style='padding-top:0px'><div class='hyphenGray' style='margin:auto'></div></td><td width='50%' style='padding-top:0px'><div class='stateBox_GRAY' style='float:none;margin:auto;'>&nbsp;</div></td></tr></table>";
													}
												}
												if(!temp_duartion_val_alone.trim().equals("-"))
													measure.put(i+"MeasureValue_org",new Float(temp_duartion_val_alone));
											}
											else{
												String disp = null;
												String tempKeyMeasure = smeasure;
												String linkParam = null;
												tempKeyMeasure = tempKeyMeasure.substring(tempKeyMeasure.indexOf(":")+1);
												if(!isLogonType){
													tempKeyMeasure = temp_arr[1];
													if(s > 3)
														disp = temp_arr[3];
													if(s > 4)
														linkParam = temp_arr[4];
												}
												if(linkParam != null && linkParam.trim().length() > 0){
													if(linkParam.startsWith("dLink")){
														linkParam = linkParam.substring(linkParam.indexOf("~!~")+3);
													}
												}
												
												if(stateMeasure != null && stateMeasure.size() > 0){
													Iterator iter = stateMeasure.entrySet().iterator();
													while(iter.hasNext()){
														Map.Entry entry_state = (Map.Entry)iter.next();
														String el_State_key = (String)entry_state.getKey();
														String el_State_val = (String)entry_state.getValue();
														ArrayList al_state_keys = com.egurkha.util.StringUtils.egTokenizer(el_State_key, "^eg^",true,false,true);//3-->includeEmpty,4-->unique,5-->trim
														
														if(al_state_keys != null && al_state_keys.size() == 8){
															String s_site_name = (String)al_state_keys.get(0);
															String s_comp_type = (String)al_state_keys.get(1);
															String s_comp_name = (String)al_state_keys.get(2);
															String s_layer_name = (String)al_state_keys.get(3);
															String s_test_name = (String)al_state_keys.get(4);
															String s_msmt_name = (String)al_state_keys.get(5);
															String s_info_name = (String)al_state_keys.get(6);
															String s_meas_name = (String)al_state_keys.get(7);

															String tmp_info = infoName;
															tmp_info = (tmp_info != null && tmp_info.trim().length() > 0 && !tmp_info.startsWith("+"))?("+"+tmp_info):tmp_info;

															if(s_comp_type.equals(compType) && s_comp_name.equals(compName) && s_test_name.equals(stest) && s_msmt_name.equals(temp_ext_agnet) && s_info_name.equalsIgnoreCase(tmp_info) && s_meas_name.equalsIgnoreCase(tempKeyMeasure) ){
																meas_state = el_State_val;
																break;
															}
															
														}
													}
												}
												String measure_val1=null;
												String measure_val2=null;
												String tem_val_F="";
												String tem_val_S="";
												int measure_width = 0;
												int measure_width2 = 0;
												if(!isLogonType){
													if(measureValue!= null && measureValue.trim().length() > 0 && measureValue.equalsIgnoreCase("-")){
														//measureValue = "<table style='table-layout:fixed;margin:auto'><tr><td width='50%' style='padding-top:0px'><div class='hyphenGray' style='margin:auto'></div></td></tr></table>";
														measureValue = "<table style='table-layout:fixed;margin:auto'><tr><td style='padding-top:0px'><div class='hyphenGray' style='margin:auto'></div></td></tr></table>";
													}
													else{
														measureValue = monUtil.formatDbValue(measureValue,4);
														String temp_duartion_val = measureValue;
														if(measureValue != null && measureValue.indexOf(".") != -1){
															String dval = measureValue.substring(measureValue.indexOf(".")+1);
															dval = dval.trim();
															String temp_dval = "0";
															if(dval != null && dval.length() > 1){
																for(int k=1;k<dval.length();k++)
																	temp_dval += "0";
															}
															/*if(dval.equals(temp_dval))
																temp_duartion_val ="<span class='decimal-align'>"+measureValue.substring(0,measureValue.indexOf("."))+"</span><span class='decimal-align2'></span>";
															else
																temp_duartion_val ="<span class='decimal-align'>"+measureValue.substring(0,measureValue.indexOf("."))+"</span><span class='decimal-align2'>"+"."+dval+"</span>";*/
															
															if(dval.equals(temp_dval))
															{
																measure_val1 = measureValue.substring(0,measureValue.indexOf("."));
																measure_width = measure_val1.length() * 7;
																
																//temp_duartion_val ="<span class='decimal-align' width= '"+measure_width+"px'>"+measure_val1+"</span><span class='decimal-align2' width='30px'></span>";

																if(max_measure_width>measure_width)
																	measure_width = max_measure_width;
																else
																	max_measure_width = measure_width;
																	temp_duartion_val ="<span class='f11-normal' width= '"+measure_width+"px'>"+measure_val1+"</span><span width='30px'></span>";

																	//tem_val_F ="<span class='f11-normal' width= '"+measure_width+"px'>"+measure_val1+"</span>";
																	//tem_val_S ="<span class='f11-normal' width='"+measure_width2+"px'></span>";
															}
															else
															{
																if(measureValue.indexOf(".")>-1)
																{
																	measure_val1 = measureValue.substring(0,measureValue.indexOf("."));
																	measure_width = measure_val1.length() * 7;

																	measure_val2 = measureValue.substring(measureValue.indexOf(".")+1);
																	measure_width2 =(measure_val2.length() * 7);
																}
																else
																{
																	measure_width = measureValue.length() * 7;
																}
																
																if(max_measure_width>measure_width)
																	measure_width = max_measure_width;
																else if (max_measure_width<measure_width)
																	max_measure_width = measure_width;

														
																if(max_measure_width2>measure_width2)
																	measure_width2 = max_measure_width2;
																else if (max_measure_width2<measure_width2)
																	max_measure_width2 = measure_width2;
																//temp_duartion_val ="<span class='decimal-align' width= '"+measure_width+"px'>"+measure_val1+"</span><span class='decimal-align2'  width='30px'>"+"."+dval+"</span>";
																temp_duartion_val ="<span class='f11-normal' width= '"+measure_width+"px'>"+measure_val1+"</span><span class='f11-normal' width='"+measure_width2+"px'>"+"."+dval+"</span>";
																//tem_val_F ="<span class='f11-normal' width= '"+measure_width+"px'>"+measure_val1+"</span>";

																//tem_val_S ="<span class='f11-normal' width='"+measure_width2+"px'>"+"."+dval+"</span>";
															}
														}
														else
														{
															measure_width = measureValue.length() * 7;
															//temp_duartion_val ="<span class='decimal-align'>"+measureValue+"</span>";
															temp_duartion_val ="<span class='f11-normal'>"+measureValue+"</span>";
															//tem_val_F ="<span class='f11-normal' width= '"+measure_width+"px'>"+measureValue+"</span>";
															//tem_val_S ="<span class='f11-normal' width='30px'></span>";
														}
														if(disp != null && disp.trim().length() > 0 && disp.equalsIgnoreCase("Symbol")){
															if(measureValue!= null && measureValue.trim().length() > 0 && !measureValue.startsWith("0"))
																measureValue = " <div class='stateTick_"+meas_state+"' style='margin:auto;'></div>";
															else if(measureValue!= null && measureValue.trim().length() > 0 && measureValue.startsWith("0") && meas_state.equalsIgnoreCase("GOOD"))
																measureValue = " <div class='stateWrong_HIGH' style='margin:auto;'></div>";
															else
																measureValue = " <div class='stateWrong_"+meas_state+"' style='margin:auto;'></div>";
														}
														else if(disp != null && disp.trim().length() > 0 && disp.equalsIgnoreCase("bar"))
														{
															//int table_width = 40+measure_width;
															if(measureValue!= null && measureValue.trim().length() > 0 && !measureValue.equalsIgnoreCase("-"))
															{
																//measureValue = "<table width='"+table_width+"px' style='table-layout:fixed;margin:auto'><tr><td width='"+td_width+"px' style='padding-top:2px'><div class='stateBox_"+meas_state+"' style='margin-top: -3px; margin-left:"+data_margin_left+"'>"+temp_duartion_val+"</div></td></tr></table>";
																measureValue = "<div class='stateBox_"+meas_state+"' style='float:none;margin:auto;'><table width='95%' style='table-layout:fixed;margin:auto;line-height:14px'><tr><td style='text-align:right;'>"+temp_duartion_val+"</td></tr></table></div>";
															}
															/*try{
																int columnWidth = 100;
																Long temp_measure_value=new Long(Math.round(Double.parseDouble(measureValue)));
																long fillColorValue=temp_measure_value.longValue();
																long value1 = (fillColorValue*100)/columnWidth;
																measure.put(i+"MeasureValueWidth",value1);
															}catch(Exception ee){}*/
														}
														else{
															//int table_width = 40+measure_width;
															//int td_width = 30+measure_width;
															if(measureValue!= null && measureValue.trim().length() > 0 && !measureValue.equalsIgnoreCase("-") && meas_state != null && (  meas_state.equalsIgnoreCase("Good") || meas_state.equalsIgnoreCase("Normal"))){
																measureValue = "<table width='100px'style='table-layout:fixed;margin:auto'><tr><td width='20px' style='padding-top:0px'><div class='stateTick_"+meas_state+"' style='margin:auto;'></div></td><td style='padding-top:2px'><div>"+temp_duartion_val+"</div></td></tr></table>";
															}else{
																measureValue = "<table width='100px' style='table-layout:fixed;margin:auto'><tr><td width='20px' style='padding-top:0px'><div class='stateWrong_"+meas_state+"' style='margin:auto;'></div></td><td style='padding-top:2px'><div>"+temp_duartion_val+"</div></td></tr></table>";
															}
														}
														if(linkParam != null && linkParam.trim().length() > 0){
															String tmp_info = infoName;
															tmp_info = (tmp_info != null && tmp_info.trim().length() > 1 && !tmp_info.startsWith("+"))?("+"+tmp_info):tmp_info;
															String keyMeasure = temp_arr[1]+"~"+sdispName;
															String link = "/final/monitor/EgMeasureTopology.jsp?host="+el_comp_name+"&port="+el_port_name+"&testName="+stest+"&measures="+EgURLEncoder.encode(linkParam,"UTF-8")+"&info="+EgURLEncoder.encode(tmp_info,"UTF-8")+"&keyMeasure="+EgURLEncoder.encode(keyMeasure,"UTF-8");
															String imgValue = "<div style=\"position:relative;height:15px;width:16px\"><img src=\"/final/images/spacer.gif\" class=\"iconDiagnosis\"  onClick=\'javascript:loadPopup(\""+link+"\");\' style=\"cursor:pointer\" data-qtip=\"Topology\" data-qclass=\"yellowTip\"/></div>";
															measure.put(i+"MeasureValueImglink",imgValue);
														}
													}
												}
												else{
													enum_state = meas_state;
													if(isLogOnFail){
														measureValue = "<table width='100%' style='table-layout:fixed'><tr><td width='50%' style='padding-top:0px'><div class='hyphenGray' style='margin:auto'></div></td></tr></table>";
													}
													else if(measureValue!= null && measureValue.trim().length() > 0 && !measureValue.equalsIgnoreCase("-") &&  !measureValue.startsWith("0.0")){
														measureValue = " <div class='stateTick_"+meas_state+"' style='margin:auto;'></div>";
													}
													else if(measureValue!= null && measureValue.trim().length() > 0 && !measureValue.equalsIgnoreCase("-") &&  measureValue.startsWith("0.0")){
														measureValue = " <div class='stateWrong_HIGH' style='margin:auto;'></div>";
													}
													else{
														isEnumFail = true;
														measureValue = " <div class='stateWrong_"+meas_state+"' style='margin:auto;'></div>";
													}
												}
												measure.put(i+"MeasureValue_org",org_measureValue.trim());
											}

											measure.put(i+"MeasureValue",measureValue);
											
											if(measureValue!=null && !measureValue.equals("-"))
											{
												if(isLogonType && unitMeasure.equals("%"))
												{
													try{
														int columnWidth = 100;
														Long temp_measure_value=new Long(Math.round(Double.parseDouble(measureValue)));
														long fillColorValue=temp_measure_value.longValue();
														long value1 = (fillColorValue*100)/columnWidth;
														measure.put(i+"MeasureValueWidth",value1);
													}catch(Exception ee){

													}
												}

												measure.put(i+"MeasureValueUrl",url);
											}
											colCount++;
										}
									}
									measures.add(measure);
								}
								else
								{
									continue;
								}
							}
						}
					}					
				}
			}
			
			
			int tempCompListSize = tempCompList.size();
			if(isNonRunningCompListView && tempCompListSize>0)
			{
				if(measures.size()==0)
				{
					for(int i=0;i<keyList.size();i++)
					{
						String tempKey = (String)keyList.get(i);
						String temp_arr[]=StringUtils.getTokens(tempKey,":");
						int s=temp_arr.length;
						String tempSmeasure ="";
						if(s >= 5)
						{						
							smeasure = temp_arr[1];
							columns.getJSONObject(i+1).put("textType", "asFloat");
							columns.getJSONObject(i+1).put("dataIndex",i+"MeasureValue");
							columns.getJSONObject(i+1).put("measureOrgName",tempSmeasure);
							columns.getJSONObject(i+1).put("sortType","ASC");							
						}
						else if(s==2)
						{
							String ds_type  = temp_arr[0];
							tempSmeasure = temp_arr[1];
							if(ds_type != null && ds_type.equalsIgnoreCase("dd_link"))
							{
								columns.getJSONObject(i+1).put("textType", "asFloat");
								columns.getJSONObject(i+1).put("dataIndex",i+"MeasureValue");
								columns.getJSONObject(i+1).put("measureOrgName",tempSmeasure);
								columns.getJSONObject(i+1).put("sortType","ASC");
							}
							else if(ds_type.equalsIgnoreCase("externalAgent")){
								columns.getJSONObject(i+1).put("textType", "asFloat");
								columns.getJSONObject(i+1).put("dataIndex",i+"MeasureValue");
								columns.getJSONObject(i+1).put("measureOrgName",tempSmeasure);
								columns.getJSONObject(i+1).put("sortType","ASC");							
							}
							else
							{
								columns.getJSONObject(i+1).put("textType", "asFloat");
								columns.getJSONObject(i+1).put("dataIndex",i+"MeasureValue");
								columns.getJSONObject(i+1).put("measureOrgName",tempSmeasure);
								columns.getJSONObject(i+1).put("sortType","ASC");								
							}
						}
						else{													
							tempSmeasure = temp_arr[1];							
							columns.getJSONObject(i+1).put("textType", "asFloat");
							columns.getJSONObject(i+1).put("dataIndex",i+"MeasureValue");
							columns.getJSONObject(i+1).put("measureOrgName",tempSmeasure);
							String sortty="ASC";
							if(sort_type!=null && sort_type.equalsIgnoreCase("DESC"))
							{
								sortty="ASC";
							}
							else if(sort_type!=null && sort_type.equalsIgnoreCase("ASC"))
							{
								sortty="DESC";
							}
							columns.getJSONObject(i+1).put("sortType",sortty);
							
						}
					}
				}

				for(int j=0;j<tempCompListSize;j++)
				{
					String compDetails = (String)tempCompList.get(j);
					
					StringTokenizer st_server = new StringTokenizer(compDetails,":");
					String type = "";
					String comp = "";
					String port = "";
					String cNWithPort = "";
					String tempUrl = "";
					
					int cntTokens = st_server.countTokens();
					if(st_server.hasMoreTokens())
					{
						type = st_server.nextToken();
						comp = st_server.nextToken();
						port = st_server.nextToken();

						cNWithPort = comp+":"+port;
					}
					
					tempUrl = "/final/servlet/com.eg.EgDashboardController?site=NULL&comptype="+type+"&host="+cNWithPort+"&tab=LayerModel&from=list";

					String msmt_host = "";
					JSONObject measure = new JSONObject();					
					for(int i=0;i<keyList.size();i++)
					{
						String tempKey = (String)keyList.get(i);
						String temp_arr[]=StringUtils.getTokens(tempKey,":");
						int s=temp_arr.length;
						if(s==2)
						{
							String d_type = temp_arr[0];
							if(d_type.equalsIgnoreCase("externalAgent"))
							{							
								List agents=egExternalInfo.getAgentsFor(l_test,type,comp);					
								if(agents==null || agents.size()==0)
								{
									msmt_host = comp;
								}
								else
								{
									msmt_host = (String)agents.get(0);		
								}								

								measure.put(i+"MeasureValue",msmt_host);
							}
							else
								measure.put(i+"MeasureValue","-");
						}
						else											
							measure.put(i+"MeasureValue","-");

						measure.put(i+"MeasureValueUrl",tempUrl);
					}
					measure.put("systemIconClass","");
					measure.put("systemIconTitle","");
					measure.put("layerModelUrl",tempUrl);
					measure.put("systemTitle",comp);
					measure.put("system",comp);					
					

					List agents=egExternalInfo.getAgentsFor(l_test,type,comp);					
					if(agents==null || agents.size()==0)
					{
						msmt_host = comp;
					}
					else
					{
						msmt_host = (String)agents.get(0);		
					}	

					if(externalAgent!=null && externalAgent.trim().length()>0 && !externalAgent.equalsIgnoreCase("ALL") && !externalAgent.equalsIgnoreCase(msmt_host))
						continue;

					if(componentNameSearch!=null && componentNameSearch.length()>0 && comp.indexOf(componentNameSearch)== -1)
						continue;
		
					measures.add(measure);
				}
			}
			
			JSONObject labelObj= new JSONObject();
			labelObj.put("monitor.serviceDashboard.noDataMsg",mappingInfo.getTextDescription("monitor.serviceDashboard.No Data found"));
			labelObj.put("monitor.serviceDashboard.systemTitle",mappingInfo.getTextDescription("monitor.serviceDashboard.Key Performance Indicators for services")+" : "+selectedNode);
			json.put("columns",columns);
			if(measures == null || measures.size() == 0)
				json.put("error",errorMsg);

			json.put("screenLabels",labelObj);

			if(monitorsBy != null && isCitraType)
			{
				pagesizec=recount/pageSize;
				int tem1 = recount;
				int mod1 = tem1%pageSize;
				if(mod1 > 0)
					pagesizec=pagesizec+1;
				countJson.put("recount",recount);
				countJson.put("pagesizec",pageSize);
				countJson.put("totalPages",pagesizec);
				countJson.put("pageNum",pageNum);
				if(pagesizec<=1)
					countJson.put("isHidePaging",new Boolean(true));
				else
					countJson.put("isHidePaging",new Boolean(false));

				json.put("countJson",countJson);
			}
			else
				json.put("countJson",countJson);
			
			json.put("measures",measures);

			sortByMainOptions.put("sortByOptions",sortByOptions);
			json.put("filterByOptions", filterByOptions);
			json.put("isCitraType", isCitraType);
			json.put("subFilterOptions", subFilterOptions);
			json.put("pageParams", pageParams);
			json.put("sortByMainOptions",sortByMainOptions);
			json.put("monitorTypeOptions",monitorTypeOptions);
			json.put("locationsTypeOPtions",locationsTypeOPtions);
			json.put("externalAgentObj",externalAgentObj);
			json.put("externalTestObj",externalTestObj);
			if(tmp_sortBy != null && (tmp_sortBy.equalsIgnoreCase("SCRIPTS") || tmp_sortBy.equalsIgnoreCase("SUCCESSFUL TRANSACTIONS") || tmp_sortBy.indexOf("TOTAL_ACTIVITY_TIME") > -1))
				json.put("sortinJs",tmp_sortBy);
			session.setAttribute("ctxlinksMap",linksMap);
			if((servicename == null || servicename.trim().length() == 0) && (fromServiceDashboard == null || fromServiceDashboard.equalsIgnoreCase("false")))
				session.setAttribute("monitorLastSession",sessionUrl);
			response.getWriter().write(json.toString());
		}
		else
		{
			JSONObject labelObj= new JSONObject();
			labelObj.put("monitor.serviceDashboard.systemTitle",mappingInfo.getTextDescription("monitor.serviceDashboard.Key Performance Indicators for services")+" : "+selectedNode);
			sortByMainOptions.put("sortByOptions",sortByOptions);
			json.put("filterByOptions", filterByOptions);
			json.put("subFilterOptions", subFilterOptions);
			json.put("pageParams", pageParams);
			json.put("screenLabels",labelObj);
			json.put("error",errorMsg);
			//response.getWriter().write(countJson.toString());
			json.put("monitorTypeOptions",monitorTypeOptions);
			json.put("locationsTypeOPtions",locationsTypeOPtions);
			json.put("externalAgentObj",externalAgentObj);
			json.put("externalTestObj",externalTestObj);
			if((servicename == null || servicename.trim().length() == 0) && (fromServiceDashboard == null || fromServiceDashboard.equalsIgnoreCase("false")))
				session.setAttribute("monitorLastSession","/final/monitor/comparisonDashboard.jsp?treeTitle=logonSimualtion&isFromMenu="+isFromMenu1+"&externalAgent="+externalAgent);
			response.getWriter().write(json.toString());
		}
	}
%>

<%!
	String s_iniFile_dir = EgInstallInfo.getInstallDir()+ "/manager/config/";	
	com.eg.IniFile egDashConfig = new com.eg.IniFile(s_iniFile_dir+"eg_dashboardConfig.ini");
	EgDateInfo dateInfo=new EgDateInfo();
	SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");

	public Hashtable getDDMeasureValueNew(String test_name,String meas_name,EgList componentList,String dd_measure,boolean flag)
	{
		String oracle_msmt_time_query = "";
		String sql_msmt_time_query = "";
		String test_cut_off = egDashConfig.getValue("ListComponentView_cut_off",test_name);
		Hashtable htsm = new Hashtable();
		htsm.put("sourceDateFormat","MM/dd/yyyy HH:mm:ss");
		if(test_cut_off != null && test_cut_off.trim().length() > 0)
		{
			try
			{
				int cut_off_val = Integer.parseInt(test_cut_off);
				java.util.Date tmpday = dateInfo.egetRealDate();
				String mgrTime = dateFormat.format(tmpday);

				java.util.Date endDateTime = dateFormat.parse(mgrTime);
				endDateTime.setTime(endDateTime.getTime() - (cut_off_val * 60 * 1000));
				String test_msmt_time = dateFormat.format(endDateTime);

				htsm.put("startDate",test_msmt_time);

				oracle_msmt_time_query = " msmt_time >= TO_DATE('"+test_msmt_time+"','mm/dd/yyyy hh24:mi:ss') ";
				sql_msmt_time_query = " msmt_time >= convert(datetime, '"+test_msmt_time+"', 101) ";

			}
			catch(Exception  e)
			{
				System.err.println("invalid date Format");
			}
		}
		else
		{
			String cut_off = egDashConfig.getValue("ListComponentView_cut_off","cut_off");
			cut_off = (cut_off == null || cut_off.trim().length() ==0 )?"10":cut_off;	
			try
			{
				int cut_off_val = Integer.parseInt(cut_off);
				java.util.Date tmpday = dateInfo.egetRealDate();
				String mgrTime = dateFormat.format(tmpday);

				java.util.Date endDateTime = dateFormat.parse(mgrTime);
				endDateTime.setTime(endDateTime.getTime() - (cut_off_val * 60 * 1000));
				String msmt_time = dateFormat.format(endDateTime);
				
				htsm.put("startDate",msmt_time);

				oracle_msmt_time_query = " msmt_time >= TO_DATE('"+msmt_time+"','mm/dd/yyyy hh24:mi:ss') ";			
				sql_msmt_time_query = " msmt_time >= convert(datetime, '"+msmt_time+"', 101) ";
			}
			catch(Exception  e)
			{
				System.err.println("invalid date Format");
			}
		}

		Hashtable returnhash = new Hashtable();
		ResultSet rs = null;
		EgDbAdapterUI egDb = EgDbAdapterTypeUI.getObject();
		String query="";
		try
		{

			ArrayList compNameList = new ArrayList();
			ArrayList compNamePort = new ArrayList();
			ArrayList compNameWithPort = new ArrayList();

			for(int l=0;l<componentList.size();l++)
			{
				EgComponent component = null;
				try
				{
					component = (EgComponent)componentList.get(l);
				}
				catch(Exception ex)
				{
					
				}

				String compName = component.getName();
				
				if(!compNameWithPort.contains(compName))
					compNameWithPort.add(compName);

				String compNameAlone = compName;
				if(compNameAlone.indexOf(":") != -1)
					compNameAlone = compNameAlone.substring(0,compNameAlone.indexOf(":"));
				String port_no_alone = 	compName.substring(compName.indexOf(":")+1);

				if(!compNameList.contains(compNameList))
					compNameList.add(compNameAlone);
				if(!compNamePort.contains(port_no_alone))
					compNamePort.add(port_no_alone);
			}
			query ="select A.TRGT_HOST,A.port_no,A.INFO,A.MSMT_HOST,A.msmt_time,A."+dd_measure+" from "+test_name+"_DDD A , (select TRGT_HOST,port_no,INFO,MSMT_HOST,max(msmt_time) as msmt_time from ddMeasure_last where " ;
			boolean isCompConditionAdded = false;
			boolean isPortConditionAdded = false;
			if(compNameList != null && compNameList.size() == 1)
			{	
				query += " TRGT_HOST='"+compNameList.get(0)+"' ";	
				isCompConditionAdded = true;
			}
			
			if(compNamePort != null && compNamePort.size() == 1)
			{	
				if(isCompConditionAdded)			
					query += " and PORT_NO='"+compNamePort.get(0)+"' ";
				else
					query += " PORT_NO='"+compNamePort.get(0)+"' ";

				isPortConditionAdded = true;
			}
			
			if(EgInstallInfo.isSuperManager)
			{
				String oraQuery=query;
				String sqlQuery=query;
				if(isCompConditionAdded || isPortConditionAdded)
				{
					oraQuery+=" and  ";
					sqlQuery+=" and  ";
				}
				if(oracle_msmt_time_query.trim().length()>0)
				{
					oraQuery+=" MEASURE='"+meas_name+"' and test_name='"+test_name+"' and "+oracle_msmt_time_query+" group by TRGT_HOST,port_no,INFO,MSMT_HOST)B   where  A.MSMT_HOST=B.MSMT_HOST and A.TRGT_HOST=B.TRGT_HOST and A.port_no=B.port_no and A.msmt_time=B.msmt_time  and A.INFO=B.INFO and A.seq_no=0 ";

					sqlQuery+=" MEASURE='"+meas_name+"' and test_name='"+test_name+"' and "+sql_msmt_time_query+" group by TRGT_HOST,port_no,INFO,MSMT_HOST)B   where  A.MSMT_HOST=B.MSMT_HOST and A.TRGT_HOST=B.TRGT_HOST and A.port_no=B.port_no and A.msmt_time=B.msmt_time  and A.INFO=B.INFO and A.seq_no=0 ";					
				}
				else
				{
					oraQuery+=" MEASURE='"+meas_name+"' and test_name='"+test_name+"' group by TRGT_HOST,port_no,INFO,MSMT_HOST)B   where  A.MSMT_HOST=B.MSMT_HOST and A.TRGT_HOST=B.TRGT_HOST and A.port_no=B.port_no and A.msmt_time=B.msmt_time  and A.INFO=B.INFO and A.seq_no=0 ";

					sqlQuery+=" MEASURE='"+meas_name+"' and test_name='"+test_name+"' group by TRGT_HOST,port_no,INFO,MSMT_HOST)B   where  A.MSMT_HOST=B.MSMT_HOST and A.TRGT_HOST=B.TRGT_HOST and A.port_no=B.port_no and A.msmt_time=B.msmt_time  and A.INFO=B.INFO and A.seq_no=0 ";
				}
				htsm.put("OracleQuery",oraQuery);
				htsm.put("SqlQuery",sqlQuery);

			}
			else if(EgDbInfo.isOraAdapter)
			{
				if(isCompConditionAdded || isPortConditionAdded)
					query+=" and  ";

				if(oracle_msmt_time_query.trim().length()>0)
				{
					query+=" MEASURE='"+meas_name+"' and test_name='"+test_name+"' and "+oracle_msmt_time_query+" group by TRGT_HOST,port_no,INFO,MSMT_HOST)B   where  A.MSMT_HOST=B.MSMT_HOST and A.TRGT_HOST=B.TRGT_HOST and A.port_no=B.port_no and A.msmt_time=B.msmt_time  and A.INFO=B.INFO and A.seq_no=0 ";
				}
				else
				{
					query+=" MEASURE='"+meas_name+"' and test_name='"+test_name+"' group by TRGT_HOST,port_no,INFO,MSMT_HOST)B   where  A.MSMT_HOST=B.MSMT_HOST and A.TRGT_HOST=B.TRGT_HOST and A.port_no=B.port_no and A.msmt_time=B.msmt_time  and A.INFO=B.INFO and A.seq_no=0 ";
				}
			}	
			else
			{
				if(isCompConditionAdded || isPortConditionAdded)
					query+=" and  ";

				if(sql_msmt_time_query.trim().length()>0)
				{
					query+=" MEASURE='"+meas_name+"' and test_name='"+test_name+"' and "+sql_msmt_time_query+" group by TRGT_HOST,port_no,INFO,MSMT_HOST)B   where  A.MSMT_HOST=B.MSMT_HOST and A.TRGT_HOST=B.TRGT_HOST and A.port_no=B.port_no and A.msmt_time=B.msmt_time  and A.INFO=B.INFO and A.seq_no=0 ";
				}
				else
				{
					query+=" MEASURE='"+meas_name+"' and test_name='"+test_name+"' group by TRGT_HOST,port_no,INFO,MSMT_HOST)B   where  A.MSMT_HOST=B.MSMT_HOST and A.TRGT_HOST=B.TRGT_HOST and A.port_no=B.port_no and A.msmt_time=B.msmt_time  and A.INFO=B.INFO and A.seq_no=0 ";
				}
			}
			String s_status = egDb.setConnection();
			if(s_status.equals("CONNECTED"))
			{
				if(EgInstallInfo.isSuperManager)
				{
					rs = new EgSMDBHelper().getResultSet(htsm);
				}
				else
				{
					rs = egDb.dbselect(query);
				}
			}
			
			if(rs == null)
				return returnhash;

			while(rs.next())
			{
				String trgt_host_rs = rs.getString(1);			
				String port_no_rs = rs.getString(2);

				if(!compNameWithPort.contains(trgt_host_rs+":"+port_no_rs))
					continue;

				String s_info_rs = rs.getString(3);
				String msmt_host_rs = rs.getString(4);
				String msmt_time_rs = rs.getString(5);
				String res = rs.getString(6);

				if(flag){
					ArrayList al_cols = com.egurkha.util.StringUtils.egTokenizer(res, "#~#",true,false,true);//3-->includeEmpty,4-->unique,5-->trim
					if(al_cols != null && al_cols.size() > 0){
						for(int l=0;l<al_cols.size();l++){
							String el =(String)al_cols.get(l);
							if(el != null && el.indexOf(":") != -1){
								String elKey  = el.substring(0,el.indexOf(":"));
								String elVal  = el.substring(el.indexOf(":")+1);
								if(elVal != null && elVal.indexOf("none") != -1)
									elVal  = elVal.substring(elVal.indexOf("\\")+1);
								
								returnhash.put(msmt_host_rs+":"+trgt_host_rs+":"+port_no_rs+":"+test_name+":"+meas_name+":"+dd_measure+":"+s_info_rs+":"+elKey,elVal);		
							}
						}
					}
				}else{
					returnhash.put(msmt_host_rs+":"+trgt_host_rs+":"+port_no_rs+":"+test_name+":"+meas_name+":"+dd_measure,res);
				}
			}
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
		finally
		{
			egDb.releaseConnection(false);
			EgDbAdapterTypeUI.releaseObject(egDb);
		}
		return returnhash;
	}

public Hashtable getDDMeasureValue(String test_name,String meas_name,String trgt_host,String port_no,String msmt_host,String dd_measure,String s_info,boolean flag){
	Hashtable returnhash = new Hashtable();
	ResultSet rs = null;
	EgDbAdapterUI egDb = EgDbAdapterTypeUI.getObject();
	String query="";
	try
	{
		//query="select Published_resources from CtxXcXALogonSimTest_DDD where TRGT_HOST='xa7_logon' and PORT_NO='NULL' and  MEASURE='Logon_availability' and msmt_time = (select max(msmt_time) from ddMeasure_last where TRGT_HOST='xa7_logon' and PORT_NO='NULL' and MSMT_HOST='Ext240' and  MEASURE='Logon_availability' and test_name='CtxXcXALogonSimTest' )";
		query="select "+dd_measure+" from "+test_name+"_DDD where TRGT_HOST='"+trgt_host+"' and PORT_NO='"+port_no+"' and  MEASURE='"+meas_name+"' and INFO='"+s_info+"' and msmt_time = (select max(msmt_time) from ddMeasure_last where TRGT_HOST='"+trgt_host+"' and PORT_NO='"+port_no+"' ";
		if(msmt_host != null && msmt_host.trim().length() > 0)
			query+="and MSMT_HOST='"+msmt_host+"' ";
		//if(s_info != null && s_info.trim().length() > 0)
		//	query+="and INFO='"+s_info+"' ";
		query+=" and  MEASURE='"+meas_name+"' and test_name='"+test_name+"' and INFO='"+s_info+"' )";


		String s_status = egDb.setConnection();
		if(s_status.equals("CONNECTED")){
			if(EgInstallInfo.isSuperManager)
			{
				Hashtable ht = new Hashtable();
				ht.put("OracleQuery",query);
				ht.put("SqlQuery",query);
				ArrayList managerIds = EgElementInfo.getInstance().getManagerIDs("component",trgt_host);
				if(managerIds != null && !managerIds.isEmpty())
				{
					ht.put("special_case_mgr_ids",managerIds);
				}
				rs = new EgSMDBHelper().getResultSet(ht);
			}
			else
			{
				rs = egDb.dbselect(query);
			}
		}
		if(rs.next())
		{
			String res = rs.getString(1);
			if(flag){
				ArrayList al_cols = com.egurkha.util.StringUtils.egTokenizer(res, "#~#",true,false,true);//3-->includeEmpty,4-->unique,5-->trim
				if(al_cols != null && al_cols.size() > 0){
					for(int l=0;l<al_cols.size();l++){
						String el =(String)al_cols.get(l);
						if(el != null && el.indexOf(":") != -1){
							String elKey  = el.substring(0,el.indexOf(":"));
							String elVal  = el.substring(el.indexOf(":")+1);
							returnhash.put(test_name+":"+meas_name+":"+dd_measure+":"+s_info+":"+elKey,elVal);		
						}
					}
				}
			}else{
				returnhash.put(test_name+":"+meas_name+":"+dd_measure,res);
			}
		}
	}
	catch(Exception e)
	{
		e.printStackTrace();
	}
	finally
	{
		egDb.releaseConnection(false);
		EgDbAdapterTypeUI.releaseObject(egDb);
	}
	return returnhash;
} 
public String getMonitorBy(String test_name,com.eg.IniFile egDashConfig)
{
	String monitor_by = "";
	String dash_ar[]= egDashConfig.getVariables("ExtTestDashboard");
	if(dash_ar!=null && dash_ar.length>0)
	{
		for(int monT=0;monT<dash_ar.length;monT++)
		{
			String s_support_type = dash_ar[monT];
			String s_support_type_test =egDashConfig.getValue("ExtTestDashboard",s_support_type);
			if(s_support_type_test.equalsIgnoreCase(test_name))
			{
				monitor_by = s_support_type;
				break;
			}
		}
	}
	return monitor_by;
}
public ArrayList reorderSortedMeasure(ArrayList sortedMeasures)
{
	ArrayList newOrderList = new ArrayList();
	try
	{
		ArrayList temp_sortedMeasure = (ArrayList) sortedMeasures.clone();
		if(temp_sortedMeasure != null && temp_sortedMeasure.size() > 0){
			ArrayList comp_name_list = new ArrayList();
			Hashtable comp_list_hash = new Hashtable();
			for(int u=0;u<temp_sortedMeasure.size();u++){
				ArrayList elements = (ArrayList)temp_sortedMeasure.get(u);
				ArrayList newElemetList = new ArrayList();
				
				for(int l=0;l<elements.size();l++){
					ArrayList innerEl = (ArrayList)elements.get(l);
					if(innerEl != null && innerEl.size() > 0){
						String info_elment = (String)innerEl.get(0);
						String sorted_key_elemet = (String)innerEl.get(1);
						
						ArrayList sorted_key_elemet_list = com.egurkha.util.StringUtils.egTokenizer(sorted_key_elemet, ":",true,false,true);//3-->includeEmpty,4-->unique,5-->trim

						if(sorted_key_elemet_list != null && sorted_key_elemet_list.size() == 7){
							String el_comp_name = (String)sorted_key_elemet_list.get(0);
							String el_port_name = (String)sorted_key_elemet_list.get(1);
							String el_comp_type_name = (String)sorted_key_elemet_list.get(2);
							String el_layer_name = (String)sorted_key_elemet_list.get(3);
							String el_info_name = (String)sorted_key_elemet_list.get(4);
							String el_test_name = (String)sorted_key_elemet_list.get(5);
							String el_msmt_host_name = (String)sorted_key_elemet_list.get(6);

							String comp_port = el_comp_name+":"+el_port_name+":"+el_msmt_host_name;
							if(!comp_name_list.contains(comp_port))
								comp_name_list.add(comp_port);
							
							if(comp_list_hash.containsKey(comp_port))
							{
								Hashtable gr_el = (Hashtable)comp_list_hash.get(comp_port);
								gr_el.put(info_elment,sorted_key_elemet);						
							}
							else
							{
								Hashtable gr_el = new Hashtable();
								gr_el.put(info_elment,sorted_key_elemet);
								comp_list_hash.put(comp_port,gr_el);
							}
						}

					}
				}
			}

			try
			{
				com.eg.IniFile egINI = new com.eg.IniFile(EgInstallInfo.getInstallDir()+ "/manager/config/eg_dashboardConfig.ini");
				EgDbAdapterUI egDb = EgDbAdapterTypeUI.getObject();
				String status = egDb.setConnection();
				for(int u=0;u<comp_name_list.size();u++){
					String elements = (String)comp_name_list.get(u);
					String _com_name = elements.substring(0,elements.indexOf(":"));
					String _com_port = elements.substring(elements.indexOf(":")+1,elements.lastIndexOf(":"));
					
					List infoOrderList = (ArrayList)egDb.getSimulationInfoOrder("NULL",_com_name,_com_port,"CitraTest_DDD",null);
					if(infoOrderList == null || infoOrderList.size() == 0)
						infoOrderList = com.egurkha.util.StringUtils.egTokenizer(egINI.getValue("TRANSACTION_ORDER",_com_name), ",", false,true,true);

					if(!infoOrderList.contains("+Total") && !infoOrderList.contains("Total")){
						infoOrderList.add("Total");
					}
					else
					{
						infoOrderList.remove("+Total");
						infoOrderList.add("+Total");
					}
					
					Hashtable gr_el = (Hashtable)comp_list_hash.get(elements);
					for(int l=0;l<infoOrderList.size();l++){
						String info = (String)infoOrderList.get(l);
						if(!info.startsWith("+"))
							info = "+"+info;

						if(gr_el.containsKey(info))
						{
							ArrayList re_list = new ArrayList();
							re_list.add(info);
							String in_key = (String) gr_el.get(info);
							re_list.add(in_key);
							gr_el.remove(info);
							newOrderList.add(re_list);
						}
					}
					if(gr_el.size() > 0 )
					{
						Iterator iter = gr_el.entrySet().iterator();
						while(iter.hasNext()){
							Map.Entry entry_state = (Map.Entry)iter.next();
							String el_State_key = (String)entry_state.getKey();
							String el_State_val = (String)entry_state.getValue();

							ArrayList re_list = new ArrayList();
							re_list.add(el_State_key);
							re_list.add(el_State_val);
							newOrderList.add(re_list);
						}
					}
					
				}
				egDb.releaseConnection(false);
				EgDbAdapterTypeUI.releaseObject(egDb);
			}
			catch(Exception ees)
			{
			}
		}
	}
	catch(Exception ee)
	{
	}
	ArrayList result  = new ArrayList();
	result.add(newOrderList);
	return result;
}
%>