
<%
/*******************************************************************************
*	File name		: EgDiagnosis.jsp
*	Purpose			: To display detailed measures
*	Version			: eG 3.0
*	Creation Date		: 29/08/2002
*	Last Modified		: 	20/12/2011  Sri Devi G User - VM Changes
				  05/07/2004 - S.Solomon - Minutes is added in timeline selection
*				  04-09-2003	John Williams	eG 3.0 Modifications
*				  06-10-2003	John Williams	Fixing DD bug
*				  21/06/2004	Arun			Uses older DD separators if new
*				   				DD separators are not found
*	Authtor			: Sandhya Kollath
******************************************************************************/
%>

<%@ taglib prefix="egui" uri="../WEB-INF/eg-taglib.tld" %>
<%@ page errorPage="EgProbsM.jsp"%>
<%@ page import = "com.egurkha.EgConstants" %>
<%@ page import = "com.egurkha.ini.*" %>
<%@ page import = "com.egurkha.monitor.alarms.*" %>
<%@ page import = "com.egurkha.util.StringUtils" %>
<%@ page import = "java.sql.*" %>
<%@ page import = "java.util.*" %>
<%@ page import = "com.eg.EgURLEncoder"%>
<%@ page import = "com.eg.EgSpecsInfo" %>
<%@ page import = "com.eg.EgAgentInfo" %>
<%@ page import = "com.eg.EgTesterInfo" %>
<%@ page import = "com.eg.EgTestInfo" %>
<%@ page import = "com.eg.EgDbInfo" %>
<%@ page import = "com.eg.EgDateInfo" %>
<%@ page import = "com.eg.EgLastMeasureThread" %>
<%@ page import = "com.egurkha.ini.IniUI" %>
<%@ page import = "com.eg.EgMappingInfo"%>
<%@ page import ="com.eg.EgDiscInfo"%>
<%@ page import ="com.egurkha.monitor.*"%>
<%@ page import ="java.util.*"%>
<%@ page import = "com.egurkha.util.DateUtil"%>
<%@ page import = "java.text.SimpleDateFormat"%>
<%@ page import = "com.eg.EgInstallInfo"%>
<%@ page import = "com.eg.IniFile"%>
<%@ page import = "com.eg.EgAPMInfo"%>
<%@ page import = "com.eg.MappingNameSorter"%>
<%@ page session = "true" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ page import = "egurkha.reporter.ErUtils" %>
<%@ page import = "egurkha.reporter.ErInfo" %>
<%@ page import = "com.egurkha.util.DateTimeTokenizer" %>
<%@ page import = "com.eg.EgFormatInfo"%>
<%@ 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 = "com.eg.*" %>
<%@ page import = "com.eg.EgMailManager" %>
<%@ page import = "com.egurkha.monitor.EgMonRemoteScriptingBean" %>
<%@ page import = "com.eg.supermanager.*"%>
<%@ page import="com.eg.EgTablesInfo"%>
<%@ page import="egurkha.EgDbAdapterUI"%>
<%@ page import="com.eg.EgDbAdapterTypeUI"%>
<%@ page import="com.egurkha.util.EgSorter"%>
<%@ page import = "com.eg.EgCrypt" %>
<%@ page import = "com.egurkha.monitor.MonitorUtility"%>
<%
	response.setContentType("application/json");
	response.setHeader("Cache-Control","no-store");
	response.setHeader("Pragma","no-cache");
	response.setDateHeader("Expires", -1);
%>
<%
	String ua = request.getHeader( "User-Agent" );
	boolean isFirefox = ( ua != null && ua.indexOf( "Firefox/" ) != -1 );
	boolean isFirefox3 = ( ua != null && ua.indexOf( "Firefox/3" ) != -1 );
	boolean isMSIE6 = ( ua != null && ua.indexOf( "MSIE 6.0" ) != -1 );
	boolean isMSIE7 = ( ua != null && ua.indexOf( "MSIE 7.0" ) != -1 )||( ua != null && ua.indexOf( "MSIE 8.0" ) != -1 );

%>

<jsp:useBean id="trans" scope="page" class="egurkha.TransactionBean" />
<jsp:useBean id="dd" scope="page" class="com.egurkha.monitor.EgDiagnosisBean" />

<%!
	String selectedMgrId=null;
	static int recTotalCount=0;
	static int recTotalRecordCount=0;
	String totalPagesDisp="Calculating total pages...";

	JSONObject json = new JSONObject();
	JSONObject json_mobile = new JSONObject();
	JSONObject hiddenFields = new JSONObject();
	EgAPMInfo apm = new EgAPMInfo("manager");
	EgTopoInfo topoinfo = new EgTopoInfo("manager");
	
	MonitorUtility monUtil = new MonitorUtility();
	Hashtable stateMeasure = new Hashtable();
	ArrayList a_temp = null;

	String monitor_Skin = "";
	String js_string ="parent.";
	String s_site = "";
	String s_compTy = "";
	String dateFormat = "";
	String strValue = "";
	String selectFilter = "";

	boolean isJavaTransactionsTest = false;
	boolean isSapAlertsTest = false;
	boolean isAPMTest = false;
	boolean proceed = false;
	boolean isDDDTest = true;
	boolean isJvmTest = false;
	boolean isStackLink = false;
	ArrayList skipColForApmTests= new ArrayList();
%>

<%!
	public Hashtable getSecondaryLogonDetails(String val){
		Hashtable details = new Hashtable();
		try
		{
			ArrayList al_cols = com.egurkha.util.StringUtils.egTokenizer(val, "#~#",true,false,true);//3-->includeEmpty,4-->unique,5-->trim
			if(al_cols != null && al_cols.size() > 0 )
			{
				for(int l=0;l<al_cols.size();l++)
				{
					String el = (String)al_cols.get(l);

					if(el == null || el.trim().length() == 0 || el.indexOf(":") == -1)
						continue;
					String key = el.substring(0,el.indexOf(":"));
					String value = el.substring(el.indexOf(":")+1);
					
					details.put(key.trim().toLowerCase(),value.trim());
				}
			}
		}
		catch(Exception ee)
		{
		}

		return details;
	} 

	public String getCtxUserNameWithDomain(Hashtable details)
	{
		String domainUser = null;
		try
		{
			if(details != null && details.containsKey("username"))
			{
				domainUser = (String)details.get("username");
			}
			else if(details != null && details.containsKey("email id"))
			{
				domainUser = (String)details.get("email id");
			}
		}
		catch(Exception ee)
		{
		}

		return domainUser;
	}

	public String getCtxScreenShotName(Hashtable details)
	{
		String screenShotName = null;
		try
		{
			if(details != null && details.containsKey("screenshot name"))
			{
				screenShotName = (String)details.get("screenshot name");
			}
		}
		catch(Exception ee)
		{
		}

		return screenShotName;
	}

	public String getCtxUserNameWithDomain(String val)
	{
		String domainUser = null;
		//Site URL:http://192.168.8.37/Citrix/XenApp/auth/login.aspx#~#Username: citrix\administrator#~#Login Time:06/08/2017 01:54:21#~#
		try
		{
			ArrayList al_cols = com.egurkha.util.StringUtils.egTokenizer(val, "#~#",true,false,true);//3-->includeEmpty,4-->unique,5-->trim
			if(al_cols != null && al_cols.size() > 0 )
			{
				for(int l=0;l<al_cols.size();l++)
				{
					String el = (String)al_cols.get(l);

					if(el == null || el.trim().length() == 0 || el.indexOf(":") == -1)
						continue;
					String key = el.substring(0,el.indexOf(":"));
					String value = el.substring(el.indexOf(":")+1);

					if(key.trim().equalsIgnoreCase("username"))
					{
						domainUser = value.trim();
						return domainUser;
					}
				}
			}
		}
		catch(Exception ee)
		{
		}

		return domainUser;
	}

	public String findAndReplaceString(String s,String s_search,String s_replace)
	{
		StringBuffer sb_tmp = new StringBuffer();
		while(s.indexOf(s_search) > -1)
		{
			sb_tmp.append(s.substring(0,s.indexOf(s_search)) + s_replace);
			s = s.substring(s.indexOf(s_search) + s_search.length(),s.length());
		}
		if(s.length() > 0)
		{
			sb_tmp.append(s);
		}
		return sb_tmp.toString();
	}

	public Hashtable getDDData(ArrayList a_results,ArrayList al_header,String s_test,int pageNo,int pageSize,int mylocalvar,boolean commonDateLayout,boolean rumStatus,StringBuffer sbData,boolean isStackLink,boolean isSapMonPerfTest,String colSeparator,String s_host,String s_port,String s_msmt_host,String s_info,String s_mes,String s_st_time,String s_en_time,String s_st_hr,String s_en_hr,String s_st_min,String s_end_min,EgMappingInfo mappingInfo,ArrayList encodeTestList,ArrayList al_cols,HttpSession session,HttpServletResponse response,User user,EgDiagnosisBean dd,String colNamesForQuery,Vector vec_Tabletitle,ArrayList index_arr,boolean isFromAlarmDetails,boolean isScreenShotEnabled ,ArrayList pdfHeaders )
	{
		Hashtable diagnosisData = new Hashtable();
		boolean isSSTest = false;
		try
		{
			int gr_l = 0; 
			int analysisDD = 0;
			String s_strTok = "";
			String separateCols = null;
			IniFile formatIniFile1 = new IniFile(EgInstallInfo.getInstallDir()+ "/manager/config/eg_format.ini");
			IniFile geoIni = new IniFile(EgInstallInfo.getInstallDir()+ "/manager/config/eg_geodetails.ini");
			IniFile externalIniFile1 = new IniFile(EgInstallInfo.getInstallDir()+ "/manager/config/eg_external.ini");
			ArrayList rumTime = new ArrayList();
			ArrayList al = new ArrayList();
			boolean isLink = false;
			String jspFileName ="";
			String linkString ="";
			String ss_dd_handled = formatIniFile1.getValue("SS_DD_Handled","Tests");
			ArrayList ss_dd_tests = null;
			if(ss_dd_handled != null && ss_dd_handled.trim().length() > 0 )
				ss_dd_tests =  com.egurkha.util.StringUtils.egTokenizer(ss_dd_handled.trim(),",",true,true,true);//param 3-->includeEmpty,4-->unique,5-->trim
			
			if(s_test != null && ss_dd_tests != null && ss_dd_tests.contains(s_test))
				isSSTest = true;

			String linkValue = formatIniFile1.getValue("LINKS_FROM_DD_TESTS",s_test);
			if(linkValue!=null && linkValue.length() > 0 && linkValue.indexOf(":") > 0)
			{
				isLink = true;
				jspFileName = linkValue.substring(0,linkValue.indexOf(":"));
				linkString = linkValue.substring(linkValue.indexOf(":")+1);
			}

			boolean isAllCompAccess=false;
			if(user!=null)
			{
				EgUserRole userRole = user.getUserRole();
				isAllCompAccess = userRole.hasAllComponentAccess();
			}

			String latlong_map = geoIni.getValue("LAT_LNG_SUPPORT_TEST_MAPPING",s_test+":"+s_mes);
			ArrayList keyEntryList = new ArrayList();
			ArrayList valueEntryList = new ArrayList();
			if(isAllCompAccess && latlong_map!=null && latlong_map.trim().length()>0)
			{
				ArrayList latlongList =  com.egurkha.util.StringUtils.egTokenizer(latlong_map.trim(),"~$~",true,true,true);//param 3-->includeEmpty,4-->unique,5-->trim

				if(latlongList!=null && latlongList.size()==2)
				{
					String key_entry=(String)latlongList.get(0);
					String value_entry=(String)latlongList.get(1);

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

					if(value_entry!=null && value_entry.trim().length()>0)
					{
						valueEntryList =  com.egurkha.util.StringUtils.egTokenizer(value_entry.trim(),"~#~",false,true,true);//param 3-->includeEmpty,4-->unique,5-->trim
					}
				}
			}
			ArrayList keyEntryIndexList = new ArrayList();
			ArrayList valueEntryIndexList = new ArrayList();
			if(al_header!=null && al_header.size()>0 && keyEntryList!=null && keyEntryList.size()>0 && valueEntryList!=null && valueEntryList.size()>0)
			{
				for(int w=0;w<keyEntryList.size();w++)
				{
					String key_en=(String)keyEntryList.get(w);
					if(key_en!=null && key_en.trim().length()>0 && al_header.contains(key_en))
					{
						int temp_key=al_header.indexOf(key_en);
						if(temp_key!=-1)
						{
							keyEntryIndexList.add(new Integer(temp_key));
						}
					}
				}

				for(int w=0;w<valueEntryList.size();w++)
				{
					String key_en=(String)valueEntryList.get(w);
					if(key_en!=null && key_en.trim().length()>0 && al_header.contains(key_en))
					{
						int temp_key=al_header.indexOf(key_en);
						if(temp_key!=-1)
						{
							valueEntryIndexList.add(new Integer(temp_key));
						}
					}
				}
			}
			
			String footerTxt = (String)session.getAttribute("footerTxt");
			
			boolean isFooterText = false;
			
			if(footerTxt != null && footerTxt.trim().length()>0 && !footerTxt.equalsIgnoreCase("NULL"))
			{
				session.setAttribute("CSVfooterTxt",footerTxt);
				isFooterText = true;
			}

			Hashtable ctxLogonTimeHash = null;
			Hashtable screenshotHash = null;
			JSONArray dataArray_mobile = new JSONArray();
			JSONArray dataArray1 = new JSONArray();
			JSONArray ctxDataArr1 = new JSONArray();
			JSONArray filterBy1 = new JSONArray();

			String sim_test = formatIniFile1.getValue("SIMULATION","Tests");
			ArrayList simTestList = new ArrayList();
			if(sim_test != null && sim_test.trim().length() > 0)
				simTestList =  com.egurkha.util.StringUtils.egTokenizer(sim_test.trim(),",",true,false,true);//param 3-->includeEmpty,4-->unique,5-->trim

			String screenshotEnabledTest = formatIniFile1.getValue("SS_DD_Handled","Tests");
			ArrayList screenshotEnabledTestList = new ArrayList();
			if(screenshotEnabledTest != null && screenshotEnabledTest.trim().length() > 0)
				screenshotEnabledTestList =  com.egurkha.util.StringUtils.egTokenizer(screenshotEnabledTest.trim(),",",true,false,true);//param 3-->includeEmpty,4-->unique,5-->trim
			boolean isScreenshotEnabledTest = false;
			boolean isLogonEnabledTest = false;
			if(s_test != null && (screenshotEnabledTest != null && screenshotEnabledTest.contains(s_test)))
			{
				screenshotHash = (Hashtable)session.getAttribute("screenshotHash");
				ctxLogonTimeHash = (Hashtable)session.getAttribute("ctxdbMsmtTime");
				isScreenshotEnabledTest = true;
			}
			else if(s_test != null && (simTestList != null && simTestList.contains(s_test)))
			{
				ctxLogonTimeHash = (Hashtable)session.getAttribute("ctxdbMsmtTime");
				isLogonEnabledTest = true;				
			}

			String enum_disable = formatIniFile1.getValue("SIMULATION","EnumerationDisabled");
			ArrayList enum_disable_list = new ArrayList();
			if(enum_disable != null && enum_disable.trim().length() > 0)
				enum_disable_list =  com.egurkha.util.StringUtils.egTokenizer(enum_disable.trim(),",",true,false,true);//param 3-->includeEmpty,4-->unique,5-->trim

			boolean isEnumDisabled = false;
			if( s_test!=null && (enum_disable_list!= null && enum_disable_list.contains(s_test) ) )
				isEnumDisabled = true;

			JSONArray latlongKeyArray = new JSONArray();
			JSONArray latlangKeyValueArray = new JSONArray();
			JSONObject latlangKeyValueObj = new JSONObject();
			for(int a=0;a<a_results.size();a=a+2)
			{
				if((selectFilter==null || selectFilter.equalsIgnoreCase("All")))
				{
					if(a>=(pageNo*(pageSize*2)) && !isDDDTest)
					{
						// break;
					}
				}
				mylocalvar++;
				JSONObject datesCombo = new JSONObject();
				String sdate = (String)a_results.get(a);
				String mydate = "";
				if(rumStatus)
					mydate = sdate;

				if(sdate != null && !sdate.trim().equals(""))
				{
					EgTimeZoneConverter timeZoneConverter = new EgTimeZoneConverter(sdate, user);
					if(!rumStatus)
					mydate = sdate;
				}
				if(a==0)
				{
					datesCombo.put("name","All");
					datesCombo.put("value","All");
					filterBy1.add(datesCombo);
				}
				if(!rumStatus){
					datesCombo.put("name",mydate);
					datesCombo.put("value",sdate);
					filterBy1.add(datesCombo);
				}else{
					if(!rumTime.contains(sdate)){
						datesCombo.put("name",mydate);
						datesCombo.put("value",sdate);
						filterBy1.add(datesCombo);
						rumTime.add(sdate);
					}
				}
				
				if(selectFilter!=null)
				{
					selectFilter = selectFilter.trim();
					sdate = sdate.trim();
					if(selectFilter.equalsIgnoreCase("All"))
					{
						
					}
					else
					{
						if(selectFilter.equals(sdate))
						{
							analysisDD = 1;
						}
						else
						{
							continue;
						}
					}
				}

				JSONObject recObj  = new JSONObject();
				JSONObject recObj_mobile  = new JSONObject();
				if(commonDateLayout)
				{
					sbData.append("<tr class=\"x-grid-row\">");
					if(isJvmTest)
					{
						if(isStackLink && !s_test.equalsIgnoreCase("JvmMemoryDetailsTest"))
						{
							String Url = response.encodeURL("/final/monitor/ThreadDetails.jsp?");
							if(Url!=null && Url.trim().length()>0 && Url.indexOf("com.eg.CSRF_NONCE")>-1)
							{
								Url = Url +"&site=" + EgURLEncoder.encode("NULL","UTF-8");
							}else{
								Url = Url +"site=" + EgURLEncoder.encode("NULL","UTF-8");
							}

							Url = Url + "&host=" +com.eg.EgURLEncoder.encode(s_host,"UTF-8") +"&port=" + s_port + "&test="+s_test+"&msmt_host="+com.eg.EgURLEncoder.encode(s_msmt_host,"UTF-8")+ "&flag=1&firsttime=true&sdate="+com.eg.EgURLEncoder.encode(sdate,"UTF-8")+"&s_measure="+com.eg.EgURLEncoder.encode(s_mes,"UTF-8")+"&s_st_time="+com.eg.EgURLEncoder.encode(s_st_time,"UTF-8")+"&s_en_time="+com.eg.EgURLEncoder.encode(s_en_time,"UTF-8")+"&s_st_hr="+com.eg.EgURLEncoder.encode(s_st_hr,"UTF-8")+"&s_en_hr="+com.eg.EgURLEncoder.encode(s_en_hr,"UTF-8")+"&s_st_min="+com.eg.EgURLEncoder.encode(s_st_min,"UTF-8")+"&s_end_min="+com.eg.EgURLEncoder.encode(s_end_min,"UTF-8");
							
							sbData.append("<td class=\"x-grid-cell darkthemefont_color\" align=\"left\" colspan=\""+(al_header.size()+1)+"\" style=\"padding:3px;text-wrap:suppress;font-weight:bold;padding:5px;\"> &nbsp;<span style=\"font-weight:bold\">"+mydate+" &nbsp;&nbsp;</span><a href=\"javascript:void(0)\" onclick=\"threadWindow('"+sdate+"')\" id=\"mouse\" style=\"font-weight:bold;\" nowrap><div style=\"float:left;\"></div><div style=\"float:left;margin-right:4px;margin-bottom:3px;\" class='iconStackTrace' data-qtip='"+mappingInfo.getTextDescription("monitor.layermodel.Stack Trace")+"' qtip-class='yellowTip'></div></a></td>");
							
							String dateWithStatckTrace = "<div><a href='javascript:threadWindow(&quot;"+sdate+"&quot;)' id='mouse' style='font-weight:bold;' nowrap><div style='float:left;'></div><div style='float:left;margin-right:4px;margin-bottom:3px;' class='iconStackTrace' data-qtip='"+mappingInfo.getTextDescription("monitor.layermodel.Stack Trace")+"' qtip-class='yellowTip'></div></a><span style='display: inline-block;margin-top: 2px;'>"+sdate+"</span></div>";

							recObj.put("time",dateWithStatckTrace);
							recObj.put("groupfn",js_string);
							recObj.put("url",Url);
							recObj.put("headerText","Thread Diagnosis - "+s_host);
							recObj.put("skin",monitor_Skin);
							recObj.put("groupText",mappingInfo.getTextDescription("monitor.layermodel.Stack Trace"));
							recObj.put("imgSrc","iconStackTrace");
							recObj_mobile.put("time",sdate);
							recObj_mobile.put("groupfn",js_string);
							recObj_mobile.put("url",Url);
							recObj_mobile.put("headerText","Thread Diagnosis - "+s_host);
							recObj_mobile.put("skin",monitor_Skin);
							recObj_mobile.put("groupText",mappingInfo.getTextDescription("monitor.layermodel.Stack Trace"));
							recObj_mobile.put("imgSrc","/final/monitor/eg_images/stack_trace.gif");
						}
						else if(s_test.equalsIgnoreCase("JvmMemoryDetailsTest"))
						{
							//String Url = response.encodeURL("/final/monitor/ThreadDetails.jsp?")+"&site=" + EgURLEncoder.encode("NULL","UTF-8") + "&host=" +com.eg.EgURLEncoder.encode(s_host,"UTF-8") +"&port=" + s_port + "&test="+s_test+"&msmt_host="+com.eg.EgURLEncoder.encode(s_msmt_host,"UTF-8")+"&s_info="+com.eg.EgURLEncoder.encode(s_info,"UTF-8")+ "&flag=1&firsttime=true&sdate="+com.eg.EgURLEncoder.encode(sdate,"UTF-8")+"&s_measure="+com.eg.EgURLEncoder.encode(s_mes,"UTF-8")+"&s_st_time="+com.eg.EgURLEncoder.encode(s_st_time,"UTF-8")+"&s_en_time="+com.eg.EgURLEncoder.encode(s_en_time,"UTF-8")+"&s_st_hr="+com.eg.EgURLEncoder.encode(s_st_hr,"UTF-8")+"&s_en_hr="+com.eg.EgURLEncoder.encode(s_en_hr,"UTF-8")+"&s_st_min="+com.eg.EgURLEncoder.encode(s_st_min,"UTF-8")+"&s_end_min="+com.eg.EgURLEncoder.encode(s_end_min,"UTF-8");
							
							String Url = response.encodeURL("/final/monitor/ThreadDetails.jsp?");
							if(Url!=null && Url.trim().length()>0 && Url.indexOf("com.eg.CSRF_NONCE")>-1)
							{
								Url = Url +"&site=" + EgURLEncoder.encode("NULL","UTF-8");
							}else{
								Url = Url +"site=" + EgURLEncoder.encode("NULL","UTF-8");
							}

							Url = Url + "&host=" +com.eg.EgURLEncoder.encode(s_host,"UTF-8") +"&port=" + s_port + "&test="+s_test+"&msmt_host="+com.eg.EgURLEncoder.encode(s_msmt_host,"UTF-8")+"&s_info="+com.eg.EgURLEncoder.encode(s_info,"UTF-8")+ "&flag=1&firsttime=true&sdate="+com.eg.EgURLEncoder.encode(sdate,"UTF-8")+"&s_measure="+com.eg.EgURLEncoder.encode(s_mes,"UTF-8");


							sbData.append("<td class=\"x-grid-cell darkthemefont_color\" align=\"left\" colspan=\""+(al_header.size()+1)+"\" > &nbsp;<span style=\"font-weight:normal\">"+mydate+"</span>&nbsp;&nbsp; <a href=\"javascript:void(0)\" onclick=\"heapWindow('"+sdate+"','"+Url+"')\" class=\"eg_monlink\" id=\"mouse\" style=\"font-weight:bold;text-transform:none;\"> "+mappingInfo.getTextDescription("monitor.layermodel.Heap Details")+" &nbsp;<img style='position: relative;top: 3px;' src=\"/final/monitor/eg_images/stack_trace.gif\" border=\"0\"></a></td>");

							String dateWithHeap = sdate+"&nbsp;&nbsp;&nbsp;&nbsp; "+mappingInfo.getTextDescription("monitor.layermodel.Heap Details")+"&nbsp;<img style='position: relative;top: 3px;' src='/final/monitor/eg_images/stack_trace.gif' onclick='javascript:heapWindow(&quot;"+sdate+"&quot;,&quot;"+Url+"&quot;)'>";

							recObj.put("time",dateWithHeap);
							recObj.put("groupfn",js_string);
							recObj.put("url",Url);
							recObj.put("headerText","Heap Analysis - "+s_host);
							recObj.put("skin",monitor_Skin);
							recObj.put("groupText",mappingInfo.getTextDescription("monitor.layermodel.Heap Details"));
							recObj.put("imgSrc","iconStackTrace");
							recObj_mobile.put("time",dateWithHeap);
							recObj_mobile.put("groupfn",js_string);
							recObj_mobile.put("url",Url);
							recObj_mobile.put("headerText","Heap Analysis - "+s_host);
							recObj_mobile.put("skin",monitor_Skin);
							recObj_mobile.put("groupText",mappingInfo.getTextDescription("monitor.layermodel.Heap Details"));
							recObj_mobile.put("imgSrc","/final/monitor/eg_images/stack_trace.gif");
						}
						else
						{
							sbData.append("<td class=\"x-grid-cell\" align=\"left\" class=\"eg_darktextbold\" colspan=\""+(al_header.size()+1)+"\" > <span style=\"font-weight:normal\" class=\"darkthemefont_color\">&nbsp;"+mydate+" </span></td>");
							recObj.put("time",sdate);
							recObj_mobile.put("time",sdate);
						}
					}
					else if(isLink)
					{
						String linkStringValue = "monitor.layermodel."+linkString;
						String tmp_s_info=com.egurkha.util.StringUtils.replace(s_info,"\\","\\\\");
						String Url = response.encodeURL("/final/monitor/"+jspFileName+"?");
						if(Url!=null && Url.trim().length()>0 && Url.indexOf("com.eg.CSRF_NONCE")>-1)
						{
							Url = Url +"&site=" + EgURLEncoder.encode("NULL","UTF-8");
						}else{
							Url = Url +"site=" + EgURLEncoder.encode("NULL","UTF-8");
						}
							
						Url = Url + "&host=" +com.eg.EgURLEncoder.encode(s_host,"UTF-8") +"&port=" + s_port + "&info="+com.eg.EgURLEncoder.encode(tmp_s_info,"UTF-8") + "&test="+ s_test +"&msmt_host=" + com.eg.EgURLEncoder.encode(s_msmt_host,"UTF-8") + "&flag=1&firsttime=true&sdate=" + com.eg.EgURLEncoder.encode(sdate,"UTF-8") +"&s_measure="+ com.eg.EgURLEncoder.encode(s_mes,"UTF-8") +"&s_st_time="+ com.eg.EgURLEncoder.encode(s_st_time,"UTF-8") + "&s_en_time="+ com.eg.EgURLEncoder.encode(s_en_time,"UTF-8") + "&s_st_hr="+ com.eg.EgURLEncoder.encode(s_st_hr,"UTF-8") + "&s_en_hr=" + com.eg.EgURLEncoder.encode(s_en_hr,"UTF-8") + "&s_st_min=" + com.eg.EgURLEncoder.encode(s_st_min,"UTF-8") + "&s_end_min=" + com.eg.EgURLEncoder.encode(s_end_min,"UTF-8");
						String dateWithHeap ="";
						if(s_test.equalsIgnoreCase("JavaTransactionsTest"))
						{
							sbData.append("<td class='x-grid-cell' align='left' class='eg_darktextbold' colspan='"+(al_header.size()+1)+"' onclick='JTMBase_Url_Tree(\""+Url+"\",\""+linkString+"\" - \""+s_host+"\",\""+monitor_Skin+"\")'> &nbsp;"+mydate+" &nbsp;&nbsp; <a href='javascript:void(0)' class='eg_monlink' id='mouse' style='font-weight:bold'>"+mappingInfo.getTextDescription(linkStringValue)+" &nbsp;<img style='position: relative;top: 3px;' src='/final/monitor/eg_images/stack_trace.gif' border='0'></a></td>");

							dateWithHeap = sdate+"&nbsp;&nbsp;&nbsp;&nbsp; "+mappingInfo.getTextDescription(linkStringValue)+"&nbsp;<img style='position: relative;top: 3px;' src='/final/monitor/eg_images/stack_trace.gif' onclick='javascript:JTMBase_Url_Tree(&quot;"+Url+"&quot;,&quot;"+linkString+" - "+s_host+"&quot;,&quot;"+monitor_Skin+"&quot;)'>";
						}
						else
						{
							sbData.append("<td class='x-grid-cell' align='left' class='eg_darktextbold' colspan='"+(al_header.size()+1)+"' onclick='show_hide_centered_href(\""+Url+"\")'> &nbsp;"+mydate+" &nbsp;&nbsp; <a href='javascript:void(0)' class='eg_monlink' id='mouse' style='font-weight:bold'>"+mappingInfo.getTextDescription(linkStringValue)+" &nbsp;<img style='position: relative;top: 3px;' src='/final/monitor/eg_images/stack_trace.gif' border='0'></a></td>");

							dateWithHeap = sdate+"&nbsp;&nbsp;&nbsp;&nbsp; "+mappingInfo.getTextDescription(linkStringValue)+"&nbsp;<img style='position: relative;top: 3px;' src='/final/monitor/eg_images/stack_trace.gif' onclick='javascript:show_hide_centered_href(&quot;"+Url+"&quot;)'>";
						}
						
						String _lh = linkString+" - "+s_host;
						String dateWithURLTree = sdate+"&nbsp;&nbsp;&nbsp;&nbsp; <a href='javascript:void(0)' class='eg_monlink' id='mouse' style='font-weight:bold' /> "+mappingInfo.getTextDescription("monitor.layermodel.Url Tree")+"&nbsp; <img src='/final/monitor/eg_images/stack_trace.gif' border='0' onclick='javascript:JTMBase_Url_Tree(&quot;"+Url+"&quot;,&quot;"+_lh+"&quot;,&quot;"+monitor_Skin+"&quot;)'  > </a>";


						//recObj.put("time",sdate);
						recObj.put("time",dateWithHeap);
						recObj.put("groupfn",js_string);
						recObj.put("url",Url);
						recObj.put("headerText",""+linkString+" - "+s_host);
						recObj.put("skin",monitor_Skin);
						recObj.put("groupText",mappingInfo.getTextDescription(linkStringValue));
						recObj.put("imgSrc","iconStackTrace");
						recObj_mobile.put("time",sdate);
						recObj_mobile.put("groupfn",js_string);
						recObj_mobile.put("url",Url);
						recObj_mobile.put("headerText",""+linkString+" - "+s_host);
						recObj_mobile.put("skin",monitor_Skin);
						recObj_mobile.put("groupText",mappingInfo.getTextDescription(linkStringValue));
						recObj_mobile.put("imgSrc","/final/monitor/eg_images/stack_trace.gif");
					}
					else if(isScreenShotEnabled && s_test.equalsIgnoreCase("GenericLogonSimTest"))
					{
						String ctx_date = sdate;
						boolean isNeedToShowIcon = false;
						try 
						{
							if(screenshotHash != null && screenshotHash.containsKey(sdate))
							{
								if(ctxLogonTimeHash != null && ctxLogonTimeHash.containsKey(sdate)){
									ctx_date = (String) ctxLogonTimeHash.get(sdate);
									ctx_date = ctx_date.trim();
									String db_date = ctx_date.substring(0,ctx_date.lastIndexOf(" "));
									String db_time = ctx_date.substring(ctx_date.lastIndexOf(" ")+1);
									db_date = DateUtil.changeDateFormat(db_date,"MM/dd/yyyy","yyyy-MM-dd");
									ctx_date = db_date+" "+db_time;
								}							
								isNeedToShowIcon = true;
							}
						}
						catch(Throwable e)
						{
							e.printStackTrace();
						}
						if(isNeedToShowIcon)
							recObj.put("time"," <span style='margin-left: 8px;margin-top:2px;margin-right:4px;float:left;'><img src='data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='  class='iconDDAnalysis handSymbol'  onclick='javascript:redirectCTX(this)' value='"+ctx_date+"' componentname='"+s_host+"' test='"+s_test+"' msmthost='"+s_msmt_host+"' info='"+s_info+"' measure='"+s_mes+"' data-qclass='yellowTip' style='margin:auto;text-align:center' data-qtip=''/></span><span style='position:relative;top:4px'>"+sdate+"</span>");
						else
							recObj.put("time",sdate);
						
						recObj_mobile.put("time",sdate);
					}
					else if(isLogonEnabledTest)
					{
						String ctx_date = sdate;
						
						try 
						{							
							if(ctxLogonTimeHash != null && ctxLogonTimeHash.containsKey(sdate)){
								ctx_date = (String) ctxLogonTimeHash.get(sdate);
								ctx_date = ctx_date.trim();
								String db_date = ctx_date.substring(0,ctx_date.lastIndexOf(" "));
								String db_time = ctx_date.substring(ctx_date.lastIndexOf(" ")+1);
								db_date = DateUtil.changeDateFormat(db_date,"MM/dd/yyyy","yyyy-MM-dd");
								ctx_date = db_date+" "+db_time;
							}							
						}
						catch(Throwable e)
						{
							e.printStackTrace();
						}
						
						recObj.put("time"," <span style='margin-left: 8px;margin-top:2px;margin-right:4px;float:left;'><img src='data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='  class='iconDDAnalysis handSymbol'  onclick='javascript:redirectCTX(this)' value='"+ctx_date+"' componentname='"+s_host+"' test='"+s_test+"' msmthost='"+s_msmt_host+"' info='"+s_info+"' measure='"+s_mes+"' data-qclass='yellowTip' style='margin:auto;text-align:center' data-qtip=''/></span><span style='position:relative;top:4px'>"+sdate+"</span>");						
						
						recObj_mobile.put("time",sdate);
					}
					else
					{
						if(rumStatus){
						sbData.append("<td align=\"left\"  class=\"darkthemefont_color dignosis_row\" colspan=\""+(al_header.size()+1)+"\" ><b class=\"darkthemefont_color\"hidden>"+mydate+"</b></td>");
							// bala added next 2 lines for rum
							recObj.put("time","");
							recObj_mobile.put("time","");
							json.put("isRUM","true");
						}else{
							sbData.append("<td align=\"left\"  class=\"darkthemefont_color  dignosis_row\" colspan=\""+(al_header.size()+1)+"\" ><b class=\"darkthemefont_color \">"+mydate+"</b></td>");
							recObj.put("time",sdate);
							recObj_mobile.put("time",sdate);
						}
					}
					sbData.append("</tr></thead>");
				}
				sbData.append("<tbody>");
				a_temp = null;
				a_temp = (ArrayList)a_results.get(a+1);
				StringBuffer sb = new StringBuffer();

				int rows = 0;
				int rows1 = 0;
				String s_strTemp = "";
				StringTokenizer str ;
				int no_of_records = a_temp.size();

				if(strValue==null || strValue.equals("")||strValue.equals("null"))
				{
					if(isSapMonPerfTest)
					{
						sb.append("var palmtree=new jktreeview('treeDD"+a+"');\n");
					}
					boolean headerFlage=true;
					int k=0;
					StringBuffer temp_table = new StringBuffer();
					for(int p=0; p<no_of_records; p++)
					{
						s_strTok = (String)a_temp.get(p);

						if(encodeTestList != null && s_test != null && s_strTok != null && encodeTestList.contains(s_test)){
							s_strTok = EgCrypt.olddecrypt(s_strTok);
							if(s_test.equalsIgnoreCase("MailAlertTest") && s_strTok.indexOf("*~*") != -1)
								s_strTok = StringUtils.replace(s_strTok,"*~*","<table style='width:100%' border='1'><tr><td></td></tr></table></br>");
						}
						if(s_strTok!=null && s_strTok.trim().length()>0)
						{
							s_strTok=(s_strTok.endsWith("~!~"))?s_strTok.substring(0,s_strTok.lastIndexOf("~!~")):s_strTok;
						}
						if(s_strTok!=null && s_strTok.trim().length()==0)
						{
							continue;
						}
						separateCols = colSeparator;
						
						if(s_strTok.indexOf(separateCols) > -1)
						{
							al_cols = com.egurkha.util.StringUtils.egTokenizer(s_strTok, separateCols,true,false,true);//3-->includeEmpty,4-->unique,5-->trim
							proceed = false;
							// Code written to avoid confusion created by seperators  - Starts ....
							if(al_header.size() != al_cols.size())
							{
								for(int zz=0;zz<al_cols.size();zz++)
								{
									s_strTemp = (String)al_cols.get(zz);
									if(s_strTemp!=null && s_strTemp.trim().length()==0)
										s_strTemp="-";
									rows = s_strTemp.lastIndexOf("(");
									rows1 = s_strTemp.lastIndexOf(")");
									if((rows > -1) && (rows1 > -1) && (rows > rows1) && (zz != al_cols.size()-1))
									{
										al_cols.set(zz, (String)al_cols.get(zz)+" "+(String)al_cols.get(zz+1));
										al_cols.remove(zz+1);
										zz = zz-1;
										continue;
									}
									//al = tokInfo.egTokenizer(s_strTemp,"'");
									al = com.egurkha.util.StringUtils.egTokenizer(s_strTemp,"'",true,false,true);//3-->includeEmpty,4-->unique,5-->trim
									if(al!=null)
										rows = al.size()-1;
									else
										rows=0;

									if(rows==1)
										rows=3;
									if(((rows % 2) != 0 && rows!=0)  && (zz != al_cols.size()-1))
									{
										al_cols.set(zz, (String)al_cols.get(zz)+" "+(String)al_cols.get(zz+1));
										al_cols.remove(zz+1);
										zz = zz-1;
									}
								}
							}
							// Code written to avoid confusion created by seperators  - ....Ends
						}
						else
						{
							proceed = true;
						}

						if(!isSapMonPerfTest)
						{
							sbData.append("<tr class=\"x-grid-row\">");
							//create new row/record
						}
						boolean endLine = false;
						boolean dataEmpty=false;

						if(a == (a_results.size()-2) && (p == a_temp.size()-1))
							endLine = false;
						if((p == a_temp.size()-1))
							endLine = true;
						if(a_temp!=null && a_temp.size()>0 && a_temp.size()>(p+1))
						{
							String s_strTok2=(String)a_temp.get(p+1);
							if(s_strTok!=null && s_strTok2.trim().length()==0)
								dataEmpty = true;
						}
						// new change commonDateLayout
						if(!isSapMonPerfTest)
						{
							if(!commonDateLayout)
							{
								if(a%4!=0)
								{
									sbData.append("<tr class=\"x-grid-row\"><td class=\"x-grid-cell darkthemefont_color dignosis_row\" colspan=\"4\" align=\"left\" ><b style=\"\" class=\"darkthemefont_color\">"+mydate+"</b></td></tr>");
								}
								else
								{
									sbData.append("<tr class=\"x-grid-row\"><td class=\"x-grid-cell darkthemefont_color dignosis_row\" colspan=\"4\" align=\"left\" ><b style=\"\" class=\"darkthemefont_color\">"+mydate+"</b></td></tr>");
								}
								recObj.put("time",sdate);
								recObj_mobile.put("time",sdate);
							}
							else // Saravanan.A added the else part on 14-08-2007.
							{
								//vec_Tabletitle.add(" ");
								if(endLine)
								{
									
								}
								else if(dataEmpty)
								{
									
								}
								else
								{
									
								}
							}
						}

						if(!proceed)
						{
							for(int len=0;len<al_cols.size();len++)
							{
								String idName = "cell_border2";
								if(!commonDateLayout)
								{
									if(len % 2 == 0)
									{
										idName = "cell_border2";
									}
									else
									{
										idName = "cell_border2";
									}
								}

								String val1 = (String) al_cols.get(len);
								val1=EgDbInfo.formatValue(val1)	;
								if (val1 != null && val1.trim().equals("") )
									val1="-";
								else if(val1 != null && (val1.trim().equals("-5.0000")|| val1.trim().equals("-5")))
								{
									val1 = "N/A";
								}
								if(val1 != null && !val1.equalsIgnoreCase("!H"))
								{
									// condition to truncate 0 decimals (ex -> 8.00 as 8)
									if(val1 != null && (val1.endsWith(".0") || val1.endsWith(".00") || val1.endsWith(".000") || val1.endsWith(".0000")))
									{
										try
										{
											val1=String.valueOf(Double.parseDouble(val1));
											val1 = val1.substring(0,val1.lastIndexOf("."));
										}
										catch(Exception e)
										{
											val1=val1;
										}
									}

									if(val1.startsWith("<") && val1.endsWith(">"))
									{
										val1=com.egurkha.util.StringUtils.replace(val1,"<","&lt;");
										val1=com.egurkha.util.StringUtils.replace(val1,">","&gt;");
									}
									else
									{
										if(val1.indexOf("<")>0)
										{
											val1=com.egurkha.util.StringUtils.replace(val1,"<","&lt;");
										}
										if(val1.indexOf(">")>0)
										{
											val1=com.egurkha.util.StringUtils.replace(val1,">","&gt;");
										}
									}

									//sarav display table value
									
									if(isSapAlertsTest)
									{
										if(len<7 || len >8)		//to rmve severity & color frm tbl
										{
											sbData.append("<tr class=\"x-grid-row\"><td valign=\"top\" align=\"left\" class=\"x-grid-cell\" wrap><div class=\"x-grid-cell-inner\">"+val1.trim()+"</div></td>");
											recObj.put(len+"col",val1.trim());
											recObj_mobile.put("col"+len,val1.trim());
										}
										else if(len == 8)		//display importance color with value.
										{
											String tmp="";
											String tmp2="";
											tmp=(String)al_cols.get(7);
											tmp2=(String)al_cols.get(8);
											StringBuffer temp_table2 = new StringBuffer();
											if(tmp!=null && tmp.trim().length()>0)
											{
												long value1 = 0;
												if(tmp.equalsIgnoreCase("N/A"))
												{
													if(tmp2!=null && tmp2.trim().equalsIgnoreCase("grey"))
														value1=100;
												}
												else
												{
													try
													{
														int columnWidth = 255;
														Long temp_measure_value=new Long(Math.round(Double.parseDouble(tmp)));
														long fillColorValue=temp_measure_value.longValue();
														value1 = (fillColorValue*100)/columnWidth;
													}
													catch(Throwable ee)
													{
														ee.printStackTrace();
														value1=0;
													}
												}

												String state_color="";
												if(tmp2!=null)
												{
													state_color=tmp2;
													if(tmp2.trim().equalsIgnoreCase("grey"))
														value1=100;
												}

												String bar_str="";
												bar_str="<table width='100' cellpadding='0' cellspacing='0' border='0'  height='11' class='prog_border'>";
												bar_str+="<tr>";
													bar_str+="<td align='left' width='100%' height='11' class='eg_whitebg'>";
														bar_str+="<table width='"+value1+"%' height='11'  cellpadding='0' cellspacing='0' border='0'>";
															bar_str+="<tr>";
																bar_str+="<td class ='sap_progress_"+state_color+"' width='100%'>"+tmp+"</td>";
															bar_str+="</tr>";
														bar_str+="</table>";
													bar_str+="</td>";
												bar_str+="</tr>";
												bar_str+="</table>";
												temp_table2.append(bar_str);
											}
											else
											{
												temp_table2.append(tmp+" "+tmp2);
											}
											sbData.append("<td valign=\"top\" class=\"x-grid-cell\" align=\"left\" wrap><div class=\"x-grid-cell-inner\">"+temp_table2.toString().trim()+"</div></td>");
											recObj.put(len+"col",temp_table2.toString().trim());
											recObj_mobile.put("col"+len,temp_table2.toString().trim());
										}
									}
									else
									{
										String temp_val1=val1.trim();
										String temp_val2="";
										//logic for map link
										if(temp_val1!=null && temp_val1.indexOf("href")>-1)
										{
											temp_val1=temp_val1.substring(temp_val1.indexOf("http"));
											temp_val1=temp_val1.substring(0,temp_val1.indexOf("&gt"));
											temp_val2=temp_val1.substring(temp_val1.indexOf("q=")+2);
											sbData.append("<td style=\"width:70px\" valign=\"top\" align=\"left\" class=\"x-grid-cell\"  wrap><div    class=\"x-grid-cell-inner\"><a target='_blank' href='"+temp_val1+"'><u>"+temp_val2+"</u></a></div></td>");
										}
										else
										{
											sbData.append("<td style=\"width:70px\" valign=\"top\" align=\"left\" class=\"x-grid-cell\"  wrap><div class=\"x-grid-cell-inner\">"+val1.trim()+"</div></td>");
										}
										recObj.put(len+"col",val1.trim());
										recObj_mobile.put("col"+len,val1.trim());
									}
									//lst_DispData.add(val1);
									if(val1!=null && val1.indexOf(",")>-1)
										val1="\""+val1+"\"";
									if(isSapAlertsTest)
									{
										if(len<7 || len >8)
										{
											//vec_Tabletitle.add(val1.trim());
											vec_Tabletitle.add("\" "+val1.trim()+"\"");
										}
										else if(len==7)
										{
											String tem1=(String)al_cols.get(7);
											String tem2=(String)al_cols.get(8);
											if(tem1!=null && tem2!=null)
											{
												String result_tmp=tem1+"-"+tem2;
												//vec_Tabletitle.add(result_tmp);
											}
										}
									}
									else
									{
										//vec_Tabletitle.add(val1.trim());
										vec_Tabletitle.add("\" "+val1.trim()+"\"");
									}
								}
							}
						}
						else
						{
							// condition to truncate 0 decimals (ex -> 8.00 as 8)
							if(s_strTok != null && (s_strTok.endsWith(".0") || s_strTok.endsWith(".00") || s_strTok.endsWith(".000") || s_strTok.endsWith(".0000")))
							{
								try
								{
									s_strTok=String.valueOf(Double.parseDouble(s_strTok));
									s_strTok = s_strTok.substring(0,s_strTok.lastIndexOf("."));
								}
								catch(Exception e)
								{
									s_strTok=s_strTok;
								}
							}

							if(s_strTok.startsWith("<") && s_strTok.endsWith(">"))
							{
								s_strTok=com.egurkha.util.StringUtils.replace(s_strTok,"<","&lt;");
								s_strTok=com.egurkha.util.StringUtils.replace(s_strTok,">","&gt;");
							}
							else
							{
								if(s_strTok.indexOf("<")>0)
								{
									s_strTok=com.egurkha.util.StringUtils.replace(s_strTok,"<","&lt;");
								}

								if(s_strTok.indexOf(">")>0)
								{
									s_strTok=com.egurkha.util.StringUtils.replace(s_strTok,">","&gt;");
								}
							}
							if(!isSapMonPerfTest)
							{
								sbData.append("<tr><td wrap style=\"width:70px\" valign=\"top\" align=\"left\" class=\"x-grid-cell\" colspan=\""+al_header.size()+"\"><div class=\"x-grid-cell-inner\"> "+s_strTok.trim()+"</div></td></tr>");
								recObj.put("0col",s_strTok.trim());
								recObj_mobile.put("col0",s_strTok.trim());
							}
							else if(isSapMonPerfTest)
							{
								String treeDataRow=s_strTok.trim();
								if(treeDataRow!=null && treeDataRow.trim().length()>0)
								{
									if(treeDataRow.startsWith("/t"))
									{
										String temp_table_temp= null;
										if(temp_table!=null)
											temp_table_temp=temp_table.toString();
										if(temp_table_temp!=null && temp_table_temp.trim().length()>0)
										{
											if(!headerFlage)
											{
												temp_table.append("</table>");
												sb.append("palmtree.addItem(\""+temp_table.toString()+"\", branch"+(k-1)+");\n");

												headerFlage=true;
												temp_table = new StringBuffer();
											}
										}
										treeDataRow=com.egurkha.util.StringUtils.replace(treeDataRow,"\\","\\\\");
										ArrayList tempList =  com.egurkha.util.StringUtils.egTokenizer(treeDataRow, "/t",true,false,true);//param 3-->includeEmpty,4-->unique,5-->trim

										if(tempList!=null && tempList.size()>0)
										{
											for(k=0;k<tempList.size();k++)
											{
												String temp_data=(String)tempList.get(k);
												if(temp_data!=null && temp_data.trim().length()>0)
												{
													if(k==1)
													{
														String temp_root="var root_text={label:'"+temp_data+"',style:'smartalert_link'};";
														sb.append(temp_root);
														sb.append("var branch"+k+"=palmtree.addItem(root_text,'',true);\n");
													}
													else if(k>1)
													{
														sb.append("var branch"+k+"=palmtree.addItem('"+temp_data+"',branch"+(k-1)+",true);\n");
													}
												}
											}
										}
									}
									else
									{
										//--need to work--
										treeDataRow=com.egurkha.util.StringUtils.replace(treeDataRow,"\\","\\\\");
										ArrayList tempList =  com.egurkha.util.StringUtils.egTokenizer(treeDataRow, "||",true,false,true);//param 3-->includeEmpty,4-->unique,5-->trim
										if(tempList!=null && tempList.size()>0)
										{
											if(headerFlage)
											{
												temp_table.append("<table border='0' bordercolor='red' cellpadding='4' align='center' valign='top'  cellspacing='0' width='100%' style='table-layout:auto;cursor:default;' class='tableborder_jvm'><tr><td class='tdborder2 eg_75bold' align='center' >"+mappingInfo.getTextDescription("monitor.detaileddiagnosis.Attribute Name")+"</td><td class='tdborder2 eg_75bold' align='center'>"+mappingInfo.getTextDescription("monitor.detaileddiagnosis.Curr Value")+" ("+mappingInfo.getTextDescription("monitor.detaileddiagnosis.units")+")</td><td class='tdborder2 eg_75bold' align='center'>"+mappingInfo.getTextDescription("monitor.detaileddiagnosis.Importance")+"</td><td class='tdborder2 eg_75bold' align='center'>"+mappingInfo.getTextDescription("monitor.detaileddiagnosis.Date")+"</td><td class='tdborder2 eg_75bold' align='center'>"+mappingInfo.getTextDescription("monitor.detaileddiagnosis.Time")+"</td></tr>");
												headerFlage=false;
											}

											String temp_data1=(String)tempList.get(0);
											String temp_data2=(String)tempList.get(1);
											String temp_data3=(String)tempList.get(2);
											String temp_data4=(String)tempList.get(3);
											String temp_data5=(String)tempList.get(4);
											String temp_data6=(String)tempList.get(5);
											String temp_data7=(String)tempList.get(6);

											if(temp_data1!=null && temp_data1.trim().length()>0)
											{
												temp_table.append("<tr>");

												temp_table.append("<td class='tdborder3_jvm eg_75bold' >"+temp_data1+"</td>");

												if(temp_data3!=null && temp_data3.trim().length()>0 && !temp_data3.equalsIgnoreCase("N/A"))
												{
													temp_table.append("<td class='tdborder3_jvm'>"+temp_data2+" ("+temp_data3+")"+"</td>");
												}
												else
												{
													temp_table.append("<td class='tdborder3_jvm'>"+temp_data2+"</td>");
												}

												if(temp_data5!=null && temp_data5.trim().length()>0)
												{
													long value1 = 0;
													if(temp_data5.equalsIgnoreCase("N/A"))
													{
														if(temp_data4!=null && temp_data4.trim().equalsIgnoreCase("grey"))
															value1=100;
													}
													else
													{
														try
														{
															int columnWidth = 255;
															Long temp_measure_value=new Long(Math.round(Double.parseDouble(temp_data5)));
															long fillColorValue=temp_measure_value.longValue();
															value1 = (fillColorValue*100)/columnWidth;
														}
														catch(Throwable ee)
														{
															ee.printStackTrace();
															value1=0;
														}
													}

													String state_color="";
													if(temp_data4!=null)
													{
														state_color=temp_data4;
														if(temp_data4.trim().equalsIgnoreCase("grey"))
															value1=100;
													}

													String bar_str="";
													bar_str="<table width='80' cellpadding='0' cellspacing='0' border='0'  height='11' class='tableborder_jvm'>";
													bar_str+="<tr>";
														bar_str+="<td align='left' width='100%' height='11' class='eg_whitebg'>";
															bar_str+="<table width='"+value1+"%' height='11'  cellpadding='0' cellspacing='0' border='0'>";
																bar_str+="<tr>";
																	bar_str+="<td class ='sap_progress_"+state_color+"' width='100%'>"+temp_data5+"</td>";
																bar_str+="</tr>";
															bar_str+="</table>";
														bar_str+="</td>";
													bar_str+="</tr>";
													bar_str+="</table>";

													temp_table.append("<td class='tdborder3_jvm'>"+bar_str+"</td>");
												}
												else
												{
													temp_table.append("<td class='tdborder3_jvm'>"+temp_data4+" "+temp_data5+"</td>");
												}
												
												if(temp_data6!=null && temp_data6.trim().length()>0 && !temp_data6.equalsIgnoreCase("N/A"))
												{
													temp_table.append("<td class='tdborder3_jvm'>"+temp_data6+"</td>");
												}
												else
												{
													temp_table.append("<td class='tdborder3_jvm'>-</td>");
												}

												if(temp_data7!=null && temp_data7.trim().length()>0 && !temp_data7.equalsIgnoreCase("N/A"))
												{
													temp_table.append("<td class='tdborder3_jvm'>"+temp_data7+"</td>");
												}
												else
												{
													temp_table.append("<td class='tdborder3_jvm'>-</td>");
												}

												temp_table.append("</tr>");
											}
										}
									}
								}
							}
						}
						if(!isSapMonPerfTest)
						{
							sbData.append("</tr>");
							dataArray1.add(recObj);  
							dataArray_mobile.add(recObj_mobile);  
						}
						//vec_Tabletitle.add("\n");
					}
					
					if(isSapMonPerfTest)
					{
						temp_table.append("</table>");
						sb.append("palmtree.addItem(\""+temp_table.toString()+"\", branch"+(k-1)+");\n");
						sb.append("palmtree.treetop.draw();");
						sbData.append("<tr> <td height=\"100%\" width=\"100%\" valign=\"top\" align=\"left\" > <div id=\"treeDD"+a+"\" class=\"treemenu\"></div> <script type=\"text/javascript\">");
						recObj.put("treeId","treeDD"+a);
						if(sb != null)
						{
							recObj.put("tree",sb.toString());
							sbData.append(sb.toString());
							recObj_mobile.put("tree",sb.toString());
						}
					}
				}
				else
				{
					String myclass="DDBgEven";
					if(mylocalvar%2==0)
					{
						//myclass="DDBgOdd";
					}
					sbData.append("<tr class="+myclass+">");

					//al_cols=(ArrayList)a_results.get(a+1);
					String al_cols_str="";
					int innerclass=0;
					for (int m=0;m<no_of_records;m++)
					{
						innerclass++;
						try
						{
							al_cols=(ArrayList)a_temp.get(m);
						}
						catch(Exception ex)
						{
							al_cols_str=(String)a_temp.get(m);
						}

						if(keyEntryIndexList!=null && keyEntryIndexList.size()>0 && al_cols!=null && al_cols.size()>0)
						{
							StringBuffer sb_key=new StringBuffer(128);
							for (int w=0;w<keyEntryIndexList.size();w++)
							{
								Integer tmp_key=(Integer)keyEntryIndexList.get(w);
								int tmp_key_val=tmp_key.intValue();
								String temp_value=(String)al_cols.get(tmp_key_val);
								if(temp_value!=null && temp_value.trim().length()>0 && !temp_value.equals("-"))
								{
									sb_key.append(temp_value+":");
								}
							}
							String sb_key_str=null;
							if(sb_key!=null)
								sb_key_str=(String)sb_key.toString();
							if(sb_key_str!=null && sb_key_str.trim().length()>0)
							{
								sb_key_str=sb_key_str.substring(0,sb_key_str.lastIndexOf(":"));
							}
							StringBuffer sb_value=new StringBuffer(128);
							int valInt=valueEntryIndexList.size();
							boolean addRec=true;
							for (int w=0;w<valInt;w++)
							{
								Integer tmp_key=(Integer)valueEntryIndexList.get(w);
								int tmp_key_val=tmp_key.intValue();

								String temp_value=(String)al_cols.get(tmp_key_val);

								sb_value.append(temp_value+"~#~");
							}

							String sb_value_str=null;
							if(sb_value!=null)
								sb_value_str=(String)sb_value.toString();

							if(sb_value_str!=null && sb_value_str.trim().length()>0)
							{
								sb_value_str=sb_value_str.substring(0,sb_value_str.lastIndexOf("~#~"));
							}

							if(addRec && sb_key_str!=null && sb_key_str.trim().length()>0)
							{
								JSONObject tmpValueObj = new JSONObject();
								tmpValueObj.put(sb_key_str,sb_value_str);
								latlongKeyArray.add(sb_key_str);
								latlangKeyValueArray.add(tmpValueObj);

								JSONArray tmpValArray = new JSONArray();
								if(latlangKeyValueObj!=null && latlangKeyValueObj.size()>0)
									tmpValArray = (JSONArray)latlangKeyValueObj.get(sb_key_str);
								
								if(tmpValArray!=null && tmpValArray.size()>0)
									tmpValArray.add(sb_value_str);
								else
								{
									tmpValArray = new JSONArray();
									tmpValArray.add(sb_value_str);
								}
								latlangKeyValueObj.put(sb_key_str,(JSONArray)tmpValArray);
							}
						}

						// new change commonDateLayout
						if(!commonDateLayout)
						{
							if(a%4!=0)
							{
								if(rumStatus){
									sbData.append("<td align='left' class='x-grid-cell darkthemefont_color dignosis_row' colspan="+al_header.size()+"><b style='' class=\"darkthemefont_color\"hidden>"+mydate+"</b></td></tr>");
								}
								else
								{
									sbData.append("<td align='left' class='x-grid-cell darkthemefont_color dignosis_row' colspan="+al_header.size()+"><b style='' class=\"darkthemefont_color\">"+mydate+"</b></td></tr>");
									if(isScreenShotEnabled && s_test.equalsIgnoreCase("GenericLogonSimTest"))
									{
										String ctx_date = sdate;
										boolean isNeedToShowIcon =false;
										try 
										{
											if(screenshotHash != null && screenshotHash.containsKey(sdate))
											{
												if(ctxLogonTimeHash != null && ctxLogonTimeHash.containsKey(sdate)){
													ctx_date = (String) ctxLogonTimeHash.get(sdate);
													ctx_date = ctx_date.trim();
													String db_date = ctx_date.substring(0,ctx_date.lastIndexOf(" "));
													String db_time = ctx_date.substring(ctx_date.lastIndexOf(" ")+1);
													db_date = DateUtil.changeDateFormat(db_date,"MM/dd/yyyy","yyyy-MM-dd");
													ctx_date = db_date+" "+db_time;

												}											
												isNeedToShowIcon = true;
											}
										}
										catch(Throwable e)
										{
											e.printStackTrace();
										}

										if(isNeedToShowIcon)
										{
											recObj.put("time"," <span style='margin-left: 8px;margin-top:2px;margin-right:4px;float:left;'><img src='data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='  class='iconDDAnalysis handSymbol'  onclick='javascript:redirectCTX(this)' value='"+ctx_date+"' componentname='"+s_host+"' test='"+s_test+"' msmthost='"+s_msmt_host+"' info='"+s_info+"' measure='"+s_mes+"' data-qclass='yellowTip' style='margin:auto;text-align:center' data-qtip=''/></span><span style='position:relative;top:4px'>"+sdate+"</span>");
										}
										else
											recObj.put("time",sdate);
										recObj_mobile.put("time",sdate);
									}
									else if(s_test != null && !s_test.equalsIgnoreCase("GenericLogonSimTest") && (simTestList != null && simTestList.contains(s_test)))
									{
										String ctx_date = sdate;
										boolean isNeedToShowIcon = false;
										try 
										{
											if(isScreenshotEnabledTest && screenshotHash != null && screenshotHash.containsKey(sdate))
											{
												if(ctxLogonTimeHash != null && ctxLogonTimeHash.containsKey(sdate)){
													ctx_date = (String) ctxLogonTimeHash.get(sdate);
													ctx_date = ctx_date.trim();
													String db_date = ctx_date.substring(0,ctx_date.lastIndexOf(" "));
													String db_time = ctx_date.substring(ctx_date.lastIndexOf(" ")+1);
													db_date = DateUtil.changeDateFormat(db_date,"MM/dd/yyyy","yyyy-MM-dd");
													ctx_date = db_date+" "+db_time;
												}											
												isNeedToShowIcon = true;
											}
											else
											{												
												if(ctxLogonTimeHash != null && ctxLogonTimeHash.containsKey(sdate)){
													ctx_date = (String) ctxLogonTimeHash.get(sdate);
													ctx_date = ctx_date.trim();
													String db_date = ctx_date.substring(0,ctx_date.lastIndexOf(" "));
													String db_time = ctx_date.substring(ctx_date.lastIndexOf(" ")+1);
													db_date = DateUtil.changeDateFormat(db_date,"MM/dd/yyyy","yyyy-MM-dd");
													ctx_date = db_date+" "+db_time;
												}											
												isNeedToShowIcon = true;
											}
										}
										catch(Throwable e)
										{
											e.printStackTrace();
											
										}
										if(isNeedToShowIcon)
											recObj.put("time"," <span style='margin-left: 8px;margin-top:2px;margin-right:4px;float:left;'><img src='data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='  class='iconDDAnalysis handSymbol'  onclick='javascript:redirectCTX(this)' value='"+ctx_date+"' componentname='"+s_host+"' test='"+s_test+"' msmthost='"+s_msmt_host+"' info='"+s_info+"' measure='"+s_mes+"' data-qclass='yellowTip' style='margin:auto;text-align:center' data-qtip=''/></span><span style='position:relative;top:4px'>"+sdate+"</span>");
										else
											recObj.put("time",sdate);

										recObj_mobile.put("time",sdate);
									}else{
										recObj.put("time",sdate);
										recObj_mobile.put("time",sdate);
									}
								}
							}
							else
							{
								if(rumStatus){
									sbData.append("<td align='left' class='x-grid-cell darkthemefont_color dignosis_row' colspan='"+al_header.size()+"'><b style='' class=\"darkthemefont_color \"hidden>"+mydate+"</b></td></tr>");
								}
								else
								{
									sbData.append("<td align='left' class='x-grid-cell darkthemefont_color dignosis_row' colspan='"+al_header.size()+"'><b style='' class=\"darkthemefont_color\">"+mydate+"</b></td></tr>");
									if(isScreenShotEnabled && s_test.equalsIgnoreCase("GenericLogonSimTest"))
									{
										String ctx_date = sdate;
										boolean isNeedToShowIcon = false;
										try 
										{
											if(screenshotHash != null && screenshotHash.containsKey(sdate))
											{
												if(ctxLogonTimeHash != null && ctxLogonTimeHash.containsKey(sdate)){
													ctx_date = (String) ctxLogonTimeHash.get(sdate);
													ctx_date = ctx_date.trim();
													String db_date = ctx_date.substring(0,ctx_date.lastIndexOf(" "));
													String db_time = ctx_date.substring(ctx_date.lastIndexOf(" ")+1);
													db_date = DateUtil.changeDateFormat(db_date,"MM/dd/yyyy","yyyy-MM-dd");
													ctx_date = db_date+" "+db_time;
												}
												isNeedToShowIcon = true;
											}

										}
										catch(Throwable e)
										{
											e.printStackTrace();
										}
										if(isNeedToShowIcon)
											recObj.put("time"," <span style='margin-left: 8px;margin-top:2px;margin-right:4px;float:left;'><img src='data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='  class='iconDDAnalysis handSymbol'  onclick='javascript:redirectCTX(this)'  value='"+ctx_date+"' componentname='"+s_host+"' test='"+s_test+"' msmthost='"+s_msmt_host+"' info='"+s_info+"' measure='"+s_mes+"' data-qclass='yellowTip' style='margin:auto;text-align:center' data-qtip=''/></span><span style='position:relative;top:4px'>"+sdate+"</span>");
										else
											recObj.put("time",sdate);

										recObj_mobile.put("time",sdate);
									}
									else if(s_test != null && !s_test.equalsIgnoreCase("GenericLogonSimTest") && (simTestList != null && simTestList.contains(s_test)))
									{
										String ctx_date = sdate;
										boolean isNeedToShowIcon = false;
										try 
										{
											if(isScreenshotEnabledTest && screenshotHash != null && screenshotHash.containsKey(sdate))
											{
												if(ctxLogonTimeHash != null && ctxLogonTimeHash.containsKey(sdate)){
													ctx_date = (String) ctxLogonTimeHash.get(sdate);
													ctx_date = ctx_date.trim();
													String db_date = ctx_date.substring(0,ctx_date.lastIndexOf(" "));
													String db_time = ctx_date.substring(ctx_date.lastIndexOf(" ")+1);
													db_date = DateUtil.changeDateFormat(db_date,"MM/dd/yyyy","yyyy-MM-dd");
													ctx_date = db_date+" "+db_time;
												}
												isNeedToShowIcon = true;
											}
											else
											{
												if(ctxLogonTimeHash != null && ctxLogonTimeHash.containsKey(sdate)){
													ctx_date = (String) ctxLogonTimeHash.get(sdate);
													ctx_date = ctx_date.trim();
													String db_date = ctx_date.substring(0,ctx_date.lastIndexOf(" "));
													String db_time = ctx_date.substring(ctx_date.lastIndexOf(" ")+1);
													db_date = DateUtil.changeDateFormat(db_date,"MM/dd/yyyy","yyyy-MM-dd");
													ctx_date = db_date+" "+db_time;
												}
												isNeedToShowIcon = true;
											}
										}
										catch(Throwable e)
										{
											e.printStackTrace();
										}

										if(isNeedToShowIcon)
											recObj.put("time"," <span style='margin-left: 8px;margin-top:2px;margin-right:4px;float:left;'><img src='data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='  class='iconDDAnalysis handSymbol'  onclick='javascript:redirectCTX(this)'  value='"+ctx_date+"' componentname='"+s_host+"' test='"+s_test+"' msmthost='"+s_msmt_host+"' info='"+s_info+"' measure='"+s_mes+"' data-qclass='yellowTip' style='margin:auto;text-align:center' data-qtip=''/></span><span style='position:relative;top:4px'>"+sdate+"</span>");
										else
											recObj.put("time",sdate);

										recObj_mobile.put("time",sdate);
									}else{
										recObj.put("time",sdate);
										recObj_mobile.put("time",sdate);
									}
								}
								
							}
						}
						else // Saravanan.A added the else part on 14-08-2007.
						{
							//vec_Tabletitle.add(" ");
							if(a_temp.size()>1)
							{
								//sbData.append("<td valign=\"top\" align=\"left\" class=\"x-grid-cell\"><div class=\"x-grid-cell-inner\">&nbsp;</div></td>");
							}
							else
							{
								
							}
						}

						if(al_cols_str==null || al_cols_str.equals(""))
						{
							int colSize = al_cols.size();
							JSONObject res_ctx_json = null;
							String guidStr = null;
							//if (isJavaTransactionsTest)
							//	colSize--; // last column should be the call trace tree column. Not showing it in DD page
							for(int len=0;len<colSize;len++)
							{
								boolean imageColum=false;
								boolean isVirtualPage=false;
								boolean isErrorStatusPage=false;
								String imageColValue=null;
								String idName = "white_bg";
								if(!commonDateLayout)
								{
									if(len % 2 == 0)
									{
										idName = "eg_lightlight";
									}else
									{
										idName = "white_bg";
									}
								}
								String val1 = (String) al_cols.get(len);

								try
								{	
									if(isSSTest)
									{
										if(s_test != null && (simTestList != null && simTestList.contains(s_test)) && s_test.equalsIgnoreCase("CitraTest"))
										{
											res_ctx_json = new JSONObject();
											res_ctx_json.put("ss",val1);
											if(s_host != null && s_host.trim().length() > 0)
												res_ctx_json.put("host",s_host);
											if(sdate != null && sdate.trim().length() > 0)
												res_ctx_json.put("time",sdate);
											ctxDataArr1.add(res_ctx_json);
										}
										else if(s_test != null && (simTestList != null && simTestList.contains(s_test)) && s_test.equalsIgnoreCase("GenericLogonSimTest"))
										{
											if(len==1)
											{	
												Hashtable _secDetails = getSecondaryLogonDetails(val1);
												String screenShot = getCtxScreenShotName(_secDetails);
												if(screenShot.lastIndexOf(".")>-1)
													screenShot = screenShot.substring(0,screenShot.lastIndexOf("."));
												res_ctx_json = new JSONObject();
												if(screenShot != null && screenShot.trim().length() > 0 && !screenShot.equalsIgnoreCase("-"))
												{
													res_ctx_json.put("ss",screenShot);
													if(s_host != null && s_host.trim().length() > 0)
														res_ctx_json.put("host",s_host);
													if(sdate != null && sdate.trim().length() > 0)
														res_ctx_json.put("time",sdate);
													ctxDataArr1.add(res_ctx_json);
												}
												String ctx_date = sdate;
												boolean isNeedToShowIcon = false;
												try 
												{
													
													if( screenshotHash != null && screenshotHash.containsKey(sdate))
													{
														if(ctxLogonTimeHash != null && ctxLogonTimeHash.containsKey(sdate)){
															ctx_date = (String) ctxLogonTimeHash.get(sdate);
															ctx_date = ctx_date.trim();
															String db_date = ctx_date.substring(0,ctx_date.lastIndexOf(" "));
															String db_time = ctx_date.substring(ctx_date.lastIndexOf(" ")+1);
															db_date = DateUtil.changeDateFormat(db_date,"MM/dd/yyyy","yyyy-MM-dd");
															ctx_date = db_date+" "+db_time;
														}
														isNeedToShowIcon = true;
													}												
												}
												catch(Throwable e)
												{
													e.printStackTrace();
													
												}

												if(isNeedToShowIcon)
													recObj.put("time"," <span style='margin-left: 8px;margin-top:2px;margin-right:4px;float:left;'><img src='data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='  class='iconDDAnalysis handSymbol'  onclick='javascript:redirectCTX(this)'  value='"+ctx_date+"' componentname='"+s_host+"' test='"+s_test+"' msmthost='"+s_msmt_host+"' info='"+s_info+"' measure='"+s_mes+"' data-qclass='yellowTip' style='margin:auto;text-align:center' data-qtip=''/></span><span style='position:relative;top:4px'>"+sdate+"</span>");
												else
													recObj.put("time",sdate);

												recObj_mobile.put("time",sdate);

											}
										}

									}
									else if(s_test != null && (simTestList != null && simTestList.contains(s_test)))
									{
										if(len == 0)
										{
											res_ctx_json = null;
											res_ctx_json =  dd.produceCtxLogonJSON(val1,stateMeasure,s_test,mappingInfo);
											if(res_ctx_json != null)
											{
												//if(s_test.equalsIgnoreCase("HrznLogonSimTest"))
												{
													String logon_site = s_site;
													if(logon_site == null || logon_site.trim().length() == 0 || logon_site.equalsIgnoreCase("NONE"))
														logon_site="NULL";

													String logon_info = s_info;
													if(logon_info != null && logon_info.trim().length() > 0 && logon_info.startsWith("*") )
														logon_info="+"+s_info.substring(1);
													else if(logon_info != null && logon_info.trim().length() > 0 && !logon_info.startsWith("+") )
														logon_info="+"+s_info;
													
													String ctx_date = sdate;
													boolean isNeedToShowIcon = false;
													try 
													{
														if(isScreenshotEnabledTest && screenshotHash != null && screenshotHash.containsKey(sdate))
														{
															if(ctxLogonTimeHash != null && ctxLogonTimeHash.containsKey(sdate)){
																ctx_date = (String) ctxLogonTimeHash.get(sdate);
																ctx_date = ctx_date.trim();
																String db_date = ctx_date.substring(0,ctx_date.lastIndexOf(" "));
																String db_time = ctx_date.substring(ctx_date.lastIndexOf(" ")+1);
																db_date = DateUtil.changeDateFormat(db_date,"MM/dd/yyyy","yyyy-MM-dd");
																ctx_date = db_date+" "+db_time;
															}
															isNeedToShowIcon = true;
														}
														else
														{
															if(ctxLogonTimeHash != null && ctxLogonTimeHash.containsKey(sdate)){
																ctx_date = (String) ctxLogonTimeHash.get(sdate);
																ctx_date = ctx_date.trim();
																String db_date = ctx_date.substring(0,ctx_date.lastIndexOf(" "));
																String db_time = ctx_date.substring(ctx_date.lastIndexOf(" ")+1);
																db_date = DateUtil.changeDateFormat(db_date,"MM/dd/yyyy","yyyy-MM-dd");
																ctx_date = db_date+" "+db_time;

															}
															isNeedToShowIcon = true;
														}
													}
													catch(Throwable e)
													{
														e.printStackTrace();
														
													}
													if(isNeedToShowIcon)
														recObj.put("time"," <span style='margin-left: 8px;margin-top:2px;margin-right:4px;float:left;'><img src='data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='  class='iconDDAnalysis handSymbol'  onclick='javascript:redirectCTX(this)'  value='"+ctx_date+"' componentname='"+s_host+"' test='"+s_test+"' msmthost='"+s_msmt_host+"' info='"+s_info+"' measure='"+s_mes+"' data-qclass='yellowTip' style='margin:auto;text-align:center' data-qtip=''/></span><span style='position:relative;top:4px'>"+sdate+"</span>");
													else
														recObj.put("time",sdate);

													recObj_mobile.put("time",sdate);

													ArrayList testTableMeasures = new ArrayList();
													testTableMeasures.add("TOTAL_DURATION");
													testTableMeasures.add("LOGOFF_DURATION");
													ArrayList measuresList = monUtil.getTestTableMeasureValue(s_host,s_port,logon_site,s_test,testTableMeasures, logon_info,ctx_date,s_msmt_host);
													if(measuresList != null && measuresList.size() == testTableMeasures.size())
													{
														String total_duration = (String)measuresList.get(0);
														String logoff_duration = (String)measuresList.get(1);
														if(total_duration == null || total_duration.trim().length() == 0 || total_duration.trim().startsWith("-5"))
															total_duration="-";
														if(logoff_duration == null || logoff_duration.trim().length() == 0 || logoff_duration.trim().startsWith("-5"))
															logoff_duration="-";
														res_ctx_json.put("total_time",total_duration);
														res_ctx_json.put("logoff_time",logoff_duration);

														if(isEnumDisabled)
														{
															try
															{
																JSONObject log_off = (JSONObject)res_ctx_json.get("app_launch");
																log_off.put("value",logoff_duration);
																if(logoff_duration.equalsIgnoreCase("-"))
																{
																	log_off.put("state","GREY");
																	log_off.put("icon","logOff_HIGH");
																}
																res_ctx_json.put("app_launch",log_off);
															}
															catch(Exception rrrr)
															{
																rrrr.printStackTrace();
															}
														}
														else
															res_ctx_json.put("isEnumDisabled","false");
													}

												}
												if(s_compTy != null && s_compTy.trim().length() > 0)
													res_ctx_json.put("c_type",mappingInfo.getComponentTypeDescription(s_compTy));
												if(s_host != null && s_host.trim().length() > 0)
													res_ctx_json.put("host",s_host);
												if(sdate != null && sdate.trim().length() > 0)
													res_ctx_json.put("time",sdate);
												if(s_test != null && s_test.trim().length() > 0)
													res_ctx_json.put("test",s_test);
												try
												{
													JSONObject app_launch = (JSONObject)res_ctx_json.get("app_launch");
													String app_state = (String)app_launch.get("state");
													if(app_state != null && app_state.equalsIgnoreCase("HIGH"))
													{
														JSONObject hdx_session = (JSONObject)res_ctx_json.get("hdx_session");
														hdx_session.put("value","0");
														res_ctx_json.put("hdx_session",hdx_session);
													}
												}
												catch(Exception eee)
												{

												}
											}
										}
										else if(len==1)
										{
											if(res_ctx_json != null)
											{
												Hashtable _secDetails = getSecondaryLogonDetails(val1);
												String screenShot = getCtxScreenShotName(_secDetails);
												String user_domain = getCtxUserNameWithDomain(_secDetails);
												if(isScreenshotEnabledTest && screenShot != null && screenShot.trim().length() > 0 && !screenShot.equalsIgnoreCase("-"))
												{
													if(!EgInstallInfo.isSuperManager)
													{
														res_ctx_json.put("screenShot",screenShot);
													}
													else
													{
														res_ctx_json.put("screenShot",selectedMgrId+"|"+screenShot);
													}
													if(user_domain != null && user_domain.trim().length() > 0)
													{
														user_domain = user_domain.trim();
														if(user_domain.startsWith("none"))
															user_domain = user_domain.substring(user_domain.indexOf("\\")+1);

														res_ctx_json.put("user",user_domain);
													}
												
													ctxDataArr1.add(res_ctx_json);
												}
												else if(!isScreenshotEnabledTest)
												{
													if(!EgInstallInfo.isSuperManager)
													{
														res_ctx_json.put("screenShot",screenShot);
													}
													else
													{
														res_ctx_json.put("screenShot",selectedMgrId+"|"+screenShot);
													}

													if(user_domain != null && user_domain.trim().length() > 0)
													{
														user_domain = user_domain.trim();
														if(user_domain.startsWith("none"))
															user_domain = user_domain.substring(user_domain.indexOf("\\")+1);

														res_ctx_json.put("user",user_domain);
													}
												
													ctxDataArr1.add(res_ctx_json);
												}
											}
										}
									}
								}catch(Exception eeeeeee){
								}

								if(dateFormat!=null && !dateFormat.equals("") && len==1)
								{
									try
									{
										if(val1.indexOf(":")>-1&&val1.indexOf(".")>-1&&val1.indexOf("-")>-1 && val1.indexOf(" ")>-1)
										{
											String date = val1.substring(0,val1.indexOf(" "));
											if(date!=null && date.indexOf("-")>-1)
											{
												String time = val1.substring(val1.indexOf(" ")+1);
												if(time!=null && time.endsWith(".0"))
													time = time.substring(0,time.lastIndexOf("."));
												date = DateUtil.changeDateFormat(date,"yyyy-MM-dd",dateFormat);
												val1 = date+" "+time;
											}
										}
									}
									catch(Exception eee)
									{
										val1=val1;
									}
								}
								val1=EgDbInfo.formatValue(val1)	;
								if (val1 != null && val1.trim().equals("") )
									val1="-";
								else if(val1 != null && (val1.trim().equals("-5.0000")|| val1.trim().equals("-5")))
								{
									val1 = "N/A";
								}
								// condition to truncate 0 decimals (ex -> 8.00 as 8)
								if(val1 != null && (val1.endsWith(".0") || val1.endsWith(".00") || val1.endsWith(".000") || val1.endsWith(".0000")))
								{
									try
									{
										val1=String.valueOf(Double.parseDouble(val1));
										val1 = val1.substring(0,val1.lastIndexOf("."));
									}
									catch(Exception e)
									{
										val1=val1;
									}
								}
								if(val1.startsWith("<") && val1.endsWith(">"))
								{
									val1=com.egurkha.util.StringUtils.replace(val1,"<","&lt;");
									val1=com.egurkha.util.StringUtils.replace(val1,">","&gt;");
									/*val1 = val1.substring(1,val1.length()-2);
									val1 = "&lt;"+val1+"&gt;";*/
								}
								else
								{
									if(val1.indexOf("<")>0)
									{
										val1=com.egurkha.util.StringUtils.replace(val1,"<","&lt;");
									}

									if(val1.indexOf(">")>0)
									{
										val1=com.egurkha.util.StringUtils.replace(val1,">","&gt;");
									}
								}

								if (isJavaTransactionsTest)
								{
									if (len == 4)
									{
										String javaData="";
										// subcomponent details column
										ArrayList cellRowsList = com.egurkha.util.StringUtils.egTokenizer(val1.trim(),"%*%",false,false,true);//param 3-->includeEmpty,4-->unique,5-->trim
										if (cellRowsList.size() > 0) {
											// size check may not be needed
												sbData.append("<td valign=\"top\" align=\"left\" class=\"x-grid-cell\" style=\"padding:2px\" nowrap><table cellspacing=\"0\" cellpadding=\"2\" align=\"center\" border=\"0\" valign=\"top\" width=\"100%\" style=\"table-layout:auto;font-size:11px;padding:5;\" class=\"jtm_SubCompTable\"><col width=\"40%\"><col width=\"40%\"><col width=\"20%\"> <tr> <th nowrap style=\"padding:5;\"align=\"left\" valign=\"top\">"+mappingInfo.getTextDescription("monitor.detaileddiagnosis.Sub Component")+"</th> <th nowrap style=\"padding:5;\"  align=\"left\"  valign=\"top\">"+mappingInfo.getTextDescription("monitor.detaileddiagnosis.Time (Secs)")+"</th> <th nowrap  align=\"left\"  valign=\"top\">"+mappingInfo.getTextDescription("monitor.detaileddiagnosis.Count")+"</th> </tr>");
												javaData ="<table class=\"jtm_SubCompTable\" style=\"table-layout:auto;font-size:11px;padding:5;\"><tr > <th nowrap style=\"padding:5;\"  align=\"left\" valign=\"top\">"+mappingInfo.getTextDescription("monitor.detaileddiagnosis.Sub Component")+"</th> <th nowrap style=\"padding:5;\"  align=\"left\"  valign=\"top\">"+mappingInfo.getTextDescription("monitor.detaileddiagnosis.Time (Secs)")+"</th> <th nowrap  align=\"left\"  valign=\"top\">"+mappingInfo.getTextDescription("monitor.detaileddiagnosis.Count")+"</th> </tr>";
												JSONObject javaTranGrid  = new JSONObject();
												JSONArray  javaTranGridHeader = new JSONArray();
												JSONArray  javaTranGridData = new JSONArray();
												
												 JSONObject header1  = new JSONObject();
												 header1.put("text",mappingInfo.getTextDescription("monitor.detaileddiagnosis.SubComponent"));
												javaTranGridHeader.add(header1);
												
												 JSONObject header2  = new JSONObject();
												 header2.put("text",mappingInfo.getTextDescription("monitor.detaileddiagnosis.Time (Secs)"));
												javaTranGridHeader.add(header2);
												
												 JSONObject header3  = new JSONObject();
												 header3.put("text",mappingInfo.getTextDescription("monitor.detaileddiagnosis.Count"));
												javaTranGridHeader.add(header3);
												javaTranGrid.put("headers",javaTranGridHeader);

											for(int i=0;i<cellRowsList.size();i++) 
											{
												ArrayList cellColsList = com.egurkha.util.StringUtils.egTokenizer((String)cellRowsList.get(i),"#=#",false,false,true);//param 3-->includeEmpty,4-->unique,5-->trim
												sbData.append("<tr>");
												JSONObject dataObj  = new JSONObject();
												for (int k = 0;k<cellColsList.size();k++) 
												{
													//murugan inner table data added here 
													sbData.append("<td wrap valign=\"top\"  align=\"left\"  style=\"font-weight:normal !important\"><div class=\"x-grid-cell-inner\">"+(String)(cellColsList.get(k))+"</div></td>");
													javaData +="<td wrap valign=\"top\"  align=\"left\" style=\"font-weight:normal !important\"><div class=\"x-grid-cell-inner\">"+(String)(cellColsList.get(k))+"</div></td>";
													dataObj.put(k+"tran",(String)(cellColsList.get(k)));
												}
												sbData.append("</tr>");
												javaData +="</tr>";
													javaTranGridData.add(dataObj);
											}
											recObj.put(len+"col",javaData+"</table>");
											sbData.append("</table>");
										}
									}
									else 
									{
										sbData.append("<td valign=\"top\" align=\"left\"  class=\"x-grid-cell\"><div class=\"x-grid-cell-inner\">"+val1.trim()+"</div></td>");
										recObj.put(len+"col",val1.trim());
									}
								}
								else 
								{
									if(!commonDateLayout)
									{
										String tableFormat_req_chk = formatIniFile1.getValue("APPLY_TABLE_FORMAT_DD_COLUMN", s_test + ":" + s_mes);
										String tableFormat_sep = formatIniFile1.getValue("APPLY_TABLE_FORMAT_DD_COLUMN_HEADER", s_test + ":" + s_mes+":Separator");
										String tableFormat_header = formatIniFile1.getValue("APPLY_TABLE_FORMAT_DD_COLUMN_HEADER", s_test + ":" + s_mes+":Header");
										String tableExt_req_chk = externalIniFile1.getValue("SNMP_Tests", s_test);
										boolean withoutTableBorder=false;
										boolean headerEnabled=false;
										//if(s_test!=null && s_test.equals("NetworkTrapTest"))
										if(tableExt_req_chk!=null && (tableExt_req_chk.equalsIgnoreCase("true") || tableExt_req_chk.equalsIgnoreCase("yes")))
										{
											withoutTableBorder=true;
										}

										if(val1!=null && !tableFormat_req_chk.trim().equalsIgnoreCase("null") && !tableFormat_req_chk.equals("")&& val1.indexOf(tableFormat_req_chk)>-1)
										{
											ArrayList val1_tok = com.egurkha.util.StringUtils.egTokenizer(val1.trim(),tableFormat_req_chk,false,false,true);
											//Inner table code starts
											if(val1_tok.size()>0) 
											{
												String table_val1 = "";
												if(withoutTableBorder)
												{
													table_val1="<div style=\"border:0px solid #000000\" ><table width='100%' cellspacing='0' cellpadding='0'><tbody>";
													for (int s = 0;s<val1_tok.size();s++)
													{
														String val1_tmp =(String)val1_tok.get(s);

														ArrayList val1_tmp_tok = com.egurkha.util.StringUtils.egTokenizer(val1_tmp.trim(),"=",false,false,true);
														if(val1_tmp_tok!=null && val1_tmp_tok.size()>1)
														{
															StringBuffer all_val_tmp=new StringBuffer(128);
															for (int vtt = 0;vtt<val1_tmp_tok.size();vtt++)
															{
																String val1_tmp_val =(String)val1_tmp_tok.get(vtt);
																if(val1_tmp_val!=null && val1_tmp_val.trim().length()>0)
																{
																	if(vtt==(val1_tmp_tok.size()-1))
																	{
																		all_val_tmp.append("<td width='300' style='white-space:normal;word-break:break-all;vertical-align:top;font-size:11px;line-height:20px!important;' >"+val1_tmp_val.trim()+"</td>");
																	}
																	else
																	{
																		all_val_tmp.append("<td style='white-space:normal;word-break:break-all;vertical-align:top;padding-right:15px;font-size:11px;line-height:20px!important;'>"+val1_tmp_val.trim()+"</td>");
																	}
																}
															}

															if(all_val_tmp!=null)
															{
																val1_tmp="<table width='100%' border='0'><tbody><tr style='background:none !important;white-space:wrap;word-break: break-word;'>"+all_val_tmp.toString()+"</tr></tbody></table>";
															}
														}

														table_val1+="<tr style='background:none !important;white-space:wrap;word-break: break-word;'>";
															table_val1+="<td wrap valign=\"top\" align=\"left\"  style=\"padding:3px;text-wrap:suppress;padding-left: 10px;\" >"+val1_tmp.trim()+"</td>";
														table_val1+="</tr>";
													}
													table_val1+="</tbody></table></div>";
												}
												else
												{
													table_val1="<div class=\"newTable\" ><table width='100%'>";

													if(tableFormat_header!=null && tableFormat_header.trim().length()>0 && (!headerEnabled))
													{
														ArrayList tblHea = com.egurkha.util.StringUtils.egTokenizer(tableFormat_header.trim(),tableFormat_sep,false,false,true);
														if(tblHea!=null && tblHea.size()>0)
														{
															table_val1+="<thead>";
															for(int ss=0;ss<tblHea.size();ss++)
															{
																String tbl_head =(String)tblHea.get(ss);
																table_val1+="<th wrap valign=\"top\" align=\"left\"  style=\"padding:3px;text-wrap:suppress;padding-left: 10px;\" >"+tbl_head.trim().toUpperCase()+"</th>";
															}
															table_val1+="</thead>";
															headerEnabled = true;
														}
													}
													table_val1+="<tbody>";
													for (int s = 0;s<val1_tok.size();s++)
													{
														String val1_tmp =(String)val1_tok.get(s);
														if(tableFormat_sep!=null && tableFormat_sep.trim().length()>0)
														{
															ArrayList tblVal = com.egurkha.util.StringUtils.egTokenizer(val1_tmp.trim(),tableFormat_sep,false,false,true);
															if(tblVal!=null && tblVal.size()>0)
															{
																table_val1+="<tr style='background:none !important;white-space:wrap'>";
																for(int ss=0;ss<tblVal.size();ss++)
																{
																	String tbl_value =(String)tblVal.get(ss);
																	table_val1+="<td wrap valign=\"top\" align=\"left\"  style=\"padding:3px;text-wrap:suppress;padding-left: 10px;\" >"+tbl_value.trim()+"</td>";
																}
																table_val1+="</tr>";
																headerEnabled = true;
															}
														}
														else
														{
															table_val1+="<tr style='background:none !important;white-space:wrap;word-break: break-word;'>";
																table_val1+="<td wrap valign=\"top\" align=\"left\"  style=\"padding:3px;text-wrap:suppress;padding-left: 10px;\" >"+val1_tmp.trim()+"</td>";
															table_val1+="</tr>";
														}
													}
													table_val1+="</tbody></table></div>";
												}
												val1=table_val1;
											}
											else
											{
												val1=val1;
											}
										} //Inner table code ended

										if(a%4!=0)
										{
											sbData.append("<td wrap valign=\"top\" align=\"left\"  style=\"width:70px;padding:3px;text-wrap:suppress;font-weight:bold;padding:5px !important\" class=\"x-grid-cell \"><div class=\"x-grid-cell-inner\">"+val1.trim()+"</div></td>");
										}
										else
										{
											sbData.append("<td wrap valign=\"top\" align=\"left\"  style=\"\" class=\"x-grid-cell  dignosis_sbData\"><div class=\"x-grid-cell-inner\"> "+val1.trim()+"</div></td>");
										}
									}
									else if(keyEntryIndexList!=null && keyEntryIndexList.size()>0 && al_cols!=null && al_cols.size()>0 && valueEntryIndexList!=null && valueEntryIndexList.contains(len) && val1!=null && val1.equalsIgnoreCase("Unknown"))
									{
										//String val1 = (String) al_cols.get(len);
										String in_put="";
										for(int ki=0;ki<keyEntryIndexList.size();ki++)
										{
											Integer tmp_key=(Integer)keyEntryIndexList.get(ki);
											int tmp_key_val=tmp_key.intValue();
											String temp_value=(String)al_cols.get(tmp_key_val);
											if(temp_value!=null && temp_value.trim().length()>0 && !temp_value.equals("-"))
											{
												in_put=in_put+":"+temp_value;
											}
										}

										StringBuffer sb_value=new StringBuffer(128);
										int valInt=valueEntryIndexList.size();
										for(int w=0;w<valInt;w++)
										{
											Integer tmp_key=(Integer)valueEntryIndexList.get(w);
											int tmp_key_val=tmp_key.intValue();

											String temp_value=(String)al_cols.get(tmp_key_val);

											sb_value.append(temp_value+"~#~");
										}

										String sb_value_str=null;
										if(sb_value!=null)
											sb_value_str=(String)sb_value.toString();

										if(sb_value_str!=null && sb_value_str.trim().length()>0)
										{
											sb_value_str=sb_value_str.substring(0,sb_value_str.lastIndexOf("~#~"));
										}

										if(in_put!=null && in_put.length()>0 && sb_value_str!=null && sb_value_str.trim().length()>0)
										{
											in_put=in_put.substring(1);
											//val1="<table><tr><td wrap valign=\"top\" align=\"left\" onclick=\"javascript:openLocationDetails('"+in_put+"')\"><div class=\"x-grid-cell-inner\" >--Men At Work--"+val1.trim()+"</div></td></tr></table>";
											val1="<table><tr><td wrap valign=\"top\" align=\"left\" id=\"mouse\" style=\"border:none !important\" class=\"x-grid-cell\" onclick=\"javascript:openLocationDetails('"+in_put+"','"+sb_value_str+"')\">"+val1.trim()+"</td></tr></table>";
										}
										sbData.append("<td wrap valign=\"top\" align=\"left\"  style=\"padding:3px;text-wrap:suppress;padding-left: 10px;\" class=\"x-grid-cell \">"+val1.trim()+"</td>");
									}
									else
									{
										if(isAPMTest)
										{
											String strg = colNamesForQuery;
											ArrayList columnNamesList = new ArrayList();
											StringTokenizer stkr = new StringTokenizer(strg, ","); 
											while(stkr.hasMoreTokens())
											{
												columnNamesList.add(stkr.nextToken());
											}

											if(len == columnNamesList.indexOf("EG_GUID"))
											{
												String overallExpQuery = "Select BTM_Experience from BTM_USER_EXPERIENCE where EG_GUID = '"+val1.trim()+"'";
												String overallExperience = dd.getOverallExperience(overallExpQuery);
												if(overallExperience != null)
												{
													String userExpIcon = null;
													if(overallExperience.equals("healthy"))
													{
														userExpIcon = "healthy.png";
													}
													else if(overallExperience.equals("slow"))
													{
														userExpIcon = "slow.png";
													}
													else if(overallExperience.equals("error"))
													{
														userExpIcon = "error.png";
													}
													else if(overallExperience.equals("stalled"))
													{
														userExpIcon = "stalled.png";
													}
													String nodeOrder = (String) al_cols.get(len+2);
													/*
														Node Order contains special symbol . Tomcat rejects the special symbols in query param So we have to encode the value to provide in query string 
													*/
													nodeOrder = StringUtils.encodeSecurityChar(nodeOrder); 
													nodeOrder = BTMHelper.getEncodedURI(nodeOrder);
													//sbData.append("<td wrap valign=\"middle\" align=\"left\"  style=\"width:105px;\" class=\"x-grid-cell \"><div class=\"x-grid-cell-inner\" style=\"white-space:normal!important;width:105px\"><a onclick= \"javascript:topologyBuild('"+val1.trim()+"','"+s_test+"','"+nodeOrder+"','"+overallExperience+"')\" href=\"javascript:void(0)\"> "+"<img src=\"/final/images/clear.png\" class=\"btm_rum_dd_icons_"+overallExperience.toLowerCase()+"\"> <span class=\"btmrum_status\">"+overallExperience.toLowerCase()+"</span> <img data-qtip=\"Drilldown into Business Transaction Topology\" data-qclass=\"yellowTip\" src=\"/final/images/clear.png\" class='iconDiagnosis' style=\"vertical-align:middle;margin-left:5px;margin-top:2px;\"></a></div></td>"); 
													sbData.append("<td><div class=\"x-grid-cell-inner\" style=\"white-space:normal!important;width:120px;\"><a onclick= \"javascript:topologyBuild('"+val1.trim()+"','"+s_test+"','"+nodeOrder+"','"+overallExperience+"')\" href=\"javascript:void(0)\"> "+"<img src=\"/final/images/clear.png\" style=\"vertical-align:middle;margin-top:-2px;\" class=\"btm_rum_dd_icons_"+overallExperience.toLowerCase()+"\"> <span class=\"btmrum_status\">"+overallExperience.toLowerCase()+"</span> <img data-qtip=\"Drilldown into Business Transaction Topology\" data-qclass=\"yellowTip\" src=\"/final/images/clear.png\" class='iconDiagnosis' style=\"vertical-align:middle;margin-left:5px;margin-top:0px;\"></a></div></td>"); 

													//val1 = "<div class=\"x-grid-cell-inner\" style=\"white-space:normal!important;width:125px\"><a onclick= \"javascript:topologyBuild('"+val1.trim()+"','"+s_test+"','"+nodeOrder+"','"+overallExperience+"')\" href=\"javascript:void(0)\"> "+"<img src=\"/final/images/clear.png\" class=\"btm_rum_dd_icons_"+overallExperience.toLowerCase()+"\"  > <span class=\"btmrum_status\">"+overallExperience.toLowerCase()+"</span> <img data-qtip=\"Drilldown into Business Transaction Topology\" data-qclass=\"yellowTip\" src=\"/final/images/clear.png\" class='iconDiagnosis' style=\"vertical-align:middle;margin-left:5px;margin-top:2px;\"></a></div>";
													val1 = "<div class=\"x-grid-cell-inner\" style=\"white-space:normal!important;width:120px;\"><a onclick= \"javascript:topologyBuild('"+val1.trim()+"','"+s_test+"','"+nodeOrder+"','"+overallExperience+"')\" href=\"javascript:void(0)\"> "+"<img src=\"/final/images/clear.png\" style=\"vertical-align:middle;margin-top:-2px;\" class=\"btm_rum_dd_icons_"+overallExperience.toLowerCase()+"\"  > <span class=\"btmrum_status\">"+overallExperience.toLowerCase()+"</span> <img data-qtip=\"Drilldown into Business Transaction Topology\" data-qclass=\"yellowTip\" src=\"/final/images/clear.png\" class='iconDiagnosis' style=\"vertical-align:middle;margin-left:5px;margin-top:0px;\"></a></div>";


												}
											}
											else
											{
												if(len == columnNamesList.indexOf("REQUEST_TIME"))
												{
													String targetServerTimeZone = (String) al_cols.get(len+3);
													if(isAPMTest)
														targetServerTimeZone = (String) al_cols.get(len+4);
													
													if(!targetServerTimeZone.equals("-"))
													{
														sbData.append("<td wrap valign=\"middle\" align=\"left\"  style=\"width:93px;padding:3px;text-wrap:suppress\" class=\"x-grid-cell \"><div class=\"x-grid-cell-inner\"  style=\"width:93px;\">"+val1.trim()+" "+targetServerTimeZone+"</div></td>");
														val1 = "<div class=\"x-grid-cell-inner\">"+val1.trim()+" "+targetServerTimeZone+"</div>";
													}
													else
													{
														sbData.append("<td wrap valign=\"middle\" align=\"left\"  style=\"width:93px;padding:3px;text-wrap:suppress\" class=\"x-grid-cell \"><div class=\"x-grid-cell-inner\"  style=\"width:93px;\">"+val1.trim()+"</div></td>");
														val1 = "<div class=\"x-grid-cell-inner\">"+val1.trim()+"</div>";
													}
													//val1 = val1.trim()+" "+targetServerTimeZone;
												}
												else if(len == columnNamesList.indexOf("COOKIES"))
												{
													try{
														if (val1.equals("-") || val1.equalsIgnoreCase("N/A"))
														{
															val1 = "-";
															sbData.append("<td wrap valign=\"middle\" align=\"left\"  style=\"padding:3px;text-wrap:suppress\" class=\"x-grid-cell \"><div class=\"x-grid-cell-inner\">"+val1.trim()+"</div></td>");
															val1 = "<div class=\"x-grid-cell-inner\">"+val1.trim()+"</div>";
														}
														else
														{
															StringTokenizer cookieToken = new StringTokenizer(val1,";");
															
															sbData.append("<td wrap valign=\"middle\" align=\"left\"  style=\"padding:3px;text-wrap:suppress\" class=\"x-grid-cell \"><div class=\"x-grid-cell-inner\"><img id='html_img_cookie_"+gr_l+"' src=\"/final/images/clear.png\" onclick=\"javascript:gridColExpand('iconTreeCollapse','cookie_"+gr_l+"')\" class=\"iconTreeExpand\" style=\"vertical-align:bottom;margin-right:5px\"><div style=\"visibility:hidden;display:block;height:0px;\" id=\"html_cookie_"+gr_l+"\"><table  style=\"table-layout:auto;font-size:11px;padding:5;\"   class=\"jtm_SubCompTable\"><tr> <th nowrap  style=\"padding:5;\"  align=\"left\"  valign=\"top\">"+mappingInfo.getTextDescription("monitor.detaileddiagnosis.Name")+"</th> <th nowrap style=\"padding:5;\"  align=\"left\"  valign=\"top\">"+mappingInfo.getTextDescription("monitor.detaileddiagnosis.Value")+"</th> </tr>");
															
															val1 ="<img id='img_cookie_"+gr_l+"' src=\"/final/images/clear.png\" onclick=\"javascript:gridColExpand('iconTreeCollapse','cookie_"+gr_l+"')\" class=\"iconTreeExpand\" style=\"vertical-align:bottom;margin-right:5px\"><div style=\"visibility:hidden;display:block;height:0px;\" id=\"cookie_"+gr_l+"\"><table style=\"table-layout:auto;font-size:11px;padding:5;\" class=\"jtm_SubCompTable\"><tr> <th nowrap style=\"padding:5;\"  align=\"left\"  valign=\"top\">"+mappingInfo.getTextDescription("monitor.detaileddiagnosis.Name")+"</th> <th nowrap style=\"padding:5;\" align=\"left\"  valign=\"top\">"+mappingInfo.getTextDescription("monitor.detaileddiagnosis.Value")+"</th> </tr>";
															
															while(cookieToken.hasMoreTokens())
															{
																try{
																	String cookie = cookieToken.nextToken();
																	String cookieKey = "-";
																	String cookieValue = "-";
																	if(cookie != null) {
																		if(cookie.indexOf('=') > -1){
																			cookieKey = cookie.substring(0,cookie.indexOf('='));
																			cookieValue = cookie.substring(cookie.indexOf('=')+1);
																		} else {
																			cookieKey = cookie;
																		}
																	}
																	sbData.append("<tr>");
																	val1+="<tr>";
																	sbData.append("<td wrap valign=\"top\"  align=\"left\" style=\"padding:3px;text-wrap:suppress;padding-left: 10px;\" ><div class=\"x-grid-cell-inner\">"+cookieKey.trim()+"</div></td>");
																	val1 +="<td wrap valign=\"top\"  align=\"left\" style=\"padding:3px;text-wrap:suppress;padding-left: 10px;\" ><div class=\"x-grid-cell-inner\">"+cookieKey.trim()+"</div></td>";
																	// if value isnt exist, making it as empty.
																	if(cookieValue != null && cookieValue.length() == 0)
																		cookieValue = "-";

																	cookieValue = cookieValue.trim();
																	cookieValue = StringUtils.replace(cookieValue,"#~#","");

																	sbData.append("<td wrap valign=\"top\"  align=\"left\" style=\"padding:3px;text-wrap:suppress;padding-left: 10px;\"><div class=\"x-grid-cell-inner\">"+cookieValue.trim()+"</div></td>");
																	val1 +="<td wrap valign=\"top\"  align=\"left\" style=\"padding:3px;text-wrap:suppress;padding-left: 10px;\"><div class=\"x-grid-cell-inner\">"+cookieValue.trim()+"</div></td>";
																}catch(Exception ccokeEx){

																}
															}
															val1 +="</table></div>";
															sbData.append("</table></div></div></td>");
														}
													}
													catch(Exception ex)
													{
														System.err.println("Exception while processing Cookies values...");
														ex.printStackTrace();
													}
												}
												else if(len == columnNamesList.indexOf("HEADER"))
												{
													try{
														if (val1.equals("-") || val1.equalsIgnoreCase("N/A"))
														{
															val1 = "-";
															sbData.append("<td wrap valign=\"middle\" align=\"left\"  style=\"padding:3px;text-wrap:suppress\" class=\"x-grid-cell \"><div class=\"x-grid-cell-inner\">"+val1.trim()+"</div></td>");
															val1 = "<div class=\"x-grid-cell-inner\">"+val1.trim()+"</div>";
														}
														else
														{
															StringTokenizer headerToken = new StringTokenizer(val1,"#~#");
															sbData.append("<td wrap valign=\"middle\" align=\"left\"  style=\"padding:3px;text-wrap:suppress\" class=\"x-grid-cell \"><div class=\"x-grid-cell-inner\"><img id='html_img_header_"+gr_l+"' src=\"/final/images/clear.png\" onclick=\"javascript:gridColExpand('iconTreeCollapse','header_"+gr_l+"')\" class=\"iconTreeExpand\" style=\"vertical-align:bottom;margin-right:5px\"><div style=\"visibility:hidden;display:block;height:0px;\" id=\"html_header_"+gr_l+"\"><table style=\"table-layout:auto;font-size:11px;padding:5;\" class=\"jtm_SubCompTable\"><tr> <th nowrap style=\"padding:5;\" align=\"left\"  valign=\"top\">"+mappingInfo.getTextDescription("monitor.detaileddiagnosis.Name")+"</th> <th nowrap style=\"padding:5;\"  align=\"left\"  valign=\"top\">"+mappingInfo.getTextDescription("monitor.detaileddiagnosis.Value")+"</th> </tr>");

															val1 ="<img id='img_header_"+gr_l+"' src=\"/final/images/clear.png\" onclick=\"javascript:gridColExpand('iconTreeCollapse','header_"+gr_l+"')\" class=\"iconTreeExpand\" style=\"vertical-align:bottom;margin-right:5px\"><div style=\"visibility:hidden;display:block;height:0px;\" id=\"header_"+gr_l+"\"><table style=\"table-layout:auto;font-size:11px;padding:5;\" class=\"jtm_SubCompTable\"><tr> <th nowrap style=\"padding:5;\" align=\"left\"  valign=\"top\">"+mappingInfo.getTextDescription("monitor.detaileddiagnosis.Name")+"</th> <th nowrap style=\"padding:5;\"  align=\"left\"  valign=\"top\">"+mappingInfo.getTextDescription("monitor.detaileddiagnosis.Value")+"</th> </tr>";
															
															while (headerToken.hasMoreTokens())
															{
																try
																{
																	String header = headerToken.nextToken();
																	String key = "-";
																	String value = "-";
																	if(header != null) {
																		if(header.indexOf('=') > -1){
																			key = header.substring(0,header.indexOf('='));
																			value = header.substring(header.indexOf('=')+1);
																		} else {
																			key = header;
																		}
																	}
																	if (value != null && value.length() == 0)// if value isnt present, making it as empty.
																		value = "-";
																	
																	sbData.append("<tr><td wrap valign=\"top\"  align=\"left\" style=\"padding:3px;text-wrap:suppress;padding-left: 10px;\"><div class=\"x-grid-cell-inner\">"+key.trim()+"</div></td>");
																	sbData.append("<td wrap valign=\"top\"  align=\"left\" style=\"padding:3px;text-wrap:suppress;padding-left: 10px;\"><div class=\"x-grid-cell-inner\">"+value.trim()+"</div></td></tr>");
																	val1 +="<tr><td wrap valign=\"top\"  align=\"left\" style=\"padding:3px;text-wrap:suppress;padding-left: 10px;\"><div class=\"x-grid-cell-inner\">"+key.trim()+"</div></td>";
																	val1 +="<td wrap valign=\"top\"  align=\"left\" style=\"padding:3px;text-wrap:suppress;padding-left: 10px;\"><div class=\"x-grid-cell-inner\">"+value.trim()+"</div></td></tr>";
																}catch(Exception eeeheader){
																	//eeeheader.printStackTrace();
																}
																
															}
															sbData.append("</table></div></div></td>");
															val1+="</table></div>";
															//System.out.println("Header ... "+val1);
														}
													}
													catch(Exception ex)
													{
														System.err.println("Exception while processing Header values...");
														ex.printStackTrace();
													}
												}
												else if(index_arr.contains(len))
												{
													sbData.append("<td wrap valign=\"middle\" align=\"left\"  style=\"padding:3px;text-wrap:suppress;display:none\" class=\"x-grid-cell \"><div class=\"x-grid-cell-inner\">"+val1.trim()+"</div></td>");

													val1 = "<div class=\"x-grid-cell-inner\">"+val1.trim()+"</div>";
												}
												else
												{
													sbData.append("<td wrap valign=\"middle\" align=\"left\"  style=\"padding:3px;text-wrap:suppress\" class=\"x-grid-cell \"><div class=\"x-grid-cell-inner\">"+val1.trim()+"</div></td>");

													val1 = "<div class=\"x-grid-cell-inner\">"+val1.trim()+"</div>";
												}
											}
										}
										else
										{
											String strg = colNamesForQuery;
											ArrayList columnNamesList = new ArrayList();
											StringTokenizer stkr = new StringTokenizer(strg, ","); 
											while(stkr.hasMoreTokens())
											{
												columnNamesList.add(stkr.nextToken());
											}
											if(columnNamesList.contains("PAGETYPE"))
											{
												int tempLen = columnNamesList.indexOf("PAGETYPE");
												String tempVal = (String) al_cols.get(tempLen);												
												if(tempVal.equalsIgnoreCase("Virtual Page"))
												{
													isVirtualPage = true;
													
													int lenTemp = columnNamesList.indexOf("STATUS");
													String val1Temp = (String) al_cols.get(lenTemp);
													if(val1Temp.equals("error"))
													{
														isErrorStatusPage = true;
													}
												}
											}
											if(len == columnNamesList.indexOf("REQUEST_TIME_ZONE"))
											{
												if(val1.indexOf(";")>-1)
													val1=val1.substring((val1.lastIndexOf(";")+1));
											}
											if(len == columnNamesList.indexOf("GUID"))
											{
												guidStr = val1.trim();
												imageColum = true;
												imageColValue =  null;
												String overallExperience = null;
												String pageType = null;
												/*String overallExpQuery = "Select RUM_USER_EXP from RUM_DETAILS where GUID = '"+val1.trim()+"'";
												String overallExperience = getOverallExperienceForRum(overallExpQuery);*/
												String overallExpQuery = "Select RUM_USER_EXP,PAGETYPE from RUM_DETAILS where GUID = '"+val1.trim()+"'";
												String queryResult = dd.getOverallExperienceForRum(overallExpQuery);
												if (queryResult.indexOf(":")>-1)
												{
													overallExperience = queryResult.substring(0,queryResult.indexOf(":"));
													pageType = queryResult.substring(queryResult.indexOf(":")+1);
												}
												if(overallExperience != null)
												{
													if(overallExperience.equalsIgnoreCase("healthy"))
													{
														imageColValue = "healthy";
													}
													else if(overallExperience.equalsIgnoreCase("slow"))
													{
														imageColValue = "slow";
													}
													else if(overallExperience.equalsIgnoreCase("error"))
													{
														imageColValue = "error";
													}
												}
												if(val1.trim().equalsIgnoreCase("Healthy"))
												{
													//val1="<div data-qtip=' Healthy ' class=\"state_Normal\"></div>";
												}
												if(val1.trim().equalsIgnoreCase("Slow"))
												{
													//val1="<div data-qtip=' Slow ' class=\"state_Slow\"></div>";
												}
												if(val1.trim().equalsIgnoreCase("Error"))
												{
													//val1="<div data-qtip=' Error ' class=\"state_Error\"></div>";
												}
													//val1 = "<div style=\"white-space:normal!important;width:105px\"><a onclick= \"javascript:rumTopologyBuild('"+val1.trim()+"','"+s_test+"')\" href=\"javascript:void(0)\"> "+"<img  src=\"/final/images/clear.png\"   class=\"btm_rum_dd_icons_"+imageColValue+"\"> <span class=\"btmrum_status\">"+imageColValue+"</span><img data-qtip=\"Drilldown into RUM Topology\" data-qclass=\"yellowTip\" src=\"/final/images/clear.png\" class='iconDiagnosis' style=\"margin-left:5px;margin-top:2px;vertical-align:middle\"></a></div>";

													if(isVirtualPage && !isErrorStatusPage){
														val1 = "<div style=\"white-space:normal!important;width:120px\" data-guid='"+val1.trim()+"'> "+"<img  src=\"/final/images/clear.png\" class=\"btm_rum_dd_icons_"+imageColValue+"\"> <span class=\"btmrum_status\">"+imageColValue+"</span></div>";
													}
													else if(isErrorStatusPage)
													{
														val1 = "<div style=\"white-space:normal!important;width:120px\"><a onclick= \"javascript:rumErrorStatusDD('"+val1.trim()+"','"+s_test+"','"+guidStr+"')\" href=\"javascript:void(0)\"> "+"<img  src=\"/final/images/clear.png\"   class=\"btm_rum_dd_icons_"+imageColValue+"\"> <span class=\"btmrum_status\">"+imageColValue+"</span><img data-qtip=\"RUM Error status DD\" data-qclass=\"yellowTip\" src=\"/final/images/clear.png\" class='iconDiagnosis' style=\"margin-left:5px;margin-top:2px;vertical-align:middle\"></a></div>";
													}
													else{
														val1 = "<div style=\"white-space:normal!important;width:120px\"><a onclick= \"javascript:rumTopologyBuild('"+val1.trim()+"','"+s_test+"')\" href=\"javascript:void(0)\"> "+"<img  src=\"/final/images/clear.png\"   class=\"btm_rum_dd_icons_"+imageColValue+"\"> <span class=\"btmrum_status\">"+imageColValue+"</span><img data-qtip=\"Drilldown into RUM Topology\" data-qclass=\"yellowTip\" src=\"/final/images/clear.png\" class='iconDiagnosis' style=\"margin-left:5px;margin-top:2px;vertical-align:middle\"></a></div>";
													}
											}
											
											String tableFormat_req_chk = formatIniFile1.getValue("APPLY_TABLE_FORMAT_DD_COLUMN", s_test + ":" + s_mes);
											String tableFormat_sep = formatIniFile1.getValue("APPLY_TABLE_FORMAT_DD_COLUMN_HEADER", s_test + ":" + s_mes+":Separator");
											String tableFormat_header = formatIniFile1.getValue("APPLY_TABLE_FORMAT_DD_COLUMN_HEADER", s_test + ":" + s_mes+":Header");
											String tableExt_req_chk = externalIniFile1.getValue("SNMP_Tests", s_test);
											boolean withoutTableBorder=false;
											boolean headerEnabled=false;
											//if(s_test!=null && s_test.equals("NetworkTrapTest"))
											if(tableExt_req_chk!=null && (tableExt_req_chk.equalsIgnoreCase("true") || tableExt_req_chk.equalsIgnoreCase("yes")))
											{
												withoutTableBorder=true;
											}
											
											if(val1!=null && !tableFormat_req_chk.trim().equalsIgnoreCase("null") && !tableFormat_req_chk.equals("")&& val1.indexOf(tableFormat_req_chk)>-1)
											{
												ArrayList val1_tok = com.egurkha.util.StringUtils.egTokenizer(val1.trim(),tableFormat_req_chk,false,false,true);
												//Inner table code starts
												if(val1_tok.size()>0) 
												{
													String table_val1 = "";
													if(withoutTableBorder)
													{
														table_val1="<div style=\"border:0px solid #000000\"><table cellspacing='0' cellpadding='0' width='100%'><tbody>";
														for (int s = 0;s<val1_tok.size();s++)
														{
															String val1_tmp =(String)val1_tok.get(s);

															ArrayList val1_tmp_tok = com.egurkha.util.StringUtils.egTokenizer(val1_tmp.trim(),"=",false,false,true);
															if(val1_tmp_tok!=null && val1_tmp_tok.size()>1)
															{
																StringBuffer all_val_tmp=new StringBuffer(128);
																for (int vtt = 0;vtt<val1_tmp_tok.size();vtt++)
																{
																	String val1_tmp_val =(String)val1_tmp_tok.get(vtt);
																	if(val1_tmp_val!=null && val1_tmp_val.trim().length()>0)
																	{
																		if(vtt==(val1_tmp_tok.size()-1))
																		{
																			all_val_tmp.append("<td width='300' style='white-space:normal;word-break:break-all;vertical-align:top;font-size:11px;line-height:20px!important'>"+val1_tmp_val.trim()+"</td>");
																		}
																		else
																		{
																			all_val_tmp.append("<td style='white-space:normal;word-break:break-all;vertical-align:top;padding-right:15px;font-size:11px;line-height:20px!important'>"+val1_tmp_val.trim()+"</td>");
																		}
																	}
																}

																if(all_val_tmp!=null)
																{
																	val1_tmp="<table width='100%' border='0'><tbody><tr style='background:none !important;white-space:wrap'>"+all_val_tmp.toString()+"</tr></tbody></table>";
																}
															}

															table_val1+="<tr style='background:none !important;white-space:wrap'>";
																table_val1+="<td wrap valign=\"top\" align=\"left\"  style=\"padding:3px;text-wrap:suppress;padding-left: 10px;\" >"+val1_tmp.trim()+"</td>";
															table_val1+="</tr>";
														}
														table_val1+="</tbody></table></div>";
													}
													else
													{
														table_val1="<div class=\"newTable\" ><table width='100%'>";

														if(tableFormat_header!=null && tableFormat_header.trim().length()>0 && (!headerEnabled))
														{
															ArrayList tblHea = com.egurkha.util.StringUtils.egTokenizer(tableFormat_header.trim(),tableFormat_sep,false,false,true);
															if(tblHea!=null && tblHea.size()>0)
															{
																table_val1+="<thead>";
																for(int ss=0;ss<tblHea.size();ss++)
																{
																	String tbl_head =(String)tblHea.get(ss);
																	table_val1+="<th wrap valign=\"top\" align=\"left\"  style=\"padding:3px;text-wrap:suppress;padding-left: 10px;\" >"+tbl_head.trim().toUpperCase()+"</th>";
																}
																table_val1+="</thead>";
																headerEnabled = true;
															}
														}
														table_val1+="<tbody>";
														for (int s = 0;s<val1_tok.size();s++)
														{
															String val1_tmp =(String)val1_tok.get(s);
															if(tableFormat_sep!=null && tableFormat_sep.trim().length()>0)
															{
																ArrayList tblVal = com.egurkha.util.StringUtils.egTokenizer(val1_tmp.trim(),tableFormat_sep,false,false,true);
																if(tblVal!=null && tblVal.size()>0)
																{
																	table_val1+="<tr style='white-space:wrap'>";
																	for(int ss=0;ss<tblVal.size();ss++)
																	{
																		String tbl_value =(String)tblVal.get(ss);
																		table_val1+="<td wrap valign=\"top\" align=\"left\"  style=\"padding:3px;text-wrap:suppress;padding-left: 10px;\" >"+tbl_value.trim()+"</td>";
																	}
																	table_val1+="</tr>";
																	headerEnabled = true;
																}
															}
															else
															{
																table_val1+="<tr style='white-space:wrap'>";
																	table_val1+="<td wrap valign=\"top\" align=\"left\"  style=\"padding:3px;text-wrap:suppress;padding-left: 10px;\" >"+val1_tmp.trim()+"</td>";
																table_val1+="</tr>";
															}
														}
														table_val1+="</tbody></table></div>";
													}
													val1=table_val1;
												}
												else
												{
													val1=val1;
												}
											} //Inner table code ended
												
											sbData.append("<td wrap valign=\"top\" align=\"left\"  style=\"padding:3px;text-wrap:suppress;padding-left: 10px;\" class=\"x-grid-cell \">"+val1.trim()+"</td>");
										}
									}
									recObj.put(len+"col",val1);
									recObj_mobile.put("col"+len,val1);
								}
							
								if(imageColValue == null)
									vec_Tabletitle.add("\" "+val1.trim()+"\"");
								else
									vec_Tabletitle.add("\" "+imageColValue.trim()+"\"");
								
							}
						}
						else
						{
							//StringTokenizer stdd=new StringTokenizer(al_cols_str,"~!~");
							ArrayList stdd = com.egurkha.util.StringUtils.egTokenizer(al_cols_str, "~!~",true,false,true);//3-->includeEmpty,4-->unique,5-->trim
							//while(stdd.hasMoreTokens())
							for (int k = 0;k<stdd.size();k++)
							{
								String val1 =(String)stdd.get(k);
								val1=EgDbInfo.formatValue(val1)	;
								val1=val1.trim();
								if (val1 != null && val1.trim().equals("") )
									val1="-";
								else if(val1 != null && val1.trim().equals("-5.0000"))
								{
									val1 = "N/A";
								}
								if(val1 != null && !val1.equalsIgnoreCase("!H"))
								{
									if(val1.startsWith("<") && val1.endsWith(">"))
									{
										val1=com.egurkha.util.StringUtils.replace(val1,"<","&lt;");
										val1=com.egurkha.util.StringUtils.replace(val1,">","&gt;");
									}
									else
									{
										if(val1.indexOf("<")>0)
										{
											val1=com.egurkha.util.StringUtils.replace(val1,"<","&lt;");
										}

										if(val1.indexOf(">")>0)
										{
											val1=com.egurkha.util.StringUtils.replace(val1,">","&gt;");
										}
									}

									// condition to truncate 0 decimals (ex -> 8.00 as 8)
									if(val1.endsWith(".0") || val1.endsWith(".00") || val1.endsWith(".000") || val1.endsWith(".0000"))
									{
										try
										{
											val1=String.valueOf(Double.parseDouble(val1));
											val1 = val1.substring(0,val1.lastIndexOf("."));
										}
										catch(Exception e)
										{
											val1=val1;
										}
										sbData.append("<td wrap style=\"width:70px;padding:3px\" valign=\"top\" align=\"left\"  class=\"x-grid-cell\"><div class=\"x-grid-cell-inner\">"+val1+"</div></td>");
									}
									recObj.put(k+"col",val1);
									recObj_mobile.put("col"+k,val1);

									if(val1!=null && val1.indexOf(",")>-1)
										val1="\""+val1+"\"";
								}
							}
						}
						dataArray1.add(recObj);
						dataArray_mobile.add(recObj_mobile);  
						sbData.append("</tr><tr class=\"DDBginnerOdd\">");
						gr_l++;
					}
				}
				if(!isFromAlarmDetails)
				{
					session.setAttribute("a_results",a_results.clone());
					session.setAttribute("nresults",a_results.clone());
					session.setAttribute("al_cols",al_cols);
					session.setAttribute("al_header",al_header);
					session.setAttribute("pdf_header",pdfHeaders);
					session.setAttribute("colNamesForQuery",colNamesForQuery);
					session.setAttribute("skipindex",index_arr);

					if(isFooterText)
					{
						session.setAttribute("PDFfooterText",footerTxt);
						System.out.println("footerTxt--dd->>>"+footerTxt);
					}
					else
						session.removeAttribute("PDFfooterText");
				}
			}	// End of top for loop
			if(ctxDataArr1.size()>0)
				diagnosisData.put("ctxDataArr",ctxDataArr1);

			diagnosisData.put("filterBy",filterBy1);
			diagnosisData.put("vec_Tabletitle",vec_Tabletitle);
			diagnosisData.put("isSSTest",new Boolean(isSSTest));
		
			diagnosisData.put("data",dataArray1);
			if(dataArray_mobile!=null && dataArray_mobile.size()>0)
				diagnosisData.put("data_mobile",dataArray_mobile);
			if(isFooterText)
				diagnosisData.put("footerText",footerTxt);
		}
		catch(Throwable ttt)
		{
			ttt.printStackTrace();
		}
		return diagnosisData;
	}

	public JSONArray getFilterJson(User user,EgMappingInfo mappingInfo,EgTimeZoneConverter timeZoneConverterStart,EgTimeZoneConverter timeZoneConverterEnd,String timeLine,String s_st_time,String comFormat,String dateFormatForDatePick,String dispDate,String s_st_hr,String s_st_min,String startDateForDisplay,String startHourForDisplay,String startMinForDisplay,String s_en_time,String s_en_hr,String s_end_min,String endDateForDisplay,String endHourForDisplay,String endMinForDisplay,String[] options)
	{
		JSONArray resultObj  = new JSONArray(); 
		JSONObject timelineFilterObj  = new JSONObject();
		timelineFilterObj.put("name",mappingInfo.getTextDescription("monitor.common.Timeline"));
		timelineFilterObj.put("id","timeline");
		timelineFilterObj.put("type","combo");
		JSONArray  timeLineComboValues = new JSONArray();
		for(int e_ctr=0; e_ctr < options.length;e_ctr++)
		{
			if(timeLine!=null&&timeLine.equals((String)options[e_ctr]))
			{
				String tempOptions="";
				String tempOptions2="";
				if(timeLine.indexOf(" ")>-1)
				{
					tempOptions2=timeLine.substring(0,timeLine.indexOf(" "))+" ";
					tempOptions=timeLine.substring(timeLine.indexOf(" ")+1);
				}
				else
				{
					tempOptions=timeLine;
				}
				JSONObject timelineOption = new JSONObject();
				timelineOption.put("name",tempOptions2+mappingInfo.getTextDescription("monitor.common."+tempOptions));
				timelineOption.put("value",timeLine);
				timelineFilterObj.put("selectedValue",timeLine);
				timeLineComboValues.add(timelineOption);
			}
			else
			{
				String tempOptions="";
				String tempOptions2="";
				if(options[e_ctr].indexOf(" ")>-1)
				{
					tempOptions2=options[e_ctr].substring(0,options[e_ctr].indexOf(" "))+" ";
					tempOptions=options[e_ctr].substring(options[e_ctr].indexOf(" ")+1);
				}
				else
				{
					tempOptions=options[e_ctr];
				}
				JSONObject timelineOption = new JSONObject();
				timelineOption.put("name",tempOptions2+mappingInfo.getTextDescription("monitor.common."+tempOptions));
				timelineOption.put("value",options[e_ctr]);
				timeLineComboValues.add(timelineOption);
			}

		}
		timelineFilterObj.put("options",timeLineComboValues);
		resultObj.add(timelineFilterObj);
		
		JSONObject fromDateFilter = new JSONObject();
		fromDateFilter.put("type","date");
		fromDateFilter.put("name",mappingInfo.getTextDescription("monitor.common.From"));
		fromDateFilter.put("id","fromdate");
		if(s_st_time!=null && !s_st_time.equals(""))
		{
			if(DateUtil.isDate(s_st_time,"MM/dd/yyyy"))
			{
				comFormat ="MM/dd/yyyy";
			}
			else
			{
				comFormat = dateFormatForDatePick;
			}
			//fromDateFilter.put("format",currentDateFormat);
			fromDateFilter.put("format",dateFormatForDatePick);
			fromDateFilter.put("time",s_st_time);
			
			//dispDate = DateUtil.changeDateFormat(s_st_time,comFormat,currentDateFormat);
			dispDate = DateUtil.changeDateFormat(s_st_time,comFormat,dateFormatForDatePick);
			//s_st_time = dispDate;
			timeZoneConverterStart = new EgTimeZoneConverter(dispDate+" "+s_st_hr+":"+s_st_min+":"+"00",user);
			startDateForDisplay = (String) timeZoneConverterStart.getDate(false);
			startHourForDisplay = timeZoneConverterStart.getHour();
			startMinForDisplay = timeZoneConverterStart.getMinute();
			//dispDate = DateUtil.changeDateFormat(startDateForDisplay,comFormat,currentDateFormat);
			dispDate = DateUtil.changeDateFormat(startDateForDisplay,comFormat,dateFormatForDatePick);
			s_st_time = dispDate;
			s_st_hr = startHourForDisplay;
			s_st_min = startMinForDisplay;
			fromDateFilter.put("selectedValue",dispDate);
		}
		else
		{
			dispDate = "";
		}
		resultObj.add(fromDateFilter);
		
		JSONObject fromHrFilter = new JSONObject();
		fromHrFilter.put("type","combo");
		fromHrFilter.put("name",mappingInfo.getTextDescription("monitor.common.Hr"));
		fromHrFilter.put("id","fromHr");
		JSONArray  fromHrOptions = new JSONArray();
		int i_tmp = Integer.parseInt(startHourForDisplay);
		for(int ctr=0; ctr < 24 ;ctr++)
		{
			JSONObject fromHrOption = new JSONObject();
			fromHrOption.put("name",ctr);
			fromHrOption.put("value",ctr);
			fromHrOptions.add(fromHrOption);
			if(ctr==i_tmp){
				fromHrFilter.put("selectedValue",ctr);
			}
		}
		fromHrFilter.put("options",fromHrOptions);
		resultObj.add(fromHrFilter);
		
		JSONObject fromMinFilter = new JSONObject();
		fromMinFilter.put("type","combo");
		fromMinFilter.put("name",mappingInfo.getTextDescription("monitor.common.Min"));
		fromMinFilter.put("id","fromMin");
		JSONArray  fromMinOptions = new JSONArray();
		i_tmp = Integer.parseInt(startMinForDisplay);
		for(int ctr=0; ctr < 60 ;ctr++)
		{
			JSONObject fromMinOption = new JSONObject();
			fromMinOption.put("name",ctr);
			fromMinOption.put("value",ctr);
			fromMinOptions.add(fromMinOption);
			if(ctr==i_tmp){
				fromMinFilter.put("selectedValue",ctr);
			}
		}
		fromMinFilter.put("options",fromMinOptions);
		resultObj.add(fromMinFilter);
		
		JSONObject toDateFilter = new JSONObject();
		toDateFilter.put("type","date");
		toDateFilter.put("name",mappingInfo.getTextDescription("monitor.common.To"));
		toDateFilter.put("id","todate");
		if(s_en_time!=null && !s_en_time.equals(""))
		{
			if(DateUtil.isDate(s_en_time,"MM/dd/yyyy"))
			{
				comFormat = "MM/dd/yyyy";
			}
			else
			{
				comFormat = dateFormatForDatePick;
			}

			//toDateFilter.put("format",currentDateFormat);
			toDateFilter.put("format",dateFormatForDatePick);
			toDateFilter.put("time",s_en_time);
			//dispDate = DateUtil.changeDateFormat(s_en_time,comFormat,currentDateFormat);
			dispDate = DateUtil.changeDateFormat(s_en_time,comFormat,dateFormatForDatePick);
				//s_en_time = dispDate;
				//toDateFilter.put("selectedValue",dispDate);
			timeZoneConverterEnd = new EgTimeZoneConverter(dispDate+" "+s_en_hr+":"+s_end_min+":"+"00",user);
			endDateForDisplay = (String) timeZoneConverterEnd.getDate(false);
			endHourForDisplay = timeZoneConverterEnd.getHour();
			endMinForDisplay = timeZoneConverterEnd.getMinute();
			
			 //dispDate = DateUtil.changeDateFormat(endDateForDisplay,comFormat,currentDateFormat);
			 dispDate = DateUtil.changeDateFormat(endDateForDisplay,comFormat,dateFormatForDatePick);
			 s_en_time = dispDate;
			 s_en_hr = endHourForDisplay;
			 s_end_min = endMinForDisplay;
			 toDateFilter.put("selectedValue",dispDate);
		}
		else
		{
			dispDate = "";
		}
		resultObj.add(toDateFilter);
		
		JSONObject toHrFilter = new JSONObject();
		toHrFilter.put("type","combo");
		toHrFilter.put("name",mappingInfo.getTextDescription("monitor.common.Hr"));
		toHrFilter.put("id","toHr");
		JSONArray  toHrOptions = new JSONArray();
		i_tmp=Integer.parseInt(endHourForDisplay);
		for(int ctr=0; ctr < 24 ;ctr++)
		{
			JSONObject toHrOption = new JSONObject();
			toHrOption.put("name",ctr);
			toHrOption.put("value",ctr);
			toHrOptions.add(toHrOption);
			if(ctr==i_tmp){
				toHrFilter.put("selectedValue",ctr);
			}
		}
		toHrFilter.put("options",toHrOptions);
		resultObj.add(toHrFilter);
		
		JSONObject toMinFilter = new JSONObject();
		toMinFilter.put("type","combo");
		toMinFilter.put("name",mappingInfo.getTextDescription("monitor.common.Min"));
		toMinFilter.put("id","toMin");
		JSONArray  toMinOptions = new JSONArray();
		i_tmp = Integer.parseInt(endMinForDisplay);
		for(int ctr=0; ctr < 60 ;ctr++)
		{
			JSONObject toMinOption = new JSONObject();
			toMinOption.put("name",ctr);
			toMinOption.put("value",ctr);
			toMinOptions.add(toMinOption);
			if(ctr==i_tmp){
				toMinFilter.put("selectedValue",ctr);
			}
		}
		toMinFilter.put("options",toMinOptions);
		resultObj.add(toMinFilter);

		return resultObj;
	}

%>

<%
	try
	{
	int pages=0;
	int totalRecords=10000;


	int totalRecordsCount=0;

	session.removeAttribute("ctxdbMsmtTime");	
	session.removeAttribute("footerTxt");	

	String reqForCount = request.getParameter("isCountRecords");
	String reqType = request.getParameter("reqType");
	if(reqType==null)
		reqType="newReq";

	String maxNum = request.getParameter("maxNo");
	int maxNo=-1;
	if(maxNum==null || maxNum.equals("undefined"))
		maxNo = -1;
	else
	{
		try
		{
			maxNo = Integer.parseInt(maxNum.trim());
		}
		catch(NumberFormatException e)
		{
			maxNo = -1;
		}
	}
	String s_ct=request.getParameter("comptype");

	String totalRecordFromReq = request.getParameter("totalRecords");
	
	boolean isFromUserSession = false;
	ArrayList VDIComponentTypes = new ArrayList();
	String _isFromUserSession = request.getParameter("isFromUserSession");	
	IniFile formatIni = new IniFile(EgInstallInfo.getInstallDir()+ "/manager/config/eg_format.ini");
	if(_isFromUserSession != null && _isFromUserSession.equalsIgnoreCase("true")){
		IniFile externalIni = new IniFile(EgInstallInfo.getInstallDir()+ "/manager/config/eg_external.ini");
		String[] compVars = externalIni.getVariables("Virtual_Desktops");
		for(int k=0;k<compVars.length;k++){
			VDIComponentTypes.add(compVars[k]);
		}
		if(s_ct != null && VDIComponentTypes != null && VDIComponentTypes.contains(s_ct))
			isFromUserSession = true;
	}
	if(totalRecordFromReq==null || reqType.equalsIgnoreCase("newReq"))
		totalPagesDisp="Calculating total pages...";
	else
		totalPagesDisp = " of "+totalRecordFromReq;
	
	
	if(reqForCount==null){
		reqForCount="No";
		if(reqType.equals("newReq"))
		{
			recTotalCount=0;
			recTotalRecordCount=0;
			totalPagesDisp = "Calculating total pages...";
		}
	}
	String fromPageReport = request.getParameter("isFromReport");	

	boolean isForAllInfoReport = false;
	boolean needToHideDescriptorList = false;
	if(fromPageReport !=null && fromPageReport.trim().length()>0 && !fromPageReport.equalsIgnoreCase("NULL") && fromPageReport.equalsIgnoreCase("btmHealthTime")) 
		isForAllInfoReport = true;

	String uname=request.getParameter("uname");
	String fromMobile=request.getParameter("fromMobile");
	String csv=request.getParameter("csv");
	String pdf=request.getParameter("pdf");

	String isNewReq = request.getParameter("isNewReq");

	String tlineJsonOnly = request.getParameter("tlineJsonOnly");
		
		if(tlineJsonOnly==null)
			tlineJsonOnly = "No";
		String reqFrom=request.getParameter("reqFrom");
		session.removeAttribute("REPORT_NAME_Ack");
		IniUI ui = (IniUI)com.egurkha.ini.IniUI.getInstance();
		UserRegistry registry = UserRegistry.getInstance();
		User user = registry.getUser(session.getId());
		List vmTypes=new LinkedList();
		List serverTypes=new LinkedList();
		dd.setSessionID(session.getId());
		String thisLanguage = ui.getDefaultLanguage();
		MappingNameSorter sorter = new MappingNameSorter(thisLanguage);
		List a_userVMs = new LinkedList();
		EgUserRole userRole = null;
		boolean hasAllCompAccess = false;
		boolean isMobileCall=false;
		boolean id_u = false;
		String u_rs = null;
		long u_v_till = 0L;
		long l_accessed = 0L;	
		/**
			 Operation - Mobile check
			 Purpose - Support for accessing the manager via mobile.
			 Author - Praveen 8/4/2014
	**/
	if (fromMobile!=null && fromMobile.equals("yes"))
	{
		%>
		<%@ page import="egurkha.reporter.ErUserData"%>
		<%
			ErUserData userData = new ErUserData(uname,false);
			if(userData!=null)
			{
				user=userData.usr;
				if(user==null)
				{
					user = userData.getUser(uname);
				}
			}
			isMobileCall=true;
	}
	else
	{
		userRole = user.getUserRole();
		String userLang = user.getLanguage();
		if (userLang!=null && !userLang.equalsIgnoreCase("NULL"))
		{
			thisLanguage=userLang;
		}
		String  script_src="script_item_"+thisLanguage+".js";
		if(user!=null)
		{
			id_u = user.isIdDeletedWhileLoggedIn();
			if(id_u == false)
			{
				u_rs =  user.getLoginID();
				if(!User.isDefaultUser(u_rs))
				{
					ErUserData er = user.getReporterData();
					u_v_till = er.getUserValidtill();
					l_accessed = session.getLastAccessedTime();
				}
			}
		}
		if(session == null || user == null)
			{
				throw new Exception("<customerror>user-session-invalid</customerror>");
			}
		else if(id_u== true)
			{
				throw new Exception("<customerror>user-deleted</customerror>");
			}
		else if (u_v_till < l_accessed)
			{
				throw new Exception("<customerror>user-timedout</customerror>");
			}
		if(!hasAllCompAccess)
			a_userVMs = user.getAlluserDesktopVms();
			//a_userVMs = user.getOnlyVMs();
	}
	/*moved here to avoid user null pointer exception in mobile
	10-09-2015 updated by Pandiyaraja R*/
	vmTypes=(LinkedList)user.getOnlyVMTypes();
	serverTypes=(LinkedList)user.getServerTypes();
	EgMappingInfo mappingInfo = new EgMappingInfo(thisLanguage);
	List listData = new LinkedList();
	listData.add(mappingInfo.getTextDescription("monitor.csv.Detailed Diagnosis"));
	listData.add(" ");
	EgDateInfo dateInfo = new EgDateInfo();
	java.util.Date local_date = new java.util.Date(dateInfo.egetUTCDate());
	Calendar cal = Calendar.getInstance();
	cal.setTime(local_date);
	cal.setTimeZone(dateInfo.getRealTimeZone());
		
	Vector vec_Tabletitle = new Vector();
	Vector f_vec = new Vector();
	Hashtable sen=new Hashtable();
	List lst_DispData = new LinkedList();
	String title="";
	int tokCount = 0;
	String s_status = "";
	String s_format = "";
	String s_desc = "";
	String s_strTok = "";
	String s_host,s_port,s_test,s_info,s_msmt_host,s_mes,s_st_time,s_st_hr,s_en_time,s_en_hr,s_st_min,s_end_min,s_st_sec,s_end_sec,s_first_time,s_from,s_flag;

	String agg_function_img_path="";
	String s_detl_meas = "";
	String s_measure = "";
	String s_firstInfo = "";
	String s_secondInfo = "";
	proceed = false;
	Vector v_measures = new Vector();
	ArrayList a_results = new ArrayList();
	ArrayList a_option_results = new ArrayList();
	a_temp = new ArrayList();
	ArrayList ar_det_measures = new ArrayList();
	ArrayList al_cols = new ArrayList();
	ArrayList al_header = new ArrayList();
	ArrayList index_arr = new ArrayList();
	ArrayList pdfHeaders = new ArrayList();

	StringTokenizer st = null;
	ResultSet rs = null;
	boolean isJvmCpuTest = false;
	boolean isVM = false;
	isJavaTransactionsTest = false;
	isAPMTest = false;

	boolean isSortEnabledTest = false;

	EgTesterInfo testInfo = new EgTesterInfo("manager");
	EgTestInfo tokInfo = new EgTestInfo("manager");
	EgDbInfo dbInfo = new EgDbInfo("manager");
	EgDateInfo edi = new EgDateInfo();
	EgDiscInfo discInfo=new EgDiscInfo("manager");
	EgAgentInfo agentInfoo = new EgAgentInfo("manager");		

	//Added new font style for double byte manager PDF.
	String fontStyle = "";
	if ((dbInfo.doubleByteEnabled || !thisLanguage.equals("en_US")))
	{
		fontStyle = "multi_font";
	}

	EgTimeZoneConverter timeZoneConverterStart=null;
	EgTimeZoneConverter timeZoneConverterEnd=null;
	String startDateForDisplay = null;
	String startHourForDisplay = null;
	String endDateForDisplay = null;
	String endHourForDisplay = null;
	String startMinForDisplay=null;
	String endMinForDisplay=null;

	Vector dddTestList=new Vector();
	String formatFile = "eg_format.ini";
	String format_iniFile_dir = EgInstallInfo.getInstallDir()+ "/manager/config/";
	IniFile formatIniFile = new IniFile(format_iniFile_dir + formatFile);
	

	String sim_type = formatIniFile.getValue("SIMULATION","Types");
	ArrayList simTypeList = new ArrayList();
	if(sim_type != null && sim_type.trim().length() > 0)
		simTypeList =  com.egurkha.util.StringUtils.egTokenizer(sim_type.trim(),",",true,false,true);//param 3-->includeEmpty,4-->unique,5-->trim

	ArrayList encodeTestList = new ArrayList();
	String encodeTestValues = formatIniFile.getValue("Encrypt_DDTests","Tests");
	if(encodeTestValues != null && encodeTestValues.trim().length() > 0){
		encodeTestList = com.egurkha.util.StringUtils.egTokenizer(encodeTestValues, ",", true,false,true);
	}

	ArrayList dbRows = new ArrayList();
	String dbRowsBased = formatIniFile.getValue("DD_DISPLAY","BasedOnDBRowsTests");
	if(dbRowsBased != null && dbRowsBased.trim().length() > 0){
		dbRows = com.egurkha.util.StringUtils.egTokenizer(dbRowsBased, ",", true,false,true);
	}
	
	boolean isBasedOnDbRows = false;
	s_test = request.getParameter("test");
	
	if(dbRows != null && s_test != null && dbRows.contains(s_test))
		isBasedOnDbRows=true;

	String pageSizeFromIni = "10";	
	if(s_test != null && s_test.trim().length() > 0 && !isBasedOnDbRows)
		pageSizeFromIni = formatIniFile.getValue("DD_DISPLAY_RECORDS",s_test);	

	if(isBasedOnDbRows)
	{
		pageSizeFromIni = formatIniFile.getValue("DD_DISPLAY",s_test);
		if(pageSizeFromIni == null || pageSizeFromIni.trim().length() == 0)
			pageSizeFromIni = formatIniFile.getValue("DD_DISPLAY","RecordsPerpage");	
	}
	if(pageSizeFromIni == null || pageSizeFromIni.trim().length() == 0)
		pageSizeFromIni="10";
	
	boolean isSSTest = false;
	String ss_dd_handled = formatIniFile.getValue("SS_DD_Handled","Tests");
	ArrayList ss_dd_tests = null;
	if(ss_dd_handled != null && ss_dd_handled.trim().length() > 0 )
		ss_dd_tests =  com.egurkha.util.StringUtils.egTokenizer(ss_dd_handled.trim(),",",true,true,true);//param 3-->includeEmpty,4-->unique,5-->trim
	
	if(s_test != null && ss_dd_tests != null && ss_dd_tests.contains(s_test))
		isSSTest = true;

	int pageSize = 0;
	try
	{
		pageSize = Integer.parseInt(pageSizeFromIni.trim());
	}
	catch(Exception e)
	{
		pageSize = 10;
		e.printStackTrace();		
	}

	String pageNoReq = request.getParameter("pageNo");

	String recordsTotal  =request.getParameter("totalRecords");

	try
	{
		totalRecords = Integer.parseInt(recordsTotal.trim());
	}
	catch(Exception e)
	{
		totalRecords = 0;
	}
	
	
	
	
	if(pageNoReq==null || pageNoReq.trim().length()==0)
		pageNoReq = "1";
		
		int pageNo = 1;
		//pageSize=10;
		int pageStartIndex = 0;
		try
		{
			pageNo = Integer.parseInt(pageNoReq.trim());
			pageNo = (pageNo == 0 )?1:pageNo;
			if(pageNo==1 && csv!=null && pdf!=null)
				pageStartIndex=1;
			else
				pageStartIndex=((pageNo-1)*pageSize+1);

		}
		catch(Exception e)
		{
			pageNo=1;
		}
		
		int startIndex=0;
		if(csv!=null || pdf!=null)
		{
			pageStartIndex = 1;
			pageSize = 0;
		}

	
	String[] dddTest=formatIniFile.getVariables("DDTests_DDD_udmeasure");
	String[] dddTestNormals=formatIniFile.getVariables("DDD_TESTS");
	List dddTestNormalsList = new ArrayList();
	if(dddTestNormals!=null && dddTestNormals.length>0)
		dddTestNormalsList = Arrays.asList(dddTestNormals);
	
	if(dddTest!=null && dddTest.length>0)
	{
		for(int x=0;x<dddTest.length;x++)
		{
			dddTestList.add(dddTest[x]);
		}
	}

	String oldColSeparator = EgConstants.SEMICOLON;
	String colSeparator = testInfo.getDDSeparator1(); // default is ";"
	if (StringUtils.isNull(colSeparator))
	{
		colSeparator = oldColSeparator;
	}

	String separateRows = null;
	String c_sid = "";

	s_site = request.getParameter("site");
	
	//if(s_site==null || s_site.equals("null"))
		s_site="NULL";

	s_host = request.getParameter("host");
	s_port = request.getParameter("port");
	// For Oracle Component
	if(s_port != null && s_port.indexOf(":") > -1)
	{
		c_sid = s_port.substring(s_port.indexOf(":")+1);
		s_port = s_port.substring(0,s_port.indexOf(":"));
	}
	
	String infoForDD = request.getParameter("info");
	if(isForAllInfoReport && infoForDD !=null && infoForDD.trim().length()>0 && infoForDD.equalsIgnoreCase("allinfo"))
	{
		infoForDD="~infoForDD~";
		needToHideDescriptorList = true;
	}
	if(infoForDD != null )
	{
		infoForDD=com.egurkha.util.StringUtils.replace(infoForDD,"%2F","/");
		infoForDD=com.egurkha.util.StringUtils.replace(infoForDD,"|plus|","+");
		infoForDD = com.egurkha.util.StringUtils.decodeSecurityChar(infoForDD);
	}
	ArrayList managerIDs = null;
	if(EgInstallInfo.isSuperManager)
	{
		String component_nick = request.getParameter("host");
		managerIDs = EgElementInfo.getInstance().getManagerIDs("component",component_nick);
		if(managerIDs != null && !managerIDs.isEmpty())
		{
			selectedMgrId=(String)managerIDs.get(0);
			SmSessionData smsData = new SmSessionData(session.getId(),managerIDs);
			EgThreadLocal egtl = new EgThreadLocal();
			egtl.set(smsData);
			new SMDateTimeConverter(managerIDs);
		}
	}
	String temps_info = request.getParameter("info");
	if(isForAllInfoReport && temps_info !=null && temps_info.trim().length()>0 && temps_info.equalsIgnoreCase("allinfo"))
	{
		temps_info="~infoForDD~";
		needToHideDescriptorList = true;
	}
	if(temps_info!=null && temps_info.length()>0)
	{
		s_info = ui.getReverseLookedupString(temps_info);
	}

	if(infoForDD!=null && infoForDD.equalsIgnoreCase("undefined"))
		infoForDD = "NONE";
	s_info = ui.getReverseLookedupString(infoForDD);
	
	if(!isFromUserSession)
		session.setAttribute("sinfo",s_info);
	if(s_info!=null)
	{
		s_info=com.egurkha.util.StringUtils.replace(s_info,"|plus|","+");
		s_info=com.egurkha.util.StringUtils.replace(s_info,"|amp|","&");
		s_info=com.egurkha.util.StringUtils.replace(s_info,"|pct|","%");
		s_info=com.egurkha.util.StringUtils.replace(s_info,"|hash|","#");
		s_info= com.egurkha.util.StringUtils.replace(s_info,"|rights|","\u00AE");
		s_info= com.egurkha.util.StringUtils.replace(s_info,"|dollar|","$");
		s_info = com.egurkha.util.StringUtils.decodeSecurityChar(s_info);
	}
	s_msmt_host = request.getParameter("msmt_host");

	s_mes = request.getParameter("measure");
	s_st_time = request.getParameter("starttime");
	
	s_en_time = request.getParameter("endtime");
	s_st_hr = request.getParameter("starthr");
	s_en_hr = request.getParameter("endhr");
	s_st_min =request.getParameter("startmin");
	String fromHistPage =request.getParameter("fromHistPage");
	String fromCurrPage =request.getParameter("fromCurrPage");
	s_end_min =request.getParameter("endmin");
	s_st_sec =request.getParameter("startsec");
	s_end_sec =request.getParameter("endsec");
	s_first_time = request.getParameter("firsttime");
	s_from = request.getParameter("from");
	s_flag = request.getParameter("flag");

	String fromAlarmDetails = request.getParameter("fromAlarmDetails");
	boolean isFromAlarmDetails = false;
	if(fromAlarmDetails != null && fromAlarmDetails.trim().length()>0 && fromAlarmDetails.equalsIgnoreCase("true"))
	{
		isFromAlarmDetails = true;
	}

	String sortbyTests = formatIniFile.getValue("DD_SORTBY_ENABLE_TESTS","Tests");
	ArrayList sortTestList = new ArrayList();
	if(sortbyTests!=null && sortbyTests.trim().length()>0)
	{
		sortTestList =  com.egurkha.util.StringUtils.egTokenizer(sortbyTests.trim(),",",true,false,true);//param 3-->includeEmpty,4-->unique,5-->trim
	}

	if(sortTestList != null && sortTestList.size() > 0 && sortTestList.indexOf(s_test) != -1)
		isSortEnabledTest = true;
	trans.createFile("eg_format.ini");

	String [] test_array=trans.getVariables("OS_DEPENDENT_DD_TEST");
	ArrayList osDepTestList = new ArrayList();
	if(test_array!=null && test_array.length>0)
		osDepTestList = new ArrayList(Arrays.asList(test_array));

	if(s_ct == null )
		s_ct = "NONE";
	if(StringUtils.isNull(s_ct) || s_ct.equalsIgnoreCase("NONE") || s_ct.equalsIgnoreCase("Host_system"))
		s_ct = discInfo.getTypeForHostTest(s_host, s_test);

	String os_name="";
	boolean isOSDepTest=false;
	if(osDepTestList!=null && s_test!=null && osDepTestList.contains(s_test))
	{
		os_name=(String)Server.getOSName(s_ct,s_host);
		if(os_name!=null && os_name.trim().length()>0)
		{
			os_name=os_name.toLowerCase();
			isOSDepTest = true;
		}
	}
	if(csv!=null || pdf!=null)
	{
		session.removeAttribute("previousRowNumber");
		session.removeAttribute("prevPaginationValueMap");
		pageStartIndex = 1;
		pageSize = 0;
	}
	if(pageNo <= 1){
		session.removeAttribute("previousRowNumber");
		session.removeAttribute("prevPaginationValueMap");
	}

	String seqNoHandling = formatIniFile.getValue("PAGINATION_SEQ_NO_HANDLING_TESTS","Tests");
	ArrayList seqNoHandlingList = null;
	if(seqNoHandling!=null && seqNoHandling.trim().length()>0)
	{
		seqNoHandlingList = new ArrayList();
		seqNoHandlingList =  com.egurkha.util.StringUtils.egTokenizer(seqNoHandling.trim(),",",true,false,true);//param 3-->includeEmpty,4-->unique,5-->trim
		if(seqNoHandlingList != null && seqNoHandlingList.contains(s_test+"_DDD"))
		{
			String measureValues = formatIniFile.getValue("PAGINATION_SEQ_NO_HANDLING", s_test+"_DDD");
			
			if(measureValues!=null && measureValues.trim().length()>0)
			{
				Hashtable prevPaginationValueMap = (Hashtable)session.getAttribute("prevPaginationValueMap");
				
				if(prevPaginationValueMap != null && prevPaginationValueMap.containsKey(s_test+"_DDD")){
					Hashtable valPre = (Hashtable) prevPaginationValueMap.get(s_test+"_DDD");
					if(valPre != null && valPre.containsKey(""+pageNo)){
						String value = (String)valPre.get(""+pageNo);
						session.setAttribute("previousRowNumber",value);
					}
				}
			}
			
		}else{
			session.removeAttribute("previousRowNumber");
			session.removeAttribute("prevPaginationValueMap");
		}
	}

	ArrayList diagnosisTimesList =  new ArrayList();
	ArrayList realTimeEL =  new ArrayList();
	
	String fromReport = request.getParameter("inidate");
	String uiFile = "eg_ui.ini";
	String s_iniFile_dir = EgInstallInfo.getInstallDir()+ "/manager/config/";
	IniFile egUI = new IniFile(s_iniFile_dir + uiFile);
	String currentDateFormat = egUI.getValue("CURRENT_DATE_FORMAT","selectedDateFormat");
	String dateFormatForDatePick = (String)user.getUserDateFormat();
	if(dateFormatForDatePick!=null && (dateFormatForDatePick.equalsIgnoreCase("default") || com.egurkha.util.StringUtils.isNull(dateFormatForDatePick)))
	{
		dateFormatForDatePick = currentDateFormat;
	}

	String dashConfigFile = "eg_dashboardConfig.ini";
	IniFile dashConfigIniFile = new IniFile(s_iniFile_dir + dashConfigFile);
	String dispDate = null;
	String comFormat = null;
	String sid = session.getId();
	String wname =sid+"DIAGNOSIS";
	boolean isfromSuper = session.getAttribute("fromSuper") != null && session.getAttribute("fromSuper").toString().equalsIgnoreCase("yes");
	String s_isVM = request.getParameter("isVM");
	isVM = (new Boolean(s_isVM)).booleanValue();
	Hashtable vmHistMap = new Hashtable();
	Hashtable vmHostMap = new Hashtable();
	boolean vmHistExists = false;
	ArrayList hosts = new ArrayList();
	if(isVM)
	{
		String tempInfo = "";
		vmHistMap = EgLastMeasureThread.vmMapDbForHistory;
		String l_tempInfo = s_info;
		if(l_tempInfo.startsWith("*") || l_tempInfo.startsWith("+"))
			l_tempInfo = l_tempInfo.substring(1);
		if(l_tempInfo.indexOf(":") >0)
			l_tempInfo = l_tempInfo.substring(0,l_tempInfo.indexOf(":"));
		

		String user_vm_host = user.getVMHost(l_tempInfo);
		ArrayList user_vm_host_list = user.getVMHostHistory(l_tempInfo);
		if(user_vm_host != null && user_vm_host.trim().length() > 0)
		{
			hosts.add(user_vm_host);
		}
		else if(user_vm_host_list != null && user_vm_host_list.size() > 0)
		{
			hosts.addAll(user_vm_host_list);
		}
		else if(s_info.startsWith("*") || s_info.startsWith("+"))
		{
			tempInfo = s_info.substring(1);
			if(tempInfo.indexOf(":") >0)
				tempInfo = tempInfo.substring(0,tempInfo.indexOf(":"));
			hosts = (ArrayList)vmHistMap.get(tempInfo);
		}
		else
		{
			if(s_info.indexOf(":")>0)
			{
				tempInfo = s_info.substring(0, s_info.indexOf(":"));
				hosts = (ArrayList)vmHistMap.get(tempInfo);
			}
			else
				hosts = (ArrayList)vmHistMap.get(s_info);
		}
		
		if(hosts!=null && hosts.size() > 0)
		{
			vmHistExists = true;
		}
	}
	String source = request.getParameter("source");
	if(s_st_time == null || s_en_time == null)
	{
		s_st_time = "";
		s_en_time = "";
	}
	if(s_st_hr == null || s_en_hr == null)
	{
		s_st_hr = "0";
		s_en_hr = "0";
	}

	if (s_st_min==null || s_st_min.equals("")) s_st_min = "0";
	if (s_end_min==null || s_end_min.equals("")) s_end_min = "0";

	if (s_st_sec==null || s_st_sec.equals("")) s_st_sec = "00";
	if (s_end_sec==null || s_end_sec.equals("")) s_end_sec = "59";
	String endDateTime ="";
	String startDateTime ="";

	if((s_st_time!=null && s_st_time.equals("")) || (s_en_time!=null && s_en_time.equals("")))
	{
		String tempp = currentDateFormat +" HH:mm:ss";

		SimpleDateFormat sdf = new SimpleDateFormat(tempp);
		//SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy HH:mm");//by James Thomas
		//java.util.Date tmpday = new java.util.Date();
		java.util.Date tmpday = new java.util.Date(edi.egetUTCDate());
		endDateTime = sdf.format(tmpday);
		//int timeLine2 = 3600;//For one hour default measures
		int timeLine2 = 60;

		//java.util.Date startDate2 = new java.util.Date();
		java.util.Date startDate2 = edi.egetRealDate();
		startDate2.setTime(tmpday.getTime() - (timeLine2 * 1000));
		startDateTime = sdf.format(startDate2);

		s_st_time = startDateTime.substring(0,startDateTime.lastIndexOf(" "));

		s_en_time = endDateTime.substring(0,endDateTime.lastIndexOf(" "));

		s_st_hr = startDateTime.substring(startDateTime.lastIndexOf(" ")+1,startDateTime.indexOf(":"));
		s_en_hr = endDateTime.substring(endDateTime.lastIndexOf(" ")+1,endDateTime.indexOf(":"));
		s_st_min = startDateTime.substring(startDateTime.indexOf(":")+1,startDateTime.lastIndexOf(":"));
		s_end_min = endDateTime.substring(endDateTime.indexOf(":")+1,endDateTime.lastIndexOf(":"));

		s_st_sec = startDateTime.substring(startDateTime.lastIndexOf(":")+1);
		s_end_sec = endDateTime.substring(endDateTime.lastIndexOf(":")+1);
	}
	String sess_st_time =null;
	String sess_end_time =null;
	if(!isFromAlarmDetails)
	{
		sess_st_time = (String) session.getAttribute("dd_sttime");
		sess_end_time = (String) session.getAttribute("dd_entime");
	}

	String startDate="";
	try
	{
		java.text.SimpleDateFormat sdf=new java.text.SimpleDateFormat("MM/dd/yyyy k 'at' hh:mm");
		//startDate =sdf.format(new java.util.Date());
		startDate =sdf.format(edi.egetRealDate());
	}
	catch(Exception ee)
	{
	
		ee.printStackTrace();
	}
	String today =startDate.substring(0,startDate.indexOf(" "));
	String startHour =startDate.substring(startDate.indexOf(" "),startDate.lastIndexOf(""));
	startHour = startHour.substring(0,3);
	if (sess_st_time == null || sess_st_time.equalsIgnoreCase("null"))
	{
		sess_st_time = today;
	}
	if(sess_end_time == null || sess_end_time.equalsIgnoreCase("null"))
	{
		sess_end_time=today;
	}

	s_st_hr = request.getParameter("starthr");
	s_en_hr = request.getParameter("endhr");

	if(s_st_time == null || s_en_time == null)
	{
		s_st_time = "";
		s_en_time = "";
	}
	if(s_st_hr == null || s_en_hr == null || s_st_hr.equals("null"))
	{
		int hour = Integer.parseInt(startHour.trim());
		s_en_hr = hour+"";
		//hour--;
		s_st_hr = hour+"";
	}

	String timeLine="";
	String searchFieldVal="";
	String searchText="";
	ErUtils erUtils = new ErUtils();
	EgSpecsInfo specsInfo = new EgSpecsInfo("manager");
	timeLine = request.getParameter("timeline");
	searchFieldVal = request.getParameter("searchfield");
	searchText = request.getParameter("searchText");
	Hashtable search_Hash = new Hashtable();
	if(searchText != null){		
		search_Hash.put("searchfield",searchFieldVal);
		search_Hash.put("searchText",searchText);
	}
	String sortByVal = request.getParameter("sortBy");
	if(sortByVal == null || sortByVal.trim().length()==0)
		sortByVal = formatIniFile.getValue("DD_SORTBY_OPTIONS",s_test+"_Defaultorder");	
	
	if(sortByVal == null || sortByVal.trim().length()==0)
		sortByVal = egUI.getValue("RUM_DD","DefaultSortBy");

	hiddenFields.put("timeline",timeLine);
	if(searchText != null && searchFieldVal != null)
	{
		hiddenFields.put("searchText",searchText);
		hiddenFields.put("searchFieldVal",searchFieldVal);
	}
	selectFilter = request.getParameter("selectfilter");
	//selectFilter=(selectFilter==null || selectFilter.trim().length()==0)?"":selectFilter;
	if(selectFilter!=null)
		hiddenFields.put("selectFilter",selectFilter);
	
	String[] options = {"Any","Latest","1 hour", "3 hours", "6 hours", "9 hours", "12 hours","15 hours", "18 hours","21 hours","24 hours", "2 days", "3 days", "4 days", "5 days", "6 days","1 week","2 weeks","3 weeks","4 weeks","1 month","2 months"};

	String selectedTimeline = egUI.getValue("GRAPHS","DD_DISPLAY");

	boolean isShowLatestEntry = true;
	String orgDispVal = "";
	if(s_test.equals("BusinessTransTest") || s_test.equals("KBusinessTransTest") || s_test.equals("NodeTransTest") || s_test.equals("KNodeTransTest") || s_test.equals("DOTNETMonitorTest") || s_test.equals("PHPTransTest") || s_test.startsWith("RUM"))
	{
		isShowLatestEntry = false;
	}

	if(isShowLatestEntry && selectedTimeline!=null && selectedTimeline.equalsIgnoreCase("Latest"))
	{
		options = new String[]{"Any","Latest","1 hour", "3 hours", "6 hours", "9 hours", "12 hours","15 hours", "18 hours","21 hours","24 hours", "2 days", "3 days", "4 days", "5 days", "6 days","1 week","2 weeks","3 weeks","4 weeks","1 month","2 months"};
	}
	else if(!isShowLatestEntry && selectedTimeline!=null && selectedTimeline.equalsIgnoreCase("Latest") && (StringUtils.isNull(timeLine) || (timeLine != null && timeLine.equalsIgnoreCase("Latest"))))
	{
		selectedTimeline = "Latest";
		timeLine = "1 hour";
		if(selectedTimeline.equalsIgnoreCase("Latest"))
			orgDispVal = "Latest";
	}
	

	Vector time_line=new Vector();
	time_line.addAll(Arrays.asList(options));

	if (timeLine==null)
	{
			if(selectedTimeline.equals("1"))
				timeLine =selectedTimeline+" "+"hour";
			else if(selectedTimeline.equals("Latest"))
			{
					timeLine =selectedTimeline;
			}
			else
				timeLine =selectedTimeline+" "+"hours";
	}
	
	String comesFrom = request.getParameter("comesFrom");
	String siteStr = topoinfo.getValue("SERVICE",s_site);
	String tmpSite = "NULL";
	if(siteStr!=null && siteStr.trim().equalsIgnoreCase("site"))
	{
		tmpSite = s_site;
	}
	Hashtable tLineValues = dd.getTimeline(timeLine,s_host,s_port,s_test,s_mes,s_info,s_msmt_host,comesFrom,s_st_time,s_en_time,s_st_hr, s_en_hr,s_st_min,s_end_min,s_st_sec,s_end_sec,dateFormatForDatePick,currentDateFormat,user,tmpSite,fromReport);
	if(tLineValues != null && tLineValues.size() > 0)
	{
		s_st_time = (String)tLineValues.get("s_st_time");
		s_en_time = (String)tLineValues.get("s_en_time");
		s_st_hr = (String)tLineValues.get("s_st_hr");
		s_en_hr = (String)tLineValues.get("s_en_hr");
		s_st_min = (String)tLineValues.get("s_st_min");
		s_end_min = (String)tLineValues.get("s_end_min");
		s_st_sec = (String)tLineValues.get("s_st_sec");
		s_end_sec = (String)tLineValues.get("s_end_sec");
		sess_st_time = (String)tLineValues.get("sess_st_time");
		sess_end_time = (String)tLineValues.get("sess_end_time");
	}

	String commTestDD = trans. getStrValue("COMMON_DDTEST_MAPPING", s_test+":"+s_mes);
	String mappedTest ="";
	String mappedMeasure="";
	boolean commTestDDFlag =false;
	String colNamesForQuery = "";
	if(commTestDD!=null && commTestDD.length()>0)
	{
		mappedTest = commTestDD.substring(0,commTestDD.indexOf(":"));
		mappedMeasure = commTestDD.substring(commTestDD.indexOf(":")+1);
		commTestDDFlag = true;
		strValue=trans. getStrValue("DDD_TESTS", mappedTest);
		dateFormat =trans.getStrValue("DDD_DATE", mappedTest+":EvtDate");
	}
	else
	{
		strValue=trans. getStrValue("DDD_TESTS", s_test);
		dateFormat =trans.getStrValue("DDD_DATE", s_test+":EvtDate");
	}

	String dummyTestTmp = commTestDDFlag?mappedTest:s_test;
	String dummyMesTmp = commTestDDFlag?mappedMeasure:s_mes;
	String [] colNames =null;
//
	boolean rumStatus=false;
	String rum_Details = egUI.getValue("RUM_DD","RUM_DETAILS");
	if(rum_Details!=null && rum_Details.trim().length()>0 && dummyTestTmp!=null && dummyTestTmp.trim().length()>0)
	{
		StringTokenizer strTokens = new StringTokenizer(rum_Details,",");
		while(strTokens.hasMoreTokens())
		{
			if(strTokens.nextToken().equalsIgnoreCase(dummyTestTmp))
				rumStatus=true;
		}
	}

	if(rumStatus)
	{
		String rum_Columns = formatIniFile.getValue("DDD_TESTS","RUM_DETAILS");
		if(rum_Columns!=null && rum_Columns.trim().length()>0)
		{
			StringTokenizer tokenizer=new StringTokenizer(rum_Columns,",");
			colNames =new String[tokenizer.countTokens()]; 
			int i=0;
			while(tokenizer.hasMoreTokens())
			{
				String colNameVal=(String)tokenizer.nextToken();
				if(colNameVal!=null && colNameVal.trim().length()>0)
				{
					colNames[i]=colNameVal;
					i++;
				}
			}
		}
		session.setAttribute("ColumnCount",new Integer(colNames.length));
	}
	else
	{
		String commDDMapping = trans.getStrValue("COMMON_DD_MAPPING", s_test+":"+s_mes);
		String ddMappedTest =s_test;
		String ddMappedMeasure=s_mes;

		if(commDDMapping!=null && commDDMapping.trim().length()>0)
		{
			ddMappedTest = commDDMapping.substring(0,commDDMapping.indexOf(":"));
			ddMappedMeasure = commDDMapping.substring(commDDMapping.indexOf(":")+1);
			if(ddMappedMeasure.indexOf(",") != -1)
				ddMappedMeasure = ddMappedMeasure.substring(0,ddMappedMeasure.indexOf(","));
		}
		String colNamesOrderStr = trans.getStrValue("DD_Data_Display_Order", ddMappedTest+":"+ddMappedMeasure);
		if(colNamesOrderStr!=null && colNamesOrderStr.trim().length()>0)
		{
			ArrayList colNamesOrderList = com.egurkha.util.StringUtils.egTokenizer(colNamesOrderStr, ",",false,false,true);//param 3-->includeEmpty,4-->unique,5-->trim
			if(colNamesOrderList!=null && colNamesOrderList.size()>0)
			{
				ArrayList dbColumnList=new ArrayList();
				for(int r=0; r<colNamesOrderList.size(); r++)
				{
					String realColName=(String)colNamesOrderList.get(r);
					if(realColName!=null && realColName.trim().length()>0)
					{
						String dbColName=(String)dbInfo.getColumnForMeasure(ddMappedTest+"_DDD",realColName,false);
						if(dbColName==null || dbColName.trim().length()==0)
							dbColName = realColName;
					
						if(dbColName!=null && dbColName.trim().length()>0)
						{
							dbColumnList.add(dbColName);
						}
					}
				}

				if(dbColumnList!=null && dbColumnList.size()>0)
				{
					colNames = (String[])dbColumnList.toArray(new String[dbColumnList.size()]);
				}
			}
		}
		else
		{
			colNames= dbInfo.getColumnNamesForTest(dummyTestTmp+"_DDD");
		}

		if(colNames!=null)
		{
			session.setAttribute("ColumnCount",new Integer(colNames.length));
		}
	}
	//
	if (!strValue.equals(""))
	{
		if(colNames != null && colNames.length > 0)
		{
			String osDepColumn  = null;
			if(isOSDepTest)
			{
				if(os_name!=null && os_name.startsWith("win"))
					osDepColumn  = 	trans.getStrValue("DDD_EmptyColumns_List",dummyTestTmp+"_DDD:"+dummyMesTmp+":Windows");
				else if(os_name!=null && os_name.startsWith("lin"))
					osDepColumn  = 	trans.getStrValue("DDD_EmptyColumns_List",dummyTestTmp+"_DDD:"+dummyMesTmp+":Linux");
				else if(os_name!=null && os_name.startsWith("sol"))
					osDepColumn  = 	trans.getStrValue("DDD_EmptyColumns_List",dummyTestTmp+"_DDD:"+dummyMesTmp+":Solaris");
				else if(os_name!=null && os_name.startsWith("aix"))
					osDepColumn  = 	trans.getStrValue("DDD_EmptyColumns_List",dummyTestTmp+"_DDD:"+dummyMesTmp+":Aix");
				else if(os_name!=null && os_name.startsWith("hpux"))
					osDepColumn  = 	trans.getStrValue("DDD_EmptyColumns_List",dummyTestTmp+"_DDD:"+dummyMesTmp+":Hpux"); 
			}
			String emptyColumn  = 	trans.getStrValue("DDD_EmptyColumns_List",dummyTestTmp+"_DDD:"+dummyMesTmp);

			for(int r=0; r<colNames.length; r++)
			{
				boolean addColumn = true;
				String columnName = colNames[r];

				if(osDepColumn!=null && osDepColumn.trim().length()>0)
				{
					emptyColumn=(emptyColumn==null)?"":emptyColumn;
					if(emptyColumn!=null && emptyColumn.trim().length()>0)
						emptyColumn=emptyColumn+","+osDepColumn;
					else
						emptyColumn=osDepColumn;
				}
				if(emptyColumn!=null&&emptyColumn.indexOf(",")>-1)
				{
					//ArrayList emptyColumnsList = tokInfo.egTokenizer(emptyColumn, ",");
					ArrayList emptyColumnsList =  com.egurkha.util.StringUtils.egTokenizer(emptyColumn, ",",true,false,true);//param 3-->includeEmpty,4-->unique,5-->trim
					for(int x=0; x<emptyColumnsList.size(); x++)
					{
						String column = (String)emptyColumnsList.get(x);
						if(column.equalsIgnoreCase(columnName))
						{
							addColumn=false;
							break;
						}
					}
				}
				else
				{
					if(emptyColumn != null && emptyColumn.equalsIgnoreCase(columnName))
						addColumn=false;
				}
				if(addColumn)
					colNamesForQuery +=columnName + ",";
			}
			if(colNamesForQuery.endsWith(","))
			{
				colNamesForQuery = colNamesForQuery.substring(0, (colNamesForQuery.length()-1));
			}
		}
	}
	String temp = "";
	boolean fake = true;
	String dummyTest = "";
	String dummyMeas = "";

	String[] Desc = null;
	if(rumStatus)
		Desc = dd.getDescription("RUM_DETAILS",s_mes);
	else if(s_test.endsWith("_ag") | s_test.endsWith("_agx"))
	{
		com.eg.EgAggregateInfo aggregateInfo = new com.eg.EgAggregateInfo("manager");
		String functionUsed = aggregateInfo.getValue("AGGREGATE_FUNCTION",s_test+":"+dummyMesTmp.toUpperCase());
		String functionTip = "";
		if(functionUsed != null && functionUsed.trim().length()>0)
		{
			functionUsed = functionUsed.substring(functionUsed.indexOf(":")+1,functionUsed.lastIndexOf(":"));
			functionTip = aggregateInfo.getValue("FUNCTION_NAME-MAPPING",functionUsed); 
		}
		functionTip = "admin.common."+functionTip;
		if((s_info.equalsIgnoreCase("None") || s_info.equals("+") || s_info.equals("*")) && dd.isInfobasedTest(aggregateInfo.getTestName(s_test)))
		{
			Desc = new String[]{"Format:Time Component Descriptor Value","The Aggregate Measure "+mappingInfo.getMeasureDescription(s_test,dummyMesTmp)+" was computed using the aggregate function "+mappingInfo.getTextDescription(functionTip)};
		}
		else
		{
			Desc = new String[]{"Format:Time Component Value","The Aggregate Measure "+mappingInfo.getMeasureDescription(s_test,dummyMesTmp)+" was computed using the aggregate function "+mappingInfo.getTextDescription(functionTip)};
		}
	}
	else
	{
		Desc = dd.getDescription(s_test,s_mes);
	}

	if (s_test!=null && s_mes!=null && !s_mes.equals("") && !s_test.equals("")&& !s_mes.equals("null") && !s_test.equals("null"))
	{
		if(rumStatus)
			Desc = dd.getDescription("RUM_DETAILS",s_mes);
		else if(s_test.endsWith("_ag") | s_test.endsWith("_agx"))
		{
			com.eg.EgAggregateInfo aggregateInfo = new com.eg.EgAggregateInfo("manager");
			String functionUsed = aggregateInfo.getValue("AGGREGATE_FUNCTION",s_test+":"+dummyMesTmp.toUpperCase());
			String functionTip = "";
			if(functionUsed != null && functionUsed.trim().length()>0)
			{
				functionUsed = functionUsed.substring(functionUsed.indexOf(":")+1,functionUsed.lastIndexOf(":"));
				functionTip = aggregateInfo.getValue("FUNCTION_NAME-MAPPING",functionUsed); 
			}
			functionTip = "admin.common."+functionTip;
			agg_function_img_path = "<img src='/final/images/spacer.gif' width='32px' height='16px' class='sym_"+functionUsed+"'>";
			if((s_info.equalsIgnoreCase("None") || s_info.equals("+") || s_info.equals("*")) && dd.isInfobasedTest(aggregateInfo.getTestName(s_test)))
			{
				Desc = new String[]{"Format:Time Component Descriptor Value","The Aggregate Measure "+mappingInfo.getMeasureDescription(s_test,dummyMesTmp)+" was computed using the aggregate function "+mappingInfo.getTextDescription(functionTip)};
			}
			else
			{
				Desc = new String[]{"Format:Time Component Value","The Aggregate Measure "+mappingInfo.getMeasureDescription(s_test,dummyMesTmp)+" was computed using the aggregate function "+mappingInfo.getTextDescription(functionTip)};
			}
		}
		else
		{
			Desc = dd.getDescription(s_test,s_mes);
		}

		if (Desc != null && Desc.length>1)
		{
			s_format=Desc[0];
			s_desc=Desc[1];
		}
	}
//	displayMode = "V";

	//EgSpecsInfo specsInfo = new EgSpecsInfo("manager");
	boolean portRelevantForTest=true;
	if(s_test != null && !s_test.equals(""))
	{
		portRelevantForTest = specsInfo.isPortRelevantForTest(s_test);
	}

	if(portRelevantForTest)
	{
		if(s_ct!=null && s_ct.equals("Oracle_server"))
		{
			if(infoForDD!=null && !infoForDD.equalsIgnoreCase("NONE") && !infoForDD.startsWith("*") && infoForDD.indexOf("*")>0 && c_sid!=null && c_sid.trim().length()==0)
			{
				c_sid=infoForDD.substring(0,infoForDD.indexOf("*"));
			}
		}
	}

	//Populate v_measures only once
	if(s_first_time != null && !s_first_time.equals("") && s_first_time.equals("true"))
	{
		s_first_time = "false";

		if(s_info.length() == 1)
		{
			s_info = "NONE";
		}
		if(s_test != null && !s_test.equals(""))
		{
			v_measures=dd.populateMeasures(s_test);
			

			if(v_measures!=null)
			{
				//Sort measures using Display names
				Vector sortedMeasures = new Vector();
				TreeMap tm = new TreeMap(new Comparator()
				{
					public int compare(Object o1, Object o2)
					{
						String s1 = (String)o1;
						String s2 = (String)o2;
						int sortvalue = s1.compareToIgnoreCase(s2);
						if(sortvalue==0)
						{
							sortvalue = s1.compareTo(s2);
						}
						return sortvalue;
					}
				});
				for(int ij=0; ij<v_measures.size(); ij++)
				{
					String temp_measure = (String)v_measures.get(ij);
					String disp_measure = (String)mappingInfo.getMeasureDescription(s_test,temp_measure);
					tm.put(disp_measure,temp_measure);
				}
				Iterator iterate = tm.entrySet().iterator();
				while(iterate.hasNext())
				{
					Map.Entry e = (Map.Entry)iterate.next();
					sortedMeasures.add((String)e.getValue());
				}
				
				if(sortedMeasures!=null && sortedMeasures.size()>0)
					v_measures = sortedMeasures;
				//Sorting measure Ends
				session.putValue("measures",v_measures);
			}
		}//CLOSING IF
	}

	String tempSortByColumn = null;
	if(rumStatus || isSortEnabledTest)
	{
		isBasedOnDbRows = true;
		//tempSortByColumn = sortByVal;
	}

	String isFromCtxHist = request.getParameter("isFromCtxHist");
	String selectedCtxTime = request.getParameter("selectedCtxTime");
	boolean fromCtxHist = false;
	if(isFromCtxHist != null && isFromCtxHist.equalsIgnoreCase("true"))
		fromCtxHist = true;
	String ss_st_time = s_st_time;
	String se_en_time = s_en_time;
	if(reqForCount.equalsIgnoreCase("yes")){
		recTotalCount=0;
		recTotalRecordCount=0;
		session.removeAttribute("diagnosisTimesList");
		if(DateUtil.isDate(s_st_time,"MM/dd/yyyy"))
		{
			comFormat = "MM/dd/yyyy";
		}
		else
		{
			comFormat = currentDateFormat;
		}
		if(fromReport!=null && fromReport!="" && fromReport.trim().length()>0)
		{
			//Already changed the date to user format in getTimeline method
			//s_st_time = DateUtil.changeDateFormat(s_st_time,fromReport,"MM/dd/yyyy");
			ss_st_time=s_st_time;
		}
		if(!DateUtil.isDate(s_st_time,"MM/dd/yyyy"))
		{
			ss_st_time = DateUtil.changeDateFormat(s_st_time,comFormat,"MM/dd/yyyy");
		}


		if(DateUtil.isDate(s_en_time,"MM/dd/yyyy"))
		{
			comFormat = "MM/dd/yyyy";
		}
		else
		{
			comFormat = currentDateFormat;
		}
		
		if(fromReport!=null && fromReport!="")
		{
			//Already changed the date to user format in getTimeline method
			//s_en_time = DateUtil.changeDateFormat(s_en_time,fromReport,"MM/dd/yyyy");
			se_en_time=s_en_time;
		}
		if(!DateUtil.isDate(s_en_time,"MM/dd/yyyy"))
		{
			se_en_time = DateUtil.changeDateFormat(s_en_time,comFormat,"MM/dd/yyyy");
		}
	}
	else if(!isBasedOnDbRows && !isFromAlarmDetails)
	{
		ArrayList timeList = (ArrayList) session.getAttribute("diagnosisTimesList");
		
		int pageNoStartIndex = pageStartIndex-1;
		if(pageNoStartIndex < 0)
			pageNoStartIndex=0;

		int pagenNoEndIndex =  pageNoStartIndex+(pageSize-1);
		
		if(pagenNoEndIndex < 0)
			pagenNoEndIndex=timeList.size()-1;
		if(timeList != null && timeList.size() > pageNoStartIndex){
			
			realTimeEL.add(ss_st_time);
			realTimeEL.add(se_en_time);
			realTimeEL.add(s_st_hr);
			realTimeEL.add(s_en_hr);
			realTimeEL.add(s_st_min);
			realTimeEL.add(s_end_min);
			realTimeEL.add(s_st_sec);
			realTimeEL.add(s_end_sec);

			if(rumStatus || isSortEnabledTest)
			{
				//tempSortByColumn = sortByVal;
				String tempStartTime = (String) timeList.get(pageNoStartIndex);
				String tempEndTime = "";

				if(timeList.size() > pagenNoEndIndex)
					tempEndTime = (String) timeList.get(pagenNoEndIndex);
				else
					tempEndTime = (String)timeList.get(timeList.size()-1);
				

				sortByVal = sortByVal+"||"+tempEndTime+"$"+tempStartTime;

			}else{
				String tempStartTime = (String) timeList.get(pageNoStartIndex);
				String tempEndTime = "";

				if(timeList.size() > pagenNoEndIndex)
					tempEndTime = (String) timeList.get(pagenNoEndIndex);
				else
					tempEndTime = (String)timeList.get(timeList.size()-1);
				
				
				if(fromCtxHist){
					if(selectedCtxTime != null && selectedCtxTime.trim().length() > 0)
					{
						tempStartTime = selectedCtxTime;
						tempEndTime = selectedCtxTime;
					}
				}
				String t_start_Day = tempStartTime.substring(0,tempStartTime.indexOf(" "));
				tempStartTime = tempStartTime.substring(tempStartTime.indexOf(" ")+1);
				tempStartTime = tempStartTime.trim();
				if(tempStartTime.indexOf(".") != -1)
					tempStartTime = tempStartTime.substring(0,tempStartTime.lastIndexOf("."));
				String t_start_hr = tempStartTime.substring(0,tempStartTime.indexOf(":"));
				String t_start_min = tempStartTime.substring(tempStartTime.indexOf(":")+1,tempStartTime.lastIndexOf(":"));
				String t_start_sec = tempStartTime.substring(tempStartTime.lastIndexOf(":")+1);

				String t_end_Day = tempEndTime.substring(0,tempEndTime.indexOf(" "));
				tempEndTime = tempEndTime.substring(tempEndTime.indexOf(" ")+1);
				tempEndTime = tempEndTime.trim();
				if(tempEndTime.indexOf(".") != -1)
					tempEndTime = tempEndTime.substring(0,tempEndTime.lastIndexOf("."));
				String t_end_hr = tempEndTime.substring(0,tempEndTime.indexOf(":"));
				String t_end_min = tempEndTime.substring(tempEndTime.indexOf(":")+1,tempEndTime.lastIndexOf(":"));
				String t_end_sec = tempEndTime.substring(tempEndTime.lastIndexOf(":")+1);
				
				
				t_start_Day = DateUtil.changeDateFormat(t_start_Day,"yyyy-MM-dd","MM/dd/yyyy");
				t_end_Day = DateUtil.changeDateFormat(t_end_Day,"yyyy-MM-dd","MM/dd/yyyy");
				
				
				ss_st_time = t_end_Day;
				se_en_time = t_start_Day;
				s_st_hr = t_end_hr;
				s_en_hr =  t_start_hr;
				s_st_min = t_end_min;
				s_end_min = t_start_min;
				s_st_sec = t_end_sec;
				s_end_sec = t_start_sec;
				//ss_st_time, se_en_time,s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec
				//s_st_time, s_en_time;
			}


			
		}
	}

	
	// for migration added on 6/26/2009
	String VMOTION_str=null;
	s_compTy=request.getParameter("comptype");
	String realcomptype=request.getParameter("realcomptype");
	//Fix to show DD for same nick with different component types
	if(s_compTy == null || s_compTy.equalsIgnoreCase("NONE") || s_compTy.equalsIgnoreCase("Host_system") || s_compTy.trim().length()==0)
	{
		List compTypes = discInfo.getServerTypesForNick(s_host);
		boolean isPortRelevantForServer = specsInfo.isPortRelevantForTest(s_test);
		if(compTypes != null && compTypes.size() > 1)
		{
			String f_c_type = null;
			for(int h=0;h<compTypes.size();h++)
			{
				String tmp_ctype=(String)compTypes.get(h);
				boolean isTestRelevantForServer = specsInfo.isTestRelevantForServer(tmp_ctype,s_test);
				if(isTestRelevantForServer && tmp_ctype!=null && tmp_ctype.trim().length()>0)
				{
					if(isPortRelevantForServer)
					{
						String t_s_compTy = discInfo.getServerTypesForComponentNamePort(s_host + ":" + s_port);
						if(c_sid != null && !c_sid.equals("") && (t_s_compTy == null || t_s_compTy.length() == 0))
						{
							t_s_compTy = discInfo.getServerTypesForComponentNamePort(s_host + ":" + s_port + ":" +c_sid);
							
							if(t_s_compTy.equals(tmp_ctype))
							{
								f_c_type = tmp_ctype;
								s_compTy = tmp_ctype;
								break;
							}
						}
						else if(t_s_compTy.equals(tmp_ctype))
						{
							f_c_type = tmp_ctype;
							s_compTy = tmp_ctype;
							break;
						}
						else
						{
							f_c_type = tmp_ctype;
							s_compTy = tmp_ctype;
						}
					}
					else
					{
						f_c_type = tmp_ctype;
						s_compTy = tmp_ctype;
						break;
					}
				}
			}


			if(f_c_type == null)
			{
				s_compTy = discInfo.getServerTypesForComponentNamePort(s_host + ":" + s_port);
				if(c_sid != null && !c_sid.equals("") && (s_compTy == null || s_compTy.length() == 0))
					s_compTy = discInfo.getServerTypesForComponentNamePort(s_host + ":" + s_port + ":" +c_sid);
			}
	
			if(s_compTy == null || s_compTy.equalsIgnoreCase("NONE") || s_compTy.equalsIgnoreCase("Host_system") || s_compTy.trim().length()==0)
			{
				if(realcomptype!=null && realcomptype.trim().length()>0 && !realcomptype.equalsIgnoreCase("Host_system"))
				{
					for(int h=0;h<compTypes.size();h++)
					{
						String tmp_ctype=(String)compTypes.get(h);
						if(tmp_ctype!=null && tmp_ctype.trim().length()>0 && tmp_ctype.equals(realcomptype))
						{
							s_compTy = tmp_ctype;
							break;
						}
					}

					if(s_compTy == null || s_compTy.equalsIgnoreCase("NONE") || s_compTy.equalsIgnoreCase("Host_system") || s_compTy.trim().length()==0)
						s_compTy=(String)compTypes.get(0);
				}
				else
				{
					s_compTy=(String)compTypes.get(0);
				}
			}
		}
		else
		{
			s_compTy = discInfo.getTypeForHostTest(s_host, s_test);

			if(s_compTy == null || s_compTy.equalsIgnoreCase("NONE") || s_compTy.equalsIgnoreCase("Host_system") || s_compTy.trim().length()==0)
			{
				if(compTypes != null && compTypes.size() > 0)
					s_compTy=(String)compTypes.get(0);
			}
		}
	}
	//end

	if(s_test!=null)
		VMOTION_str=egUI.getValue("TEST_FOR_VMOTION",s_test);

	String show_VMOTION_str=null;
	show_VMOTION_str=egUI.getValue("VMOTION","ShowMigration");

	boolean test_for_VMOTION_flag=false;
	boolean show_VMOTION_flag=false;

	if(show_VMOTION_str!=null && show_VMOTION_str.equalsIgnoreCase("yes"))
	{
		show_VMOTION_flag=true;
	}
	if(VMOTION_str!=null && VMOTION_str.equalsIgnoreCase("yes"))
	{
		test_for_VMOTION_flag=true;
	}
	String s_host_to_db=s_host;
	ArrayList temp_hosts_list=new ArrayList();
	String temp_s_host="";
	/*if(show_VMOTION_flag)
	{
		if(test_for_VMOTION_flag && s_compTy!=null && 
			(s_compTy.equalsIgnoreCase("VmEsx_i_server") || s_compTy.equalsIgnoreCase("Vmware_esx_server")||s_compTy.equalsIgnoreCase("Vmware_vdi_server")||s_compTy.equalsIgnoreCase("VmVdi_i_server")))
		{
			java.util.List user_comp_type_list=user.getServerTypes();
			StringBuffer temp_hosts=new StringBuffer(128);
			boolean isHaveHost=false;
			if(user_comp_type_list!=null && user_comp_type_list.size()>0 && user_comp_type_list.contains("Virtual_center"))
			{
				java.util.List user_comp_list=user.getServers(false);
				if(user_comp_list!=null && user_comp_list.size()>0)
				{
					for(int z=0;z<user_comp_list.size();z++)
					{
						String comp=(String)user_comp_list.get(z);
						if(comp!=null && comp.trim().length()>0 && (comp.indexOf("Virtual_center:")>-1))
						{
							StringTokenizer tokenForComp=new StringTokenizer(comp,":");
							String comp_type_only=null;
							String comp_name_only=null;
							String port_no_only=null;
							String sid_only=null;
							if(tokenForComp.countTokens()==3)
							{
								comp_type_only=tokenForComp.nextToken();
								comp_name_only=tokenForComp.nextToken();
								port_no_only=tokenForComp.nextToken();
							}
							else if(tokenForComp.countTokens()==4)
							{
								comp_type_only=tokenForComp.nextToken();
								comp_name_only=tokenForComp.nextToken();
								port_no_only=tokenForComp.nextToken();
								sid_only=tokenForComp.nextToken();
							}
							if(comp_type_only!=null && comp_type_only.equalsIgnoreCase("Virtual_center"))
							{
								VmDashboardHelper vmDashHelp=new VmDashboardHelper(user);
								ArrayList list_of_comp_for_a_vc=vmDashHelp.getHostsfromVC(comp_name_only);
								Hashtable NickIpMap=discInfo.getNickIpMap();
								String ips=null;
								if(NickIpMap!=null && NickIpMap.size()>0)
								{
									ips=(String)NickIpMap.get(s_host);
									if(ips!=null && ips.trim().length()>0)
									{
										if(list_of_comp_for_a_vc!=null && list_of_comp_for_a_vc.size()>0 && list_of_comp_for_a_vc.contains(ips))
										{
											Hashtable IpNickMap=discInfo.getIpNickMap();
											if(IpNickMap!=null && IpNickMap.size()>0)
											{
												for(int x=0;x<list_of_comp_for_a_vc.size();x++)
												{
													String ip_from_vc=(String)list_of_comp_for_a_vc.get(x);
													String host_name=(String)IpNickMap.get(ip_from_vc);
													if(host_name!=null && host_name.trim().length()>0)
													{
														StringTokenizer host_name_token=new StringTokenizer(host_name,":");
														boolean isOneHostForOneIP=true;
														while(host_name_token.hasMoreTokens())
														{
															String org_host_name=host_name_token.nextToken();
															java.util.List stNick=discInfo.getServerTypesForNick(org_host_name);
															if(stNick!=null && stNick.contains(s_compTy) && isOneHostForOneIP)
															{
																temp_hosts.append(",'");
																temp_hosts.append(org_host_name);
																temp_hosts.append("'");
																temp_hosts_list.add(org_host_name);
																isHaveHost=true;
																isOneHostForOneIP=false;
															}
														}
													}
												}
												if(isHaveHost && temp_hosts_list.size()>0)
													break;
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
	}*/

	String s_info_to_db = null;
	String ddWithoutInfo = formatIniFile.getValue("Tests_For_DDWithoutInfos", dummyTestTmp + ":" + dummyMesTmp);
	boolean lookforActualDes = false;
	if(ddWithoutInfo!=null && ddWithoutInfo.equalsIgnoreCase("yes"))
	{
		//lookforActualDes = true;
		//s_info_to_db = "+";
		s_info_to_db = s_info;
	}
	else
	{
		s_info_to_db = s_info;
	}

	boolean isDDDInfoDisplay = false;
	String te_s_info = s_info;
	te_s_info=com.egurkha.util.StringUtils.replace(te_s_info,"*","+");
	String ddWithallInfoDispName = formatIniFile.getValue("Tests_For_DDAllInfos_display_column", dummyTestTmp + ":" + te_s_info);
	if(ddWithallInfoDispName!=null && ddWithallInfoDispName.trim().length() > 0)
		isDDDInfoDisplay= true;

	if(EgInstallInfo.isSuperManager && managerIDs != null && !managerIDs.isEmpty())
	{
		SmSessionData smsData = new SmSessionData(session.getId(),managerIDs);
		EgThreadLocal egtl = new EgThreadLocal();
		egtl.set(smsData);
	}
	/*if(temp_hosts_list!=null&&temp_hosts_list.size()>0 && !isVM)
	{
		if(!temp_hosts_list.contains(s_host_to_db))
		{
			a_results=new ArrayList();
			a_option_results=new ArrayList();
			ArrayList a_temp_result=new ArrayList();
			if(s_info_to_db!=null && s_info_to_db.indexOf("*")>-1)
			{
				if(s_info_to_db.length()==2 && s_info_to_db.substring(s_info_to_db.indexOf("*")+1).equals("+"))
				{
								
								
					if(reqForCount.equalsIgnoreCase("yes"))
					{
					
						recTotalCount = dd.getDiagnosisDataCount(s_host_to_db,s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db.substring(s_info_to_db.indexOf("*")+1), ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,colNamesForQuery,s_msmt_host);
						
						recTotalRecordCount = recTotalCount;

						if(recTotalCount<pageSize)
						recTotalCount=1;
						else
						{
							int tem = recTotalCount;
							recTotalCount = recTotalCount/pageSize;
							if(tem%pageSize>0)
								recTotalCount=recTotalCount+1;
						}


										
					}else if(tlineJsonOnly.equalsIgnoreCase("No")){

						if(isSortEnabledTest)
						{
							a_temp_result=dd.getDiagnosisData(s_host_to_db,s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db.substring(s_info_to_db.indexOf("*")+1), ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,colNamesForQuery,s_msmt_host,pageStartIndex,pageSize,sortByVal,session);
						}
						else
						{
							a_temp_result=dd.getDiagnosisData(s_host_to_db,s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db.substring(s_info_to_db.indexOf("*")+1), ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,colNamesForQuery,s_msmt_host,pageStartIndex,pageSize,session);
						}
					}

					if(a_temp_result!=null && a_temp_result.size()>0)
						a_option_results.addAll(a_temp_result);

					// Don't remove the below code.In case if any eg_ud_measure test has been moved to separate DDD table,we need to take data from both eg_ud_measure and DDD table to show.
					if(dddTestList.contains(dummyTestTmp))
					{
						
						if(reqForCount.equalsIgnoreCase("yes"))
							{
							
								recTotalCount=dd.getDiagnosisDataCount(s_host_to_db,s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db.substring(s_info_to_db.indexOf("*")+1), ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,"",s_msmt_host);								
								recTotalRecordCount = recTotalCount;
								if(recTotalCount<pageSize)
								recTotalCount=1;
								else
								{
									int tem = recTotalCount;
									recTotalCount = recTotalCount/pageSize;
									if(tem%pageSize>0)
										recTotalCount=recTotalCount+1;
								}

									
							}
							else if(tlineJsonOnly.equalsIgnoreCase("No"))
							{	
								if(isSortEnabledTest)
								{
									a_temp_result=dd.getDiagnosisData(s_host_to_db,s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db.substring(s_info_to_db.indexOf("*")+1), ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,"",s_msmt_host,pageStartIndex,pageSize,sortByVal,session);
								}else
								{
									a_temp_result=dd.getDiagnosisData(s_host_to_db,s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db.substring(s_info_to_db.indexOf("*")+1), ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,"",s_msmt_host,pageStartIndex,pageSize,session);
								}
							}
					}

					if(a_temp_result!=null && a_temp_result.size()>0)
						a_results.addAll(a_temp_result);
					else if(a_option_results!=null && a_option_results.size()>0)
						a_results.addAll(a_option_results);
				}
				else
				{
						
						if(reqForCount.equalsIgnoreCase("yes"))
						{						
							recTotalCount=dd.getDiagnosisDataCount(s_host_to_db, s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,colNamesForQuery,s_msmt_host);							
							recTotalRecordCount = recTotalCount;
							if(recTotalCount<pageSize)
							recTotalCount=1;
							else
							{
								int tem = recTotalCount;
								recTotalCount = recTotalCount/pageSize;
								if(tem%pageSize>0)
									recTotalCount=recTotalCount+1;
							}

						
							
						}
						else if(tlineJsonOnly.equalsIgnoreCase("No"))
						{
							if(isSortEnabledTest)
							{
								a_temp_result=dd.getDiagnosisData(s_host_to_db, s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,colNamesForQuery,s_msmt_host,pageStartIndex,pageSize,sortByVal,session);
							}
							else
							{
								a_temp_result=dd.getDiagnosisData(s_host_to_db, s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,colNamesForQuery,s_msmt_host,pageStartIndex,pageSize,session);
							}
						}

					
					if(a_temp_result!=null && a_temp_result.size()>0)
						a_option_results.addAll(a_temp_result);

					// Don't remove the below code.In case if any eg_ud_measure test has been moved to separate DDD table,we need to take data from both eg_ud_measure and DDD table to show.
					if(dddTestList.contains(dummyTestTmp))
					{						

							if(reqForCount.equalsIgnoreCase("yes"))
							{							
								recTotalCount=dd.getDiagnosisDataCount(s_host_to_db, s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,"",s_msmt_host);								
								recTotalRecordCount = recTotalCount;
								if(recTotalCount<pageSize)
									recTotalCount=1;
								else
								{
									int tem = recTotalCount;
									recTotalCount = recTotalCount/pageSize;
									if(tem%pageSize>0)
										recTotalCount=recTotalCount+1;
								}
	
								
							}
							else if(tlineJsonOnly.equalsIgnoreCase("No"))
							{
								if(isSortEnabledTest)
								{
									a_temp_result=dd.getDiagnosisData(s_host_to_db, s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,"",s_msmt_host,pageStartIndex,pageSize,sortByVal,session);
								}
								else
								{
									a_temp_result=dd.getDiagnosisData(s_host_to_db, s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,"",s_msmt_host,pageStartIndex,pageSize,session);
								}
							}


						
					}

					if(a_temp_result!=null && a_temp_result.size()>0)
						a_results.addAll(a_temp_result);
					else if(a_option_results!=null && a_option_results.size()>0)
						a_results.addAll(a_option_results);
				}
			}
			else
			{
					
				if(reqForCount.equalsIgnoreCase("yes"))
				{
				
					recTotalCount=dd.getDiagnosisDataCount(s_host_to_db, s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,colNamesForQuery,s_msmt_host);
									
					recTotalRecordCount = recTotalCount;
					if(recTotalCount<pageSize)
						recTotalCount=1;
					else
					{
						int tem = recTotalCount;
						recTotalCount = recTotalCount/pageSize;
						if(tem%pageSize>0)
							recTotalCount=recTotalCount+1;
					}
	
					
				}
				else if(tlineJsonOnly.equalsIgnoreCase("No"))
				{
					if(isSortEnabledTest)
					{
						a_temp_result=dd.getDiagnosisData(s_host_to_db, s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,colNamesForQuery,s_msmt_host,pageStartIndex,pageSize,sortByVal,session);
					}
					else
					{
						a_temp_result=dd.getDiagnosisData(s_host_to_db, s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,colNamesForQuery,s_msmt_host,pageStartIndex,pageSize,session);
					}

				}

				
				
				if(a_temp_result!=null && a_temp_result.size()>0)
					a_option_results.addAll(a_temp_result);

				// Don't remove the below code.In case if any eg_ud_measure test has been moved to separate DDD table,we need to take data from both eg_ud_measure and DDD table to show.
				if(dddTestList.contains(dummyTestTmp))
				{					
					if(reqForCount.equalsIgnoreCase("yes"))
					{
					
						recTotalCount=dd.getDiagnosisDataCount(s_host_to_db, s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,"",s_msmt_host);						
						recTotalRecordCount = recTotalCount;
						if(recTotalCount<pageSize)
							recTotalCount=1;
						else
						{
							int tem = recTotalCount;
							recTotalCount = recTotalCount/pageSize;
							if(tem%pageSize>0)
								recTotalCount=recTotalCount+1;
						}

											
					}
					else if(tlineJsonOnly.equalsIgnoreCase("No")){
						if(isSortEnabledTest)
						{
							a_temp_result=dd.getDiagnosisData(s_host_to_db, s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,"",s_msmt_host,pageStartIndex,pageSize,sortByVal,session);
						}
						else
						{
							a_temp_result=dd.getDiagnosisData(s_host_to_db, s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,"",s_msmt_host,pageStartIndex,pageSize,session);
						}
					}

					
				}

				if(a_temp_result!=null && a_temp_result.size()>0)
					a_results.addAll(a_temp_result);
				else if(a_option_results!=null && a_option_results.size()>0)
					a_results.addAll(a_option_results);
			}

		}
		else
		{
			a_results=new ArrayList();
			for(int i=0;i<temp_hosts_list.size();i++)
			{
				String tempHost=(String)temp_hosts_list.get(i);
				if(!tempHost.equalsIgnoreCase(s_host_to_db))
					continue;

				ArrayList a_temp_result=new ArrayList();
				a_option_results=new ArrayList();
				if(s_info_to_db!=null && s_info_to_db.indexOf("*")>-1)
				{
					if(s_info_to_db.length()==2 && s_info_to_db.substring(s_info_to_db.indexOf("*")+1).equals("+"))
					{					
							
							if(reqForCount.equalsIgnoreCase("yes"))
							{
							
								recTotalCount=dd.getDiagnosisDataCount(s_host_to_db,s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db.substring(s_info_to_db.indexOf("*")+1), ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,colNamesForQuery,s_msmt_host);
								
								recTotalRecordCount = recTotalCount;
								if(recTotalCount<pageSize)
									recTotalCount=1;
								else
								{
									int tem = recTotalCount;
									recTotalCount = recTotalCount/pageSize;
									if(tem%pageSize>0)
										recTotalCount=recTotalCount+1;
								}
												
							}
							else if(tlineJsonOnly.equalsIgnoreCase("No"))
							{
								if(isSortEnabledTest)
								{
									a_temp_result=dd.getDiagnosisData(s_host_to_db,s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db.substring(s_info_to_db.indexOf("*")+1), ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,colNamesForQuery,s_msmt_host,pageStartIndex,pageSize,sortByVal,session);
								}
								else
								{
									a_temp_result=dd.getDiagnosisData(s_host_to_db,s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db.substring(s_info_to_db.indexOf("*")+1), ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,colNamesForQuery,s_msmt_host,pageStartIndex,pageSize,session);
								}

							}


						
						
						if(a_temp_result!=null && a_temp_result.size()>0)
							a_option_results.addAll(a_temp_result);

						// Don't remove the below code.In case if any eg_ud_measure test has been moved to separate DDD table,we need to take data from both eg_ud_measure and DDD table to show.
						if(dddTestList.contains(dummyTestTmp))
						{
							
							if(reqForCount.equalsIgnoreCase("yes"))
							{
								
								recTotalCount=dd.getDiagnosisDataCount(s_host_to_db,s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db.substring(s_info_to_db.indexOf("*")+1), ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,"",s_msmt_host);
								
								recTotalRecordCount = recTotalCount;
								if(recTotalCount<pageSize)
									recTotalCount=1;
								else
								{
									int tem = recTotalCount;
									recTotalCount = recTotalCount/pageSize;
									if(tem%pageSize>0)
										recTotalCount=recTotalCount+1;
								}

															
							}
							else if(tlineJsonOnly.equalsIgnoreCase("No"))
							{
								if(isSortEnabledTest)
								{
									a_temp_result=dd.getDiagnosisData(s_host_to_db,s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db.substring(s_info_to_db.indexOf("*")+1), ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,"",s_msmt_host,pageStartIndex,pageSize,sortByVal,session);
								}
								else
								{
									a_temp_result=dd.getDiagnosisData(s_host_to_db,s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db.substring(s_info_to_db.indexOf("*")+1), ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,"",s_msmt_host,pageStartIndex,pageSize,session);
								}

							}

							
							
						}

						if(a_temp_result!=null && a_temp_result.size()>0)
							a_results.addAll(a_temp_result);
						else if(a_option_results!=null && a_option_results.size()>0)
							a_results.addAll(a_option_results);
					}
					else
					{
							
						if(reqForCount.equalsIgnoreCase("yes"))
						{
						
							recTotalCount =dd.getDiagnosisDataCount(s_host_to_db, s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,colNamesForQuery,s_msmt_host);								
							recTotalRecordCount = recTotalCount;
							if(recTotalCount<pageSize)
								recTotalCount=1;
							else
							{
								int tem = recTotalCount;
								recTotalCount = recTotalCount/pageSize;
								if(tem%pageSize>0)
									recTotalCount=recTotalCount+1;
							}
												
						}
						else if(tlineJsonOnly.equalsIgnoreCase("No"))
						{
							if(isSortEnabledTest)
							{
								a_temp_result=dd.getDiagnosisData(s_host_to_db, s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,colNamesForQuery,s_msmt_host,pageStartIndex,pageSize,sortByVal,session);
							}else
							{
								a_temp_result=dd.getDiagnosisData(s_host_to_db, s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,colNamesForQuery,s_msmt_host,pageStartIndex,pageSize,session);
							}

						}


						
						if(a_temp_result!=null && a_temp_result.size()>0)
							a_option_results.addAll(a_temp_result);

						// Don't remove the below code.In case if any eg_ud_measure test has been moved to separate DDD table,we need to take data from both eg_ud_measure and DDD table to show.
						if(dddTestList.contains(dummyTestTmp))
						{						
							if(reqForCount.equalsIgnoreCase("yes"))
							{
							
								recTotalCount = dd.getDiagnosisDataCount(s_host_to_db, s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,"",s_msmt_host);
							
								recTotalRecordCount = recTotalCount;
								if(recTotalCount<pageSize)
									recTotalCount=1;
								else
								{
									int tem = recTotalCount;
									recTotalCount = recTotalCount/pageSize;
									if(tem%pageSize>0)
										recTotalCount=recTotalCount+1;
								}
							}
							else
							{
								if(isSortEnabledTest)
								{
									a_temp_result=dd.getDiagnosisData(s_host_to_db, s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,"",s_msmt_host,pageStartIndex,pageSize,sortByVal,session);
								}else
								{
									a_temp_result=dd.getDiagnosisData(s_host_to_db, s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,"",s_msmt_host,pageStartIndex,pageSize,session);
								}
							}
						}

						if(a_temp_result!=null && a_temp_result.size()>0)
							a_results.addAll(a_temp_result);
						else if(a_option_results!=null && a_option_results.size()>0)
							a_results.addAll(a_option_results);
					}
				}
				else
				{
						
								if(reqForCount.equalsIgnoreCase("yes"))
								{
								
									recTotalCount=dd.getDiagnosisDataCount(s_host_to_db, s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,colNamesForQuery,s_msmt_host);

									recTotalRecordCount = recTotalCount;
									if(recTotalCount<pageSize)
										recTotalCount=1;
									else
									{
										int tem = recTotalCount;
										recTotalCount = recTotalCount/pageSize;
										if(tem%pageSize>0)
											recTotalCount=recTotalCount+1;
									}
									
								}else if(tlineJsonOnly.equalsIgnoreCase("No"))
								{	
									if(isSortEnabledTest)
									{
										a_temp_result=dd.getDiagnosisData(s_host_to_db, s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,colNamesForQuery,s_msmt_host,pageStartIndex,pageSize,sortByVal,session);
									}else
									{
										a_temp_result=dd.getDiagnosisData(s_host_to_db, s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,colNamesForQuery,s_msmt_host,pageStartIndex,pageSize,session);
									}
								}
							
							if(a_temp_result!=null && a_temp_result.size()>0)
							a_option_results.addAll(a_temp_result);

					// Don't remove the below code.In case if any eg_ud_measure test has been moved to separate DDD table,we need to take data from both eg_ud_measure and DDD table to show.
					if(dddTestList.contains(dummyTestTmp))
					{
							
							if(reqForCount.equalsIgnoreCase("yes"))
							{

							
								recTotalCount=dd.getDiagnosisDataCount(s_host_to_db, s_port,s_site, dummyTestTmp,					dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,"",s_msmt_host);
								
								recTotalRecordCount = recTotalCount;
								if(recTotalCount<pageSize)
									recTotalCount=1;
								else
								{
									int tem = recTotalCount;
									recTotalCount = recTotalCount/pageSize;
									if(tem%pageSize>0)
										recTotalCount=recTotalCount+1;
								}

														
							}
							else if(tlineJsonOnly.equalsIgnoreCase("No"))
							{
								if(isSortEnabledTest)
								{
									a_temp_result=dd.getDiagnosisData(s_host_to_db, s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,"",s_msmt_host,pageStartIndex,pageSize,sortByVal,session);
								}else
								{
									a_temp_result=dd.getDiagnosisData(s_host_to_db, s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,"",s_msmt_host,pageStartIndex,pageSize,session);
								}

							}
						
						
					}

					if(a_temp_result!=null && a_temp_result.size()>0)
						a_results.addAll(a_temp_result);
					else if(a_option_results!=null && a_option_results.size()>0)
						a_results.addAll(a_option_results);
				}
			}
		}//for
	}//if
	else//without migration*/
	{

		if(isDDDInfoDisplay)
			colNamesForQuery = "INFO,"+colNamesForQuery;
		
		a_results=new ArrayList();
		a_option_results=new ArrayList();

		if(s_test.equals("JvmCpuTest") && s_mes.equals("Jvm_cpu_utilization"))
		{
			isJvmCpuTest = true;
			dummyMesTmp = "JvmCpuTest:Live_threads";
		}
		else if(s_test.equals("JvmThreadTest") && s_mes.equals("Total_current_threads"))
		{
			dummyMesTmp = "JvmThreadTest:Total_current_threads";
		}
		else if(s_test.equals("JavaTransactionsTest")) 
		{
			isJavaTransactionsTest = true;
		}		
		else if(apm.isAPMTest(s_test)) 
		{
			isAPMTest = true;
			String hideCols=formatIni.getValue("HIDE_COLUMNS_IN_DD",s_test);
			skipColForApmTests = com.egurkha.util.StringUtils.egTokenizer(hideCols, ",",true,false,true);

			/*if(s_mes.equals("All_urls_avg_time"))
			{
				dummyMesTmp = s_test+":All_urls_avg_time";
			}*/
		}
		if(isVM)
		{
			if(s_info_to_db!=null && s_info_to_db.indexOf("*")>-1)
			{
				if(s_info_to_db.length()==2 && s_info_to_db.substring(s_info_to_db.indexOf("*")+1).equals("+"))
				{
					if(vmHistExists)
					{
						ArrayList temp_results = new ArrayList();
						for(int h=0; h < hosts.size();h++)
						{
							a_option_results=new ArrayList();
							String host = (String)hosts.get(h);
							String st_host = host.substring(0,host.lastIndexOf(":"));
							String ss_host = st_host.substring(0, st_host.indexOf(":"));
							String ss_port = st_host.substring(st_host.indexOf(":")+1);
							
							
							if(reqForCount.equalsIgnoreCase("yes"))
							{
							
								diagnosisTimesList =dd.getDiagnosisDataCount(ss_host, ss_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,colNamesForQuery,s_msmt_host,tempSortByColumn,search_Hash);
								recTotalCount = diagnosisTimesList.size();
								recTotalRecordCount = recTotalCount;
								if(recTotalCount<pageSize)
									recTotalCount=1;
								else
								{
									int tem = recTotalCount;
									recTotalCount = recTotalCount/pageSize;
									if(tem%pageSize>0)
										recTotalCount=recTotalCount+1;
								}
							
							}else if(tlineJsonOnly.equalsIgnoreCase("No"))
							{
								if(isSortEnabledTest)
								{
									temp_results=dd.getDiagnosisData(ss_host, ss_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,colNamesForQuery,s_msmt_host,pageStartIndex,pageSize,sortByVal,session,search_Hash);
								}else
								{
									temp_results=dd.getDiagnosisData(ss_host, ss_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,colNamesForQuery,s_msmt_host,pageStartIndex,pageSize,session,search_Hash);
								}
							}

							if(temp_results!=null && temp_results.size()>0)
								a_option_results.addAll(temp_results);

							// Don't remove the below code.In case if any eg_ud_measure test has been moved to separate DDD table,we need to take data from both eg_ud_measure and DDD table to show.
							if(dddTestList.contains(dummyTestTmp) && dddTestNormalsList.contains(dummyTestTmp))
							{								

								if(reqForCount.equalsIgnoreCase("yes"))
								{
									ArrayList udAlsoList = new ArrayList();
									udAlsoList =dd.getDiagnosisDataCount(ss_host,ss_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db.substring(s_info_to_db.indexOf("*")+1), ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,"",s_msmt_host,tempSortByColumn,search_Hash);
									if(udAlsoList != null && udAlsoList.size() > 0)
										diagnosisTimesList.addAll(udAlsoList);

									recTotalCount = diagnosisTimesList.size();
									recTotalCount = recTotalRecordCount+recTotalCount;
									recTotalRecordCount = recTotalCount;
									if(recTotalCount<pageSize)
										recTotalCount=1;
									else
									{
										int tem = recTotalCount;
										recTotalCount = recTotalCount/pageSize;
										if(tem%pageSize>0)
											recTotalCount=recTotalCount+1;
									}
								}
								else if(tlineJsonOnly.equalsIgnoreCase("No")){
								if(isSortEnabledTest)
								{
									temp_results=dd.getDiagnosisData(ss_host,ss_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db.substring(s_info_to_db.indexOf("*")+1), ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,"",s_msmt_host,pageStartIndex,pageSize,sortByVal,session,search_Hash);
								}else
								{
									temp_results=dd.getDiagnosisData(ss_host,ss_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db.substring(s_info_to_db.indexOf("*")+1), ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,"",s_msmt_host,pageStartIndex,pageSize,session,search_Hash);
								}
							}

							if(temp_results!=null && temp_results.size()>0)
								a_results.addAll(temp_results);
							else if(a_option_results!=null && a_option_results.size()>0)
								a_results.addAll(a_option_results);
						}
					}
				}
				else
				{
						
					if(reqForCount.equalsIgnoreCase("yes"))
					{
							diagnosisTimesList =dd.getDiagnosisDataCount(s_host,s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db.substring(s_info_to_db.indexOf("*")+1), ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,"",s_msmt_host,tempSortByColumn,search_Hash);
							
							recTotalCount = diagnosisTimesList.size();
							recTotalRecordCount = recTotalCount;
							if(recTotalCount<pageSize)
								recTotalCount=1;
							else
							{
								int tem = recTotalCount;
								recTotalCount = recTotalCount/pageSize;
								if(tem%pageSize>0)
									recTotalCount=recTotalCount+1;
							}

					
						
					}
					else if(tlineJsonOnly.equalsIgnoreCase("No"))
			
					{
						if(isSortEnabledTest)
						{
							a_results=dd.getDiagnosisData(s_host,s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db.substring(s_info_to_db.indexOf("*")+1), ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,"",s_msmt_host,pageStartIndex,pageSize,sortByVal,session,search_Hash);
						}else
						{
							a_results=dd.getDiagnosisData(s_host,s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db.substring(s_info_to_db.indexOf("*")+1), ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,"",s_msmt_host,pageStartIndex,pageSize,session,search_Hash);
						}
					}
					if(vmHistExists)
					{
						ArrayList temp_results = new ArrayList();
						for(int h=0; h < hosts.size();h++)
						{
							a_option_results=new ArrayList();
							String host = (String)hosts.get(h);
							String st_host = host.substring(0,host.lastIndexOf(":"));
							String ss_host = st_host.substring(0, st_host.indexOf(":"));
							String ss_port = st_host.substring(st_host.indexOf(":")+1);
								

							if(reqForCount.equalsIgnoreCase("yes"))
							{
									
								diagnosisTimesList=dd.getDiagnosisDataCount(ss_host, ss_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,colNamesForQuery,s_msmt_host,tempSortByColumn,search_Hash);
								recTotalCount = diagnosisTimesList.size();

								recTotalRecordCount = recTotalCount;
									
								if(recTotalCount<pageSize)
									recTotalCount=1;
								else
								{
									int tem = recTotalCount;
									recTotalCount = recTotalCount/pageSize;
									if(tem%pageSize>0)
										recTotalCount=recTotalCount+1;
								}

									
							}
							else if(tlineJsonOnly.equalsIgnoreCase("No"))
							{
								if(isSortEnabledTest)
								{
									temp_results=dd.getDiagnosisData(ss_host, ss_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,colNamesForQuery,s_msmt_host,pageStartIndex,pageSize,sortByVal,session,search_Hash);
								}else
								{
									temp_results=dd.getDiagnosisData(ss_host, ss_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,colNamesForQuery,s_msmt_host,pageStartIndex,pageSize,session,search_Hash);
								}
							}

							if(temp_results!=null && temp_results.size()>0)
								a_option_results.addAll(temp_results);

							// Don't remove the below code.In case if any eg_ud_measure test has been moved to separate DDD table,we need to take data from both eg_ud_measure and DDD table to show.
							if(dddTestList.contains(dummyTestTmp))
							{
							if(reqForCount.equalsIgnoreCase("yes") && dddTestNormalsList.contains(dummyTestTmp))
								{
									ArrayList udAlsoList = new ArrayList();
									udAlsoList=dd.getDiagnosisDataCount(ss_host, ss_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,"",s_msmt_host,tempSortByColumn,search_Hash);
									if(udAlsoList != null && udAlsoList.size() > 0)
										diagnosisTimesList.addAll(udAlsoList);

									recTotalCount = diagnosisTimesList.size();

									recTotalCount = recTotalRecordCount+recTotalCount;

									recTotalRecordCount = recTotalCount;

									if(recTotalCount<pageSize)
										recTotalCount=1;
									else
									{
										int tem = recTotalCount;
										recTotalCount = recTotalCount/pageSize;
										if(tem%pageSize>0)
											recTotalCount=recTotalCount+1;
									}
								}
								else if(tlineJsonOnly.equalsIgnoreCase("No"))
									if(isSortEnabledTest)
									{
										temp_results=dd.getDiagnosisData(ss_host, ss_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,"",s_msmt_host,pageStartIndex,pageSize,sortByVal,session,search_Hash);
									}else
									{
										temp_results=dd.getDiagnosisData(ss_host, ss_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,"",s_msmt_host,pageStartIndex,pageSize,session,search_Hash);
									}
								}
							}

							if(temp_results!=null && temp_results.size()>0)
								a_results.addAll(temp_results);
							else if(a_option_results!=null && a_option_results.size()>0)
								a_results.addAll(a_option_results);
						}
					}
				}
				else
				{
					if(vmHistExists)
					{
						ArrayList temp_results = new ArrayList();
						for(int h=0; h < hosts.size();h++)
						{
							a_option_results=new ArrayList();
							String host = (String)hosts.get(h);
							String st_host = host.substring(0,host.lastIndexOf(":"));
							String ss_host = st_host.substring(0, st_host.indexOf(":"));
							String ss_port = st_host.substring(st_host.indexOf(":")+1);
								
							if(reqForCount.equalsIgnoreCase("yes"))
							{
								diagnosisTimesList=dd.getDiagnosisDataCount(ss_host, ss_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,colNamesForQuery,s_msmt_host,tempSortByColumn,search_Hash);
								recTotalCount = diagnosisTimesList.size();

								recTotalRecordCount = recTotalCount;
								if(recTotalCount<pageSize)
									recTotalCount=1;
								else
								{
									int tem = recTotalCount;
									recTotalCount = recTotalCount/pageSize;
									if(tem%pageSize>0)
										recTotalCount=recTotalCount+1;
								}
		
										
							}
							else if(tlineJsonOnly.equalsIgnoreCase("No"))
							{
								if(isSortEnabledTest)
								{
									temp_results=dd.getDiagnosisData(ss_host, ss_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,colNamesForQuery,s_msmt_host,pageStartIndex,pageSize,sortByVal,session,search_Hash);
								}else
								{
									temp_results=dd.getDiagnosisData(ss_host, ss_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,colNamesForQuery,s_msmt_host,pageStartIndex,pageSize,session,search_Hash);
								}
							}

							if(temp_results!=null && temp_results.size()>0)
								a_option_results.addAll(temp_results);

							// Don't remove the below code.In case if any eg_ud_measure test has been moved to separate DDD table,we need to take data from both eg_ud_measure and DDD table to show.
							if(dddTestList.contains(dummyTestTmp) && dddTestNormalsList.contains(dummyTestTmp))
							{
								if(reqForCount.equalsIgnoreCase("yes"))
								{
									ArrayList udAlsoList = new ArrayList();
									udAlsoList=dd.getDiagnosisDataCount(ss_host, ss_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,"",s_msmt_host,tempSortByColumn,search_Hash);

									if(udAlsoList != null && udAlsoList.size() > 0)
										diagnosisTimesList.addAll(udAlsoList);

									recTotalCount = diagnosisTimesList.size();

									recTotalCount = recTotalRecordCount+recTotalCount;
											
									recTotalRecordCount = recTotalCount;
									if(recTotalCount<pageSize)
										recTotalCount=1;
									else
									{
										int tem = recTotalCount;
										recTotalCount = recTotalCount/pageSize;
										if(tem%pageSize>0)
											recTotalCount=recTotalCount+1;
									}

									
								}
								else if(tlineJsonOnly.equalsIgnoreCase("No")){
								
									if(isSortEnabledTest)
									{
										temp_results=dd.getDiagnosisData(ss_host, ss_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,"",s_msmt_host,pageStartIndex,pageSize,sortByVal,session,search_Hash);
									}else
									{
									temp_results=dd.getDiagnosisData(ss_host, ss_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,"",s_msmt_host,pageStartIndex,pageSize,session,search_Hash);
									}
								}
							}

							if(temp_results!=null && temp_results.size()>0)
								a_results.addAll(temp_results);
							else if(a_option_results!=null && a_option_results.size()>0)
								a_results.addAll(a_option_results);
						}
					}
				}
			}
			else
			{
				if(vmHistExists)
				{
					ArrayList temp_results = new ArrayList();
					for(int h=0; h < hosts.size();h++)
					{
						a_option_results=new ArrayList();
						String host = (String)hosts.get(h);
						String st_host = host.substring(0,host.lastIndexOf(":"));
						String ss_host = st_host.substring(0, st_host.indexOf(":"));
						String ss_port = st_host.substring(st_host.indexOf(":")+1);
							
						if(reqForCount.equalsIgnoreCase("yes"))
						{
							diagnosisTimesList=dd.getDiagnosisDataCount(ss_host, ss_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,colNamesForQuery,s_msmt_host,tempSortByColumn,search_Hash);
							recTotalCount = diagnosisTimesList.size();

							recTotalRecordCount = recTotalCount;
							if(recTotalCount<pageSize)
								recTotalCount=1;
							else
							{
								int tem = recTotalCount;
								recTotalCount = recTotalCount/pageSize;
								if(tem%pageSize>0)
									recTotalCount=recTotalCount+1;
							}
	
									
						}
						else if(tlineJsonOnly.equalsIgnoreCase("No"))
						{
							if(isSortEnabledTest)
							{
								temp_results=dd.getDiagnosisData(ss_host, ss_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,colNamesForQuery,s_msmt_host,pageStartIndex,pageSize,sortByVal,session,search_Hash);
							}else
							{
								temp_results=dd.getDiagnosisData(ss_host, ss_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,colNamesForQuery,s_msmt_host,pageStartIndex,pageSize,session,search_Hash);
							}
						}

						if(temp_results!=null && temp_results.size()>0)
							a_option_results.addAll(temp_results);

						// Don't remove the below code.In case if any eg_ud_measure test has been moved to separate DDD table,we need to take data from both eg_ud_measure and DDD table to show.
						if(dddTestList.contains(dummyTestTmp) && dddTestNormalsList.contains(dummyTestTmp))
						{
							if(reqForCount.equalsIgnoreCase("yes"))
							{
								ArrayList udAlsoList = new ArrayList();
								udAlsoList=dd.getDiagnosisDataCount(ss_host, ss_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,"",s_msmt_host,tempSortByColumn,search_Hash);

								if(udAlsoList != null && udAlsoList.size() > 0)
									diagnosisTimesList.addAll(udAlsoList);

								recTotalCount = diagnosisTimesList.size();

								recTotalCount = recTotalRecordCount+recTotalCount;
										
								recTotalRecordCount = recTotalCount;
								if(recTotalCount<pageSize)
									recTotalCount=1;
								else
								{
									int tem = recTotalCount;
									recTotalCount = recTotalCount/pageSize;
									if(tem%pageSize>0)
										recTotalCount=recTotalCount+1;
								}

								
							}
							else if(tlineJsonOnly.equalsIgnoreCase("No")){
							
								if(isSortEnabledTest)
								{
									temp_results=dd.getDiagnosisData(ss_host, ss_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,"",s_msmt_host,pageStartIndex,pageSize,sortByVal,session,search_Hash);
								}else
								{
								temp_results=dd.getDiagnosisData(ss_host, ss_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,"",s_msmt_host,pageStartIndex,pageSize,session,search_Hash);
								}
							}
						}

						if(temp_results!=null && temp_results.size()>0)
							a_results.addAll(temp_results);
						else if(a_option_results!=null && a_option_results.size()>0)
							a_results.addAll(a_option_results);
					}
				}
			}
		}
		else
		{
			String temp_host = s_host;
			if(s_compTy != null && s_compTy.trim().length()>0)
			{
				temp_host = s_compTy+"#$#"+s_host;
			}
			a_option_results=new ArrayList();
			ArrayList temp_results = new ArrayList();
			if(dummyTestTmp.equalsIgnoreCase("GenericLogonSimTest") ||dummyTestTmp.equalsIgnoreCase("GenericLogonSimTest_DDD") )
				s_info_to_db = s_info_to_db.substring(0,s_info_to_db.indexOf(":")+1)+"Total";
			String temp_colNamesForQuery = colNamesForQuery.toUpperCase();
			if(temp_colNamesForQuery != null && temp_colNamesForQuery.trim().length()>0)
				colNamesForQuery = temp_colNamesForQuery;
			if(s_info_to_db!=null && s_info_to_db.indexOf("*")>-1)
			{
				if(s_info_to_db.length()==2 && s_info_to_db.substring(s_info_to_db.indexOf("*")+1).equals("+"))
				{		


				if(reqForCount.equalsIgnoreCase("yes"))
					{
						
						diagnosisTimesList=dd.getDiagnosisDataCount(s_host,s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db.substring(s_info_to_db.indexOf("*")+1), ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,colNamesForQuery,s_msmt_host,tempSortByColumn,search_Hash);
						recTotalCount = diagnosisTimesList.size();
						recTotalRecordCount = recTotalCount;
						if(recTotalCount<pageSize)
							recTotalCount=1;
						else
						{
							int tem = recTotalCount;
							recTotalCount = recTotalCount/pageSize;
							if(tem%pageSize>0)
								recTotalCount=recTotalCount+1;
						}

						
					}else if(tlineJsonOnly.equalsIgnoreCase("No")){
						if(isSortEnabledTest)
						{
							temp_results=dd.getDiagnosisData(temp_host,s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db.substring(s_info_to_db.indexOf("*")+1), ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,colNamesForQuery,s_msmt_host,pageStartIndex,pageSize,sortByVal,session,search_Hash);
						}
						else{
						temp_results=dd.getDiagnosisData(temp_host,s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db.substring(s_info_to_db.indexOf("*")+1), ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,colNamesForQuery,s_msmt_host,pageStartIndex,pageSize,session,search_Hash);
						}
					}

					if(temp_results!=null && temp_results.size()>0)
						a_option_results.addAll(temp_results);

					// Don't remove the below code.In case if any eg_ud_measure test has been moved to separate DDD table,we need to take data from both eg_ud_measure and DDD table to show.
					if(dddTestList.contains(dummyTestTmp) && dddTestNormalsList.contains(dummyTestTmp))
					{
							

						if(reqForCount.equalsIgnoreCase("yes"))
						{
							ArrayList udAlsoList = new ArrayList();
							udAlsoList=dd.getDiagnosisDataCount(s_host,s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db.substring(s_info_to_db.indexOf("*")+1), ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,"",s_msmt_host,tempSortByColumn,search_Hash);
							if(udAlsoList != null && udAlsoList.size() > 0)
								diagnosisTimesList.addAll(udAlsoList);

							recTotalCount = diagnosisTimesList.size();
							recTotalCount = recTotalRecordCount+recTotalCount;
							recTotalRecordCount = recTotalCount;
							if(recTotalCount<pageSize)
								recTotalCount=1;
							else
							{
								int tem = recTotalCount;
								recTotalCount = recTotalCount/pageSize;
								if(tem%pageSize>0)
									recTotalCount=recTotalCount+1;
							}

									
						}else if(tlineJsonOnly.equalsIgnoreCase("No"))
						{

							if(isSortEnabledTest)
							{
								temp_results=dd.getDiagnosisData(temp_host,s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db.substring(s_info_to_db.indexOf("*")+1), ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,"",s_msmt_host,pageStartIndex,pageSize,sortByVal,session,search_Hash);
							}else
							{
							temp_results=dd.getDiagnosisData(temp_host,s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db.substring(s_info_to_db.indexOf("*")+1), ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,"",s_msmt_host,pageStartIndex,pageSize,session,search_Hash);
							}
						}
					}

					if(temp_results!=null && temp_results.size()>0)
						a_results.addAll(temp_results);
					else if(a_option_results!=null && a_option_results.size()>0)
						a_results.addAll(a_option_results);
				}
				else
				{
					
					if(reqForCount.equalsIgnoreCase("yes"))
					{	
							
						diagnosisTimesList = dd.getDiagnosisDataCount(s_host, s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,colNamesForQuery,s_msmt_host,tempSortByColumn,search_Hash);
						recTotalCount = diagnosisTimesList.size();
						recTotalRecordCount = recTotalCount;
						if(recTotalCount<pageSize)
							recTotalCount=1;
						else
						{
							int tem = recTotalCount;
							recTotalCount = recTotalCount/pageSize;
							if(tem%pageSize>0)
								recTotalCount=recTotalCount+1;
						}

				
					
					}
					else if(tlineJsonOnly.equalsIgnoreCase("No")){
					

					if(rumStatus || isSortEnabledTest)
						{
							temp_results=dd.getDiagnosisData(temp_host, s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,colNamesForQuery,s_msmt_host,pageStartIndex,pageSize,sortByVal,session,search_Hash);
						}
						else
						{
							temp_results=dd.getDiagnosisData(temp_host, s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,colNamesForQuery,s_msmt_host,pageStartIndex,pageSize,session,search_Hash);
						}

				
					}
					

					if(temp_results!=null && temp_results.size()>0)
						a_option_results.addAll(temp_results);

					// Don't remove the below code.In case if any eg_ud_measure test has been moved to separate DDD table,we need to take data from both eg_ud_measure and DDD table to show.
					if(dddTestList.contains(dummyTestTmp))
					{
						
						
					if(reqForCount.equalsIgnoreCase("yes") && dddTestNormalsList.contains(dummyTestTmp))
					{					
						ArrayList udAlsoList = new ArrayList();
						udAlsoList =dd.getDiagnosisDataCount(s_host, s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,"",s_msmt_host,tempSortByColumn,search_Hash);		
						
						if(udAlsoList != null && udAlsoList.size() > 0)
							diagnosisTimesList.addAll(udAlsoList);

						recTotalCount = diagnosisTimesList.size();
						recTotalCount = recTotalRecordCount+recTotalCount;
						recTotalRecordCount = recTotalCount;
						if(recTotalCount<pageSize)
							recTotalCount=1;
						else
						{
							int tem = recTotalCount;
							recTotalCount = recTotalCount/pageSize;
							if(tem%pageSize>0)
								recTotalCount=recTotalCount+1;
						}



					}else if(tlineJsonOnly.equalsIgnoreCase("No")){
						if(isSortEnabledTest)
						{
							temp_results=dd.getDiagnosisData(temp_host, s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,"",s_msmt_host,pageStartIndex,pageSize,sortByVal,session,search_Hash);
						}else
						{
						temp_results=dd.getDiagnosisData(temp_host, s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,"",s_msmt_host,pageStartIndex,pageSize,session,search_Hash);
						}

					}
					}
					if(temp_results!=null && temp_results.size()>0)
						a_results.addAll(temp_results);
					else if(a_option_results!=null && a_option_results.size()>0)
						a_results.addAll(a_option_results);
				}
			}
			else
			{
				
				if(reqForCount.equalsIgnoreCase("yes")){						
					ArrayList udAlsoList = new ArrayList();
					diagnosisTimesList = dd.getDiagnosisDataCount(s_host, s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,colNamesForQuery,s_msmt_host,tempSortByColumn,search_Hash);
					
					if(udAlsoList != null && udAlsoList.size() > 0)
							diagnosisTimesList.addAll(udAlsoList);

						recTotalCount = diagnosisTimesList.size();
						recTotalCount = recTotalRecordCount+recTotalCount;
						recTotalRecordCount = recTotalCount;
						if(recTotalCount<pageSize)
							recTotalCount=1;
						else
						{
							int tem = recTotalCount;
							recTotalCount = recTotalCount/pageSize;
							if(tem%pageSize>0)
								recTotalCount=recTotalCount+1;
						}


				}
				else if(tlineJsonOnly.equalsIgnoreCase("No")){
					if(isSortEnabledTest)
					{
						temp_results=dd.getDiagnosisData(temp_host, s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,colNamesForQuery,s_msmt_host,pageStartIndex,pageSize,sortByVal,session,search_Hash);
					}else
					{
						temp_results=dd.getDiagnosisData(temp_host, s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,colNamesForQuery,s_msmt_host,pageStartIndex,pageSize,session,search_Hash);
					}
				}

				if(temp_results!=null && temp_results.size()>0)
					a_option_results.addAll(temp_results);

				// Don't remove the below code.In case if any eg_ud_measure test has been moved to separate DDD table,we need to take data from both eg_ud_measure and DDD table to show.
				if(dddTestList.contains(dummyTestTmp) && dddTestNormalsList.contains(dummyTestTmp))
				{
					

					if(reqForCount.equalsIgnoreCase("yes")){

						ArrayList udAlsoList = new ArrayList();

						udAlsoList =dd.getDiagnosisDataCount(s_host, s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,"",s_msmt_host,tempSortByColumn,search_Hash);

						if(udAlsoList != null && udAlsoList.size() > 0)
							diagnosisTimesList.addAll(udAlsoList);

						recTotalCount = diagnosisTimesList.size();
						recTotalCount = recTotalRecordCount+recTotalCount;
						recTotalRecordCount = recTotalCount;
					
						if(recTotalCount<pageSize)
							recTotalCount=1;
						else
						{
							int tem = recTotalCount;
							recTotalCount = recTotalCount/pageSize;
							if(tem%pageSize>0)
								recTotalCount=recTotalCount+1;
						}

					
					}else if(tlineJsonOnly.equalsIgnoreCase("No"))
					{
						if(isSortEnabledTest)
						{
							temp_results=dd.getDiagnosisData(temp_host, s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,"",s_msmt_host,pageStartIndex,pageSize,sortByVal,session,search_Hash);
						}
						else
						{
						temp_results=dd.getDiagnosisData(temp_host, s_port,s_site, dummyTestTmp, dummyMesTmp, s_info_to_db, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,"",s_msmt_host,pageStartIndex,pageSize,session,search_Hash);
						}
					}
				}

				if(temp_results!=null && temp_results.size()>0)
					a_results.addAll(temp_results);
				else if(a_option_results!=null && a_option_results.size()>0)
					a_results.addAll(a_option_results);
			}
		}

		//For dd changes in SystemTest & DiskActivityTest
		/*if(lookforActualDes && (a_results==null || a_results.size()==0))
		{
			if(s_info!=null && s_info.indexOf("*")>-1)
			{
				if(s_info.length()==2 && s_info.substring(s_info.indexOf("*")+1).equals("+"))
				{
					a_results=dd.getDiagnosisData(s_host,s_port,s_site, dummyTestTmp, dummyMesTmp, s_info.substring(s_info.indexOf("*")+1), ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,colNamesForQuery,s_msmt_host);

					// Don't remove the below code.In case if any eg_ud_measure test has been moved to separate DDD table,we need to take data from both eg_ud_measure and DDD table to show.
					if(dddTestList.contains(dummyTestTmp))
					{
						a_results=dd.getDiagnosisData(s_host,s_port,s_site, dummyTestTmp, dummyMesTmp, s_info.substring(s_info.indexOf("*")+1), ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,"",s_msmt_host);
					}
				}
				else
				{
					a_results=dd.getDiagnosisData(s_host, s_port,s_site, dummyTestTmp, dummyMesTmp, s_info, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,colNamesForQuery,s_msmt_host);

					// Don't remove the below code.In case if any eg_ud_measure test has been moved to separate DDD table,we need to take data from both eg_ud_measure and DDD table to show.
					if(dddTestList.contains(dummyTestTmp))
					{
						a_results=dd.getDiagnosisData(s_host, s_port,s_site, dummyTestTmp, dummyMesTmp, s_info, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,"",s_msmt_host);
					}
				}
			}
			else
			{
				a_results=dd.getDiagnosisData(s_host, s_port,s_site, dummyTestTmp, dummyMesTmp, s_info, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,colNamesForQuery,s_msmt_host);

				// Don't remove the below code.In case if any eg_ud_measure test has been moved to separate DDD table,we need to take data from both eg_ud_measure and DDD table to show.
				if(dddTestList.contains(dummyTestTmp))
				{
					a_results=dd.getDiagnosisData(s_host, s_port,s_site, dummyTestTmp, dummyMesTmp, s_info, ss_st_time, se_en_time, s_st_hr, s_en_hr,s_st_min+":"+s_st_sec,s_end_min+":"+s_end_sec,s_flag,"",s_msmt_host);
				}
			}
		}*/
	}
	if(reqForCount.equalsIgnoreCase("yes")){
		session.setAttribute("diagnosisTimesList",diagnosisTimesList);
	}else if(!isBasedOnDbRows){
		if(realTimeEL != null && realTimeEL.size() == 8){
			ss_st_time = (String) realTimeEL.get(0);
			se_en_time = (String) realTimeEL.get(1);
			s_st_hr = (String) realTimeEL.get(2);
			s_en_hr = (String) realTimeEL.get(3);
			s_st_min = (String) realTimeEL.get(4);
			s_end_min = (String) realTimeEL.get(5);
			s_st_sec = (String) realTimeEL.get(6);
			s_end_sec = (String) realTimeEL.get(7);
		}

		if(rumStatus || isSortEnabledTest)
			sortByVal = sortByVal.substring(0,sortByVal.indexOf("||"));
	}
	String fildate=ss_st_time+" "+s_st_hr+":"+s_st_min;
	String hnqstring=request.getParameter("hqstring");
	String qstr1=request.getQueryString();
	if(hnqstring==null)
		hnqstring=qstr1;
	else 
		hnqstring=request.getParameter("hqstring");

		//hnqstring = com.egurkha.util.StringUtils.decodeSecurityChar(hnqstring);

		String pageTitle=mappingInfo.getTextDescription("monitor.detaileddiagnosis.Detailed Diagnosis for");
        pageTitle+=" "+mappingInfo.getMeasureDescription(s_test,s_mes);
		pageTitle+=" "+"-"+" "+mappingInfo.getTextDescription(isfromSuper?"monitor.common.eG Super Manager":"monitor.common.eG Manager");
        json.put("pageTitle",pageTitle);
		

	long refreshFrequency = 60;
	String refFreq = user.getRefreshFrequency();
	monitor_Skin = user.getMonitorSkin();

	if(refFreq!=null && refFreq.length()>0)
	{
		//refreshFrequency =  Long.valueOf(refFreq).longValue() * 1000L;
		refreshFrequency = Long.valueOf(refFreq).longValue();
	}
	String fromPage = request.getParameter("fromPage");
	if(s_st_time.equals(""))
	{
       //refreshfreq to be set

	}
   
	

	String temp1 = (cal.get(cal.MONTH)+1) + "/" + cal.get(cal.DAY_OF_MONTH) + "/" +cal.get(cal.YEAR);
	String temp2 = cal.get(cal.HOUR_OF_DAY)+":"+cal.get(cal.MINUTE)+":"+cal.get(cal.SECOND);
    String dispDate1 = DateUtil.changeDateFormat(temp1,"MM/dd/yyyy",currentDateFormat);

	EgTimeZoneConverter timeZoneConverter1 = new EgTimeZoneConverter(dispDate1+" "+temp2,user);
	String loginUserDateTime = (String)timeZoneConverter1.getDate(false);
	String loginUserDateHour = (String)timeZoneConverter1.getHour();
	String loginUserDateMin = (String)timeZoneConverter1.getMinute();

	hiddenFields.put("hidCurrentDateTime",loginUserDateTime);
	hiddenFields.put("hidCurrentDateHour",loginUserDateHour);
	hiddenFields.put("hidCurrentDateMin",loginUserDateMin);
	String newWindow = request.getParameter("newWindow");//---modified on 20/09/07-----------------
	boolean eventHistoryHead = (newWindow != null && fromPage!=null && newWindow.equals("false") && fromPage.equals("eveHist"));
	hiddenFields.put("startsec",s_st_sec);
	hiddenFields.put("endsec",s_end_sec);
	hiddenFields.put("fromPage",fromPage);
	
	JSONArray  filterInfo = new JSONArray();
	String tmpComesForDD = request.getParameter("comesForDD");
	if(tmpComesForDD!=null && tmpComesForDD.trim().length()>0 && tmpComesForDD.equalsIgnoreCase("comesForDD"))
	{
		if(s_site!=null && s_site.trim().length()>0 && !s_site.equalsIgnoreCase("NULL"))
			listData.add(mappingInfo.getTextDescription("monitor.csv.Service")+"="+s_site);

		String tmpCtype = request.getParameter("comptype");
		if(tmpCtype!=null && !tmpCtype.equalsIgnoreCase("NULL") && tmpCtype.trim().length()>0)
			listData.add(mappingInfo.getTextDescription("monitor.csv.Component Type")+"="+mappingInfo.getComponentTypeDescription(tmpCtype));
	}
	/***************Components**********************/
	String componentName = null;
	if(!portRelevantForTest)
	{
		//out.println(s_host);
		componentName = s_host;
		listData.add(mappingInfo.getTextDescription("monitor.csv.Component")+"="+s_host);
		if(!s_info.equals("NONE"))
		{
			if(s_info.indexOf("*") != -1){
				s_firstInfo = s_info.substring(0,s_info.indexOf("*"));
				s_secondInfo = s_info.substring(s_info.indexOf("*") + 1,s_info.length());
			}
			if(s_port !="NULL" && !s_port.contains(s_firstInfo))
			{
				componentName = s_host + ":" + s_port + ":" + s_firstInfo;
			}
			else
			{
				componentName = s_host + ":" + s_port;
			}
			//commented by ahamed
			/*if(s_firstInfo.equals("")) //No sid
			{
				s_info = s_secondInfo;
			}
			else //For Oracle tests
			{
				if(s_secondInfo.equals(""))
				{
					s_info = "NONE";
				}
				else
				{
					s_info = s_secondInfo;
				}
			}*/
		}
		else
		{
			// For oracle Component(Without info)
			if(s_port !="NULL" && !s_port.contains(c_sid))
			{
				componentName = s_host + ":" + s_port + ":" + c_sid;
			}
			else
			{
				componentName = s_host + ":" + s_port;
			}
		}
	}
	else
	{
		if(!s_info.equals("NONE"))
		{
			if(s_info.indexOf("*") != -1){
				s_firstInfo = s_info.substring(0,s_info.indexOf("*"));
				s_secondInfo = s_info.substring(s_info.indexOf("*") + 1,s_info.length());
			}
			if(s_firstInfo.equals("")) //No sid
			{
				//s_info = s_secondInfo;// commented by ahamed
				//out.println(s_host + ":" + s_port);
				componentName = s_host + ":" + s_port;

				
				if(isVM)
				{
					String vmTemp = "";
					vmTemp=s_info.trim();
					if(s_info.indexOf("*")>-1 && s_info.startsWith("*"))
					{
						vmTemp="+"+s_info.substring(1);
					}
					else if(s_info.indexOf("*")>-1 && !s_info.startsWith("*"))
					{
						String first_in=s_info.substring(0,s_info.indexOf("*"));
						String sec_in=s_info.substring(s_info.indexOf("*")+1);
						vmTemp=sec_in;
						
					}
					if(vmTemp.startsWith("+"))
					{
						vmTemp = vmTemp.substring(1);
					}
					if(vmTemp.indexOf(":")>-1)
					{
						vmTemp = vmTemp.substring(0,vmTemp.indexOf(":"));
					}
					listData.add(mappingInfo.getTextDescription("monitor.csv.VM Name")+"=" +vmTemp);

				}
				else
				{
					String componentName1=componentName;
					if (componentName.endsWith(EgConstants.NULL_PORT) && (componentName.indexOf(EgConstants.NULL_PORT) > -1))
					{
						 componentName1 = Server.getServerNameWithoutPort(componentName, false);
					}
					listData.add(mappingInfo.getTextDescription("monitor.csv.Component")+"="+componentName1);
				}
			}
			else //For Oracle tests
			{
				// commented by ahamed
				/*if(s_secondInfo.equals(""))
				{
					s_info = "NONE";
				}
				else
				{
					s_info = s_secondInfo;
				}*/
				//out.println(s_host + ":" + s_port + ":" + s_firstInfo);
				//componentName = s_host + ":" + s_port + ":" + s_firstInfo;
					if(s_port !="NULL" && !s_port.contains(s_firstInfo))
				{
					componentName = s_host + ":" + s_port + ":" + s_firstInfo;
				}
				else
				{
					componentName = s_host + ":" + s_port;
				}
				String componentName1=componentName;
				if (componentName.endsWith(EgConstants.NULL_PORT) && 	(componentName.indexOf(EgConstants.NULL_PORT) > -1))
				{
					 componentName1 = Server.getServerNameWithoutPort(componentName, false);
				}
				listData.add(mappingInfo.getTextDescription("monitor.csv.Component")+"="+componentName1);
			}
		}
		else
		{
			//listData.add(mappingInfo.getTextDescription("monitor.csv.Component")+"="+s_host + ":" + s_port);
			//out.println(s_host + ":" + s_port);
			// For oracle Component(Without info)
			if(s_port !="NULL" && !s_port.contains(c_sid))
			{
				componentName = s_host + ":" + s_port + ":" + c_sid;
			}
			else
			{
				componentName = s_host + ":" + s_port;
			}
			String componentName1=componentName;
			if (componentName.endsWith(EgConstants.NULL_PORT) && 	(componentName.indexOf(EgConstants.NULL_PORT) > -1))
			{
				 componentName1 = Server.getServerNameWithoutPort(componentName, false);
			}
			listData.add(mappingInfo.getTextDescription("monitor.csv.Component")+"="+componentName1);
		
		}
	}
	if(s_msmt_host!=null && !s_msmt_host.equals(" ") && s_msmt_host.trim().length()>0)
		listData.add(mappingInfo.getTextDescription("monitor.csv.Measured By")+"="+s_msmt_host);
	/*************** End of Components**********************/


	/***************Service*************************/
	if(s_site.equalsIgnoreCase("NULL")|| s_site.equals("egurkha.physical.topology"))
	{
		s_site = "NONE";
	}
	if(s_site != null && s_site.length() == 0 && !s_site.equalsIgnoreCase("NONE"))
	{
		listData.add(mappingInfo.getTextDescription("monitor.csv.Service")+"="+s_site);
	}
	/**************End of Service*******************/

		
	String test_csv = null;
	String mes_csv = null;
	if(s_test != null && s_mes != null)
	{
		test_csv = mappingInfo.getTestDescription(s_test);// test name to pass excel format
		mes_csv = mappingInfo.getMeasureDescription(s_test,request.getParameter("measure"));// measure to pass excel
	}


	/*****************Descriptor*****************/
	String s_info_temp = "";
	s_info_temp=s_info.trim();
	if(s_info.indexOf("*")>-1 && s_info.startsWith("*"))
	{
		s_info_temp="+"+s_info.substring(1);
	}
	else if(s_info.indexOf("*")>-1 && !s_info.startsWith("*"))
	{
		String first_in=s_info.substring(0,s_info.indexOf("*"));
		String sec_in=s_info.substring(s_info.indexOf("*")+1);
		s_info_temp=sec_in;
	}

	listData.add(mappingInfo.getTextDescription("monitor.csv.Test")+"="+test_csv);
	listData.add(mappingInfo.getTextDescription("monitor.csv.Measure")+"="+mes_csv);
	if(s_info_temp != null && !s_info_temp.equalsIgnoreCase("NONE") && !s_info_temp.equals("+") &&  s_info_temp.length() != 0)
	{
		if(s_info_temp.startsWith("+"))
			s_info_temp=s_info_temp.substring(1);
		if(isVM)
		{
			String sTemp = s_info_temp;

			if(sTemp.indexOf(":")>-1)
			{
				sTemp = sTemp.substring(sTemp.indexOf(":")+1);
			}

			listData.add(mappingInfo.getTextDescription("monitor.csv.Description")+"="+sTemp);
		}
		else
		{
		listData.add(mappingInfo.getTextDescription("monitor.csv.Description")+"="+s_info_temp);
		}
	}
	if(s_st_time!=null && !s_st_time.equals(""))
	{
		if(DateUtil.isDate(s_st_time,"MM/dd/yyyy"))
		{
			comFormat = currentDateFormat;
			s_st_time = DateUtil.changeDateFormat(s_st_time,"MM/dd/yyyy",dateFormatForDatePick);
		}

		if(DateUtil.isDate(s_en_time,"MM/dd/yyyy"))
		{
			comFormat = currentDateFormat;
			s_en_time = DateUtil.changeDateFormat(s_en_time,"MM/dd/yyyy",dateFormatForDatePick);
		}
		timeZoneConverterStart = new EgTimeZoneConverter(s_st_time+" "+s_st_hr+":"+s_st_min,user);
		timeZoneConverterEnd = new EgTimeZoneConverter(s_en_time+" "+s_en_hr+":"+s_end_min,user);

		listData.add("\""+mappingInfo.getTextDescription("monitor.csv.Start Time")+"="+timeZoneConverterStart.getDateTime()+"\"");
		listData.add("\""+mappingInfo.getTextDescription("monitor.csv.End Time")+"="+timeZoneConverterEnd.getDateTime()+"\"");
	}
	else
	{
		String s_start_time="";
		String s_end_time="";
		long lt = dateInfo.egetUTCDate();
		java.util.Date s_end_date = new java.util.Date(lt);
		 ui = (IniUI)IniUI.getInstance();
		String displayTime =ui.getDDDisplayTime();
		double dTime = 1.0;
		try
		{
			dTime = Double.parseDouble(displayTime);
		}
		catch(Exception e)
		{
			dTime = 1.0;
		}
		lt = lt - (long)(1000 * 60 * 60 * dTime);
		java.util.Date s_start_date = new java.util.Date(lt);
		s_start_time = dateInfo.egetDate(s_start_date);
		s_end_time = dateInfo.egetDate(s_end_date);
		
		if(DateUtil.isDate(s_start_time,"dd/MM/yyyy HH:mm:ss"))
		{
			comFormat = currentDateFormat;
			s_start_time = DateUtil.changeDateFormat(s_start_time,"dd/MM/yyyy HH:mm:ss",comFormat+" HH:mm:ss");
		}
		if(DateUtil.isDate(s_end_time,"dd/MM/yyyy HH:mm:ss"))
		{
			comFormat = currentDateFormat;
			s_end_time = DateUtil.changeDateFormat(s_end_time,"dd/MM/yyyy HH:mm:ss",comFormat+" HH:mm:ss");
		}
		timeZoneConverterStart = new EgTimeZoneConverter(s_start_time,user);
		timeZoneConverterEnd = new EgTimeZoneConverter(s_end_time,user);

		listData.add("\""+mappingInfo.getTextDescription("monitor.csv.Start Time")+"="+timeZoneConverterStart.getDateTime()+"\"");
		listData.add("\""+mappingInfo.getTextDescription("monitor.csv.End Time")+"="+timeZoneConverterEnd.getDateTime()+"\"");
		session.setAttribute("s_start_time",s_start_time);
		session.setAttribute("s_end_time",s_end_time);


	}
	if(searchText != null && searchText.trim().length() > 0 && searchText.indexOf("null") != 0 && searchFieldVal != null && searchFieldVal.trim().length() > 0 && searchFieldVal.indexOf("null") != 0 )
	{
		listData.add("searchField"+"="+searchFieldVal+"");
		listData.add("searchVal"+"="+searchText+"");
		listData.add(" ");
	}
	listData.add(" ");

	listData.add(" ");
	listData.add(s_desc);
	/****************End of		*************/
	List labels = new ArrayList();
	//labels.add("Component");
	//labels.add("Test");
	//labels.add("Measured By");
	//labels.add("Service");
	//labels.add("Test");
	//labels.add("Measure");

	List values = new ArrayList();
	//values.add(componentName);
	//values.add(s_test);
	//values.add(s_msmt_host);
	//values.add(s_site);
	if(componentName.indexOf(":") == -1)
		componentName=s_host + ":" + s_port;
	
	if(reqForCount.equalsIgnoreCase("yes"))
	{
		if(fromCtxHist){
			JSONObject timeObj = new JSONObject();
			if(isSSTest)
			{
				timeObj.put("host",s_host);
				timeObj.put("isSSTest",new Boolean(isSSTest));
			}
			timeObj.put("id","ctxTimeLine");
			timeObj.put("name",mappingInfo.getTextDescription("monitor.common.Measurement Time"));
			timeObj.put("selectedValue","-1");
			timeObj.put("type","combo");
			JSONArray timeArray = new JSONArray();
			JSONObject obj_t = new JSONObject();
			obj_t.put("name","Not Applicable");
			obj_t.put("value","-1");
			timeArray.add(obj_t);
			int data_ind;
			if(diagnosisTimesList != null && diagnosisTimesList.size() > 0){
				timeArray = new JSONArray();
				if((fromHistPage!=null && fromHistPage.trim().length() > 0 && fromHistPage.equalsIgnoreCase("true")) || (fromCurrPage!=null && fromCurrPage.trim().length() > 0 && fromCurrPage.equalsIgnoreCase("true")))
				{
					data_ind=diagnosisTimesList.size()-1;
				}
				else
					data_ind=0;

				for(int l=0;l<diagnosisTimesList.size();l++){
					String time_in = (String)diagnosisTimesList.get(l);
					String org_time_in=time_in;
					String date_alone="";
					String hr_alone="";
					String min_alone="";
					try
					{
						if(time_in!=null && time_in.indexOf(":")!=-1)
						{
							time_in = time_in.trim();
							String date_in = time_in.substring(0,time_in.lastIndexOf(" "));
							if(date_in!=null && date_in.indexOf("-")>-1)
							{
								String time_inner = time_in.substring(time_in.indexOf(" ")+1);
								if(time_inner!=null && time_inner.endsWith(".0"))
									time_inner = time_inner.substring(0,time_inner.lastIndexOf("."));
								date_in = DateUtil.changeDateFormat(date_in,"yyyy-MM-dd",currentDateFormat);
								time_in = date_in+" "+time_inner;
								if(user != null)
								{
									EgTimeZoneConverter convert_ctx = new EgTimeZoneConverter(time_in,user);
									time_in = ""+convert_ctx.getDateTime();
								}

								date_alone = time_in.substring(0,time_in.lastIndexOf(" "));
								date_alone = DateUtil.changeDateFormat(date_alone,currentDateFormat,"MM/dd/yyyy");
								hr_alone = time_in.substring(time_in.lastIndexOf(" ")+1,time_in.indexOf(":"));
								min_alone = time_in.substring(time_in.indexOf(":")+1,time_in.lastIndexOf(":"));

								obj_t = new JSONObject();
								if(l==data_ind)
									timeObj.put("selectedValue",org_time_in);
								obj_t.put("name",time_in);
								obj_t.put("value",org_time_in);
								
								timeArray.add(obj_t);
							}
						}
					}
					catch(Exception eee)
					{
						eee.printStackTrace();
						timeObj.put("error",""+eee);
						continue;
					}
				}
			}
			timeObj.put("options",timeArray);
			JSONArray filtersOjct = getFilterJson(user,mappingInfo,timeZoneConverterStart,timeZoneConverterEnd,timeLine,s_st_time,comFormat,dateFormatForDatePick,dispDate,s_st_hr,s_st_min,startDateForDisplay,startHourForDisplay,startMinForDisplay,s_en_time,s_en_hr,s_end_min,endDateForDisplay,endHourForDisplay,endMinForDisplay,options);
			timeObj.put("filters",filtersOjct);
			response.getWriter().write(""+timeObj);
		}
		else if(isMobileCall)
			response.getWriter().write(""+recTotalCount);
		else
		{
			if(recTotalCount > recTotalRecordCount )
				recTotalRecordCount = recTotalCount;

			response.getWriter().write(""+recTotalCount+"@"+recTotalRecordCount);
		}
		json = new JSONObject();
		json_mobile = new JSONObject();
		hiddenFields = new JSONObject();
		return;
	}

	if(s_test != null && s_ct != null && !isSSTest && (simTypeList != null && simTypeList.contains(s_ct)))
	{
		List compTypeList = new ArrayList();
		compTypeList.add(s_ct);
		List testList = new ArrayList();
		testList.add(s_test);
		List compNameList = new ArrayList();
		compNameList.add(componentName);

		List msmt_host_list = new ArrayList();
		msmt_host_list.add(s_msmt_host);
		
		String s_info_state = "";
		s_info_state=s_info.trim();
		if(s_info.indexOf("*")>-1 && s_info.startsWith("*"))
			s_info_state="+"+s_info.substring(1);
		
		List infoNameList = new ArrayList();
		infoNameList.add(s_info_state);
		
		String temp_ctx_site=s_site;
		if(temp_ctx_site == null)
			temp_ctx_site="NULL";
		if(temp_ctx_site.equalsIgnoreCase("NONE"))
			temp_ctx_site="NULL";
		
		ArrayList measure_list = new ArrayList();
		measure_list.add("LOGON_DURATION");
		measure_list.add("APP_LAUNCH_DURATION");
		stateMeasure = monUtil.getTestTableState(s_test,temp_ctx_site,s_host,s_port,s_info_state,s_msmt_host,selectedCtxTime,measure_list);

		/*String latestTime_check = monUtil.getMeasureLastLatestTime("DDMeasure_last",temp_ctx_site,s_test,s_host,s_port,s_info_state,s_msmt_host);
		if(latestTime_check != null && latestTime_check.trim().length() > 0 && selectedCtxTime != null && selectedCtxTime.trim().length() > 0 && latestTime_check.equals(selectedCtxTime)){
			stateMeasure = monUtil.getComponentState(null,compTypeList,compNameList,null,testList,infoNameList,msmt_host_list,null);
		}else{
			ArrayList measure_list = new ArrayList();
			measure_list.add("LOGON_DURATION");
			measure_list.add("APP_LAUNCH_DURATION");
			stateMeasure = monUtil.getTestTableState(s_test,temp_ctx_site,s_host,s_port,s_info_state,s_msmt_host,selectedCtxTime,measure_list);
		}*/
	}
	String selectCompValue = "";
	//if((vmTypes!=null && (vmTypes.isEmpty() || vmTypes.size()==0)) || (serverTypes!=null && serverTypes.size()>0))
	if(!isVM)
	{
		JSONObject CompFilterObj  = new JSONObject();
		CompFilterObj .put("type","scrollcombo");	
		CompFilterObj .put("name",mappingInfo.getTextDescription("monitor.common.Component Type"));	
		CompFilterObj .put("id","compTypeList");
		String displayCompName=componentName;
		if (componentName.endsWith(EgConstants.NULL_PORT) && (componentName.indexOf(EgConstants.NULL_PORT) > -1))
		{
			displayCompName = Server.getServerNameWithoutPort(componentName, false);
		}
		selectCompValue = s_compTy;
		//CompFilterObj .put("selectedOriginalValue",displayCompName+":"+mappingInfo.getComponentTypeDescription(s_compTy));
		//CompFilterObj .put("selectedOriginalValue",s_compTy);
		CompFilterObj .put("selectedOriginalValue",mappingInfo.getComponentTypeDescription(s_compTy));
		JSONArray compComboArray = new JSONArray();
		List comNameSort=new ArrayList();
		EgList componentList=new EgList();
		java.util.List UserCompList=user.getServers(false);
		if(user.isOnlyVMAssigned() || user.isVMAssigned())
		{
			java.util.List UserVMCompList = user.getOnlyVMServers(true);
			if(UserVMCompList != null && UserVMCompList.size() > 0)
			{
				for(int l=0;l<UserVMCompList.size();l++)
				{
					String vm_comp = (String)UserVMCompList.get(l);
					if(UserCompList != null && !UserCompList.contains(vm_comp))
						UserCompList.add(vm_comp);
				}
			}
		}
		//EgList UserCompList=(EgList)user.getServers(false);
		if (UserCompList != null && UserCompList.size() > 0)
		{
			for(int k=0;k<UserCompList.size();k++)
			{
				String server=(String)UserCompList.get(k);
				String serverType=server.substring(0,server.indexOf(":"));
				String serverName=server.substring(server.indexOf(":")+1);
				String SerPortField = serverName.substring(serverName.indexOf(":")+1);
				String nickNameField = serverName.substring(0,serverName.indexOf(":"));
				comNameSort.add(nickNameField);
				comNameSort.add(server);
				
			}

			if (comNameSort != null && comNameSort.size() > 0)
			{
				EgSorter esort = new EgSorter(comNameSort, 2);
				comNameSort = esort.sort(1, "String", "asc");
			}

		}
		
		if (comNameSort != null && comNameSort.size() > 0)
		{
			UserCompList= new LinkedList();
			for (int i = 0; i < comNameSort.size(); i += 2)
			{
				String compNameLi = (String) comNameSort.get(i);
				String comObject = (String) comNameSort.get(i + 1);
				UserCompList.add(comObject);
			}
		}
		List org_list = new ArrayList();
		Hashtable orgDispName = new Hashtable();
		if(UserCompList != null && UserCompList.size() > 0)
		{
			for(int k=0;k<UserCompList.size();k++){
				
				String compdiskey = (String)UserCompList.get(k);//Generic_server:winmypc:NULL,
				String compTypeField = compdiskey.substring(0,compdiskey.indexOf(":"));
				String compNameField = compdiskey.substring(compdiskey.indexOf(":")+1);
				String compPortField = compNameField.substring(compNameField.indexOf(":")+1);
				String compDisp = compNameField;
				String nickNameField = compNameField.substring(0,compNameField.indexOf(":"));
				if(compPortField.equalsIgnoreCase("null"))
					compDisp = compNameField.substring(0,compNameField.indexOf(":"));
				
				//compCombo.put("name",compDisp+":"+mappingInfo.getComponentTypeDescription(compTypeField));
				
				if(s_host != null && nickNameField != null && compTypeField!=null && s_compTy!=null && nickNameField.equalsIgnoreCase(s_host) && compTypeField.equals(s_compTy))
				{
					if(portRelevantForTest)
					{
						if(s_ct!=null && s_ct.equals("Oracle_server"))
						{
							if(c_sid!=null && c_sid.trim().length()>0 && compPortField!=null && s_port!=null && compPortField.equals(s_port+":"+c_sid))
							{
								//CompFilterObj.put("selectedValue",compdiskey);
								CompFilterObj.put("selectedValue",compTypeField);
							}
							else if(compPortField!=null && s_port!=null && compPortField.equals(s_port))
							{
								//CompFilterObj.put("selectedValue",compdiskey);
								CompFilterObj.put("selectedValue",compTypeField);
							}
						}
						else
						{
							
							if(compPortField!=null && s_port!=null && compPortField.equals(s_port))
							{
								//CompFilterObj.put("selectedValue",compdiskey);
								CompFilterObj.put("selectedValue",compTypeField);
							}
						}
					}
					else
					{
						//CompFilterObj.put("selectedValue",compdiskey);
						CompFilterObj.put("selectedValue",compTypeField);
					}
				}

				//compCombo.put("value",compNameField);
				if(!org_list.contains(mappingInfo.getComponentTypeDescription(compTypeField)))
				{
					org_list.add(mappingInfo.getComponentTypeDescription(compTypeField));
					orgDispName.put(mappingInfo.getComponentTypeDescription(compTypeField),compTypeField);
				}
			}
			if(org_list != null && org_list.size()>1)
			{
				EgSorter esort = new EgSorter(org_list, 1);
				org_list = esort.sort(1, "String", "asc");
			}
			if(org_list != null && org_list.size()>0 && orgDispName != null && orgDispName.size()>0)
			{
				for(int d=0;d<org_list.size();d++)
				{
					String compDispName = (String)org_list.get(d);
					if(orgDispName.containsKey(compDispName))
					{
						String orgCompName = (String)orgDispName.get(compDispName);
						JSONObject compCombo = new JSONObject();
						compCombo.put("name",compDispName);
						compCombo.put("value",orgCompName);
						compComboArray.add(compCombo);
					}
				}
			}
		}
		if(user.isOnlyVMAssigned())
			CompFilterObj.put("isHidden",new Boolean(true));
		CompFilterObj.put("options",compComboArray);
		filterInfo.add(CompFilterObj);
		/*Component list for type------------------------starts---*/
		JSONObject ComponentFilterObj  = new JSONObject();
		ComponentFilterObj .put("type","scrollcombo");	
		ComponentFilterObj .put("name",mappingInfo.getTextDescription("monitor.common.Component"));	
		ComponentFilterObj .put("id","compList");

		if(user.isOnlyVMAssigned())
			ComponentFilterObj.put("isHidden",new Boolean(true));
		//ComponentFilterObj .put("selectedValue",componentName);
		//ComponentFilterObj .put("selectedOriginalValue",componentName+":"+s_compTy);
		if (componentName.endsWith(EgConstants.NULL_PORT) && (componentName.indexOf(EgConstants.NULL_PORT) > -1))
		{
			displayCompName = Server.getServerNameWithoutPort(componentName, false);
		}
		selectCompValue = s_compTy;
		//ComponentFilterObj .put("selectedOriginalValue",displayCompName+":"+mappingInfo.getComponentTypeDescription(s_compTy));
		ComponentFilterObj .put("selectedOriginalValue",displayCompName);
		//JSONArray compComboArray = new JSONArray();
		JSONArray compTypeComboArray = new JSONArray();
		List componentNameSort=new ArrayList();
		java.util.List UserComponentList=user.getServersForType(selectCompValue);
		
		if(user.isOnlyVMAssigned() || user.isVMAssigned())
		{
			if(UserComponentList == null)
				UserComponentList = new ArrayList();
			java.util.List UserVMCompList = user.getOnlyVMServers(true);
			if(UserVMCompList != null && UserVMCompList.size() > 0)
			{
				for(int l=0;l<UserVMCompList.size();l++)
				{
					String vm_comp = (String)UserVMCompList.get(l);
					if(vm_comp != null && vm_comp.indexOf(selectCompValue) != -1)
						UserComponentList.add(vm_comp);
				}
			}
		}
		
		if (UserComponentList != null && UserComponentList.size() > 0)
		{
			for(int k=0;k<UserComponentList.size();k++)
			{
				String server=(String)UserComponentList.get(k);
				String serverType=server.substring(0,server.indexOf(":"));
				String serverName=server.substring(server.indexOf(":")+1);
				String SerPortField = serverName.substring(serverName.indexOf(":")+1);
				String nickNameField = serverName.substring(0,serverName.indexOf(":"));
				componentNameSort.add(nickNameField);
				componentNameSort.add(server);
				
			}

			if (componentNameSort != null && componentNameSort.size() > 0)
			{
				EgSorter esort = new EgSorter(componentNameSort, 2);
				componentNameSort = esort.sort(1, "String", "asc");
			}

		}

		if (componentNameSort != null && componentNameSort.size() > 0)
		{
			UserComponentList= new LinkedList();
			for (int i = 0; i < componentNameSort.size(); i += 2)
			{
				String compNameLi = (String) componentNameSort.get(i);
				String comObject = (String) componentNameSort.get(i + 1);
				UserComponentList.add(comObject);
			}
		}

		if(UserComponentList != null && UserComponentList.size() > 0){
			for(int k=0;k<UserComponentList.size();k++){
				JSONObject componentCombo = new JSONObject();
				String compdiskey = (String)UserComponentList.get(k);//Generic_server:winmypc:NULL,
				String compTypeField = compdiskey.substring(0,compdiskey.indexOf(":"));
				String compNameField = compdiskey.substring(compdiskey.indexOf(":")+1);
				String compPortField = compNameField.substring(compNameField.indexOf(":")+1);
				String compDisp = compNameField;
				String nickNameField = compNameField.substring(0,compNameField.indexOf(":"));
				if(compPortField.equalsIgnoreCase("null"))
					compDisp = compNameField.substring(0,compNameField.indexOf(":"));
				
				//componentCombo.put("name",compDisp+":"+mappingInfo.getComponentTypeDescription(compTypeField));
				componentCombo.put("name",compDisp);
				
				if(s_host != null && nickNameField != null && compTypeField!=null && s_compTy!=null && nickNameField.equalsIgnoreCase(s_host) && compTypeField.equals(s_compTy))
				{
					if(portRelevantForTest)
					{
						if(s_ct!=null && s_ct.equals("Oracle_server"))
						{
							if(c_sid!=null && c_sid.trim().length()>0 && compPortField!=null && s_port!=null && compPortField.equals(s_port+":"+c_sid))
							{
								ComponentFilterObj.put("selectedValue",compdiskey);
							}
							else if(compPortField!=null && s_port!=null && compPortField.equals(s_port))
							{
								ComponentFilterObj.put("selectedValue",compdiskey);
							}
						}
						else
						{
							
							if(compPortField!=null && s_port!=null && compPortField.equals(s_port))
							{
								ComponentFilterObj.put("selectedValue",compdiskey);
							}
						}
					}
					else
					{
						ComponentFilterObj.put("selectedValue",compdiskey);
					}
				}

				//componentCombo.put("value",compNameField);
				componentCombo.put("value",compdiskey);
				compTypeComboArray.add(componentCombo);
			}
		}
		ComponentFilterObj.put("options",compTypeComboArray);
		filterInfo.add(ComponentFilterObj);
		/*Component list for type------------------------ends---*/
	}
	//System.out.println("CompFilterObj*******************"+CompFilterObj);
	//System.out.println("componentName*****************"+mappingInfo.getComponentTypeDescription("Windows_server"));

	JSONObject testFilterObj  = new JSONObject();
	testFilterObj.put("type","scrollcombo");
	testFilterObj.put("name",mappingInfo.getTextDescription("monitor.common.Test"));
	testFilterObj.put("id","testList");
	testFilterObj.put("selectedValue",s_test);
	testFilterObj.put("selectedOriginalValue",mappingInfo.getTestDescription(s_test));
	JSONArray  testComboValues = new JSONArray();
	//EgMonRemoteScriptingBean egMonRemote = new EgMonRemoteScriptingBean("manager");
	EgMonRemoteScriptingBean egMonRemote = new EgMonRemoteScriptingBean(u_rs);
	
	Vector test_vec = (Vector)egMonRemote.getAllRunningDDDTest(s_host,s_port);
	EgTablesInfo tablesInfo=new EgTablesInfo("manager");
	String fromVmSearch = request.getParameter("fromVmSearch");
	boolean isFromVMSearch = false;
	if(fromVmSearch != null && fromVmSearch.equalsIgnoreCase("true"))
	{
		isFromVMSearch = true;
	}

	ArrayList t_l = null;
	if(isFromUserSession || isVM)
	{
		com.eg.IniFile egEx = new com.eg.IniFile(EgInstallInfo.getInstallDir()+ "/manager/config/eg_external.ini");
		String layer_for_url=egEx.getValue("VMSearch_InsideviewLayer",s_ct);
		layer_for_url = (layer_for_url == null)?"VIRTUAL_DESKTOP":layer_for_url;
		t_l = tablesInfo.getTestsForLayer(layer_for_url);
	}
	if(test_vec==null)
		test_vec=new Vector();

	if(s_test!=null && s_test.trim().length()>0 && !test_vec.contains(s_test)){
		test_vec.add(s_test);
	}

	if(test_vec != null && test_vec.size() > 0){
		ArrayList allTests = sorter.getSortedTestList(test_vec);
		Iterator itrTests = allTests.iterator();
		String val ="";
		String dis ="";
		while (itrTests.hasNext())
		{
			EgName nameObj = (EgName)itrTests.next();
			val = nameObj.getActualName();
			dis = nameObj.getLocalName();

			if((isFromUserSession || isVM) && t_l != null && !t_l.contains(val))
				continue;

			boolean isTestRelevantForServer = false;
			if(val!=null && val.trim().length()>0)
			{
				isTestRelevantForServer = specsInfo.isTestRelevantForServer(s_ct,val);
			}
			if(isTestRelevantForServer)
			{
				JSONObject testOptionObj  = new JSONObject();
				testOptionObj.put("name",dis);
				testOptionObj.put("value",val);
				testComboValues.add(testOptionObj);
			}
		}
	}

	/*EgTablesInfo tInfo=new EgTablesInfo("manager");
	JSONArray DDTestList1 = new JSONArray();
	ArrayList layersOfComp1 = new ArrayList();
	layersOfComp1=(ArrayList)tInfo.getLayersForComponent(s_compTy);
	if(c_sid.equals("") && s_compTy.equalsIgnoreCase("Oracle_server")){
		int colonCount = componentName.length()- componentName.replaceAll(":","").length();
		if(colonCount < 2 && s_info != null)
			c_sid = s_info.substring(0,s_info.length()-1);
		else
			c_sid = componentName.substring(componentName.lastIndexOf(":")+1);
	}

	for(int kk=0;kk<layersOfComp1.size();kk++){
		String layerName1 = (String) layersOfComp1.get(kk);
		// For oracle Component
		if(c_sid != null && !c_sid.equals(""))
		{
			DDTestList1 =  egMonRemote.getTestsForDDJSON(s_site,s_host + ":" + s_port+":"+c_sid+":"+s_compTy,layerName1);
		}
		else
		{
			DDTestList1 =  egMonRemote.getTestsForDDJSON(s_site,s_host + ":" + s_port+":"+s_compTy,layerName1);
		}


		if(DDTestList1 != null && DDTestList1.size()>0){
			for(int mm=0;mm<DDTestList1.size();mm++){
				JSONObject vaue =  (JSONObject) DDTestList1.get(mm);
				String disply = ""+vaue.get("displayField");
				String valueFiel = ""+vaue.get("valueField");
				valueFiel=valueFiel.substring(0,valueFiel.indexOf("-+"));
				JSONObject testOptionObj  = new JSONObject();
				testOptionObj.put("name",disply);
				testOptionObj.put("value",valueFiel);
				testComboValues.add(testOptionObj);
			}
		}
	}*/
	testFilterObj.put("options",testComboValues);
	
	filterInfo.add(testFilterObj);
	

	String layer = 	request.getParameter("layer");
	/**ArrayList layersOfComp1 = new ArrayList();
	System.out.println("s_compTy------>"+s_compTy);
	layersOfComp1=(ArrayList)tablesInfo.getLayersForComponent(s_compTy);
	System.out.println("layersOfComp------>"+layersOfComp1);
	for(int kk=0;kk<layersOfComp1.size();kk++){
		String layerName1 = (String) layersOfComp1.get(kk);
		System.out.println("layerNamegetTestsForGraph------>"+layerName1);
		JSONArray DDTestList1 =  egMonRemote.getTestsForDDJSON(s_site,s_host + ":" + s_port+":"+s_compTy,layerName1);
			System.out.println("DDTestList------->"+DDTestList1); 
	}
	*/
	if(layer == null){
		ArrayList layersOfComp = new ArrayList();
		layersOfComp=(ArrayList)tablesInfo.getLayersForComponent(s_compTy);
		String Layer_name_str=tablesInfo.getLayerForTest(s_test);
		layer="HOST";
		if(Layer_name_str!=null && Layer_name_str.trim().length()>0)
		{
			StringTokenizer tokenLayer=new StringTokenizer(Layer_name_str,",");
			if(tokenLayer!=null)
			{
				while(tokenLayer.hasMoreTokens())
				{
					String l_name=(String)tokenLayer.nextToken();
					if(l_name!=null)
					{
						if(layersOfComp != null && layersOfComp.contains(l_name))
						{
							if(tablesInfo.isMeasureInLayer(s_test,s_mes,l_name))
							{
								layer=l_name;
								break;
							}
						}
						else
							continue;
					}
				}
			}
		}
	}
	String measureMentHost = "";
	if(c_sid != null && c_sid != "")
	{
		measureMentHost = egMonRemote.selectMsmtHostForGraph(s_site,s_host + ":" + s_port+":"+c_sid+":"+s_compTy,layer,s_test);
	}
	else
	{
		if(isVM)
		{
			if(vmHistExists)
			{
				for(int g=0;g<hosts.size();g++)
				{
					String vm_comp=(String)hosts.get(g);
					String t_ctype = vm_comp.substring(vm_comp.lastIndexOf(":")+1);
					String t_cname = vm_comp.substring(0,vm_comp.lastIndexOf(":"));
					String t_measureMentHost = egMonRemote.selectMsmtHostForGraph(s_site,t_cname+":"+t_ctype,layer,s_test);
					if(t_measureMentHost == null || t_measureMentHost.trim().length() ==0)
						continue;
					if(g==0)
						measureMentHost +="	"+t_measureMentHost;
					else
						measureMentHost +="	"+t_measureMentHost;
				}
			}
			else
				measureMentHost = egMonRemote.selectMsmtHostForGraph(s_site,s_host + ":" + s_port+":"+s_compTy,layer,s_test);
		}
		else
			measureMentHost = egMonRemote.selectMsmtHostForGraph(s_site,s_host + ":" + s_port+":"+s_compTy,layer,s_test);
	}
	//System.out.println("measureMentHost,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"+measureMentHost);
	JSONObject MeasureHostFilterObj  = new JSONObject();
	MeasureHostFilterObj.put("type","scrollcombo");	
	MeasureHostFilterObj.put("name",mappingInfo.getTextDescription("monitor.common.Measured By"));	
	MeasureHostFilterObj.put("id","measureHostList");
	//MeasureHostFilterObj.put("selectedValue",s_msmt_host);
	JSONArray MeasureHostComboArray = new JSONArray();
	String measureHostInd ="";
	if(measureMentHost != null && measureMentHost.trim().length() > 0){
		
		/**StringTokenizer mesHost = new StringTokenizer(measureMentHost,":");
		String value = mesHost.nextToken();
		JSONObject measureHostCombo = new JSONObject();
		measureHostCombo.put("name",value);
		measureHostCombo.put("value",value);
		MeasureHostComboArray.add(measureHostCombo);*/
		int cnt = 0;
		StringTokenizer mesHost = new StringTokenizer(measureMentHost,"\t");
		boolean selectedFlag =false;
		while(mesHost.hasMoreTokens()){
			String host = mesHost.nextToken();
			String value = host.substring(0,host.indexOf(":"));
			JSONObject measureHostCombo = new JSONObject();
			measureHostCombo.put("name",value);
			measureHostCombo.put("value",value);
			MeasureHostComboArray.add(measureHostCombo);
			if(s_msmt_host != null && s_msmt_host.equalsIgnoreCase(value))
			{
				MeasureHostFilterObj.put("selectedValue",value);
				selectedFlag = true;
			}
			if(cnt==0)
				measureHostInd = value;
			cnt++;
		}
		if(!selectedFlag)
			MeasureHostFilterObj.put("selectedValue",measureHostInd);
	}
	else if(s_msmt_host != null)
	{
		JSONObject measureHostCombo = new JSONObject();
		measureHostCombo.put("name",s_msmt_host);
		measureHostCombo.put("value",s_msmt_host);
		MeasureHostComboArray.add(measureHostCombo);
		MeasureHostFilterObj.put("selectedValue",s_msmt_host);
	}

	//System.out.println("s_msmt_host :: "+s_msmt_host+"   ?::  measureHostInd " +measureHostInd);
	


	MeasureHostFilterObj.put("options",MeasureHostComboArray);
	//System.out.println("MeasureHostComboArray,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"+MeasureHostComboArray);
	filterInfo.add(MeasureHostFilterObj);
	
	
	
	JSONObject tee=egMonRemote.getDDTestsAsJSONForComponent(s_compTy+":"+s_host + ":" + s_port);
	//System.out.println("getDDTestsAsJSONForComponent------------------------------>"+tee);
	//System.out.println("getLayerDescription------------------------------>"+mappingInfo.getLayerDescription("NETWORK"));

	//values.add(request.getParameter("measure"));
	String temp_info="";
	if(s_info.indexOf("*")>-1 && s_info.startsWith("*"))
	{
		//temp_info=s_info.replace('*','+').trim();
		temp_info="+"+s_info.substring(1);
	}
	else if(s_info.indexOf("*")>-1 && !s_info.startsWith("*"))
	{
		String first_in=s_info.substring(0,s_info.indexOf("*"));
		String sec_in=s_info.substring(s_info.indexOf("*")+1);
		temp_info="+"+sec_in;
	}
	int indexValue=-1;
	if(temp_info.indexOf("+")>-1)
	indexValue=temp_info.indexOf("+");
	if(indexValue>-1)
	{
		temp_info=temp_info.substring(indexValue+1);
	}
	//String temp_info=s_info.replace('*',' ').trim();
	if(temp_info != null && !temp_info.equalsIgnoreCase("NONE") && !temp_info.equals("+") &&  temp_info.length() != 0)
	{
		//labels.add("Description");
		//values.add(temp_info);
	}

	int j=0;
	int count =0;
	/**for(int i=0; i< values.size(); i++)
	{
		String labelStr = (String)labels.get(i);
		String valueStr = null;
		if(values.get(i) != null) valueStr = values.get(i).toString();
		JSONObject filterObj  = new JSONObject();
		if( valueStr == null || valueStr.length() == 0  || valueStr.equalsIgnoreCase("NONE") || valueStr.equalsIgnoreCase("-1") || valueStr.equalsIgnoreCase("null") || valueStr.equalsIgnoreCase(" "))
		{
			continue;
		}
		// TR
		if(j % 2 == 0)
		{
			JSONObject nextLineObj  = new JSONObject();
			nextLineObj.put("type","nextLine");
			filterInfo.add(nextLineObj);
		}
							if(isVM)
								{
									filterObj.put("type","label");
									if(labelStr!=null && labelStr.equals("Component"))
									{
										filterObj.put("name",mappingInfo.getTextDescription("monitor.common.VM Name"));
									}
									else
									{
										filterObj.put("name",mappingInfo.getTextDescription("monitor.common."+labelStr));
									}
								}
								else
								{
									filterObj.put("name",mappingInfo.getTextDescription("monitor.common."+labelStr));
								}
		if(labelStr != null && labelStr.equals("Test"))
		{
			filterObj.put("value",mappingInfo.getTestDescription(valueStr));
		}
		else if(labelStr!=null && labelStr.equals("Component"))
		{
			if(isVM)
			{
				
					//valueStr = "-";
					if(temp_info!=null && temp_info.indexOf(":")>-1)
					{
						valueStr = temp_info.substring(0,temp_info.indexOf(":"));

					}
					else
					{
						valueStr = temp_info;
					}
					
					if(count == 0)
						filterObj.put("value",valueStr);
					count++;
				
			}
			else
			{
				if(valueStr.indexOf("NULL")>-1)
				{
					if(valueStr.length()>=valueStr.indexOf("NULL")+4)
					{
						filterObj.put("value",valueStr.substring(0,(valueStr.indexOf("NULL")-1)));						
						if(valueStr.substring(valueStr.indexOf("NULL")+4).length()>0)
						{
							filterObj.put("value",":"+valueStr.substring(valueStr.indexOf("NULL")+4));
						}
					}
					else
						filterObj.put("value",valueStr.substring(0,valueStr.indexOf("NULL")));
				}
				else
				{
					filterObj.put("value",valueStr);
				}
			}
		}
		else
		{
			if(valueStr.indexOf("NULL")>-1)
			{
				if(valueStr.length()>=valueStr.indexOf("NULL")+4)
				{
					filterObj.put("value",valueStr.substring(0,(valueStr.indexOf("NULL")-1)));
					if(valueStr.substring(valueStr.indexOf("NULL")+4).length()>0)
					{
						filterObj.put("value",":"+valueStr.substring(valueStr.indexOf("NULL")+4));
					}
				}
				else
					filterObj.put("value",valueStr.substring(0,valueStr.indexOf("NULL")));
			}
			else
			{
				filterObj.put("value",valueStr);
			}
		}
									//space between two TDs
		if(j % 2 == 0) 
		{
		}
									//End of TR and space
		if(j % 2 != 0)
		{
		}
		j++;
		filterInfo.add(filterObj);
	}// End of for loop
	*/
	JSONObject nextLineObj  = new JSONObject();
	nextLineObj.put("type","nextLine");
	filterInfo.add(nextLineObj);
			String colspan_str="6";
			//if(temp_info != null && !temp_info.equalsIgnoreCase("NONE") && !temp_info.equals("+") &&  temp_info.length() != 0)
			//if(1==1)
			if(!needToHideDescriptorList)
			{
				colspan_str="4";
				ErInfo erInfo = new ErInfo();
				String comp_name_value=componentName;
				if(comp_name_value!=null && comp_name_value.indexOf(":")<0)
				{
					comp_name_value = comp_name_value+":NULL";
				}
				Vector info_list = new Vector();
				try
				{
					if(isVM)
					{
						List vmServerList = user.getOnlyVMServers();
						if(vmServerList != null && vmServerList.size() > 0)
						{
							for(int g=0;g<vmServerList.size();g++)
							{
								String vm_comp=(String)vmServerList.get(g);
								String t_ctype = vm_comp.substring(0,vm_comp.indexOf(":"));
								String t_cname = vm_comp.substring(vm_comp.indexOf(":")+1);
								Vector t_info_list = erInfo.getInfosForTest(s_site,s_test,t_cname+":"+t_ctype,true);
								if(t_info_list != null)
									info_list.addAll(t_info_list);
							}
						}
						else
							 info_list = erInfo.getInfosForTest(s_site,s_test,comp_name_value+":"+s_compTy,true);
						//[VmEsx_i_server:192.168.10.15:NULL, VmEsx_i_server:192.168.10.14:NULL]
					}
					else
						 info_list = erInfo.getInfosForTest(s_site,s_test,comp_name_value+":"+s_compTy,true);
				
				}
				catch(Exception eer)
				{
					eer.printStackTrace();
				}
				String comp_sid=null;
				if(componentName!=null)
				{
					ArrayList comp_split_list = com.egurkha.util.StringUtils.egTokenizer(componentName, ":",false,false,true);//3-->includeEmpty,4-->unique,5-->trim
					if(comp_split_list!=null && comp_split_list.size()>2)
					{
						comp_sid=(String)comp_split_list.get(2);
					}
				}
				
				JSONObject searchFilter = new JSONObject();
				searchFilter.put("type","trigger");
				searchFilter.put("name",mappingInfo.getTextDescription("monitor.common.Search"));
				searchFilter.put("id","search");
				filterInfo.add(searchFilter);
				JSONObject descFilterObj  = new JSONObject();
				descFilterObj.put("type","scrollcombo");
				descFilterObj.put("name",mappingInfo.getTextDescription("monitor.common.Descriptor"));
				descFilterObj.put("id","infolist");
				JSONArray  comboValues = new JSONArray();
				if(info_list!=null && info_list.size()>0)
				{
					for(int k=0; k<info_list.size(); k++)
					{
						String s_list_info = (String)info_list.get(k);
						String temp_info_value=s_list_info;
						String descrip = "";
						String vmInfo = "";
						if(s_list_info!=null && s_list_info.startsWith("+"))
						{
							temp_info_value=s_list_info.substring(1);
							if(isVM)
							{
								if(temp_info_value.indexOf(":")>-1)
								{
									vmInfo = temp_info_value.substring(0,temp_info_value.indexOf(":"));
									descrip = temp_info_value.substring(temp_info_value.indexOf(":")+1);
								}
								else
								{
									vmInfo = temp_info_value;
									descrip="Not Applicable";
								}
								if(a_userVMs!=null && a_userVMs.size() >0)
								{
									if(!a_userVMs.contains(vmInfo))
										continue;
									else
									{
										//To display only the selected vm
										//if(s_info.indexOf(vmInfo)<0)
										//	continue;
									}
								}
							}
							if(comp_sid!=null && comp_sid.trim().length()>0)
							{
								s_list_info=comp_sid+"*"+temp_info_value;
							}
							else
							{
								s_list_info="*"+temp_info_value;
							}
						}
						if(vmInfo.equalsIgnoreCase(s_info))
							descFilterObj.put("selectedValue",s_list_info);
						if(temp_info_value!=null && temp_info!=null && temp_info_value.equals(temp_info))
						{
							if(isVM)
							{
								JSONObject optionObj  = new JSONObject();
								//optionObj.put("name",descrip);
								optionObj.put("name",temp_info_value);
								optionObj.put("value",s_list_info);
								comboValues.add(optionObj);
								descFilterObj.put("selectedValue",s_list_info);
							}
							else
							{
								JSONObject optionObj  = new JSONObject();
								optionObj.put("name",temp_info_value);
								optionObj.put("value",s_list_info);
								comboValues.add(optionObj);
								descFilterObj.put("selectedValue",s_list_info);
							}
							hiddenFields.put("selectedInfoValue",s_list_info);
						}
						else if(temp_info_value!=null && temp_info!=null && temp_info_value.equalsIgnoreCase(temp_info))
						{
							String selInfo = temp_info;
							if(!selInfo.startsWith("*"))
								selInfo = "*"+selInfo;
							if(isVM)
							{
								JSONObject optionObj  = new JSONObject();
								optionObj.put("name",descrip);
								optionObj.put("value",selInfo);
								comboValues.add(optionObj);
								descFilterObj.put("selectedValue",selInfo);
							}
							else
							{
								JSONObject optionObj  = new JSONObject();
								optionObj.put("name",temp_info);
								optionObj.put("value",selInfo);
								comboValues.add(optionObj);
								descFilterObj.put("selectedValue",selInfo);
							}
							hiddenFields.put("selectedInfoValue",selInfo);
						}
						else if(temp_info_value!=null && temp_info_value.trim().length() > 0 && !temp_info_value.equals("+"))
						{
							if(isVM)
							{
								JSONObject optionObj  = new JSONObject();
								//optionObj.put("name",descrip);
								optionObj.put("name",temp_info_value);
								optionObj.put("value",s_list_info);
								comboValues.add(optionObj);
							}
							else
							{
								JSONObject optionObj  = new JSONObject();
								optionObj.put("name",temp_info_value);
								optionObj.put("value",s_list_info);
								comboValues.add(optionObj);
							}
						}
					}
				}
				else
				{
					descFilterObj.put("selectedValue","-1");
					descFilterObj.put("selectedInfoValue",mappingInfo.getTextDescription("monitor.detaileddiagnosis.No Description found"));
					JSONObject optionObj  = new JSONObject();
					optionObj.put("name",mappingInfo.getTextDescription("monitor.detaileddiagnosis.No Description found"));
					optionObj.put("value",-1);
					comboValues.add(optionObj);
				}
				descFilterObj.put("options",comboValues);
				filterInfo.add(descFilterObj);
			}
			JSONObject measureFilterObj  = new JSONObject();
			measureFilterObj.put("type","combo");
			measureFilterObj.put("name",mappingInfo.getTextDescription("monitor.detaileddiagnosis.Measurement"));
			measureFilterObj.put("id","measurelist");
			JSONArray  comboValues = new JSONArray();
	v_measures = (Vector)session.getValue("measures");

	ArrayList hideMeasure = new ArrayList();
	String hide_Meas=(String)dashConfigIniFile.getValue("Hide_Measures_UI",s_test);
	if(hide_Meas!= null && hide_Meas.trim().length() > 0 && !hide_Meas.equalsIgnoreCase("All"))
	{
		hideMeasure = com.egurkha.util.StringUtils.egTokenizer(hide_Meas, ",", false,true,false);
	}
	for(int i=0; i<v_measures.size(); i++)
	{
		s_measure = (String)v_measures.get(i);
		String aa = "";
		aa = s_test + ":" + s_measure;
		if(hideMeasure != null && hideMeasure.size()>0)
		{
			if(s_measure != null && !hideMeasure.contains(s_measure)) 
			{
				if(s_measure.equals(s_mes))
				{
					JSONObject optionObj  = new JSONObject();
					optionObj.put("name",mappingInfo.getMeasureDescription(s_test,s_measure));
					optionObj.put("value",s_measure);
					comboValues.add(optionObj);
					measureFilterObj.put("selectedValue",s_measure);
					measureFilterObj.put("selectedOriginalValue",mappingInfo.getMeasureDescription(s_test,s_measure));
					hiddenFields.put("selectedMeasureValue",s_measure);

				}
				else
				{
					JSONObject optionObj  = new JSONObject();
					optionObj.put("name",mappingInfo.getMeasureDescription(s_test,s_measure));
					optionObj.put("value",s_measure);
					comboValues.add(optionObj);
				}
			}
		}
		else if(hideMeasure != null && hideMeasure.size()==0)
		{
			if(s_measure.equals(s_mes))
			{
				JSONObject optionObj  = new JSONObject();
				optionObj.put("name",mappingInfo.getMeasureDescription(s_test,s_measure));
				optionObj.put("value",s_measure);
				comboValues.add(optionObj);
				measureFilterObj.put("selectedValue",s_measure);
				measureFilterObj.put("selectedOriginalValue",mappingInfo.getMeasureDescription(s_test,s_measure));
				hiddenFields.put("selectedMeasureValue",s_measure);

			}
			else
			{
				JSONObject optionObj  = new JSONObject();
				optionObj.put("name",mappingInfo.getMeasureDescription(s_test,s_measure));
				optionObj.put("value",s_measure);
				comboValues.add(optionObj);
			}
		}
	}
	String comeFrom=request.getParameter("comeFrom");
	hiddenFields.put("comeFrom",comeFrom);
	measureFilterObj.put("options",comboValues);
	filterInfo.add(measureFilterObj);
	
	JSONObject nLineObj  = new JSONObject();
	nLineObj.put("type","nextLine");
	filterInfo.add(nLineObj);

	String temp_test = s_test;
	String FilterforTest = formatIniFile.getValue("DD_Search_Filter",temp_test+":"+s_measure);
	if(s_test != null && s_test.startsWith("RUM"))
	{
		FilterforTest = formatIniFile.getValue("DD_Search_Filter","RUM_DETAILS");
		temp_test = "RUM_DETAILS";
	}
	
	if(FilterforTest!= null && FilterforTest.trim().length() > 0){

		String dispForm = formatIniFile.getValue("FORMAT",temp_test+":"+s_measure);
		String colsDD = formatIniFile.getValue("DDD_TESTS",temp_test);
		String colsDDDisp = formatIniFile.getValue("DD_Data_Display_Order",temp_test+":"+s_measure);
		colsDDDisp = (colsDDDisp==null)?"":colsDDDisp;
		colsDD = (colsDD==null)?"":colsDD;
		dispForm = (dispForm==null)?"":dispForm;

		
		ArrayList dispColList = null;
		if(dispForm != null && dispForm.trim().length() > 0){
			if(dispForm.indexOf("Format:") != -1)
				dispForm = dispForm.substring(dispForm.indexOf("Format:")+1);
			if(dispForm.indexOf(",") != -1)
					dispForm = dispForm.substring(0,dispForm.indexOf(","));
			dispColList = com.egurkha.util.StringUtils.egTokenizer(dispForm, " ",true,false,true);
		}
		ArrayList colsDDDispList = com.egurkha.util.StringUtils.egTokenizer(colsDDDisp, ",",true,false,true);
		ArrayList colsDDList = com.egurkha.util.StringUtils.egTokenizer(colsDD, ",",true,false,true);
		ArrayList searchList = com.egurkha.util.StringUtils.egTokenizer(FilterforTest, ",",true,false,true);
		JSONObject searchFilterObj = new JSONObject();
		searchFilterObj.put("name",mappingInfo.getTextDescription("monitor.common.Filter by"));
		searchFilterObj.put("id","searchComboId");
		searchFilterObj.put("type","combo");
		JSONArray  searchComboVal = new JSONArray();

		//searchFieldVal = request.getParameter("searchfield");
		//searchText = request.getParameter("searchText");
		
		for(int n=0;n<searchList.size();n++){
			int dispIndex = -1;
			String searchVal = (String)searchList.get(n);
			JSONObject searchObj = new JSONObject();
			String dispText = searchVal;
			if(colsDDDispList != null && colsDDDispList.contains(searchVal)){
				for(int u=0;u<colsDDDispList.size();u++){
					String el = (String)colsDDDispList.get(u);
					if(el.equals(searchVal))
						dispIndex = u;
				}
			}else{
				for(int u=0;u<colsDDList.size();u++){
					String el = (String)colsDDList.get(u);
					if(el.equals(searchVal))
						dispIndex = u;
				}
			}
			
			if( dispIndex != -1 && dispColList.size() >= (dispIndex+1)){
				dispText = (String) dispColList.get(dispIndex);
				if(dispText != null){
					dispText = dispText.toUpperCase();
					if(dispText.indexOf("(") != -1)
						dispText = dispText.substring(0,dispText.indexOf("("));
					if(dispText.indexOf("_") != -1)
						dispText=com.egurkha.util.StringUtils.replace(dispText,"_"," ");
				}
				else
				{
					dispText = dispText.toUpperCase();
					if(dispText.indexOf("_") != -1)
						dispText=com.egurkha.util.StringUtils.replace(dispText,"_"," ");
				}
			}
			else
			{	
				dispText = dispText.toUpperCase();
				if(dispText.indexOf("_") != -1)
					dispText=com.egurkha.util.StringUtils.replace(dispText,"_"," ");
			}
			/*if(dispColList != null && dispColList.size() > 0 && colsDDList != null && colsDDList.contains(searchVal)){
				int indexEl = colsDDList.indexOf(searchVal);
				if(dispColList.size() >= indexEl+1){
					String temp_dispText = (String)dispColList.get(indexEl);
					if(temp_dispText != null && temp_dispText.trim().length() > 0)
					{
						dispText = temp_dispText.toUpperCase();
						if(dispText.indexOf("_") != -1)
							dispText=com.egurkha.util.StringUtils.replace(dispText,"_"," ");
					}
				}
			}
			String dbColNam11e=(String)dbInfo.getColumnForMeasure(s_test+"_DDD",dispText,false);
			if(dbColNam11e != null && dbColNam11e != "undefined" && dbColNam11e.trim().length() > 0){
				dispText = dbColNam11e;
			}*/
			searchObj.put("name",dispText);
			searchObj.put("value",searchVal);
			searchComboVal.add(searchObj);
			if(searchFieldVal != null && searchFieldVal.trim().length() > 0){
				searchFilterObj.put("selectedValue",searchFieldVal);
				searchFilterObj.put("selectedOriginalValue",searchFieldVal);
			}
			else if(n==0){
				searchFilterObj.put("selectedValue",searchVal);
				searchFilterObj.put("selectedOriginalValue",searchVal);
			}
		}
		searchFilterObj.put("options",searchComboVal);
		filterInfo.add(searchFilterObj);

		nLineObj  = new JSONObject();
		nLineObj.put("type","nextLine");
		filterInfo.add(nLineObj);

		JSONObject searchFilterText = new JSONObject();
		searchFilterText.put("type","textfield");
		searchFilterText.put("id","searchTextId");
		if(searchText != null && searchText.trim().length() > 0)
			searchFilterText.put("value",searchText);
		else
			searchFilterText.put("value","");

		searchFilterText.put("name",mappingInfo.getTextDescription("monitor.common.Filter Condition"));
		
		filterInfo.add(searchFilterText);

		nLineObj  = new JSONObject();
		nLineObj.put("type","nextLine");
		filterInfo.add(nLineObj);
	}else{
		JSONObject searchFilterObj = new JSONObject();
		searchFilterObj.put("name",mappingInfo.getTextDescription("monitor.common.Filter by"));
		searchFilterObj.put("id","searchComboId");
		searchFilterObj.put("type","combo");
		searchFilterObj.put("isHidden","true");
		filterInfo.add(searchFilterObj);
		
		nLineObj  = new JSONObject();
		nLineObj.put("type","nextLine");
		filterInfo.add(nLineObj);

		JSONObject searchFilterText = new JSONObject();
		searchFilterText.put("type","textfield");
		searchFilterText.put("id","searchTextId");
		searchFilterText.put("value","");
		searchFilterText.put("isHidden","true");

		searchFilterText.put("name",mappingInfo.getTextDescription("monitor.common.Filter Condition"));
		
		filterInfo.add(searchFilterText);

		nLineObj  = new JSONObject();
		nLineObj.put("type","nextLine");
		filterInfo.add(nLineObj);
	}

	ArrayList SortBy_Options = null;
	String RUM_DD_SortByOptions=null;
	String RUM_DD_DefaultSortBy=null;
	String DD_SortByOptions=null;
	String DD_DefaultSortBy=null;
	String SortBy_Tok="";
	String Disp_Name="";
	String DB_colName="";
	if(rumStatus)
	{
		RUM_DD_SortByOptions = egUI.getValue("RUM_DD","SortByOptions");
		RUM_DD_DefaultSortBy = egUI.getValue("RUM_DD","DefaultSortBy");
		
		if(RUM_DD_SortByOptions == null || RUM_DD_SortByOptions.trim().length()==0)
			RUM_DD_SortByOptions="Request Date:REQUEST_DATE,Page Load Time:PAGE_LOAD_TIME";

		if(RUM_DD_DefaultSortBy == null || RUM_DD_DefaultSortBy.trim().length()==0 || RUM_DD_DefaultSortBy.trim().equalsIgnoreCase("null"))
			RUM_DD_DefaultSortBy="PAGE_LOAD_TIME";

		String Default_Disp_Name="";
		String Default_DB_colName="";
		String RUM_DD_DefaultSortByValue="";

		SortBy_Options = com.egurkha.util.StringUtils.egTokenizer(RUM_DD_SortByOptions, ",",true,false,true);
		
		if(sortByVal==null || sortByVal.trim().length() == 0 || sortByVal.trim().equalsIgnoreCase("null"))
		{
			sortByVal = RUM_DD_DefaultSortBy;
		}
		else
			RUM_DD_DefaultSortBy = sortByVal;

		
	}
	else
	{
		DD_SortByOptions = formatIniFile.getValue("DD_SORTBY_OPTIONS",s_test);
		DD_DefaultSortBy = formatIniFile.getValue("DD_SORTBY_OPTIONS",s_test+"_Defaultorder");
		SortBy_Options = com.egurkha.util.StringUtils.egTokenizer(DD_SortByOptions, ",",true,false,true);
		if(sortByVal==null || sortByVal.trim().length() == 0)
		{
			sortByVal = DD_DefaultSortBy;
		}
		else
			DD_DefaultSortBy = sortByVal;
	}
	JSONObject sortByFilterObj  = new JSONObject();
	sortByFilterObj.put("name",mappingInfo.getTextDescription("monitor.common.Sort by"));
	sortByFilterObj.put("id","sortby");
	sortByFilterObj.put("type","combo");
	
	if(rumStatus || isSortEnabledTest)
		sortByFilterObj.put("hidden",false);
	else
		sortByFilterObj.put("hidden",true);



	JSONArray sortByValues=new JSONArray();
	for(int sort=0;sort<SortBy_Options.size();sort++)
	{
		JSONObject  sortObj= new JSONObject();
		SortBy_Tok=(String)SortBy_Options.get(sort);
		if(SortBy_Tok!=null && SortBy_Tok.indexOf(":")>-1)
		{
			Disp_Name=SortBy_Tok.substring(0,SortBy_Tok.indexOf(":"));
			DB_colName=SortBy_Tok.substring(SortBy_Tok.indexOf(":")+1);
		}
		else
		{
			Disp_Name=SortBy_Tok;
			if(Disp_Name!=null && Disp_Name.contains("_"))
			{
				Disp_Name = StringUtils.replace(Disp_Name,"_"," ");
			}
			else
			{
				Disp_Name = StringUtils.replace(Disp_Name," ","_");
			}
		
			if(SortBy_Tok != null && SortBy_Tok.trim().length() > 0 && SortBy_Tok.indexOf(" ")>-1)
				DB_colName = StringUtils.replace(SortBy_Tok," ","_");
		}

		sortObj.put("name",(String)Disp_Name);
		sortObj.put("value",(String)DB_colName);
		if(rumStatus)
		{
			if(RUM_DD_DefaultSortBy!=null && DB_colName!=null && RUM_DD_DefaultSortBy.equals(DB_colName))
			{
				sortByFilterObj.put("selectedValue",RUM_DD_DefaultSortBy);
				sortByFilterObj.put("selectedOriginalValue",Disp_Name);
			}
			else if(RUM_DD_DefaultSortBy!=null && Disp_Name!=null && RUM_DD_DefaultSortBy.equals(Disp_Name))
			{
				sortByFilterObj.put("selectedValue",DB_colName);
				sortByFilterObj.put("selectedOriginalValue",Disp_Name);
			}
		}
		else
		{
			if(DD_DefaultSortBy!=null && DB_colName!=null && DD_DefaultSortBy.equals(DB_colName))
			{
				sortByFilterObj.put("selectedValue",DD_DefaultSortBy);
				sortByFilterObj.put("selectedOriginalValue",Disp_Name);
			}
			else if(DD_DefaultSortBy!=null && Disp_Name!=null && DD_DefaultSortBy.equals(Disp_Name))
			{
				sortByFilterObj.put("selectedValue",DB_colName);
				sortByFilterObj.put("selectedOriginalValue",Disp_Name);
			}
		}
		sortByValues.add(sortObj);
	}

	sortByFilterObj.put("options",sortByValues);
	filterInfo.add(sortByFilterObj);

	
	JSONObject timelineFilterObj  = new JSONObject();
	timelineFilterObj.put("name",mappingInfo.getTextDescription("monitor.common.Timeline"));
	timelineFilterObj.put("id","timeline");
	timelineFilterObj.put("type","combo");
	JSONArray  timeLineComboValues = new JSONArray();
	for(int e_ctr=0; e_ctr < options.length;e_ctr++)
	{
		if(timeLine!=null&&timeLine.equals((String)options[e_ctr]))
		{
			String tempOptions="";
			String tempOptions2="";
			if(timeLine.indexOf(" ")>-1)
			{
				tempOptions2=timeLine.substring(0,timeLine.indexOf(" "))+" ";
				tempOptions=timeLine.substring(timeLine.indexOf(" ")+1);
			}
			else
			{
				tempOptions=timeLine;
			}
			JSONObject timelineOption = new JSONObject();
			timelineOption.put("name",tempOptions2+mappingInfo.getTextDescription("monitor.common."+tempOptions));
			timelineOption.put("value",timeLine);
			if(orgDispVal != null && orgDispVal.trim().length() > 0 && orgDispVal.equalsIgnoreCase("Latest") && timeLine != null && timeLine.equalsIgnoreCase("1 hour"))
			{
				timelineFilterObj.put("selectedValue",orgDispVal);
			}
			else
			{
				timelineFilterObj.put("selectedValue",timeLine);
			}
			timeLineComboValues.add(timelineOption);
		}
		else
		{
			String tempOptions="";
			String tempOptions2="";
			if(options[e_ctr].indexOf(" ")>-1)
			{
				tempOptions2=options[e_ctr].substring(0,options[e_ctr].indexOf(" "))+" ";
				tempOptions=options[e_ctr].substring(options[e_ctr].indexOf(" ")+1);
			}
			else
			{
				tempOptions=options[e_ctr];
			}
			JSONObject timelineOption = new JSONObject();
			timelineOption.put("name",tempOptions2+mappingInfo.getTextDescription("monitor.common."+tempOptions));
			timelineOption.put("value",options[e_ctr]);
			timeLineComboValues.add(timelineOption);
		}

	}
	timelineFilterObj.put("options",timeLineComboValues);
	filterInfo.add(timelineFilterObj);
	
	JSONObject fromDateFilter = new JSONObject();
	fromDateFilter.put("type","date");
	fromDateFilter.put("name",mappingInfo.getTextDescription("monitor.common.From"));
	fromDateFilter.put("id","fromdate");
		if(s_st_time!=null && !s_st_time.equals(""))
		{
			if(DateUtil.isDate(s_st_time,"MM/dd/yyyy"))
			{
				comFormat ="MM/dd/yyyy";
			}
			else
			{
				comFormat = dateFormatForDatePick;
			}
			//fromDateFilter.put("format",currentDateFormat);
			fromDateFilter.put("format",dateFormatForDatePick);
			fromDateFilter.put("time",s_st_time);
			
			//dispDate = DateUtil.changeDateFormat(s_st_time,comFormat,currentDateFormat);
			dispDate = DateUtil.changeDateFormat(s_st_time,comFormat,dateFormatForDatePick);
			//s_st_time = dispDate;
			timeZoneConverterStart = new EgTimeZoneConverter(dispDate+" "+s_st_hr+":"+s_st_min+":"+"00",user);
			startDateForDisplay = (String) timeZoneConverterStart.getDate(false);
			startHourForDisplay = timeZoneConverterStart.getHour();
			startMinForDisplay = timeZoneConverterStart.getMinute();
			//dispDate = DateUtil.changeDateFormat(startDateForDisplay,comFormat,currentDateFormat);
			dispDate = DateUtil.changeDateFormat(startDateForDisplay,comFormat,dateFormatForDatePick);
			s_st_time = dispDate;
			s_st_hr = startHourForDisplay;
			s_st_min = startMinForDisplay;
			fromDateFilter.put("selectedValue",dispDate);
		}
		else
		{
			dispDate = "";
		}
		filterInfo.add(fromDateFilter);
		
		JSONObject fromHrFilter = new JSONObject();
		fromHrFilter.put("type","combo");
		fromHrFilter.put("name",mappingInfo.getTextDescription("monitor.common.Hr"));
		fromHrFilter.put("id","fromHr");
		JSONArray  fromHrOptions = new JSONArray();
		int i_tmp = Integer.parseInt(startHourForDisplay);
		for(int ctr=0; ctr < 24 ;ctr++)
		{
			JSONObject fromHrOption = new JSONObject();
			fromHrOption.put("name",ctr);
			fromHrOption.put("value",ctr);
			fromHrOptions.add(fromHrOption);
			if(ctr==i_tmp){
				fromHrFilter.put("selectedValue",ctr);
			}
		}
		fromHrFilter.put("options",fromHrOptions);
		filterInfo.add(fromHrFilter);
		
		JSONObject fromMinFilter = new JSONObject();
		fromMinFilter.put("type","combo");
		fromMinFilter.put("name",mappingInfo.getTextDescription("monitor.common.Min"));
		fromMinFilter.put("id","fromMin");
		JSONArray  fromMinOptions = new JSONArray();
		i_tmp = Integer.parseInt(startMinForDisplay);
		for(int ctr=0; ctr < 60 ;ctr++)
		{
			JSONObject fromMinOption = new JSONObject();
			fromMinOption.put("name",ctr);
			fromMinOption.put("value",ctr);
			fromMinOptions.add(fromMinOption);
			if(ctr==i_tmp){
				fromMinFilter.put("selectedValue",ctr);
			}
		}
		fromMinFilter.put("options",fromMinOptions);
		filterInfo.add(fromMinFilter);
		
		JSONObject toDateFilter = new JSONObject();
		toDateFilter.put("type","date");
		toDateFilter.put("name",mappingInfo.getTextDescription("monitor.common.To"));
		toDateFilter.put("id","todate");
		if(s_en_time!=null && !s_en_time.equals(""))
		{
			if(DateUtil.isDate(s_en_time,"MM/dd/yyyy"))
			{
				comFormat = "MM/dd/yyyy";
			}
			else
			{
				comFormat = dateFormatForDatePick;
			}

			//toDateFilter.put("format",currentDateFormat);
			toDateFilter.put("format",dateFormatForDatePick);
			toDateFilter.put("time",s_en_time);
			//dispDate = DateUtil.changeDateFormat(s_en_time,comFormat,currentDateFormat);
			dispDate = DateUtil.changeDateFormat(s_en_time,comFormat,dateFormatForDatePick);
				//s_en_time = dispDate;
				//toDateFilter.put("selectedValue",dispDate);
			timeZoneConverterEnd = new EgTimeZoneConverter(dispDate+" "+s_en_hr+":"+s_end_min+":"+"00",user);
			endDateForDisplay = (String) timeZoneConverterEnd.getDate(false);
			endHourForDisplay = timeZoneConverterEnd.getHour();
			endMinForDisplay = timeZoneConverterEnd.getMinute();
			
			 //dispDate = DateUtil.changeDateFormat(endDateForDisplay,comFormat,currentDateFormat);
			 dispDate = DateUtil.changeDateFormat(endDateForDisplay,comFormat,dateFormatForDatePick);
			 s_en_time = dispDate;
			 s_en_hr = endHourForDisplay;
			 s_end_min = endMinForDisplay;
			 toDateFilter.put("selectedValue",dispDate);
		}
		else
		{
			dispDate = "";
		}
	    filterInfo.add(toDateFilter);
		
		JSONObject toHrFilter = new JSONObject();
		toHrFilter.put("type","combo");
		toHrFilter.put("name",mappingInfo.getTextDescription("monitor.common.Hr"));
		toHrFilter.put("id","toHr");
		JSONArray  toHrOptions = new JSONArray();
		i_tmp=Integer.parseInt(endHourForDisplay);
		for(int ctr=0; ctr < 24 ;ctr++)
		{
			JSONObject toHrOption = new JSONObject();
			toHrOption.put("name",ctr);
			toHrOption.put("value",ctr);
			toHrOptions.add(toHrOption);
			if(ctr==i_tmp){
				toHrFilter.put("selectedValue",ctr);
			}
		}
		toHrFilter.put("options",toHrOptions);
		filterInfo.add(toHrFilter);
		
		JSONObject toMinFilter = new JSONObject();
		toMinFilter.put("type","combo");
		toMinFilter.put("name",mappingInfo.getTextDescription("monitor.common.Min"));
		toMinFilter.put("id","toMin");
		JSONArray  toMinOptions = new JSONArray();
		i_tmp = Integer.parseInt(endMinForDisplay);
		for(int ctr=0; ctr < 60 ;ctr++)
		{
			JSONObject toMinOption = new JSONObject();
			toMinOption.put("name",ctr);
			toMinOption.put("value",ctr);
			toMinOptions.add(toMinOption);
			if(ctr==i_tmp){
				toMinFilter.put("selectedValue",ctr);
			}
		}
		toMinFilter.put("options",toMinOptions);
		filterInfo.add(toMinFilter);

		if(!isFromUserSession)
		{
			session.setAttribute("dd_sttime" , s_st_time);
			session.setAttribute("dd_entime" , s_en_time);
		}
	String enable="false";
	if(a_results.size() > 0 && s_from.equals("0"))
		enable="true";
	
	JSONObject submitBtn = new JSONObject();
	submitBtn.put("type","button");
	submitBtn.put("text",mappingInfo.getTextDescription("monitor.common.Submit"));
	filterInfo.add(submitBtn);
	hiddenFields.put("hqstring",hnqstring);
	hiddenFields.put("comptype",s_compTy);
	hiddenFields.put("site",s_site);
	hiddenFields.put("host",s_host);
	hiddenFields.put("port",s_port);
	hiddenFields.put("test",s_test);
	hiddenFields.put("info",s_info);
	hiddenFields.put("msmt_host",s_msmt_host);
	hiddenFields.put("strValue",strValue);
	hiddenFields.put("proceed",proceed);
	hiddenFields.put("s_desc",s_desc);
	hiddenFields.put("s_st_time",s_st_time);
	hiddenFields.put("s_en_time",s_en_time);
	hiddenFields.put("enable",enable);
	hiddenFields.put("s_st_hr",s_st_hr);
	hiddenFields.put("s_en_hr",s_en_hr);
	hiddenFields.put("s_st_min",s_st_min);
	hiddenFields.put("s_end_min",s_end_min);
	hiddenFields.put("layer",session.getAttribute("layerforDD"));
	hiddenFields.put("isVM",isVM);
	hiddenFields.put("source",source);
	hiddenFields.put("detailedDiagnosis",mappingInfo.getTextDescription("monitor.csv.Detailed Diagnosis"));
	hiddenFields.put("messwills_val",EgURLEncoder.encode(s_desc,"UTF-8"));
	hiddenFields.put("dateErrorDate",mappingInfo.getTextDescription("monitor.common.From date should be lesser than To date"));
	hiddenFields.put("dateErrorCurrentDate",mappingInfo.getTextDescription("monitor.common.From and To Date should be lesser than Current date"));
	hiddenFields.put("analysis",mappingInfo.getTextDescription("monitor.detaileddiagnosis.Analysis"));
	hiddenFields.put("pdf",mappingInfo.getTextDescription("monitor.common.SAVE"));
	hiddenFields.put("csv",mappingInfo.getTextDescription("monitor.common.CSV"));
	hiddenFields.put("print",mappingInfo.getTextDescription("monitor.common.PRINT"));
	//block starts for pdf
	if(!isFromAlarmDetails)
		json.put("filters",filterInfo);
	
	String layer_save = (String)session.getAttribute("layerforDD");
	String strValue1 = com.egurkha.util.StringUtils.encodeSecurityChar(strValue);
	//strValue1 = EgURLEncoder.encode(strValue1,"UTF-8");
	//String s_desc1 = EgURLEncoder.encode(s_desc,"UTF-8");
	String t_s_info=com.egurkha.util.StringUtils.encodeSecurityChar(s_info);
	String t_s_desc=com.egurkha.util.StringUtils.encodeSecurityChar(s_desc);
	t_s_desc=com.egurkha.util.StringUtils.replace(t_s_desc,"'","|sinquot|");
	String q_string="s_host="+EgURLEncoder.encode(s_host,"UTF-8")+"&s_port="+s_port+"&s_mes="+s_mes+"&s_site="+s_site+"&s_info="+EgURLEncoder.encode(t_s_info,"UTF-8")+"&s_test="+s_test+"&messwills_val="+ EgURLEncoder.encode(t_s_desc,"UTF-8")+"&messwills=1"+"&strValue="+EgURLEncoder.encode(strValue1,"UTF-8")+"&proceed="+proceed+"&msmt_host="+EgURLEncoder.encode(s_msmt_host,"UTF-8")+"&layer="+layer_save+"&s_end_min="+s_end_min+"&s_st_min="+s_st_min+"&s_st_hr="+s_st_hr+"&s_en_hr="+s_en_hr+"&comptype="+s_compTy+"&isVM="+isVM;
	String PDFPAGE = "true";
	String mngrIProc = new IniFile(new com.eg.EgConfigInfo("manager").getDbFile()).getValue("DB_PROPERTIES","ManagerUrl");
	String htmlFileName = mngrIProc+"/final/monitor/Egprintdata.jsp;jsessionid="+session.getId()+"?"+q_string+"&reqFrom=DD";
	if(tmpComesForDD!=null && tmpComesForDD.trim().length()>0 && !tmpComesForDD.equalsIgnoreCase("NULL"))
	{
		htmlFileName = htmlFileName + "&comesForDD="+tmpComesForDD;
	}
	if(!isFromUserSession)
	{
		session.setAttribute("PopUP_PDF_URL",htmlFileName);
		session.setAttribute("REPORT_NAME","Detailed_Diagnosis");
		session.setAttribute("REPORT_LAYOUT","Landscape");
		session.setAttribute("PAGE_WIDTH_PDF","1100");
		session.setAttribute("title","Detailed_Diagnosis");
		session.setAttribute("frmPage","EgDiagnosis");
	}
	//block ends for pdf
	String qstring=hnqstring;//(String)session.getAttribute("nqstring");//request.getQueryString();
	if(qstring.indexOf("info")<0)
		qstring=request.getQueryString();
	JSONArray  tools = new JSONArray();
	if(qstring!=null&&a_results!=null&a_results.size()>0)
	{
		String Qstring="";
		// for encode issue when click Analysis icon. its fixed.
		// encode in java script enableFilter method.
		if(qstring!=null)
		{
			qstring = com.egurkha.util.StringUtils.decodeSecurityChar(qstring);
			qstring=com.egurkha.util.StringUtils.replace(qstring,"&","|amp|");
			StringTokenizer strtok = new StringTokenizer(qstring,"&");
			while(strtok.hasMoreTokens())
			{
				String param = strtok.nextToken();
				String reqparam =param.substring(0,param.indexOf("="));
				String value = param.substring(param.indexOf("=")+1,param.length());
				if(reqparam.equals("info"))
				{
					value=request.getParameter(reqparam) ;
					if(isForAllInfoReport && value !=null && value.trim().length()>0 && value.equalsIgnoreCase("allinfo"))
					{
						needToHideDescriptorList = true;
						value="~infoForDD~";
					}
					value=com.egurkha.util.StringUtils.replace(value,"+","|plus|");
					value=com.egurkha.util.StringUtils.replace(value,"&","|amp|");
					value=com.egurkha.util.StringUtils.replace(value,"%","|pct|");
					value=com.egurkha.util.StringUtils.replace(value,"#","|hash|");
					value=com.egurkha.util.StringUtils.replace(value,"$","|dollar|");
				}
				else if(reqparam.equals("host"))
				{
					value=request.getParameter(reqparam) ;
				}
				else if(reqparam.equals("sinfo"))
				{
					value=request.getParameter(reqparam) ;
					value=com.egurkha.util.StringUtils.replace(value,"+","|plus|");
					value=com.egurkha.util.StringUtils.replace(value,"&","|amp|");
					value=com.egurkha.util.StringUtils.replace(value,"%","|pct|");
					value=com.egurkha.util.StringUtils.replace(value,"#","|hash|");
					value=com.egurkha.util.StringUtils.replace(value,"$","|dollar|");
				}
				else if(reqparam.equals("test"))
				{
					value=request.getParameter(reqparam);
				}
				else if(reqparam.equals("layer"))
				{
					value=request.getParameter(reqparam) ;
				}
				else if(reqparam.equals("site"))
				{
					value=request.getParameter(reqparam) ;
				}
				else if(reqparam.equals("msmt_host"))
				{
					value=request.getParameter(reqparam) ;
				}
				else if(reqparam.equalsIgnoreCase("newWindow"))
					continue;
				else if(reqparam!=null)
				{
					value=request.getParameter(reqparam);
				}

				Qstring=Qstring+reqparam+"="+value+"&";
			}
		}
		if(Qstring!=null && Qstring.endsWith("&"))
			Qstring=Qstring.substring(0,Qstring.lastIndexOf("&"));
		Qstring = Qstring+ "&isVM="+isVM+"&source="+source;
		//---end--- for encode issue.
		
		
		if(fromPage!=null && fromPage.equalsIgnoreCase("alarm"))
		{
			JSONObject toolObj  = new JSONObject();
			toolObj.put("tooltip",mappingInfo.getTextDescription("monitor.detaileddiagnosis.Analysis"));
			toolObj.put("src","/final/monitor/eg_images/analysis.gif");
			toolObj.put("id","analysis");
			tools.add(toolObj);
		}
		else
		{
			JSONObject toolObj  = new JSONObject();
			toolObj.put("tooltip",mappingInfo.getTextDescription("monitor.detaileddiagnosis.Analysis"));
			toolObj.put("src","/final/monitor/eg_images/analysis.gif");
			toolObj.put("id","analysis");
			tools.add(toolObj);
		}
		
	}
	
	JSONObject pdfToolObj  = new JSONObject();
	pdfToolObj.put("tooltip",mappingInfo.getTextDescription("monitor.common.SAVE"));
	pdfToolObj.put("src","/final/monitor/eg_images/pdf-icon.gif");
	pdfToolObj.put("id","pdf");
	tools.add(pdfToolObj);
	
	JSONObject csvToolObj  = new JSONObject();
	csvToolObj.put("tooltip",mappingInfo.getTextDescription("monitor.common.CSV"));
	csvToolObj.put("src","/final/monitor/eg_images/csv.gif");
	csvToolObj.put("id","csv");
	tools.add(csvToolObj);
	
	JSONObject printToolObj  = new JSONObject();
	printToolObj.put("tooltip",mappingInfo.getTextDescription("monitor.common.PRINT"));
	printToolObj.put("src","/final/monitor/eg_images/print.gif");
	printToolObj.put("id","print");
	tools.add(printToolObj);
	if(!isFromAlarmDetails)
		json.put("tools",tools);
	if(s_desc!=null&&s_desc.indexOf(".")>-1)
	{
		//s_desc=s_desc.replace(".","&#46");
		s_desc=StringUtils.replace(s_desc,".","&#46");
	}

	boolean show = false;
	if(a_results.size() > 0 && s_from.equals("0"))
	{
		show = true;
		
	}
	
	if(!isFromAlarmDetails)
	{
		json.put("isSSTest",""+isSSTest);
		json.put("host",s_host);
	}
	StringBuffer sbData = new StringBuffer();
	StringBuffer sbPagination=new StringBuffer();
//--------------vijay------------------
	if(show)
	{
		String mappingInfovalue = null;
		if(isAPMTest)
		{
			if(s_desc.equals("Slow Transaction Details"))
				mappingInfovalue=mappingInfo.getTextDescription("monitor.detaileddiagnosis.Slow Transaction Snapshots for ");
			else if(s_desc.equals("Stalled Transaction Details"))
				mappingInfovalue=mappingInfo.getTextDescription("monitor.detaileddiagnosis.Stalled Transaction Snapshots for ");
			else if(s_desc.equals("Error Transaction Details"))
				mappingInfovalue=mappingInfo.getTextDescription("monitor.detaileddiagnosis.Error Transaction Snapshots for ");
			else if(s_desc.equals("Healthy Transaction Details"))
				mappingInfovalue=mappingInfo.getTextDescription("monitor.detaileddiagnosis.Healthy Transaction Snapshots for ");
			else if(s_desc.equals("All Transaction Details"))
				mappingInfovalue=mappingInfo.getTextDescription("monitor.detaileddiagnosis.All Transaction Snapshots for ");
			//mappingInfovalue=mappingInfo.getTextDescription("monitor.detaileddiagnosis."+s_desc+" for ");
			hiddenFields.put("title",mappingInfovalue+" "+s_host);
		}
		else
		{
			mappingInfovalue=mappingInfo.getTextDescription("monitor.detaileddiagnosis."+s_desc);
			if(s_test.endsWith("_ag") | s_test.endsWith("_agx"))
			{
				hiddenFields.put("title",mappingInfovalue + agg_function_img_path);
			}
			else
			{
				hiddenFields.put("title",mappingInfovalue);
			}
		}

		//sbData.append("<table align = 'center' cellspacing = '0' cellpadding = '0' border = '0' width='100%' style='padding-top:0px;' borderColor='red' ><tr><th nowrap width='100%' class='data_headbg'  id='white_text' align='left' valign='top'>&nbsp;"+mappingInfovalue+"</th></tr><tr><td id='bottomTableTd' class = 'data_border' style='height:400px;' valign='top' >");
		
		sbData.append("<div class=\"DDx-table\" style=\"border:none\"><table border = \"1\" style=\"margin-right:3px;width:100%;table-layout:auto\" bordercolor=\"green\" class=\"x-grid-table\"><thead><tr class=\"x-grid-row \">");
		JSONObject gridInfo  = new JSONObject();
		JSONObject gridInfo_mobile  = new JSONObject();
		if(isAPMTest)
		{
			gridInfo.put("gridHeader",mappingInfovalue+" "+s_host);
			gridInfo_mobile.put("gridHeader",mappingInfovalue+" "+s_host);
		}
		else
		{
			gridInfo.put("gridHeader",mappingInfo.getTextDescription("monitor.detaileddiagnosis."+s_desc));
			gridInfo_mobile.put("gridHeader",mappingInfo.getTextDescription("monitor.detaileddiagnosis."+s_desc));
		}
		String popUp=request.getParameter("isPopUp");
		if(popUp==null)
		{
			popUp=request.getParameter("newWindow");
		}

		boolean isSapMonPerfTest = false;
		if(s_compTy!=null && s_compTy.equals("SAP_R3_server") && s_test!=null && s_test.equalsIgnoreCase("SapMonPerfTest"))
			isSapMonPerfTest = true;

		String position_ie="relative";
		if (isSapMonPerfTest && (isMSIE7 || isMSIE6))
		{
			position_ie="absolute";
		}

		s_format = s_format.substring(s_format.indexOf(":")+1);
		if(isDDDInfoDisplay)
			s_format = ddWithallInfoDispName+" "+s_format;
		
		st = new StringTokenizer(s_format);
		tokCount = st.countTokens();


		//al_header = tokInfo.egTokenizer(s_format, " ");
		al_header = com.egurkha.util.StringUtils.egTokenizer(s_format, " ",false,false,true);//3-->includeEmpty,4-->unique,5-->trim
		ArrayList headers = new ArrayList();
		//headers = tokInfo.egTokenizer(s_format, " ");
		headers = com.egurkha.util.StringUtils.egTokenizer(s_format, " ",false,false,true);//3-->includeEmpty,4-->unique,5-->trim

		// for remove column name have only space, Modified on 28-8-2008
		if(al_header!=null &&al_header.size()>0)
		{
			for(int z=0;z<al_header.size();z++)
			{
				String columnName=(String)al_header.get(z);
				
				if(columnName!=null && columnName.trim().length()==0)
				{
					al_header.remove(z);
				}
			}
		}
		if(headers!=null&&headers.size()>0)
		{
			String osDepColumn  = null;
			if(isOSDepTest)
			{
				if(os_name!=null && os_name.startsWith("win"))
					osDepColumn  = 	trans.getStrValue("DDD_EmptyColumns_List",s_test+"_DDD:"+s_mes+":Windows");
				else if(os_name!=null && os_name.startsWith("lin"))
					osDepColumn  = 	trans.getStrValue("DDD_EmptyColumns_List",s_test+"_DDD:"+s_mes+":Linux");
				else if(os_name!=null && os_name.startsWith("sol"))
					osDepColumn  = 	trans.getStrValue("DDD_EmptyColumns_List",s_test+"_DDD:"+s_mes+":Solaris");
				else if(os_name!=null && os_name.startsWith("aix"))
					osDepColumn  = 	trans.getStrValue("DDD_EmptyColumns_List",dummyTestTmp+"_DDD:"+dummyMesTmp+":Aix");
				else if(os_name!=null && os_name.startsWith("hpux"))
					osDepColumn  = 	trans.getStrValue("DDD_EmptyColumns_List",dummyTestTmp+"_DDD:"+dummyMesTmp+":Hpux"); 
			}

			String emptyColumn  = trans.getStrValue("DDD_EmptyColumns_List",s_test+"_DDD:"+s_mes);
			

			for(int z=0;z<headers.size();z++)
			{
				boolean removeColumn=false;
				String columnName=(String)headers.get(z);

				if(osDepColumn!=null && osDepColumn.trim().length()>0)
				{
					emptyColumn=(emptyColumn==null)?"":emptyColumn;
					if(emptyColumn!=null && emptyColumn.trim().length()>0)
						emptyColumn=emptyColumn+","+osDepColumn;
					else
						emptyColumn=osDepColumn;
				}

				if(emptyColumn!=null&&emptyColumn.indexOf(",")>-1)
				{
					//ArrayList emptyColumnsList = tokInfo.egTokenizer(emptyColumn, ",");
					ArrayList emptyColumnsList = com.egurkha.util.StringUtils.egTokenizer(emptyColumn, ",",true,false,true);//3-->includeEmpty,4-->unique,5-->trim
					for(int x=0; x<emptyColumnsList.size(); x++)
					{
						String column = (String)emptyColumnsList.get(x);
						if(columnName.equalsIgnoreCase(column))
						{
							removeColumn=true;
							break;
						}
					}
				}
				else
				{
					if(emptyColumn != null && emptyColumn.equalsIgnoreCase(columnName))
						removeColumn=true;
				}
				if(removeColumn)
				{
					al_header.remove(columnName);
				}
			}
			if (isJavaTransactionsTest) 
			{
				//enable for subcomp column  murugan
				//al_header.remove(al_header.size()-1); // removing URL Tree column (last column)
			}
		}

		String measure=request.getParameter("measure");
		String successScreenshot=request.getParameter("isForSuccessScreenshot");
		String _isScreenShotEnabled=request.getParameter("isScreenShotEnabled");
		_isScreenShotEnabled = (_isScreenShotEnabled == null)?"false":_isScreenShotEnabled;
		boolean isScreenShotEnabled = false;
		if(s_test.equalsIgnoreCase("GenericLogonSimTest") &&  _isScreenShotEnabled.equalsIgnoreCase("true"))
			isScreenShotEnabled = true;
		
		/*if (measure!=null && measure.equals("New_logins"))
			al_header.remove(2);*/
		//new change
		boolean commonDateLayout = true;
		int singleRowSize = 0;
		int totalRows = 0;
		if(al_header.size() <= 4) //&& singleRowSize >= ( (3 * totalRows)/4 ) )
		{
			commonDateLayout = false;
		}
		
		
		for(int a=0; a<a_results.size(); a=a+1)
		{
		
			a_temp = null;
			a=a+1;
			a_temp = (ArrayList)a_results.get(a);
			totalRows = totalRows + a_temp.size();
			if(a_temp != null && a_temp.size() == 1)
			{
				if (s_test.equalsIgnoreCase("JavaTransactionsTest")) 
					commonDateLayout=true;
				else
					singleRowSize++;
			}
			else
				commonDateLayout=true;
			//}
		}// For loo

		/*if(al_header.size() <= 4 && singleRowSize >= ( (3 * totalRows)/4 ) ){
			commonDateLayout = false;
		}*/

		if(comeFrom!=null && comeFrom.equals("Reporter"))
		{
			al_header.add(0,"Time");
		}
		else
		{
			//al_header.add(0,"Time");
		}
		// new change end 

		int cellwidth = 100/(int)al_header.size();
		//out.print((int)al_header.size());
		//out.print(cellwidth);
		sbData.append("</tr><tr class=\"x-grid-row \">");
		vec_Tabletitle.add(" ");
		vec_Tabletitle.add("TIME");
		//vec_Tabletitle.add(" ");
		
		if(s_compTy!=null && s_compTy.equals("SAP_R3_server") && s_test!=null && s_test.equalsIgnoreCase("SapAlertsTest"))
			isSapAlertsTest = true;

		if(isSapAlertsTest)
		{
			al_header.set(3,"SYSTEM");//Replace title SysId to  SYSTEM
			al_header.set(8,"Importance");//Replacetitle Severity to  Importance
			al_header.remove(9);//remove severit color from header
		}
		JSONArray  headersArray = new JSONArray();
		JSONArray  headersArray_mobile = new JSONArray();
	
		JSONObject headerObjTime  = new JSONObject();
		headerObjTime.put("text","TIME");
	
		
		headerObjTime.put("sortable",false);
		headerObjTime.put("dataIndex","time");
		headersArray.add(headerObjTime);
		for(int k=0;k<al_header.size();k++)
		{
			String header=(String)al_header.get(k);
			if(isSapMonPerfTest && k>0)
				continue;
				//sbData.append("<td valign=\"middle\" align=\"left\" class=\"x-grid-cell\" wrap style=\"padding:5px;vertical-align:middle\"><b>"+mappingInfo.getTextDescription("monitor.detaileddiagnosis."+header.toUpperCase())+"</b> </td>");
				JSONObject headerObj  = new JSONObject();
				JSONObject headerObj_mobile  = new JSONObject();
				if((isAPMTest) && header.equalsIgnoreCase("Total_Response_Time(msec)"))
				{
					if(skipColForApmTests.contains(header))
						sbData.append("<td valign=\"middle\" align=\"left\" class=\"x-grid-cell\" wrap style=\"padding:5px;vertical-align:middle;display:none\"><b style='white-space: nowrap;text-transform:none'>"+mappingInfo.getTextDescription("monitor.detaileddiagnosis.TOTAL RESPONSE TIME (msec)")+"</b></td>");
					else
						sbData.append("<td valign=\"middle\" align=\"left\" class=\"x-grid-cell\" wrap style=\"padding:5px;vertical-align:middle\"><b style='white-space: nowrap;text-transform:none'>"+mappingInfo.getTextDescription("monitor.detaileddiagnosis.TOTAL RESPONSE TIME (msec)")+"</b></td>");
					headerObj.put("text",mappingInfo.getTextDescription("monitor.detaileddiagnosis.TOTAL RESPONSE TIME")+" <span style='text-transform: lowercase'>(msec)</span>");
				}
				else if(s_test != null && (s_test.equalsIgnoreCase("CtxXcXALogonSimTest") || s_test.equalsIgnoreCase("HrznLogonSimTest"))){
					String appName=s_info;
					appName = appName.substring(1);
					String tempHeader= mappingInfo.getTextDescription("monitor.detaileddiagnosis."+header)+" For Component : "+s_host+",Application: "+appName;
					if(k!=0)
						tempHeader="";
					sbData.append("<td valign=\"middle\" align=\"left\" class=\"x-grid-cell\" wrap style=\"padding:5px;vertical-align:middle\"><b>"+mappingInfo.getTextDescription("monitor.detaileddiagnosis."+header)+"</b> </td>");
					headerObj.put("text",tempHeader);
				}
				else
				{
					if(isAPMTest && skipColForApmTests.contains(header))
						sbData.append("<td valign=\"middle\" align=\"left\" class=\"x-grid-cell\" wrap style=\"padding:5px;vertical-align:middle;display:none\"><b>"+mappingInfo.getTextDescription("monitor.detaileddiagnosis."+header.toUpperCase())+"</b> </td>");
					else
						sbData.append("<td valign=\"middle\" align=\"left\" class=\"x-grid-cell\" wrap style=\"padding:5px;vertical-align:middle\"><b>"+mappingInfo.getTextDescription("monitor.detaileddiagnosis."+header.toUpperCase())+"</b> </td>");

					headerObj.put("text",mappingInfo.getTextDescription("monitor.detaileddiagnosis."+header.toUpperCase()));
				}
				//headerObj.put("width","300");
				//headerObj.put("flex",1);
				headerObj.put("autoWidth",true);
				headerObj.put("sortable",false);
				headerObj_mobile.put("text",mappingInfo.getTextDescription("monitor.detaileddiagnosis."+header.toUpperCase()));
				//if(header.toUpperCase().equals("TIME")){
					//headerObj.put("dataIndex","time");
					//headerObj_mobile.put("dataIndex","time");
				//}else
				//{
					//headerObj.put("dataIndex",(k-1)+"col");
					headerObj.put("dataIndex",k+"col");
					headerObj_mobile.put("dataIndex","col"+(k));
					if(isAPMTest && skipColForApmTests.contains(header))
					{
						headerObj.put("hidden",true);
						headerObj_mobile.put("hidden",true);
						index_arr.add(k);
					}
					else
					{
						pdfHeaders.add(header);
						String csvHeader = (String)al_header.get(k);
						//vec_Tabletitle.add(al_header.get(k));
						//vec_Tabletitle.add(mappingInfo.getTextDescription("monitor.detaileddiagnosis."+al_header.get(k)));
						csvHeader= mappingInfo.getTextDescription("monitor.detaileddiagnosis."+csvHeader.toUpperCase());
						vec_Tabletitle.add(csvHeader);
					}
				//}		
				headersArray.add(headerObj);
				headersArray_mobile.add(headerObj_mobile);		
		}
		gridInfo.put("headers",headersArray);
		sbData.append("</tr>");
		gridInfo_mobile.put("headers",headersArray_mobile);
		vec_Tabletitle.add("\n");

			isJvmTest = false;
			isStackLink = false;
			if(s_test.equalsIgnoreCase("JvmThreadTest")||s_test.equalsIgnoreCase("JvmCpuTest") ||s_test.equalsIgnoreCase("JvmMemoryDetailsTest"))
			{
				isJvmTest = true;
				isStackLink = true;
				//EgAgentInfo agentInfoo = new EgAgentInfo("manager");
				/*if(s_msmt_host!=null && s_msmt_host.length() > 0)
				{
					String showMode = agentInfoo.getParamValue(s_test,s_host,s_port,"+",s_msmt_host,"mode");
					if(showMode!=null && showMode.equalsIgnoreCase("false"))
						isStackLink = true;
				}
				else	// This block is executed when request comes from reporter
				{
					String rhs = agentInfoo.getValueForVar(s_test+"::"+s_host+":"+s_port);
					if(rhs.indexOf("-mode") > 0)
					{
						String str = rhs.substring(rhs.indexOf("-mode")+5) ;
						StringTokenizer tmp = new StringTokenizer(str," ");
						int tokens = tmp.countTokens();
						if(tmp.countTokens() > 0)
						{
							String showMode = tmp.nextToken().trim();
							if(showMode!=null && showMode.equalsIgnoreCase("false"))
								isStackLink = true;
						}
					}
				}*/
			}
			//............ To Provide Links for specific tests (Begin)
			if(fromPage!=null && fromPage.equals("eveHist"))
			{
				js_string = " ";
			}
			//............ To Provide Links for specific tests (End)
			// loop to display records
			if(commonDateLayout){
				gridInfo.put("grouping",true);
				gridInfo_mobile.put("grouping",true);
			}
			JSONArray  dataArray = new JSONArray();
			JSONArray  ctxDataArr = new JSONArray();
			JSONArray filterBy = new JSONArray();
			JSONArray filterByGridData = new JSONArray();
			String fromAnalysisDD = request.getParameter("fromAnalysisDD");
			
			boolean filterDate=false;
			
			//CSV Code ---------
			if( csv==null || csv.equals("null") )
			{
				if( pageNo == 1 )
					  startIndex = 0;
				else if( pageNo > 1)
				{
					startIndex = ((pageNo-1)*(pageSize*2));
				}
			}
			else
			{
				startIndex=0;
			}
			
			int mylocalvar=0;
			isDDDTest=true;
			if(colNamesForQuery==null || colNamesForQuery.trim().equals(""))
			{
				isDDDTest = false;
			}
		
			if(isDDDTest)
			{
				startIndex=0;
				totalRecordsCount=totalRecords;
			}
			else
				totalRecordsCount=a_results.size()/2;

		if((csv==null || csv.trim().length()==0))
		{
			//(ArrayList a_results,ArrayList al_header,String s_test,boolean isDDDTest,int gr_l,int pageNo,int pageSize,int mylocalvar,boolean commonDateLayout,boolean rumStatus,String selectFilter,StringBuffer sbData,boolean isJvmTest,boolean isStackLink,boolean isSapMonPerfTest,String strValue,String colSeparator,boolean proceed,JSONArray dataArray,JSONArray dataArray_mobile,String s_host,String s_port,String s_msmt_host,String s_info,String s_mes,String s_st_time,String s_en_time,String s_st_hr,String s_en_hr,String s_st_min,String s_end_min,String js_string,String monitor_Skin,EgMappingInfo mappingInfo,ArrayList encodeTestList,ArrayList al_cols,String dateFormat,JSONArray filterBy)

			Hashtable ddData = getDDData(a_results,al_header,s_test,pageNo,pageSize,mylocalvar,commonDateLayout,rumStatus,sbData,isStackLink,isSapMonPerfTest,colSeparator,s_host,s_port,s_msmt_host,s_info,s_mes,s_st_time,s_en_time,s_st_hr,s_en_hr,s_st_min,s_end_min,mappingInfo,encodeTestList,al_cols,session,response,user,dd,colNamesForQuery,vec_Tabletitle,index_arr,isFromAlarmDetails,isScreenShotEnabled,pdfHeaders);
			
			Vector temp_vec_Tabletitle = (Vector)ddData.get("vec_Tabletitle");
			if(temp_vec_Tabletitle != null && vec_Tabletitle != null)
				vec_Tabletitle.addAll(temp_vec_Tabletitle);
			listData.add(vec_Tabletitle);
			if(dataArray != null && ddData != null)
				dataArray.addAll((JSONArray)ddData.get("data"));

			JSONObject latlangKeyValueObj = new JSONObject();
			if(ddData != null)
				latlangKeyValueObj = ((JSONObject)ddData.get("latlangHash"));
			gridInfo.put("data",dataArray);
			gridInfo.put("LocData",latlangKeyValueObj);
			gridInfo_mobile.put("data",(JSONArray)ddData.get("data_mobile"));
			json.put("gridInfo",gridInfo);
			
			String ana_footerText = "";
			if(ddData.containsKey("footerText"))
			{
				ana_footerText = (String)ddData.get("footerText");
				json.put("footerText",ana_footerText);
			}

			if(!isFromAlarmDetails)
			{	
				if(ddData.containsKey("ctxDataArr"))
					json.put("ctxDataArr",ddData.get("ctxDataArr"));
				json.put("successScreenshot",successScreenshot);
				json.put("isSSTest",ddData.get("isSSTest"));
			}
			filterBy = (JSONArray)ddData.get("filterBy");
			
			/*listData.add(vec_Tabletitle);
			gridInfo.put("data",dataArray);
			gridInfo_mobile.put("data",dataArray_mobile);
			json.put("gridInfo",gridInfo);
			json.put("ctxDataArr",ctxDataArr);*/
			if(!isFromAlarmDetails)
				json.put("arraylenth",a_results.size());
			
			sbData.append("<td align=\"right\"  class=\"darkthemefont_color  dignosis_row\" colspan=\""+(al_header.size()+1)+"\" ><b class=\"darkthemefont_color \">"+ana_footerText+"</b></td>");
			
			sbData.append("</tbody>");
			sbData.append("</table></div>");
		}
		else if(csv!=null)
		{
			Hashtable csvData = dd.getCSVData(a_results,al_header,s_test,mylocalvar,commonDateLayout,strValue,isSapMonPerfTest,encodeTestList,proceed,rumStatus,isSapAlertsTest,isAPMTest,user,colSeparator,mappingInfo,dateFormat,colNamesForQuery,index_arr,session);
			Vector temp_vec_Tabletitle = (Vector)csvData.get("vec_Tabletitle");
			filterBy = (JSONArray)csvData.get("filterBy");
			if(temp_vec_Tabletitle != null && vec_Tabletitle != null)
				vec_Tabletitle.addAll(temp_vec_Tabletitle);

			if(csvData.containsKey("footerTxt"))
			{
				String footerTxt = (String)csvData.get("footerTxt");			
				f_vec.add("");
				f_vec.add("** "+footerTxt);				
			}

	} //End of CSV Loop
 		
		listData.add(vec_Tabletitle);
		listData.add(f_vec);
		if(csv==null)
		{
         	// Added Pagination by KNRaju on 20.11.14			

			if((selectFilter==null || selectFilter.equalsIgnoreCase("All")) && (true))
			{
				
				pages = totalRecordsCount/pageSize;
				if(totalRecordsCount%pageSize!=0)
					pages +=1;
				
					sbPagination.append("<form onsubmit=\"return checkSubmit()\" id=\"pagination\" name=\"pagination\">");
					sbPagination.append("<table border=\"0\" style=\"margin:2px 0 0 6px;padding:3px\" class=\"PagingText\">");
						sbPagination.append("<tr>");
						if(pageNo>1)
						{
							
								sbPagination.append("<td style='padding-top:5px;vertical-align:top'>");
								sbPagination.append("<img data-qtip=\"First Page\" data-qclass=\"yellowTip\" src=\"/final/images/clear.png\" onClick=\"javascript:goToPage("+1+","+pages+",'"+totalRecords+"');return false;\" class=\"PagingToolbar-first\"/>");
								sbPagination.append("</td>");

								sbPagination.append("<td style=\"padding-top:5px;padding-right:10px;vertical-align:top\">");
								sbPagination.append("<img data-qtip=\"Previous Page\" data-qclass=\"yellowTip\" src=\"/final/images/clear.png\" onClick=\"javascript:goToPage("+(pageNo-1)+","+recTotalCount+",'"+totalRecords+"');return false;\" class=\"PagingToolbar-prev\"/>");
								sbPagination.append("</td>");					
						}
							sbPagination.append("<td style=\"padding-right:3px;vertical-align:top;padding-top:5px\">");
							sbPagination.append("Page");
							sbPagination.append("</td>");
							sbPagination.append("<td style=\"vertical-align:top;padding-top:5px;\">");
							int currPage = pageNo;
							if(currPage==0)currPage++;

							sbPagination.append("<input style=\"width:35px;margin-right:2px;height:16px;\" class=\"PagingTextbox\" type=\"text\" name=\"pageNo\" onkeypress=\"javascript:goToPageOnEnter(event,this.value,this.form.pageNo.value,"+pages+",'"+totalRecords+"')\" value=\""+currPage+"\" >");
							sbPagination.append("</td>");

						sbPagination.append("<td style=\"display:none;padding-right:15px;vertical-align:top\">");
							sbPagination.append("<button class=\"PagingButton\" onClick=\"javascript:goToPage(this.form.pageNo.value,"+pages+",'"+totalRecords+"');return false;\" name=\"Go\" id=\"Go\">Go</button>");
						
						sbPagination.append("</td>");
						sbPagination.append("<td id=\"totalPages\" style=\"padding-right:3px;padding-top:5px;vertical-align:top;\">");
							//sbPagination.append("of "+pages);
						sbPagination.append(totalPagesDisp);
						sbPagination.append("</td>");					
						
				
						if(maxNo < 0  || pageNo!=maxNo)
						{	
							if(pageNo==0)
								pageNo = 1;

							sbPagination.append("<td id='next' style=\"padding-left:10px;padding-top:5px;vertical-align:top\">");
								sbPagination.append("<img id=\"nextPage\" data-qtip=\"Next Page\" data-qclass=\"yellowTip\" src=\"/final/images/clear.png\" onClick=\"javascript:goToPage("+(pageNo+1)+","+recTotalCount+",'"+totalRecords+"');return false;\" class=\"PagingToolbar-next\"/>");
								sbPagination.append("</td>");						
							
							//if(totalRecordsCount>pageSize)
							//{							
								sbPagination.append("<td id='last' style=\"padding-top:5px;vertical-align:top\">");

									sbPagination.append("<img data-qtip=\"Last Page\"  data-qclass=\"yellowTip\" src=\"/final/images/clear.png\" onClick=\"javascript:goToPage("+recTotalCount+","+recTotalCount+",'last');return false;\" class=\"PagingToolbar-last\"/>");
															sbPagination.append("</td>");
							//}						
						}

						sbPagination.append("</tr>");
					sbPagination.append("</table>");
				sbPagination.append("</form>");
			}
		
		}
			
			if(dataArray!=null)
					filterByGridData = dataArray;
			hiddenFields.put("filterBy",filterBy);
			hiddenFields.put("filterByGridData",filterByGridData);
			json_mobile.put("output",gridInfo_mobile);
		
	}
	else
	{
		json.put("errorImage","/final/monitor/eg_images/"+monitor_Skin+"/exclamation-icon.gif");
		if(s_flag != null && s_flag.equals("0"))
		{
			String displayTime = ui.getDDDisplayTime();
			double dTime = 1.0;
			try
			{
				dTime = Double.parseDouble(displayTime);
			}
			catch(Exception e)
			{
				dTime = 1.0;
			}
			if(testInfo.isFrequencySet())
			{
				json.put("errorMsg",mappingInfo.getTextDescription("monitor.detaileddiagnosis.No detailed measures available for the last ")+dTime+mappingInfo.getTextDescription("monitor.detaileddiagnosis.hour(s)"));

			}
			else
			{
				json.put("errorMsg",mappingInfo.getTextDescription("monitor.detaileddiagnosis.Normal samples/Bad samples are not configured for detailed diagnosis"));
			}
		}
		else
		{
				json.put("errorMsg",mappingInfo.getTextDescription("monitor.detaileddiagnosis.No detailed measures available for this combination of parameters"));

		}
	}
   
	if(csv!=null)
	{
		if(!isFromAlarmDetails)
			json.put("CSV","CSV_FINISHED");
	}
	else
	{
		if(!isFromAlarmDetails)
		{
			json.put("hiddenFields",hiddenFields);
			json.put("tableData",sbData.toString());
			json.put("sbPagination",sbPagination.toString());
		}
	}

	if(!isFromAlarmDetails)
		session.setAttribute("list_dd",listData);
	
	a_temp =new ArrayList();
	a_results.clear();

	if(!isFromAlarmDetails)
		session.setAttribute("curTabQS",request.getQueryString());

	if(isMobileCall)
	{

		
		if(reqForCount.equalsIgnoreCase("Yes"))
			response.getWriter().write(""+recTotalCount);
		else
			response.getWriter().write(json_mobile.toString());


	}
	else
	{

			if(recTotalCount > recTotalRecordCount )
				recTotalRecordCount = recTotalCount;
			if(reqForCount.equalsIgnoreCase("Yes"))
				response.getWriter().write(""+recTotalCount+"@"+recTotalRecordCount);
			else
				response.getWriter().write(json.toString());



	}
}
catch(Exception e)
{
	//e.printStackTrace();
	e.toString();
}
String fromAlarmDetails = request.getParameter("fromAlarmDetails");
boolean isFromAlarmDetails = false;
if(fromAlarmDetails != null && fromAlarmDetails.trim().length()>0 && fromAlarmDetails.equalsIgnoreCase("true"))
{
	isFromAlarmDetails = true;
}
if(!isFromAlarmDetails)
{
	if((request.getParameter("newWindow")==null || (request.getParameter("newWindow")!=null && !request.getParameter("newWindow").equals("true"))) && request.getParameter("comeFrom")==null)
	{
		if(request.getQueryString()!=null)
		session.setAttribute("monitorLastSession","/final/monitor/EgDiagnosis.jsp?"+request.getQueryString());
		else
		session.setAttribute("monitorLastSession","/final/monitor/EgDiagnosis.jsp?");
	}
}
%>