<%----------------------------------------------------------------------
GUI 4.0				:	Vijaykumar 31.10.2006
-------------------------------------------------------------------------%>
<%@ page import = "java.lang.*"%>
<%@ taglib prefix="egui" uri="../WEB-INF/eg-taglib.tld" %>
<%@ include file = "EgMonitorTracker.jsp" %>
<%@ page errorPage = "EgProbsM.jsp" %>
<%@ page import = "com.eg.EgAlarmTable" %>
<%@ page import = "com.eg.EgDateInfo" %>
<%@ page import = "com.eg.EgDbAdapterTypeUI"%>
<%@ page import = "com.eg.EgSpecsInfo" %>
<%@ page import = "com.eg.EgTablesInfo" %>
<%@ page import = "com.eg.EgConfigInfo" %>
<%@ page import = "com.eg.EgServicesInfo" %>
<%@ page import = "com.eg.EgDiscInfo"%>
<%@ page import = "com.eg.EgExternalInfo" %>
<%@ page import = "com.egurkha.monitor.LayerModel" %>
<%@ page import = "com.egurkha.monitor.alarms.AlarmPriorities" %>
<%@ page import = "com.egurkha.util.Sorter" %>
<%@ page import = "com.egurkha.util.StringUtils" %>
<%@ page import="java.io.PrintWriter"%>
<%@ page import = "egurkha.EgDbAdapterUI"%>
<%@ page import = "java.sql.ResultSet" %>
<%@ page import = "java.net.URLEncoder" %>
<%@ page import = "com.eg.EgURLEncoder" %>
<%@ page import = "java.net.URLDecoder" %>
<%@ page import="com.egurkha.ini.IniUI"%>
<%@ page import = "com.eg.EgMappingInfo"%>
<%@ page import = "com.egurkha.util.DateUtil"%>
<%@ page import = "com.eg.EgMaintenanceInfo"%>
<%@ page import = "com.eg.EgTestInfo"%>
<%@ page import = "com.egurkha.admin.EgMaintenanceUtility"%>
<%@ page import = "com.eg.EgDbInfo"%>
<%@ page import = "com.eg.EgMetaThread"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ page import="java.util.*" %>
<%@ page import = "com.eg.EgInstallInfo" %>
<%@ page import = "com.eg.IniFile"%>
<%@ page import="net.sf.json.*"%>
<%@ page import = "com.egurkha.User"%>
<%@ page import="egurkha.reporter.ErUtils"%>
<%@ page import = "com.egurkha.UserRegistry"%>
<%@ page import = "com.egurkha.*"%>
<%@ page import="egurkha.reporter.ErUserData"%>
<%@ page import="com.egurkha.monitor.MonitorDAOFactory"%>
<%@ page import="com.egurkha.monitor.MeasuresDAO"%>
<%@ page import="com.egurkha.util.EgSorter"%>
<%@ page import = "com.eg.EgManagersIniForManager" %>
<%@ page import = "com.egurkha.EgUserRole"%>
<%@ page import = "egurkha.TransactionBean"%>

<%
/* This is for SuperManager - starts */
String comp_mgr_id=null;
boolean isDouble=EgDbInfo.doubleByteEnabled;
long time_diff_in_ms=0;
String disableDesc=request.getParameter("disableDesc");
boolean disableDescFlag = false;
if(disableDesc != null && disableDesc.trim().length() > 0)
	disableDescFlag = true;
if(com.eg.EgInstallInfo.isSuperManager)
{
	String currentSession = session.getId();
	String hostname = request.getParameter("host");
	if(hostname != null)
	{
		if(hostname.indexOf(":")>-1)
		{
			hostname = hostname.substring(0,hostname.indexOf(":"));
		}
		ArrayList managerIds = EgElementInfo.getInstance().getManagerIDs("component",hostname);
		if(managerIds != null && !managerIds.isEmpty())
		{
			comp_mgr_id = (String)managerIds.get(0);
			session.setAttribute("mgr_id_sm",comp_mgr_id);
			String ms = EgSmSuperInfo.getInstance().getValue(comp_mgr_id,"TIME_DIFF");
			try
			{
				if(ms != null && ms.trim().length()>0)
				{
					time_diff_in_ms = Long.parseLong(ms);
				}
			}
			catch(Exception e)
			{
				e.printStackTrace();
			}
			SmSessionData smsData = new SmSessionData(currentSession,managerIds);
			EgThreadLocal egtl = new EgThreadLocal();
			egtl.set(smsData);
		}
	}
}
/* This is for SuperManager - ends */
	response.setContentType("application/json");
	String mgr_time=null;
	String temp1=null;
	Hashtable customLayer = new Hashtable();
	fromMobile=request.getParameter("fromMobile");
	if(fromMobile!=null && fromMobile.equals("yes"))
	{
		Calendar cal = Calendar.getInstance();
		EgDateInfo egDate = new EgDateInfo();
		Date local_date = new Date(egDate.egetUTCDate());
		cal.setTime(local_date);
		cal.setTimeZone(egDate.getRealTimeZone());
		temp1 =local_date.toString();
		mgr_time=cal.get(cal.HOUR_OF_DAY)+"";
	}
	JSONObject json = new JSONObject();
	JSONObject json_mobile = new JSONObject();
	JSONArray Testinfo_array = new JSONArray();
	JSONArray Testinfo_array_mobile = new JSONArray();
	JSONObject errormsg = new JSONObject();
	String showAll=request.getParameter("showAll");
	String mobiletest=request.getParameter("test");

	//MonitorDAOFactory monitorDaoFactory = MonitorDAOFactory.getInstance();
	//MeasuresDAO MeasuresDao = monitorDaoFactory.getMeasuresDAO();
	request.setCharacterEncoding("UTF-8");
	response.setHeader("Cache-Control","no-store");
	response.setHeader("Pragma","no-cache");
	response.setDateHeader ("Expires", -1);
	session.removeAttribute("compddlink");
	session.removeAttribute("compgraphlink");
	session.removeAttribute("comphistorylink");
	session.removeAttribute("compfeedbacklink");
	String MeasureUrl="egDashBoardDispCompMeasure.jsp";
	String tempUrl="";
	ArrayList a1 = new ArrayList();
	ArrayList alist_InF = new ArrayList();
	boolean selectBold = false;
	boolean selectInFBold = false;
	//PrintWriter printwriter = response.getWriter();
	UserRegistry registry    = UserRegistry.getInstance();
	User user = registry.getUser(session.getId());
	EgMaintenanceInfo egM=new EgMaintenanceInfo("manager");
	EgTestInfo tokInfo = new EgTestInfo("manager");
	EgMaintenanceUtility maintenanceUtil=new EgMaintenanceUtility();
	EgDateInfo dateInfo=new EgDateInfo();
	IniUI ui = (IniUI)com.egurkha.ini.IniUI.getInstance();
	String thisLanguage = ui.getDefaultLanguage();
	if (user!=null)
	{
		String userLang = user.getLanguage();
		if (userLang!=null && !userLang.equalsIgnoreCase("NULL"))
			thisLanguage=userLang;
	}
	//EgMappingInfo mappingInfo = new EgMappingInfo(thisLanguage);
	
	
//	boolean from_sm = false;
//	String sessionId_sm = null;
	if(session.getAttribute("sessionId_SM") != null)
	{
		from_sm = true;
		sessionId_sm = (String)session.getAttribute("sessionId_SM");
	}

//com.egurkha.ini.IniUI trackerUI = (com.egurkha.ini.IniUI)com.egurkha.ini.IniUI.getInstance();
//String trackerLanguage = trackerUI.getDefaultLanguage();
	
	// -- For get the real info's from metetest db table...
	// by Saravanan.A on 21-Jun-2012
	Hashtable metaTest=(Hashtable)EgMetaThread.metaTest;
	Hashtable specMetaTest=(Hashtable)EgMetaThread.specMetaTest;
	if(metaTest == null)
		metaTest=new Hashtable();

	if(specMetaTest == null)
		specMetaTest=new Hashtable();
	//---end---

	String ua = request.getHeader( "User-Agent" );
	boolean isFirefox = ( ua != null && ((ua.indexOf( "Firefox/" ) != -1)  || (ua.indexOf( "MSIE 999.1" ) != -1)));
	boolean isChrome = ( ua != null && ua.indexOf( "Chrome/" ) != -1 );
	boolean isSafari = ( ua != null && ua.indexOf( "Safari/" ) != -1 );

	String tr_display_text="block";
	if(isFirefox || isChrome || isSafari)
	{
		tr_display_text="table-row";
	}
	EgUserRole userRole;
	boolean hasAdminTab=false;
	boolean hasMaintenancePolicyConfiguration=false;
	boolean isCompletedUserRole=false;
	boolean isAdmin=false;
	if(fromMobile==null || !fromMobile.equals("yes"))
	{
		userRole = user.getUserRole();
		hasAdminTab = userRole.hasAnyAdminRole(EgUserPermission.ADMIN);
		hasMaintenancePolicyConfiguration = userRole.hasAnyAdminRole(EgUserPermission.MAINTENANCE_POLICY);
		isCompletedUserRole = userRole.hasAllComponentAccess();
		isAdmin = user.isAdmin();
	}

	boolean showMaintenanceConfigIcon = false;
	boolean allowMPolicyCreationForTestInLayerModel=false;
	
	boolean isNotOpenNewWindow = false;

	boolean isSecondaryManager = false;
	EgManagersIniForManager mi = null;
	if (EgInstallInfo.isClusterSupported)
	{
		mi = EgManagersIniForManager.getInstance();
		if (mi != null && !mi.isPrimaryManager())
		{
			hasAdminTab = false;
			isSecondaryManager = true;
		}
	}
	IniFile iniFile = new IniFile(EgInstallInfo.getInstallDir() + "/manager/config/eg_services.ini");
	String more_value = iniFile.getValue("MISC_ARGS", "MoreInfos");
	int maxInfosCount = 0;
	if (more_value != null)
	{
		try
		{
			maxInfosCount = Integer.parseInt(more_value.trim());
		}
		catch(NumberFormatException nfe)
		{
			maxInfosCount = 20;
		}
	}
	else
		maxInfosCount = 20;

	String uiFile = "eg_ui.ini";
	String iniFileDir = EgInstallInfo.getInstallDir()+ "/manager/config/";
	IniFile egUI = new IniFile(iniFileDir + uiFile);
	String currentDateFormat = egUI.getValue("CURRENT_DATE_FORMAT","selectedDateFormat");
	String subTreeTests=(String)egUI.getValue("TEST_PANEL_SUBTREE","SubTreeTestList");
	// reading Custom subtree values from ini file
	String customSubTree = egUI.getValue("TEST_PANEL_SUBTREE","CustomeSubTreeList");
	String multiSubTree = egUI.getValue("TEST_PANEL_SUBTREE","SecondLevelSubTreeList");
	ArrayList multiSubTreeList = new ArrayList();
	ArrayList groupingData = new ArrayList();
	ArrayList customSubTreeList = new ArrayList();
	ArrayList tmpCustomSubTreeList = new ArrayList();
	if(multiSubTree != null && multiSubTree.length() > 0){
		multiSubTreeList =  com.egurkha.util.StringUtils.egTokenizer(multiSubTree,",",false,true,true);//param 3-->includeEmpty,4-->unique,5-->trim
	}
	String allowToCreateMPolcyForTest = egUI.getValue("MISC_ARGS","AllowMPolicyCreationForTestInLayerModel");
	if(allowToCreateMPolcyForTest!=null && (allowToCreateMPolcyForTest.equalsIgnoreCase("yes") || allowToCreateMPolcyForTest.equalsIgnoreCase("true")))
	{
		allowMPolicyCreationForTestInLayerModel=true;
	}
	StringTokenizer cust = null;
	if(customSubTree != null && customSubTree.trim().length() > 0){
		tmpCustomSubTreeList =  com.egurkha.util.StringUtils.egTokenizer(customSubTree,",",false,true,true);//param 3-->includeEmpty,4-->unique,5-->trim
		if(customSubTree.indexOf(",") != -1  ){
			cust = new StringTokenizer(customSubTree,",");
			while(cust.hasMoreTokens()){
				String cusTest = cust.nextToken();
				String tempDataTest = egUI.getValue("TEST_PANEL_SUBTREE","CustomeSubTreeData_"+cusTest);
				if(tempDataTest != null && tempDataTest.trim().length() > 0 ){
					customSubTreeList.add(cusTest);
				}
				//customSubTreeList.add(cust.nextToken());
			}
		}else {
			String tempDataTest = egUI.getValue("TEST_PANEL_SUBTREE","CustomeSubTreeData_"+customSubTree);
			if(tempDataTest != null && tempDataTest.trim().length() > 0 ){
				customSubTreeList.add(customSubTree);
			}
			//customSubTreeList.add(customSubTree);
		}		
	}

	ArrayList subTreeTestsList=new ArrayList();
	if(subTreeTests!=null && subTreeTests.trim().length()>0)
	{
		subTreeTestsList =  com.egurkha.util.StringUtils.egTokenizer(subTreeTests,",",false,true,true);//param 3-->includeEmpty,4-->unique,5-->trim
	}
%>
<jsp:useBean id="transBean" scope="page" class="egurkha.TransactionBean"/> 
<%
	transBean.createFile("eg_ui.ini");
%>
<jsp:useBean id="trans" scope="page" class="egurkha.TransactionBean" />
<jsp:useBean id="trans1" scope="page" class="egurkha.TransactionBean" />

<%-- jaiwin changes starts --%>
<%
//kannan changes starts here------
	String fakeType="";
	EgDiscInfo discInfo = new EgDiscInfo("manager");
	String hostType = request.getParameter("comptype");
	String hostName=request.getParameter("host");
	String insideViewTestConfig=request.getParameter("insideViewTestConfig");
	if(isDouble)
		hostName=URLDecoder.decode(hostName,"UTF-8");
	String currLayerState=request.getParameter("currLayerState");
	currLayerState=(currLayerState==null || currLayerState.trim().length()==0)?"GOOD":currLayerState;
	String external_url_ini = "eg_externalURL.ini";
	boolean isToolPopup = false;
	IniFile externalUrlIni = new IniFile(iniFileDir + external_url_ini);
	String uiFile_Config = "eg_dashboardConfig.ini";
	String iniFileDir_Config = EgInstallInfo.getInstallDir()+ "/manager/config/";
	IniFile egUI_Config = new IniFile(iniFileDir_Config + uiFile_Config);
	String tools = "";
	String compTypeName=egUI.getValue("VMDash_Supported_Types",hostType);
	if(compTypeName==null || compTypeName.trim().length()==0)
		compTypeName=egUI_Config.getValue("VMDash_Supported_Types",hostType);

	String layer=egUI.getValue("Layer_for_ComponentType",hostType);
	//Added by chandrasekhar.P to get real type incase of Host system
	
	if(hostType==null || hostType.equalsIgnoreCase("Host_system"))
	{
		fakeType = request.getParameter("faketype");
		if(fakeType!=null && fakeType.equalsIgnoreCase("host_system"))
		{
			String testName=request.getParameter("test");
			if(testName!=null && testName.trim().length()>0)
			{
				//testName=URLDecoder.decode(testName);
				testName=com.egurkha.util.StringUtils.replace(testName,"|plus|","+");
				testName=com.egurkha.util.StringUtils.replace(testName,"|amp|","&");
				testName=com.egurkha.util.StringUtils.replace(testName,"|pct|","%");
				testName=com.egurkha.util.StringUtils.replace(testName,"|hash|","#");
			}
			
			if(testName!=null)
				testName=testName.substring(0,testName.indexOf('-'));
			fakeType = discInfo.getTypeForHostTest(hostName,testName);
		}
		tools = externalUrlIni.getValue("MONITORING TOOLS",fakeType+":"+hostName);
		
	}
	else
	{
		tools = externalUrlIni.getValue("MONITORING TOOLS",hostType+":"+hostName);
	}
	if(tools!=null && !tools.equals(""))
	{
		StringTokenizer toolTokens  = new StringTokenizer(tools,",");
		int countTools = 0;
		boolean isDoubleByteLanguage=((EgDbInfo.doubleByteEnabled && !trackerLanguage.equals("en_US")));
		int toolDisplayLength=20;
		if(isDoubleByteLanguage)
			toolDisplayLength=16;
		
		JSONArray toolsJsonArray = new JSONArray();
		while(toolTokens.hasMoreTokens())
		{
			JSONObject toolsJson = new JSONObject();
			
			String toolName = toolTokens.nextToken();
			String displayToolName=toolName;
			if(displayToolName!=null && displayToolName.length()>toolDisplayLength)
				displayToolName=displayToolName.substring(0,toolDisplayLength)+"...";

			String url = externalUrlIni.getValue(hostType,hostName+":"+toolName);
			String urlForExternalMonitor=response.encodeURL("/final/monitor/EgExternalMonitorLink.jsp?")+"hostName="+EgURLEncoder.encode(hostName,"UTF-8")+"&compType="+hostType;
			if(countTools<3)
			{
				toolsJson.put("link",url);
				toolsJson.put("ToolName",displayToolName);
			}
			else
			{
				toolsJson.put("link",urlForExternalMonitor);
				break;
			}
			countTools++;
			toolsJsonArray.add(toolsJson);
		}
		json.put("tools", toolsJsonArray);
	}

//kannan change ends here..........
//<!-- jaiwin changes ends -->
	//  All Declarations here
	EgDbAdapterUI egDb;
	ResultSet rsReport=null;
	ResultSet rsLastMeasure = null;

	Hashtable testsForLayer = new Hashtable();

	Vector rept = new Vector();
	Vector test = new Vector();
	String conn="";
	String siteName="";
	String layerName="";
	String flagAlarm = "";
	boolean state1 = false;
	boolean state2 = false;
	boolean isTestRelevantForServer = false;
	boolean isPortRelevant =  false;
	
	// for Db Optimization
	String hostNameDb="";

	EgTablesInfo tableInfo = new EgTablesInfo("manager");
	EgServicesInfo egserInfo = new EgServicesInfo("manager");
	EgExternalInfo extInfo =new EgExternalInfo("manager");
	EgSpecsInfo specsInfo = new EgSpecsInfo("manager");
	boolean uniqueHostSystemData = egserInfo.isUniqueHostSystemData();
	Vector hostSysTests = egserInfo.getHostSysTest();
	Hashtable hash = extInfo.getInternalAgentMap();

	String thiselement ="";
	Vector searchVec=new Vector();
	List validSearchList=new LinkedList();
	List validSearchInfosList=new LinkedList();
	boolean searchItemFound = false;

	String testQueryStr = (String)request.getQueryString();

	int searchStringInd = testQueryStr.indexOf("searchString");
	
	boolean isMoreInfosTreeView=false;
	String MoreInfosTreeView = request.getParameter("MoreInfosTreeView");
	if(MoreInfosTreeView!=null && MoreInfosTreeView.trim().length()>0 && (MoreInfosTreeView.equalsIgnoreCase("true") || MoreInfosTreeView.equalsIgnoreCase("yes")))
	{
		isMoreInfosTreeView=true;
	}
	String moreInfoTest = request.getParameter("test");
	if(moreInfoTest != null && moreInfoTest.trim().length() >0 )
	{
		//EsxDiskUsageTest-+nfs
		if(moreInfoTest.indexOf("-") != -1)
			moreInfoTest = moreInfoTest.substring(0,moreInfoTest.indexOf("-"));

		moreInfoTest = moreInfoTest.trim();
	}

	String isInterface = request.getParameter("isInterface");
	isInterface = (isInterface==null)?"":isInterface;
	String selectedInterface = request.getParameter("selectedInterface");
	selectedInterface=(selectedInterface==null)?"":selectedInterface;

	if(selectedInterface!=null && selectedInterface.trim().length()>0)
		selectedInterface =com.egurkha.util.StringUtils.decodeSecurityChar(selectedInterface);

	if(searchStringInd==-1)
	{
		String s_qrstring=testQueryStr;
		String Qstring="";
		if(s_qrstring!=null)
		{
			StringTokenizer strtok = new StringTokenizer(s_qrstring,"&");
			while(strtok.hasMoreTokens())
			{
				String param = strtok.nextToken();
				int ind = param.indexOf("=");
				if (ind < 0)
					continue;
				String reqparam =param.substring(0,ind);
				String value = param.substring(ind+1);
				if(reqparam.equals("info"))
				{
					value=request.getParameter(reqparam);
				}
				else if(reqparam.equals("host"))
				{
					value=request.getParameter(reqparam);
				}
				else if(reqparam.equals("comptype"))
				{
					value=request.getParameter(reqparam) ;
				}
				else if(reqparam.equals("test"))
				{
					value=request.getParameter(reqparam);
				}
				else if(reqparam.equals("layer"))
				{
					value=request.getParameter(reqparam);
				}
				else if(reqparam.equals("fromPage"))
				{
					value=request.getParameter(reqparam);
				}

				Qstring=Qstring+reqparam+"="+value+"&";
			}
		}
		if(Qstring.endsWith("&"))
			Qstring=Qstring.substring(0,Qstring.lastIndexOf("&"));

		session.setAttribute("egBackComplete",Qstring);
	}

	String searchString = (String)request.getParameter("searchString");
	searchString=com.egurkha.util.StringUtils.decodeSecurityChar(searchString);
	json.put("SearchText",searchString);
	String egBackComplete=(String)session.getAttribute("egBackComplete");

	String subtitle = request.getParameter("subtitle");
	String searchBox=request.getParameter("searchBox");
	String backButton = request.getParameter("backButton");
	
	boolean searchBoxNeed = searchBox!=null && searchBox.equalsIgnoreCase("false");
	boolean isNoSubtitle = subtitle!=null && subtitle.equalsIgnoreCase("false");
	boolean isBackNeeded = backButton!=null && backButton.equalsIgnoreCase("true");
	boolean moreInfosTreeViewEnabled=false;
	//Tests Table begins
	String hostType2;
	String qctr = request.getParameter("qctr");
		
	if(qctr.equals("1") || qctr.equals("2"))
	{
		siteName=request.getParameter("site");
		hostName=request.getParameter("host");
		layerName=request.getParameter("layer");
		flagAlarm = request.getParameter("fromalarm");
		String testName1 =request.getParameter("test");
		String layerClicked =request.getParameter("Layerclicked");
		boolean isLayerClicked=false;
		//if(layerClicked!=null && layerClicked.equalsIgnoreCase("true"))
		//{
			//isLayerClicked=true;
		//}
		
		HashMap testQueryHash = new HashMap();
		StringBuffer searchQry = new StringBuffer();
		if(testQueryStr!=null)
		{
			testQueryHash = parseQString(testQueryStr);
		}
		//String queryForSearch = searchQry.substring(0,searchQry.length()-1);
		String qctrValue = (String)testQueryHash.get("qctr");
		
		if(!qctrValue.equals("0") && (qctrValue.equals("1") || qctrValue.equals("2") || qctrValue.equals("3")))
		{
			session.setAttribute("test",testQueryStr);
		}
		
		hostType2 = hostType;
		//boolean isApplicationLayer = tableInfo.isPortRelevantForLayer(hostType,layerName.trim());
		boolean isApplicationLayer = false;
		ArrayList layersForComp = tableInfo.getLayersForComponent(hostType);
		ArrayList layersForHostSystem = tableInfo.getLayersForComponent("Host_system");

		if(layerName!=null && layersForComp!=null && layersForHostSystem!=null  && layersForComp.contains(layerName.trim()) && (!layersForHostSystem.contains(layerName.trim())))
		{
			isApplicationLayer = true;
		}

		// -- For get the real info's from metetest db table...
		// by Saravanan.A on 21-Jun-2012
		String org_comp_type=hostType;
		String org_host_name=hostName;
		if(layerName!=null && layersForHostSystem!=null && layersForHostSystem.contains(layerName) && layersForComp!=null && layersForComp.contains(layerName))
		{
			org_comp_type = "Host_system";
			StringTokenizer st = new StringTokenizer(hostName,":");
			if(st.countTokens()>0)
			{
				org_host_name = st.nextToken()+":NULL";
			}
		}
		//Hashtable testDetails =(Hashtable) metaTest.get(org_comp_type+":"+org_host_name);
		Hashtable testDetails = new Hashtable();
		Hashtable specTestDetails = new Hashtable();
		boolean isCheckTestData=false;
		if(org_host_name!=null && org_host_name.trim().length()>0)
		{
			String tmp_host_name=org_host_name;
			if(tmp_host_name.indexOf(":")>-1)
				tmp_host_name = tmp_host_name.substring(0,tmp_host_name.indexOf(":"));

			List temp_type_list=(List)discInfo.getServerTypesForNick(tmp_host_name);

			if(temp_type_list!=null && temp_type_list.size()>1)
			{
				testDetails =(Hashtable) metaTest.get(org_comp_type+":"+org_host_name);
				specTestDetails =(Hashtable) specMetaTest.get(org_comp_type+":"+org_host_name);
				isCheckTestData=true;
			}
		}
		if(testDetails == null)
			testDetails = new Hashtable();
		if(specTestDetails == null)
			specTestDetails = new Hashtable();
		//---end---

		Hashtable testInfoMap = new Hashtable();
		boolean timeOut = false;
		egDb=EgDbAdapterTypeUI.getObject();
		conn=egDb.setConnection();
		// To retrieve infos from measure_last table instead of metatest table.
		// by Saravanan.A changed on 14-12-2011.
		ArrayList testsFromML = new ArrayList();
		ArrayList infosFromML = new ArrayList();
		ArrayList msmtFromML = new ArrayList();
		ArrayList removedMsmthost = new ArrayList();
		Hashtable testWithMsmtHostHash = new Hashtable();
	
		ArrayList hideList = new ArrayList();
		String hide_Test[]= egUI_Config.getVariables("Hide_Measures_UI");
		if(hide_Test!=null && hide_Test.length>0)
		{
			for(int k=0; k<hide_Test.length; k++)
			{			
				String hide_TestVal=(String)egUI_Config.getValue("Hide_Measures_UI",hide_Test[k]);
				if(hide_TestVal!= null && hide_TestVal.equalsIgnoreCase("All"))
					hideList.add(hide_Test[k]);
			}
		}
		
		ArrayList needList = new ArrayList();
		if(insideViewTestConfig!=null && insideViewTestConfig.equalsIgnoreCase("OTHERS"))
		{
			String insideView_Layers =(String)egUI_Config.getValue("InsideviewDashboard_LayerView","Layers");
			StringTokenizer insideView_Layers_token = new StringTokenizer(insideView_Layers,",");
			while(insideView_Layers_token != null && insideView_Layers_token.hasMoreTokens())
			{
				String insideView_Tests =(String)egUI_Config.getValue("InsideviewDashboard_LayerView",insideView_Layers_token.nextToken().trim());
				StringTokenizer insideView_Tests_token = new StringTokenizer(insideView_Tests,",");
				while(insideView_Tests_token != null && insideView_Tests_token.hasMoreTokens())
					hideList.add(insideView_Tests_token.nextToken().trim());
			}
		}
		else
		{
			String need_TestName =(String)egUI_Config.getValue("InsideviewDashboard_LayerView",insideViewTestConfig);
			StringTokenizer need_TestName_token = new StringTokenizer(need_TestName,",");
			while(need_TestName_token != null && need_TestName_token.hasMoreTokens())
				needList.add(need_TestName_token.nextToken().trim());
		}
		String topFalg = "5px";
		boolean insideView = false;
		if(needList.size() > 0 || (insideViewTestConfig!=null && insideViewTestConfig.equalsIgnoreCase("OTHERS")))
		{
			topFalg = "1px";
			insideView = true;
		}
		String infoInsideView = request.getParameter("info");
		if(infoInsideView != null && infoInsideView.indexOf("|amp|") > -1)
			infoInsideView = com.egurkha.util.StringUtils.replace(infoInsideView,"|amp|","&");
		if(infoInsideView != null && infoInsideView.indexOf("|hash|") > -1)
			infoInsideView = com.egurkha.util.StringUtils.replace(infoInsideView,"|hash|","#");
		if (conn != null && conn.equalsIgnoreCase("CONNECTED"))
		{
			state1 = true;
			Hashtable tmp_hash=(Hashtable)getTestDetails(egDb,hideList,isMoreInfosTreeView,moreInfoTest,isCheckTestData,testDetails,hostType,hostName,layerName,siteName,isApplicationLayer,customSubTreeList,customLayer,specsInfo,needList,infoInsideView,specTestDetails,time_diff_in_ms);

			if(tmp_hash!=null && tmp_hash.size()>0)
			{
				testInfoMap = (Hashtable)tmp_hash.get("testInfoMap");
				testsFromML = (ArrayList)tmp_hash.get("testsFromML");
				infosFromML = (ArrayList)tmp_hash.get("infosFromML");
				msmtFromML = (ArrayList)tmp_hash.get("msmtFromML");
				testWithMsmtHostHash = (Hashtable)tmp_hash.get("testWithMsmtHostHash");
				if(testWithMsmtHostHash==null)
					testWithMsmtHostHash = new Hashtable();
			}
		}
		//new code for dynamic infos ends
		//EgDbAdapterTypeUI.releaseObject(egDb);

		//****** db optimization *****************
		hostNameDb = hostName;
		if (uniqueHostSystemData)
		{
			String compName="";
			compName = hostNameDb.substring(0,hostNameDb.indexOf(":"));
			if (hash.containsKey(compName)) 
			{
				String ss = (String)hash.get(compName);
				String stLayer = request.getParameter("layer");
				ArrayList arr = tableInfo.getTestsForLayer(stLayer);
				
				for (int i=0;i<arr.size();i++)
				{
					if (hostSysTests.contains((String) arr.get(i)))
					{
						if(ss != null && !ss.equals(""))
						{
							hostNameDb = ss + hostName.substring(hostName.indexOf(":"));
							break;
						}
					}
				}
			}
		}

		AlarmPriorities ap = AlarmPriorities.getInstance();
		//****************************************

		// Retrieved infos from measure_last table so commenting the below code.
		// by Saravanan.A changed on 14-12-2011.
		trans.createFile("eg_services.ini");
		boolean agentsOpened = false;
		Hashtable h = new Hashtable();
		ArrayList tests2 = new ArrayList();
		ArrayList infos = new ArrayList();
		ArrayList msmt = new ArrayList();
		specsInfo.checkForUpdate();
		String strPort =  hostNameDb.substring(hostNameDb.indexOf(":")+1);
		rsReport = null;

		String moreInfosTreeViewStr = trans.getStrValue("MISC_ARGS","MoreInfosTreeView");
		if(moreInfosTreeViewStr!=null && moreInfosTreeViewStr.trim().length()>0 && (moreInfosTreeViewStr.equalsIgnoreCase("yes") || moreInfosTreeViewStr.equalsIgnoreCase("true")))
			moreInfosTreeViewEnabled=true;

		if(testsFromML!=null && testsFromML.size()>0)
			tests2.addAll(testsFromML);
		if(infosFromML!=null && infosFromML.size()>0)
			infos.addAll(infosFromML);
		if(msmtFromML!=null && msmtFromML.size()>0)
			msmt.addAll(msmtFromML);

		// To get the disabled tests list.
		// by Saravanan.A changed on 14-12-2011.

		String disable = EgInstallInfo.getInstallDir()+"/manager/config/eg_disable.ini";
		IniFile disableIniObj = new IniFile(disable);

		boolean isAppLayer = tableInfo.isPortRelevantForLayer(hostType,layerName);

		String disp_value=null;
		String onlyHostName = hostNameDb.substring(0,hostNameDb.indexOf(":"));
		if(isAppLayer)
			disp_value=disableIniObj.getValue(hostType,hostType+":"+hostNameDb);
		else
			disp_value=disableIniObj.getValue("Default_server","Default_server:"+onlyHostName);

		ArrayList dispTestList=new ArrayList();
		if(disp_value!=null && disp_value.length()>0)
		{
			dispTestList =  com.egurkha.util.StringUtils.egTokenizer(disp_value.trim(), ",",false,true,true);//param 3-->includeEmpty,4-->unique,5-->trim
		}
		//---end---

		int count = tests2.size();
		Hashtable cache2 = new Hashtable();
		Hashtable relevant = new Hashtable();
		Hashtable portRel = new Hashtable();
		long mgrTime = dateInfo.egetUTCDate(false);
		Hashtable timeoutCache = new Hashtable();
		ArrayList timeoutinfo = new ArrayList();
		String search = hostType+'~';
		int disableTestCount = 0;
		for(int r=0; r<count; r++)
		{
			timeOut = false;
			String testStr = (String) tests2.get(r);
			if(testStr!=null && testStr.trim().length()>0 && !dispTestList.contains(testStr))
			{
				String ind2 = search +testStr;
				Boolean b = (Boolean) relevant.get(ind2);
				if (b == null)
				{
					isTestRelevantForServer = specsInfo.isTestRelevantForServer(hostType,testStr);
					relevant.put(ind2,new Boolean (isTestRelevantForServer));
				}
				else
				{
					isTestRelevantForServer = b.booleanValue();
				}
				if(flagAlarm !=null && flagAlarm.equals("1"))
				{
					if (fakeType != null && fakeType.length() > 0)
					{
						ind2 = fakeType+'~'+testStr;
						b = (Boolean) relevant.get(ind2);
						if (b == null)
						{
							isTestRelevantForServer = specsInfo.isTestRelevantForServer(fakeType,testStr);
							relevant.put(ind2, new Boolean (isTestRelevantForServer));
						} else {
							isTestRelevantForServer = b.booleanValue();
						}
					}
					else
						isTestRelevantForServer = true;
				}
				//dynamic infos code starts
				String infoName = (String) infos.get(r);
				String multipleStr = null;
				multipleStr = (String) h.get(testStr);
				//Added by Chandrasekhar toget Cut of Factor value from eg_services.ini...
				if(multipleStr == null)
					multipleStr = (String)getIniValue(testStr,trans);

				if(multipleStr == null || multipleStr.trim().length()==0)
					multipleStr="-1";

				h.put(testStr,multipleStr);

				if(EgInstallInfo.isSuperManager && comp_mgr_id == null)
				{
					multipleStr=null;
				}
				String msmtHostStr = (String) msmt.get(r);
				if((multipleStr != null) && !(multipleStr.trim().equals("-1") && (multipleStr.trim().length() != 0)))
				{
					String temp = "";
					String testFreqStr = "";
					String msmtTimeStr = "";
					
					long multiple, testFreq, msmtTime= 0l;
					java.util.Date msmtTimeDate;
					String ipNum = hostName.substring(0, hostName.indexOf(':'));
					String portNumber = "";
					String tempStr = "";
					String tempStr1 = "";

					if (!agentsOpened)
					{
						if(EgInstallInfo.isSuperManager && comp_mgr_id != null)
							trans1.createFile(comp_mgr_id+"-eg_agents.ini");
						else
							trans1.createFile("eg_agents.ini");
						agentsOpened = true;
					}
					Boolean bb = (Boolean) portRel.get(testStr);
					boolean flag = false;
					if (bb == null)
					{
						flag = specsInfo.isPortRelevantForTest(testStr);
						portRel.put(testStr, new Boolean (flag));
					} else 
						flag = bb.booleanValue();
					if(flag)
					{
						tempStr = testStr +":"+hostType+":"+ hostName;
						tempStr1 = testStr +"::"+ hostName;
					}
					else
					{
						tempStr = testStr +"::"+ ipNum;
						tempStr1 = testStr +":"+hostType+":"+ ipNum;
					}
					String ind = msmtHostStr+'~'+tempStr;
					temp = (String) cache2.get(ind);
					if (temp == null)
					{
						temp = trans1.getStrValue(msmtHostStr, tempStr);
						if(temp == null || temp.trim().equals(""))
						{
							temp = trans1.getStrValue(msmtHostStr, tempStr1);
						}
						if (temp != null)
							cache2.put(ind,temp);
					}

					testFreqStr = (temp.substring(temp.lastIndexOf(',')+1)).trim();
					if((testFreqStr != null) && testFreqStr.trim().length() != 0)
					{
						multiple = 0l;
						testFreq = 0l;
						try
						{
							multiple = Long.parseLong(multipleStr);
							testFreq = Long.parseLong(testFreqStr);
						}
						catch(Exception we)
						{
							we.printStackTrace();
						}
						if(hostType2 != null && hostType2.equalsIgnoreCase("Oracle_server"))
						{
							msmtTimeStr = (String)testInfoMap.get(testStr + "||" + hostName.substring(hostName.lastIndexOf(":")+1)+ infoName+"||"+msmtHostStr);
							if(msmtTimeStr==null || msmtTimeStr.trim().length()==0)
								msmtTimeStr = (String)testInfoMap.get(testStr + "||" + infoName+"||"+msmtHostStr);
						}
						else
						{
							msmtTimeStr = (String)testInfoMap.get(testStr + "||" + infoName+"||"+msmtHostStr);
						}
						String ind3 = ind + '~'+msmtTimeStr;
						Boolean cc = (Boolean)timeoutCache.get(ind3);
						if (cc == null)
						{
							if(msmtTimeStr != null && msmtTimeStr.length() != 0)
							{
								String msmtTimeStrDate=msmtTimeStr.substring(0,msmtTimeStr.indexOf(" "));
								String msmtTimeStrTime=msmtTimeStr.substring(msmtTimeStr.indexOf(" ")+1);
								msmtTimeStrDate=com.egurkha.util.DateUtil.changeDateFormat(msmtTimeStrDate,"MM/dd/yyyy","dd/MM/yyyy");
								msmtTime = dateInfo.egetUTCDate(msmtTimeStrDate+" "+msmtTimeStrTime);

								if((mgrTime - msmtTime - time_diff_in_ms) > (multiple * testFreq * 1000l))
								{
									timeOut = true; 
									timeoutCache.put(ind3,new Boolean (true));
								} else {
									timeoutCache.put(ind3,new Boolean (false));
								}
							}
							else if(msmtTimeStr==null || msmtTimeStr.trim().length()==0)
								timeOut = true;
						}
						else
						{
							if (cc.booleanValue())
								timeOut = true;
						}
					}
					else
						timeOut = true;
				}
				//dynamic infos code ends
				if(isTestRelevantForServer && (!timeOut))
				{
					test.addElement(testStr);
					String testName = testStr + "-" + infoName;

					ArrayList al = (ArrayList) testsForLayer.get(testName);
					if (al == null)
					{
						al = new ArrayList();
						al.add(AlarmPriorities.GOOD_STATE);
						al.add(msmtHostStr);

						testsForLayer.put(testName, al);

					} else {
						al.add(AlarmPriorities.GOOD_STATE);
						al.add(msmtHostStr);
					}
				}
				else if(isTestRelevantForServer && timeOut)
				{
					// To Show info if timeout but exists in report table
					timeoutinfo.add(testStr + "-" + infoName);
					//end
					if(testWithMsmtHostHash!=null && testWithMsmtHostHash.size()>0)
					{
						ArrayList temp_m_list=(ArrayList)testWithMsmtHostHash.get(testStr);
						if(temp_m_list!=null && temp_m_list.size()>1 && temp_m_list.contains(msmtHostStr))
						{
							// Fix to show unknown msmthost for more than one msmthost of a test
							removedMsmthost.add(testStr + "-" + infoName+"-$-"+msmtHostStr);
							removedMsmthost.add(testStr + "-+-$-"+msmtHostStr);
							//temp_m_list.remove(msmtHostStr);
						}
					}
				}
			}
			else
				disableTestCount++;
		}

		if(count==disableTestCount)
			timeOut = true;

		if((test.size() < 1) && (!timeOut))
		{
			//	The metatest table doesnt get filled upto one hour when the agent is started for the first time so no test or info could be got from that during that period ....
			//	Hence the usage of query3 to get the tests from measurement_layer table!! 

			// Command the below code for collect infos from measure_last table instead of metatest table.
			// by Saravanan.A changed on 14-12-2011.

			ArrayList arr = tableInfo.getTestsForLayer(layerName);
			ArrayList addedTest=new ArrayList();
			if(arr!=null && arr.size()>0)
			{
				for (int i=0;i<arr.size();i++)
				{
					String test_name=(String)arr.get(i);
					if(test_name!=null && test_name.trim().length()>0 && !dispTestList.contains(test_name) && !addedTest.contains(test_name))
					{
						addedTest.add(test_name);
						//To check if the test is relevant for this type of server
						isTestRelevantForServer = specsInfo.isTestRelevantForServer(hostType,test_name);
						
						if(flagAlarm !=null && flagAlarm.equals("1"))
						{
							//modify on 22-8-2008 for disabled test
							if(hostType!=null && hostType.trim().length()>0 && 	hostType.equalsIgnoreCase("Host_system"))
							{
								if (fakeType != null && fakeType.length() > 0)
									isTestRelevantForServer = specsInfo.isTestRelevantForServer(fakeType,test_name);
							}
							else if(hostType!=null && hostType.trim().length()>0 && !hostType.equalsIgnoreCase("Host_system"))
							{
								isTestRelevantForServer = specsInfo.isTestRelevantForServer(hostType,test_name);
							}
						}

						if(isTestRelevantForServer && !timeOut)
						{
							test.addElement(test_name);
							String testName = test_name + "-+";
							ArrayList al = (ArrayList) testsForLayer.get(testName);
							if (al == null)
							{
								al = new ArrayList();
								al.add(AlarmPriorities.GOOD_STATE);
								al.add("");

								testsForLayer.put(testName, al);

							} else {
								al.add(AlarmPriorities.GOOD_STATE);
								al.add("");
								//multipleMsmtTestsForLayer.put(testName, new Boolean(true));
							}
						}
					}
				}
			}
		}

		String dummyStr = "";
		Vector dummyVector = new Vector();

		try
		{
			rsReport=egDb.SelectDispTest_2(siteName,flagAlarm,hostType,hostName,layerName,hostType2);
			state2=egDb.getState();
			
			while(rsReport != null && rsReport.next())
			{
				String testStr = rsReport.getString("test_name");
				if(insideViewTestConfig!=null && insideViewTestConfig.equalsIgnoreCase("OTHERS"))
				{
					if(hideList != null && hideList.size()>0 && testStr != null && hideList.contains(testStr))
						continue;
				}
				isTestRelevantForServer = specsInfo.isTestRelevantForServer(hostType,testStr);
				if(flagAlarm !=null && flagAlarm.equals("1"))
				{
					if (fakeType != null && fakeType.length() > 0)
						isTestRelevantForServer = specsInfo.isTestRelevantForServer(fakeType,testStr);
					else
						isTestRelevantForServer = true;
				}

				if(isTestRelevantForServer)
				{
					// if for custom sub tree else for pre condition
					if(customSubTreeList.contains(rsReport.getString("test_name"))){
						String tempTestName= rsReport.getString("test_name");
						String temptInfo = rsReport.getString("info");
						
						if(infoInsideView!=null && infoInsideView.trim().length() > 0 && temptInfo != null && temptInfo.trim().length() > 0)
						{
							String tempInfoObj = "";
							 if(temptInfo.startsWith("+"))
								tempInfoObj = temptInfo.substring(1);
							if(tempInfoObj.indexOf(":") > -1)
								tempInfoObj = tempInfoObj.substring(0,tempInfoObj.indexOf(":"));
							if(!(tempInfoObj.equalsIgnoreCase(infoInsideView)))
								continue;
						}
						
						if(needList != null && needList.size()>0 && tempTestName != null && !needList.contains(tempTestName))
							continue;						
						try{
							String customSubTreeData = egUI.getValue("TEST_PANEL_SUBTREE","CustomeSubTreeData_"+tempTestName);
							if(customSubTreeData != null && customSubTreeData.trim().length() >0){
								StringTokenizer cst1 = new StringTokenizer(customSubTreeData,":");
								String groupingField = cst1.nextToken();
								String groupingRule = cst1.nextToken();
								StringTokenizer cst2 = new StringTokenizer(groupingRule,"~");
								while(cst2.hasMoreTokens()){
									StringTokenizer cst3 = new StringTokenizer(cst2.nextToken(),"&");
									cst3.nextToken();
									groupingData.add(cst3.nextToken());
								}
							}
						}catch(Exception e){
							System.out.println("error..in ini"+e.toString());
						}

						for(int i=0;i<groupingData.size();i++)
						{
							String grpColName = (String)groupingData.get(i);
							String testCase = tempTestName+"-+"+grpColName+":"+temptInfo.substring(1,temptInfo.length());
							if(customLayer.containsKey(testCase)){
								rept.addElement(testCase);
								rept.addElement(rsReport.getString("state"));
								//rept.addElement("UNKNOWN");
								rept.addElement(rsReport.getString("msmt_host"));
								dummyStr = (String)rept.get(rept.size()-3);
								//dummyStr = (String)tempTestName+"-+";
								if(dummyStr.endsWith("-+"))
								{
									dummyVector.addElement(dummyStr);
									dummyVector.addElement(rept.get(rept.size()-2));
									dummyVector.addElement(rept.get(rept.size()-1));
								}

								String tmp_msmt_host=(String)rept.get(rept.size()-1);
								if(tmp_msmt_host!=null && tmp_msmt_host.trim().length()>0)
								{
									if(testWithMsmtHostHash.size()==0)
									{
										ArrayList temp_mlist=new ArrayList();
										temp_mlist.add(tmp_msmt_host);
										testWithMsmtHostHash.put(tempTestName,(ArrayList)temp_mlist);
									}
									else if(testWithMsmtHostHash.size()>0)
									{
										if(testWithMsmtHostHash.containsKey(tempTestName))
										{
											ArrayList temp_mlist=(ArrayList)testWithMsmtHostHash.get(tempTestName);
											if(temp_mlist!=null && !temp_mlist.contains(tmp_msmt_host))
											{
												temp_mlist.add(tmp_msmt_host);
												testWithMsmtHostHash.put(tempTestName,(ArrayList)temp_mlist);
											}
										}
										else
										{
											ArrayList temp_mlist=new ArrayList();
											temp_mlist.add(tmp_msmt_host);
											testWithMsmtHostHash.put(tempTestName,(ArrayList)temp_mlist);
										}
									}
								}
							}
						}
					}else{
						String infoObj = rsReport.getString("info");
						String test_name = rsReport.getString("test_name");
						
						if(infoInsideView!=null && infoInsideView.trim().length() > 0 && infoObj != null && infoObj.trim().length() > 0)
						{
							String tempInfo = "";
							 if(infoObj.startsWith("+"))
								tempInfo = infoObj.substring(1);
							if(tempInfo.indexOf(":") > -1)
								tempInfo = tempInfo.substring(0,tempInfo.indexOf(":"));
							if(!(tempInfo.equalsIgnoreCase(infoInsideView)))
								continue;
						}

						if(needList != null && needList.size()>0 && test_name != null && !needList.contains(test_name))
							continue;

						rept.addElement(test_name+ "-" +infoObj);
						rept.addElement(rsReport.getString("state"));
						rept.addElement(rsReport.getString("msmt_host"));
						dummyStr = (String)rept.get(rept.size()-3);
						if(dummyStr.endsWith("-+"))
						{
							dummyVector.addElement(dummyStr);
							dummyVector.addElement(rept.get(rept.size()-2));
							dummyVector.addElement(rept.get(rept.size()-1));
						}

						String tmp_msmt_host=(String)rept.get(rept.size()-1);
						if(tmp_msmt_host!=null && tmp_msmt_host.trim().length()>0)
						{
							if(testWithMsmtHostHash.size()==0)
							{
								ArrayList temp_mlist=new ArrayList();
								temp_mlist.add(tmp_msmt_host);
								testWithMsmtHostHash.put(test_name,(ArrayList)temp_mlist);
							}
							else if(testWithMsmtHostHash.size()>0)
							{
								if(testWithMsmtHostHash.containsKey(test_name))
								{
									ArrayList temp_mlist=(ArrayList)testWithMsmtHostHash.get(test_name);
									if(temp_mlist!=null && !temp_mlist.contains(tmp_msmt_host))
									{
										temp_mlist.add(tmp_msmt_host);
										testWithMsmtHostHash.put(test_name,(ArrayList)temp_mlist);
									}
								}
								else
								{
									ArrayList temp_mlist=new ArrayList();
									temp_mlist.add(tmp_msmt_host);
									testWithMsmtHostHash.put(test_name,(ArrayList)temp_mlist);
								}
							}
						}
					}
				}
			}
			
			if (rsReport != null)
				rsReport.close();
			rsReport = null;

			egDb.releaseConnection(false);
		}//End Of Try Block
		catch(Throwable e)
		{
			e.printStackTrace();
			if(!conn.equals("CONNECTED"))
			{
				errormsg.put("Msgfortest",mappingInfo.getTextDescription("monitor.layermodel.Connection could not be established"));
			}
			else if(!state1)
			{
				errormsg.put("Msgfortest",mappingInfo.getTextDescription("monitor.layermodel.Error in Sql Query"));
			}
			else
			{
				//out.println(e.toString());
				errormsg.put("Msgfortest","Some error has occurred");
			}

			if (rsReport != null)
			{
				try
				{
					rsReport.close();
					rsReport = null;
				}
				catch (Exception bug123) {}
			}
			try
			{
				egDb.releaseConnection(true);
			}
			catch(Exception e2)
			{
				e2.printStackTrace();
			}
		} //End Of Class Block
		finally
		{
			EgDbAdapterTypeUI.releaseObject(egDb);
		}

		try
		{
			Vector reportTableData = new Vector();
			for(int jj =0; jj < dummyVector.size() ; jj= jj+3)
			{
				String sickStr = (String) dummyVector.get(jj);
				String overallstate = (String) dummyVector.get(jj+1);
				String chk1 = (String) dummyVector.get(jj+2);
				boolean fs = false;
				Enumeration ee3 = testsForLayer.keys();
				while (ee3.hasMoreElements())
				{
					String reallysick = (String) ee3.nextElement();
					// There is a state change irrespective of the info
					if (reallysick.startsWith(sickStr))
					{
						//Check for msmt_host
						ArrayList al = (ArrayList) testsForLayer.get(reallysick);
						if (al == null)
							continue;
						for (int r=0; r<al.size(); r=r+2)
						{
						   // Check for msmt_host
							String chk2 = (String) al.get(r+1);
							if(chk1!=null&&chk2!=null&&chk1.equals(chk2))
							{
								//change state only if not bad
								chk2 = (String) al.get(r);
								overallstate = ap.getHigherPriority(chk2, overallstate);
								al.set(r,overallstate);
							}
							else if(chk2!=null&&chk2.equals(""))
								al.set(r,dummyVector.get(jj+1));
						}
					}
				}
			}
			String tmpStr =null;
			String tmpStr2 =null;
			for(int i =0;i< rept.size();i=i+3)
			{
				String stateFromAlarmTable = null;
				boolean sameMHosts= false;
				tmpStr =(String) rept.get(i);
				String  MHost1 = (String) rept.get(i+2);
				tmpStr = tmpStr;
				int x;
				String stateForInfo = null;
				//fix starts 
				ArrayList al = (ArrayList) testsForLayer.get(tmpStr);
				if(customSubTreeList != null){
					for(int kk=0;kk<customSubTreeList.size();kk++){
						String customSubTreeIn = (String)customSubTreeList.get(kk);
						if(tmpStr.startsWith(customSubTreeIn)){
							tmpStr=customSubTreeIn+"-+"+tmpStr.substring(tmpStr.indexOf(":")+1,tmpStr.length());
						}
					}
				}
				
				int foundIndex = -1;
				if (al != null)
				{
					for (int r=0; r<al.size(); r= r+2)
					{
						String MHost2 = (String) al.get(r+1);
						stateForInfo = (String)al.get(r);
						if (MHost2.equals(MHost1))
						{
							sameMHosts = true;
							foundIndex = r;
							break;
						}
					}
				}
				String testInfo = tmpStr.substring(tmpStr.indexOf("+"));
				String testComp = tmpStr.substring(0,tmpStr.indexOf("-"));
				String check="yes";

				if(isMoreInfosTreeView && testComp!=null && !moreInfoTest.equalsIgnoreCase(testComp))
					continue;

				stateFromAlarmTable = EgAlarmTable.getTestPriority(hostName,hostType,layerName,testInfo,testComp,MHost1,"",check);		
				if (EgConfigInfo.isBad(stateForInfo))
				{
					if(stateFromAlarmTable!=null&&!stateFromAlarmTable.equals(""))
						stateForInfo=stateFromAlarmTable;
				}
				if (EgConfigInfo.isBad((String) rept.get(i+1)))
				{
					if(stateFromAlarmTable!=null&&!stateFromAlarmTable.equals(""))
						 rept.set(i+1,stateFromAlarmTable);
				}
				if(sameMHosts)
				{
					if (EgConfigInfo.isBad(stateForInfo))
						al.set(foundIndex, stateForInfo);
					else
					{
						String s = ap.getHigherPriority(stateForInfo, (String) rept.get(i+1));
						al.set(foundIndex, s);
					}
				}
				else
				{
					//Hot fix - 14/04/2001 
					//To eliminate inconsistent display caused due to inconsistent Data
					int k;
					boolean addreportData = true;
					Enumeration ee4 = testsForLayer.keys();
					boolean isMHost1Empty = (MHost1.length() == 0);
					int index = -1;
					while (ee4.hasMoreElements())
					{
						String realCompTest = (String) ee4.nextElement();
						if (realCompTest.startsWith(tmpStr))
						{
							String compTest = realCompTest.substring(0,realCompTest.indexOf("-+")+2);
							boolean equal = tmpStr.equals(compTest);
							if (!equal)
								continue;
							ArrayList cl = (ArrayList) testsForLayer.get(realCompTest);
							if (cl == null)
								continue;
							boolean found = false;
							for (int r=0; r<cl.size(); r= r+2)
							{
								String Mhost = (String) cl.get(r+1);
								if (!isMHost1Empty && Mhost.equals(""))
									addreportData = false;
								if (MHost1.equals(Mhost))
								{
									found = true;
									index = r;
									break;
								}
							}
							if (index >= 0)
								break;
						}
					}
					if (index < 0 && addreportData)
					{ // // not equals match - lets do startsWith
						Enumeration ee = testsForLayer.keys();
						int ind = -1;
						String matchedKey = "";
						while (ee.hasMoreElements())
						{
							String realCompTest = (String) ee.nextElement();
							String compTest = realCompTest.substring(0,realCompTest.indexOf("-+")+2);
							if (tmpStr.startsWith(compTest))
							{
								ArrayList al4 = (ArrayList) testsForLayer.get(realCompTest);
								if (al4 == null)
									continue;
								for (int r=0; r<al4.size(); r=r+2)
								{
									String Mhost = (String) al4.get(r+1);
									if (MHost1.equals(Mhost))
									{
										ind = r;
										matchedKey = realCompTest;
										break;
									}
								}
							}
							if (ind >= 0)
								break;
						}
						if (ind >= 0)
						{
							ArrayList al5 = (ArrayList) testsForLayer.get(matchedKey);
							String chk2 = (String) al5.get(ind+1);
							//To check if both measurement hosts are same
							if (MHost1.equals(chk2) || chk2.length() == 0)
							{
								String pain = (String) al5.get(ind);
								String s = ap.getHigherPriority(pain,(String) rept.get(i+1));

								ArrayList bl = (ArrayList) testsForLayer.get((String) rept.get(i));
								if (bl == null)
								{
									bl = new ArrayList();
									bl.add(s);
									bl.add(rept.get(i+2));
									testsForLayer.put((String) rept.get(i),bl);
								} else {
									bl.add(s);
									bl.add(rept.get(i+2));
								}
								
								if (al5.size() == 2)
								{
									//Fix to show info which exist in report table but removed while timeout
									if(timeoutinfo == null || timeoutinfo.size() == 0  || !(timeoutinfo.contains(matchedKey)))
									{
										testsForLayer.remove(matchedKey);
									}
								} 
								else 
								{
									al5.remove(ind);
									al5.remove(ind); // remove state and mhost
								}
							}
						}
						else
						{
							ArrayList al6 = (ArrayList) testsForLayer.get(tmpStr);
							if (al6 == null)
							{
								al6 = new ArrayList();
								al6.add((String) rept.get(i+1));
								al6.add((String) rept.get(i+2));
								testsForLayer.put(tmpStr,al6);
							} else {
								al6.add((String) rept.get(i+1));
								al6.add((String) rept.get(i+2));
								//multipleMsmtTestsForLayer.put(tmpStr, new Boolean (true));
							}
						}
					}
				}
			}
			//Hot fix to remove inconsistent display due to inconsistent data in metatest and report table
			String hostColor = null;
			/*
			 * Fixed by checking to see if the index of the priority is atthe second place for every row.
			 */
			boolean isBad = false;
			boolean isUnknown = false;
			Enumeration ee1 = testsForLayer.keys();
			List finalTestsForLayer = new LinkedList();
			Hashtable removeSubTreeHash = new Hashtable();
			Hashtable finalInterfacesForLayer = new Hashtable();
			Hashtable finalInterfacesDescForLayer = new Hashtable();
			ArrayList removeSubTreeList=new ArrayList();
			while (ee1.hasMoreElements())
			{
				String key = (String) ee1.nextElement();
				int key_inx=key.indexOf("-");
				String temp_test=key.substring(0,key_inx);
				if(temp_test!=null)
					temp_test=temp_test;
				if(subTreeTestsList!=null && subTreeTestsList.size()>0 && temp_test!=null && subTreeTestsList.contains(temp_test))
				{
					String test_seprater=(String)egUI.getValue("TEST_PANEL_SUBTREE",temp_test);
					test_seprater=(test_seprater==null || test_seprater.trim().length()==0)?":":test_seprater;
					int test_sep_len=test_seprater.length();
					String temp_key ="";
					String temp_info="";
					if(key.length()>(key_inx+1))
					{
						temp_info=key.substring(key_inx+1);
					}
					ArrayList tmpInfosList = new ArrayList();
					boolean isAllowSub=true;
					if(temp_info!=null)
					{
						temp_info=temp_info;
						tmpInfosList =  com.egurkha.util.StringUtils.egTokenizer(temp_info,test_seprater,true,true,true);//param 3-->includeEmpty,4-->unique,5-->trim
						
						int info_size=0;
						if(tmpInfosList!=null)
							info_size = tmpInfosList.size();

						if(info_size==2)
						{
							String endTok=(String)tmpInfosList.get(1);
							if(endTok==null || endTok.trim().length()==0)
								isAllowSub=false;
						}
					}
					
					String temp_interface="";
					String temp_desc="";
					//if(temp_info!=null && temp_info.indexOf(test_seprater)>-1 && !temp_info.endsWith(test_seprater))
					if(isAllowSub && temp_info!=null && temp_info.indexOf(test_seprater)>-1)
					{
						if(temp_info.startsWith("+"+test_seprater)){
							temp_info="+"+temp_info.substring(2);
						}
							
						temp_interface=temp_info.substring(0,temp_info.indexOf(test_seprater));
						//if(temp_interface!=null)
						//	temp_interface=temp_interface;

						if(isInterface!=null && (isInterface.equalsIgnoreCase("yes") || isInterface.equalsIgnoreCase("true")) && selectedInterface!=null && selectedInterface.trim().length()>0)
						{
							if(temp_interface!=null)
							{
								if(!temp_interface.equals("+"+selectedInterface))
								{
									if(!temp_info.startsWith("+"+selectedInterface))
										continue;
								}
							}
						}
						try
						{
							temp_desc=temp_info.substring(temp_info.indexOf(test_seprater)+test_sep_len);
							if(temp_desc!=null && temp_desc.trim().length()>0)
								temp_desc=temp_desc.trim();
						}
						catch(Exception e)
						{}

						temp_key = temp_test + "-" + temp_interface.trim();

						ArrayList al = (ArrayList) testsForLayer.get(key);
						if (al == null)
							continue;

						removeSubTreeHash.put(temp_test,"yes");
						if(removeSubTreeList!=null && removeSubTreeList.contains(temp_test))
						{
							removeSubTreeList.remove(temp_test);
						}

						// No need to remove msmt_host for morethen one msmt_host for a test
						// by Saravanan.A on 25-4-2012
						ArrayList temp_m_list=(ArrayList)testWithMsmtHostHash.get(temp_test);

						if(temp_m_list==null || (temp_m_list!=null && temp_m_list.size()==1))
						{
							if (al.size() == 2)
								al.set(1,"");
						}
						else if(temp_m_list!=null && temp_m_list.size()>1 && !dummyVector.contains(temp_test+"-+"))
						{
							if (al.size() == 2)
								al.set(1,"");
						}
						/*else if(temp_m_list!=null && temp_m_list.size()>1) 
						{
							for(int i=0;i<temp_m_list.size();i++)
							{
								String temp_msmthost = (String) temp_m_list.get(i);
								String temp_key1 = key + "-$-" + temp_msmthost;
								if(!dummyVector.contains(temp_msmthost) && (removedMsmthost.contains(temp_test+"-+") || removedMsmthost.contains(temp_key1)))
								{
									if (al.size() == 2)
										al.set(1,"");
									break;
								}
							}
						}*/
						
						//---end---

						if(finalInterfacesForLayer!=null && !finalInterfacesForLayer.containsKey(temp_key))
						{
							finalInterfacesForLayer.put(temp_key,(ArrayList)al);
							Hashtable temp_hash=new Hashtable();
							Hashtable temp_more_msmt_hash=new Hashtable();
							if(al!=null && al.size()>2)
							{
								for(int st=0;st<al.size();st=st+2)
								{
									try
									{
										String info_state=(String)al.get(st);
										String info_msmt_host=(String)al.get(st+1);
										if(info_msmt_host!=null && info_msmt_host.trim().length()>0)
											temp_more_msmt_hash.put(key+"~MH~"+info_msmt_host,(String)info_state);
									}
									catch(Exception ee)
									{
										ee.printStackTrace();
									}
								}
							}

							temp_hash.put(key,(String) al.get(0));
							finalInterfacesDescForLayer.put(temp_key,(Hashtable)temp_hash);
							finalInterfacesDescForLayer.put(temp_key+"_MoreMsmt",(Hashtable)temp_more_msmt_hash);
						}
						else
						{
							ArrayList al_old=(ArrayList)finalInterfacesForLayer.get(temp_key);
							Hashtable temp_hash=(Hashtable)finalInterfacesDescForLayer.get(temp_key);
							Hashtable temp_more_msmt_hash=(Hashtable)finalInterfacesDescForLayer.get(temp_key+"_MoreMsmt");
							if(al_old!=null && al_old.size()>0 && al!=null && al.size()>0)
							{
								for(int st=0;st<al.size();st=st+2)
								{
									try
									{
										String info_state_new=(String)al.get(st);
										String info_msmt_host_new=(String)al.get(st+1);

										String info_state_old=(String)al_old.get(st);
										String info_msmt_host_old=(String)al_old.get(st+1);

										String latest_prior = ap.getHigherPriority(info_state_old, info_state_new);

										al_old.set(st,latest_prior);
									}
									catch(Exception ee)
									{
										ee.printStackTrace();
									}
								}
								finalInterfacesForLayer.put(temp_key,(ArrayList)al_old);
							}

							if(temp_hash!=null && temp_hash.size()>0)
							{
								if(temp_more_msmt_hash==null)
									temp_more_msmt_hash=new Hashtable();

								if(al!=null && al.size()>2)
								{
									for(int st=0;st<al.size();st=st+2)
									{
										try
										{
											String info_state=(String)al.get(st);
											String info_msmt_host=(String)al.get(st+1);
											if(info_msmt_host!=null && info_msmt_host.trim().length()>0)
												temp_more_msmt_hash.put(key+"~MH~"+info_msmt_host,(String)info_state);
										}
										catch(Exception ee)
										{
											ee.printStackTrace();
										}
									}
								}

								temp_hash.put(key,(String) al.get(0));
								finalInterfacesDescForLayer.put(temp_key,(Hashtable)temp_hash);
								finalInterfacesDescForLayer.put(temp_key+"_MoreMsmt",(Hashtable)temp_more_msmt_hash);
							}
							else
							{
								temp_hash=new Hashtable();
								temp_more_msmt_hash=new Hashtable();
								if(al!=null && al.size()>2)
								{
									for(int st=0;st<al.size();st=st+2)
									{
										try
										{
											String info_state=(String)al.get(st);
											String info_msmt_host=(String)al.get(st+1);
											if(info_msmt_host!=null && info_msmt_host.trim().length()>0)
												temp_more_msmt_hash.put(key+"~MH~"+info_msmt_host,(String)info_state);
										}
										catch(Exception ee)
										{
											ee.printStackTrace();
										}
									}
								}

								temp_hash.put(key,(String) al.get(0));
								finalInterfacesDescForLayer.put(temp_key,(Hashtable)temp_hash);
								finalInterfacesDescForLayer.put(temp_key+"_MoreMsmt",(Hashtable)temp_more_msmt_hash);
							}
						}
					}
					else
					{
						// For Subtree test have both subtree infos and non-subtree infos changes.
						// by Saravanan.A on 19-4-2012

						temp_key = temp_test + "-" + temp_info;
						ArrayList al = (ArrayList) testsForLayer.get(key);
						if (al == null)
							continue;

						ArrayList temp_m_list=(ArrayList)testWithMsmtHostHash.get(temp_test);
						if(temp_m_list==null || (temp_m_list!=null && temp_m_list.size()==1))
						{
							if (al.size() == 2)
								al.set(1,"");
						}
						else if(temp_m_list!=null && temp_m_list.size()>1 && !dummyVector.contains(temp_test+"-+"))
						{
							if (al.size() == 2)
								al.set(1,"");
						}
						/*else if(temp_m_list!=null && temp_m_list.size()>1) 
						{
							for(int i=0;i<temp_m_list.size();i++)
							{
								String temp_msmthost = (String) temp_m_list.get(i);
								String temp_key1 = key + "-$-" + temp_msmthost;
								if(!dummyVector.contains(temp_msmthost) && (removedMsmthost.contains(temp_test+"-+") || removedMsmthost.contains(temp_key1)))
								{
									if (al.size() == 2)
										al.set(1,"");
									break;
								}
							}
						}*/
						
						if(finalInterfacesForLayer!=null && !finalInterfacesForLayer.containsKey(temp_key))
						{
							finalInterfacesForLayer.put(temp_key,(ArrayList)al);
							Hashtable temp_hash=new Hashtable();
							Hashtable temp_more_msmt_hash=new Hashtable();
							if(al!=null && al.size()>2)
							{
								for(int st=0;st<al.size();st=st+2)
								{
									try
									{
										String info_state=(String)al.get(st);
										String info_msmt_host=(String)al.get(st+1);
										if(info_msmt_host!=null && info_msmt_host.trim().length()>0)
											temp_more_msmt_hash.put(key+"~MH~"+info_msmt_host,(String)info_state);
									}
									catch(Exception ee)
									{
										ee.printStackTrace();
									}
								}
							}

							temp_hash.put(key,(String) al.get(0));
							finalInterfacesDescForLayer.put(temp_key,(Hashtable)temp_hash);
							finalInterfacesDescForLayer.put(temp_key+"_MoreMsmt",(Hashtable)temp_more_msmt_hash);
						}
						else
						{
							ArrayList al_old=(ArrayList)finalInterfacesForLayer.get(temp_key);
							Hashtable temp_hash=(Hashtable)finalInterfacesDescForLayer.get(temp_key);
							Hashtable temp_more_msmt_hash=(Hashtable)finalInterfacesDescForLayer.get(temp_key+"_MoreMsmt");
							if(al_old!=null && al_old.size()>0 && al!=null && al.size()>0)
							{
								for(int st=0;st<al.size();st=st+2)
								{
									try
									{
										String info_state_new=(String)al.get(st);
										String info_msmt_host_new=(String)al.get(st+1);

										String info_state_old=(String)al_old.get(st);
										String info_msmt_host_old=(String)al_old.get(st+1);

										String latest_prior = ap.getHigherPriority(info_state_old, info_state_new);

										al_old.set(st,latest_prior);
									}
									catch(Exception ee)
									{
										ee.printStackTrace();
									}
								}

								/*String prior = (String) al.get(0);
								String old_prior = (String) al_old.get(0);

								old_prior = ap.getHigherPriority(old_prior, prior);
								al_old.set(0,old_prior);*/

								finalInterfacesForLayer.put(temp_key,(ArrayList)al_old);
							}

							if(temp_hash!=null && temp_hash.size()>0)
							{
								if(temp_more_msmt_hash==null)
									temp_more_msmt_hash=new Hashtable();

								if(al!=null && al.size()>2)
								{
									for(int st=0;st<al.size();st=st+2)
									{
										try
										{
											String info_state=(String)al.get(st);
											String info_msmt_host=(String)al.get(st+1);
											if(info_msmt_host!=null && info_msmt_host.trim().length()>0)
												temp_more_msmt_hash.put(key+"~MH~"+info_msmt_host,(String)info_state);
										}
										catch(Exception ee)
										{
											ee.printStackTrace();
										}
									}
								}

								temp_hash.put(key,(String) al.get(0));
								finalInterfacesDescForLayer.put(temp_key,(Hashtable)temp_hash);
								finalInterfacesDescForLayer.put(temp_key+"_MoreMsmt",(Hashtable)temp_more_msmt_hash);
							}
							else
							{
								temp_hash=new Hashtable();
								temp_more_msmt_hash=new Hashtable();
								if(al!=null && al.size()>2)
								{
									for(int st=0;st<al.size();st=st+2)
									{
										try
										{
											String info_state=(String)al.get(st);
											String info_msmt_host=(String)al.get(st+1);
											if(info_msmt_host!=null && info_msmt_host.trim().length()>0)
												temp_more_msmt_hash.put(key+"~MH~"+info_msmt_host,(String)info_state);
										}
										catch(Exception ee)
										{
											ee.printStackTrace();
										}
									}
								}
								temp_hash.put(key,(String) al.get(0));
								finalInterfacesDescForLayer.put(temp_key,(Hashtable)temp_hash);
								finalInterfacesDescForLayer.put(temp_key+"_MoreMsmt",(Hashtable)temp_more_msmt_hash);
							}
						}

						if(removeSubTreeHash!=null && !removeSubTreeHash.containsKey(temp_test))
						{
							if(removeSubTreeList!=null && !removeSubTreeList.contains(temp_test))
								removeSubTreeList.add(temp_test);
						}
					}
				}
				else
				{
					ArrayList al = (ArrayList) testsForLayer.get(key);
					if (al == null)
						continue;

					// No need to remove msmt_host for morethen one msmt_host for a test
					// by Saravanan.A on 25-4-2012
					ArrayList temp_m_list=(ArrayList)testWithMsmtHostHash.get(temp_test);

					if(temp_m_list==null || (temp_m_list!=null && temp_m_list.size()==1))
					{
						if (al.size() == 2)
							al.set(1,"");
					}
					else if(temp_m_list!=null && temp_m_list.size()>1 && !dummyVector.contains(temp_test+"-+"))
					{
						if (al.size() == 2)
							al.set(1,"");
					}
					/*else if(temp_m_list!=null && temp_m_list.size()>1) 
					{
						for(int i=0;i<temp_m_list.size();i++)
						{
							String temp_msmthost = (String) temp_m_list.get(i);
							String temp_key1 = key + "-$-" + temp_msmthost;
							if(!dummyVector.contains(temp_msmthost) && (removedMsmthost.contains(temp_test+"-+") || removedMsmthost.contains(temp_key1)))
							{
								if (al.size() == 2)
									al.set(1,"");
								break;
							}
						}
					}*/
					//---end---

					for (int r=0; r<al.size(); r=r+2)
					{
						String prior = (String) al.get(r);
						if (EgConfigInfo.isBad(prior))
							isBad = true;
						else if (EgConfigInfo.isUnknown(prior))
							isUnknown = true;
						finalTestsForLayer.add(key);
						finalTestsForLayer.add(prior);
						finalTestsForLayer.add((String) al.get(r+1));
					}
				}
			}
			
			if(finalInterfacesForLayer!=null && finalInterfacesForLayer.size()>0)
			{
				if(removeSubTreeList!=null && removeSubTreeList.size()>0 && subTreeTestsList!=null && subTreeTestsList.size()>0)
				{
					for (int r=0; r<removeSubTreeList.size(); r++)
					{
						String removed_test = (String) removeSubTreeList.get(r);
						if(subTreeTestsList.contains(removed_test))
							subTreeTestsList.remove(removed_test);
					}
				}
				Enumeration ee2 = finalInterfacesForLayer.keys();
				while (ee2.hasMoreElements())
				{
					String key = (String) ee2.nextElement();

					int key_inx=key.indexOf("-");
					String temp_test=key.substring(0,key_inx);
					if(temp_test!=null)
						temp_test=temp_test;

					ArrayList al = (ArrayList) finalInterfacesForLayer.get(key);
					if (al == null)
						continue;

					// No need to remove msmt_host for morethen one msmt_host for a test
					// by Saravanan.A on 25-4-2012
					ArrayList temp_m_list=(ArrayList)testWithMsmtHostHash.get(temp_test);

					if(temp_m_list==null || (temp_m_list!=null && temp_m_list.size()==1))
					{
						if (al.size() == 2)
							al.set(1,"");
					}
					else if(temp_m_list!=null && temp_m_list.size()>1 && !dummyVector.contains(temp_test+"-+"))
					{
						if (al.size() == 2)
							al.set(1,"");
					}
					int lev = 2;
					if(customSubTreeList != null){
						if(customSubTreeList.contains(temp_test))
						lev = al.size();
					}

					for (int r=0; r<al.size(); r=r+lev)
					{
						String prior = (String) al.get(r);
						if (EgConfigInfo.isBad(prior))
							isBad = true;
						else if (EgConfigInfo.isUnknown(prior))
							isUnknown = true;

						finalTestsForLayer.add(key);
						finalTestsForLayer.add(prior);
						finalTestsForLayer.add((String) al.get(r+1));
					}
				}
				finalInterfacesForLayer=new Hashtable();
			}

			if (isBad || isMoreInfosTreeView)
			{
				if (layerName.equals(LayerModel.WEB_SITE) || layerName.equals(LayerModel.WEB_TRANSACTIONS))
					hostColor = ap.getLayerPriority(hostName, hostType, siteName, layerName);
				else
					hostColor = ap.getLayerPriority(hostName, hostType, layerName);
			}
			else if (isUnknown)
				hostColor = AlarmPriorities.UNKNOWN_STATE;
			else
				hostColor = AlarmPriorities.GOOD_STATE;

			if(hostColor!=null && hostColor.trim().length()>0)
				currLayerState = hostColor;

			ArrayList listOfTest=(ArrayList)tableInfo.getTestsForLayer(layerName,hostType);
			
			//Added by ChandraSekhar.P
			if((listOfTest == null || listOfTest.size()==0) && finalTestsForLayer.size()==0)
			{
				//egDb.releaseConnection(false);
				errormsg.put("Msgfortest",mappingInfo.getTextDescription("monitor.layermodel.No tests are enabled for this layer!"));
			}
			else if(listOfTest!=null && listOfTest.size()>0 && finalTestsForLayer.size()==0)
			{
				/*String disable_value=null;
				
				if(isAppLayer)
					disable_value=disableIniObj.getValue(hostType,hostType+":"+hostName);
				else
					disable_value=disableIniObj.getValue("Default_server","Default_server:"+hostName);

				if(disable_value!=null && disable_value.trim().length()>0)
				{
					listOfTest =  com.egurkha.util.StringUtils.egTokenizer(disable_value.trim(), ",",false,true,true);//param 3-->includeEmpty,4-->unique,5-->trim
				}*/

				//if(listOfTest!=null && listOfTest.size()>0 && finalTestsForLayer.size()==0)
				if(dispTestList!=null && dispTestList.size()>0 && finalTestsForLayer.size()==0)
				{
					//egDb.releaseConnection(false);
					errormsg.put("Msgfortest",mappingInfo.getTextDescription("monitor.layermodel.No Tests are running currently for this layer !"));
				}
				else
				{
					//egDb.releaseConnection(false);
					errormsg.put("Msgfortest",mappingInfo.getTextDescription("monitor.layermodel.No tests are enabled for this layer!"));
				}
			}//Ended Here...
			else
			{
				//Passing to the function to decide on the display of msmt_host
				//Contains the priorities for each test as (TestName, Priority) pairs
				//Map testPriorities = egDb.getPriorityForTestOrMeasure(hostName, hostType, layerName, null);
				//egDb.releaseConnection(false);
				if (finalTestsForLayer.size () > 0)
				{
					LayerModel lm = new LayerModel(finalTestsForLayer, request);
					com.egurkha.monitor.Test[] tests = lm.getTests();
					
					if(compTypeName!=null && compTypeName.trim().length()>0 && compTypeName.equalsIgnoreCase("Yes"))
					{
						if(layer!=null && layer.trim().length()>0 && layer.equalsIgnoreCase(layerName))
						{
							JSONObject liveGraphJson = new JSONObject();
							
							liveGraphJson.put("liveGraphURL","/final/monitor/livegraph/EgVmwareLiveGraphHome.jsp?comptype="+hostType+"&er_component="+hostName);
							liveGraphJson.put("liveGraphTooltip",mappingInfo.getTextDescription("monitor.livegraph.Virtual Metrics"));
							json.put("liveGraph", liveGraphJson);

							String virtualLiveGraphURL="/final/monitor/livegraph/EgVmwareLiveGraphHome.jsp?comptype="+EgURLEncoder.encode(hostType,"UTF-8")+"&er_component="+EgURLEncoder.encode(hostName,"UTF-8");

							json.put("liveGraphDiv", "<div id=\"virtualLive\" class=\"iconLiveGraph iconLiveGraphPosition\" href=\"javascript:void(0);\" data-qtip=\""+mappingInfo.getTextDescription("monitor.livegraph.Virtual Metrics")+"\" onclick=goToLiveGraph(\""+virtualLiveGraphURL+"\") data-qclass=\"yellowTip\"></div>");
						}
					}

					if(!searchBoxNeed)
					{
						boolean isSearch = (searchString==null||searchString.equals("null")||searchString.equals(""));
						if (isSearch)
						{
							json.put("SearchRequired","true");
						}
						else
						{
							json.put("SearchRequired","false");
							if(egBackComplete!=null)
							{
								session.setAttribute("backButton","true");
							}
						}
					}
					String enable = transBean.getStrValue("ALLOW_INFO_EXPANDING","expand");
					String subInfosEnabled = transBean.getStrValue("ALLOW_INFO_EXPANDING","subInfosExpand");
					subInfosEnabled=(subInfosEnabled==null)?"":subInfosEnabled;
					String checkStr = "";
					String searchByDescriptor=transBean.getStrValue("ALLOW_INFO_EXPANDING","searchByDescriptor");
					if(enable.equalsIgnoreCase("True"))
					{
						checkStr = "checked";
					}

					if(searchByDescriptor==null || searchByDescriptor.trim().length()==0 || searchByDescriptor.equalsIgnoreCase("false"))
					{
						searchByDescriptor=request.getParameter("searchByDescriptor");
						if(searchByDescriptor==null || searchByDescriptor.trim().length()==0)
							searchByDescriptor="false";

						if(isMoreInfosTreeView)
							searchByDescriptor="true";
					}

					String checkedAll=request.getParameter("checkedAll");
					if(checkedAll!=null && checkedAll.equalsIgnoreCase("true"))
					{
						checkStr="checked";
						enable="True";
					}
					else if(checkedAll!=null && checkedAll.equalsIgnoreCase("false"))
					{
						checkStr="";
						enable="false";
					}

					json.put("checkBox",new Boolean(true));

					if((checkStr==null || checkStr.trim().length()==0) && enable.equalsIgnoreCase("false"))
					{
						json.put("checkBox",new Boolean(false));
					}

					boolean firstRow = true;
					int cc = tests.length-1;
					int infosForTest = 0;
					boolean colorChanger = false;
					if (searchString!=null && searchString.trim().length()>0)
					{
						searchString = searchString.toLowerCase();
						/*for(int i=0;i<tests.length;i++)
						{
							thiselement = (String)tests[i].getTestName();
							String thislab = (String)tests[i].getTestLabel(true);
							String tempTest = mappingInfo.getTestDescription(thiselement);

							thiselement = tempTest.toLowerCase();
							tempTest = tempTest.toLowerCase();

							if(searchByDescriptor!=null && searchByDescriptor.equalsIgnoreCase("false"))
							{
								if (tempTest.indexOf(searchString)==-1)
								{
									continue;
								}
								else
								{
									searchVec.add(thiselement);
									searchItemFound=true;
								}
							}
							else if(searchByDescriptor!=null && (searchByDescriptor.equalsIgnoreCase("true") || searchByDescriptor.equalsIgnoreCase("yes")))
							{
								
							}
						}*/
						Hashtable searchHash=(Hashtable)getValidSearchHash(finalTestsForLayer,finalInterfacesDescForLayer,searchByDescriptor,searchString,mappingInfo);
						if(searchHash!=null && searchHash.size()>0)
						{
							searchVec = (Vector)searchHash.get("OutputVec");
							validSearchList = (List)searchHash.get("ValidSearchList");
							validSearchInfosList = (List)searchHash.get("ValidSearchInfosList");
							searchItemFound = ((Boolean)searchHash.get("OutputBoolean")).booleanValue();
						}
						
						/*for(int i=0;i<finalTestsForLayer.size();i=i+3)
						{
							thiselement = (String)finalTestsForLayer.get(i);

							String compTest = thiselement.substring(0,thiselement.indexOf("-"));
							if(searchByDescriptor!=null && searchByDescriptor.equalsIgnoreCase("false"))
							{
								String tempTest = mappingInfo.getTestDescription(compTest);
								tempTest = tempTest.toLowerCase();
								if (tempTest.indexOf(searchString)==-1)
								{
									continue;
								}
								else
								{
									searchVec.add(thiselement);
									searchItemFound=true;
								}
							}
							else if(searchByDescriptor!=null && (searchByDescriptor.equalsIgnoreCase("true") || searchByDescriptor.equalsIgnoreCase("yes")))
							{
								String tmp_thiselement = thiselement.toLowerCase();

								if (tmp_thiselement.indexOf(searchString)==-1)
								{
									if(finalInterfacesDescForLayer!=null && finalInterfacesDescForLayer.containsKey(thiselement))
									{
										Hashtable temp_hash = (Hashtable)finalInterfacesDescForLayer.get(thiselement);

										if(temp_hash!=null && temp_hash.size()>0)
										{
											Enumeration ee2 = temp_hash.keys();
											while (ee2.hasMoreElements())
											{
												String keyelement = (String) ee2.nextElement();
												
												if (keyelement.toLowerCase().indexOf(searchString)==-1)
												{
													continue;
												}
												else
												{
													searchVec.add(keyelement);
													searchItemFound=true;
													break;
												}
											}
										}
									}
									else
										continue;
								}
								else
								{
									searchVec.add(tmp_thiselement);
									searchItemFound=true;
								}
							}
						}*/
					}
					String notest = (String)request.getAttribute("noTestFound");
					if(!searchItemFound && searchString!=null && (!searchString.equals("") || (notest!=null && notest.equals("yes"))))
					{
						errormsg.put("MsgforSearchTest",mappingInfo.getTextDescription("monitor.layermodel.No Test found for your search"));
						errormsg.put("SearchString",searchString);

						session.setAttribute("noTestFound","yes");
						session.setAttribute("searchItemFound","no");
						session.setAttribute("searchString",searchString);
					}
					if(searchByDescriptor!=null && searchByDescriptor.equalsIgnoreCase("true"))
					{
						errormsg.put("MsgforSearchTest",mappingInfo.getTextDescription("monitor.layermodel.No Descriptors found for your search"));
						errormsg.put("SearchString",searchString);
					}
					HashMap urlHash = null;
					JSONObject Testinfo_mobile = new JSONObject();
					boolean isHaveData=false;
					boolean isHaveAllData=false;
					// Adding tests to JSONArray starts here - Marked by Premkumar
					for (int a=0; a<tests.length; a++)
					{
						JSONObject Testinfo = new JSONObject();
						JSONArray descriptorsJsonArray = new JSONArray();
						JSONArray descriptorsJsonArray_mobile = new JSONArray();
						JSONObject  tArray=new  JSONObject();

						
						// Added by KNRaju for SearchByDescriptor on 12/17/2014
						if(searchByDescriptor!=null && searchByDescriptor.equalsIgnoreCase("false"))
						{
							thiselement = (String)tests[a].getTestName();
							String tempDis = mappingInfo.getTestDescription(thiselement);
							tempDis = tempDis.toLowerCase();
							if(searchString!=null)
								searchString = searchString.toLowerCase();
							if (tempDis!=null && searchString!=null && (tempDis.indexOf(searchString)==-1))
								continue;
						}
						else if(searchByDescriptor!=null && (searchByDescriptor.equalsIgnoreCase("true") || searchByDescriptor.equalsIgnoreCase("yes")))
						{
							thiselement = (String)tests[a].getTestName();
							if(validSearchList!=null && validSearchList.size()>0 && !validSearchList.contains(thiselement))
								continue;

							/*String testLabeltemp = (String)tests[a].getTestLabel(false);
							testLabeltemp = ui.getReverseLookupAll(testLabeltemp);
							testLabeltemp = testLabeltemp.trim();
							if(searchString!=null)
								  searchString = searchString.toLowerCase();
							if (testLabeltemp!=null && searchString!=null)
							{
								testLabeltemp=testLabeltemp.toLowerCase();
								if (testLabeltemp.indexOf(searchString)==-1)
								{
									continue;
								}
							}*/
						} // End of SearchByDescriptor 

						isHaveData=true;
						boolean nextTestExists = false;
						boolean isFinalElement=(a+1)<tests.length;
					
						if (a < cc)
						{
							com.egurkha.monitor.Test nextTest = tests[a+1];
							nextTestExists = (tests[a].getTestName().equals(nextTest.getTestName()));
						}
						colorChanger=!colorChanger;
						String colorId = colorChanger?"test_highlight":"";
						String testName = request.getParameter("test");
						if(testName!=null && testName.trim().length()>0)
						{
							//testName=URLDecoder.decode(testName);
							testName=com.egurkha.util.StringUtils.replace(testName,"|plus|","+");
							testName=com.egurkha.util.StringUtils.replace(testName,"|amp|","&");
							testName=com.egurkha.util.StringUtils.replace(testName,"|pct|","%");
							testName=com.egurkha.util.StringUtils.replace(testName,"|hash|","#");
							testName=com.egurkha.util.StringUtils.decodeSecurityChar(testName);
						}
						boolean  selectedTest =false;
						String sid="";
						StringTokenizer st=new StringTokenizer(hostName,":");
						String serverName=st.nextToken();
						String portNo=st.nextToken();
						if(st.countTokens()>0)
							sid=st.nextToken();
						String testNameForMaintenace= tests[a].getTestName();
						boolean isTestinMaintenance = egM.isItMaintenanceTime(testNameForMaintenace,dateInfo.egetDate(),true);
						boolean isHostTestinMaintenace=egM.isItMaintenanceTime(testNameForMaintenace,dateInfo.egetDate(),serverName,"","",true);
						boolean isCompTestinMaintenance=egM.isItMaintenanceTime(testNameForMaintenace,dateInfo.egetDate(),serverName,portNo,sid,true);
						List maintenaceTimePeriod=new ArrayList();
						List tempVec=new ArrayList();
						if(isTestinMaintenance)
						{
							tempVec=egM.getMaintenancePeriods(testNameForMaintenace);
							if(tempVec!=null)
							{
								maintenaceTimePeriod.addAll(tempVec);
							}
							tempVec=egM.getUnplannedMaintenancePeriods(testNameForMaintenace);
							if(tempVec!=null)
								maintenaceTimePeriod.addAll(tempVec);
						}
						if(isHostTestinMaintenace)
						{
							tempVec=egM.getMaintenancePeriods(testNameForMaintenace,serverName,"","",true);
							if(tempVec!=null)
							{
								maintenaceTimePeriod.addAll(tempVec);
							}
							tempVec=egM.getUnplannedMaintenancePeriods(testNameForMaintenace,serverName,"","",true);
							if(tempVec!=null)
								maintenaceTimePeriod.addAll(tempVec);
						}
						if(isCompTestinMaintenance)
						{
							tempVec=egM.getMaintenancePeriods(testNameForMaintenace,serverName,portNo,sid,true);
							if(tempVec!=null)
							{
								maintenaceTimePeriod.addAll(tempVec);
							}
							tempVec=egM.getUnplannedMaintenancePeriods(testNameForMaintenace,serverName,portNo,sid,true);
							if(tempVec!=null)
								maintenaceTimePeriod.addAll(tempVec);
						}
						showMaintenanceConfigIcon=false;
						if(allowMPolicyCreationForTestInLayerModel && (!isTestinMaintenance && !isHostTestinMaintenace && !isCompTestinMaintenance))
						{
							if (!EgInstallInfo.isSuperManager && !isSecondaryManager)
							{
								String strChildWindow = (String)session.getAttribute("isNewChildWindow");
								if(StringUtils.isNull(strChildWindow))
								{
									strChildWindow = "no";
								}
								isNotOpenNewWindow = (!StringUtils.isNull(strChildWindow) && strChildWindow.equalsIgnoreCase("no"));
								if(isAdmin)
								{
									showMaintenanceConfigIcon = true;
								}
								else if(hasAdminTab && hasMaintenancePolicyConfiguration)
								{
									showMaintenanceConfigIcon=true;
								}
							}
						}
						int noOfLines=maintenaceTimePeriod.size();
						ArrayList aListDummy = new ArrayList();
						aListDummy.addAll(maintenaceTimePeriod);

						String maintenaceTimePeriodStr= "";

						if(isTestinMaintenance || isHostTestinMaintenace || isCompTestinMaintenance)
						{
							maintenaceTimePeriodStr = maintenanceUtil.convertMaintenacevectorToString(aListDummy,user);
						}

						if (nextTestExists)
						{
							selectedTest = testName.indexOf(tests[a].getTestName())>=0 && testName.startsWith((tests[a].getTestName()+"-"));
							String qryStr = response.encodeURL("../servlet/com.eg.EgMonitorController?")+"monCmd=descComparison&testName="+ui.getReverseLookupAll(tests[a].getTestName())+"&serviceName="+EgURLEncoder.encode(siteName,"UTF-8")+"&componentName="+EgURLEncoder.encode(hostName,"UTF-8")+"&layerName="+EgURLEncoder.encode(layerName,"UTF-8")+"&componentType="+EgURLEncoder.encode(hostType,"UTF-8");
							if(sessionId_sm != null)
							{
								qryStr+="&sessionId_SM="+sessionId_sm;
							}
							boolean selectInfo1 = false;
							String thisInfo = "";
							String tName = "";
							String testDisplay ="";
							String testLabeltemp="";
							String msmt_Host = "";
							ArrayList msmt_Hosts = new ArrayList();
							if (testName!= null && !testName.equals("") && !testName.equalsIgnoreCase("null"))
							{
								String testNameInfo = request.getParameter("test");

								if(testNameInfo!=null && testNameInfo.trim().length()>0)
								{
									//thisInfo = URLDecoder.decode(testNameInfo.substring(testNameInfo.indexOf("-")+1));
									thisInfo = testNameInfo.substring(testNameInfo.indexOf("-")+1);
								}
								else
								{
									//thisInfo = URLDecoder.decode(testName.substring(testName.indexOf("-")+1));
									thisInfo = testName.substring(testName.indexOf("-")+1);
								}

								if(thisInfo!=null && thisInfo.trim().length()>0)
								{
									thisInfo=com.egurkha.util.StringUtils.replace(thisInfo,"|plus|","+");
									thisInfo=com.egurkha.util.StringUtils.replace(thisInfo,"|amp|","&");
									thisInfo=com.egurkha.util.StringUtils.replace(thisInfo,"|pct|","%");
									thisInfo=com.egurkha.util.StringUtils.replace(thisInfo,"|hash|","#");
								}

								tName = testName.substring(0,testName.indexOf("-"));
								testDisplay = ui.getReverseLookupAll(tests[a].getTestName());

								if(thisInfo!=null && thisInfo.trim().length()>0)
								{
									thisInfo=ui.getReverseLookupAll(thisInfo);
								}

								for (int p=0; p<tests.length; p++)
								{
									msmt_Host = tests[p].getMsmtHost();
							
									if (!msmt_Host.equals("") && !msmt_Host.equals(null))
									{
										if(!msmt_Hosts.contains("(" + msmt_Host + ")"))
											msmt_Hosts.add("(" + msmt_Host + ")");
									}

									testLabeltemp = tests[p].getTestLabel(false);
									testLabeltemp = ui.getReverseLookupAll(testLabeltemp);
									//testLabeltemp = testLabeltemp;
									
									if (testLabeltemp.startsWith("("))
										a1.add(tName + "-  "+testLabeltemp);
									else a1.add(tName + "- "+testLabeltemp);
								}
								String chk = tests[a].getMsmtHost();
								if (!chk.equals("") && !chk.equals(null))
								{
									if (msmt_Hosts.size()>0)
									{
										for(int m=0;m<msmt_Hosts.size();m++)
										{
											msmt_Host = (String)msmt_Hosts.get(m);
											String temp = testName +"  "+msmt_Host;
											if(a1.contains(temp))
											{
												selectInfo1 = a1.contains(temp) && tName.equals(testDisplay);
												if((!selectInfo1) && subTreeTestsList!=null && subTreeTestsList.size()>0 && tName!=null && subTreeTestsList.contains(tName))
												{
													String test_seprater=(String)egUI.getValue("TEST_PANEL_SUBTREE",tName);
													test_seprater=(test_seprater==null || test_seprater.length()==0)?":":test_seprater;
													int test_sep_len=test_seprater.length();
													if(temp!=null && temp.indexOf(test_seprater)>-1)
													{
														String temp_interface=temp.substring(0,temp.indexOf(test_seprater));
														//if(temp_interface!=null)
														//	temp_interface=temp_interface;

														selectInfo1 = a1.contains(temp_interface) && tName.equals(testDisplay);
													}
												}

											}
										}
										
									}
								}
								else
								{
									selectInfo1 = a1.contains(testName) && tName.equals(testDisplay);

									if((!selectInfo1) && subTreeTestsList!=null && subTreeTestsList.size()>0 && tName!=null && subTreeTestsList.contains(tName))
									{
										String test_seprater=(String)egUI.getValue("TEST_PANEL_SUBTREE",tName);
										test_seprater=(test_seprater==null || test_seprater.trim().length()==0)?":":test_seprater;
										int test_sep_len=test_seprater.length();
										if(testName!=null && testName.indexOf(test_seprater)>-1)
										{
											String temp_interface=testName.substring(0,testName.indexOf(test_seprater));
											//if(temp_interface!=null)
											//	temp_interface=temp_interface;

											selectInfo1 = a1.contains(temp_interface) && tName.equals(testDisplay);
										}
									}
								}
							}
							
							String testStateImage = null;
							if(isMoreInfosTreeView)
							{
								if(layersForHostSystem!=null && layersForHostSystem.contains(layerName))
								{
									testStateImage = (String)ap.getTestPriority(hostName, "Host_system", layerName, tests[a].getTestName().replace(' ', '+'));
								}
								else
									testStateImage = (String)ap.getTestPriority(hostName, hostType, layerName, tests[a].getTestName().replace(' ', '+'));

							}
							if(testStateImage!=null && testStateImage.trim().length()>0)
								Testinfo.put("iconCls","state_"+testStateImage);
							else
								Testinfo.put("iconCls","state_"+tests[a].getTestState());

							if(enable.equalsIgnoreCase("True"))
							{
								selectInfo1 = true;
							}

							if(isLayerClicked)// when layer clicked
							{
								selectedTest=false;
							}
							String msmt_hst_mobile=(String)tests[a].getTestName();
							
							if(disableDescFlag)
								Testinfo.put("text",mappingInfo.getTestDescription(""+ui.getReverseLookupAll(tests[a].getTestName())));
							else
							{
								String comparisonTooltip = mappingInfo.getTextDescription("monitor.common.Comparison");
								if(showMaintenanceConfigIcon)
								{
									Testinfo.put("text",mappingInfo.getTestDescription(""+ui.getReverseLookupAll(tests[a].getTestName()))+"<div style=\"float:right;position:relative;\"><div style=\"position:absolute;top:"+topFalg+";right:10px\" >"+getMaintainenancePolicyConfigURL(tests[a].getTestName(),""+ui.getReverseLookupAll(tests[a].getTestName()),hostName,hostType,isApplicationLayer,mappingInfo)+"&nbsp;<a href=\"javascript:void(0);\" onclick=javascript:showDescriptorComparison(\""+qryStr+"\",event) class=\"comparison-image-container\"><img data-qtip=\""+comparisonTooltip+"\" data-qclass=\"yellowTip\" class=\"comparison-image iconComponentDetails\" src=\"/final/images/clear.png\"/></a></div><div>");
								}
								else
								{
									Testinfo.put("text",mappingInfo.getTestDescription(""+ui.getReverseLookupAll(tests[a].getTestName()))+"<div style=\"float:right;position:relative;\"><div style=\"position:absolute;top:"+topFalg+";right:10px\" ><a href=\"javascript:void(0);\" onclick=javascript:showDescriptorComparison(\""+qryStr+"\",event) class=\"comparison-image-container\"><img data-qtip=\""+comparisonTooltip+"\" data-qclass=\"yellowTip\" class=\"comparison-image iconComponentDetails\" src=\"/final/images/clear.png\"/></a></div><div>");
								}
								//	Testinfo.put("text",mappingInfo.getTestDescription(""+ui.getReverseLookupAll(tests[a].getTestName()))+"<div style=\"float:right;position:relative;\"><div style=\"position:absolute;top:"+topFalg+";right:10px\" ><a href=\"javascript:void(0);\" onclick=javascript:showDescriptorComparison(\""+qryStr+"\",event) class=\"comparison-image-container\"><img data-qtip=\""+comparisonTooltip+"\" data-qclass=\"yellowTip\" class=\"comparison-image iconComponentDetails\" src=\"/final/images/clear.png\"/></a></div><div>");
							}

							//Testinfo.put("text",mappingInfo.getTestDescription(""+ui.getReverseLookupAll(tests[a].getTestName()))+"<div style=\"float:right;position:relative;\"><div style=\"position:absolute;top:5px;right:10px\" ><a href=\"javascript:void(0);\" onclick=javascript:showMoreInfos(\""+qryStr+"\",event) class=\"comparison-image-container\"><img data-qtip=\"Comparison\" data-qclass=\"yellowTip\" class=\"comparison-image iconComponentDetails\" src=\"/final/images/clear.png\"/></a></div><div>");

							Testinfo.put("selected",selectedTest);
							tArray.put("name",mappingInfo.getTestDescription(ui.getReverseLookupAll(tests[a].getTestName())));
							tArray.put("internalTestName",tests[a].getTestName());
							tArray.put("status",tests[a].getTestState());
							tArray.put("endhr",mgr_time);
							tArray.put("mgr_date",temp1);
							tArray.put("msmt_host",testWithMsmtHostHash.get(msmt_hst_mobile));
							if(isTestinMaintenance || isHostTestinMaintenace || isCompTestinMaintenance)
							{
								Testinfo.put("maintenaceTimePeriodStr",maintenaceTimePeriodStr);
								Testinfo.put("maintenanceNoOfLines",noOfLines);
							}
							/* Testinfo.put("comparisonLink",qryStr);
							Testinfo.put("comparisonTooltip","Comparison"); */

							if (selectInfo1)
							{
								Testinfo.put("tr_display_text",tr_display_text);
							}
							a1 = new ArrayList();

							int tempA=a;
							ArrayList tName2=new ArrayList();
							while (tempA < tests.length)
							{
								String testLabel = tests[tempA].getTestLabel(false);
								if((ui.getReverseLookupAll(testLabel)).trim().equals("More Infos"))
								{
									tName2.add(tests[tempA].getTestName());
								}
								tempA++;
							}
							boolean isMoreInfos=false;
							boolean isMoreSubInfos=false;
							String strMoreInfosURL=null;
							while (a < tests.length)
							{
								isMoreInfos=false;
								isMoreSubInfos=false;
								JSONObject descriptorsJson = new JSONObject();
								JSONObject descriptorsTreeJson = new JSONObject();
								JSONObject descriptorsJson_mobile = new JSONObject();
								tempUrl="";
								infosForTest++;

								/*
								 * Track the number of infos for this test
								 */
								String testLabel = tests[a].getTestLabel(false);
								// Added by KNRaju for SearchByDescriptor
								if(searchByDescriptor!=null  && searchByDescriptor.equalsIgnoreCase("true"))
								{
									if(searchString!=null && testLabel!=null)
									{
										searchString=searchString.toLowerCase();
										String testLblLwr=testLabel.toLowerCase();
										if(testLblLwr.indexOf(searchString)==-1)
										{
											if(selectedInterface==null || selectedInterface.trim().length()==0)
												testLabel=null;
										}
									}
								} //End of SearchByDescriptor
								//checking infoLabel as null or empty string
								if(testLabel == null || testLabel.length() == 0)
								{
									if (a < tests.length-1)
									{
										com.egurkha.monitor.Test nextTest = tests[a+1];
										nextTestExists = (tests[a].getTestName().equals(nextTest.getTestName()));
									}

									if (nextTestExists)
									{
										a++;
										continue;
									}
									else
									{
										break;
									}
								}
								//end

								String testNameForMaintenance=tests[a].getTestName();
								if(testNameForMaintenance!=null && testNameForMaintenance.length()>0)
									testNameForMaintenance=testNameForMaintenance;

								String curDatTime=dateInfo.egetDate();
								String descript=tests[a].getTestLabel(false);
								//if(descript!=null && descript.length()>0)
								//	descript=descript;
								final String frstDescr = descript;
								boolean isDescriptorMaintenanceForTest=egM.isItMaintenanceTime(testNameForMaintenance, curDatTime,descript,true);
								isPortRelevant = specsInfo.isPortRelevantForTest(testNameForMaintenance);
								if(!isPortRelevant)
								{
									portNo = "NULL";
								}
								boolean isDescriptorMaintenanceForComponentTest=egM.isItMaintenanceTime(testNameForMaintenance, curDatTime, serverName, portNo, sid,descript,true);

								List maintenancePeriodVec=new ArrayList();
								maintenaceTimePeriod=new ArrayList();

								maintenaceTimePeriod = (ArrayList)getMaintenanceComputing(egM,maintenaceTimePeriod,isDescriptorMaintenanceForTest,isDescriptorMaintenanceForComponentTest,testNameForMaintenance,descript,serverName,portNo,sid);

								/*if(isDescriptorMaintenanceForTest)
								{
									maintenancePeriodVec=egM.getMaintenancePeriods(testNameForMaintenance,descript);
									if(maintenancePeriodVec!=null && maintenaceTimePeriod!=null)
									{
										maintenaceTimePeriod.addAll(maintenancePeriodVec);
									}
									maintenancePeriodVec=egM.getUnplannedMaintenancePeriods(testNameForMaintenance,descript);
									if(maintenancePeriodVec!=null && maintenaceTimePeriod!=null)
										maintenaceTimePeriod.addAll(maintenancePeriodVec);
								}
								if(isDescriptorMaintenanceForComponentTest)
								{
									maintenancePeriodVec=egM.getMaintenancePeriods(testNameForMaintenance, serverName, portNo, sid,descript);
									if(maintenancePeriodVec!=null && maintenaceTimePeriod!=null)
									{
										maintenaceTimePeriod.addAll(maintenancePeriodVec);
									}
									maintenancePeriodVec=egM.getUnplannedMaintenancePeriods(testNameForMaintenance, serverName, portNo, sid,descript);
									if(maintenancePeriodVec!=null && maintenaceTimePeriod!=null)
										maintenaceTimePeriod.addAll(maintenancePeriodVec);
								}*/
								noOfLines=maintenaceTimePeriod.size();
								aListDummy = new ArrayList();
								aListDummy.addAll(maintenaceTimePeriod);

								String descriptorMaintenaceTimePeriodStr="";
								if((isDescriptorMaintenanceForTest || isDescriptorMaintenanceForComponentTest) && noOfLines>0)
								{
									descriptorMaintenaceTimePeriodStr=maintenanceUtil.convertMaintenacevectorToString(aListDummy,user);
								}

								String url = this.getUrl(tests[a], request,ui);
								String titleText = null;
								if(testLabel!=null)
									titleText=ui.getReverseLookupAll(testLabel);
								else titleText="";
								if (testLabel.trim().length() > 60)
								{
									testLabel = StringUtils.elipsis(testLabel, 60);
								}
								boolean  selectedMeasure = testName.indexOf(ui.getReverseLookupAll("+"+testLabel))>=0;
								boolean flageTrue=tName2.contains(tests[a].getTestName());
								
								String dispStr = "";
								String dispStrTooltip = "";
								if((ui.getReverseLookupAll(testLabel)).trim().equals("More Infos"))
								{
									isMoreInfos=true;
									StringBuffer moreInfo = new StringBuffer(64);

									if(!moreInfosTreeViewEnabled)
									{
										moreInfo.append(response.encodeURL("/final/monitor/EgMoreInfosView.jsp?") +"qctr=1&showAll=yes&test=");	moreInfo.append(EgURLEncoder.encode((tests[a].getTestName()==null?"":tests[a].getTestName()),"UTF-8"));
										moreInfo.append("&host=");
										moreInfo.append(EgURLEncoder.encode((hostName==null?"":hostName),"UTF-8"));
										moreInfo.append("&layer=");
										moreInfo.append(EgURLEncoder.encode((layerName==null?"":layerName),"UTF-8"));
										moreInfo.append("&site=");
										moreInfo.append(EgURLEncoder.encode((siteName==null?"":siteName),"UTf-8"));
										moreInfo.append("&comptype=");
										moreInfo.append(EgURLEncoder.encode((hostType==null?"":hostType),"UTF-8"));
										moreInfo.append("&faketype=");
										moreInfo.append(EgURLEncoder.encode((fakeType==null?"":fakeType),"UTF-8"));
										moreInfo.append("&fromalarm=");
										moreInfo.append(flagAlarm);

										dispStr = "Click here for the complete list ....";
										
										//JSONObject MoreInfoJson = new JSONObject();
										strMoreInfosURL=moreInfo.toString();
										descriptorsJson.put("moreDescriptorsURL",moreInfo.toString());
										descriptorsJson.put("text",dispStr);
										descriptorsJson.put("iconCls","error-state-icon");
										descriptorsJson.put("leaf",true);
										descriptorsJson.put("moreInfoPostText",selectBold);
										
										//descriptorsJson.put("children", MoreInfoJson);
									}
									else
									{
										moreInfo = new StringBuffer(64);
										moreInfo.append(response.encodeURL("/final/monitor/EgMoreInfosView.jsp?") +"comesFrom=LayerModel&qctr=1&from=list&showAll=yes&MoreInfosTreeView=true&tab=LayerModel&searchByDescriptor=true&test=");
										moreInfo.append(EgURLEncoder.encode((tests[a].getTestName()==null?"":tests[a].getTestName()),"UTF-8"));
										moreInfo.append("&host=");
										moreInfo.append(EgURLEncoder.encode((hostName==null?"":hostName),"UTF-8"));
										moreInfo.append("&layer=");
										moreInfo.append(EgURLEncoder.encode((layerName==null?"":layerName),"UTF-8"));
										moreInfo.append("&site=");
										moreInfo.append(EgURLEncoder.encode((siteName==null?"":siteName),"UTf-8"));
										moreInfo.append("&comptype=");
										moreInfo.append(EgURLEncoder.encode((hostType==null?"":hostType),"UTF-8"));
										moreInfo.append("&faketype=");
										moreInfo.append(EgURLEncoder.encode((fakeType==null?"":fakeType),"UTF-8"));
										moreInfo.append("&fromalarm=");
										moreInfo.append(flagAlarm);

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

										dispStr = "Click here for the complete list ....";
										
										//JSONObject MoreInfoJson = new JSONObject();
										//descriptorsTreeJson.put("moreDescriptorsURL",moreInfo.toString());
										strMoreInfosURL=moreInfo.toString();
										descriptorsTreeJson.put("moreDescriptorsTreeURL",moreInfo.toString());
										descriptorsTreeJson.put("text",dispStr);
										descriptorsTreeJson.put("iconCls","error-state-icon");
										descriptorsTreeJson.put("leaf",true);
										descriptorsTreeJson.put("moreInfoPostText",selectBold);
									}
								}
								else if(!flageTrue)
								{
									HashMap symbolHash = null;
									String boldStyle = selectedMeasure?"<b>":"";
									
									String testLabel_for_display=titleText;
									String temp_testLabel_for_display="";
									String temp_dispStrTooltip="";
									String test_name_value=tests[a].getTestName();

									String isSymbol=(String)egUI.getValue("Tests_For_LayerModel_Images",test_name_value);

									String skipInfos=(String)egUI.getValue("MISC_ARGS","FINAL_INFO");
									
									boolean symbolBlock=true;
									ArrayList exclude_info_list = new ArrayList();
									if(skipInfos!=null && skipInfos.trim().length()>0)
										exclude_info_list = tokInfo.egTokenizer(skipInfos, ",");
									if(exclude_info_list!=null && testLabel_for_display!=null && exclude_info_list.contains(testLabel_for_display.trim()))
										symbolBlock=false;
									symbolHash=(HashMap)getSymbolText(symbolBlock,isSymbol,testLabel_for_display,test_name_value,nextTestExists,tokInfo,mappingInfo,dispStrTooltip);
									
									temp_testLabel_for_display=(String)symbolHash.get("testLabel_for_display");
									temp_dispStrTooltip=(String)symbolHash.get("dispStrTooltip");
									
									if(temp_testLabel_for_display !=null && temp_testLabel_for_display.trim().length()>0)
										testLabel_for_display=temp_testLabel_for_display;

									if(temp_dispStrTooltip !=null && temp_dispStrTooltip.trim().length()>0)
										dispStrTooltip=temp_dispStrTooltip;
									// Ended by Chandrasekhar
									
									if(dispStrTooltip==null || dispStrTooltip.trim().length()<=0)
										dispStrTooltip=titleText;
									dispStr = ui.getReverseLookupAll(testLabel_for_display);
									if(insideView && dispStr != null && infoInsideView != null && dispStr.indexOf(infoInsideView) != -1){
										dispStr = dispStr.substring(infoInsideView.length()+1);
									}										
									//dispStr = boldStyle+dispStr+ boldStyle;
									String chk = tests[a].getMsmtHost();
									chk=(chk==null)?"":chk;
									String tempchk = "";
									thisInfo=(thisInfo==null)?"":thisInfo;
									if (!chk.equals("") && !chk.equals(null))
									{
										tempchk = thisInfo + "  " + "(" + chk + ")" ;
									}
									else
									{
										tempchk = thisInfo;
									}
									tempchk = tempchk;
									if (urlHash == null)
									{
										urlHash = new HashMap();
										if(testQueryStr!=null)
										{
											StringTokenizer urlTokens1 = new StringTokenizer(testQueryStr,"&");
											while (urlTokens1.hasMoreTokens()) 
											{

												String urlValueTemp = (String)urlTokens1.nextToken();
												StringTokenizer urlTokens2 = new StringTokenizer(urlValueTemp,"=");

												int urlTokens2Count = urlTokens2.countTokens();
												String key = "";
												String value = "";
												if(urlTokens2Count==2)
												{
													 key = (String)urlTokens2.nextToken();
													 value = (String)urlTokens2.nextToken();
													 urlHash.put(key,value);
												}
												else
												{
													 key = (String)urlTokens2.nextToken();
													 urlHash.put(key,"");
												}
											}
										}
									}
									String msmt_HostValue = (String)urlHash.get("msmt_host");
									boolean chkmsmt = false;
									if (!chk.equals("") && !chk.equals(null))
									{
										chk = chk;
										
										if(chk.equals(msmt_HostValue))
										{
											chkmsmt = true;
											selectBold = tempchk.trim().equals((ui.getReverseLookupAll(titleText))) && chkmsmt && tName.equals(testDisplay);
										}
										else
											selectBold = tempchk.trim().equals((ui.getReverseLookupAll(titleText))) && chkmsmt && tName.equals(testDisplay);
									}
									else
										selectBold = tempchk.trim().equals((ui.getReverseLookupAll(titleText))) && tName.equals(testDisplay);

									if(!selectBold)
									{
										if (!chk.equals("") && !chk.equals(null))
										{
											chk = chk;
											
											if(chk.equals(msmt_HostValue))
											{
												chkmsmt = true;
												selectBold = tempchk.trim().equals(("+"+ui.getReverseLookupAll(titleText))) && chkmsmt && tName.equals(testDisplay);
											}
											else
												selectBold = tempchk.trim().equals(("+"+ui.getReverseLookupAll(titleText))) && chkmsmt && tName.equals(testDisplay);
										}
										else
											selectBold = tempchk.trim().equals(("+"+ui.getReverseLookupAll(titleText))) && tName.equals(testDisplay);

									}
								
									if(isLayerClicked)// when layer clicked
									{
										selectBold=false;
									}
									
									if(titleText!=null)
									{
										titleText=com.egurkha.util.StringUtils.replace(titleText,"\"","&#34");
									}
	
									if(subTreeTestsList!=null && subTreeTestsList.size()>0 && test_name_value!=null && subTreeTestsList.contains(test_name_value))
									{
										boolean isMoreSub = false;
										isMoreSubInfos=true;
										String test_sep_v= "";
										String test_sep_vIn="";
										if(multiSubTreeList.contains(test_name_value)){
											String sepEntryCheck=(String)egUI.getValue("TEST_PANEL_SUBTREE","SecondLevelSubTreeList:"+test_name_value);
											if(sepEntryCheck == null || sepEntryCheck.trim().length() == 0)
												sepEntryCheck=(String)egUI.getValue("TEST_PANEL_SUBTREE",test_name_value);

											if(sepEntryCheck != null && sepEntryCheck.trim().length() > 0)
												isMoreSub =true;
										}
										test_sep_v=(String)egUI.getValue("TEST_PANEL_SUBTREE",test_name_value);
										test_sep_v=(test_sep_v==null || test_sep_v.trim().length()==0)?":":test_sep_v;

										if(finalInterfacesDescForLayer!=null && finalInterfacesDescForLayer.size()>0)
										{
											String temp_TestLabel= tests[a].getTestLabel(false);
											if(temp_TestLabel!=null)
											{
												temp_TestLabel=com.egurkha.util.StringUtils.replace(temp_TestLabel,"|plus|","+");
												temp_TestLabel=com.egurkha.util.StringUtils.replace(temp_TestLabel,"|amp|","&");
												temp_TestLabel=com.egurkha.util.StringUtils.replace(temp_TestLabel,"|pct|","%");
												temp_TestLabel=com.egurkha.util.StringUtils.replace(temp_TestLabel,"|hash|","#");
											}

											String chkInFMsmtHost = tests[a].getMsmtHost();
											String temp_TestLabel2=temp_TestLabel;
											if(temp_TestLabel!=null && temp_TestLabel.trim().length()>0 && chkInFMsmtHost!=null && chkInFMsmtHost.trim().length()>0 && temp_TestLabel.trim().lastIndexOf(" ")>0 && temp_TestLabel.trim().indexOf(chkInFMsmtHost)>-1 )
											{
												temp_TestLabel2=temp_TestLabel.substring(0,temp_TestLabel.lastIndexOf(" "));
												if(temp_TestLabel2!=null)
													temp_TestLabel2=temp_TestLabel2.trim();
											}
											Hashtable temp_hash=(Hashtable)finalInterfacesDescForLayer.get(test_name_value+"-+"+temp_TestLabel2);
											Hashtable temp_more_msmt_hash=(Hashtable)finalInterfacesDescForLayer.get(test_name_value+"-+"+temp_TestLabel2+"_MoreMsmt");
											LinkedList finalInterfaceTestsDesc=new LinkedList();
											if(temp_hash!=null && temp_hash.size()>0)
											{
												Enumeration ee2 = temp_hash.keys();
												JSONArray moreElementsJsonArray = new JSONArray();
												while (ee2.hasMoreElements())
												{
													JSONObject moreElementsJson = new JSONObject();
													String key = (String) ee2.nextElement();
													String prior_state = (String) temp_hash.get(key);

													if(temp_more_msmt_hash!=null && temp_more_msmt_hash.size()>0)
													{
														String msmt_host_based_prior_state = (String) temp_more_msmt_hash.get(key+"~MH~"+chkInFMsmtHost);
														if(msmt_host_based_prior_state!=null && msmt_host_based_prior_state.trim().length()>0)
															prior_state = msmt_host_based_prior_state;
													}
													
													if (prior_state == null)
														continue;

													// For Subtree test have both subtree infos and non-subtree infos changes.
													// by Saravanan.A on 19-4-2012
													boolean flage_normal=false;
													if(key!=null && key.trim().length()>0)
													{
														if(key.indexOf(test_sep_v)>=0)
														{
															try
															{
																String key_sub=key.substring(key.indexOf(test_sep_v)+1);
																if(key_sub==null || key_sub.trim().length()==0)
																	flage_normal=true;
															}
															catch(Exception e)
															{
																flage_normal=true;
															}
														}
														else if(key.indexOf(test_sep_v)<0)
														{
															flage_normal=true;
														}
													}
													else
														flage_normal=true;

													if(flage_normal)
													{
														String tempDispStr=dispStr;
														if(tempDispStr!=null && tempDispStr.trim().length()>50 && tempDispStr.indexOf("<img")<0 && tempDispStr.indexOf("&#34")<0 && tempDispStr.indexOf("&#39")<0)
														{
															tempDispStr=tempDispStr.substring(0,48)+"..";
														}

														moreElementsJson.put("iconCls","stateSymbol_"+tests[a].getTestState());
														moreElementsJson.put("iconTooltip",mappingInfo.getLabelDescription(tests[a].getTestState()));
														moreElementsJson.put("cls","non-header");
														if(isDescriptorMaintenanceForTest || isDescriptorMaintenanceForComponentTest)
														{
															moreElementsJson.put("measuresLink",url);
															//moreElementsJson.put("text",dispStr);
															moreElementsJson.put("text",tempDispStr+"<img class='iconMaintenance' style='margin:2px 5px 0' data-qtip='"+descriptorMaintenaceTimePeriodStr+"' data-qclass='yellowTip'  src='data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='>");
															moreElementsJson.put("qtip",titleText);
															moreElementsJson.put("selected",selectBold);
															moreElementsJson.put("leaf",true);
															moreElementsJson.put("descriptorMaintenaceTimePeriodStr",descriptorMaintenaceTimePeriodStr);
															moreElementsJson.put("descriptorMaintenaceNoOfLines",noOfLines);
														}
														else
														{
															moreElementsJson.put("measuresLink",url);
															moreElementsJson.put("leaf",true);
															//moreElementsJson.put("text",dispStr);
															moreElementsJson.put("text",tempDispStr);
															moreElementsJson.put("qtip",titleText);
															moreElementsJson.put("selected",selectBold);
														}
													}
													else
													{
														finalInterfaceTestsDesc.add(key);
														finalInterfaceTestsDesc.add(prior_state);
														finalInterfaceTestsDesc.add("");
													}

													if(moreElementsJson!=null && !moreElementsJson.isEmpty())
														moreElementsJsonArray.add(moreElementsJson);
												}
												if(moreElementsJsonArray!=null && moreElementsJsonArray.size()>0)
													descriptorsJson.put("moreElements",moreElementsJsonArray);
												temp_hash=new Hashtable();
											}

											LayerModel lm2 = null;
											com.egurkha.monitor.Test[] InterfaceTests = null;
											HashMap urlInFHash = null;
											int ccc = 0;
											int real_count=0;
											if(finalInterfaceTestsDesc!=null && finalInterfaceTestsDesc.size()>0)
											{
												lm2 = new LayerModel(finalInterfaceTestsDesc, request);
												InterfaceTests = lm2.getTests();
												if(InterfaceTests!=null)
												{
													real_count = InterfaceTests.length;
													ccc = InterfaceTests.length-1;
												}
											}
											//---end--
											
											JSONArray realJsonArray = new JSONArray();
											boolean noSubTree=true;
											for (int aa=0; aa<real_count; aa++)
											{
												JSONObject realJson = new JSONObject();
												
												boolean selectedInFTest =false;
												boolean nextInfTestExists = false;
					
												if (aa < ccc)
												{
													com.egurkha.monitor.Test nextTest = InterfaceTests[aa+1];
													nextInfTestExists = (InterfaceTests[aa].getTestName().equals(nextTest.getTestName()));
												}

												selectedInFTest = testName.indexOf(InterfaceTests[aa].getTestName())>=0 && testName.startsWith(InterfaceTests[aa].getTestName());

												String test_sep=(String)egUI.getValue("TEST_PANEL_SUBTREE",InterfaceTests[aa].getTestName());
												test_sep=(test_sep==null || test_sep.trim().length()==0)?":":test_sep;

												if(selectedInFTest)
												{
													String testInFLabel = InterfaceTests[aa].getTestLabel(false);
													if(testInFLabel!=null && testInFLabel.indexOf(test_sep)>-1)
													{
														testInFLabel=testInFLabel.substring(0,testInFLabel.indexOf(test_sep));

														selectedInFTest = testName.trim().indexOf(testInFLabel.trim())>=0;
													}
													
												}

												boolean selectInFInfo1 = false;
												String thisInFInfo = "";
												String tNameInF = "";
												String testInFDisplay ="";
												String testInFLabel="";
												String msmt_Host_InF = "";
												ArrayList msmt_HostsList_InF = new ArrayList();
												if (testName!= null && !testName.equals("") && !testName.equalsIgnoreCase("null"))
												{
													String testNameInfo = request.getParameter("test");
													String str_msmt_host = request.getParameter("msmt_host");
													if(testNameInfo!=null && testNameInfo.trim().length()>0)
													{
														//thisInFInfo = URLDecoder.decode(testNameInfo.substring(testNameInfo.indexOf("-")+1));
														thisInFInfo =testNameInfo.substring(testNameInfo.indexOf("-")+1);
													}
													else
													{
														//thisInFInfo = URLDecoder.decode(testName.substring(testName.indexOf("-")+1));
														thisInFInfo = testName.substring(testName.indexOf("-")+1);
													}

													if(thisInFInfo!=null && thisInFInfo.trim().length()>0)
													{
														thisInFInfo=com.egurkha.util.StringUtils.replace(thisInFInfo,"|plus|","+");
														thisInFInfo=com.egurkha.util.StringUtils.replace(thisInFInfo,"|amp|","&");
														thisInFInfo=com.egurkha.util.StringUtils.replace(thisInFInfo,"|pct|","%");
														thisInFInfo=com.egurkha.util.StringUtils.replace(thisInFInfo,"|hash|","#");
													}

													tNameInF = testName.substring(0,testName.indexOf("-"));
													testInFDisplay = ui.getReverseLookupAll(InterfaceTests[aa].getTestName());

													if(thisInFInfo!=null && thisInFInfo.trim().length()>0)
													{
														thisInFInfo=ui.getReverseLookupAll(thisInFInfo);
													}

													for (int p=0; p<InterfaceTests.length; p++)
													{
														msmt_Host_InF = InterfaceTests[p].getMsmtHost();
														if(msmt_Host_InF==null || msmt_Host_InF.length()==0)
															msmt_Host_InF = chkInFMsmtHost;
												
														if (!msmt_Host_InF.equals("") && !msmt_Host_InF.equals(null))
														{
															if(!msmt_HostsList_InF.contains("(" + msmt_Host_InF + ")"))
															msmt_HostsList_InF.add("(" + msmt_Host_InF + ")");
														}
													}
													
													for (int i=0; i<InterfaceTests.length; i++)
													{
														testInFLabel = InterfaceTests[i].getTestLabel(false);
														testInFLabel = ui.getReverseLookupAll(testInFLabel);
														testInFLabel = testInFLabel;
														
														if(str_msmt_host!=null && str_msmt_host.trim().length()>0)
														{
															testInFLabel = testInFLabel + " ("+str_msmt_host+")";
														}
														
														if (testInFLabel.startsWith("("))
															alist_InF.add(tNameInF + "-  "+testInFLabel);
														else alist_InF.add(tNameInF + "- "+testInFLabel);
													}

													String chkInF = InterfaceTests[aa].getMsmtHost();
													
													if(chkInF==null || chkInF.trim().length()==0)
													{
														if(str_msmt_host!=null)
															chkInF = chkInFMsmtHost;
													}
													
													if (!chkInF.equals("") && !chkInF.equals(null))
													{
														if (msmt_HostsList_InF.size()>0)
														{
															for(int m=0;m<msmt_HostsList_InF.size();m++)
															{
																msmt_Host_InF = (String)msmt_HostsList_InF.get(m);
																if(str_msmt_host!=null && msmt_Host_InF.indexOf(str_msmt_host)>-1)
																{
																	String temp = testName +" "+msmt_Host_InF;
																	if(alist_InF.contains(temp))
																	{
																		selectInFInfo1 = alist_InF.contains(temp) && tNameInF.equals(testInFDisplay);
																	}
																}
															}
															
														}
													}
													else
													{
														selectInFInfo1 = alist_InF.contains(testName) && tNameInF.equals(testInFDisplay);
													}
												}
												descriptorsJson.put("iconCls","stateSymbol_"+InterfaceTests[aa].getTestState());
												descriptorsJson.put("iconTooltip",mappingInfo.getLabelDescription(tests[a].getTestState()));
												descriptorsJson.put("cls","non-header");
												if(subInfosEnabled.equalsIgnoreCase("True") || subInfosEnabled.equalsIgnoreCase("yes"))
												{
													selectInFInfo1 = true;
												}

												if(isLayerClicked || (!selectInFInfo1))// when layer clicked
												{
													selectedInFTest=false;
												}

												String tempDispStr=dispStr;
												String tempLinkStr=dispStr;
												if(tempDispStr!=null && tempDispStr.trim().length()>50 && tempDispStr.indexOf("<img")<0 && tempDispStr.indexOf("&#34")<0 && tempDispStr.indexOf("&#39")<0)
												{
													tempDispStr=tempDispStr.substring(0,48)+"..";
												}

												//Descriptors having Interfaces
												descriptorsJson_mobile.put("name",titleText);
												descriptorsJson_mobile.put("endhr",mgr_time);
												descriptorsJson_mobile.put("mgr_date",temp1);
												descriptorsJson_mobile.put("status",tests[a].getTestState());
												descriptorsJson_mobile.put("msmt_host",testWithMsmtHostHash.get(msmt_hst_mobile));						
												descriptorsJson.put("selected",selectedInFTest);
												descriptorsJson.put("interfacesLink",a);
												descriptorsJson.put("leaf",false);
												descriptorsJson.put("expanded",selectInFInfo1);
												//descriptorsJson.put("text",dispStr);
												if(customSubTree != null && groupingData.size() > 0 ){
													for(int kk=0;kk<groupingData.size();kk++){
														String groupingDataIn = (String) groupingData.get(kk);
														if(tempDispStr.startsWith(groupingDataIn) && tempDispStr.indexOf("(") != -1 && tempDispStr.indexOf(")") !=-1 ){
															descriptorsJson.put("text",tempDispStr.substring(0,tempDispStr.indexOf("(")));
														}else{
															descriptorsJson.put("text",tempDispStr);		
														}
													}
												}
												else{
													descriptorsJson.put("text",tempDispStr);
												}
												descriptorsJson.put("qtip",titleText);

												if (selectInFInfo1)
												{
													descriptorsJson.put("tr_display_text",tr_display_text);
												}
												alist_InF = new ArrayList();

												int tempAA=aa;
												ArrayList tNameInF2=new ArrayList();
												while (tempAA < InterfaceTests.length)
												{
													String test_InFLabel = InterfaceTests[tempAA].getTestLabel(false);
													if((ui.getReverseLookupAll(test_InFLabel)).trim().equals("More Infos"))
													{
														tNameInF2.add(InterfaceTests[tempAA].getTestName());
													}
													tempAA++;
												}

												JSONArray moreSubJsonArray = new JSONArray();
												JSONArray interfaceTestJsonArray = new JSONArray();
												JSONArray interfaceTestJsonArray_mobile = new JSONArray();
												if(isMoreSub){
													String urlForInF = "";
													Hashtable temp_hashIn=(Hashtable)finalInterfacesDescForLayer.get(test_name_value+"-+"+temp_TestLabel2);
													Hashtable temp_more_msmt_hashIn=(Hashtable)finalInterfacesDescForLayer.get(test_name_value+"-+"+temp_TestLabel2+"_MoreMsmt");
													LinkedList finalInterfaceTestsDescIn=new LinkedList();

													List high_fitd=new LinkedList();
													List inter_fitd=new LinkedList();
													List low_fitd=new LinkedList();
													List unkn_fitd=new LinkedList();
													List good_fitd=new LinkedList();

													test_sep_vIn=(String)egUI.getValue("TEST_PANEL_SUBTREE","SecondLevelSubTreeList:"+test_name_value);

													if(test_sep_vIn == null || test_sep_vIn.trim().length() == 0)
															test_sep_vIn=(String)egUI.getValue("TEST_PANEL_SUBTREE",test_name_value);

													test_sep_vIn=(test_sep_vIn==null || test_sep_vIn.trim().length()==0)?":":test_sep_vIn;
													
													if(temp_hashIn!=null && temp_hashIn.size()>0)
													{
														Enumeration ee2 = temp_hashIn.keys();
														JSONArray moreElementsJsonArrayIn = new JSONArray();
														while (ee2.hasMoreElements())
														{
															JSONObject moreElementsJsonIn = new JSONObject();
															String key = (String) ee2.nextElement();

															if(validSearchInfosList!=null && validSearchInfosList.size()>0 && !validSearchInfosList.contains(key))
																continue;

															String stateKey = key;
															
															if(key.indexOf(test_sep_v) == -1)
																continue;

															key = key.substring(0,key.indexOf("-+")+2)+key.substring(key.indexOf(test_sep_v)+1);
															String prior_state = (String) temp_hashIn.get(stateKey);
															if(temp_more_msmt_hashIn!=null && temp_more_msmt_hashIn.size()>0)
															{
																String msmt_host_based_prior_state = (String) temp_more_msmt_hashIn.get(stateKey+"~MH~"+chkInFMsmtHost);
																if(msmt_host_based_prior_state!=null && msmt_host_based_prior_state.trim().length()>0)
																	prior_state = msmt_host_based_prior_state;
															}
															if (prior_state == null)
																continue;

															boolean flage_normal=false;
															if(key!=null && key.trim().length()>0)
															{
																if(key.indexOf(test_sep_vIn)>=0)
																{
																	try
																	{
																		String key_sub=key.substring(key.indexOf(test_sep_vIn)+1);
																		if(key_sub==null || key_sub.trim().length()==0)
																			flage_normal=true;
																	}
																	catch(Exception e)
																	{
																		flage_normal=true;
																	}
																}
																else if(key.indexOf(test_sep_vIn)<0)
																{
																	finalInterfaceTestsDescIn.add(key+"="+prior_state);

																	if(prior_state!=null && prior_state.equals("HIGH"))
																	{
																		high_fitd.add(key);
																		high_fitd.add(key+"="+prior_state);
																	}
																	else if(prior_state!=null && prior_state.equals("INTERMEDIATE"))
																	{
																		inter_fitd.add(key);
																		inter_fitd.add(key+"="+prior_state);
																	}
																	else if(prior_state!=null && prior_state.equals("LOW"))
																	{
																		low_fitd.add(key);
																		low_fitd.add(key+"="+prior_state);
																	}
																	else if(prior_state!=null && prior_state.equals("UNKNOWN"))
																	{
																		unkn_fitd.add(key);
																		unkn_fitd.add(key+"="+prior_state);
																	}
																	else if(prior_state!=null && prior_state.equals("GOOD"))
																	{
																		good_fitd.add(key);
																		good_fitd.add(key+"="+prior_state);
																	}

																	flage_normal=true;
																}
															}
															else
																flage_normal=true;
															
															if(flage_normal)
															{
																String tempDispStrIn=dispStr;
																if(tempDispStrIn!=null && tempDispStrIn.trim().length()>50 && tempDispStrIn.indexOf("<img")<0 && tempDispStrIn.indexOf("&#34")<0 && tempDispStrIn.indexOf("&#39")<0)
																{
																	tempDispStrIn=tempDispStrIn.substring(0,48)+"..";
																}

																moreElementsJsonIn.put("iconCls","stateSymbol_"+tests[a].getTestState());
																moreElementsJsonIn.put("iconTooltip",mappingInfo.getLabelDescription(tests[a].getTestState()));
																moreElementsJsonIn.put("cls","non-header");
																if(isDescriptorMaintenanceForTest || isDescriptorMaintenanceForComponentTest)
																{
																	moreElementsJsonIn.put("measuresLink",url);
																	//moreElementsJson.put("text",dispStr);
																	moreElementsJsonIn.put("text",tempDispStrIn+"<img class='iconMaintenance' style='margin:2px 5px 0' data-qtip='"+descriptorMaintenaceTimePeriodStr+"' data-qclass='yellowTip'  src='data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='>");
																	moreElementsJsonIn.put("qtip",titleText);
																	moreElementsJsonIn.put("selected",selectBold);
																	moreElementsJsonIn.put("leaf",true);
																	moreElementsJsonIn.put("descriptorMaintenaceTimePeriodStr",descriptorMaintenaceTimePeriodStr);
																	moreElementsJsonIn.put("descriptorMaintenaceNoOfLines",noOfLines);
																}
																else
																{
																	moreElementsJsonIn.put("measuresLink",url);
																	moreElementsJsonIn.put("leaf",true);
																	moreElementsJsonIn.put("text",tempDispStrIn);
																	moreElementsJsonIn.put("qtip",titleText);
																	moreElementsJsonIn.put("selected",selectBold);
																}
															}
															else
															{
																finalInterfaceTestsDescIn.add(key+"="+prior_state);

																if(prior_state!=null && prior_state.equals("HIGH"))
																{
																	high_fitd.add(key);
																	high_fitd.add(key+"="+prior_state);
																}
																else if(prior_state!=null && prior_state.equals("INTERMEDIATE"))
																{
																	inter_fitd.add(key);
																	inter_fitd.add(key+"="+prior_state);
																}
																else if(prior_state!=null && prior_state.equals("LOW"))
																{
																	low_fitd.add(key);
																	low_fitd.add(key+"="+prior_state);
																}
																else if(prior_state!=null && prior_state.equals("UNKNOWN"))
																{
																	unkn_fitd.add(key);
																	unkn_fitd.add(key+"="+prior_state);
																}
																else if(prior_state!=null && prior_state.equals("GOOD"))
																{
																	good_fitd.add(key);
																	good_fitd.add(key+"="+prior_state);
																}

																//finalInterfaceTestsDescIn.add(prior_state);
																//finalInterfaceTestsDescIn.add("");
															}

															if(moreElementsJsonIn!=null && !moreElementsJsonIn.isEmpty())
																moreElementsJsonArrayIn.add(moreElementsJsonIn);
														}
														if(moreElementsJsonArrayIn!=null && moreElementsJsonArrayIn.size()>0)
															descriptorsJson.put("moreElements",moreElementsJsonArrayIn);
														temp_hashIn=new Hashtable();
													}

													//Collections.sort(finalInterfaceTestsDescIn);
													//List afterSorted = (List) sortByState(finalInterfaceTestsDescIn);

													List afterSorted = new LinkedList();
													List return_list=new LinkedList();
													if(high_fitd != null && high_fitd.size() >0)
													{
														EgSorter esort=new EgSorter(high_fitd,2);
														high_fitd=esort.sort(1,"String","asc");
														return_list.addAll(high_fitd);
													}
													if(inter_fitd != null && inter_fitd.size() >0)
													{
														EgSorter esort=new EgSorter(inter_fitd,2);
														inter_fitd=esort.sort(1,"String","asc");
														return_list.addAll(inter_fitd);
													}
													if(low_fitd != null && low_fitd.size() >0)
													{
														EgSorter esort=new EgSorter(low_fitd,2);
														low_fitd=esort.sort(1,"String","asc");
														return_list.addAll(low_fitd);
													}
													if(unkn_fitd != null && unkn_fitd.size() >0)
													{
														EgSorter esort=new EgSorter(unkn_fitd,2);
														unkn_fitd=esort.sort(1,"String","asc");
														return_list.addAll(unkn_fitd);
													}
													if(good_fitd != null && good_fitd.size() >0)
													{
														EgSorter esort=new EgSorter(good_fitd,2);
														good_fitd=esort.sort(1,"String","asc");
														return_list.addAll(good_fitd);
													}

													if (return_list != null && return_list.size() > 0)
													{
														afterSorted=new LinkedList();
														for (int fi = 0; fi < return_list.size(); fi += 2)
														{
															String tmp_key = (String) return_list.get(fi);
															String tmp_key_state = (String) return_list.get(fi+1);

															if(tmp_key_state!=null && tmp_key_state.trim().length()>0)
																afterSorted.add(tmp_key_state);
														}
													}

													LinkedHashMap moreSubMap = new LinkedHashMap();
													Hashtable linkMoreHashMap = new Hashtable();
													if(afterSorted != null && afterSorted.size() > 0 ){
														for(int m=0;m<afterSorted.size();m++){
															String sortedTest = (String)afterSorted.get(m);
															String sortedTestTemp = sortedTest.replace("-+","-+"+tempLinkStr+test_sep_v);
															String testNameSub = sortedTest.substring(0,sortedTest.indexOf("-+"));
															String dispMoreSub = sortedTest.substring(sortedTest.indexOf("-+")+2,sortedTest.indexOf("="));
															String stateMoreSub = sortedTest.substring(sortedTest.indexOf("=")+1);

															if(dispMoreSub.indexOf(test_sep_vIn) != -1){
																String dispMoreSubVal = dispMoreSub.substring(0,dispMoreSub.indexOf(test_sep_vIn));
																String dispMoreSubValIn = dispMoreSub.substring(dispMoreSub.indexOf(test_sep_vIn)+1);
																if(moreSubMap.containsKey(dispMoreSubVal)){
																	String getOldKey = 	(String) moreSubMap.get(dispMoreSubVal);
																	String newKey = getOldKey+"~eGSep~"+dispMoreSubValIn+"="+stateMoreSub;
																	moreSubMap.put(dispMoreSubVal,newKey);
																	linkMoreHashMap.put(dispMoreSubVal,sortedTestTemp);
																	//linkMoreHashMap.put(dispMoreSubValIn,sortedTestTemp);
																	linkMoreHashMap.put(dispMoreSub,sortedTestTemp);
																}else{
																	moreSubMap.put(dispMoreSubVal,dispMoreSubVal+"="+stateMoreSub+"||"+dispMoreSubValIn+"="+stateMoreSub);
																	linkMoreHashMap.put(dispMoreSubVal,sortedTestTemp);
																	//linkMoreHashMap.put(dispMoreSubValIn,sortedTestTemp);
																	linkMoreHashMap.put(dispMoreSub,sortedTestTemp);
																}
																
															}else{
																if(! moreSubMap.containsKey(dispMoreSub)){
																	moreSubMap.put(dispMoreSub,dispMoreSub+"="+stateMoreSub);
																	linkMoreHashMap.put(dispMoreSub,sortedTestTemp);
																}else{
																	moreSubMap.put(dispMoreSub+"|Empty",dispMoreSub+"="+stateMoreSub);
																	linkMoreHashMap.put(dispMoreSub,sortedTestTemp);
																}
															}
														}
														//{notepad=notepad=INTERMEDIATE, plus=plus=GOOD||cmd=GOOD::process=GOOD}
														
														if(moreSubMap != null && moreSubMap.size() > 0){
															Set set = moreSubMap.keySet();
															Iterator itr = set.iterator();
															//boolean stateInFlag = true;
															int iState=0;
															while (itr.hasNext()) {
																String keyLocal = (String)itr.next();
																String valueLocal = (String)moreSubMap.get(keyLocal);
																JSONObject moreSubJsonOb = new JSONObject();
																JSONArray moreSubJsonAr = new JSONArray();

																if(valueLocal.indexOf("||") != -1){
																	String valueLocalSub = valueLocal.substring(0,valueLocal.indexOf("||"));
																	String jsonState = valueLocalSub.substring(valueLocalSub.indexOf("=")+1);
																	String jsonText = valueLocalSub.substring(0,valueLocalSub.indexOf("="));

																	String jsonSubText = valueLocal.substring(valueLocal.indexOf("||")+2);
																	final String seclevelDesc = jsonText;
																	//String urlTest = (String) linkMoreHashMap.get(jsonText);
																	//urlForInF = this.getUrl(InterfaceTests[aa], request,urlTest);
																	urlForInF = this.getUrl(InterfaceTests[aa], request,linkMoreHashMap,jsonText,ui);

																	if(jsonText!=null && jsonText.trim().length()>48 && jsonText.indexOf("<img")<0 && jsonText.indexOf("&#34")<0 && jsonText.indexOf("&#39")<0)
																	{
																		jsonText=jsonText.substring(0,46)+"..";
																	}

																	moreSubJsonOb.put("iconCls","stateSymbol_"+jsonState);
																	moreSubJsonOb.put("iconTooltip","Normal");
																	moreSubJsonOb.put("cls","non-header");
																	moreSubJsonOb.put("measuresLink",urlForInF);
																	moreSubJsonOb.put("leaf",false);
																	moreSubJsonOb.put("text",jsonText);
																	moreSubJsonOb.put("qtip",jsonText);
																	moreSubJsonOb.put("selected",selectBold);
																	moreSubJsonOb.put("expanded",selectInFInfo1);
																	//StringTokenizer moreSubToken = new StringTokenizer(jsonSubText,"::");
																	ArrayList moreSubTokenList = tokInfo.egTokenizer(jsonSubText,"~eGSep~");
																	String label="";
																	String label_for_title="";

																	if((!isMoreInfosTreeView) && maxInfosCount <= moreSubTokenList.size())
																	{
																		JSONObject moreSubJsonObIn = new JSONObject();

																		String comparisonTooltip = mappingInfo.getTextDescription("monitor.common.Comparison");
																		isMoreInfos=true;
																		StringBuffer moreInfos = new StringBuffer(64);
																		boolean  selectInfo12=false;
																		
																		if(!moreInfosTreeViewEnabled)
																		{
																			moreInfos.append(response.encodeURL("/final/monitor/EgMoreInfosView.jsp?")+"qctr=1&showAll=yes&test=");
																			moreInfos.append(EgURLEncoder.encode((tests[a].getTestName()==null?"":tests[a].getTestName()),"UTF-8"));
																			moreInfos.append("&host=");
																			moreInfos.append(EgURLEncoder.encode((hostName==null?"":hostName),"UTF-8"));
																			moreInfos.append("&layer=");
																			moreInfos.append(layerName);
																			moreInfos.append("&site=");
																			moreInfos.append(EgURLEncoder.encode((siteName==null?"":siteName),"UTf-8"));
																			moreInfos.append("&comptype=");
																			moreInfos.append(EgURLEncoder.encode((hostType==null?"":hostType),"UTF-8"));
																			moreInfos.append("&faketype=");
																			moreInfos.append(EgURLEncoder.encode((fakeType==null?"":fakeType),"UTF-8"));
																			moreInfos.append("&fromalarm=");
																			moreInfos.append(flagAlarm);
																			moreInfos.append("&isInterface=yes");
																			moreInfos.append("&selectedInterface=");
																			moreInfos.append(EgURLEncoder.encode(com.egurkha.util.StringUtils.encodeSecurityChar(temp_TestLabel2.trim()+test_sep_vIn+keyLocal),"UTF-8"));
																			moreInfos.append("&isMoreSub=yes");

																			moreSubJsonObIn.put("iconCls","stateSymbol_"+jsonState);

																			String disp3rdInFDescStr = "Click here for the complete list ....";

																			//Saravanan.A added the follwing lines on 12-12-2007
																			
																			if(enable.equalsIgnoreCase("True"))
																			{
																				selectInfo12 = true;
																			}
																			moreSubJsonObIn.put("qtip",disp3rdInFDescStr);
																			moreSubJsonObIn.put("text",disp3rdInFDescStr+"<div style=\"float:right;\"><a href=\"javascript:void(0);\" onclick=javascript:showMoreInfos(\""+qryStr+"\") class=\"comparison-image-container\"><img title=\""+mappingInfo.getTextDescription("monitor.layermodel.Comparison")+"\" class=\"comparison-image iconDetailList\" src=\"/final/images/clear.png\"/></a></div>");
																			/* Testinfo.put("comparisonLink",qryStr);
																			Testinfo.put("comparisonTooltip",mappingInfo.getTextDescription("monitor.layermodel.Comparison")); */
																			if (selectInfo12)
																			{
																				moreSubJsonObIn.put("tr_display_text",tr_display_text);
																			}

																			if(label.equals("Click here for the complete list ...."))
																			{
																			}
																			else
																			{
																				moreSubJsonObIn.put("iconCls","stateSymbol_"+jsonState);
																			}
																			
																			if(label_for_title!=null)
																			{
																				label_for_title=com.egurkha.util.StringUtils.replace(label_for_title,"\"","&#34");
																			}
																			//More Descriptors/More Information
																			//JSONObject MoreInfoJson = new JSONObject();
																			strMoreInfosURL=moreInfos.toString();

																			String params=strMoreInfosURL.substring(strMoreInfosURL.indexOf("?")+1,strMoreInfosURL.trim().length());

																			moreSubJsonObIn.put("moreDescriptorsURL",moreInfos.toString());
																			moreSubJsonObIn.put("leaf",true);
																			//Testinfo.put("text",label);
																			//Testinfo.put("text",label+"<div style=\"float:right;position:relative;\"><div style=\"position:absolute;top:5px;right:10px\" ><a href=\"javascript:void(0);\" onclick=javascript:showMoreInfos(\""+params+"\",event) ><img data-qtip=\"More Infos\" data-qclass=\"yellowTip\" class=\"iconPlus\" src=\"/final/images/clear.png\"/></a></div><div>");

																			moreSubJsonObIn.put("fireEvent",params);
																			if(disableDescFlag)
																			{
																				moreSubJsonObIn.put("text",disp3rdInFDescStr+"&nbsp;<a href=\"javascript:void(0);\" onclick=javascript:showMoreInfos(\""+params+"\",event) ><img data-qtip=\"More Infos\" data-qclass=\"yellowTip\" style=\"position:relative;top:3px\" class=\"iconLayerMoreInfo\" src=\"/final/images/clear.png\"/></a>");

																				//descriptorsJson.put("text",tempDispStr+"&nbsp;<a href=\"javascript:void(0);\" onclick=javascript:MoreInfoLayerTreePopUp(\""+moreInfoInF.toString()+"\",'',event) ><img data-qtip=\"Click here to see the Descriptors\" data-qclass=\"yellowTip\" style=\"position:relative;top:3px\" class=\"iconLayerMoreInfo\" src=\"/final/images/clear.png\"/></a>");
																			}
																			else
																			{
																				if(showMaintenanceConfigIcon)
																				{
																					moreSubJsonObIn.put("text",disp3rdInFDescStr+"&nbsp;<a href=\"javascript:void(0);\" onclick=javascript:showMoreInfos(\""+params+"\",event) ><img data-qtip=\"More Infos\" data-qclass=\"yellowTip\" style=\"position:relative;top:3px\" class=\"iconLayerMoreInfo\" src=\"/final/images/clear.png\"/></a><div style=\"float:right;position:relative;\"><div style=\"position:absolute;top:"+topFalg+";right:10px;background:transparent !important\" > "+getMaintainenancePolicyConfigURL(tests[a].getTestName(),""+ui.getReverseLookupAll(tests[a].getTestName()),hostName,hostType,isApplicationLayer,mappingInfo)+"&nbsp;<a href=\"javascript:void(0);\" onclick=javascript:showDescriptorComparison(\""+qryStr+"\",event) class=\"comparison-image-container\"><img data-qtip=\""+comparisonTooltip+"\" data-qclass=\"yellowTip\" class=\"comparison-image iconComponentDetails\" src=\"/final/images/clear.png\"/></a></div><div>");
																				}
																				else
																				{
																					moreSubJsonObIn.put("text",disp3rdInFDescStr+"&nbsp;<a href=\"javascript:void(0);\" onclick=javascript:showMoreInfos(\""+params+"\",event) ><img data-qtip=\"More Infos\" data-qclass=\"yellowTip\" style=\"position:relative;top:3px\" class=\"iconLayerMoreInfo\" src=\"/final/images/clear.png\"/></a><div style=\"float:right;position:relative;\"><div style=\"position:absolute;top:"+topFalg+";right:10px;background:transparent !important\" > <a href=\"javascript:void(0);\" onclick=javascript:showDescriptorComparison(\""+qryStr+"\",event) class=\"comparison-image-container\"><img data-qtip=\""+comparisonTooltip+"\" data-qclass=\"yellowTip\" class=\"comparison-image iconComponentDetails\" src=\"/final/images/clear.png\"/></a></div><div>");
																				}
																			}

																			moreSubJsonObIn.put("qtip",disp3rdInFDescStr);
																			
																			//Testinfo.put("children", MoreInfoJson);
																		}
																		else
																		{
																			moreInfos = new StringBuffer(64);
																			moreInfos.append(response.encodeURL("/final/monitor/EgMoreInfosView.jsp?")+"comesFrom=LayerModel&qctr=1&from=list&showAll=yes&MoreInfosTreeView=true&tab=LayerModel&searchByDescriptor=true&test=");
																			moreInfos.append(EgURLEncoder.encode((tests[a].getTestName()==null?"":tests[a].getTestName()),"UTF-8"));
																			moreInfos.append("&host=");
																			moreInfos.append(EgURLEncoder.encode((hostName==null?"":hostName),"UTF-8"));
																			moreInfos.append("&layer=");
																			moreInfos.append(layerName);
																			moreInfos.append("&site=");
																			moreInfos.append(EgURLEncoder.encode((siteName==null?"":siteName),"UTf-8"));
																			moreInfos.append("&comptype=");
																			moreInfos.append(EgURLEncoder.encode((hostType==null?"":hostType),"UTF-8"));
																			moreInfos.append("&faketype=");
																			moreInfos.append(EgURLEncoder.encode((fakeType==null?"":fakeType),"UTF-8"));
																			moreInfos.append("&fromalarm=");
																			moreInfos.append(flagAlarm);
																			moreInfos.append("&isInterface=yes");
																			moreInfos.append("&selectedInterface=");
																			moreInfos.append(EgURLEncoder.encode(com.egurkha.util.StringUtils.encodeSecurityChar(temp_TestLabel2.trim()+test_sep_vIn+keyLocal),"UTF-8"));
																			moreInfos.append("&isMoreSub=yes");

																			moreSubJsonObIn.put("iconCls","stateSymbol_"+jsonState);

																			//Saravanan.A added the follwing lines on 12-12-2007
																			selectInfo12=false;
																			if(enable.equalsIgnoreCase("True"))
																			{
																				selectInfo12 = true;
																			}

																			String disp3rdInFDescStr = "Click here for the complete list ....";

																			moreSubJsonObIn.put("qtip",disp3rdInFDescStr);
																			moreSubJsonObIn.put("text",disp3rdInFDescStr+"<div style=\"float:right;\"><a href=\"javascript:void(0);\" onclick=javascript:showMoreInfos(\""+qryStr+"\") class=\"comparison-image-container\"><img title=\""+mappingInfo.getTextDescription("monitor.layermodel.Comparison")+"\" class=\"comparison-image iconDetailList\" src=\"/final/images/clear.png\"/></a></div>");
																			/* Testinfo.put("comparisonLink",qryStr);
																			Testinfo.put("comparisonTooltip",mappingInfo.getTextDescription("monitor.layermodel.Comparison")); */
																			if (selectInfo12)
																			{
																				moreSubJsonObIn.put("tr_display_text",tr_display_text);
																			}

																			if(label.equals("Click here for the complete list ...."))
																			{
																			}
																			else
																			{
																				moreSubJsonObIn.put("iconCls","stateSymbol_"+jsonState);
																			}
																			
																			if(label_for_title!=null)
																			{
																				label_for_title=com.egurkha.util.StringUtils.replace(label_for_title,"\"","&#34");
																			}
																			//More Descriptors/More Information
																			//JSONObject MoreInfoJson = new JSONObject();
																			//Testinfo.put("moreDescriptorsURL",moreInfos.toString());
																			strMoreInfosURL=moreInfos.toString();
																			moreSubJsonObIn.put("moreDescriptorsTreeURL",moreInfos.toString());
																			moreSubJsonObIn.put("leaf",true);
																			//Testinfo.put("text",label);
																			
																			String params=strMoreInfosURL.substring(strMoreInfosURL.indexOf("?")+1,strMoreInfosURL.trim().length());
																			//Testinfo.put("text",label+"<div style=\"float:right;position:relative;\"><div style=\"position:absolute;top:5px;right:10px\" ><a href=\"javascript:void(0);\" onclick=javascript:MoreInfoLayerTreePopUp(\""+params+"\",'',event) ><img data-qtip=\"More Infos\" data-qclass=\"yellowTip\" class=\"iconPlus\" src=\"/final/images/clear.png\"/></a></div><div>");
																			moreSubJsonObIn.put("fireEvent",params);
																			/*if(disableDescFlag)
																				moreSubJsonObIn.put("text",disp3rdInFDescStr+"&nbsp;<a href=\"javascript:void(0);\" onclick=javascript:MoreInfoLayerTreePopUp(\""+params+"\",'',event) ><img data-qtip=\"Click here to see the Descriptors\" data-qclass=\"yellowTip\" style=\"position:relative;top:3px\" class=\"iconLayerMoreInfo\" src=\"/final/images/clear.png\"/></a>");
																			else
																				moreSubJsonObIn.put("text",disp3rdInFDescStr+"&nbsp;<a href=\"javascript:void(0);\" onclick=javascript:MoreInfoLayerTreePopUp(\""+params+"\",'',event) ><img data-qtip=\"Click here to see the Descriptors\" data-qclass=\"yellowTip\" style=\"position:relative;top:3px\" class=\"iconLayerMoreInfo\" src=\"/final/images/clear.png\"/></a><div style=\"float:right;position:relative;\"><div style=\"position:absolute;top:"+topFalg+";right:10px;background:transparent !important\" > <a href=\"javascript:void(0);\" onclick=javascript:showDescriptorComparison(\""+qryStr+"\",event) class=\"comparison-image-container\"><img data-qtip=\""+comparisonTooltip+"\" data-qclass=\"yellowTip\" class=\"comparison-image iconComponentDetails\" src=\"/final/images/clear.png\"/></a></div><div>");*/

																			if(disableDescFlag)
																				moreSubJsonOb.put("text",jsonText+"&nbsp;<a href=\"javascript:void(0);\" onclick=javascript:MoreInfoLayerTreePopUp(\""+params+"\",'',event) ><img data-qtip=\"Click here to see the Descriptors\" data-qclass=\"yellowTip\" style=\"position:relative;top:3px\" class=\"iconLayerMoreInfo\" src=\"/final/images/clear.png\"/></a>");
																			else
																				moreSubJsonOb.put("text",jsonText+"&nbsp;<a href=\"javascript:void(0);\" onclick=javascript:MoreInfoLayerTreePopUp(\""+params+"\",'',event) ><img data-qtip=\"Click here to see the Descriptors\" data-qclass=\"yellowTip\" style=\"position:relative;top:3px\" class=\"iconLayerMoreInfo\" src=\"/final/images/clear.png\"/></a><div style=\"float:right;position:relative;\"><div style=\"position:absolute;top:"+topFalg+";right:10px;background:transparent !important\" > <a href=\"javascript:void(0);\" onclick=javascript:showDescriptorComparison(\""+qryStr+"\",event) class=\"comparison-image-container\"><img data-qtip=\""+comparisonTooltip+"\" data-qclass=\"yellowTip\" class=\"comparison-image iconComponentDetails\" src=\"/final/images/clear.png\"/></a></div><div>");

																			moreSubJsonObIn.put("qtip",disp3rdInFDescStr);
																		}

																		if(!isMoreInfos)
																			moreSubJsonAr.add(moreSubJsonObIn);
																	}
																	else
																	{
																		for(int l=0;l<moreSubTokenList.size();l++)
																		{
																			//while(moreSubToken.hasMoreTokens()){
																			//String subLevelText = moreSubToken.nextToken();
																			String subLevelText = (String) moreSubTokenList.get(l);
																			String jsonStateIn = subLevelText.substring(subLevelText.indexOf("=")+1);
																			String jsonTextIn = subLevelText.substring(0,subLevelText.indexOf("="));

																			//String urlTestIn = (String) linkMoreHashMap.get(jsonTextIn);
																			//urlForInF = this.getUrl(InterfaceTests[aa], request,urlTestIn);
																			
																			final String trdLevelValue = jsonTextIn;
																			String finalLevelInfo = frstDescr + test_sep_vIn + seclevelDesc + test_sep_vIn + trdLevelValue;
																			//==3nd level 
																			isDescriptorMaintenanceForTest = egM.isItMaintenanceTime(testNameForMaintenance, curDatTime,finalLevelInfo,true);
																			isDescriptorMaintenanceForComponentTest = egM.isItMaintenanceTime(testNameForMaintenance, curDatTime, serverName, portNo, sid,finalLevelInfo,true);

																			maintenancePeriodVec = new ArrayList();
																			maintenaceTimePeriod = new ArrayList();

																			maintenaceTimePeriod = (ArrayList)getMaintenanceComputing(egM,maintenaceTimePeriod,isDescriptorMaintenanceForTest,isDescriptorMaintenanceForComponentTest,testNameForMaintenance,finalLevelInfo,serverName,portNo,sid);

																			/*if(isDescriptorMaintenanceForTest)
																			{
																				maintenancePeriodVec = egM.getMaintenancePeriods(testNameForMaintenance, finalLevelInfo);
																				if(maintenancePeriodVec != null && maintenaceTimePeriod != null){
																					maintenaceTimePeriod.addAll(maintenancePeriodVec);
																				}
																				maintenancePeriodVec = egM.getUnplannedMaintenancePeriods(testNameForMaintenance, finalLevelInfo);
																				if(maintenancePeriodVec != null && maintenaceTimePeriod != null)
																					maintenaceTimePeriod.addAll(maintenancePeriodVec);
																			}
																			if(isDescriptorMaintenanceForComponentTest)
																			{
																				maintenancePeriodVec = egM.getMaintenancePeriods(testNameForMaintenance, serverName, portNo, sid, finalLevelInfo);
																				if(maintenancePeriodVec != null && maintenaceTimePeriod != null){
																					maintenaceTimePeriod.addAll(maintenancePeriodVec);
																				}
																				maintenancePeriodVec = egM.getUnplannedMaintenancePeriods(testNameForMaintenance, serverName, portNo, sid, finalLevelInfo);
																				if(maintenancePeriodVec != null && maintenaceTimePeriod != null)
																					maintenaceTimePeriod.addAll(maintenancePeriodVec);
																			}*/
																			noOfLines = maintenaceTimePeriod.size();
																			aListDummy = new ArrayList();
																			aListDummy.addAll(maintenaceTimePeriod);
																		descriptorMaintenaceTimePeriodStr = "";
																		if((isDescriptorMaintenanceForTest || isDescriptorMaintenanceForComponentTest) && noOfLines>0)
																		{
																			descriptorMaintenaceTimePeriodStr = maintenanceUtil.convertMaintenacevectorToString(aListDummy, user);
																		}
																			//===================
																
																			urlForInF = this.getUrl(InterfaceTests[aa], request,linkMoreHashMap,keyLocal+test_sep_vIn+jsonTextIn,ui);

																			JSONObject moreSubJsonObIn = new JSONObject();
																			moreSubJsonObIn.put("iconCls","stateSymbol_"+jsonStateIn);
																			moreSubJsonObIn.put("iconTooltip","Normal");
																			moreSubJsonObIn.put("cls","non-header");
																			moreSubJsonObIn.put("measuresLink",urlForInF);
																			moreSubJsonObIn.put("leaf",true);
																			moreSubJsonObIn.put("qtip",jsonTextIn);
																			moreSubJsonObIn.put("selected",selectBold);
																			
																			if(isDescriptorMaintenanceForTest || isDescriptorMaintenanceForComponentTest)
																			{
																				moreSubJsonObIn.put("text",jsonTextIn+"<img class='iconMaintenance' style='margin:2px 5px 0' data-qtip='"+descriptorMaintenaceTimePeriodStr+"' data-qclass='yellowTip'  src='data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='>");
																				moreSubJsonObIn.put("descriptorMaintenaceTimePeriodStr",descriptorMaintenaceTimePeriodStr);
																				moreSubJsonObIn.put("descriptorMaintenaceNoOfLines",noOfLines);
																			} else {
																				moreSubJsonObIn.put("text",jsonTextIn);
																			}
																			
																			moreSubJsonAr.add(moreSubJsonObIn);

																		}
																	}
																	if(moreSubJsonAr.size() > 0)
																		moreSubJsonOb.put("measuresLink","");

																	if(moreSubJsonAr!=null && moreSubJsonAr.size()>0)
																		moreSubJsonOb.put("children",moreSubJsonAr);

																}else{
																	String jsonState = valueLocal.substring(valueLocal.indexOf("=")+1);
																	String jsonText = valueLocal.substring(0,valueLocal.indexOf("="));
																	//String urlTest = (String) linkMoreHashMap.get(jsonText);
																	//urlForInF = this.getUrl(InterfaceTests[aa], request,urlTest);
																	
																	String secdLevelInfo = frstDescr+test_sep_vIn+jsonText;
																	
																	//==2nd level 
																	isDescriptorMaintenanceForTest = egM.isItMaintenanceTime(testNameForMaintenance, curDatTime,secdLevelInfo,true);
																	isDescriptorMaintenanceForComponentTest = egM.isItMaintenanceTime(testNameForMaintenance, curDatTime, serverName, portNo, sid,secdLevelInfo,true);

																	maintenancePeriodVec = new ArrayList();
																	maintenaceTimePeriod = new ArrayList();
																	maintenaceTimePeriod = (ArrayList)getMaintenanceComputing(egM,maintenaceTimePeriod,isDescriptorMaintenanceForTest,isDescriptorMaintenanceForComponentTest,testNameForMaintenance,secdLevelInfo,serverName,portNo,sid);
																	/*if(isDescriptorMaintenanceForTest)
																	{
																		maintenancePeriodVec = egM.getMaintenancePeriods(testNameForMaintenance, secdLevelInfo);
																		if(maintenancePeriodVec != null && maintenaceTimePeriod != null){
																			maintenaceTimePeriod.addAll(maintenancePeriodVec);
																		}
																		maintenancePeriodVec = egM.getUnplannedMaintenancePeriods(testNameForMaintenance, secdLevelInfo);
																		if(maintenancePeriodVec != null && maintenaceTimePeriod != null)
																			maintenaceTimePeriod.addAll(maintenancePeriodVec);
																	}
																	if(isDescriptorMaintenanceForComponentTest)
																	{
																		maintenancePeriodVec = egM.getMaintenancePeriods(testNameForMaintenance, serverName, portNo, sid, secdLevelInfo);
																		if(maintenancePeriodVec != null && maintenaceTimePeriod != null){
																			maintenaceTimePeriod.addAll(maintenancePeriodVec);
																		}
																		maintenancePeriodVec = egM.getUnplannedMaintenancePeriods(testNameForMaintenance, serverName, portNo, sid, secdLevelInfo);
																		if(maintenancePeriodVec != null && maintenaceTimePeriod != null)
																			maintenaceTimePeriod.addAll(maintenancePeriodVec);
																	}*/
																	noOfLines = maintenaceTimePeriod.size();
																	aListDummy = new ArrayList();
																	aListDummy.addAll(maintenaceTimePeriod);
																	descriptorMaintenaceTimePeriodStr = "";
																	if((isDescriptorMaintenanceForTest || isDescriptorMaintenanceForComponentTest) && noOfLines>0)
																	{
																		descriptorMaintenaceTimePeriodStr = maintenanceUtil.convertMaintenacevectorToString(aListDummy, user);
																	}
																	//===================
																
																	urlForInF = this.getUrl(InterfaceTests[aa], request,linkMoreHashMap,jsonText,ui);

																	moreSubJsonOb.put("iconCls","stateSymbol_"+jsonState);
																	moreSubJsonOb.put("iconTooltip","Normal");
																	moreSubJsonOb.put("cls","non-header");
																	moreSubJsonOb.put("measuresLink",urlForInF);
																	moreSubJsonOb.put("leaf",true);
																	moreSubJsonOb.put("qtip",jsonText);
																	moreSubJsonOb.put("selected",selectBold);

																	if(isDescriptorMaintenanceForTest || isDescriptorMaintenanceForComponentTest)
																	{
																		moreSubJsonOb.put("text",jsonText+"<img class='iconMaintenance' style='margin:2px 5px 0' data-qtip='"+descriptorMaintenaceTimePeriodStr+"' data-qclass='yellowTip'  src='data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='>");
																		moreSubJsonOb.put("descriptorMaintenaceTimePeriodStr",descriptorMaintenaceTimePeriodStr);
																		moreSubJsonOb.put("descriptorMaintenaceNoOfLines",noOfLines);
																		
																	} else {
																		moreSubJsonOb.put("text",jsonText);
																	}
																}
															moreSubJsonArray.add(moreSubJsonOb);	
															}
														}
													}
												}else{
													String comparisonTooltip = mappingInfo.getTextDescription("monitor.common.Comparison");
													while (aa < InterfaceTests.length)
													{
														JSONObject interfaceTestJson = new JSONObject();
														JSONObject interfaceTestJson_mobile = new JSONObject();
														/*
														 * Track the number of infos for this test
														 */
														String test_InFLabel = InterfaceTests[aa].getTestLabel(false);

														//checking infoLabel as null or empty string
														if(test_InFLabel == null || test_InFLabel.length() == 0)
														{
															if (aa < InterfaceTests.length-1)
															{
																com.egurkha.monitor.Test nextTest = InterfaceTests[aa+1];
																nextInfTestExists = (InterfaceTests[aa].getTestName().equals(nextTest.getTestName()));
															}

															if (nextInfTestExists)
															{
																aa++;
																continue;
															}
															else
															{
																break;
															}
														}
														//end

														if(validSearchInfosList!=null && validSearchInfosList.size()>0 && !validSearchInfosList.contains(InterfaceTests[aa].getTestName()+"-+"+test_InFLabel))
														{
															aa++;
															continue;
														}

														String urlForInF = this.getUrl(InterfaceTests[aa], request,chkInFMsmtHost,ui,tmpCustomSubTreeList);
														String titleInFText = null;
														if(test_InFLabel!=null)
															titleInFText=ui.getReverseLookupAll(test_InFLabel);
														else titleInFText="";
														
														isDescriptorMaintenanceForTest = egM.isItMaintenanceTime(testNameForMaintenance, curDatTime,titleInFText,true);
														isDescriptorMaintenanceForComponentTest = egM.isItMaintenanceTime(testNameForMaintenance, curDatTime, serverName, portNo, sid,titleInFText,true);
														//--2nd --------------------
														maintenancePeriodVec = new ArrayList();
														maintenaceTimePeriod = new ArrayList();

														maintenaceTimePeriod = (ArrayList)getMaintenanceComputing(egM,maintenaceTimePeriod,isDescriptorMaintenanceForTest,isDescriptorMaintenanceForComponentTest,testNameForMaintenance,titleInFText,serverName,portNo,sid);

														/*if(isDescriptorMaintenanceForTest)
														{
															maintenancePeriodVec = egM.getMaintenancePeriods(testNameForMaintenance,titleInFText);
															if(maintenancePeriodVec != null && maintenaceTimePeriod != null){
																maintenaceTimePeriod.addAll(maintenancePeriodVec);
															}
															maintenancePeriodVec = egM.getUnplannedMaintenancePeriods(testNameForMaintenance,titleInFText);
															if(maintenancePeriodVec != null && maintenaceTimePeriod != null)
																maintenaceTimePeriod.addAll(maintenancePeriodVec);
														}
														if(isDescriptorMaintenanceForComponentTest)
														{
															maintenancePeriodVec = egM.getMaintenancePeriods(testNameForMaintenance, serverName, portNo, sid,titleInFText);
															if(maintenancePeriodVec != null && maintenaceTimePeriod != null){
																maintenaceTimePeriod.addAll(maintenancePeriodVec);
															}
															maintenancePeriodVec = egM.getUnplannedMaintenancePeriods(testNameForMaintenance, serverName, portNo, sid,titleInFText);
															if(maintenancePeriodVec != null && maintenaceTimePeriod != null)
																maintenaceTimePeriod.addAll(maintenancePeriodVec);
														}*/
														noOfLines = maintenaceTimePeriod.size();
														aListDummy = new ArrayList();
														aListDummy.addAll(maintenaceTimePeriod);
														descriptorMaintenaceTimePeriodStr = "";
														if((isDescriptorMaintenanceForTest || isDescriptorMaintenanceForComponentTest) && noOfLines>0)
														{
															descriptorMaintenaceTimePeriodStr = maintenanceUtil.convertMaintenacevectorToString(aListDummy,user);
														}

														//-----------------------
														if (test_InFLabel.trim().length() > 60)
														{
															test_InFLabel = StringUtils.elipsis(test_InFLabel, 60);
														}
														boolean  selectedInFMeasure = testName.indexOf(ui.getReverseLookupAll("+"+test_InFLabel))>=0;
														boolean flageInFTrue=tNameInF2.contains(InterfaceTests[aa].getTestName());
														
														String dispInFDescStr = "";
														String dispInFDescStrTooltip = "";
														if((ui.getReverseLookupAll(test_InFLabel)).trim().equals("More Infos"))
														{
															isMoreInfos=true;
															StringBuffer moreInfoInF = new StringBuffer(64);
															if(!moreInfosTreeViewEnabled)
															{
																moreInfoInF.append(response.encodeURL("/final/monitor/EgMoreInfosView.jsp?") +"qctr=1&showAll=yes&test=");	moreInfoInF.append(EgURLEncoder.encode((InterfaceTests[aa].getTestName()==null?"":InterfaceTests[aa].getTestName()),"UTF-8"));
																moreInfoInF.append("&host=");
																moreInfoInF.append(EgURLEncoder.encode((hostName==null?"":hostName),"UTF-8"));
																moreInfoInF.append("&layer=");
																moreInfoInF.append(EgURLEncoder.encode((layerName==null?"":layerName),"UTF-8"));
																moreInfoInF.append("&site=");
																moreInfoInF.append(EgURLEncoder.encode((siteName==null?"":siteName),"UTf-8"));
																moreInfoInF.append("&comptype=");
																moreInfoInF.append(EgURLEncoder.encode((hostType==null?"":hostType),"UTF-8"));
																moreInfoInF.append("&faketype=");
																moreInfoInF.append(EgURLEncoder.encode((fakeType==null?"":fakeType),"UTF-8"));
																moreInfoInF.append("&fromalarm=");
																moreInfoInF.append(flagAlarm);
																moreInfoInF.append("&isInterface=yes");
																moreInfoInF.append("&selectedInterface=");
																moreInfoInF.append(EgURLEncoder.encode(com.egurkha.util.StringUtils.encodeSecurityChar(temp_TestLabel.trim()),"UTF-8"));
																
																dispInFDescStr = "Click here for the complete list ....";
																
																// More Descriptors
																//JSONObject MoreInfoJson = new JSONObject();
																interfaceTestJson_mobile.put("name",dispInFDescStr);
																interfaceTestJson_mobile.put("leaf",true);
																interfaceTestJson_mobile.put("measuresLink",urlForInF);
																interfaceTestJson_mobile.put("status",InterfaceTests[aa].getTestState());
																interfaceTestJson_mobile.put("msmt_host",testWithMsmtHostHash.get(msmt_hst_mobile));

																strMoreInfosURL=moreInfoInF.toString();

																interfaceTestJson.put("moreDescriptorsURL",moreInfoInF.toString());
																/*interfaceTestJson.put("iconCls","error-state-icon");
																interfaceTestJson.put("leaf",true);
																interfaceTestJson.put("text",dispInFDescStr);
																interfaceTestJson.put("selected",selectBold);
																interfaceTestJson.put("cls","non-header");*/
																//interfaceTestJson.put("children", MoreInfoJson);
																descriptorsJson.put("text",tempDispStr+"&nbsp;<a href=\"javascript:void(0);\" onclick=javascript:MoreInfoLayerTreePopUp(\""+moreInfoInF.toString()+"\",'',event) ><img data-qtip=\"Click here to see the Descriptors\" data-qclass=\"yellowTip\" style=\"position:relative;top:3px\" class=\"iconLayerMoreInfo\" src=\"/final/images/clear.png\"/></a>");
																descriptorsJson.put("selected",selectBold);
															}
															else
															{
																moreInfoInF = new StringBuffer(64);

																moreInfoInF.append(response.encodeURL("/final/monitor/EgMoreInfosView.jsp?") +"comesFrom=LayerModel&qctr=1&from=list&showAll=yes&MoreInfosTreeView=true&tab=LayerModel&searchByDescriptor=true&test=");
																moreInfoInF.append(EgURLEncoder.encode((InterfaceTests[aa].getTestName()==null?"":InterfaceTests[aa].getTestName()),"UTF-8"));
																moreInfoInF.append("&host=");
																moreInfoInF.append(EgURLEncoder.encode((hostName==null?"":hostName),"UTF-8"));
																moreInfoInF.append("&layer=");
																moreInfoInF.append(EgURLEncoder.encode((layerName==null?"":layerName),"UTF-8"));
																moreInfoInF.append("&site=");
																moreInfoInF.append(EgURLEncoder.encode((siteName==null?"":siteName),"UTf-8"));
																moreInfoInF.append("&comptype=");
																moreInfoInF.append(EgURLEncoder.encode((hostType==null?"":hostType),"UTF-8"));
																moreInfoInF.append("&faketype=");
																moreInfoInF.append(EgURLEncoder.encode((fakeType==null?"":fakeType),"UTF-8"));
																moreInfoInF.append("&fromalarm=");
																moreInfoInF.append(flagAlarm);
																moreInfoInF.append("&isInterface=yes");
																moreInfoInF.append("&selectedInterface=");
																moreInfoInF.append(EgURLEncoder.encode(com.egurkha.util.StringUtils.encodeSecurityChar(temp_TestLabel.trim()),"UTF-8"));

																dispInFDescStr = "Click here for the complete list ....";
																// More Descriptors
																//JSONObject MoreInfoJson = new JSONObject();
																interfaceTestJson_mobile.put("name",dispInFDescStr);
																interfaceTestJson_mobile.put("leaf",true);
																interfaceTestJson_mobile.put("measuresLink",urlForInF);
																interfaceTestJson_mobile.put("status",InterfaceTests[aa].getTestState());
																interfaceTestJson_mobile.put("msmt_host",testWithMsmtHostHash.get(msmt_hst_mobile));

																strMoreInfosURL=moreInfoInF.toString();

																//interfaceTestJson.put("moreDescriptorsURL",moreInfoInF.toString());
																interfaceTestJson.put("moreDescriptorsTreeURL",moreInfoInF.toString());
																/*interfaceTestJson.put("iconCls","error-state-icon");
																interfaceTestJson.put("leaf",true);
																interfaceTestJson.put("text",dispInFDescStr);
																interfaceTestJson.put("selected",selectBold);
																interfaceTestJson.put("cls","non-header");*/
																//interfaceTestJson.put("children", MoreInfoJson);

																descriptorsJson.put("text",tempDispStr+"&nbsp;<a href=\"javascript:void(0);\" onclick=javascript:MoreInfoLayerTreePopUp(\""+moreInfoInF.toString()+"\",'',event) ><img data-qtip=\"Click here to see the Descriptors\" data-qclass=\"yellowTip\" style=\"position:relative;top:3px\" class=\"iconLayerMoreInfo\" src=\"/final/images/clear.png\"/></a>");
																descriptorsJson.put("selected",selectBold);
															}
														}
														else if(!flageInFTrue)
														{
															String boldInFStyle = selectedInFMeasure?"<b>":"";
															String display_TestInFLabel=titleInFText;

															String test_seprater=(String)egUI.getValue("TEST_PANEL_SUBTREE",InterfaceTests[aa].getTestName());
															test_seprater=(test_seprater==null || test_seprater.trim().length()==0)?":":test_seprater;

															if(titleInFText!=null && titleInFText.indexOf(test_seprater)>-1)
															{
																display_TestInFLabel=titleInFText.substring(titleInFText.indexOf(test_seprater)+1);
															}
															String testInFLabel_for_display=display_TestInFLabel;
															String test_name_value_InF=InterfaceTests[aa].getTestName();

															if(dispInFDescStrTooltip==null || dispInFDescStrTooltip.trim().length()<=0)
																dispInFDescStrTooltip=titleInFText;
															
															dispInFDescStr = ui.getReverseLookupAll(testInFLabel_for_display);															
															String chkInF = InterfaceTests[aa].getMsmtHost();
															String str_msmt_host = request.getParameter("msmt_host");
															if(chkInF==null || chkInF.trim().length()==0)
																chkInF = chkInFMsmtHost;
															chkInF=(chkInF==null)?"":chkInF;
															String tempchkInF = "";
															thisInFInfo=(thisInFInfo==null)?"":thisInFInfo;
															if (!chkInF.equals("") && !chkInF.equals(null))
															{
																tempchkInF = thisInFInfo + "  " + "(" + chkInF + ")" ;
															}
															else
															{
																tempchkInF = thisInFInfo;
															}
															tempchkInF = tempchkInF;
															if (urlInFHash == null)
															{
																urlInFHash = new HashMap();
																if(testQueryStr!=null)
																{
																	StringTokenizer urlTokens1 = new StringTokenizer(testQueryStr,"&");
																	while (urlTokens1.hasMoreTokens()) 
																	{

																		String urlValueTemp = (String)urlTokens1.nextToken();
																		StringTokenizer urlTokens2 = new StringTokenizer(urlValueTemp,"=");

																		int urlTokens2Count = urlTokens2.countTokens();
																		String key = "";
																		String value = "";
																		if(urlTokens2Count==2)
																		{
																			 key = (String)urlTokens2.nextToken();
																			 value = (String)urlTokens2.nextToken();
																			 urlInFHash.put(key,value);
																		}
																		else
																		{
																			 key = (String)urlTokens2.nextToken();
																			 urlInFHash.put(key,"");
																		}
																	}
																}
															}
															String msmt_HostInFValue = (String)urlInFHash.get("msmt_host");
															boolean chkInFmsmt = false;

															if (!chkInF.equals("") && !chkInF.equals(null))
															{
																chkInF = chkInF;
																
																if(chkInF.equals(msmt_HostInFValue) && str_msmt_host!=null && str_msmt_host.equals(msmt_HostInFValue))
																{
																	chkInFmsmt = true;
																	selectInFBold = tempchkInF.trim().equals((ui.getReverseLookupAll(titleInFText)+" ("+str_msmt_host+")")) && chkInFmsmt && tName.equals(testInFDisplay);
																}
																else
																	selectInFBold = tempchkInF.trim().equals((ui.getReverseLookupAll(titleInFText))) && chkInFmsmt && tName.equals(testInFDisplay);
															}
															else
																selectInFBold = tempchkInF.trim().equals((ui.getReverseLookupAll(titleInFText))) && tName.equals(testInFDisplay);

															if(!selectInFBold)
															{
																if (!chkInF.equals("") && !chkInF.equals(null))
																{
																	chkInF = chkInF;
																	
																	if(chkInF.equals(msmt_HostInFValue) && str_msmt_host!=null && str_msmt_host.equals(msmt_HostInFValue))
																	{
																		chkInFmsmt = true;
																		selectInFBold = tempchkInF.trim().equals(("+"+ui.getReverseLookupAll(titleInFText)+" ("+str_msmt_host+")")) && chkInFmsmt && tName.equals(testInFDisplay);
																	}
																	else
																		selectInFBold = tempchkInF.trim().equals(("+"+ui.getReverseLookupAll(titleInFText))) && chkInFmsmt && tName.equals(testInFDisplay);
																}
																else
																	selectInFBold = tempchkInF.trim().equals(("+"+ui.getReverseLookupAll(titleInFText))) && tName.equals(testInFDisplay);
															}
														
															if(isLayerClicked)// when layer clicked
															{
																selectInFBold=false;
															}
															
															if(titleInFText!=null)
															{
																titleInFText=com.egurkha.util.StringUtils.replace(titleInFText,"\"","&#34");
															}

															String tempdispInFDescStr=dispInFDescStr;
															if(tempdispInFDescStr!=null && tempdispInFDescStr.trim().length()>50 && tempdispInFDescStr.indexOf("<img")<0 && tempdispInFDescStr.indexOf("&#34")<0 && tempdispInFDescStr.indexOf("&#39")<0)
															{
																tempdispInFDescStr=tempdispInFDescStr.substring(0,48)+"..";
															}

															interfaceTestJson.put("iconCls","stateSymbol_"+InterfaceTests[aa].getTestState());
															interfaceTestJson.put("iconTooltip",mappingInfo.getLabelDescription(InterfaceTests[aa].getTestState()));
															interfaceTestJson.put("cls","non-header");
															//interfaceTestJson_mobile.put("name",dispInFDescStr);
															interfaceTestJson_mobile.put("name",tempdispInFDescStr);
															//new code for Mobile measuresLink code starts here
															interfaceTestJson_mobile.put("measuresLink",urlForInF);
															//Ends here
															interfaceTestJson_mobile.put("leaf",true);
															interfaceTestJson_mobile.put("status",InterfaceTests[aa].getTestState());
															interfaceTestJson_mobile.put("msmt_host",testWithMsmtHostHash.get(msmt_hst_mobile));
															if(isDescriptorMaintenanceForTest || isDescriptorMaintenanceForComponentTest)
															{
																interfaceTestJson.put("measuresLink",urlForInF);
																interfaceTestJson.put("leaf",true);
																//interfaceTestJson.put("text",dispInFDescStr);
																interfaceTestJson.put("text",tempdispInFDescStr+"<img class='iconMaintenance' style='margin:2px 5px 0' data-qtip='"+descriptorMaintenaceTimePeriodStr+"' data-qclass='yellowTip'  src='data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='>");
																interfaceTestJson.put("qtip",titleInFText);
																interfaceTestJson.put("selected",selectInFBold);
																interfaceTestJson.put("maintenaceTimePeriodStr",descriptorMaintenaceTimePeriodStr);
																interfaceTestJson.put("maintenaceNoOfLines",noOfLines);
															}
															else
															{
																interfaceTestJson.put("measuresLink",urlForInF);
																interfaceTestJson.put("leaf",true);
																//interfaceTestJson.put("text",dispInFDescStr);
																interfaceTestJson.put("text",tempdispInFDescStr);
																interfaceTestJson.put("qtip",titleInFText);
																interfaceTestJson.put("selected",selectInFBold);
																				
															}
														}
														if(interfaceTestJson_mobile != null && !interfaceTestJson_mobile.isEmpty())
															interfaceTestJsonArray_mobile.add(interfaceTestJson_mobile);
														if((!isMoreInfos) && interfaceTestJson != null && !interfaceTestJson.isEmpty())
															interfaceTestJsonArray.add(interfaceTestJson);
														if (aa < InterfaceTests.length-1)
														{
															com.egurkha.monitor.Test nextTest = InterfaceTests[aa+1];
															nextInfTestExists = (InterfaceTests[aa].getTestName().equals(nextTest.getTestName()));
														}

														if (nextInfTestExists)
														{
															aa++;
														}
														else
														{
															break;
														}
													}
												}
												if(moreSubJsonArray != null && moreSubJsonArray.size() > 0)
													descriptorsJson.put("children", moreSubJsonArray);
												if(interfaceTestJsonArray!=null && interfaceTestJsonArray.size()>0)
												{
													descriptorsJson.put("children", interfaceTestJsonArray);
													//realJsonArray.add(realJson);
												}
												if(interfaceTestJsonArray_mobile!=null && interfaceTestJsonArray_mobile.size()>0)
													descriptorsJson_mobile.put("items", interfaceTestJsonArray_mobile);
												noSubTree=false;
											}
											
											if(real_count==0 && noSubTree)
											{
												String tempDispStr=dispStr;
												if(tempDispStr!=null && tempDispStr.trim().length()>50 && tempDispStr.indexOf("<img")<0 && tempDispStr.indexOf("&#34")<0 && tempDispStr.indexOf("&#39")<0)
													tempDispStr=tempDispStr.substring(0,48)+"..";

												descriptorsJson.put("iconCls","stateSymbol_"+tests[a].getTestState());
												descriptorsJson.put("iconTooltip",mappingInfo.getLabelDescription(tests[a].getTestState()));
												descriptorsJson.put("cls","non-header");
												if(isDescriptorMaintenanceForTest || isDescriptorMaintenanceForComponentTest)
												{
													descriptorsJson.put("measuresLink",url);
													descriptorsJson.put("leaf",true);
													//descriptorsJson.put("text",dispStr);
													descriptorsJson.put("text",tempDispStr+"<img class='iconMaintenance' style='margin:2px 5px 0' data-qtip='"+descriptorMaintenaceTimePeriodStr+"' data-qclass='yellowTip'  src='data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='>");
													descriptorsJson.put("qtip",titleText);
													descriptorsJson.put("selected",selectBold);
													descriptorsJson.put("maintenaceTimePeriodStr",descriptorMaintenaceTimePeriodStr);
													descriptorsJson.put("maintenaceNoOfLines",noOfLines);

												}
												else
												{
													descriptorsJson.put("measuresLink",url);
													descriptorsJson.put("leaf",true);
													//descriptorsJson.put("text",dispStr);
													descriptorsJson.put("text",tempDispStr);
													descriptorsJson.put("qtip",titleText);
													descriptorsJson.put("selected",selectBold);
												}
											}
											//descriptorsJson.put("children",realJsonArray);
										}
										else
										{
											String tempDispStr=dispStr;
											if(tempDispStr!=null && tempDispStr.trim().length()>50 && tempDispStr.indexOf("<img")<0 && tempDispStr.indexOf("&#34")<0 && tempDispStr.indexOf("&#39")<0)
												tempDispStr=tempDispStr.substring(0,48)+"..";

											descriptorsJson.put("iconCls","stateSymbol_"+tests[a].getTestState());
											descriptorsJson.put("iconTooltip",mappingInfo.getLabelDescription(tests[a].getTestState()));
											descriptorsJson.put("cls","non-header");
											if(isDescriptorMaintenanceForTest || isDescriptorMaintenanceForComponentTest)
											{
												descriptorsJson.put("measuresLink",url);
												descriptorsJson.put("leaf",true);
												//descriptorsJson.put("text",dispStr);
												descriptorsJson.put("text",tempDispStr+"<img class='iconMaintenance' style='margin:2px 5px 0' data-qtip='"+descriptorMaintenaceTimePeriodStr+"' data-qclass='yellowTip'  src='data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='>");
												descriptorsJson.put("qtip",titleText);
												descriptorsJson.put("selected",selectBold);
												descriptorsJson.put("maintenaceTimePeriodStr",descriptorMaintenaceTimePeriodStr);
												descriptorsJson.put("maintenaceNoOfLines",noOfLines);

											}
											else
											{
												descriptorsJson.put("measuresLink",url);
												descriptorsJson.put("leaf",true);
												//descriptorsJson.put("text",dispStr);
												descriptorsJson.put("text",tempDispStr);
												descriptorsJson.put("qtip",titleText);
												descriptorsJson.put("selected",selectBold);
											}
										}
									}
									else
									{
										isMoreSubInfos=false;
										String tempDispStr=dispStr;
										if(tempDispStr!=null && tempDispStr.trim().length()>50 && tempDispStr.indexOf("<img")<0 && tempDispStr.indexOf("&#34")<0 && tempDispStr.indexOf("&#39")<0)
											tempDispStr=tempDispStr.substring(0,48)+"..";
										msmt_hst_mobile=(String)tests[a].getTestName();
										descriptorsJson.put("iconCls","stateSymbol_"+tests[a].getTestState());
										//descriptorsJson_mobile.put("name",dispStr);
										descriptorsJson_mobile.put("name",tempDispStr);
										descriptorsJson_mobile.put("endhr",mgr_time);
										descriptorsJson_mobile.put("mgr_date",temp1);
										descriptorsJson_mobile.put("status",tests[a].getTestState());
										descriptorsJson_mobile.put("msmt_host",testWithMsmtHostHash.get(msmt_hst_mobile));
										descriptorsJson_mobile.put("leaf",new Boolean(true));
										//new code for Mobile measuresLink code starts here
										descriptorsJson_mobile.put("measuresLink",url);
										//Ends here
										descriptorsJson.put("iconTooltip",mappingInfo.getLabelDescription(tests[a].getTestState()));
										descriptorsJson.put("cls","non-header");
										if(isDescriptorMaintenanceForTest || isDescriptorMaintenanceForComponentTest)
										{
											descriptorsJson.put("measuresLink",url);
											descriptorsJson.put("leaf",true);
											//descriptorsJson.put("text",dispStr);
											descriptorsJson.put("text",tempDispStr+"<img class='iconMaintenance' style='margin:2px 5px 0' data-qtip='"+descriptorMaintenaceTimePeriodStr+"' data-qclass='yellowTip'  src='data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='>");
											descriptorsJson.put("qtip",titleText);
											descriptorsJson.put("selected",selectBold);
											descriptorsJson.put("maintenaceTimePeriodStr",descriptorMaintenaceTimePeriodStr);
											descriptorsJson.put("maintenaceNoOfLines",noOfLines);
										}
										else
										{
											descriptorsJson.put("measuresLink",url);
											descriptorsJson.put("leaf",true);
											//descriptorsJson.put("text",dispStr);
											descriptorsJson.put("text",tempDispStr);
											descriptorsJson.put("qtip",titleText);
											descriptorsJson.put("selected",selectBold);

										}
									}
								}
								if (a < tests.length-1)
								{
									com.egurkha.monitor.Test nextTest = tests[a+1];
									nextTestExists = (tests[a].getTestName().equals(nextTest.getTestName()));
								}

								//if(isMoreInfos && false)
								if(isMoreInfos && (!isMoreSubInfos))
								{
									String comparisonTooltip = mappingInfo.getTextDescription("monitor.common.Comparison");
									Testinfo.put("leaf",new Boolean(true));
									
									String params=strMoreInfosURL.substring(strMoreInfosURL.indexOf("?")+1,strMoreInfosURL.trim().length());

									if(moreInfosTreeViewEnabled)
									{
										Testinfo.put("fireEvent",params);
										if(disableDescFlag)
											Testinfo.put("text",mappingInfo.getTestDescription(""+ui.getReverseLookupAll(tests[a].getTestName()))+"&nbsp;<a href=\"javascript:void(0);\" onclick=javascript:MoreInfoLayerTreePopUp(\""+params+"\",'',event) ><img data-qtip=\"Click here to see the Descriptors\" data-qclass=\"yellowTip\" style=\"position:relative;top:3px\" class=\"iconLayerMoreInfo\" src=\"/final/images/clear.png\"/></a>");
										else
											Testinfo.put("text",mappingInfo.getTestDescription(""+ui.getReverseLookupAll(tests[a].getTestName()))+"&nbsp;<a href=\"javascript:void(0);\" onclick=javascript:MoreInfoLayerTreePopUp(\""+params+"\",'',event) ><img data-qtip=\"Click here to see the Descriptors\" data-qclass=\"yellowTip\" style=\"position:relative;top:3px\" class=\"iconLayerMoreInfo\" src=\"/final/images/clear.png\"/></a><div style=\"float:right;position:relative;\"><div style=\"position:absolute;top:"+topFalg+";right:10px;background:transparent !important\" > <a href=\"javascript:void(0);\" onclick=javascript:showDescriptorComparison(\""+qryStr+"\",event) class=\"comparison-image-container\"><img data-qtip=\""+comparisonTooltip+"\" data-qclass=\"yellowTip\" class=\"comparison-image iconComponentDetails\" src=\"/final/images/clear.png\"/></a></div><div>");
									}
									else
									{
										String url_params="/final/monitor/EgMoreInfosApp.jsp?"+params+"&page=More Infos";
										Testinfo.put("fireEvent",params);
										if(disableDescFlag)
											Testinfo.put("text",mappingInfo.getTestDescription(""+ui.getReverseLookupAll(tests[a].getTestName()))+"&nbsp;<a href=\"javascript:void(0);\" onclick=javascript:showMoreInfos(\""+params+"\",event) ><img data-qtip=\"More Infos\" data-qclass=\"yellowTip\" style=\"position:relative;top:3px\" class=\"iconLayerMoreInfo\" src=\"/final/images/clear.png\"/></a>");
										else
											Testinfo.put("text",mappingInfo.getTestDescription(""+ui.getReverseLookupAll(tests[a].getTestName()))+"&nbsp;<a href=\"javascript:void(0);\" onclick=javascript:showMoreInfos(\""+params+"\",event) ><img data-qtip=\"More Infos\" data-qclass=\"yellowTip\" style=\"position:relative;top:3px\" class=\"iconLayerMoreInfo\" src=\"/final/images/clear.png\"/></a><div style=\"float:right;position:relative;\"><div style=\"position:absolute;top:"+topFalg+";right:10px;background:transparent !important\" > <a href=\"javascript:void(0);\" onclick=javascript:showDescriptorComparison(\""+qryStr+"\",event) class=\"comparison-image-container\"><img data-qtip=\""+comparisonTooltip+"\" data-qclass=\"yellowTip\" class=\"comparison-image iconComponentDetails\" src=\"/final/images/clear.png\"/></a></div><div>");
									}
								}
								else
								{
									if(descriptorsJson != null && !descriptorsJson.isEmpty()){
										descriptorsJsonArray.add(descriptorsJson);
									}
									if(descriptorsTreeJson != null && !descriptorsTreeJson.isEmpty()){
										descriptorsJsonArray.add(descriptorsTreeJson);
									}
									if(descriptorsJson_mobile != null && !descriptorsJson_mobile.isEmpty()){
										descriptorsJsonArray_mobile.add(descriptorsJson_mobile);
									}
								}

								if (nextTestExists)
								{
									a++;
								}
								else
								{
									break;
								}
							}

							if(descriptorsJsonArray!=null && descriptorsJsonArray.size()>0)
								Testinfo.put("children",descriptorsJsonArray);

							if(descriptorsJsonArray_mobile==null || descriptorsJsonArray_mobile.size()==0)
								tArray.put("leaf",new Boolean(true));

							if(fromMobile!=null && fromMobile.equalsIgnoreCase("yes"))
							{
								tArray.put("isMoreInfosTreeView",isMoreInfos);
								/*if (tests[a].getTestInfo().equals(com.egurkha.monitor.Test.MORE_INFOS))
								tArray.put("isMoreInfosTreeView",true);
								else
								tArray.put("isMoreInfosTreeView",false);*/
							}
							tArray.put("items",descriptorsJsonArray_mobile);

							if(descriptorsJsonArray!=null && descriptorsJsonArray.size()>0)
								isHaveAllData=true;
						}
						else
						{
							String url = null;
							String label = null;
							String label_for_title=null;
							String state = tests[a].getTestState();
							String testLabel_for_display="";
							//Saravanan.A added this code
							boolean  selectedTestElse= testName.indexOf(tests[a].getTestName())>=0 && testName.startsWith((tests[a].getTestName()+"-"));
							String testNameForMaintenance=tests[a].getTestName();
							if(testNameForMaintenance!=null && testNameForMaintenance.length()>0)
									testNameForMaintenance=testNameForMaintenance;

							String curDatTime=dateInfo.egetDate();
							String descript=tests[a].getTestLabel(false);
							if(descript!=null && descript.length()>0)
									descript=descript;

							boolean isDescriptorMaintenanceForTest=egM.isItMaintenanceTime(testNameForMaintenance, curDatTime,descript);
							isPortRelevant = specsInfo.isPortRelevantForTest(testNameForMaintenance);
							if(!isPortRelevant)
							{
								portNo = "NULL";
							}
							boolean isDescriptorMaintenanceForComponentTest=egM.isItMaintenanceTime(testNameForMaintenance, curDatTime, serverName, portNo, sid,descript);

							List maintenancePeriodVec=new ArrayList();
							maintenaceTimePeriod=new ArrayList();

							maintenaceTimePeriod = (ArrayList)getMaintenanceComputing(egM,maintenaceTimePeriod,isDescriptorMaintenanceForTest,isDescriptorMaintenanceForComponentTest,testNameForMaintenance,descript,serverName,portNo,sid);

							/*if(isDescriptorMaintenanceForTest)
							{
								maintenancePeriodVec=egM.getMaintenancePeriods(testNameForMaintenance,descript);
								if(maintenancePeriodVec!=null && maintenaceTimePeriod!=null)
								{
									maintenaceTimePeriod.addAll(maintenancePeriodVec);
								}
								maintenancePeriodVec=egM.getUnplannedMaintenancePeriods(testNameForMaintenance,descript);
								if(maintenancePeriodVec!=null && maintenaceTimePeriod!=null)
									maintenaceTimePeriod.addAll(maintenancePeriodVec);
							}
							if(isDescriptorMaintenanceForComponentTest)
							{
								maintenancePeriodVec=egM.getMaintenancePeriods(testNameForMaintenance, serverName, portNo, sid,descript);
								if(maintenancePeriodVec!=null && maintenaceTimePeriod!=null)
								{
									maintenaceTimePeriod.addAll(maintenancePeriodVec);
								}
								maintenancePeriodVec=egM.getUnplannedMaintenancePeriods(testNameForMaintenance, serverName, portNo, sid,descript);
								if(maintenancePeriodVec!=null && maintenaceTimePeriod!=null)
									maintenaceTimePeriod.addAll(maintenancePeriodVec);
							}*/
							noOfLines=maintenaceTimePeriod.size();

							aListDummy = new ArrayList();
							aListDummy.addAll(maintenaceTimePeriod);

							String descriptorMaintenaceTimePeriodStr="";
							if((isDescriptorMaintenanceForTest || isDescriptorMaintenanceForComponentTest) && noOfLines>0)
							{
								descriptorMaintenaceTimePeriodStr = maintenanceUtil.convertMaintenacevectorToString(aListDummy,user);
							}
							if (tests[a].getTestInfo().equals(com.egurkha.monitor.Test.MORE_INFOS))
							{
								label = "Click here for the complete list ...";
								label_for_title=label;
							}
							else
							{
								HashMap symbolHash = null;
								String dispStr = "";
								String dispStrTooltip = "";
								String temp_testLabel_for_display = "";
								String temp_dispStrTooltip = "";
								url = this.getUrl(tests[a], request,ui);
								label = tests[a].getTestLabel(false);
								testLabel_for_display=label;
								String test_name_value=tests[a].getTestName();
								String isSymbol=(String)egUI.getValue("Tests_For_LayerModel_Images",test_name_value);

								String skipInfos=(String)egUI.getValue("MISC_ARGS","FINAL_INFO");
								boolean symbolBlock=true;
								ArrayList exclude_info_list = new ArrayList();
								if(skipInfos!=null && skipInfos.trim().length()>0)
									exclude_info_list = tokInfo.egTokenizer(skipInfos, ",");


								if(exclude_info_list!=null && testLabel_for_display!=null && exclude_info_list.contains(testLabel_for_display))
									symbolBlock=false;

								symbolHash=(HashMap)getSymbolText(symbolBlock,isSymbol,testLabel_for_display,test_name_value,nextTestExists,tokInfo,mappingInfo,dispStrTooltip);
									
									temp_testLabel_for_display=(String)symbolHash.get("testLabel_for_display");
									temp_dispStrTooltip=(String)symbolHash.get("dispStrTooltip");
									
									if(temp_testLabel_for_display !=null && temp_testLabel_for_display.trim().length()>0)
										testLabel_for_display=temp_testLabel_for_display;

									if(temp_dispStrTooltip !=null && temp_dispStrTooltip.trim().length()>0)
										dispStrTooltip=temp_dispStrTooltip;
								// Ended by Chandrasekhar

								if(label!=null)
									label_for_title=ui.getReverseLookupAll(label);
								else label_for_title="";
								if (label.length() > 60)
								{
									//label = StringUtils.elipsis(label, 60);
								}
							}
							String qryStr = response.encodeURL("../servlet/com.eg.EgMonitorController?")+"monCmd=descComparison&testName="+ui.getReverseLookupAll(tests[a].getTestName())+"&serviceName="+EgURLEncoder.encode(siteName,"UTF-8")+"&componentName="+EgURLEncoder.encode(hostName,"UTF-8")+"&layerName="+EgURLEncoder.encode(layerName,"UTF-8")+"&componentType="+EgURLEncoder.encode(hostType,"UTF-8");
							if(sessionId_sm != null)
							{
								qryStr+="&sessionId_SM="+sessionId_sm;
							}

							boolean isMoreInfos=false;
							String strMoreInfosURL=null;
							// Last has no nextTest and more infos is true
							if (tests[a].getTestInfo().equals(com.egurkha.monitor.Test.MORE_INFOS))
							{
								String comparisonTooltip = mappingInfo.getTextDescription("monitor.common.Comparison");
								isMoreInfos=true;
								StringBuffer moreInfos = new StringBuffer(64);
								boolean  selectInfo1=false;
								if(!moreInfosTreeViewEnabled)
								{
									moreInfos.append(response.encodeURL("/final/monitor/EgMoreInfosView.jsp?")+"qctr=1&showAll=yes&test=");
									moreInfos.append(EgURLEncoder.encode((tests[a].getTestName()==null?"":tests[a].getTestName()),"UTF-8"));
									moreInfos.append("&host=");
									moreInfos.append(EgURLEncoder.encode((hostName==null?"":hostName),"UTF-8"));
									moreInfos.append("&layer=");
									moreInfos.append(layerName);
									moreInfos.append("&site=");
									moreInfos.append(EgURLEncoder.encode((siteName==null?"":siteName),"UTf-8"));
									moreInfos.append("&comptype=");
									moreInfos.append(EgURLEncoder.encode((hostType==null?"":hostType),"UTF-8"));
									moreInfos.append("&faketype=");
									moreInfos.append(EgURLEncoder.encode((fakeType==null?"":fakeType),"UTF-8"));
									moreInfos.append("&fromalarm=");
									moreInfos.append(flagAlarm);

									Testinfo.put("iconCls","stateSymbol_"+state);

									//Saravanan.A added the follwing lines on 12-12-2007
									
									if(enable.equalsIgnoreCase("True"))
									{
										selectInfo1 = true;
									}
									Testinfo.put("qtip",mappingInfo.getTestDescription(""+ui.getReverseLookupAll(tests[a].getTestName())));
									Testinfo.put("text",mappingInfo.getTestDescription(""+ui.getReverseLookupAll(tests[a].getTestName()))+"<div style=\"float:right;\"><a href=\"javascript:void(0);\" onclick=javascript:showMoreInfos(\""+qryStr+"\") class=\"comparison-image-container\"><img title=\""+mappingInfo.getTextDescription("monitor.layermodel.Comparison")+"\" class=\"comparison-image iconDetailList\" src=\"/final/images/clear.png\"/></a></div>");
									/* Testinfo.put("comparisonLink",qryStr);
									Testinfo.put("comparisonTooltip",mappingInfo.getTextDescription("monitor.layermodel.Comparison")); */
									if (selectInfo1)
									{
										Testinfo.put("tr_display_text",tr_display_text);
									}

									if(label.equals("Click here for the complete list ...."))
									{
									}
									else
									{
										Testinfo.put("iconCls","stateSymbol_"+state);
									}
									
									if(label_for_title!=null)
									{
										label_for_title=com.egurkha.util.StringUtils.replace(label_for_title,"\"","&#34");
									}
									//More Descriptors/More Information
									//JSONObject MoreInfoJson = new JSONObject();
									strMoreInfosURL=moreInfos.toString();

									String params=strMoreInfosURL.substring(strMoreInfosURL.indexOf("?")+1,strMoreInfosURL.trim().length());

									Testinfo.put("moreDescriptorsURL",moreInfos.toString());
									Testinfo.put("leaf",true);
									//Testinfo.put("text",label);
									//Testinfo.put("text",label+"<div style=\"float:right;position:relative;\"><div style=\"position:absolute;top:5px;right:10px\" ><a href=\"javascript:void(0);\" onclick=javascript:showMoreInfos(\""+params+"\",event) ><img data-qtip=\"More Infos\" data-qclass=\"yellowTip\" class=\"iconPlus\" src=\"/final/images/clear.png\"/></a></div><div>");

									Testinfo.put("fireEvent",params);
									if(disableDescFlag)
									{
										Testinfo.put("text",label+"&nbsp;<a href=\"javascript:void(0);\" onclick=javascript:showMoreInfos(\""+params+"\",event) ><img data-qtip=\"More Infos\" data-qclass=\"yellowTip\" style=\"position:relative;top:3px\" class=\"iconLayerMoreInfo\" src=\"/final/images/clear.png\"/></a>");
									}
									else
									{
										if(showMaintenanceConfigIcon)
										{
											Testinfo.put("text",label+"&nbsp;<a href=\"javascript:void(0);\" onclick=javascript:showMoreInfos(\""+params+"\",event) ><img data-qtip=\"More Infos\" data-qclass=\"yellowTip\" style=\"position:relative;top:3px\" class=\"iconLayerMoreInfo\" src=\"/final/images/clear.png\"/></a><div style=\"float:right;position:relative;\"><div style=\"position:absolute;top:"+topFalg+";right:10px;background:transparent !important\" > "+getMaintainenancePolicyConfigURL(tests[a].getTestName(),""+ui.getReverseLookupAll(tests[a].getTestName()),hostName,hostType,isApplicationLayer,mappingInfo)+"&nbsp;<a href=\"javascript:void(0);\" onclick=javascript:showDescriptorComparison(\""+qryStr+"\",event) class=\"comparison-image-container\"><img data-qtip=\""+comparisonTooltip+"\" data-qclass=\"yellowTip\" class=\"comparison-image iconComponentDetails\" src=\"/final/images/clear.png\"/></a></div><div>");
										}
										else
										{
											Testinfo.put("text",label+"&nbsp;<a href=\"javascript:void(0);\" onclick=javascript:showMoreInfos(\""+params+"\",event) ><img data-qtip=\"More Infos\" data-qclass=\"yellowTip\" style=\"position:relative;top:3px\" class=\"iconLayerMoreInfo\" src=\"/final/images/clear.png\"/></a><div style=\"float:right;position:relative;\"><div style=\"position:absolute;top:"+topFalg+";right:10px;background:transparent !important\" > <a href=\"javascript:void(0);\" onclick=javascript:showDescriptorComparison(\""+qryStr+"\",event) class=\"comparison-image-container\"><img data-qtip=\""+comparisonTooltip+"\" data-qclass=\"yellowTip\" class=\"comparison-image iconComponentDetails\" src=\"/final/images/clear.png\"/></a></div><div>");
										}
									}

									Testinfo.put("qtip",label_for_title);
									
									//Testinfo.put("children", MoreInfoJson);
								}
								else
								{
									moreInfos = new StringBuffer(64);
									moreInfos.append(response.encodeURL("/final/monitor/EgMoreInfosView.jsp?")+"comesFrom=LayerModel&qctr=1&from=list&showAll=yes&MoreInfosTreeView=true&tab=LayerModel&searchByDescriptor=true&test=");
									moreInfos.append(EgURLEncoder.encode((tests[a].getTestName()==null?"":tests[a].getTestName()),"UTF-8"));
									moreInfos.append("&host=");
									moreInfos.append(EgURLEncoder.encode((hostName==null?"":hostName),"UTF-8"));
									moreInfos.append("&layer=");
									moreInfos.append(layerName);
									moreInfos.append("&site=");
									moreInfos.append(EgURLEncoder.encode((siteName==null?"":siteName),"UTf-8"));
									moreInfos.append("&comptype=");
									moreInfos.append(EgURLEncoder.encode((hostType==null?"":hostType),"UTF-8"));
									moreInfos.append("&faketype=");
									moreInfos.append(EgURLEncoder.encode((fakeType==null?"":fakeType),"UTF-8"));
									moreInfos.append("&fromalarm=");
									moreInfos.append(flagAlarm);

									Testinfo.put("iconCls","stateSymbol_"+state);

									//Saravanan.A added the follwing lines on 12-12-2007
									selectInfo1=false;
									if(enable.equalsIgnoreCase("True"))
									{
										selectInfo1 = true;
									}
									Testinfo.put("qtip",mappingInfo.getTestDescription(""+ui.getReverseLookupAll(tests[a].getTestName())));
									Testinfo.put("text",mappingInfo.getTestDescription(""+ui.getReverseLookupAll(tests[a].getTestName()))+"<div style=\"float:right;\"><a href=\"javascript:void(0);\" onclick=javascript:showMoreInfos(\""+qryStr+"\") class=\"comparison-image-container\"><img title=\""+mappingInfo.getTextDescription("monitor.layermodel.Comparison")+"\" class=\"comparison-image iconDetailList\" src=\"/final/images/clear.png\"/></a></div>");
									/* Testinfo.put("comparisonLink",qryStr);
									Testinfo.put("comparisonTooltip",mappingInfo.getTextDescription("monitor.layermodel.Comparison")); */
									if (selectInfo1)
									{
										Testinfo.put("tr_display_text",tr_display_text);
									}

									if(label.equals("Click here for the complete list ...."))
									{
									}
									else
									{
										Testinfo.put("iconCls","stateSymbol_"+state);
									}
									
									if(label_for_title!=null)
									{
										label_for_title=com.egurkha.util.StringUtils.replace(label_for_title,"\"","&#34");
									}
									//More Descriptors/More Information
									//JSONObject MoreInfoJson = new JSONObject();
									//Testinfo.put("moreDescriptorsURL",moreInfos.toString());
									strMoreInfosURL=moreInfos.toString();
									Testinfo.put("moreDescriptorsTreeURL",moreInfos.toString());
									Testinfo.put("leaf",true);
									//Testinfo.put("text",label);
									
									String params=strMoreInfosURL.substring(strMoreInfosURL.indexOf("?")+1,strMoreInfosURL.trim().length());
									//Testinfo.put("text",label+"<div style=\"float:right;position:relative;\"><div style=\"position:absolute;top:5px;right:10px\" ><a href=\"javascript:void(0);\" onclick=javascript:MoreInfoLayerTreePopUp(\""+params+"\",'',event) ><img data-qtip=\"More Infos\" data-qclass=\"yellowTip\" class=\"iconPlus\" src=\"/final/images/clear.png\"/></a></div><div>");
									Testinfo.put("fireEvent",params);
									if(disableDescFlag)
										Testinfo.put("text",label+"&nbsp;<a href=\"javascript:void(0);\" onclick=javascript:MoreInfoLayerTreePopUp(\""+params+"\",'',event) ><img data-qtip=\"Click here to see the Descriptors\" data-qclass=\"yellowTip\" style=\"position:relative;top:3px\" class=\"iconLayerMoreInfo\" src=\"/final/images/clear.png\"/></a>");
									else
										Testinfo.put("text",label+"&nbsp;<a href=\"javascript:void(0);\" onclick=javascript:MoreInfoLayerTreePopUp(\""+params+"\",'',event) ><img data-qtip=\"Click here to see the Descriptors\" data-qclass=\"yellowTip\" style=\"position:relative;top:3px\" class=\"iconLayerMoreInfo\" src=\"/final/images/clear.png\"/></a><div style=\"float:right;position:relative;\"><div style=\"position:absolute;top:"+topFalg+";right:10px;background:transparent !important\" > <a href=\"javascript:void(0);\" onclick=javascript:showDescriptorComparison(\""+qryStr+"\",event) class=\"comparison-image-container\"><img data-qtip=\""+comparisonTooltip+"\" data-qclass=\"yellowTip\" class=\"comparison-image iconComponentDetails\" src=\"/final/images/clear.png\"/></a></div><div>");

									Testinfo.put("qtip",label_for_title);
								}
								isHaveAllData=true;
							}
							else // Has no more nextTests and no more infos
							{
								boolean  selectedTest1 = testName.trim().indexOf(tests[a].getTestName())>=0 && testName.trim().startsWith((tests[a].getTestName()+"-"));

								String selectedInfo = "";
								String tName1 = "";
								String testLabeltemp = "";
								boolean selectInfo1 = false;
								String testDisplay1 = "";
								String test_name_value=tests[a].getTestName();
								
								if (testName!= null && !testName.equals("") && !testName.equalsIgnoreCase("null"))
								{
									selectedInfo = (testName.substring(testName.indexOf("-")+1));
									tName1 = testName.substring(0,testName.indexOf("-"));
									testDisplay1 = ui.getReverseLookupAll(tests[a].getTestName());

									for (int i=0; i<tests.length; i++)
									{
										testLabeltemp = tests[i].getTestLabel(false);
										testLabeltemp = ui.getReverseLookupAll(testLabeltemp);
										a1.add(tName1+ "- "+testLabeltemp);
									}
									testName = testName;
									selectInfo1 = a1.contains(testName) && tName1.equals(testDisplay1);

									if((!selectInfo1) && subTreeTestsList!=null && subTreeTestsList.size()>0 && tName1!=null && subTreeTestsList.contains(tName1))
									{
										String test_seprater=(String)egUI.getValue("TEST_PANEL_SUBTREE",tName1);
										test_seprater=(test_seprater==null || test_seprater.length()==0)?":":test_seprater;
										int test_sep_len=test_seprater.length();
										if(testName!=null && testName.indexOf(test_seprater)>-1)
										{
											String temp_interface=testName.substring(0,testName.indexOf(test_seprater));
											//if(temp_interface!=null)
											//	temp_interface=temp_interface;

											selectInfo1 = a1.contains(temp_interface) && tName1.equals(testDisplay1);
										}
									}
								}

								selectedInfo = selectedInfo;
								//selectBold = tName1.equals(testDisplay1) && selectedInfo.equals((ui.getReverseLookupAll(label)));
								selectBold = tName1.equals(testDisplay1) && (selectedInfo.indexOf((ui.getReverseLookupAll(label))) > -1);
								String testStateImage = null;
								if(isMoreInfosTreeView)
								{
									//ArrayList layersForHostSystem = tableInfo.getLayersForComponent("Host_system");
									if(layersForHostSystem!=null && layersForHostSystem.contains(layerName))
										testStateImage = (String)ap.getTestPriority(hostName, "Host_system", layerName, test_name_value.replace(' ', '+'));
									else
										testStateImage = (String)ap.getTestPriority(hostName, hostType, layerName, test_name_value.replace(' ', '+'));
								}
								if(testStateImage!=null && testStateImage.trim().length()>0)
									Testinfo.put("iconCls","state_"+testStateImage);
								else
									Testinfo.put("iconCls","state_"+state);

								if(testLabel_for_display!=null && testLabel_for_display.length()>0)
								{
									label=testLabel_for_display;
								}
								String msmt_hst_mobile=null;
								msmt_hst_mobile=(String)tests[a].getTestName();
								tArray.put("name",mappingInfo.getTestDescription(ui.getReverseLookupAll(tests[a].getTestName())));
								tArray.put("internalTestName",tests[a].getTestName());
								tArray.put("status",state);
								tArray.put("endhr",mgr_time);
								tArray.put("mgr_date",temp1);
								tArray.put("msmt_host",testWithMsmtHostHash.get(msmt_hst_mobile));

								if (!StringUtils.isNull(label))
								{
									if(isLayerClicked)// when layer clicked
									{
										selectedTest1=false;
									}
									Testinfo.put("qtip",mappingInfo.getTestDescription(""+ui.getReverseLookupAll(tests[a].getTestName())));
									if(showMaintenanceConfigIcon)
									{
										Testinfo.put("text",mappingInfo.getTestDescription(""+ui.getReverseLookupAll(tests[a].getTestName()))+"<div style=\"float:right;\">"+getMaintainenancePolicyConfigURL(tests[a].getTestName(),""+ui.getReverseLookupAll(tests[a].getTestName()),hostName,hostType,isApplicationLayer,mappingInfo)+"</div>");
									}
									else
									{
										Testinfo.put("text",mappingInfo.getTestDescription(""+ui.getReverseLookupAll(tests[a].getTestName())));
									}
									Testinfo.put("selected",selectedTest1);
									if(isTestinMaintenance || isHostTestinMaintenace || isCompTestinMaintenance)
									{
									    Testinfo.put("maintenaceTimePeriodStr",maintenaceTimePeriodStr);
										Testinfo.put("maintenaceNoOfLines",noOfLines);
									}
								}
								else
								{
									url=url.substring(url.indexOf("?")+1,url.length());
									if(isLayerClicked)// when layer clicked
									{
										selectedTest1=false;
									}
									//new code for Mobile measuresLink code starts here
									tArray.put("measuresLink",url);
									//Ends here
									Testinfo.put("measuresLink",url);
									Testinfo.put("leaf",true);
									Testinfo.put("qtip",mappingInfo.getTestDescription(""+ui.getReverseLookupAll(tests[a].getTestName())));
									if(showMaintenanceConfigIcon)
									{
										Testinfo.put("text",mappingInfo.getTestDescription(""+ui.getReverseLookupAll(tests[a].getTestName()))+"<div style=\"float:right;\">"+getMaintainenancePolicyConfigURL(tests[a].getTestName(),""+ui.getReverseLookupAll(tests[a].getTestName()),hostName,hostType,isApplicationLayer,mappingInfo)+"</div>");
									}
									else
									{
										Testinfo.put("text",mappingInfo.getTestDescription(""+ui.getReverseLookupAll(tests[a].getTestName())));
									}
									Testinfo.put("selected",selectedTest1);

									if(isTestinMaintenance || isHostTestinMaintenace || isCompTestinMaintenance)
									{
										Testinfo.put("descriptorMaintenaceTimePeriodStr",maintenaceTimePeriodStr);
										Testinfo.put("descriptorMaintenaceNoOfLines",noOfLines);

									}
								}

								if (!StringUtils.isNull(label))
								{
									if (url!=null)
									url=url.substring(url.indexOf("?")+1,url.length());

									if(enable.equalsIgnoreCase("True"))
									{
										selectInfo1 = true;
									}
									if (selectInfo1)
									{
										Testinfo.put("tr_display_text",tr_display_text);
									}

									if(isLayerClicked)// when layer clicked
									{
										selectedTest1=false;
									}

									if(label_for_title!=null)
									{
										label_for_title=com.egurkha.util.StringUtils.replace(label_for_title,"\"","&#34");
									}
									if(subTreeTestsList!=null && subTreeTestsList.size()>0 && test_name_value!=null && subTreeTestsList.contains(test_name_value))
									{
										String test_sep_v=(String)egUI.getValue("TEST_PANEL_SUBTREE",test_name_value);
										boolean isMoreSub = false;
										String test_sep_vIn="";
										if(multiSubTreeList.contains(test_name_value)){
											String sepEntryCheck=(String)egUI.getValue("TEST_PANEL_SUBTREE","SecondLevelSubTreeList:"+test_name_value);
											if(sepEntryCheck == null || sepEntryCheck.trim().length() == 0)
												sepEntryCheck=(String)egUI.getValue("TEST_PANEL_SUBTREE",test_name_value);

											if(sepEntryCheck != null && sepEntryCheck.trim().length() > 0)
												isMoreSub =true;
										}
										test_sep_v=(String)egUI.getValue("TEST_PANEL_SUBTREE",test_name_value);
										test_sep_v=(test_sep_v==null || test_sep_v.trim().length()==0)?":":test_sep_v;

										if(finalInterfacesDescForLayer!=null && finalInterfacesDescForLayer.size()>0)
										{
											String titleText = label_for_title;
											String temp_TestLabel= tests[a].getTestLabel(false);
											if(temp_TestLabel!=null)
											{
												temp_TestLabel=com.egurkha.util.StringUtils.replace(temp_TestLabel,"|plus|","+");
												temp_TestLabel=com.egurkha.util.StringUtils.replace(temp_TestLabel,"|amp|","&");
												temp_TestLabel=com.egurkha.util.StringUtils.replace(temp_TestLabel,"|pct|","%");
												temp_TestLabel=com.egurkha.util.StringUtils.replace(temp_TestLabel,"|hash|","#");
											}

											String chkInFMsmtHost = tests[a].getMsmtHost();
											String temp_TestLabel2=temp_TestLabel;
											if(temp_TestLabel!=null && temp_TestLabel.trim().length()>0 && chkInFMsmtHost!=null && chkInFMsmtHost.trim().length()>0 && temp_TestLabel.trim().lastIndexOf(" ")>0 && temp_TestLabel.trim().indexOf(chkInFMsmtHost)>-1 )
											{
												temp_TestLabel2=temp_TestLabel.substring(0,temp_TestLabel.lastIndexOf(" "));
												if(temp_TestLabel2!=null)
													temp_TestLabel2=temp_TestLabel2.trim();
											}

											Hashtable temp_hash=(Hashtable)finalInterfacesDescForLayer.get(test_name_value+"-+"+temp_TestLabel2);
											Hashtable temp_more_msmt_hash=(Hashtable)finalInterfacesDescForLayer.get(test_name_value+"-+"+temp_TestLabel2+"_MoreMsmt");
											LinkedList finalInterfaceTestsDesc=new LinkedList();
											if(temp_hash!=null && temp_hash.size()>0)
											{
												Enumeration ee2 = temp_hash.keys();
												while (ee2.hasMoreElements())
												{
													JSONObject descriptorsJson = new JSONObject();
													String key = (String) ee2.nextElement();
													String prior_state = (String) temp_hash.get(key);
													if(temp_more_msmt_hash!=null && temp_more_msmt_hash.size()>0)
													{
														String msmt_host_based_prior_state = (String) temp_more_msmt_hash.get(key+"~MH~"+chkInFMsmtHost);
														if(msmt_host_based_prior_state!=null && msmt_host_based_prior_state.trim().length()>0)
															prior_state = msmt_host_based_prior_state;
													}
													if (prior_state == null)
														continue;

													// Subtree test have both subtree infos and non-subtree changes.
													// by Saravanan.A on 19-4-2012
													boolean flage_normal=false;
													if(key!=null && key.trim().length()>0)
													{
														if(key.indexOf(test_sep_v)>=0)
														{
															try
															{
																String key_sub=key.substring(key.indexOf(test_sep_v)+1);
																if(key_sub==null || key_sub.trim().length()==0)
																	flage_normal=true;
															}
															catch(Exception e)
															{
																flage_normal=true;
															}
														}
														else if(key.indexOf(test_sep_v)<0)
														{
															flage_normal=true;
														}
													}
													else
														flage_normal=true;

													if(flage_normal)
													{
														descriptorsJson.put("iconCls","stateSymbol_"+state);
														descriptorsJson.put("iconTooltip",mappingInfo.getLabelDescription(state));
														descriptorsJson.put("cls","non-header");
														if(isDescriptorMaintenanceForTest || isDescriptorMaintenanceForComponentTest)
														{
															descriptorsJson.put("measuresLink",url);
															descriptorsJson.put("leaf",true);
															descriptorsJson.put("qtip",label_for_title);
															descriptorsJson.put("text",ui.getReverseLookupAll(label)+"<img class='iconMaintenance' style='margin:2px 5px 0' data-qtip='"+descriptorMaintenaceTimePeriodStr+"' data-qclass='yellowTip'  src='data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='>");
															descriptorsJson.put("selected",selectedTest1);
															descriptorsJson.put("descriptorMaintenaceTimePeriodStr",descriptorMaintenaceTimePeriodStr);
															descriptorsJson.put("descriptorMaintenaceNoOfLines",noOfLines);
														}
														else
														{
															descriptorsJson.put("measuresLink",url);
															descriptorsJson.put("leaf",true);
															descriptorsJson.put("qtip",label_for_title);
															descriptorsJson.put("text",ui.getReverseLookupAll(label));
															descriptorsJson.put("selected",selectedTest1);
														}
													}
													else
													{
														finalInterfaceTestsDesc.add(key);
														finalInterfaceTestsDesc.add(prior_state);
														finalInterfaceTestsDesc.add("");
													}
													descriptorsJsonArray.add(descriptorsJson);
												}
												Testinfo.put("children",descriptorsJsonArray);
												temp_hash=new Hashtable();
											}

											LayerModel lm2 = null;
											com.egurkha.monitor.Test[] InterfaceTests = null;
											HashMap urlInFHash = null;
											int ccc = 0;
											int real_count=0;
											if(finalInterfaceTestsDesc!=null && finalInterfaceTestsDesc.size()>0)
											{
												lm2 = new LayerModel(finalInterfaceTestsDesc, request);
												InterfaceTests = lm2.getTests();
												if(InterfaceTests!=null)
												{
													real_count = InterfaceTests.length;
													ccc = real_count-1;
												}
											}
											
											JSONArray realJsonArray = new JSONArray();	
											JSONArray realJsonArray_mobile = new JSONArray();	
											for (int aa=0; aa<real_count; aa++)
											{
												JSONObject realJson = new JSONObject();
												JSONObject realJson_mobile = new JSONObject();
												boolean selectedInFTest =false;
												boolean nextInfTestExists = false;
												if(aa != 0 && isMoreSub)
													continue;
					
												if (aa < ccc)
												{
													com.egurkha.monitor.Test nextTest = InterfaceTests[aa+1];
													nextInfTestExists = (InterfaceTests[aa].getTestName().equals(nextTest.getTestName()));
												}

												selectedInFTest = testName.trim().indexOf(InterfaceTests[aa].getTestName())>=0 && testName.trim().startsWith(InterfaceTests[aa].getTestName());
												
												String test_sep=(String)egUI.getValue("TEST_PANEL_SUBTREE",InterfaceTests[aa].getTestName());
												test_sep=(test_sep==null || test_sep.trim().length()==0)?":":test_sep;

												if(selectedInFTest)
												{
													//selectedInFTest = testName.endsWith(InterfaceTests[aa].getTestLabel(false));
													String testInFLabel = InterfaceTests[aa].getTestLabel(false);
													if(testInFLabel!=null && testInFLabel.indexOf(test_sep)>-1)
													{
														testInFLabel=testInFLabel.substring(0,testInFLabel.indexOf(test_sep));

														selectedInFTest = testName.trim().indexOf(testInFLabel.trim())>=0;
													}
												}

												boolean selectInFInfo1 = false;
												String thisInFInfo = "";
												String tNameInF = "";
												String testInFDisplay ="";
												String testInFLabel="";
												String msmt_Host_InF = "";
												ArrayList msmt_HostsList_InF = new ArrayList();
												if (testName!= null && !testName.equals("") && !testName.equalsIgnoreCase("null"))
												{
													String testNameInfo = request.getParameter("test");
													String rel_msmt_host = request.getParameter("msmt_host");
					
													if(testNameInfo!=null && testNameInfo.trim().length()>0)
													{
														//thisInFInfo = URLDecoder.decode(testNameInfo.substring(testNameInfo.indexOf("-")+1));
														thisInFInfo = testNameInfo.substring(testNameInfo.indexOf("-")+1);
													}
													else
													{
														//thisInFInfo = URLDecoder.decode(testName.substring(testName.indexOf("-")+1));
														thisInFInfo = testName.substring(testName.indexOf("-")+1);
													}

													if(thisInFInfo!=null && testName.trim().length()>0)
													{
														thisInFInfo=com.egurkha.util.StringUtils.replace(thisInFInfo,"|plus|","+");
														thisInFInfo=com.egurkha.util.StringUtils.replace(thisInFInfo,"|amp|","&");
														thisInFInfo=com.egurkha.util.StringUtils.replace(thisInFInfo,"|pct|","%");
														thisInFInfo=com.egurkha.util.StringUtils.replace(thisInFInfo,"|hash|","#");
													}
													
													tNameInF = testName.substring(0,testName.indexOf("-"));
													testInFDisplay = ui.getReverseLookupAll(InterfaceTests[aa].getTestName());

													if(thisInFInfo!=null && thisInFInfo.trim().length()>0)
													{
														thisInFInfo=ui.getReverseLookupAll(thisInFInfo);
													}

													for (int p=0; p<InterfaceTests.length; p++)
													{
														msmt_Host_InF = InterfaceTests[p].getMsmtHost();
														if(msmt_Host_InF==null || msmt_Host_InF.trim().length()==0)
														{
															msmt_Host_InF = chkInFMsmtHost;
														}
												
														if (!msmt_Host_InF.equals("") && !msmt_Host_InF.equals(null))
														{
															if(!msmt_HostsList_InF.contains("(" + msmt_Host_InF + ")"))
															msmt_HostsList_InF.add("(" + msmt_Host_InF + ")");
														}
													}
													for (int i=0; i<InterfaceTests.length; i++)
													{
														testInFLabel = InterfaceTests[i].getTestLabel(false);
														testInFLabel = ui.getReverseLookupAll(testInFLabel);
														testInFLabel = testInFLabel;
														
														if(rel_msmt_host!=null && rel_msmt_host.length()>0)
														{
															testInFLabel = testInFLabel + " ("+rel_msmt_host+")";
														}
														
														if (testInFLabel.startsWith("("))
															alist_InF.add(tNameInF + "-  "+testInFLabel);
														else alist_InF.add(tNameInF + "- "+testInFLabel);
													}

													String chkInF = InterfaceTests[aa].getMsmtHost();
													if(chkInF==null || chkInF.length()==0)
														chkInF = chkInFMsmtHost;
													if (!chkInF.equals("") && !chkInF.equals(null))
													{
														if (msmt_HostsList_InF.size()>0)
														{
															for(int m=0;m<msmt_HostsList_InF.size();m++)
															{
																msmt_Host_InF = (String)msmt_HostsList_InF.get(m);
																if(rel_msmt_host!=null && msmt_Host_InF.indexOf(rel_msmt_host)>-1)
																{
																	String temp = testName +" "+msmt_Host_InF;
																	if(alist_InF.contains(temp))
																	{
																		selectInFInfo1 = alist_InF.contains(temp) && tNameInF.equals(testInFDisplay);
																	}
																}
															}
															
														}
													}
													else
													{
														selectInFInfo1 = alist_InF.contains(testName) && tNameInF.equals(testInFDisplay);
													}
												}
												realJson.put("iconCls","stateSymbol_"+tests[a].getTestState());
												realJson.put("iconTooltip",mappingInfo.getLabelDescription(tests[a].getTestState()));
												realJson.put("cls","non-header");
												if(subInfosEnabled.equalsIgnoreCase("True") || subInfosEnabled.equalsIgnoreCase("yes"))
												{
													selectInFInfo1 = true;
												}

												if(isLayerClicked || (!selectInFInfo1))// when layer clicked
												{
													selectedInFTest=false;
												}
												realJson.put("qtip",titleText);
												realJson.put("text",ui.getReverseLookupAll(label));
												realJson_mobile.put("name",ui.getReverseLookupAll(label));
												realJson_mobile.put("status",tests[a].getTestState());
												realJson_mobile.put("msmt_host",testWithMsmtHostHash.get(msmt_hst_mobile));
												realJson.put("selected",selectedInFTest);
												realJson.put("interfacesLink",a);
												realJson.put("expanded",selectInFInfo1);
												if (selectInFInfo1)
												{
													realJson.put("tr_display_text",tr_display_text);
												}
												alist_InF = new ArrayList();
												int tempAA=aa;
												ArrayList tNameInF2=new ArrayList();
												while (tempAA < InterfaceTests.length)
												{
													String test_InFLabel = InterfaceTests[tempAA].getTestLabel(false);
													if((ui.getReverseLookupAll(test_InFLabel)).trim().equals("More Infos"))
													{
														tNameInF2.add(InterfaceTests[tempAA].getTestName());
													}
													tempAA++;
												}

												String tempDispStrIn=label;
												String tempLinkStrIn=label;
												JSONArray moreSubJsonArray = new JSONArray();	
												JSONArray interfaceTestJsonArray = new JSONArray();
												JSONArray interfaceTestJsonArray_mobile = new JSONArray();
												if(isMoreSub){
													String urlForInF = "";
													Hashtable temp_hashIn=(Hashtable)finalInterfacesDescForLayer.get(test_name_value+"-+"+temp_TestLabel2);
													Hashtable temp_more_msmt_hashIn=(Hashtable)finalInterfacesDescForLayer.get(test_name_value+"-+"+temp_TestLabel2+"_MoreMsmt");
													LinkedList finalInterfaceTestsDescIn=new LinkedList();

													List high_fitd=new LinkedList();
													List inter_fitd=new LinkedList();
													List low_fitd=new LinkedList();
													List unkn_fitd=new LinkedList();
													List good_fitd=new LinkedList();

													test_sep_vIn=(String)egUI.getValue("TEST_PANEL_SUBTREE","SecondLevelSubTreeList:"+test_name_value);

													if(test_sep_vIn == null || test_sep_vIn.trim().length() == 0)
														test_sep_vIn=(String)egUI.getValue("TEST_PANEL_SUBTREE",test_name_value);

													test_sep_vIn=(test_sep_vIn==null || test_sep_vIn.trim().length()==0)?":":test_sep_vIn;
													
													
													if(temp_hashIn!=null && temp_hashIn.size()>0)
													{
														Enumeration ee2 = temp_hashIn.keys();
														JSONArray moreElementsJsonArrayIn = new JSONArray();
														while (ee2.hasMoreElements())
														{
															JSONObject moreElementsJsonIn = new JSONObject();
															String key = (String) ee2.nextElement();

															if(validSearchInfosList!=null && validSearchInfosList.size()>0 && !validSearchInfosList.contains(key))
																continue;

															String stateKey = key;

															if(key.indexOf(test_sep_v) == -1)
																continue;

															key = key.substring(0,key.indexOf("-+")+2)+key.substring(key.indexOf(test_sep_v)+1);
															//ProcessTest-+edit/plus-cmd
															//ProcessTest-+plus-cmd
															String prior_state = (String) temp_hashIn.get(stateKey);
															if(temp_more_msmt_hashIn!=null && temp_more_msmt_hashIn.size()>0)
															{
																String msmt_host_based_prior_state = (String) temp_more_msmt_hashIn.get(stateKey+"~MH~"+chkInFMsmtHost);
																if(msmt_host_based_prior_state!=null && msmt_host_based_prior_state.trim().length()>0)
																	prior_state = msmt_host_based_prior_state;
															}
															if (prior_state == null)
																continue;

															// For Subtree test have both subtree infos and non-subtree infos changes.
															// by Saravanan.A on 19-4-2012
															boolean flage_normal=false;
															if(key!=null && key.trim().length()>0)
															{
																if(key.indexOf(test_sep_vIn)>=0)
																{
																	try
																	{
																		String key_sub=key.substring(key.indexOf(test_sep_vIn)+1);
																		if(key_sub==null || key_sub.trim().length()==0)
																			flage_normal=true;
																	}
																	catch(Exception e)
																	{
																		flage_normal=true;
																	}
																}
																else if(key.indexOf(test_sep_vIn)<0)
																{
																	finalInterfaceTestsDescIn.add(key+"="+prior_state);

																	if(prior_state!=null && prior_state.equals("HIGH"))
																	{
																		high_fitd.add(key);
																		high_fitd.add(key+"="+prior_state);
																	}
																	else if(prior_state!=null && prior_state.equals("INTERMEDIATE"))
																	{
																		inter_fitd.add(key);
																		inter_fitd.add(key+"="+prior_state);
																	}
																	else if(prior_state!=null && prior_state.equals("LOW"))
																	{
																		low_fitd.add(key);
																		low_fitd.add(key+"="+prior_state);
																	}
																	else if(prior_state!=null && prior_state.equals("UNKNOWN"))
																	{
																		unkn_fitd.add(key);
																		unkn_fitd.add(key+"="+prior_state);
																	}
																	else if(prior_state!=null && prior_state.equals("GOOD"))
																	{
																		good_fitd.add(key);
																		good_fitd.add(key+"="+prior_state);
																	}

																	flage_normal=true;
																}
															}
															else
																flage_normal=true;
															
															if(flage_normal)
															{
																
																if(tempDispStrIn!=null && tempDispStrIn.trim().length()>50 && tempDispStrIn.indexOf("<img")<0 && tempDispStrIn.indexOf("&#34")<0 && tempDispStrIn.indexOf("&#39")<0)
																{
																	tempDispStrIn=tempDispStrIn.substring(0,48)+"..";
																}

																moreElementsJsonIn.put("iconCls","stateSymbol_"+tests[a].getTestState());
																moreElementsJsonIn.put("iconTooltip",mappingInfo.getLabelDescription(tests[a].getTestState()));
																moreElementsJsonIn.put("cls","non-header");
																if(isDescriptorMaintenanceForTest || isDescriptorMaintenanceForComponentTest)
																{
																	moreElementsJsonIn.put("measuresLink",url);
																	//moreElementsJson.put("text",dispStr);
																	moreElementsJsonIn.put("text",tempDispStrIn+"<img class='iconMaintenance' style='margin:2px 5px 0' data-qtip='"+descriptorMaintenaceTimePeriodStr+"' data-qclass='yellowTip'  src='data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='>");
																	moreElementsJsonIn.put("qtip",titleText);
																	moreElementsJsonIn.put("selected",selectBold);
																	moreElementsJsonIn.put("leaf",true);
																	moreElementsJsonIn.put("descriptorMaintenaceTimePeriodStr",descriptorMaintenaceTimePeriodStr);
																	moreElementsJsonIn.put("descriptorMaintenaceNoOfLines",noOfLines);
																}
																else
																{
																	moreElementsJsonIn.put("measuresLink",url);
																	moreElementsJsonIn.put("leaf",true);
																	//moreElementsJson.put("text",dispStr);
																	moreElementsJsonIn.put("text",tempDispStrIn);
																	moreElementsJsonIn.put("qtip",titleText);
																	moreElementsJsonIn.put("selected",selectBold);
																}
															}
															else
															{
																finalInterfaceTestsDescIn.add(key+"="+prior_state);

																if(prior_state!=null && prior_state.equals("HIGH"))
																{
																	high_fitd.add(key);
																	high_fitd.add(key+"="+prior_state);
																}
																else if(prior_state!=null && prior_state.equals("INTERMEDIATE"))
																{
																	inter_fitd.add(key);
																	inter_fitd.add(key+"="+prior_state);
																}
																else if(prior_state!=null && prior_state.equals("LOW"))
																{
																	low_fitd.add(key);
																	low_fitd.add(key+"="+prior_state);
																}
																else if(prior_state!=null && prior_state.equals("UNKNOWN"))
																{
																	unkn_fitd.add(key);
																	unkn_fitd.add(key+"="+prior_state);
																}
																else if(prior_state!=null && prior_state.equals("GOOD"))
																{
																	good_fitd.add(key);
																	good_fitd.add(key+"="+prior_state);
																}

																//finalInterfaceTestsDescIn.add(prior_state);
																//finalInterfaceTestsDescIn.add("");
															}

															if(moreElementsJsonIn!=null && !moreElementsJsonIn.isEmpty())
																moreElementsJsonArrayIn.add(moreElementsJsonIn);
														}
														if(moreElementsJsonArrayIn!=null && moreElementsJsonArrayIn.size()>0)
															//descriptorsJson.put("moreElements",moreElementsJsonArrayIn);
														temp_hashIn=new Hashtable();
													}

													//Collections.sort(finalInterfaceTestsDescIn);
													//List afterSorted = (List) sortByState(finalInterfaceTestsDescIn);

													List afterSorted = new LinkedList();
													List return_list=new LinkedList();
													if(high_fitd != null && high_fitd.size() >0)
													{
														EgSorter esort=new EgSorter(high_fitd,2);
														high_fitd=esort.sort(1,"String","asc");
														return_list.addAll(high_fitd);
													}
													if(inter_fitd != null && inter_fitd.size() >0)
													{
														EgSorter esort=new EgSorter(inter_fitd,2);
														inter_fitd=esort.sort(1,"String","asc");
														return_list.addAll(inter_fitd);
													}
													if(low_fitd != null && low_fitd.size() >0)
													{
														EgSorter esort=new EgSorter(low_fitd,2);
														low_fitd=esort.sort(1,"String","asc");
														return_list.addAll(low_fitd);
													}
													if(unkn_fitd != null && unkn_fitd.size() >0)
													{
														EgSorter esort=new EgSorter(unkn_fitd,2);
														unkn_fitd=esort.sort(1,"String","asc");
														return_list.addAll(unkn_fitd);
													}
													if(good_fitd != null && good_fitd.size() >0)
													{
														EgSorter esort=new EgSorter(good_fitd,2);
														good_fitd=esort.sort(1,"String","asc");
														return_list.addAll(good_fitd);
													}

													if (return_list != null && return_list.size() > 0)
													{
														afterSorted=new LinkedList();
														for (int fi = 0; fi < return_list.size(); fi += 2)
														{
															String tmp_key = (String) return_list.get(fi);
															String tmp_key_state = (String) return_list.get(fi+1);

															if(tmp_key_state!=null && tmp_key_state.trim().length()>0)
																afterSorted.add(tmp_key_state);
														}
													}

													LinkedHashMap moreSubMap = new LinkedHashMap();
													Hashtable linkMoreHashMap = new Hashtable();
													if(afterSorted != null && afterSorted.size() > 0 ){
														for(int m=0;m<afterSorted.size();m++){
															String sortedTest = (String)afterSorted.get(m);
															String sortedTestTemp = sortedTest.replace("-+","-+"+tempLinkStrIn+test_sep_v);

															String testNameSub = sortedTest.substring(0,sortedTest.indexOf("-+"));
															String dispMoreSub = sortedTest.substring(sortedTest.indexOf("-+")+2,sortedTest.indexOf("="));
															String stateMoreSub = sortedTest.substring(sortedTest.indexOf("=")+1);

															if(dispMoreSub.indexOf(test_sep_vIn) != -1){
																String dispMoreSubVal = dispMoreSub.substring(0,dispMoreSub.indexOf(test_sep_vIn));
																String dispMoreSubValIn = dispMoreSub.substring(dispMoreSub.indexOf(test_sep_vIn)+1);
																if(moreSubMap.containsKey(dispMoreSubVal)){
																	String getOldKey = 	(String) moreSubMap.get(dispMoreSubVal);
																	String newKey = getOldKey+"~eGSep~"+dispMoreSubValIn+"="+stateMoreSub;
																	moreSubMap.put(dispMoreSubVal,newKey);
																	linkMoreHashMap.put(dispMoreSubVal,sortedTestTemp);
																	//linkMoreHashMap.put(dispMoreSubValIn,sortedTestTemp);
																	linkMoreHashMap.put(dispMoreSub,sortedTestTemp);
																}else{
																	moreSubMap.put(dispMoreSubVal,dispMoreSubVal+"="+stateMoreSub+"||"+dispMoreSubValIn+"="+stateMoreSub);
																	linkMoreHashMap.put(dispMoreSubVal,sortedTestTemp);
																	//linkMoreHashMap.put(dispMoreSubValIn,sortedTestTemp);
																	linkMoreHashMap.put(dispMoreSub,sortedTestTemp);
																}
																
															}else{
																if(!moreSubMap.containsKey(dispMoreSub)){
																	moreSubMap.put(dispMoreSub,dispMoreSub+"="+stateMoreSub);
																	linkMoreHashMap.put(dispMoreSub,sortedTestTemp);
																}
																else{
																	moreSubMap.put(dispMoreSub+"|Empty",dispMoreSub+"="+stateMoreSub);
																	linkMoreHashMap.put(dispMoreSub,sortedTestTemp);
																}
															}
														}

														if(moreSubMap != null && moreSubMap.size() > 0){
															Set set = moreSubMap.keySet();
															Iterator itr = set.iterator();
															//boolean stateInFlag = true;
															int iState=0;
															while (itr.hasNext()) {
																String keyLocal = (String)itr.next();
																String valueLocal = (String)moreSubMap.get(keyLocal);
																JSONObject moreSubJsonOb = new JSONObject();
																JSONArray moreSubJsonAr = new JSONArray();

																if(valueLocal.indexOf("||") != -1){
																	String valueLocalSub = valueLocal.substring(0,valueLocal.indexOf("||"));
																	String jsonState = valueLocalSub.substring(valueLocalSub.indexOf("=")+1);
																	String jsonText = valueLocalSub.substring(0,valueLocalSub.indexOf("="));
																	String jsonSubText = valueLocal.substring(valueLocal.indexOf("||")+2);
																	urlForInF = this.getUrl(InterfaceTests[aa], request,linkMoreHashMap,jsonText,ui);
																	String scndLevlDescr = jsonText; 

																	if(jsonText!=null && jsonText.trim().length()>48 && jsonText.indexOf("<img")<0 && jsonText.indexOf("&#34")<0 && jsonText.indexOf("&#39")<0)
																	{
																		jsonText=jsonText.substring(0,48)+"..";
																	}

																	moreSubJsonOb.put("iconCls","stateSymbol_"+jsonState);
																	moreSubJsonOb.put("iconTooltip","Normal");
																	moreSubJsonOb.put("cls","non-header");
																	moreSubJsonOb.put("measuresLink",urlForInF);
																	moreSubJsonOb.put("leaf",false);
																	moreSubJsonOb.put("text",jsonText);
																	moreSubJsonOb.put("qtip",scndLevlDescr);
																	if(selectedInfo.indexOf(jsonText) > -1)
																		moreSubJsonOb.put("selected",true);
																	else
																		moreSubJsonOb.put("selected",false);
																	moreSubJsonOb.put("expanded",selectInFInfo1);
																	//StringTokenizer moreSubToken = new StringTokenizer(jsonSubText,"::");
																	ArrayList moreSubTokenList = tokInfo.egTokenizer(jsonSubText, "~eGSep~");

																	if((!isMoreInfosTreeView) && maxInfosCount <= moreSubTokenList.size())
																	{
																		JSONObject moreSubJsonObIn = new JSONObject();

																		String comparisonTooltip = mappingInfo.getTextDescription("monitor.common.Comparison");
																		isMoreInfos=true;
																		StringBuffer moreInfos = new StringBuffer(64);
																		boolean  selectInfo12=false;
																		if(!moreInfosTreeViewEnabled)
																		{
																			moreInfos.append(response.encodeURL("/final/monitor/EgMoreInfosView.jsp?")+"qctr=1&showAll=yes&test=");
																			moreInfos.append(EgURLEncoder.encode((tests[a].getTestName()==null?"":tests[a].getTestName()),"UTF-8"));
																			moreInfos.append("&host=");
																			moreInfos.append(EgURLEncoder.encode((hostName==null?"":hostName),"UTF-8"));
																			moreInfos.append("&layer=");
																			moreInfos.append(layerName);
																			moreInfos.append("&site=");
																			moreInfos.append(EgURLEncoder.encode((siteName==null?"":siteName),"UTf-8"));
																			moreInfos.append("&comptype=");
																			moreInfos.append(EgURLEncoder.encode((hostType==null?"":hostType),"UTF-8"));
																			moreInfos.append("&faketype=");
																			moreInfos.append(EgURLEncoder.encode((fakeType==null?"":fakeType),"UTF-8"));
																			moreInfos.append("&fromalarm=");
																			moreInfos.append(flagAlarm);
																			moreInfos.append("&isInterface=yes");
																			moreInfos.append("&selectedInterface=");
																			moreInfos.append(EgURLEncoder.encode(com.egurkha.util.StringUtils.encodeSecurityChar(temp_TestLabel2.trim()+test_sep_vIn+keyLocal),"UTF-8"));
																			moreInfos.append("&isMoreSub=yes");

																			moreSubJsonObIn.put("iconCls","stateSymbol_"+state);

																			String disp3rdInFDescStr = "Click here for the complete list ....";

																			//Saravanan.A added the follwing lines on 12-12-2007
																			
																			if(enable.equalsIgnoreCase("True"))
																			{
																				selectInfo12 = true;
																			}
																			moreSubJsonObIn.put("qtip",disp3rdInFDescStr);
																			moreSubJsonObIn.put("text",disp3rdInFDescStr+"<div style=\"float:right;\"><a href=\"javascript:void(0);\" onclick=javascript:showMoreInfos(\""+qryStr+"\") class=\"comparison-image-container\"><img title=\""+mappingInfo.getTextDescription("monitor.layermodel.Comparison")+"\" class=\"comparison-image iconDetailList\" src=\"/final/images/clear.png\"/></a></div>");
																			/* Testinfo.put("comparisonLink",qryStr);
																			Testinfo.put("comparisonTooltip",mappingInfo.getTextDescription("monitor.layermodel.Comparison")); */
																			if (selectInfo12)
																			{
																				moreSubJsonObIn.put("tr_display_text",tr_display_text);
																			}

																			if(label.equals("Click here for the complete list ...."))
																			{
																			}
																			else
																			{
																				moreSubJsonObIn.put("iconCls","stateSymbol_"+state);
																			}
																			
																			if(label_for_title!=null)
																			{
																				label_for_title=com.egurkha.util.StringUtils.replace(label_for_title,"\"","&#34");
																			}
																			//More Descriptors/More Information
																			//JSONObject MoreInfoJson = new JSONObject();
																			strMoreInfosURL=moreInfos.toString();

																			String params=strMoreInfosURL.substring(strMoreInfosURL.indexOf("?")+1,strMoreInfosURL.trim().length());

																			moreSubJsonObIn.put("moreDescriptorsURL",moreInfos.toString());
																			moreSubJsonObIn.put("leaf",true);
																			//Testinfo.put("text",label);
																			//Testinfo.put("text",label+"<div style=\"float:right;position:relative;\"><div style=\"position:absolute;top:5px;right:10px\" ><a href=\"javascript:void(0);\" onclick=javascript:showMoreInfos(\""+params+"\",event) ><img data-qtip=\"More Infos\" data-qclass=\"yellowTip\" class=\"iconPlus\" src=\"/final/images/clear.png\"/></a></div><div>");

																			moreSubJsonObIn.put("fireEvent",params);
																			if(disableDescFlag)
																			{
																				moreSubJsonOb.put("text",jsonText+"&nbsp;<a href=\"javascript:void(0);\" onclick=javascript:showMoreInfos(\""+params+"\",event) ><img data-qtip=\"More Infos\" data-qclass=\"yellowTip\" style=\"position:relative;top:3px\" class=\"iconLayerMoreInfo\" src=\"/final/images/clear.png\"/></a>");
																			}
																			else
																			{
																				if(showMaintenanceConfigIcon)
																				{
																					moreSubJsonOb.put("text",jsonText+"&nbsp;<a href=\"javascript:void(0);\" onclick=javascript:showMoreInfos(\""+params+"\",event) ><img data-qtip=\"More Infos\" data-qclass=\"yellowTip\" style=\"position:relative;top:3px\" class=\"iconLayerMoreInfo\" src=\"/final/images/clear.png\"/></a>");
																				}
																				else
																				{
																					//moreSubJsonOb.put("text",jsonText+"&nbsp;<a href=\"javascript:void(0);\" onclick=javascript:showMoreInfos(\""+params+"\",event) ><img data-qtip=\"More Infos\" data-qclass=\"yellowTip\" style=\"position:relative;top:3px\" class=\"iconLayerMoreInfo\" src=\"/final/images/clear.png\"/></a><div style=\"float:right;position:relative;\"><div style=\"position:absolute;top:"+topFalg+";right:10px;background:transparent !important\" > <a href=\"javascript:void(0);\" onclick=javascript:showDescriptorComparison(\""+qryStr+"\",event) class=\"comparison-image-container\"><img data-qtip=\""+comparisonTooltip+"\" data-qclass=\"yellowTip\" class=\"comparison-image iconComponentDetails\" src=\"/final/images/clear.png\"/></a></div><div>");

																					moreSubJsonOb.put("text",jsonText+"&nbsp;<a href=\"javascript:void(0);\" onclick=javascript:showMoreInfos(\""+params+"\",event) ><img data-qtip=\"More Infos\" data-qclass=\"yellowTip\" style=\"position:relative;top:3px\" class=\"iconLayerMoreInfo\" src=\"/final/images/clear.png\"/></a>");
																				}
																			}

																			moreSubJsonObIn.put("qtip",disp3rdInFDescStr);
																			
																			//Testinfo.put("children", MoreInfoJson);
																		}
																		else
																		{
																			moreInfos = new StringBuffer(64);
																			moreInfos.append(response.encodeURL("/final/monitor/EgMoreInfosView.jsp?")+"comesFrom=LayerModel&qctr=1&from=list&showAll=yes&MoreInfosTreeView=true&tab=LayerModel&searchByDescriptor=true&test=");
																			moreInfos.append(EgURLEncoder.encode((tests[a].getTestName()==null?"":tests[a].getTestName()),"UTF-8"));
																			moreInfos.append("&host=");
																			moreInfos.append(EgURLEncoder.encode((hostName==null?"":hostName),"UTF-8"));
																			moreInfos.append("&layer=");
																			moreInfos.append(layerName);
																			moreInfos.append("&site=");
																			moreInfos.append(EgURLEncoder.encode((siteName==null?"":siteName),"UTf-8"));
																			moreInfos.append("&comptype=");
																			moreInfos.append(EgURLEncoder.encode((hostType==null?"":hostType),"UTF-8"));
																			moreInfos.append("&faketype=");
																			moreInfos.append(EgURLEncoder.encode((fakeType==null?"":fakeType),"UTF-8"));
																			moreInfos.append("&fromalarm=");
																			moreInfos.append(flagAlarm);
																			moreInfos.append("&isInterface=yes");
																			moreInfos.append("&selectedInterface=");
																			moreInfos.append(EgURLEncoder.encode(com.egurkha.util.StringUtils.encodeSecurityChar(temp_TestLabel2.trim()+test_sep_vIn+keyLocal),"UTF-8"));
																			moreInfos.append("&isMoreSub=yes");

																			moreSubJsonObIn.put("iconCls","stateSymbol_"+state);

																			//Saravanan.A added the follwing lines on 12-12-2007
																			selectInfo12=false;
																			if(enable.equalsIgnoreCase("True"))
																			{
																				selectInfo12 = true;
																			}

																			String disp3rdInFDescStr = "Click here for the complete list ....";

																			moreSubJsonObIn.put("qtip",disp3rdInFDescStr);
																			moreSubJsonObIn.put("text",disp3rdInFDescStr+"<div style=\"float:right;\"><a href=\"javascript:void(0);\" onclick=javascript:showMoreInfos(\""+qryStr+"\") class=\"comparison-image-container\"><img title=\""+mappingInfo.getTextDescription("monitor.layermodel.Comparison")+"\" class=\"comparison-image iconDetailList\" src=\"/final/images/clear.png\"/></a></div>");
																			/* Testinfo.put("comparisonLink",qryStr);
																			Testinfo.put("comparisonTooltip",mappingInfo.getTextDescription("monitor.layermodel.Comparison")); */
																			if (selectInfo12)
																			{
																				moreSubJsonObIn.put("tr_display_text",tr_display_text);
																			}

																			if(label.equals("Click here for the complete list ...."))
																			{
																			}
																			else
																			{
																				moreSubJsonObIn.put("iconCls","stateSymbol_"+state);
																			}
																			
																			if(label_for_title!=null)
																			{
																				label_for_title=com.egurkha.util.StringUtils.replace(label_for_title,"\"","&#34");
																			}
																			//More Descriptors/More Information
																			//JSONObject MoreInfoJson = new JSONObject();
																			//Testinfo.put("moreDescriptorsURL",moreInfos.toString());
																			strMoreInfosURL=moreInfos.toString();
																			moreSubJsonObIn.put("moreDescriptorsTreeURL",moreInfos.toString());
																			moreSubJsonObIn.put("leaf",true);
																			//Testinfo.put("text",label);
																			
																			String params=strMoreInfosURL.substring(strMoreInfosURL.indexOf("?")+1,strMoreInfosURL.trim().length());
																			//Testinfo.put("text",label+"<div style=\"float:right;position:relative;\"><div style=\"position:absolute;top:5px;right:10px\" ><a href=\"javascript:void(0);\" onclick=javascript:MoreInfoLayerTreePopUp(\""+params+"\",'',event) ><img data-qtip=\"More Infos\" data-qclass=\"yellowTip\" class=\"iconPlus\" src=\"/final/images/clear.png\"/></a></div><div>");
																			moreSubJsonObIn.put("fireEvent",params);
																			//moreSubJsonOb.put("text",jsonText);
																			if(disableDescFlag)
																				moreSubJsonOb.put("text",jsonText+"&nbsp;<a href=\"javascript:void(0);\" onclick=javascript:MoreInfoLayerTreePopUp(\""+params+"\",'',event) ><img data-qtip=\"Click here to see the Descriptors\" data-qclass=\"yellowTip\" style=\"position:relative;top:3px\" class=\"iconLayerMoreInfo\" src=\"/final/images/clear.png\"/></a>");
																			else
																				moreSubJsonOb.put("text",jsonText+"&nbsp;<a href=\"javascript:void(0);\" onclick=javascript:MoreInfoLayerTreePopUp(\""+params+"\",'',event) ><img data-qtip=\"Click here to see the Descriptors\" data-qclass=\"yellowTip\" style=\"position:relative;top:3px\" class=\"iconLayerMoreInfo\" src=\"/final/images/clear.png\"/></a>");

																			moreSubJsonObIn.put("qtip",disp3rdInFDescStr);
																		}

																		if(!isMoreInfos)
																			moreSubJsonAr.add(moreSubJsonObIn);
																	}
																	else
																	{
																		for(int l=0;l<moreSubTokenList.size();l++)
																		{
																			//while(moreSubToken.hasMoreTokens()){
																			//	String subLevelText = moreSubToken.nextToken();
																			String subLevelText = (String) moreSubTokenList.get(l);
																			String jsonStateIn = subLevelText.substring(subLevelText.indexOf("=")+1);
																			String jsonTextIn = subLevelText.substring(0,subLevelText.indexOf("="));

																			urlForInF = this.getUrl(InterfaceTests[aa], request,linkMoreHashMap,keyLocal+test_sep_vIn+jsonTextIn,ui);
																			String thrdLevlDescr = ui.getReverseLookupAll(label) + test_sep_vIn + scndLevlDescr + test_sep_vIn + jsonTextIn;

																			//==3nd level 
																			isDescriptorMaintenanceForTest = egM.isItMaintenanceTime(testNameForMaintenance, curDatTime,thrdLevlDescr,true);
																			isDescriptorMaintenanceForComponentTest = egM.isItMaintenanceTime(testNameForMaintenance, curDatTime, serverName, portNo, sid,thrdLevlDescr,true);

																			maintenancePeriodVec = new ArrayList();
																			maintenaceTimePeriod = new ArrayList();

																			maintenaceTimePeriod = (ArrayList)getMaintenanceComputing(egM,maintenaceTimePeriod,isDescriptorMaintenanceForTest,isDescriptorMaintenanceForComponentTest,testNameForMaintenance,thrdLevlDescr,serverName,portNo,sid);

																			/*if(isDescriptorMaintenanceForTest)
																			{
																				maintenancePeriodVec = egM.getMaintenancePeriods(testNameForMaintenance, thrdLevlDescr);
																				if(maintenancePeriodVec != null && maintenaceTimePeriod != null){
																					maintenaceTimePeriod.addAll(maintenancePeriodVec);
																				}
																				maintenancePeriodVec = egM.getUnplannedMaintenancePeriods(testNameForMaintenance, thrdLevlDescr);
																				if(maintenancePeriodVec != null && maintenaceTimePeriod != null)
																					maintenaceTimePeriod.addAll(maintenancePeriodVec);
																			}
																			if(isDescriptorMaintenanceForComponentTest)
																			{
																				maintenancePeriodVec = egM.getMaintenancePeriods(testNameForMaintenance, serverName, portNo, sid, thrdLevlDescr);
																				if(maintenancePeriodVec != null && maintenaceTimePeriod != null){
																					maintenaceTimePeriod.addAll(maintenancePeriodVec);
																				}
																				maintenancePeriodVec = egM.getUnplannedMaintenancePeriods(testNameForMaintenance, serverName, portNo, sid, thrdLevlDescr);
																				if(maintenancePeriodVec != null && maintenaceTimePeriod != null)
																					maintenaceTimePeriod.addAll(maintenancePeriodVec);
																			}*/
																			noOfLines = maintenaceTimePeriod.size();
																			aListDummy = new ArrayList();
																			aListDummy.addAll(maintenaceTimePeriod);
																		descriptorMaintenaceTimePeriodStr = "";
																		if((isDescriptorMaintenanceForTest || isDescriptorMaintenanceForComponentTest) && noOfLines>0)
																		{
																			descriptorMaintenaceTimePeriodStr = maintenanceUtil.convertMaintenacevectorToString(aListDummy, user);
																		}
																			//---------
																		
																			JSONObject moreSubJsonObIn = new JSONObject();
																			moreSubJsonObIn.put("iconCls", "stateSymbol_" + jsonStateIn);
																			moreSubJsonObIn.put("iconTooltip", "Normal");
																			moreSubJsonObIn.put("cls", "non-header");
																			moreSubJsonObIn.put("measuresLink", urlForInF);
																			moreSubJsonObIn.put("leaf", true);
																			moreSubJsonObIn.put("qtip", jsonTextIn);
																			moreSubJsonObIn.put("selected", selectBold);

																			if(isDescriptorMaintenanceForTest || isDescriptorMaintenanceForComponentTest)
																			{
																				moreSubJsonObIn.put("text", jsonTextIn + "<img class='iconMaintenance' style='margin:2px 5px 0' data-qtip='" + descriptorMaintenaceTimePeriodStr + "' data-qclass='yellowTip'  src='data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='>");
																				
																				moreSubJsonObIn.put("descriptorMaintenaceTimePeriodStr", descriptorMaintenaceTimePeriodStr);
																				moreSubJsonObIn.put("descriptorMaintenaceNoOfLines", noOfLines);
																			} else {
																				moreSubJsonObIn.put("text", jsonTextIn);
																			}
																			
																			moreSubJsonAr.add(moreSubJsonObIn);
																		}
																	}
																	if(moreSubJsonAr.size() > 0)
																		moreSubJsonOb.put("measuresLink","");

																	moreSubJsonOb.put("children",moreSubJsonAr);
																}else{
																	String jsonState = valueLocal.substring(valueLocal.indexOf("=")+1);
																	String jsonText = valueLocal.substring(0,valueLocal.indexOf("="));
																	//String urlTest = (String) linkMoreHashMap.get(jsonText);
																	//urlForInF = this.getUrl(InterfaceTests[aa], request,urlTest);
																	urlForInF = this.getUrl(InterfaceTests[aa], request,linkMoreHashMap,jsonText,ui);
																	String secdLevelInfo = ui.getReverseLookupAll(label) + test_sep_vIn + jsonText;
																	
																	//==2nd level 
																	isDescriptorMaintenanceForTest = egM.isItMaintenanceTime(testNameForMaintenance, curDatTime,secdLevelInfo, true);
																	isDescriptorMaintenanceForComponentTest = egM.isItMaintenanceTime(testNameForMaintenance, curDatTime, serverName, portNo, sid, secdLevelInfo,true);

																	maintenancePeriodVec = new ArrayList();
																	maintenaceTimePeriod = new ArrayList();

																	maintenaceTimePeriod = (ArrayList)getMaintenanceComputing(egM,maintenaceTimePeriod,isDescriptorMaintenanceForTest,isDescriptorMaintenanceForComponentTest,testNameForMaintenance,secdLevelInfo,serverName,portNo,sid);

																	/*if(isDescriptorMaintenanceForTest)
																	{
																		maintenancePeriodVec = egM.getMaintenancePeriods(testNameForMaintenance, secdLevelInfo);
																		if(maintenancePeriodVec != null && maintenaceTimePeriod != null){
																			maintenaceTimePeriod.addAll(maintenancePeriodVec);
																		}
																		maintenancePeriodVec = egM.getUnplannedMaintenancePeriods(testNameForMaintenance, secdLevelInfo);
																		if(maintenancePeriodVec != null && maintenaceTimePeriod != null)
																			maintenaceTimePeriod.addAll(maintenancePeriodVec);
																	}
																	if(isDescriptorMaintenanceForComponentTest)
																	{
																		maintenancePeriodVec = egM.getMaintenancePeriods(testNameForMaintenance, serverName, portNo, sid, secdLevelInfo);
																		if(maintenancePeriodVec != null && maintenaceTimePeriod != null){
																			maintenaceTimePeriod.addAll(maintenancePeriodVec);
																		}
																		maintenancePeriodVec = egM.getUnplannedMaintenancePeriods(testNameForMaintenance, serverName, portNo, sid, secdLevelInfo);
																		if(maintenancePeriodVec != null && maintenaceTimePeriod != null)
																			maintenaceTimePeriod.addAll(maintenancePeriodVec);
																	}*/
																	noOfLines = maintenaceTimePeriod.size();
																	aListDummy = new ArrayList();
																	aListDummy.addAll(maintenaceTimePeriod);
																	descriptorMaintenaceTimePeriodStr = "";
																	if((isDescriptorMaintenanceForTest || isDescriptorMaintenanceForComponentTest) && noOfLines>0)
																	{
																		descriptorMaintenaceTimePeriodStr = maintenanceUtil.convertMaintenacevectorToString(aListDummy, user);
																	}
																	//===================
																	
																	moreSubJsonOb.put("cls", "non-header");
																	moreSubJsonOb.put("measuresLink", urlForInF);
																	moreSubJsonOb.put("iconCls", "stateSymbol_" + jsonState);
																	moreSubJsonOb.put("iconTooltip", "Normal");
																	moreSubJsonOb.put("leaf", true);
																	moreSubJsonOb.put("qtip", jsonText);
																	if(selectedInfo.indexOf(jsonText) > -1)
																		moreSubJsonOb.put("selected",true);
																	else
																		moreSubJsonOb.put("selected",false);
																	
																	if(isDescriptorMaintenanceForTest || isDescriptorMaintenanceForComponentTest)
																	{
																		//moreElementsJson.put("text",dispStr);
																		moreSubJsonOb.put("text",jsonText + "<img class='iconMaintenance' style='margin:2px 5px 0' data-qtip='" + descriptorMaintenaceTimePeriodStr + "' data-qclass='yellowTip'  src='data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='>");
																	
																		moreSubJsonOb.put("descriptorMaintenaceTimePeriodStr", descriptorMaintenaceTimePeriodStr);
																		moreSubJsonOb.put("descriptorMaintenaceNoOfLines", noOfLines);
																	} else {
																		moreSubJsonOb.put("text", jsonText);
																	}
																	
																}
																moreSubJsonArray.add(moreSubJsonOb);	
															}
														}
													}
													isHaveAllData=true;
												}
												else
												{
													while(aa < InterfaceTests.length)
													{
														JSONObject interfaceTestJson = new JSONObject();
														JSONObject interfaceTestJson_mobile = new JSONObject();
														/*
														 * Track the number of infos for this test
														 */
														String test_InFLabel = InterfaceTests[aa].getTestLabel(false);

														//checking infoLabel as null or empty string
														if(test_InFLabel == null || test_InFLabel.length() == 0)
														{
															if (aa < InterfaceTests.length-1)
															{
																com.egurkha.monitor.Test nextTest = InterfaceTests[aa+1];
																nextInfTestExists = (InterfaceTests[aa].getTestName().equals(nextTest.getTestName()));
															}

															if (nextInfTestExists)
															{
																aa++;
																if(selectedInFTest)
																{
																	selectedInFTest = testName.endsWith(InterfaceTests[aa].getTestLabel(false));
																}
																continue;
															}
															else
															{
																break;
															}
														}
														//end

														if(validSearchInfosList!=null && validSearchInfosList.size()>0 && !validSearchInfosList.contains(InterfaceTests[aa].getTestName()+"-+"+test_InFLabel))
														{
															aa++;
															continue;
														}
														
														String urlForInF = this.getUrl(InterfaceTests[aa], request,chkInFMsmtHost,ui,tmpCustomSubTreeList);
														String titleInFText = null;
														if(test_InFLabel!=null)
															titleInFText=ui.getReverseLookupAll(test_InFLabel);
														else titleInFText="";

														 //os level
														
														isDescriptorMaintenanceForTest = egM.isItMaintenanceTime(testNameForMaintenance, curDatTime,titleInFText,true);
														isDescriptorMaintenanceForComponentTest = egM.isItMaintenanceTime(testNameForMaintenance, curDatTime, serverName, portNo, sid, titleInFText, true);
														//----------------------
														maintenancePeriodVec = new ArrayList();
														maintenaceTimePeriod = new ArrayList();

														maintenaceTimePeriod = (ArrayList)getMaintenanceComputing(egM,maintenaceTimePeriod,isDescriptorMaintenanceForTest,isDescriptorMaintenanceForComponentTest,testNameForMaintenance,titleInFText,serverName,portNo,sid);

														/*if(isDescriptorMaintenanceForTest)
														{
															maintenancePeriodVec=egM.getMaintenancePeriods(testNameForMaintenance, titleInFText);
															if(maintenancePeriodVec!=null && maintenaceTimePeriod!=null)
															{
																maintenaceTimePeriod.addAll(maintenancePeriodVec);
															}
															maintenancePeriodVec=egM.getUnplannedMaintenancePeriods(testNameForMaintenance, titleInFText);
															if(maintenancePeriodVec!=null && maintenaceTimePeriod!=null)
																maintenaceTimePeriod.addAll(maintenancePeriodVec);
														}
														if(isDescriptorMaintenanceForComponentTest)
														{
															maintenancePeriodVec=egM.getMaintenancePeriods(testNameForMaintenance, serverName, portNo, sid, titleInFText);
															if(maintenancePeriodVec != null && maintenaceTimePeriod != null)
															{
																maintenaceTimePeriod.addAll(maintenancePeriodVec);
															}
															maintenancePeriodVec = egM.getUnplannedMaintenancePeriods(testNameForMaintenance, serverName, portNo, sid, titleInFText);
															if(maintenancePeriodVec != null && maintenaceTimePeriod != null)
																maintenaceTimePeriod.addAll(maintenancePeriodVec);
														}*/
														noOfLines=maintenaceTimePeriod.size();
														aListDummy = new ArrayList();
														aListDummy.addAll(maintenaceTimePeriod);

														descriptorMaintenaceTimePeriodStr = "";
														if((isDescriptorMaintenanceForTest || isDescriptorMaintenanceForComponentTest) && noOfLines>0)
														{
															descriptorMaintenaceTimePeriodStr = maintenanceUtil.convertMaintenacevectorToString(aListDummy, user);
														}
														//-----------------------
														if (test_InFLabel.trim().length() > 60)
														{
															test_InFLabel = StringUtils.elipsis(test_InFLabel, 60);
														}
														boolean  selectedInFMeasure = testName.indexOf(ui.getReverseLookupAll("+"+test_InFLabel))>=0;
														boolean flageInFTrue=tNameInF2.contains(InterfaceTests[aa].getTestName());
														
														String dispInFDescStr = "";
														String dispInFDescStrTooltip = "";
														isMoreInfos=false;
														if((ui.getReverseLookupAll(test_InFLabel)).trim().equals("More Infos"))
														{
															String comparisonTooltip = mappingInfo.getTextDescription("monitor.common.Comparison");
															isMoreInfos=true;
															StringBuffer moreInfoInF = new StringBuffer(64);
															if(!moreInfosTreeViewEnabled)
															{
																moreInfoInF.append(response.encodeURL("/final/monitor/EgMoreInfosView.jsp?") +"qctr=1&showAll=yes&test=");	moreInfoInF.append(EgURLEncoder.encode((InterfaceTests[aa].getTestName()==null?"":InterfaceTests[aa].getTestName()),"UTF-8"));
																moreInfoInF.append("&host=");
																moreInfoInF.append(EgURLEncoder.encode((hostName==null?"":hostName),"UTF-8"));
																moreInfoInF.append("&layer=");
																moreInfoInF.append(EgURLEncoder.encode((layerName==null?"":layerName),"UTF-8"));
																moreInfoInF.append("&site=");
																moreInfoInF.append(EgURLEncoder.encode((siteName==null?"":siteName),"UTf-8"));
																moreInfoInF.append("&comptype=");
																moreInfoInF.append(EgURLEncoder.encode((hostType==null?"":hostType),"UTF-8"));
																moreInfoInF.append("&faketype=");
																moreInfoInF.append(EgURLEncoder.encode((fakeType==null?"":fakeType),"UTF-8"));
																moreInfoInF.append("&fromalarm=");
																moreInfoInF.append(flagAlarm);
																moreInfoInF.append("&isInterface=yes");
																moreInfoInF.append("&selectedInterface=");
																moreInfoInF.append(EgURLEncoder.encode(com.egurkha.util.StringUtils.encodeSecurityChar(temp_TestLabel),"UTF-8"));

																dispInFDescStr = "Click here for the complete list ....";
																interfaceTestJsonArray = new JSONArray();
																interfaceTestJson_mobile.put("name",dispInFDescStr);
																interfaceTestJson_mobile.put("leaf",true);
																interfaceTestJson_mobile.put("measuresLink",urlForInF);
																interfaceTestJson_mobile.put("status",InterfaceTests[aa].getTestState());
																interfaceTestJson_mobile.put("msmt_host",testWithMsmtHostHash.get(msmt_hst_mobile));

																strMoreInfosURL=moreInfoInF.toString();

																interfaceTestJson.put("moreDescriptorsURL",moreInfoInF.toString());
																interfaceTestJson.put("leaf",true);
																//interfaceTestJson.put("text",dispInFDescStr);

																String params=strMoreInfosURL.substring(strMoreInfosURL.indexOf("?")+1,strMoreInfosURL.trim().length());

																//interfaceTestJson.put("text",dispInFDescStr+"<div style=\"float:right;position:relative;\"><div style=\"position:absolute;top:5px;right:10px\" ><a href=\"javascript:void(0);\" onclick=javascript:showMoreInfos(\""+params+"\",event) ><img data-qtip=\"More Infos\" data-qclass=\"yellowTip\" class=\"iconPlus\" src=\"/final/images/clear.png\"/></a></div><div>");
																interfaceTestJson.put("fireEvent",params);
																if(disableDescFlag)
																	realJson.put("text",ui.getReverseLookupAll(label)+"&nbsp;<a href=\"javascript:void(0);\" onclick=javascript:showMoreInfos(\""+params+"\",event) ><img data-qtip=\"More Infos\" data-qclass=\"yellowTip\" style=\"position:relative;top:3px\" class=\"iconLayerMoreInfo\" src=\"/final/images/clear.png\"/></a>");
																else
																	realJson.put("text",ui.getReverseLookupAll(label)+"&nbsp;<a href=\"javascript:void(0);\" onclick=javascript:showMoreInfos(\""+params+"\",event) ><img data-qtip=\"More Infos\" data-qclass=\"yellowTip\" style=\"position:relative;top:3px\" class=\"iconLayerMoreInfo\" src=\"/final/images/clear.png\"/></a>");

																interfaceTestJson.put("selected",selectBold);
															}
															else
															{
																moreInfoInF = new StringBuffer(64);
																moreInfoInF.append(response.encodeURL("/final/monitor/EgMoreInfosView.jsp?") +"comesFrom=LayerModel&qctr=1&from=list&showAll=yes&MoreInfosTreeView=true&tab=LayerModel&searchByDescriptor=true&test=");	moreInfoInF.append(EgURLEncoder.encode((InterfaceTests[aa].getTestName()==null?"":InterfaceTests[aa].getTestName()),"UTF-8"));
																moreInfoInF.append("&host=");
																moreInfoInF.append(EgURLEncoder.encode((hostName==null?"":hostName),"UTF-8"));
																moreInfoInF.append("&layer=");
																moreInfoInF.append(EgURLEncoder.encode((layerName==null?"":layerName),"UTF-8"));
																moreInfoInF.append("&site=");
																moreInfoInF.append(EgURLEncoder.encode((siteName==null?"":siteName),"UTf-8"));
																moreInfoInF.append("&comptype=");
																moreInfoInF.append(EgURLEncoder.encode((hostType==null?"":hostType),"UTF-8"));
																moreInfoInF.append("&faketype=");
																moreInfoInF.append(EgURLEncoder.encode((fakeType==null?"":fakeType),"UTF-8"));
																moreInfoInF.append("&fromalarm=");
																moreInfoInF.append(flagAlarm);
																moreInfoInF.append("&isInterface=yes");
																moreInfoInF.append("&selectedInterface=");
																moreInfoInF.append(EgURLEncoder.encode(com.egurkha.util.StringUtils.encodeSecurityChar(temp_TestLabel),"UTF-8"));

																dispInFDescStr = "Click here for the complete list ....";
																interfaceTestJsonArray = new JSONArray();
																interfaceTestJson_mobile.put("name",dispInFDescStr);
																interfaceTestJson_mobile.put("leaf",true);
																interfaceTestJson_mobile.put("measuresLink",urlForInF);
																interfaceTestJson_mobile.put("status",InterfaceTests[aa].getTestState());
																interfaceTestJson_mobile.put("msmt_host",testWithMsmtHostHash.get(msmt_hst_mobile));
																strMoreInfosURL=moreInfoInF.toString();
																interfaceTestJson.put("moreDescriptorsTreeURL",moreInfoInF.toString());
																interfaceTestJson.put("leaf",true);
																//interfaceTestJson.put("text",dispInFDescStr);
																interfaceTestJson.put("leaf",new Boolean(true));
																
																String params=strMoreInfosURL.substring(strMoreInfosURL.indexOf("?")+1,strMoreInfosURL.trim().length());

																//Testinfo.put("text",dispInFDescStr+"<div style=\"float:right;position:relative;\"><div style=\"position:absolute;top:5px;right:10px\" ><a href=\"javascript:void(0);\" onclick=javascript:MoreInfoLayerTreePopUp(\""+params+"\",'',event) ><img data-qtip=\"More Infos\" data-qclass=\"yellowTip\" class=\"iconPlus\" src=\"/final/images/clear.png\"/></a></div><div>");

																interfaceTestJson.put("fireEvent",params);
																if(disableDescFlag)
																	realJson.put("text",ui.getReverseLookupAll(label)+"&nbsp;<a href=\"javascript:void(0);\" onclick=javascript:MoreInfoLayerTreePopUp(\""+params+"\",'',event) ><img data-qtip=\"Click here to see the Descriptors\" data-qclass=\"yellowTip\" style=\"position:relative;top:3px\" class=\"iconLayerMoreInfo\" src=\"/final/images/clear.png\"/></a>");
																else
																	realJson.put("text",ui.getReverseLookupAll(label)+"&nbsp;<a href=\"javascript:void(0);\" onclick=javascript:MoreInfoLayerTreePopUp(\""+params+"\",'',event) ><img data-qtip=\"Click here to see the Descriptors\" data-qclass=\"yellowTip\" style=\"position:relative;top:3px\" class=\"iconLayerMoreInfo\" src=\"/final/images/clear.png\"/></a>");

																interfaceTestJson.put("selected",selectBold);
															}
														}
														else if(!flageInFTrue)
														{
															String boldInFStyle = selectedInFMeasure?"<b>":"";
															String display_TestInFLabel=titleInFText;
															String test_seprater=(String)egUI.getValue("TEST_PANEL_SUBTREE",InterfaceTests[aa].getTestName());
															test_seprater=(test_seprater==null || test_seprater.trim().length()==0)?":":test_seprater;
															if(titleInFText!=null && titleInFText.indexOf(test_seprater)>-1)
															{
																display_TestInFLabel=titleInFText.substring(titleInFText.indexOf(test_seprater)+1);
															}
															String testInFLabel_for_display=display_TestInFLabel;
															String test_name_value_InF=InterfaceTests[aa].getTestName();

															if(dispInFDescStrTooltip==null || dispInFDescStrTooltip.trim().length()<=0)
																dispInFDescStrTooltip=titleInFText;
															
															dispInFDescStr = ui.getReverseLookupAll(testInFLabel_for_display);
															String str_msmt_host = request.getParameter("msmt_host");
															String chkInF = InterfaceTests[aa].getMsmtHost();
															if(chkInF==null || chkInF.trim().length()==0)
																chkInF = chkInFMsmtHost;
															chkInF=(chkInF==null)?"":chkInF;
															String tempchkInF = "";
															thisInFInfo=(thisInFInfo==null)?"":thisInFInfo;
															if (!chkInF.equals("") && !chkInF.equals(null))
															{
																tempchkInF = thisInFInfo + "  " + "(" + chkInF + ")" ;
															}
															else
															{
																tempchkInF = thisInFInfo;
															}
															tempchkInF = tempchkInF.trim();
															if(tempchkInF.startsWith("+"))
																tempchkInF=tempchkInF.substring(1);
															if (urlInFHash == null)
															{
																urlInFHash = new HashMap();
																if(testQueryStr!=null)
																{
																	StringTokenizer urlTokens1 = new StringTokenizer(testQueryStr,"&");
																	while (urlTokens1.hasMoreTokens()) 
																	{

																		String urlValueTemp = (String)urlTokens1.nextToken();
																		StringTokenizer urlTokens2 = new StringTokenizer(urlValueTemp,"=");

																		int urlTokens2Count = urlTokens2.countTokens();
																		String key = "";
																		String value = "";
																		if(urlTokens2Count==2)
																		{
																			 key = (String)urlTokens2.nextToken();
																			 value = (String)urlTokens2.nextToken();
																			 urlInFHash.put(key,value);
																		}
																		else
																		{
																			 key = (String)urlTokens2.nextToken();
																			 urlInFHash.put(key,"");
																		}
																	}
																}
															}
															String msmt_HostInFValue = (String)urlInFHash.get("msmt_host");
															boolean chkInFmsmt = false;

															if (!chkInF.equals("") && !chkInF.equals(null))
															{
																chkInF = chkInF;
																
																if(chkInF.equals(msmt_HostInFValue) && str_msmt_host!=null && str_msmt_host.equals(msmt_HostInFValue))
																{
																	chkInFmsmt = true;
																	selectInFBold = tempchkInF.trim().equals((ui.getReverseLookupAll(titleInFText)+" ("+str_msmt_host+")")) && chkInFmsmt && tName1.equals(testInFDisplay);
																}
																else
																	selectInFBold = tempchkInF.trim().equals((ui.getReverseLookupAll(titleInFText))) && chkInFmsmt && tName1.equals(testInFDisplay);
															}
															else
																selectInFBold = tempchkInF.trim().equals((ui.getReverseLookupAll(titleInFText))) && tName1.equals(testInFDisplay);

															if(!selectInFBold)
															{
																if (!chkInF.equals("") && !chkInF.equals(null))
																{
																	chkInF = chkInF;
																	
																	if(chkInF.equals(msmt_HostInFValue) && str_msmt_host!=null && str_msmt_host.equals(msmt_HostInFValue))
																	{
																		chkInFmsmt = true;
																		selectInFBold = tempchkInF.trim().equals(("+"+ui.getReverseLookupAll(titleInFText)+" ("+str_msmt_host+")")) && chkInFmsmt && tName1.equals(testInFDisplay);
																	}
																	else
																		selectInFBold = tempchkInF.trim().equals(("+"+ui.getReverseLookupAll(titleInFText))) && chkInFmsmt && tName1.equals(testInFDisplay);
																}
																else
																	selectInFBold = tempchkInF.trim().equals(("+"+ui.getReverseLookupAll(titleInFText))) && tName1.equals(testInFDisplay);
															}
														
															if(isLayerClicked)// when layer clicked
															{
																selectInFBold=false;
															}
															
															if(titleInFText!=null)
															{
																titleInFText=com.egurkha.util.StringUtils.replace(titleInFText,"\"","&#34");
															}

															String tempdispInFDescStr=dispInFDescStr;
															if(tempdispInFDescStr!=null && tempdispInFDescStr.trim().length()>50 && tempdispInFDescStr.indexOf("<img")<0 && tempdispInFDescStr.indexOf("&#34")<0 && tempdispInFDescStr.indexOf("&#39")<0)
															{
																tempdispInFDescStr=tempdispInFDescStr.substring(0,48)+"..";
															}
															//if(tempdispInFDescStr.indexOf(test_seprater) != -1){
																//tempdispInFDescStr=tempdispInFDescStr.substring(tempdispInFDescStr.indexOf(test_seprater)+1);
															//}
															if(insideView && dispInFDescStr != null && infoInsideView != null && dispInFDescStr.equalsIgnoreCase(infoInsideView))
															{
																Testinfo.put("iconCls","stateSymbol_"+InterfaceTests[aa].getTestState());
																Testinfo.put("iconTooltip",mappingInfo.getLabelDescription(InterfaceTests[aa].getTestState()));
																Testinfo.put("cls","non-header");
															}
															else
															{
																interfaceTestJson.put("iconCls","stateSymbol_"+InterfaceTests[aa].getTestState());
																interfaceTestJson.put("iconTooltip",mappingInfo.getLabelDescription(InterfaceTests[aa].getTestState()));
																interfaceTestJson.put("cls","non-header");
															}
															//interfaceTestJson_mobile.put("name",dispInFDescStr);
															interfaceTestJson_mobile.put("name",tempdispInFDescStr);
															interfaceTestJson_mobile.put("leaf","true");
															interfaceTestJson_mobile.put("measuresLink",urlForInF);
															interfaceTestJson_mobile.put("status",InterfaceTests[aa].getTestState());
															interfaceTestJson_mobile.put("msmt_host",testWithMsmtHostHash.get(msmt_hst_mobile));
															if(isDescriptorMaintenanceForTest || isDescriptorMaintenanceForComponentTest)
															{
																interfaceTestJson.put("measuresLink",urlForInF);
																interfaceTestJson.put("leaf",true);
																interfaceTestJson.put("qtip",titleInFText);
																//interfaceTestJson.put("text",dispInFDescStr);
																interfaceTestJson.put("text",tempdispInFDescStr+"<img class='iconMaintenance' style='margin:2px 5px 0' data-qtip='"+descriptorMaintenaceTimePeriodStr+"' data-qclass='yellowTip'  src='data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='>");
																interfaceTestJson.put("selected",selectInFBold);
																interfaceTestJson.put("descriptorMaintenaceTimePeriodStr",descriptorMaintenaceTimePeriodStr);
																interfaceTestJson.put("descriptorMaintenaceNoOfLines",noOfLines);		
															}
															else
															{
																interfaceTestJson.put("measuresLink",urlForInF);
																interfaceTestJson.put("leaf",true);
																interfaceTestJson.put("qtip",titleInFText);
																//interfaceTestJson.put("text",dispInFDescStr);
																interfaceTestJson.put("text",tempdispInFDescStr);
																interfaceTestJson.put("selected",selectInFBold);
															}
														}
														if (aa < InterfaceTests.length-1)
														{
															com.egurkha.monitor.Test nextTest = InterfaceTests[aa+1];
															nextInfTestExists = (InterfaceTests[aa].getTestName().equals(nextTest.getTestName()));
														}

														if((!isMoreInfos) && interfaceTestJson_mobile!=null && !interfaceTestJson_mobile.isEmpty() )
														{
															interfaceTestJsonArray_mobile.add(interfaceTestJson_mobile);
														}

														if(!isMoreInfos && interfaceTestJson!=null && !interfaceTestJson.isEmpty())
															interfaceTestJsonArray.add(interfaceTestJson);

														if (nextInfTestExists)
														{
															aa++;
														}
														else
														{
															break;
														}
													}
												}
												if(moreSubJsonArray != null && moreSubJsonArray.size() > 0){
													String desc_label = ui.getReverseLookupAll(label);
													if(insideView && (!isMoreInfos) && desc_label != null && infoInsideView != null && desc_label.equalsIgnoreCase(infoInsideView))
													{
														Testinfo.put("children",moreSubJsonArray);
													}
													else
													{
														realJson.put("children",moreSubJsonArray);
														realJsonArray.add(realJson);
														Testinfo.put("children",realJsonArray);
													}													
													//realJson_mobile.put("items",interfaceTestJsonArray_mobile);
													//realJsonArray_mobile.add(realJson_mobile);
												}else{
													String desc_label = ui.getReverseLookupAll(label);
													if(insideView && (!isMoreInfos) && desc_label != null && infoInsideView != null && desc_label.equalsIgnoreCase(infoInsideView))
													{
														Testinfo.put("children",interfaceTestJsonArray);
													}
													else
													{
														realJson.put("children",interfaceTestJsonArray);
														if(interfaceTestJsonArray.size()==0)
															realJson.put("leaf",true);
														realJsonArray.add(realJson);
														Testinfo.put("children",realJsonArray);
													}
													realJson_mobile.put("items",interfaceTestJsonArray_mobile);
													realJsonArray_mobile.add(realJson_mobile);
												}
												//realJson.put("children",interfaceTestJsonArray);
												//realJsonArray.add(realJson);
												//realJson_mobile.put("items",interfaceTestJsonArray_mobile);
												//realJsonArray_mobile.add(realJson_mobile);
											}
											//fix for descCompariosn
											if(disableDescFlag)
												Testinfo.put("text",mappingInfo.getTestDescription(""+ui.getReverseLookupAll(tests[a].getTestName())));
											else
											{
												String comparisonTooltip = mappingInfo.getTextDescription("monitor.common.Comparison");
												if(showMaintenanceConfigIcon)
												{
													//fix for descCompariosn
													Testinfo.put("text",mappingInfo.getTestDescription(""+ui.getReverseLookupAll(tests[a].getTestName()))+"<div style=\"float:right;position:relative;\"><div style=\"position:absolute;top:"+topFalg+";right:10px\" >"+getMaintainenancePolicyConfigURL(tests[a].getTestName(),""+ui.getReverseLookupAll(tests[a].getTestName()),hostName,hostType,isApplicationLayer,mappingInfo)+"<a href=\"javascript:void(0);\" onclick=javascript:showMoreInfos(\""+qryStr+"\",event) class=\"comparison-image-container\"><img data-qtip=\""+comparisonTooltip+"\" data-qclass=\"yellowTip\" class=\"comparison-image iconComponentDetails\" src=\"/final/images/clear.png\"/></a></div><div>");
												}
												else
												{
													Testinfo.put("text",mappingInfo.getTestDescription(""+ui.getReverseLookupAll(tests[a].getTestName()))+"<div style=\"float:right;position:relative;\"><div style=\"position:absolute;top:"+topFalg+";right:10px\" ><a href=\"javascript:void(0);\" onclick=javascript:showMoreInfos(\""+qryStr+"\",event) class=\"comparison-image-container\"><img data-qtip=\""+comparisonTooltip+"\" data-qclass=\"yellowTip\" class=\"comparison-image iconComponentDetails\" src=\"/final/images/clear.png\"/></a></div><div>");
												}
											}

											tArray.put("items",realJsonArray_mobile);

											isHaveAllData=true;
										}
										else
										{
											String dispInStr=ui.getReverseLookupAll(label);
											String dispInStrOrg=ui.getReverseLookupAll(label);
											if(dispInStr!=null && dispInStr.trim().length()>50 && dispInStr.indexOf("<img")<0 && dispInStr.indexOf("&#34")<0 && dispInStr.indexOf("&#39")<0)
											{
												dispInStr=dispInStr.substring(0,48)+"..";
											}

											JSONArray realJsonArray = new JSONArray();											
											JSONObject realJson = new JSONObject();
											
											realJson.put("iconCls","stateSymbol_"+state);
											realJson.put("iconTooltip",mappingInfo.getLabelDescription(state));
											realJson.put("cls","non-header");
											if(insideView && dispInStrOrg != null && infoInsideView != null && dispInStrOrg.equalsIgnoreCase(infoInsideView))
											{
												if(isDescriptorMaintenanceForTest || isDescriptorMaintenanceForComponentTest)
												{
													Testinfo.put("measuresLink",url);
													Testinfo.put("leaf",true);
													Testinfo.put("qtip",label_for_title);
													//realJson.put("text",ui.getReverseLookupAll(label));
													//Testinfo.put("text",dispInStr+"<img class='iconMaintenance' style='margin:2px 5px 0' data-qtip='"+descriptorMaintenaceTimePeriodStr+"' data-qclass='yellowTip'  src='data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='>");
													Testinfo.put("text",mappingInfo.getTestDescription(""+ui.getReverseLookupAll(tests[a].getTestName()))+"<img class='iconMaintenance' style='margin:2px 5px 0' data-qtip='"+mappingInfo.getTestDescription(""+ui.getReverseLookupAll(tests[a].getTestName()))+":"+descriptorMaintenaceTimePeriodStr+"' data-qclass='yellowTip'  src='data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='>");
													Testinfo.put("selected",selectedTest1);
													Testinfo.put("descriptorMaintenaceTimePeriodStr",descriptorMaintenaceTimePeriodStr);
													Testinfo.put("descriptorMaintenaceNoOfLines",noOfLines);			
												}
												else
												{
													Testinfo.put("measuresLink",url);
													Testinfo.put("leaf",true);
													Testinfo.put("qtip",mappingInfo.getTestDescription(""+ui.getReverseLookupAll(tests[a].getTestName()))+":"+label_for_title);
													//realJson.put("text",ui.getReverseLookupAll(label));
													//Testinfo.put("text",dispInStr);
													Testinfo.put("text",mappingInfo.getTestDescription(""+ui.getReverseLookupAll(tests[a].getTestName())));
													Testinfo.put("selected",selectedTest1);
												}
											}
											else
											{
												if(isDescriptorMaintenanceForTest || isDescriptorMaintenanceForComponentTest)
												{
													realJson.put("measuresLink",url);
													realJson.put("leaf",true);
													realJson.put("qtip",label_for_title);
													//realJson.put("text",ui.getReverseLookupAll(label));
													realJson.put("text",dispInStr+"<img class='iconMaintenance' style='margin:2px 5px 0' data-qtip='"+descriptorMaintenaceTimePeriodStr+"' data-qclass='yellowTip'  src='data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='>");
													realJson.put("selected",selectedTest1);
													realJson.put("descriptorMaintenaceTimePeriodStr",descriptorMaintenaceTimePeriodStr);
													realJson.put("descriptorMaintenaceNoOfLines",noOfLines);			
												}
												else
												{
													realJson.put("measuresLink",url);
													realJson.put("leaf",true);
													realJson.put("qtip",label_for_title);
													//realJson.put("text",ui.getReverseLookupAll(label));
													realJson.put("text",dispInStr);
													realJson.put("selected",selectedTest1);
												}
												realJsonArray.add(realJson);
												Testinfo.put("children",realJsonArray);
											}

											isHaveAllData=true;
										}
									}
									else
									{
										String dispInStr=ui.getReverseLookupAll(label);
										String dispInStrOrg=ui.getReverseLookupAll(label);
										if(dispInStr!=null && dispInStr.trim().length()>50 && dispInStr.indexOf("<img")<0 && dispInStr.indexOf("&#34")<0 && dispInStr.indexOf("&#39")<0)
										{
											dispInStr=dispInStr.substring(0,48)+"..";
										}

										msmt_hst_mobile=(String)tests[a].getTestName();
										JSONObject descriptorsJson_mobile = new JSONObject();
										JSONObject descriptorsJson = new JSONObject();
										descriptorsJson.put("iconCls","stateSymbol_"+state);
										descriptorsJson.put("iconTooltip",mappingInfo.getLabelDescription(state));
										descriptorsJson.put("cls","non-header");
										//descriptorsJson_mobile.put("name",ui.getReverseLookupAll(label));
										descriptorsJson_mobile.put("name",dispInStr);
										descriptorsJson_mobile.put("endhr",mgr_time);
										descriptorsJson_mobile.put("mgr_date",temp1);
										descriptorsJson_mobile.put("status",state);
										descriptorsJson_mobile.put("msmt_host",testWithMsmtHostHash.get(msmt_hst_mobile));
										descriptorsJson_mobile.put("leaf",new Boolean(true));
										//new code for Mobile measuresLink code starts here
										descriptorsJson_mobile.put("measuresLink",url);
										//Ends here
										if(insideView && dispInStrOrg != null && infoInsideView != null && dispInStrOrg.equalsIgnoreCase(infoInsideView))
										{
											if(isDescriptorMaintenanceForTest || isDescriptorMaintenanceForComponentTest)
											{
												Testinfo.put("measuresLink",url);
												Testinfo.put("leaf",true);
												Testinfo.put("qtip",label_for_title);
												//descriptorsJson.put("text",ui.getReverseLookupAll(label));
												//Testinfo.put("text",dispInStr+"<img class='iconMaintenance' style='margin:2px 5px 0' data-qtip='"+descriptorMaintenaceTimePeriodStr+"' data-qclass='yellowTip'  src='data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='>");
												Testinfo.put("text",mappingInfo.getTestDescription(""+ui.getReverseLookupAll(tests[a].getTestName()))+"<img class='iconMaintenance' style='margin:2px 5px 0' data-qtip='"+mappingInfo.getTestDescription(""+ui.getReverseLookupAll(tests[a].getTestName()))+":"+descriptorMaintenaceTimePeriodStr+"' data-qclass='yellowTip'  src='data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='>");
												Testinfo.put("selected",selectedTest1);	
												Testinfo.put("descriptorMaintenaceTimePeriodStr",descriptorMaintenaceTimePeriodStr);
												Testinfo.put("descriptorMaintenaceNoOfLines",noOfLines);	
											}
											else
											{
												Testinfo.put("measuresLink",url);
												Testinfo.put("leaf",true);
												Testinfo.put("qtip",mappingInfo.getTestDescription(""+ui.getReverseLookupAll(tests[a].getTestName()))+":"+label_for_title);
												//descriptorsJson.put("text",ui.getReverseLookupAll(label));
												//Testinfo.put("text",dispInStr);
												Testinfo.put("text",mappingInfo.getTestDescription(""+ui.getReverseLookupAll(tests[a].getTestName())));
												Testinfo.put("selected",selectedTest1);	
		
											}											
										}
										else
										{
											if(isDescriptorMaintenanceForTest || isDescriptorMaintenanceForComponentTest)
											{
												descriptorsJson.put("measuresLink",url);
												descriptorsJson.put("leaf",true);
												descriptorsJson.put("qtip",label_for_title);
												//descriptorsJson.put("text",ui.getReverseLookupAll(label));
												descriptorsJson.put("text",dispInStr+"<img class='iconMaintenance' style='margin:2px 5px 0' data-qtip='"+descriptorMaintenaceTimePeriodStr+"' data-qclass='yellowTip'  src='data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='>");
												descriptorsJson.put("selected",selectedTest1);	
												descriptorsJson.put("descriptorMaintenaceTimePeriodStr",descriptorMaintenaceTimePeriodStr);
												descriptorsJson.put("descriptorMaintenaceNoOfLines",noOfLines);	
											}
											else
											{
												descriptorsJson.put("measuresLink",url);
												descriptorsJson.put("leaf",true);
												descriptorsJson.put("qtip",label_for_title);
												//descriptorsJson.put("text",ui.getReverseLookupAll(label));
												descriptorsJson.put("text",dispInStr);
												descriptorsJson.put("selected",selectedTest1);	
		
											}
											descriptorsJsonArray.add(descriptorsJson);
											if(descriptorsJson_mobile != null ){
												descriptorsJsonArray_mobile.add(descriptorsJson_mobile);
											}
											Testinfo.put("children",descriptorsJsonArray);
											if(descriptorsJsonArray_mobile==null || descriptorsJsonArray_mobile.size()==0)
												tArray.put("leaf",new Boolean(true));
												tArray.put("items",descriptorsJsonArray_mobile);
										}
									}

									isHaveAllData=true;
								}

								/*if(descriptorsJsonArray_mobile==null || descriptorsJsonArray_mobile.size()==0)
									tArray.put("items",descriptorsJsonArray_mobile);
									//Testinfo_mobile.put("Items",tArray);*/
							}
						}

						if(Testinfo != null && !Testinfo.isEmpty())
						{
							Testinfo_array.add(Testinfo);
							if(tArray != null && !tArray.isEmpty()){
							
								if(showAll!=null && mobiletest!=null)
								{
									
									if(mobiletest!=null && mobiletest.indexOf("-")>-1)
									{
										mobiletest=mobiletest.substring(0,mobiletest.indexOf("-")).trim();
									}
									
									if(mobiletest.equalsIgnoreCase(tArray.getString("internalTestName")))
									{
										Testinfo_array_mobile.add(tArray);
									}
								}
								else
								{
									Testinfo_array_mobile.add(tArray);
								}
							
							}
						}
					}

					if(searchString!=null && searchString.trim().length()>0 && searchByDescriptor!=null && isHaveData && (!isHaveAllData))
					{
						Testinfo_array = new JSONArray();
						Testinfo_array_mobile = new JSONArray();

						errormsg.put("MsgforSearchTest",mappingInfo.getTextDescription("monitor.layermodel.No Data found for your search"));
						errormsg.put("SearchString",searchString);

					}
				}
				testsForLayer.clear();
				finalTestsForLayer.clear();
				rept.clear();
				test.clear();
			}
		}//End Of Try Block
		catch(Throwable e)
		{
			e.printStackTrace();
			if(!conn.equals("CONNECTED"))
			{
				errormsg.put("Msgfortest",mappingInfo.getTextDescription("monitor.layermodel.Connection could not be established"));
			}
			else if(!state1)
			{
				errormsg.put("Msgfortest",mappingInfo.getTextDescription("monitor.layermodel.Error in Sql Query"));
			}
			else
			{
				//out.println(e.toString());
				errormsg.put("Msgfortest","Some error has occurred");
			}

			if (rsReport != null)
			{
				try
				{
					rsReport.close();
					rsReport = null;
				}
				catch (Exception bug123) {}
			}
			try
			{
				//egDb.releaseConnection(true);
			}
			catch(Exception e2)
			{
				e2.printStackTrace();
			}
		} //End Of Class Block
		finally
		{
			//EgDbAdapterTypeUI.releaseObject(egDb);
		}
	}
	else
	{
		errormsg.put("Msgfortest",mappingInfo.getTextDescription("monitor.layermodel.Please select a layer to view the corresponding tests"));
	}
	json.put("tests",Testinfo_array);
	json.put("layerState",currLayerState);
	json.put("errormsg",errormsg);
	json_mobile.put("items",Testinfo_array_mobile);

	if(isMobileCall)
		response.getWriter().write(json_mobile.toString());
	else
		response.getWriter().write(json.toString());

%>

<%!

	AlarmPriorities ap = AlarmPriorities.getInstance();
	EgDateInfo dateInfo = new EgDateInfo();
	

	private String getUrl(com.egurkha.monitor.Test test, HttpServletRequest request,IniUI ui)
	{
		if(ui == null)
			ui = IniUI.getInstance();

		StringBuffer url = new StringBuffer();
		url.append("site=");
		url.append(request.getParameter("site"));
		url.append("&host=");
		url.append(request.getParameter("host"));
		url.append("&layer=");
		url.append(request.getParameter("layer"));
		
		//new code for Mobile mmeasuresLink code starts here
		if(request.getParameter("fromMobile")!=null && request.getParameter("fromMobile").equalsIgnoreCase("yes"))
		{
			url.append("&qctr=2&componentType=");
			url.append(request.getParameter("comptype"));
		}
		else
		{
			url.append("&qctr=2&comptype=");
			url.append(request.getParameter("comptype"));
			url.append("&fromalarm=");
			url.append(request.getParameter("fromalarm"));
			url.append("&msmt_host=");
			url.append(test.getMsmtHost());
		}
		//end here
		url.append("&test=");
		url.append(test.getTestName());
		//new code for Mobile measuresLink code starts here
		if(request.getParameter("fromMobile")!=null && request.getParameter("fromMobile").equalsIgnoreCase("yes"))
		{
			url.append("-%2B");
		}
		else
		{
			url.append("-+");
		}
		//Ends here
		String thisInfo = test.getTestInfo();
		if(thisInfo!=null)
		{
			thisInfo=ui.getLookedupString(thisInfo);
			//if(thisInfo!=null && (thisInfo.indexOf("#")>-1 || thisInfo.indexOf("!")>-1  ))
			if(thisInfo!=null)
			{
				try
				{
					thisInfo=com.eg.EgURLEncoder.encode(thisInfo,"UTF-8");
				}
				catch(Exception e)
				{
					System.out.println("-----Exception-in getUrl method at dispCompTests.jsp---");
					e.printStackTrace();
				}
			}
		}
		url.append(thisInfo);   //Antony
		//New code for Mobile measuresLink code link
		if(request.getParameter("fromMobile")!=null && request.getParameter("fromMobile").equalsIgnoreCase("yes"))
		{
		url.append("&stateName=");
		url.append(test.getTestState());
		}
		else
		{
			url.append("&tstate=");
			url.append(test.getTestState());
		}
		//ends here
		if (request.getParameter("searchString")!=null)
		{
			url.append("&searchString=");
			url.append(request.getParameter("searchString"));
			url.append("&backButton=true&subtitle=true&searchBox=true");
		}
		String str = request.getParameter("faketype");
		if (str != null && str.length() > 0)
		{
			url.append("&faketype=");
			url.append(request.getParameter("faketype"));
		}
		return url.toString();
	}
	
	private String getUrl(com.egurkha.monitor.Test test, HttpServletRequest request,String re_msmt_host,IniUI ui,ArrayList customSubTreeList)
	{
		if(ui == null)
			ui = IniUI.getInstance();

		/*String iniFileDir = EgInstallInfo.getInstallDir()+ "/manager/config/eg_ui.ini";
		IniFile egUI = new IniFile(iniFileDir);
		String customSubTree = egUI.getValue("TEST_PANEL_SUBTREE","CustomeSubTreeList").trim();

		ArrayList customSubTreeList = new ArrayList();
		StringTokenizer cust = null;
		if(customSubTree == null  ){
			customSubTree="";
		}
		if(customSubTree.indexOf(",") != -1){
			cust = new StringTokenizer(customSubTree,",");
			while(cust.hasMoreTokens()){
				customSubTreeList.add(cust.nextToken());
			}
		}else{
			customSubTreeList.add(customSubTree);
		}*/

		StringBuffer url = new StringBuffer();
		url.append("site=");
		url.append(request.getParameter("site"));
		url.append("&host=");
		url.append(request.getParameter("host"));
		url.append("&layer=");
		url.append(request.getParameter("layer"));
		url.append("&qctr=2&comptype=");
		url.append(request.getParameter("comptype"));
		url.append("&fromalarm=");
		url.append(request.getParameter("fromalarm"));
		url.append("&msmt_host=");
		if(re_msmt_host!=null && re_msmt_host.trim().length()>0)
		{
			url.append(re_msmt_host);
		}
		else
		{
			url.append(test.getMsmtHost());
		}
		url.append("&test=");
		url.append(test.getTestName());
		url.append("-+");
		String thisInfo = test.getTestInfo();
		if(thisInfo!=null)
		{
			thisInfo=ui.getLookedupString(thisInfo);
			//if(thisInfo!=null && (thisInfo.indexOf("#")>-1 || thisInfo.indexOf("!")>-1))
			if(thisInfo!=null)
			{
				if(customSubTreeList!=null && customSubTreeList.size()>0 && customSubTreeList.contains(test.getTestName())){
					thisInfo = thisInfo.substring(thisInfo.indexOf(":")+1,thisInfo.length());
				}
				if(thisInfo!=null)
				{
					try
					{
						thisInfo=com.eg.EgURLEncoder.encode(thisInfo,"UTF-8");
					}
					catch(Exception e)
					{
						System.out.println("-----Exception-in getUrl method at dispCompTests.jsp---");
						e.printStackTrace();
					}
				}
			}
		}
		// myy changes next if else conditions
		/*if(customSubTreeList.contains(test.getTestName())){
			thisInfo = thisInfo.substring(thisInfo.indexOf(":")+1,thisInfo.length());
			url.append(thisInfo);
		}else{
			url.append(thisInfo);
		}*/
		//url.append(thisInfo);   //Antony
		url.append(thisInfo);
		url.append("&tstate=");
		url.append(test.getTestState());
		if (request.getParameter("searchString")!=null)
		{
			url.append("&searchString=");
			url.append(request.getParameter("searchString"));
			url.append("&backButton=true&subtitle=true&searchBox=true");
		}
		String str = request.getParameter("faketype");
		if (str != null && str.length() > 0)
		{
			url.append("&faketype=");
			url.append(request.getParameter("faketype"));
		}
		return url.toString();
	}
	//[ProcessTest-+cmd=GOOD, ProcessTest-+edit/plus-process=GOOD, ProcessTest-+lync=GOOD, ProcessTest-+notepad=INTERMEDIATE]
	public List sortByState(List list){
		List sortedList = new LinkedList();
		int prevState = 0;
		String text = "";
		try{
			if(list != null && list.size() > 0){
				for(int k=0;k<list.size();k++){
					String value = (String) list.get(k); 
					int stateCode=0;
					if(value.indexOf("HIGH") != -1)
						stateCode=1;
					else if(value.indexOf("INTERMEDIATE")!= -1 || value.indexOf("MEDIUM")!= -1 )
						stateCode=2;
					else if(value.indexOf("LOW")!= -1)
						stateCode=3;
					else if(value.indexOf("UNKNOWN")!= -1)
						stateCode=4;
					else if(value.indexOf("GOOD")!= -1)
						stateCode=5; 

					if(prevState == 0){
						text=text+value;		
					}else{
						if(prevState <= stateCode){
							text = text+value;
						}
						else{
							text = value+text;
						}
					}
					
					prevState = stateCode;
				}
				if(text.indexOf("HIGH") != -1)
						text = text.replaceAll("HIGH","HIGH,");
				 if(text.indexOf("INTERMEDIATE")!= -1 )
					text = text.replaceAll("INTERMEDIATE","INTERMEDIATE,");
				 if(text.indexOf("MEDIUM")!= -1)
					text = text.replaceAll("MEDIUM","MEDIUM,");
				 if(text.indexOf("LOW")!= -1)
					text = text.replaceAll("LOW","LOW,");
				 if(text.indexOf("UNKNOWN")!= -1)
					text = text.replaceAll("UNKNOWN","UNKNOWN,");
				 if(text.indexOf("GOOD") != -1)
					text = text.replaceAll("GOOD","GOOD,"); 
				StringTokenizer st  = new StringTokenizer(text,",");
				while(st.hasMoreTokens()){
					String sortTest = st.nextToken();
					if(sortTest.trim().length() > 1 )
						sortedList.add(sortTest);
				}
			}

		}catch(Exception e){
			System.out.println(""+e.toString());
		}
		return sortedList;
	}

	private String getUrl(com.egurkha.monitor.Test test, HttpServletRequest request,Hashtable linkMoreHashMap,String key,IniUI ui)
	{
		if(ui == null)
			ui = IniUI.getInstance();

		StringBuffer url = new StringBuffer();
		url.append("site=");
		url.append(request.getParameter("site"));
		url.append("&host=");
		url.append(request.getParameter("host"));
		url.append("&layer=");
		url.append(request.getParameter("layer"));
		url.append("&qctr=2&comptype=");
		url.append(request.getParameter("comptype"));
		url.append("&fromalarm=");
		url.append(request.getParameter("fromalarm"));
		url.append("&msmt_host=");
		url.append(test.getMsmtHost());
		url.append("&test=");
		if(linkMoreHashMap.containsKey(key)){
			String testLinkValue = (String)linkMoreHashMap.get(key);
			testLinkValue = testLinkValue.replace("=","&tstate=");
			try{
				String testName = testLinkValue.substring(0,testLinkValue.indexOf("-+")+2);
				String urlEncodeString = testLinkValue.substring(testLinkValue.indexOf("-+")+2,testLinkValue.indexOf("&tstate="));

				urlEncodeString=ui.getLookedupString(urlEncodeString);
				//if(urlEncodeString!=null && (urlEncodeString.indexOf("#")>-1 || urlEncodeString.indexOf("!")>-1))
				if(urlEncodeString!=null)
				{
					try
					{
						urlEncodeString=com.eg.EgURLEncoder.encode(urlEncodeString,"UTF-8");
					}
					catch(Exception e)
					{
						System.out.println("-----Exception-in getUrl method at dispCompTests.jsp---");
						e.printStackTrace();
					}
				}
				String state = testLinkValue.substring(testLinkValue.indexOf("&tstate="));
				testLinkValue = testName+""+urlEncodeString+state;
			}
			catch(Exception e){
				e.printStackTrace();
			}
			url.append(testLinkValue);
		}
		else{
			url.append(test.getTestName());
			url.append("-+");
			String thisInfo = test.getTestInfo();
			if(thisInfo!=null)
			{
				thisInfo=ui.getLookedupString(thisInfo);
				if(thisInfo!=null && (thisInfo.indexOf("#")>-1 || thisInfo.indexOf("!")>-1))
				{
					try
					{
						thisInfo=com.eg.EgURLEncoder.encode(thisInfo,"UTF-8");
					}
					catch(Exception e)
					{
						System.out.println("-----Exception-in getUrl method at dispCompTests.jsp---");
						e.printStackTrace();
					}
				}
			}
			url.append(thisInfo);   //Antony
			url.append("&tstate=");
			url.append(test.getTestState());
		}
		
		
		if (request.getParameter("searchString")!=null)
		{
			url.append("&searchString=");
			url.append(request.getParameter("searchString"));
			url.append("&backButton=true&subtitle=true&searchBox=true");
		}
		String str = request.getParameter("faketype");
		if (str != null && str.length() > 0)
		{
			url.append("&faketype=");
			url.append(request.getParameter("faketype"));
		}
		return url.toString();
	}

	// Splits the info string into info and msmt host
	private String[] getInfo(String testInfo)
	{
		String[] info = new String[2];
		int index = testInfo.indexOf(EgConstants.BLANK_SPACE);
		if (index == -1)
		{
			// See if info or msmtHost is present
			index = testInfo.indexOf("(");
			if (index == -1)
			{
				info[0] = testInfo;
				info[1] = EgConstants.BLANK_STRING;
			}
			else
			{
				info[0] = EgConstants.BLANK_STRING;
				info[1] = testInfo.substring(index, testInfo.lastIndexOf(")"));
			}
		}
		else
		{
			info[0] = testInfo.substring(0, index);
			info[1] = testInfo.substring(index+1);
		}
		return info;
	}
	public HashMap getSymbolText(boolean symbolBlock,String isSymbol,String testLabel_for_display,String test_name_value,boolean nextTestExists,EgTestInfo tokInfo,EgMappingInfo mappingInfo, String dispStrTooltip)
	{
		HashMap loc_result = new HashMap();
		if(nextTestExists)
		{
			if(symbolBlock && isSymbol!=null && isSymbol.trim().equalsIgnoreCase("::") && testLabel_for_display!=null && testLabel_for_display.trim().length()>0)
			{
				String temp_testLabel="";
				String temp_tooltip="";
				ArrayList token_list = tokInfo.egTokenizer(testLabel_for_display, "::");
				
				if(token_list!=null && token_list.size()>0)
				{
					String end_image_name_value="";
					String tooltip_value="";
					for(int ind_no=0;ind_no<token_list.size();ind_no++)
					{
						String path=(String)token_list.get(ind_no);

						if(ind_no==0)
						{
							if(test_name_value!=null && test_name_value.equals("RHEVMDataCenTest") || test_name_value.equals("RHEVMStorageTest") || test_name_value.equals("RHEVMClusterTest"))
							{
								end_image_name_value="descriptor_rhev_datacenter";
								tooltip_value="monitor.layermodel.Datacenter";
							}
							else
							{
								end_image_name_value="descriptor_vsphere_datacenter";
								tooltip_value="monitor.layermodel.Datacenter";
							}
						}
						else if(ind_no==1)
						{
							if(test_name_value!=null && test_name_value.equals("RHEVMStorageTest"))
							{
								end_image_name_value="descriptor_rhev_datastore";
								tooltip_value="monitor.layermodel.Data&nbsp;Storage";
							}
							else if(test_name_value!=null && test_name_value.equals("RHEVMClusterTest"))
							{
								end_image_name_value="descriptor_rhev_cluster";
								tooltip_value="monitor.layermodel.Cluster";
							}
							else
							{
								end_image_name_value="descriptor_vsphere_cluster";
								tooltip_value="monitor.layermodel.Cluster";
							}
						}
						else if(ind_no==2)
						{
							end_image_name_value="descriptor_vsphere_resourcepool";
							tooltip_value="monitor.layermodel.monitor.layermodel.Resource&nbsp;pool";
						}

						if(path!=null && path.trim().length()>0)
						{
							ArrayList path_list = tokInfo.egTokenizer(path, "->");
							if(path_list!=null && path_list.size()==2)
							{
								String folder_part=(String)path_list.get(0);
								if(folder_part!=null && folder_part.trim().length()>0)
								{
									ArrayList folder_list = tokInfo.egTokenizer(folder_part, "\\");
									if(folder_list!=null && folder_list.size()>0)
									{
										for(int w=0;w<folder_list.size();w++)
										{
											String folder_name=(String)folder_list.get(w);
											
											temp_testLabel=temp_testLabel+" <img class='descriptor_vsphere_folder' style='margin-top:2px' src ='/final/images/clear.png' border = '0' title='"+mappingInfo.getTextDescription("monitor.layermodel.Folder")+"'/> "+folder_name;

											temp_tooltip=temp_tooltip+" <img src =\\'/final/monitor/eg_images/vsphere_folder_11.png\\' width = \\'13\\' title=\\'"+mappingInfo.getTextDescription("monitor.layermodel.Folder")+"\\'> "+folder_name;
										}
									}
								}

								String dc_or_cl_rp_path=(String)path_list.get(1);
								if(dc_or_cl_rp_path!=null && dc_or_cl_rp_path.trim().length()>0)
								{
									ArrayList dc_or_cl_rp_list = tokInfo.egTokenizer(dc_or_cl_rp_path,"/");
						
									if(dc_or_cl_rp_list!=null && dc_or_cl_rp_list.size()>0)
									{
										for(int w=0;w<dc_or_cl_rp_list.size();w++)
										{
											String dc_or_cl_rp_name=(String)dc_or_cl_rp_list.get(w);

											temp_testLabel=temp_testLabel+" <img class='"+end_image_name_value+"' style='margin-top:2px' src ='/final/images/clear.png' border = '0' title='"+mappingInfo.getTextDescription(tooltip_value)+"' /> "+dc_or_cl_rp_name;

											temp_tooltip=temp_tooltip+" <img src =\\'/final/monitor/eg_images/"+end_image_name_value+".png\\' width = \\'13\\' > "+dc_or_cl_rp_name;
										}
									}
								}
							}
							else if(path_list!=null && path_list.size()==1)
							{
								String dc_or_cl_rp_path=(String)path_list.get(0);
								if(dc_or_cl_rp_path!=null && dc_or_cl_rp_path.trim().length()>0)
								{
									ArrayList dc_or_cl_rp_list = tokInfo.egTokenizer(dc_or_cl_rp_path,"/");
						
									if(dc_or_cl_rp_list!=null && dc_or_cl_rp_list.size()>0)
									{
										for(int w=0;w<dc_or_cl_rp_list.size();w++)
										{
											String dc_or_cl_rp_name=(String)dc_or_cl_rp_list.get(w);

											temp_testLabel=temp_testLabel+" <img class='"+end_image_name_value+"' style='margin-top:2px' src ='/final/images/clear.png' border = '0' title='"+mappingInfo.getTextDescription(tooltip_value)+"' /> "+dc_or_cl_rp_name;

											temp_tooltip=temp_tooltip+" <img src =\\'/final/monitor/eg_images/"+end_image_name_value+".png\\' width = \\'13\\' > "+dc_or_cl_rp_name;
										}
									}
								}
							}
						}
					}
					if(temp_testLabel!=null && temp_testLabel.trim().length()>0)
					{
						//testLabel_for_display=temp_testLabel;
						loc_result.put("testLabel_for_display",temp_testLabel);
					}
					if(temp_tooltip!=null && temp_tooltip.trim().length()>0)
					{
						//dispStrTooltip=temp_tooltip;
						loc_result.put("dispStrTooltip",temp_tooltip);
					}
				}
			}
			else if(symbolBlock && isSymbol!=null && isSymbol.trim().equalsIgnoreCase("/") && testLabel_for_display!=null && testLabel_for_display.trim().length()>0)
			{
				String temp_testLabel="";
				String temp_tooltip="";
				ArrayList resourcepool_list = tokInfo.egTokenizer(testLabel_for_display,"/");
				if(resourcepool_list!=null && resourcepool_list.size()>0)
				{
					for(int w=0;w<resourcepool_list.size();w++)
					{
						String resourcepool_name=(String)resourcepool_list.get(w);

						temp_testLabel=temp_testLabel+" <img class='descriptor_vsphere_resourcepool' style='margin-top:2px' src ='/final/images/clear.png' border = '0' title='"+mappingInfo.getTextDescription("monitor.layermodel.Resource pool")+"' /> "+resourcepool_name;

						temp_tooltip=temp_tooltip+" <img src =\\'/final/monitor/eg_images/vsphere_resourcepool_11.png\\' width = \\'13\\' > "+resourcepool_name;
					}
				}
				if(temp_testLabel!=null && temp_testLabel.trim().length()>0)
				{
					//testLabel_for_display=temp_testLabel;
					loc_result.put("testLabel_for_display",temp_testLabel);
				}
				if(temp_tooltip!=null && temp_tooltip.trim().length()>0)
				{
						dispStrTooltip=temp_tooltip;
						loc_result.put("dispStrTooltip",temp_tooltip);
				}
			}
			else if(symbolBlock && isSymbol!=null && isSymbol.trim().equalsIgnoreCase("$eg^") && testLabel_for_display!=null && testLabel_for_display.trim().length()>0)
			{
				String temp_testLabel="";
				if(test_name_value.equals("MsSqlDatabaseTest") || test_name_value.equals("MsSqlDBStatusTest") || test_name_value.equals("MsSqlLongRunQryTest") || test_name_value.equals("MsSqlMissingIdxTest") || test_name_value.equals("MsSqlNetTest") || test_name_value.equals("MsSqlSpaceTest") || test_name_value.equals("MsSqlTabSizeTest") || test_name_value.equals("MsSqlTransSpaceTest") || test_name_value.equals("MsSqlUnusedIdxTest"))
				{
					temp_testLabel=temp_testLabel+" <img class='descriptor_database' style='margin-top:2px' src ='/final/images/clear.png' border = '0' title='"+mappingInfo.getTextDescription("monitor.layermodel.DB")+"'/> "+testLabel_for_display;
				}
				else if(test_name_value.equals("MsSqlAppsTest") || test_name_value.equals("MsSqlSessionStTest"))
				{
					temp_testLabel=temp_testLabel+" <img class='descriptor_application' style='margin-top:2px' src ='/final/images/clear.png' border = '0' title='"+mappingInfo.getTextDescription("monitor.layermodel.Application")+"'/> "+testLabel_for_display;
				}
				else if(test_name_value.equals("CtxAppTest") || test_name_value.equals("CtxXcXAAppTest") || test_name_value.equals("CtxXcXAGPUAppTest"))
				{
					String testLabel_for_display_name=testLabel_for_display;
					if(testLabel_for_display_name.indexOf(':') != -1)
					{
						StringTokenizer strToken = new StringTokenizer(testLabel_for_display_name,":");
						String firstString=strToken.nextToken();
						String secondString=strToken.nextToken();
						if(firstString!=null && firstString.indexOf('\\') != -1)
						{
							String folderName=firstString.substring(0,firstString.lastIndexOf('\\'));
							StringTokenizer stringToken = new StringTokenizer(folderName,"\\");
							while (stringToken.hasMoreElements())
							{
								temp_testLabel=temp_testLabel+" <img class='descriptor_vsphere_folder' style='margin-top:2px' src ='/final/images/clear.png' border = '0' title='"+mappingInfo.getTextDescription("monitor.layermodel.Folder")+"'/> "+stringToken.nextElement();
							}
							String workGroup=firstString.substring(firstString.lastIndexOf('\\')+1);
							temp_testLabel=temp_testLabel+" <img class='descriptor_workgroup' style='margin-top:2px' src ='/final/images/clear.png' border = '0' title='"+mappingInfo.getTextDescription("monitor.layermodel.WorkerGroup")+"'/> "+workGroup;
						}
						else
						{
							if(firstString!=null && firstString.indexOf('/') != -1)
							{
								String folderName=firstString.substring(0,firstString.lastIndexOf('/'));
								StringTokenizer stringToken = new StringTokenizer(folderName,"/");
								while (stringToken.hasMoreElements())
								{
									temp_testLabel=temp_testLabel+" <img class='descriptor_vsphere_folder' style='margin-top:2px' src ='/final/images/clear.png' border = '0' title='"+mappingInfo.getTextDescription("monitor.layermodel.Folder")+"'/> "+stringToken.nextElement();
								}
								String workGroup=firstString.substring(firstString.lastIndexOf('/')+1);
								temp_testLabel=temp_testLabel+" <img class='descriptor_workgroup' style='margin-top:2px' src ='/final/images/clear.png' border = '0' title='"+mappingInfo.getTextDescription("monitor.layermodel.WorkerGroup")+"'/> "+workGroup;
							}
							else
							{
								temp_testLabel=temp_testLabel+" <img class='descriptor_workgroup' style='margin-top:2px' src ='/final/images/clear.png' border = '0' title='"+mappingInfo.getTextDescription("monitor.layermodel.WorkerGroup")+"'/> "+firstString;
							}
						}
						if(secondString!=null && secondString.indexOf('\\') != -1)
						{
							String folderName=secondString.substring(0,secondString.lastIndexOf('\\'));
							StringTokenizer stringToken = new StringTokenizer(folderName,"\\");
							while (stringToken.hasMoreElements())
							{
								temp_testLabel=temp_testLabel+" <img class='descriptor_vsphere_folder' style='margin-top:2px' src ='/final/images/clear.png' border = '0' title='"+mappingInfo.getTextDescription("monitor.layermodel.Folder")+"'/> "+stringToken.nextElement();
							}
							String applicationName=secondString.substring(secondString.lastIndexOf('\\')+1);
							temp_testLabel=temp_testLabel+" <img class='descriptor_application' style='margin-top:2px' src ='/final/images/clear.png' border = '0' title='"+mappingInfo.getTextDescription("monitor.layermodel.Application")+"'/> "+applicationName;
						}
						else
						{	
							if(secondString!=null && secondString.indexOf('/') != -1)
							{
								String folderName=secondString.substring(0,secondString.lastIndexOf('/'));
								StringTokenizer stringToken = new StringTokenizer(folderName,"/");
								while(stringToken.hasMoreElements())
								{
									temp_testLabel=temp_testLabel+" <img class='descriptor_vsphere_folder' style='margin-top:2px' src ='/final/images/clear.png' border = '0' title='"+mappingInfo.getTextDescription("monitor.layermodel.Folder")+"'/> "+stringToken.nextElement();
								}
								String applicationName=secondString.substring(secondString.lastIndexOf('/')+1);
								temp_testLabel=temp_testLabel+" <img class='descriptor_application' style='margin-top:2px' src ='/final/images/clear.png' border = '0' title='"+mappingInfo.getTextDescription("monitor.layermodel.Application")+"'/> "+applicationName;
							}
							else
							{
								temp_testLabel=temp_testLabel+" <img class='descriptor_application' style='margin-top:2px' src ='/final/images/clear.png' border = '0' title='"+mappingInfo.getTextDescription("monitor.layermodel.Application")+"'/> "+secondString;
							}
						}
					}//end if :
					else if(testLabel_for_display_name.indexOf('\\') != -1)
					{
						String folderName=testLabel_for_display_name.substring(0,testLabel_for_display_name.lastIndexOf('\\'));
						StringTokenizer stringToken = new StringTokenizer(folderName,"\\");
						while(stringToken.hasMoreElements())
						{
							temp_testLabel=temp_testLabel+" <img class='descriptor_vsphere_folder' style='margin-top:2px' src ='/final/images/clear.png' border = '0' title='"+mappingInfo.getTextDescription("monitor.layermodel.Folder")+"'/> "+stringToken.nextElement();
						}
						String applicationName=testLabel_for_display_name.substring(testLabel_for_display_name.lastIndexOf('\\')+1);
						temp_testLabel=temp_testLabel+" <img class='descriptor_application' style='margin-top:2px' src ='/final/images/clear.png' border = '0' title='"+mappingInfo.getTextDescription("monitor.layermodel.Application")+"'/> "+applicationName;
						
					}
					else if(testLabel_for_display_name.indexOf('/') != -1)
					{
						String folderName=testLabel_for_display_name.substring(0,testLabel_for_display_name.lastIndexOf('/'));
						StringTokenizer stringToken = new StringTokenizer(folderName,"/");
						while(stringToken.hasMoreElements())
						{
							temp_testLabel=temp_testLabel+" <img class='descriptor_vsphere_folder' style='margin-top:2px' src ='/final/images/clear.png' border = '0' title='"+mappingInfo.getTextDescription("monitor.layermodel.Folder")+"'/> "+stringToken.nextElement();
						}
						String applicationName=testLabel_for_display_name.substring(testLabel_for_display_name.lastIndexOf('/')+1);
						temp_testLabel=temp_testLabel+" <img class='descriptor_application' style='margin-top:2px' src ='/final/images/clear.png' border = '0' title='"+mappingInfo.getTextDescription("monitor.layermodel.Application")+"'/> "+applicationName;
					}
					else
					{
						temp_testLabel=temp_testLabel+" <img class='descriptor_application' style='margin-top:2px' src ='/final/images/clear.png' border = '0' title='"+mappingInfo.getTextDescription("monitor.layermodel.Application")+"'/> "+testLabel_for_display;
					}
				} //end if for citrix
				else
				{
					temp_testLabel=temp_testLabel+" <img class='descriptor_user' style='margin-top:2px' src ='/final/images/clear.png' border = '0' title='"+mappingInfo.getTextDescription("monitor.layermodel.User")+"'/> "+testLabel_for_display;
				}

				if(temp_testLabel!=null && temp_testLabel.trim().length()>0)
				{
					//testLabel_for_display=temp_testLabel;
					loc_result.put("testLabel_for_display",temp_testLabel);
				}
			}
			else if(symbolBlock && isSymbol!=null && isSymbol.trim().equalsIgnoreCase(":") && testLabel_for_display!=null && testLabel_for_display.trim().length()>0)
			{
				String temp_testLabel="";
				String temp_tooltip="";
				String temp_lableTest="";
				String temp_lableToolTip="";
				ArrayList token_list = tokInfo.egTokenizer(testLabel_for_display, ":");
				if(token_list!=null && token_list.size()>0)
				{
					String end_image_name_value="";
					String image_name_value2="";
					String tooltip_value="";
					String tooltip_value2="";
					for(int ind_no=0;ind_no<token_list.size();ind_no++)
					{
						String path=(String)token_list.get(ind_no);

						if(ind_no==0)
						{
							end_image_name_value="descriptor_xen_desktop_controller";
							tooltip_value="monitor.layermodel.Controller";

							image_name_value2="descriptor_xen_desktop_group";
							tooltip_value2="monitor.layermodel.Desktop&nbsp;Groups";
						}
						else if(ind_no==1)
						{
							end_image_name_value="descriptor_xen_desktop";
							tooltip_value="monitor.layermodel.Desktop";
						}

						if(path!=null && path.trim().length()>0)
						{
							if(ind_no==0)
							{
								ArrayList path_list = tokInfo.egTokenizer(path, "->");
								if(path_list!=null && path_list.size()==2)
								{
									String controller=(String)path_list.get(0);
									
									temp_testLabel=temp_testLabel+" <img class='"+end_image_name_value+"' style='margin-top:2px' src ='/final/images/clear.png'  border = '0' title='"+mappingInfo.getTextDescription(tooltip_value)+"'/> "+controller;
									
									temp_tooltip=temp_tooltip+" <img src =\\'/final/monitor/eg_images/'"+end_image_name_value+".png\\' width = \\'13\\' > "+controller;
									
									String folder_and_groupName=(String)path_list.get(1);

									if(folder_and_groupName!=null && folder_and_groupName.trim().length()>0)
									{
										ArrayList f_and_g_list = tokInfo.egTokenizer(folder_and_groupName, "\\");

										if(f_and_g_list!=null && f_and_g_list.size()>0)
										{
											if(f_and_g_list.size()==2)
											{
												String  folder_name=(String)f_and_g_list.get(0);
												temp_testLabel=temp_testLabel+" <img class='descriptor_vsphere_folder' style='margin-top:2px' src ='/final/images/clear.png'  border = '0'  title='"+mappingInfo.getTextDescription("monitor.layermodel.Folder")+"'/> "+folder_name;

												temp_tooltip=temp_tooltip+" <img src =\\'/final/monitor/eg_images/vsphere_folder_11.png.png\\' width = \\'13\\' > "+folder_name;
												
												String group_name=(String)f_and_g_list.get(1);
												temp_testLabel=temp_testLabel+" <img class='"+image_name_value2+"' src ='/final/images/clear.png' style='margin-top:2px' border = '0' title='"+mappingInfo.getTextDescription(tooltip_value2)+"'/> "+group_name;

												temp_tooltip=temp_tooltip+" <img src =\\'/final/monitor/eg_images/"+image_name_value2+".png\\' width = \\'13\\' > "+group_name;

											}
											else if(f_and_g_list.size()==1)
											{
												String groupName=(String)f_and_g_list.get(0);
												temp_testLabel=temp_testLabel+" <img class='"+image_name_value2+"' src ='/final/images/clear.png' style='margin-top:2px' border = '0' title='"+mappingInfo.getTextDescription(tooltip_value2)+"'/> "+groupName;

												temp_tooltip=temp_tooltip+" <img src =\\'/final/monitor/eg_images/'"+image_name_value2+".png\\' width = \\'13\\' > "+groupName;
											}
										}
									}
								}
								else if(path_list!=null && path_list.size()==1)
								{
									String folder_and_groupName=(String)path_list.get(0);

									if(folder_and_groupName!=null && folder_and_groupName.length()>0)
									{
										ArrayList f_and_g_list = tokInfo.egTokenizer(folder_and_groupName, "\\");

										if(f_and_g_list!=null && f_and_g_list.size()>0)
										{
											if(f_and_g_list.size()==2)
											{
												String  folder_name=(String)f_and_g_list.get(0);
												temp_testLabel=temp_testLabel+" <img class='descriptor_vsphere_folder' src ='/final/images/clear.png' style='margin-top:2px' border = '0'  title='"+mappingInfo.getTextDescription("monitor.layermodel.Folder")+"'/> "+folder_name;

												temp_tooltip=temp_tooltip+" <img src =\\'/final/monitor/eg_images/vsphere_folder_11.png.png\\' width = \\'13\\' > "+folder_name;
												
												String group_name=(String)f_and_g_list.get(1);
												temp_testLabel=temp_testLabel+" <img class='"+image_name_value2+"' src ='/final/images/clear.png' style='margin-top:2px' border = '0' title='"+mappingInfo.getTextDescription(tooltip_value2)+"'/> "+group_name;

												temp_tooltip=temp_tooltip+" <img src =\\'/final/monitor/eg_images/"+image_name_value2+".png\\' width = \\'13\\' > "+group_name;

											}
											else if(f_and_g_list.size()==1)
											{
												String groupName=(String)f_and_g_list.get(0);
												temp_testLabel=temp_testLabel+" <img class='"+image_name_value2+"' src ='/final/images/clear.png' style='margin-top:2px' border = '0' title='"+mappingInfo.getTextDescription(tooltip_value2)+"'/> "+groupName;

												temp_tooltip=temp_tooltip+" <img src =\\'/final/monitor/eg_images/'"+image_name_value2+".png\\' width = \\'13\\' > "+groupName;
											}
										}
									}
								}
							}
							else if(ind_no==1)
							{
								ArrayList path_list = tokInfo.egTokenizer(path, "\\");
								if(path_list!=null && path_list.size()==2)
								{
									String  domain_name=(String)path_list.get(0);
									
									temp_testLabel=temp_testLabel+" <img class='descriptor_domain_name' src ='/final/images/clear.png' style='margin-top:2px' border = '0' title='"+mappingInfo.getTextDescription("monitor.layermodel.Domain")+"'/> "+domain_name;

									temp_tooltip=temp_tooltip+" <img src =\\'/final/monitor/eg_images/domain_name.png\\' width = \\'13\\' > "+domain_name;
									
									String deskTopName=(String)path_list.get(1);

									temp_testLabel=temp_testLabel+" <img class='"+end_image_name_value+"' src ='/final/images/clear.png' style='margin-top:2px' border = '0' title='"+mappingInfo.getTextDescription(tooltip_value)+"'/> "+deskTopName;

									temp_tooltip=temp_tooltip+" <img src =\\'/final/monitor/eg_images/"+end_image_name_value+".png\\' width = \\'13\\' > "+deskTopName;
								}
								else if(path_list!=null && path_list.size()==1)
								{
									String deskTopName=(String)path_list.get(0);

									temp_testLabel=temp_testLabel+" <img class='"+end_image_name_value+"' src ='/final/images/clear.png' style='margin-top:2px'  border = '0' title='"+mappingInfo.getTextDescription(tooltip_value)+"'/> "+deskTopName;

									temp_tooltip=temp_tooltip+" <img src =\\'/final/monitor/eg_images/"+end_image_name_value+".png\\' width = \\'13\\' > "+deskTopName;
								
								}
							}
						}
					}
				}
				if(temp_testLabel!=null && temp_testLabel.trim().length()>0)
				{
						//testLabel_for_display=temp_testLabel;
						loc_result.put("testLabel_for_display",temp_testLabel);
				}
					if(temp_tooltip!=null && temp_tooltip.trim().length()>0)
					{
						//dispStrTooltip=temp_tooltip;
						loc_result.put("dispStrTooltip",temp_tooltip);
					}
			}
		}
		else
		{
			if(symbolBlock && isSymbol!=null && isSymbol.trim().equalsIgnoreCase("::") && testLabel_for_display!=null && testLabel_for_display.trim().length()>0)
			{
				String temp_testLabel="";
				ArrayList token_list = tokInfo.egTokenizer(testLabel_for_display, "::");
				
				if(token_list!=null && token_list.size()>0)
				{
					String end_image_name_value="";
					String tooltip_value="";
					for(int ind_no=0;ind_no<token_list.size();ind_no++)
					{
						String path=(String)token_list.get(ind_no);

						if(ind_no==0)
						{
							if(test_name_value!=null && test_name_value.equals("RHEVMDataCenTest") || test_name_value.equals("RHEVMStorageTest") || test_name_value.equals("RHEVMClusterTest"))
							{
								end_image_name_value="descriptor_rhev_datacenter";
								tooltip_value="monitor.layermodel.Datacenter";
							}
							else
							{
								end_image_name_value="descriptor_vsphere_datacenter";
								tooltip_value="monitor.layermodel.Datacenter";
							}
						}
						else if(ind_no==1)
						{
							if(test_name_value!=null && test_name_value.equals("RHEVMStorageTest"))
							{
								end_image_name_value="descriptor_rhev_datastore";
								tooltip_value="monitor.layermodel.Data&nbsp;Storage";
							}
							else if(test_name_value!=null && test_name_value.equals("RHEVMClusterTest"))
							{
								end_image_name_value="descriptor_rhev_cluster";
								tooltip_value="monitor.layermodel.Cluster";
							}
							else
							{
								end_image_name_value="descriptor_vsphere_cluster";
								tooltip_value="monitor.layermodel.Cluster";
							}
						}
						else if(ind_no==2)
						{
							end_image_name_value="descriptor_vsphere_resourcepool";
							tooltip_value="monitor.layermodel.Resource&nbsp;pool";
						}

						if(path!=null && path.trim().length()>0)
						{
							ArrayList path_list = tokInfo.egTokenizer(path, "->");
							if(path_list!=null && path_list.size()==2)
							{
								String folder_part=(String)path_list.get(0);
								if(folder_part!=null && folder_part.trim().length()>0)
								{
									ArrayList folder_list = tokInfo.egTokenizer(folder_part, "\\");
									if(folder_list!=null && folder_list.size()>0)
									{
										for(int w=0;w<folder_list.size();w++)
										{
											String folder_name=(String)folder_list.get(w);
											
											temp_testLabel=temp_testLabel+" <img class='descriptor_vsphere_folder' style='margin-top:2px' src ='/final/images/clear.png'  border = '0' title='"+mappingInfo.getTextDescription("monitor.layermodel.Folder")+"'/> "+folder_name;
										}
									}
								}

								String dc_or_cl_rp_path=(String)path_list.get(1);
								if(dc_or_cl_rp_path!=null && dc_or_cl_rp_path.trim().length()>0)
								{
									ArrayList dc_or_cl_rp_list = tokInfo.egTokenizer(dc_or_cl_rp_path,"/");
						
									if(dc_or_cl_rp_list!=null && dc_or_cl_rp_list.size()>0)
									{
										for(int w=0;w<dc_or_cl_rp_list.size();w++)
										{
											String dc_or_cl_rp_name=(String)dc_or_cl_rp_list.get(w);
											temp_testLabel=temp_testLabel+" <img class='"+end_image_name_value+"' style='margin-top:2px' src ='/final/images/clear.png' border = '0' title='"+mappingInfo.getTextDescription(tooltip_value)+"'/> "+dc_or_cl_rp_name;
										}
									}
								}
							}
							else if(path_list!=null && path_list.size()==1)
							{
								String dc_or_cl_rp_path=(String)path_list.get(0);
								if(dc_or_cl_rp_path!=null && dc_or_cl_rp_path.trim().length()>0)
								{
									ArrayList dc_or_cl_rp_list = tokInfo.egTokenizer(dc_or_cl_rp_path,"/");
						
									if(dc_or_cl_rp_list!=null && dc_or_cl_rp_list.size()>0)
									{
										for(int w=0;w<dc_or_cl_rp_list.size();w++)
										{
											String dc_or_cl_rp_name=(String)dc_or_cl_rp_list.get(w);
											temp_testLabel=temp_testLabel+" <img class='"+end_image_name_value+"' src ='/final/images/clear.png' style='margin-top:2px' border = '0' title='"+mappingInfo.getTextDescription(tooltip_value)+"'/> "+dc_or_cl_rp_name;
										}
									}
								}
							}
						}
					}
					if(temp_testLabel!=null && temp_testLabel.trim().length()>0)
					{
						//testLabel_for_display=temp_testLabel;
						loc_result.put("testLabel_for_display",temp_testLabel);
					}
				}
			}
			else if(symbolBlock && isSymbol!=null && isSymbol.trim().equalsIgnoreCase("/") && testLabel_for_display!=null && testLabel_for_display.trim().length()>0)
			{
				String temp_testLabel="";
				ArrayList resourcepool_list = tokInfo.egTokenizer(testLabel_for_display,"/");
				if(resourcepool_list!=null && resourcepool_list.size()>0)
				{
					for(int w=0;w<resourcepool_list.size();w++)
					{
						String resourcepool_name=(String)resourcepool_list.get(w);
						temp_testLabel=temp_testLabel+" <img class='descriptor_vsphere_resourcepool' style='margin-top:2px' src ='/final/images/clear.png' border = '0' title='"+mappingInfo.getTextDescription("monitor.layermodel.Resource pool")+"'/> "+resourcepool_name;
					}
				}
				if(temp_testLabel!=null && temp_testLabel.trim().length()>0)
				{
					loc_result.put("testLabel_for_display",temp_testLabel);
					//testLabel_for_display=temp_testLabel;
				}
			}
			else if(symbolBlock && isSymbol!=null && isSymbol.trim().equalsIgnoreCase("$eg^") && testLabel_for_display!=null && testLabel_for_display.trim().length()>0)
			{
				String temp_testLabel="";
				if(test_name_value.equals("MsSqlDatabaseTest") || test_name_value.equals("MsSqlDBStatusTest") || test_name_value.equals("MsSqlLongRunQryTest") || test_name_value.equals("MsSqlMissingIdxTest") || test_name_value.equals("MsSqlNetTest") || test_name_value.equals("MsSqlSpaceTest") || test_name_value.equals("MsSqlTabSizeTest") || test_name_value.equals("MsSqlTransSpaceTest") || test_name_value.equals("MsSqlUnusedIdxTest"))
				{
					temp_testLabel=temp_testLabel+" <img class='descriptor_database' style='margin-top:2px' src ='/final/images/clear.png' border = '0' title='"+mappingInfo.getTextDescription("monitor.layermodel.DB")+"'/> "+testLabel_for_display;
				}
				else if(test_name_value.equals("MsSqlAppsTest") || test_name_value.equals("MsSqlSessionStTest"))
				{
					temp_testLabel=temp_testLabel+" <img class='descriptor_application' style='margin-top:2px' src ='/final/images/clear.png' border = '0' title='"+mappingInfo.getTextDescription("monitor.layermodel.Application")+"'/> "+testLabel_for_display;
				}
				else if(test_name_value.equals("CtxAppTest") || test_name_value.equals("CtxXcXAAppTest"))
				{
					String testLabel_for_display_name=testLabel_for_display;
					if(testLabel_for_display_name.indexOf(':') != -1)
					{
						StringTokenizer strToken = new StringTokenizer(testLabel_for_display_name,":");
						String firstString=strToken.nextToken();
						String secondString=strToken.nextToken();
						if(firstString!=null && firstString.indexOf('\\') != -1)
						{
							String folderName=firstString.substring(0,firstString.lastIndexOf('\\'));
							StringTokenizer stringToken = new StringTokenizer(folderName,"\\");
							while (stringToken.hasMoreElements())
							{
								temp_testLabel=temp_testLabel+" <img class='descriptor_vsphere_folder' style='margin-top:2px' src ='/final/images/clear.png' border = '0' title='"+mappingInfo.getTextDescription("monitor.layermodel.Folder")+"'/> "+stringToken.nextElement();
							}
							String workGroup=firstString.substring(firstString.lastIndexOf('\\')+1);
							temp_testLabel=temp_testLabel+" <img class='descriptor_workgroup' style='margin-top:2px' src ='/final/images/clear.png' border = '0' title='"+mappingInfo.getTextDescription("monitor.layermodel.WorkerGroup")+"'/> "+workGroup;
						}
						else
						{
							if(firstString!=null && firstString.indexOf('/') != -1)
							{
								String folderName=firstString.substring(0,firstString.lastIndexOf('/'));
								StringTokenizer stringToken = new StringTokenizer(folderName,"/");
								while (stringToken.hasMoreElements())
								{
									temp_testLabel=temp_testLabel+" <img class='descriptor_vsphere_folder' style='margin-top:2px' src ='/final/images/clear.png' border = '0' title='"+mappingInfo.getTextDescription("monitor.layermodel.Folder")+"'/> "+stringToken.nextElement();
								}
								String workGroup=firstString.substring(firstString.lastIndexOf('/')+1);
								temp_testLabel=temp_testLabel+" <img class='descriptor_workgroup' style='margin-top:2px' src ='/final/images/clear.png' border = '0' title='"+mappingInfo.getTextDescription("monitor.layermodel.WorkerGroup")+"'/> "+workGroup;
							}
							else
							{
								temp_testLabel=temp_testLabel+" <img class='descriptor_workgroup' style='margin-top:2px' src ='/final/images/clear.png' border = '0' title='"+mappingInfo.getTextDescription("monitor.layermodel.WorkerGroup")+"'/> "+firstString;
							}
						}
						if(secondString!=null && secondString.indexOf('\\') != -1)
						{
							String folderName=secondString.substring(0,secondString.lastIndexOf('\\'));
							StringTokenizer stringToken = new StringTokenizer(folderName,"\\");
							while (stringToken.hasMoreElements())
							{
								temp_testLabel=temp_testLabel+" <img class='descriptor_vsphere_folder' style='margin-top:2px' src ='/final/images/clear.png' border = '0' title='"+mappingInfo.getTextDescription("monitor.layermodel.Folder")+"'/> "+stringToken.nextElement();
							}
							String applicationName=secondString.substring(secondString.lastIndexOf('\\')+1);
							temp_testLabel=temp_testLabel+" <img class='descriptor_application' style='margin-top:2px' src ='/final/images/clear.png' border = '0' title='"+mappingInfo.getTextDescription("monitor.layermodel.Application")+"'/> "+applicationName;
						}
						else
						{	
							if(secondString!=null && secondString.indexOf('/') != -1)
							{
								String folderName=secondString.substring(0,secondString.lastIndexOf('/'));
								StringTokenizer stringToken = new StringTokenizer(folderName,"/");
								while(stringToken.hasMoreElements())
								{
									temp_testLabel=temp_testLabel+" <img class='descriptor_vsphere_folder' style='margin-top:2px' src ='/final/images/clear.png' border = '0' title='"+mappingInfo.getTextDescription("monitor.layermodel.Folder")+"'/> "+stringToken.nextElement();
								}
								String applicationName=secondString.substring(secondString.lastIndexOf('/')+1);
								temp_testLabel=temp_testLabel+" <img class='descriptor_application' style='margin-top:2px' src ='/final/images/clear.png' border = '0' title='"+mappingInfo.getTextDescription("monitor.layermodel.Application")+"'/> "+applicationName;
							}
							else
							{
								temp_testLabel=temp_testLabel+" <img class='descriptor_application' style='margin-top:2px' src ='/final/images/clear.png' border = '0' title='"+mappingInfo.getTextDescription("monitor.layermodel.Application")+"'/> "+secondString;
							}
						}
					}//end if :
					else if(testLabel_for_display_name.indexOf('\\') != -1)
					{
						String folderName=testLabel_for_display_name.substring(0,testLabel_for_display_name.lastIndexOf('\\'));
						StringTokenizer stringToken = new StringTokenizer(folderName,"\\");
						while(stringToken.hasMoreElements())
						{
							temp_testLabel=temp_testLabel+" <img class='descriptor_vsphere_folder' style='margin-top:2px' src ='/final/images/clear.png' border = '0' title='"+mappingInfo.getTextDescription("monitor.layermodel.Folder")+"'/> "+stringToken.nextElement();
						}
						String applicationName=testLabel_for_display_name.substring(testLabel_for_display_name.lastIndexOf('\\')+1);
						temp_testLabel=temp_testLabel+" <img class='descriptor_application' style='margin-top:2px' src ='/final/images/clear.png' border = '0' title='"+mappingInfo.getTextDescription("monitor.layermodel.Application")+"'/> "+applicationName;
						
					}
					else if(testLabel_for_display_name.indexOf('/') != -1)
					{
						String folderName=testLabel_for_display_name.substring(0,testLabel_for_display_name.lastIndexOf('/'));
						StringTokenizer stringToken = new StringTokenizer(folderName,"/");
						while(stringToken.hasMoreElements())
						{
							temp_testLabel=temp_testLabel+" <img class='descriptor_vsphere_folder' style='margin-top:2px' src ='/final/images/clear.png' border = '0' title='"+mappingInfo.getTextDescription("monitor.layermodel.Folder")+"'/> "+stringToken.nextElement();
						}
						String applicationName=testLabel_for_display_name.substring(testLabel_for_display_name.lastIndexOf('/')+1);
						temp_testLabel=temp_testLabel+" <img class='descriptor_application' style='margin-top:2px' src ='/final/images/clear.png' border = '0' title='"+mappingInfo.getTextDescription("monitor.layermodel.Application")+"'/> "+applicationName;
					}
					else
					{
						temp_testLabel=temp_testLabel+" <img class='descriptor_application' style='margin-top:2px' src ='/final/images/clear.png' border = '0' title='"+mappingInfo.getTextDescription("monitor.layermodel.Application")+"'/> "+testLabel_for_display;
					}
				} //end if for citrix
				else
				{
					temp_testLabel=temp_testLabel+" <img class='descriptor_user' style='margin-top:2px' src ='/final/images/clear.png' border = '0' title='"+mappingInfo.getTextDescription("monitor.layermodel.User")+"'/> "+testLabel_for_display;
				}
				if(temp_testLabel!=null && temp_testLabel.trim().length()>0)
				{
					//testLabel_for_display=temp_testLabel;
					loc_result.put("testLabel_for_display",temp_testLabel);
				}
			}
			else if(symbolBlock && isSymbol!=null && isSymbol.trim().equalsIgnoreCase(":") && testLabel_for_display!=null && testLabel_for_display.trim().length()>0)
			{
				String temp_testLabel="";
				String temp_tooltip="";
				String temp_lableTest="";
				String temp_lableToolTip="";
				ArrayList token_list = tokInfo.egTokenizer(testLabel_for_display, ":");
				if(token_list!=null && token_list.size()>0)
				{
					String end_image_name_value="";
					String image_name_value2="";
					String tooltip_value="";
					String tooltip_value2="";
					for(int ind_no=0;ind_no<token_list.size();ind_no++)
					{
						String path=(String)token_list.get(ind_no);

						if(ind_no==0)
						{
							end_image_name_value="descriptor_xen_desktop_controller";
							tooltip_value="monitor.layermodel.Controller";

							image_name_value2="descriptor_xen_desktop_group";
							tooltip_value2="monitor.layermodel.Desktop&nbsp;Groups";
						}
						else if(ind_no==1)
						{
							end_image_name_value="descriptor_xen_desktop";
							tooltip_value="monitor.layermodel.Desktop";
						}

						if(path!=null && path.trim().length()>0)
						{
							if(ind_no==0)
							{
								ArrayList path_list = tokInfo.egTokenizer(path, "->");
								if(path_list!=null && path_list.size()==2)
								{
									String controller=(String)path_list.get(0);
									
									temp_testLabel=temp_testLabel+" <img class='"+end_image_name_value+"' style='margin-top:2px' src ='/final/images/clear.png' border = '0' title='"+mappingInfo.getTextDescription(tooltip_value)+"'/> "+controller;
									
									temp_tooltip=temp_tooltip+" <img src =\\'/final/monitor/eg_images/'"+end_image_name_value+".png\\' width = \\'13\\' > "+controller;
									
									String folder_and_groupName=(String)path_list.get(1);

									if(folder_and_groupName!=null && folder_and_groupName.trim().length()>0)
									{
										ArrayList f_and_g_list = tokInfo.egTokenizer(folder_and_groupName, "\\");

										if(f_and_g_list!=null && f_and_g_list.size()>0)
										{
											if(f_and_g_list.size()==2)
											{
												String  folder_name=(String)f_and_g_list.get(0);
												temp_testLabel=temp_testLabel+" <img class='descriptor_vsphere_folder' style='margin-top:2px' src ='/final/images/clear.png' border = '0' title='"+mappingInfo.getTextDescription("monitor.layermodel.Folder")+"'/> "+folder_name;

												temp_tooltip=temp_tooltip+" <img src =\\'/final/monitor/eg_images/vsphere_folder_11.png.png\\' width = \\'13\\' > "+folder_name;
												
												String group_name=(String)f_and_g_list.get(1);
												temp_testLabel=temp_testLabel+" <img class='"+image_name_value2+"' src ='/final/images/clear.png' style='margin-top:2px' border = '0' title='"+mappingInfo.getTextDescription(tooltip_value2)+"'/> "+group_name;

												temp_tooltip=temp_tooltip+" <img src =\\'/final/monitor/eg_images/"+image_name_value2+".png\\' width = \\'13\\' > "+group_name;

											}
											else if(f_and_g_list.size()==1)
											{
												String groupName=(String)f_and_g_list.get(0);
												temp_testLabel=temp_testLabel+" <img class='"+image_name_value2+"' src ='/final/images/clear.png' style='margin-top:2px' border = '0' title='"+mappingInfo.getTextDescription(tooltip_value2)+"'/> "+groupName;

												temp_tooltip=temp_tooltip+" <img src =\\'/final/monitor/eg_images/'"+image_name_value2+".png\\' width = \\'13\\' > "+groupName;
											}
										}
									}
								}
								else if(path_list!=null && path_list.size()==1)
								{
									String folder_and_groupName=(String)path_list.get(0);

									if(folder_and_groupName!=null && folder_and_groupName.trim().length()>0)
									{
										ArrayList f_and_g_list = tokInfo.egTokenizer(folder_and_groupName, "\\");

										if(f_and_g_list!=null && f_and_g_list.size()>0)
										{
											if(f_and_g_list.size()==2)
											{
												String  folder_name=(String)f_and_g_list.get(0);
												temp_testLabel=temp_testLabel+" <img class='descriptor_vsphere_folder' src ='/final/images/clear.png' style='margin-top:2px' border = '0' title='"+mappingInfo.getTextDescription("monitor.layermodel.Folder")+"'/> "+folder_name;

												temp_tooltip=temp_tooltip+" <img src =\\'/final/monitor/eg_images/vsphere_folder_11.png.png\\' width = \\'13\\' > "+folder_name;
												
												String group_name=(String)f_and_g_list.get(1);
												temp_testLabel=temp_testLabel+" <img class='"+image_name_value2+"' src ='/final/images/clear.png' style='margin-top:2px' border = '0' title='"+mappingInfo.getTextDescription(tooltip_value2)+"'/> "+group_name;

												temp_tooltip=temp_tooltip+" <img src =\\'/final/monitor/eg_images/"+image_name_value2+".png\\' width = \\'13\\' > "+group_name;

											}
											else if(f_and_g_list.size()==1)
											{
												String groupName=(String)f_and_g_list.get(0);
												temp_testLabel=temp_testLabel+" <img class='"+image_name_value2+"' src ='/final/images/clear.png' style='margin-top:2px' border = '0' title='"+mappingInfo.getTextDescription(tooltip_value2)+"'/> "+groupName;

												temp_tooltip=temp_tooltip+" <img src =\\'/final/monitor/eg_images/'"+image_name_value2+".png\\' width = \\'13\\' > "+groupName;
											}
										}
									}
								}
							}
							else if(ind_no==1)
							{
								ArrayList path_list = tokInfo.egTokenizer(path, "\\");
								if(path_list!=null && path_list.size()==2)
								{
									String  domain_name=(String)path_list.get(0);
									
									temp_testLabel=temp_testLabel+" <img class='descriptor_domain_name' src='/final/images/clear.png' style='margin-top:2px' border = '0'  title='"+mappingInfo.getTextDescription("monitor.layermodel.Domain")+"'/> "+domain_name;

									temp_tooltip=temp_tooltip+" <img src =\\'/final/monitor/eg_images/domain_name.png\\' width = \\'13\\' > "+domain_name;
									
									String deskTopName=(String)path_list.get(1);

									temp_testLabel=temp_testLabel+" <img class='"+end_image_name_value+"' src ='/final/images/clear.png' style='margin-top:2px' border = '0' title='"+mappingInfo.getTextDescription(tooltip_value)+"'/> "+deskTopName;

									temp_tooltip=temp_tooltip+" <img src =\\'/final/monitor/eg_images/"+end_image_name_value+".png\\' width = \\'13\\' > "+deskTopName;
								}
								else if(path_list!=null && path_list.size()==1)
								{
									String deskTopName=(String)path_list.get(0);

									temp_testLabel=temp_testLabel+" <img class='"+end_image_name_value+"' src ='/final/images/clear.png' style='margin-top:2px' border = '0' title='"+mappingInfo.getTextDescription(tooltip_value)+"'/> "+deskTopName;

									temp_tooltip=temp_tooltip+" <img src =\\'/final/monitor/eg_images/"+end_image_name_value+".png\\' width = \\'13\\' > "+deskTopName;
								
								}
							}
						}
					}
				}
				if(temp_testLabel!=null && temp_testLabel.trim().length()>0)
				{
					//testLabel_for_display=temp_testLabel;
					loc_result.put("testLabel_for_display",temp_testLabel);
				}
				if(temp_tooltip!=null && temp_tooltip.trim().length()>0)
				{
					//dispStrTooltip=temp_tooltip;
					loc_result.put("dispStrTooltip",dispStrTooltip);
				}
			}
		}
		return loc_result;

	}
	private Hashtable getTestDetails(EgDbAdapterUI egDb,ArrayList hideList,boolean isMoreInfosTreeView,String moreInfoTest,boolean isCheckTestData,Hashtable testDetails,String hostType,String hostName,String layerName,String siteName,boolean isApplicationLayer,ArrayList customSubTreeList,Hashtable customLayer,EgSpecsInfo specsInfo,ArrayList needList,String infoInsideView,Hashtable specTestDetails,long time_diff_in_ms)
	{
		Hashtable resHash = new Hashtable();

		Hashtable testWithMsmtHostHash=new Hashtable();
		Hashtable testInfoMap = new Hashtable();
		ResultSet rsLastMeasure = null;

		Hashtable testInfoMap_Temp = new Hashtable();
		Hashtable testInfoHash = new Hashtable();
		HashSet testInfoHashKey = new HashSet();

		ArrayList testsFromML = new ArrayList();
		ArrayList infosFromML = new ArrayList();
		ArrayList msmtFromML = new ArrayList();

		EgDateInfo methodDateInfo=new EgDateInfo();
		EgTestInfo tmpTokInfo = new EgTestInfo("manager");

		String uiFile = "eg_services.ini";
		String iniFileDir = EgInstallInfo.getInstallDir()+ "/manager/config/";
		IniFile egService = new IniFile(iniFileDir + uiFile);

		String temp = "";
		String tempIp = "";
		String portNumber = "";
		String compSid = "";
		StringTokenizer st = null;

		try
		{
			if(hostName != null && hostName.indexOf(":") > -1)
			{
				st = new StringTokenizer(hostName,":");
				if(st.countTokens()>2)
				{
					tempIp = st.nextToken();
					portNumber = st.nextToken();
					compSid = st.nextToken();
				}
				else if(st.countTokens()>1)
				{
					tempIp = st.nextToken();
					portNumber = st.nextToken();
				}
			}
			else
			{
				tempIp = hostName;
				if (tempIp == null)
					tempIp = "";
			}
			
			//new code for infos populate bug fix for multiple msmt_host 

			// Changed the query for get test with msmt_host in Hashtable for check the not running test.
			// by Saravanan.A on 25-4-2012
			//String msmtHostQuery = "Select distinct(msmt_host),test_name from measure_last where trgt_host='" +tempIp+ "' and test_name not like '%_cf' ";
			String msmtHostQuery = "Select distinct(msmt_host),test_name from measure_last where trgt_host='" +tempIp+ "'";
			Vector msmtHost = new Vector();
			ResultSet rsMsmtHost=null;

			try
			{
				if(EgInstallInfo.isSuperManager)
				{
					ArrayList managerIds = EgElementInfo.getInstance().getManagerIDs("component",tempIp);
					Hashtable ht = new Hashtable();
					ht.put("OracleQuery",msmtHostQuery);
					ht.put("SqlQuery",msmtHostQuery);
					if(managerIds != null && !managerIds.isEmpty())
					{
						ht.put("special_case_mgr_ids",managerIds);
					}
					rsMsmtHost = new EgSMDBHelper().getResultSet(ht);
				}
				else
				{
					rsMsmtHost = egDb.dbselect(msmtHostQuery);
				}
				if(rsMsmtHost != null)
				{
					while(rsMsmtHost != null && rsMsmtHost.next())
					{
						String ss = rsMsmtHost.getString("msmt_host");
						String t_name = rsMsmtHost.getString("test_name");

						if(t_name != null && t_name.endsWith("_cf"))
							continue;
						
						if(needList != null && needList.size()>0 && t_name != null && !needList.contains(t_name))
							continue;

						if(hideList != null && hideList.size()>0 && t_name != null && hideList.contains(t_name))
							continue;
					
						if(isMoreInfosTreeView && !moreInfoTest.equalsIgnoreCase(t_name))
							continue;

						if (ss == null)
							continue;
						if (!msmtHost.contains(ss))
							msmtHost.addElement(ss);

						// Get test with msmt_host in Hashtable for check the not running test.
						// by Saravanan.A on 25-4-2012
						if(testWithMsmtHostHash.size()==0)
						{
							ArrayList temp_mlist=new ArrayList();
							temp_mlist.add(ss);
							testWithMsmtHostHash.put(t_name,(ArrayList)temp_mlist);
						}
						else if(testWithMsmtHostHash.size()>0)
						{
							if(testWithMsmtHostHash.containsKey(t_name))
							{
								ArrayList temp_mlist=(ArrayList)testWithMsmtHostHash.get(t_name);
								temp_mlist.add(ss);
								testWithMsmtHostHash.put(t_name,(ArrayList)temp_mlist);
							}
							else
							{
								ArrayList temp_mlist=new ArrayList();
								temp_mlist.add(ss);
								testWithMsmtHostHash.put(t_name,(ArrayList)temp_mlist);
							}
						}
						//--end--
					}
					if (rsMsmtHost != null)
						rsMsmtHost.close();
				}
				if(msmtHost.size()==0)
					msmtHost.addElement("Test");
			}
			catch(Exception rss)
			{
				if (rsMsmtHost != null)
				try { rsMsmtHost.close(); } catch (Exception grr) {grr.printStackTrace();}
				rss.printStackTrace();
			}

			long mgrTime = methodDateInfo.egetUTCDate(false);

			//new code for infos populate bug fix
			for(int i=0; i<msmtHost.size();i++)
			{
				String tempMsmtHost = (String) msmtHost.get(i);
				if(tempMsmtHost != null && tempMsmtHost.equalsIgnoreCase("Test"))
					tempMsmtHost=null;
				rsLastMeasure = egDb.SelectLastMeasTimeInfo(tempIp, portNumber, siteName, layerName, tempMsmtHost,hostType);
				if (rsLastMeasure != null)
				{
					try
					{
						while(rsLastMeasure != null && rsLastMeasure.next())
						{
							temp = rsLastMeasure.getString("INFO");
							String port_number = rsLastMeasure.getString("PORT_NO");
							if (temp!=null && temp.trim().equals(""))
								continue;
							
							if (infoInsideView!=null && infoInsideView.trim().length() > 0 && temp!=null && temp.trim().length() > 0)
							{
								String tempInfo = "";
								if(temp.startsWith("+"))
									tempInfo = temp.substring(1);
								if(tempInfo.indexOf(":") > -1)
									tempInfo = tempInfo.substring(0,tempInfo.indexOf(":"));
								if(!(tempInfo.equalsIgnoreCase(infoInsideView)))
									continue;
							}
							String test_Name= rsLastMeasure.getString("TEST_NAME");
							if(needList != null && needList.size()>0 && test_Name != null && !needList.contains(test_Name))
								continue;

							if(hideList != null && hideList.size()>0 && test_Name != null && hideList.contains(test_Name))
								continue;	
							if(isMoreInfosTreeView && test_Name!=null && !moreInfoTest.equalsIgnoreCase(test_Name))
								continue;

							// -- Check whether the info have in metatest table
							// by Saravanan.A on 21-Jun-2012.
							//ArrayList testData = (ArrayList)testDetails.get(test_Name);
							ArrayList testData = new ArrayList();
							if(isCheckTestData)
							{
								testData = (ArrayList)testDetails.get(test_Name);
							}

							// To retrieve infos from measure_last table instead of metatest table.
							// by Saravanan.A changed on 14-12-2011.
							String temp_info=temp;
							if(!temp_info.startsWith("+") && hostType.equals("Oracle_server") && compSid!=null && compSid.length()>0)
							{
								String temp_sid=temp_info.substring(0,temp_info.indexOf("+"));
								if(temp_sid==null || (!compSid.trim().equals(temp_sid)))
									continue;
								temp_info=temp_info.substring(temp_info.indexOf("+"));
								if(temp_info != null && temp_info.equals("++"))
								{
									continue;
								}
							}
							else if(isApplicationLayer && hostType.equals("Oracle_server") && temp_info.startsWith("+") && compSid.trim().length()>0)
							{
								continue;
							}

							String temp_info2 = "";
							
							if(customSubTreeList != null ){
								if(customSubTreeList.contains(test_Name)){
									temp_info2 = "+"+temp_info.substring(temp_info.indexOf(":")+1,temp_info.length());
									customLayer.put(test_Name+"-"+temp_info,test_Name+"-"+temp_info2);
								}
							}

							boolean isAddEntry=true;
							/*if(isCheckTestData && testData!=null && testData.size()>0)
							{
								isAddEntry=false;
								int z=0;
								for(z=0;z<testData.size();z=z+3)
								{
									String meta_info=(String)testData.get(z+1);
									if(meta_info!=null && temp_info!=null && meta_info.equals(temp_info))
									{
										isAddEntry=true;
										break;
									}
									else if(meta_info!=null && temp_info2!=null && temp_info2.trim().length()>0 && meta_info.equals(temp_info2))
									{
										isAddEntry=true;
										break;
									}
								}
							}*/

							//if(testData!=null && (testData.size()==0 || testData.contains(temp_info) || testData.contains(temp_info2)))
							if(testData!=null && isAddEntry)
							{
								String multipleStr = egService.getValue("MEASURE_LAST_CUT_OFF_FACTOR", test_Name);
								boolean isTempTimeout=false;

								if(multipleStr!=null && multipleStr.trim().length()>0)
								{
									isTempTimeout=true;
									String db_str_msmt_time=(String)rsLastMeasure.getString("MSMT_TIME");

									String msmtTimeStrDate=db_str_msmt_time.substring(0,db_str_msmt_time.indexOf(" "));
									String msmtTimeStrTime=db_str_msmt_time.substring(db_str_msmt_time.indexOf(" ")+1);
									msmtTimeStrDate=com.egurkha.util.DateUtil.changeDateFormat(msmtTimeStrDate,"MM/dd/yyyy","dd/MM/yyyy");
									long msmtTime = methodDateInfo.egetUTCDate(msmtTimeStrDate+" "+msmtTimeStrTime);

									if(EgInstallInfo.isSuperManager)
									{
										msmtTime = msmtTime + time_diff_in_ms;
									}

									if((mgrTime - msmtTime) < (Integer.parseInt(multipleStr) * 60  * 1000l))
									{
										isTempTimeout = false;
									}
								}

								if(!isTempTimeout)
								{
									String tikey=test_Name+ "||" +temp+"||"+tempMsmtHost;

									boolean tmp_isPortRelevant = specsInfo.isPortRelevantForTest(test_Name, false);
									if(tmp_isPortRelevant)
									{
										if(portNumber!=null && port_number!=null && port_number.equalsIgnoreCase(portNumber))
										{
											//testInfoMap.put((rsLastMeasure.getString("TEST_NAME")+ "||" +temp), rsLastMeasure.getString("MSMT_TIME"));

											//testInfoMap.put((test_Name+ "||" +temp+"||"+tempMsmtHost), rsLastMeasure.getString("MSMT_TIME"));

											testInfoMap.put(tikey, rsLastMeasure.getString("MSMT_TIME"));

											testsFromML.add(test_Name);
											infosFromML.add(temp_info);
											msmtFromML.add(tempMsmtHost);

											if(testInfoHash.containsKey(test_Name))
											{
												HashSet testInfo_key=(HashSet)testInfoHash.get(test_Name);
												testInfo_key.add(tikey);
												testInfoHash.put(test_Name,testInfo_key);
											}
											else
											{
												HashSet testInfo_key=new HashSet();
												testInfo_key.add(tikey);
												testInfoHash.put(test_Name,testInfo_key);
											}

											testInfoHashKey.add(test_Name);
										}
									}
									else
									{
										if(port_number!=null && (port_number.equalsIgnoreCase("NULL") || port_number.equalsIgnoreCase("NONE")))
										{
											//testInfoMap.put((test_Name+ "||" +temp+"||"+tempMsmtHost), rsLastMeasure.getString("MSMT_TIME"));

											testInfoMap.put(tikey, rsLastMeasure.getString("MSMT_TIME"));

											testsFromML.add(test_Name);
											infosFromML.add(temp);
											msmtFromML.add(tempMsmtHost);

											if(testInfoHash.containsKey(test_Name))
											{
												HashSet testInfo_key=(HashSet)testInfoHash.get(test_Name);
												testInfo_key.add(tikey);
												testInfoHash.put(test_Name,testInfo_key);
											}
											else
											{
												HashSet testInfo_key=new HashSet();
												testInfo_key.add(tikey);
												testInfoHash.put(test_Name,testInfo_key);
											}
											testInfoHashKey.add(test_Name);
										}
									}
								}
							}
						}
						if (rsLastMeasure != null)
							rsLastMeasure.close();
						rsLastMeasure = null;
					}
					catch (Exception grr)
					{
						if (rsLastMeasure != null)
						{
							try
							{
								rsLastMeasure.close();
								rsLastMeasure = null;
							}
							catch (Exception g2)
							{
								g2.printStackTrace();
							}
						}
					}
				}
			}//for loop iteration for msmt_host
		}
		catch(Throwable ex)
		{
			System.out.println("During last measurement time info from db "+ex);
			ex.printStackTrace();
		}

		ArrayList testInfoList=new ArrayList();
		if(testInfoHashKey!=null)
			testInfoList.addAll(testInfoHashKey);
		if(isCheckTestData && testInfoList!=null && testInfoList.size()>0)
		{
			testsFromML = new ArrayList();
			infosFromML = new ArrayList();
			msmtFromML = new ArrayList();

			if(testInfoHash!=null && testInfoHash.size()>0)
			{
				for(int kk=0; kk<testInfoList.size();kk++)
				{
					String test_Name=(String)testInfoList.get(kk);
					HashSet tmp_hashset=(HashSet)testInfoHash.get(test_Name);
					ArrayList testInfoKey = new ArrayList();
					testInfoKey.addAll(tmp_hashset);

					ArrayList testData = new ArrayList();
					testData = (ArrayList)testDetails.get(test_Name);
					if(specTestDetails!=null && specTestDetails.size()>0)
					{
						ArrayList tmp_testData=(ArrayList)specTestDetails.get(test_Name);
						if(tmp_testData!=null && tmp_testData.size()>=0)
						{
							testData = tmp_testData;
						}
					}

					for(int ti=0;ti<testInfoKey.size();ti++)
					{
						String tikey=(String)testInfoKey.get(ti);

						if(tikey!=null && tikey.trim().length()>0)
						{
							ArrayList test_info_list = tmpTokInfo.egTokenizer(tikey, "||");
							if(test_info_list!=null && test_info_list.size()==3)
							{
								//String tmp_test_Name=(String)test_info_list.get(0);
								String tempI=(String)test_info_list.get(1);
								String tempMsmtHost=(String)test_info_list.get(2);

								String temp_info=tempI;
								if(!temp_info.startsWith("+") && hostType.equals("Oracle_server") && compSid!=null && compSid.length()>0)
								{
									String temp_sid=temp_info.substring(0,temp_info.indexOf("+"));
									if(temp_sid==null || (!compSid.trim().equals(temp_sid)))
										continue;
									temp_info=temp_info.substring(temp_info.indexOf("+"));
								}

								String temp_info2 = "";
								
								if(customSubTreeList != null )
								{
									if(customSubTreeList.contains(test_Name))
									{
										temp_info2 = "+"+temp_info.substring(temp_info.indexOf(":")+1,temp_info.length());
									}
								}

								boolean isAddEntry=true;
								if(testData!=null && testData.size()>0)
								{
									isAddEntry=false;
									int z=0;
									for(z=0;z<testData.size();z=z+3)
									{
										String meta_info=(String)testData.get(z+1);
										if(meta_info!=null && temp_info!=null && meta_info.equals(temp_info))
										{
											isAddEntry=true;
											break;
										}
										else if(meta_info!=null && temp_info2!=null && temp_info2.trim().length()>0 && meta_info.equals(temp_info2))
										{
											isAddEntry=true;
											break;
										}
									}
								}

								if(testData!=null && isAddEntry)
								{
									String msmt_host_val=(String)testInfoMap.get(tikey);
									testInfoMap_Temp.put(tikey, msmt_host_val);
									boolean isPortRelevant2 = specsInfo.isPortRelevantForTest(test_Name, false);
									if(isPortRelevant2)
									{
										testsFromML.add(test_Name);
										infosFromML.add(temp_info);
										msmtFromML.add(tempMsmtHost);
									}
									else
									{
										testsFromML.add(test_Name);
										infosFromML.add(tempI);
										msmtFromML.add(tempMsmtHost);
									}
								}
							}
						}
					}
				}
			}

			if(testInfoMap_Temp!=null && testInfoMap_Temp.size()>0)
			{
				testInfoMap=new Hashtable();
				testInfoMap.putAll(testInfoMap_Temp);
			}

			resHash.put("testInfoMap",(Hashtable)testInfoMap);
			resHash.put("testsFromML",(ArrayList)testsFromML);
			resHash.put("infosFromML",(ArrayList)infosFromML);
			resHash.put("msmtFromML",(ArrayList)msmtFromML);
			resHash.put("testWithMsmtHostHash",(Hashtable)testWithMsmtHostHash);
		}
		else
		{
			resHash.put("testInfoMap",(Hashtable)testInfoMap);
			resHash.put("testsFromML",(ArrayList)testsFromML);
			resHash.put("infosFromML",(ArrayList)infosFromML);
			resHash.put("msmtFromML",(ArrayList)msmtFromML);
			resHash.put("testWithMsmtHostHash",(Hashtable)testWithMsmtHostHash);
		}
		return resHash;
	}

	private String getMaintainenancePolicyConfigURL(String testName,String testDispName,String hostName,String hostType, boolean isApplicationLayer,EgMappingInfo mappingInfo)
	{
		String mainPolicyConfigURL="";
		try
		{
				testDispName=StringUtils.replace(testDispName," ","!spc!");
				String maintenanceType="";
				String compNameForMaintenance=hostName;
				if(isApplicationLayer)
				{
					maintenanceType="Test For Component";
				}
				else
				{
					maintenanceType="Test For Host";
					compNameForMaintenance=compNameForMaintenance.substring(0,compNameForMaintenance.indexOf(":"));
				}

				String instantMaintenanceConfigURL="from=saveQuickMaintenancePolicy&type=showPolicies&operation=create&combination="+EgURLEncoder.encode(maintenanceType,"UTF-8")+"&test="+EgURLEncoder.encode(testName,"UTF-8")+"&infratypename="+testName+"&serverType="+EgURLEncoder.encode(hostType,"UTF-8")+"&fassociate="+EgURLEncoder.encode(compNameForMaintenance,"UTF-8")+"&testcomp="+EgURLEncoder.encode(hostType,"UTF-8");

				String compDispName=compNameForMaintenance;
				if(compDispName!=null && compDispName.endsWith(":NULL"))
				{
					compDispName=compDispName.substring(0,compDispName.indexOf(":NULL"));
				}
				String tempTestName=mappingInfo.getTestDescription(testDispName);
				tempTestName=StringUtils.replace(tempTestName," ","!spc!");
				testDispName=compDispName+"!sep!"+tempTestName;

				mainPolicyConfigURL="<a href=\"javascript:void(0);\" onclick=javascript:showMaintenanceOpts(\"Test\",'"+testDispName+"',\""+instantMaintenanceConfigURL+"\") class=\"comparison-image-container\" data-qtip=\""+mappingInfo.getTextDescription("monitor.layermodel.Maintenance Policy")+"\" data-qclass=\"yellowTip\"><img  style=\"margin: 0px 10px 0 0;display:inline-block;position:relative;\"  class=\"iconMaintenancePolicy\" src=\"/final/images/clear.png\"/></a>";
		}
		catch(Throwable t)
		{
			t.printStackTrace();
		}
		finally
		{
			return mainPolicyConfigURL;
		}
	}

	private Hashtable getValidSearchHash(List finalTestsForLayer,Hashtable finalInterfacesDescForLayer,String searchByDescriptor,String searchString,EgMappingInfo mappingInfo)
	{
		Hashtable out_hash=new Hashtable();
		Vector searchVec2=new Vector();
		List validTestList=new LinkedList();
		List validDescList=new LinkedList();
		boolean searchItemFound2 = false;
		for(int i=0;i<finalTestsForLayer.size();i=i+3)
		{
			String thiselement = (String)finalTestsForLayer.get(i);

			String compTest = thiselement.substring(0,thiselement.indexOf("-"));
			if(searchByDescriptor!=null && searchByDescriptor.equalsIgnoreCase("false"))
			{
				String tempTest = mappingInfo.getTestDescription(compTest);
				tempTest = tempTest.toLowerCase();
				if (tempTest.indexOf(searchString)==-1)
				{
					continue;
				}
				else
				{
					searchVec2.add(thiselement);
					searchItemFound2=true;
				}
			}
			else if(searchByDescriptor!=null && (searchByDescriptor.equalsIgnoreCase("true") || searchByDescriptor.equalsIgnoreCase("yes")))
			{
				String tmp_thiselement = thiselement.toLowerCase();
				if (tmp_thiselement.indexOf(searchString)==-1)
				{
					if(finalInterfacesDescForLayer!=null && finalInterfacesDescForLayer.containsKey(thiselement))
					{
						Hashtable temp_hash = (Hashtable)finalInterfacesDescForLayer.get(thiselement);
						if(temp_hash!=null && temp_hash.size()>0)
						{
							Enumeration ee2 = temp_hash.keys();
							while (ee2.hasMoreElements())
							{
								String keyelement = (String) ee2.nextElement();
								if (keyelement.toLowerCase().indexOf(searchString)==-1)
								{
									continue;
								}
								else
								{
									String keyTest = keyelement.substring(0,keyelement.indexOf("-"));
									if(validTestList!=null && !validTestList.contains(keyTest))
										validTestList.add(keyTest);

									if(validDescList!=null && !validDescList.contains(keyelement))
										validDescList.add(keyelement);
									
									searchVec2.add(keyelement);
									searchItemFound2=true;
									//break;
								}
							}
						}
					}
					else
						continue;
				}
				else
				{
					searchVec2.add(tmp_thiselement);
					searchItemFound2=true;
				}
			}
		}

		out_hash.put("OutputVec",(Vector)searchVec2);
		out_hash.put("OutputBoolean",new Boolean(searchItemFound2));
		out_hash.put("ValidSearchList",(List)validTestList);
		out_hash.put("ValidSearchInfosList",(List)validDescList);

		return out_hash;
	}

	private List getMaintenanceComputing(EgMaintenanceInfo egM,List maintenaceTimePeriod,boolean isDescriptorMaintenanceForTest,boolean isDescriptorMaintenanceForComponentTest,String testNameForMaintenance,String selInfo,String serverName,String portNo,String sid)
	{
		List maintenancePeriodVecTmp=new LinkedList();
		if(isDescriptorMaintenanceForTest)
		{
			maintenancePeriodVecTmp = egM.getMaintenancePeriods(testNameForMaintenance, selInfo);
			if(maintenancePeriodVecTmp != null && maintenaceTimePeriod != null){
				maintenaceTimePeriod.addAll(maintenancePeriodVecTmp);
			}
			maintenancePeriodVecTmp = egM.getUnplannedMaintenancePeriods(testNameForMaintenance, selInfo);
			if(maintenancePeriodVecTmp != null && maintenaceTimePeriod != null)
				maintenaceTimePeriod.addAll(maintenancePeriodVecTmp);
		}
		if(isDescriptorMaintenanceForComponentTest)
		{
			maintenancePeriodVecTmp = egM.getMaintenancePeriods(testNameForMaintenance, serverName, portNo, sid, selInfo);
			if(maintenancePeriodVecTmp != null && maintenaceTimePeriod != null){
				maintenaceTimePeriod.addAll(maintenancePeriodVecTmp);
			}
			maintenancePeriodVecTmp = egM.getUnplannedMaintenancePeriods(testNameForMaintenance, serverName, portNo, sid, selInfo);
			if(maintenancePeriodVecTmp != null && maintenaceTimePeriod != null)
				maintenaceTimePeriod.addAll(maintenancePeriodVecTmp);
		}

		return maintenaceTimePeriod;
	}

	public String getIniValue(String testStr,TransactionBean trans)
	{
		String multipleStr="";
		if(testStr != null && (testStr.endsWith("_ag") || testStr.endsWith("_agx")))
		{
			multipleStr = trans.getStrValue("CUT_OFF_FACTOR", testStr);
			if(StringUtils.isNull(multipleStr))
				multipleStr = trans.getStrValue("CUT_OFF_FACTOR", "Default_AggregateTest");
		}
		else if(testStr != null && testStr.endsWith("_rx"))
		{
			multipleStr = trans.getStrValue("CUT_OFF_FACTOR", testStr);
			if(StringUtils.isNull(multipleStr))
				multipleStr = trans.getStrValue("CUT_OFF_FACTOR", "Default_CompositeTest");
		}
		else
		{
			if(testStr!=null)
				multipleStr = trans.getStrValue("CUT_OFF_FACTOR", testStr);
		
			if(multipleStr==null || multipleStr.trim().length()==0)
				multipleStr = trans.getStrValue("CUT_OFF_FACTOR", "Default");
		}

		return multipleStr;
	}

	public HashMap parseQString(String testQueryStr){
		HashMap testQueryHash = new HashMap();
		StringTokenizer testQueryTokens1 = new StringTokenizer(testQueryStr,"&");
		while (testQueryTokens1.hasMoreTokens()) 
		{
			String testQueryValueTemp = (String)testQueryTokens1.nextToken();
			StringTokenizer testQueryTokens2 = new StringTokenizer(testQueryValueTemp,"=");

			int testQueryTokens2Count = testQueryTokens2.countTokens();
			String key = "";
			String value = "";
			if(testQueryTokens2Count==2)
			{
				key = (String)testQueryTokens2.nextToken();
				value = (String)testQueryTokens2.nextToken();
				
				testQueryHash.put(key,value);
				/*if (key.equals("qctr"))
				{
					 searchQry.append(key).append("=1&");
				}
				else
				{
					searchQry.append(key).append("=").append(value).append("&");
				}*/
			}
			else
			{
				key = (String)testQueryTokens2.nextToken();
				testQueryHash.put(key,"");
				
				/*if(key.equals("qctr"))
				{
					searchQry.append(key).append("=1&");
				}
				else
				{
					searchQry.append(key).append("=").append(value).append("&");
				}*/
			}
		}
		return testQueryHash;
	}
%>