<%
/********************************************************************************************************
*	Name			:	endUserDashboardData.jsp
*	Purpose			:	This is the main page for End User Dashboard
*	Version			:	eG 5.6.5 and Above
*	Creation Date		:	30/01/2014
*	Authtor			:	Vinoth Kumar P V, Saravanan.A
*	Design			:	Vijay and Jaiwin
*******************************************************************************************************/
%>
<%@ taglib prefix="egui" uri="../WEB-INF/eg-taglib.tld" %>
<%@ page errorPage = "EgProbsM.jsp" %>
<%@ page import = "java.util.*"%>
<%@ page import = "java.util.Map.Entry"%>
<%@ page import = "java.io.*"%>
<%@ page import = "com.egurkha.*"%>
<%@ page import = "com.egurkha.monitor.EgServerDashboardModel"%>
<%@ page import = "com.egurkha.monitor.EgServerDashBoardDAO"%>
<%@ page import = "com.egurkha.monitor.EgDashBoardModel"%>
<%@ page import = "com.egurkha.monitor.MeasuresDAO"%>
<%@ page import = "com.egurkha.monitor.MonitorDAOFactory"%>
<%@ page import = "com.egurkha.util.*"%>
<%@ page import = "com.eg.*"%>
<%@ page import = "com.egurkha.monitor.VmDashboardHelper"%>
<%@ page language="java" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" %>
<%@ page import = "com.eg.EgMappingInfo"%>
<%@ page import = "com.eg.EgURLEncoder"%>
<%@ page import = "com.eg.IniFile"%>
<%@ page import = "egurkha.reporter.ErUserData"%>
<%@ page import="com.eg.EgExternalInfo"%>
<%@ page import="com.egurkha.ini.*"%>
<%@ page import = "net.sf.json.*"%>
<%@ page import = "java.text.*" %>
<%@ page import = "java.math.*" %>
<%@ page import = "java.sql.Timestamp"%>
<%@ page import = "com.eg.supermanager.*" %>
<%@ page import = "com.eg.EgMetaThread"%>
<%@ page import = "com.eg.EgDiscInfo"%>
<%@ page import = "com.egurkha.EgTimeZoneConverter"%>
<%
	response.setHeader("Cache-Control","no-store");
	response.setHeader("Pragma","no-cache");
	response.setDateHeader ("Expires", -1);
	request.setCharacterEncoding("UTF-8");
	response.setContentType("application/json");
%>

<%
	/* This is for SuperManager - starts */
	if(com.eg.EgInstallInfo.isSuperManager)
	{
		ArrayList managerIds = null;
		String currentSession = session.getId();
		if(EgManagersInfo.sessionManagerMap.containsKey(currentSession))
			managerIds = (ArrayList)EgManagersInfo.sessionManagerMap.get(currentSession);
		if(managerIds == null || managerIds.isEmpty())
		{
			EgManagersInfo mgrsInfo = EgManagersInfo.getInstance();
			if(!mgrsInfo.getReportingManagers().isEmpty())
				managerIds = new ArrayList(mgrsInfo.getReportingManagers().keySet());
		}
		if(managerIds != null && !managerIds.isEmpty())
		{
			SmSessionData smsData = new SmSessionData(currentSession,managerIds);
			EgThreadLocal egtl = new EgThreadLocal();
			egtl.set(smsData);
		}
	}
	/* This is for SuperManager - ends */
	UserRegistry registry = UserRegistry.getInstance();
	User user = null; //registry.getUser(session.getId());
	EgTimeZoneConverter convert = null;

	MonitorDAOFactory monitorDaoFactory = MonitorDAOFactory.getInstance();
	EgServerDashBoardDAO dashboardDAO = monitorDaoFactory.getServerDashBoardDAO();

	String fromMenuStr = request.getParameter("fromMenu");
	boolean isFromMenu=false;
	if(fromMenuStr!=null && (fromMenuStr.equalsIgnoreCase("true") || fromMenuStr.equalsIgnoreCase("yes")))
		isFromMenu=true;
	String showKeyUserStr = request.getParameter("showKeyUser");
	boolean showKeyUser=false;
	if(showKeyUserStr!=null && (showKeyUserStr.equalsIgnoreCase("true") || showKeyUserStr.equalsIgnoreCase("yes")))
		showKeyUser=true;

	/*String updateUserAssociateStr = request.getParameter("updateUserAssociate");
	boolean updateUserAssociateFlag=false;
	if(showKeyUser && updateUserAssociateStr!=null && (updateUserAssociateStr.equalsIgnoreCase("true") || updateUserAssociateStr.equalsIgnoreCase("yes")))
	{
		updateUserAssociateFlag=true;
	}*/

	boolean isFromGeo=false;
	String fromGeoStr = request.getParameter("fromGeo");
	if(fromGeoStr!=null && (fromGeoStr.equalsIgnoreCase("true") || fromGeoStr.equalsIgnoreCase("yes")))
		isFromGeo=true;
	
	boolean isfromf5=false;
	String fromf5 = request.getParameter("fromf5");
	if(fromf5!=null && (fromf5.equalsIgnoreCase("true") || fromf5.equalsIgnoreCase("yes")))
		isfromf5=true;

	String iniName = null,user_name = null,isUserBased = null,dashboard_name = null,view_name = null,time_line = null,geoInfo = null,usercountval = null,dashboard_mapping = null,fromServiceHomePage = null,fromZonePage = null,selectedTest=null,selectedMeasure=null,selectedTestMea=null;
	if(isFromGeo)
	{
		iniName = request.getParameter("iniName");
		user_name = request.getParameter("user_name");
		isUserBased = request.getParameter("isUserBased");
		dashboard_name = request.getParameter("dashboard_name");
		view_name = request.getParameter("view_name");
		time_line = request.getParameter("time_line");
		geoInfo = request.getParameter("ginfo");
		usercountval = request.getParameter("usercountval");
		dashboard_mapping = request.getParameter("dashboard_mapping");
		fromServiceHomePage = request.getParameter("fromServiceHomePage");
		fromZonePage = request.getParameter("fromZonePage");
		selectedTest = request.getParameter("selectedTest");
		selectedTest=(selectedTest==null)?"":selectedTest;
		selectedMeasure = request.getParameter("selectedMeasure");
		selectedMeasure=(selectedMeasure==null)?"":selectedMeasure;
		if(selectedTest!=null && selectedTest.trim().length()>0 && selectedMeasure!=null && selectedMeasure.trim().length()>0)
			selectedTestMea=selectedTest+":"+selectedMeasure;
	}

	String isfromCitrix = request.getParameter("isfromCitrix");
	String fromMetricView = request.getParameter("fromMetricView");
	if(isfromCitrix!=null && (isfromCitrix.equalsIgnoreCase("true") || isfromCitrix.equalsIgnoreCase("yes")))
	{
		iniName = request.getParameter("iniName");
		view_name = request.getParameter("view_name");
		user_name = request.getParameter("user_name");
		dashboard_mapping = request.getParameter("dashboard_mapping");
		dashboard_name = request.getParameter("dashboard_name");
	}

	if(isFromMenu || isFromGeo)
		user = registry.getUser(session.getId(),true);
	else
		user = registry.getUser(session.getId());

	if(session!=null)
		session.removeAttribute("toBackUED2_url");

	//JSONObject jsonRoot = new JSONObject();
	EgUserRole userRole = null;
	boolean isAllCompAccess=false;
	boolean isDataManagerLogin=false;
	String userName = "admin";

	String file = "eg_endUserDetails.ini";
	String dir = EgInstallInfo.getInstallDir()+ "/manager/config/";
	IniFile ini = new IniFile(dir + file);

	boolean isDebugEnabled = false;
	int logFileSize = 30;

	String browserType = request.getHeader("User-Agent");

	String userExpLogging = ini.getValue("Logging","enableLogging");
	if(userExpLogging!=null && (userExpLogging.equalsIgnoreCase("true") || userExpLogging.equalsIgnoreCase("yes")))
		isDebugEnabled = true;

	if(isDebugEnabled){
		String fileSize = ini.getValue("Logging","fileSize");
		try{
			if(fileSize != null && fileSize.trim().length() > 0)
				logFileSize = Integer.parseInt(fileSize);

		}catch(Exception e){
			logFileSize = 30;
		}
	}

	String strEGManagerUser=ini.getValue("END_USER_DASHBOARD_SETTINGS","eGManagerUser");
	strEGManagerUser=(strEGManagerUser==null || strEGManagerUser.trim().length()==0)?"false":strEGManagerUser;
	boolean isEGManagerUser = strEGManagerUser.equalsIgnoreCase("true")?true:false;

	String show_app_overview = ini.getValue("END_USER_DASHBOARD_SETTINGS","ShowApplicationsOverview");

	String userType = request.getParameter("userType");
	String overviewType = request.getParameter("overviewType");

	String Hide_Panels_When_External_Access="";
	if(user==null && (!isFromMenu))
	{
		String login_user ="";
		if(isEGManagerUser)
			login_user = request.getParameter("user");

		userName=(login_user==null || login_user.trim().length()==0)?"admin":login_user;
		ErUserData userData = new ErUserData(userName,false);
		if(userData==null)
		{
			userName="admin";
			userData = new ErUserData(userName,false);
			user = userData.usr;
		}
		else if(userData!=null)
			user = userData.usr;
		if(user!=null)
		{
			userRole = user.getUserRole();
			isAllCompAccess = userRole.hasAllComponentAccess();
		}
	}
	else if(user!=null)
	{
		userName = user.getLoginID();
		userRole = user.getUserRole();
		isAllCompAccess = userRole.hasAllComponentAccess();
		isDataManagerLogin = true;
	}

	boolean isOnlyVMAssigned=false;
	boolean isVMAssigned=false;
	/*if(user!=null && user.isOnlyVMAssigned() && user.getOnlyVMs().size()>0)
	{
		isOnlyVMAssigned=true;
	}
	else if(user!=null && (user.isOnlyVMAssigned() || user.isVMAssigned()) && user.getOnlyVMs().size()>0)
	{
		isOnlyVMAssigned=true;
	}*/

	if(user!=null && user.isOnlyVMAssigned() && (!user.isVMAssigned()) && user.getOnlyVMs().size()>0 && userType!=null && userType.equalsIgnoreCase("VDI"))
		isOnlyVMAssigned=true;
	else if(user!=null && (!user.isOnlyVMAssigned()) && user.isVMAssigned() && user.getOnlyVMs().size()>0 && userType!=null && userType.equalsIgnoreCase("VDI"))
		isVMAssigned=true;
	else if(user!=null && user.isOnlyVMAssigned() && user.isVMAssigned() && user.getOnlyVMs().size()>0 && userType!=null && userType.equalsIgnoreCase("VDI"))
	{
		isOnlyVMAssigned=true;
		isVMAssigned=true;
	}

	writeLog(" ::::::::::::::::::::::::::::::::::::::::::::STARTS::::::::::::::::::::::::::::::::::::::::::::::::: ",isDebugEnabled,logFileSize);
	writeLog(" userName  "+userName,isDebugEnabled,logFileSize);
	StringBuffer buf = new StringBuffer();
	IniUI ui = IniUI.getInstance();
	IniFile egEx = new IniFile(EgInstallInfo.getInstallDir()+ "/manager/config/eg_external.ini");
	IniFile egUi = new IniFile(EgInstallInfo.getInstallDir()+ "/manager/config/eg_ui.ini");
	IniFile egFormat  = new IniFile(EgInstallInfo.getInstallDir()+ "/manager/config/eg_format.ini");
	EgTablesInfo tablesInfo = new EgTablesInfo("manager");
	EgDbInfo Dbdata = new EgDbInfo("manager");
	EgSpecsInfo specsInfo = new EgSpecsInfo("manager");
	EgExternalInfo egExternalInfo=new EgExternalInfo("manager");
	EgDiscInfo discInfo = new EgDiscInfo("manager");
	EgGroupInfo groupInfo = new EgGroupInfo();
	EgServerDashboardModel dashboardModel = new EgServerDashboardModel();
	EgDashBoardModel  egDashboard=new  EgDashBoardModel();
	String thisLanguage = ui.getDefaultLanguage();
	if (user!=null)
	{
		user.setUserLanguageAndSkins();
		String userLang = user.getLanguage();
		if (userLang!=null && !userLang.equalsIgnoreCase("NULL"))
		{
			thisLanguage=userLang;
		}
	}
	EgMappingInfo mappingInfo = new EgMappingInfo(thisLanguage);
	String monitor_Skin ="";
	if(user!=null)
		 monitor_Skin = user.getMonitorSkin();
	VmDashboardHelper vmDashHelper=new VmDashboardHelper(user);
	List VmsList = new ArrayList();
	EgList egList=new EgList();
	String noOfInfoToDisplay = ""+10;
	EgList vdiDesktopsList= new EgList();
	int vdiDesktopsListTotalCount=0;
	int groupByUserCount = 0;
	Hashtable finalDesktopVmsHash=new Hashtable();
	Hashtable infosCompHash=new Hashtable();
	ArrayList infolist = new ArrayList();
	ArrayList infolist1 = new ArrayList();
	//ArrayList dbinfolist = new ArrayList();

	List resTypeList = new LinkedList();
	//List resCnameList = new LinkedList();
	//List resCompsList = new LinkedList();
	//List resNickList = new LinkedList();
	//List resPortList = new LinkedList();

	JSONObject json  = new JSONObject();
	JSONArray  columns = new JSONArray();
	JSONArray  measuresjson = new JSONArray();
	JSONObject countJson= new JSONObject();
	
	int recount=0;
	int pagesizec=0;
	int pageSize = 0;

	Hashtable typeCompInfoHash=new Hashtable();
	Hashtable componentsInfo = new Hashtable();
	Hashtable measuresInfo = new Hashtable();
	Hashtable measureValues = new Hashtable();
	//Hashtable user_count_hash = new Hashtable();
	ArrayList groupByUserKeys = new ArrayList();
	Hashtable finalGroupByUserTab = new Hashtable();
	Hashtable finalallMeasureDataLen = new Hashtable();
	Hashtable groupByUser = new Hashtable();
	//String maxUser="";
	List componentTypeList=new ArrayList();
	List measureList = new ArrayList();
	String serviceComponent =  request.getParameter("serviceComponent");
	String desktopUserName = request.getParameter("username");
	desktopUserName=com.egurkha.util.StringUtils.decodeSecurityChar(desktopUserName);
	String searchString = (desktopUserName!=null && !desktopUserName.equalsIgnoreCase("") && desktopUserName.length()>0)?desktopUserName:request.getParameter("searchString");
	searchString=(searchString==null || searchString.trim().length()==0)?"":searchString;
	searchString=com.egurkha.util.StringUtils.decodeSecurityChar(searchString);

	boolean isAdtnlSearch = false;
	boolean addtionalSearchFlag = false;
	String adtnlSearchColumns = "";
	String adtnlSearchStr_EN = "";
	ArrayList addSearchColList = null;
	String adtnlSearchStr = request.getParameter("adtnlSearchStr");
	adtnlSearchStr = (adtnlSearchStr==null || adtnlSearchStr.trim().length()==0 || adtnlSearchStr.equalsIgnoreCase("NULL"))?"":adtnlSearchStr;

	String addSeachSubject = "Additional_Search";
	String additionalSearch = ini.getValue(addSeachSubject,"EnableAddtionalSearch");
	if (additionalSearch!=null && additionalSearch.trim().length()>0 && (additionalSearch.equalsIgnoreCase("true") || additionalSearch.equalsIgnoreCase("yes")))
	{
		if (adtnlSearchStr!=null && adtnlSearchStr.trim().length()>0 && !adtnlSearchStr.equalsIgnoreCase("NULL"))
		{
			isAdtnlSearch = true;
			adtnlSearchStr_EN = com.egurkha.util.StringUtils.encodeSecurityChar(adtnlSearchStr);
		}
		adtnlSearchColumns = ini.getValue(addSeachSubject,userType+":SelectedSearchColumn");
		if (adtnlSearchColumns!=null && adtnlSearchColumns.trim().length()>0 && !adtnlSearchColumns.equalsIgnoreCase("NULL"))
			addSearchColList = (ArrayList)com.egurkha.util.StringUtils.egTokenizer(adtnlSearchColumns, ",",false,false,true);		//param 3-->includeEmpty,4-->unique,5-->trim
	}
	String priority = request.getParameter("priority");
	priority=(priority==null || priority.trim().length()==0)?"ALL":priority;
	String tmp_priority=priority;
	
	String vdiType = request.getParameter("vdiType");
	String vdiType_SBD = request.getParameter("vdiType");
	vdiType=(vdiType==null || vdiType.trim().length()==0)?"":vdiType;

	String orderBy =request.getParameter("orderBy");
	orderBy=(orderBy==null || orderBy.trim().length()==0)?"desc":orderBy;
	if(orderBy==null || orderBy.trim().length()==0 || orderBy.equalsIgnoreCase("null"))
		orderBy="desc";
	
	String aduserFilter = request.getParameter("aduserFilter");
	if(aduserFilter != null)
	{
		aduserFilter=  com.egurkha.util.StringUtils.replace(aduserFilter,"|eq|","=");
		aduserFilter=  com.egurkha.util.StringUtils.replace(aduserFilter,"|comma|",",");
	}
	
	boolean defaultAdCase = false;
	if(aduserFilter != null && aduserFilter.equalsIgnoreCase("default")){
		aduserFilter ="All";
		defaultAdCase = true;
	}

	String orderByColumnName = request.getParameter("orderByColumn");
	String defaultOrderMeasure = ini.getValue("USER_DESKTOP_METRICS_DEFAULT_ORDER_MEASURE",userType);
	if(defaultOrderMeasure!=null && defaultOrderMeasure.trim().length()>0)
	{
		String deTest=defaultOrderMeasure.substring(0,defaultOrderMeasure.indexOf(":"));
		String deMea=defaultOrderMeasure.substring(defaultOrderMeasure.indexOf(":")+1);
		defaultOrderMeasure = Dbdata.getColumnForMeasure(deTest,deMea);
	}
	if((orderByColumnName==null || orderByColumnName.equals("null")) && defaultOrderMeasure!=null && defaultOrderMeasure.trim().length()>0)
		orderByColumnName=defaultOrderMeasure;

	String columnDispName = request.getParameter("columnDispName");
	String pageNoReq = request.getParameter("pageNo");
	if(pageNoReq==null || pageNoReq.trim().length()==0)
		pageNoReq = "0";

	int pageNo = Integer.parseInt(pageNoReq);

	userType = request.getParameter("userType");
	String searchFrom = request.getParameter("searchFrom");
	String isFromVCDS = request.getParameter("isFromVCDS");
	if(userType==null || userType.trim().length()==0)
		userType = request.getParameter("usertype");
	userType=(userType==null || userType.trim().length()==0)?"VDI":userType;

	if (selectedTest!=null && selectedTest.trim().length()>0 && selectedTest.equalsIgnoreCase("AppLaunchTest_DDD"))
	{
		//userType = "AppLaunchDDXenApp7";
		if(selectedTest.endsWith("_DDD"))
			selectedTest = selectedTest.substring(0,selectedTest.indexOf("_DDD"));
	}

	String searchStringVCDS ="";
	if(userType!=null && userType.equalsIgnoreCase("VDIESX"))
	{
		searchStringVCDS = searchString;
		if(isFromVCDS==null || isFromVCDS.trim().length()==0)
			searchString="";
	}

	String infoBaseTestStr = ini.getValue("UED_INFO_BASED_TESTS",userType);
	ArrayList infoBaseTestList = new ArrayList();
	if(infoBaseTestStr!=null && infoBaseTestStr.trim().length()>0)
		infoBaseTestList = com.egurkha.util.StringUtils.egTokenizer(infoBaseTestStr, ",",false,true,true);//param 3-->includeEmpty,4-->unique,5-->trim
	boolean isEndUserOverview = false;
	String endUserDashOverview = request.getParameter("endUserDashOverview");
	endUserDashOverview = (endUserDashOverview==null || endUserDashOverview.trim().length()==0)?"":endUserDashOverview;
	if(endUserDashOverview!=null && endUserDashOverview.trim().length()>0 && (endUserDashOverview.equalsIgnoreCase("true") || endUserDashOverview.equalsIgnoreCase("yes")))
		isEndUserOverview = true;
	boolean isFromUEDSort = false;
	String fromuedsort = request.getParameter("isfromuedsort");
	fromuedsort = (fromuedsort==null || fromuedsort.trim().length()==0)?"":fromuedsort;
	if(fromuedsort!=null && fromuedsort.trim().length()>0 && (fromuedsort.equalsIgnoreCase("true")||fromuedsort.equalsIgnoreCase("yes")))
		isFromUEDSort = true;
	String enableBackButton = request.getParameter("enableBackButton");
	enableBackButton=(enableBackButton==null || enableBackButton.trim().length()==0)?"false":enableBackButton;
	String overviewSearchStr = request.getParameter("overviewsearchstr");
	overviewSearchStr = (overviewSearchStr==null || overviewSearchStr.trim().length()==0)?"":overviewSearchStr;
	String isFromUEDOverview = request.getParameter("isfromuedoverview");
	isFromUEDOverview = (isFromUEDOverview==null || isFromUEDOverview.trim().length()==0)?"":isFromUEDOverview;
	String filterName =  request.getParameter("filterName");
	filterName = (filterName==null || filterName.trim().length()==0)?"":filterName;
	//finalDesktopVmsHash = (Hashtable)vmDashHelper.getVmDesktopsForTheComponent(searchString,priority,vdiType);
	String isServiceBusiViewMetrics = request.getParameter("isServiceBusiViewMetrics");
	isServiceBusiViewMetrics = (isServiceBusiViewMetrics==null || isServiceBusiViewMetrics.trim().length()==0)?"":isServiceBusiViewMetrics;

	String showUserLocations = ini.getValue("GEO_LOCATION_SETTINGS",userType+":ShowUserLocations");
	String strSeparator = ini.getValue("GEO_LOCATION_SETTINGS",userType+":Separator");
	String strReplaceSep = ini.getValue("GEO_LOCATION_SETTINGS",userType+":ReplaceSeparatorTo");
	showUserLocations = (showUserLocations==null || showUserLocations.trim().length()==0)?"":showUserLocations;
	boolean isShowUserLocation = false;
	if(showUserLocations!=null && showUserLocations.trim().length()>0 && (showUserLocations.equalsIgnoreCase("true") || showUserLocations.equalsIgnoreCase("yes")))
		isShowUserLocation = true;

	String keyUserUED = ini.getValue("END_USER_DASHBOARD_SETTINGS","HighUserProfileExpDashboard");
	keyUserUED = (keyUserUED==null || keyUserUED.trim().length()==0)?"":keyUserUED;
	boolean isKeyUserUED = false;
	if(keyUserUED!=null && keyUserUED.trim().length()>0 && (keyUserUED.equalsIgnoreCase("true") || keyUserUED.equalsIgnoreCase("yes")))
		isKeyUserUED = true;

	String col_Type = request.getParameter("columnType");

	String strUDSortByAllValue=ini.getValue("END_USER_DASHBOARD_SETTINGS","SortByAllMeasureValue");
	strUDSortByAllValue=(strUDSortByAllValue==null || strUDSortByAllValue.trim().length()==0)?"false":strUDSortByAllValue;
	boolean isUDSortByAllValue = (strUDSortByAllValue.equalsIgnoreCase("true") || strUDSortByAllValue.equalsIgnoreCase("yes"))?true:false;

	String strMValueOrder=ini.getValue("END_USER_DASHBOARD_SETTINGS","SortByAllMeasureValueOrder");
	strMValueOrder=(strMValueOrder==null || strMValueOrder.trim().length()==0)?"asc":strMValueOrder;

	IniFile dashIni = new IniFile(EgInstallInfo.getInstallDir()+"/manager/config/eg_dashboardConfig.ini",true);
	boolean isDetailsFromADOnly = false;
	String locStr = dashIni.getValue("USER_LOCATION_TEST_CONFIG",userType+":ShowLocationFromADOnly");
	if(locStr != null && locStr.trim().length() > 0 && (locStr.equalsIgnoreCase("true") || locStr.equalsIgnoreCase("yes")))
		isDetailsFromADOnly = true;

	boolean isShowUniqueUserCountInUI = false;
	String showUniqueUserCountInUI=ini.getValue("END_USER_DASHBOARD_SETTINGS","ShowUniqueUserCountInUI");
	showUniqueUserCountInUI=(showUniqueUserCountInUI==null || showUniqueUserCountInUI.trim().length()==0)?"false":showUniqueUserCountInUI;
	if(showUniqueUserCountInUI != null && showUniqueUserCountInUI.trim().length() > 0 && (showUniqueUserCountInUI.equalsIgnoreCase("true") || showUniqueUserCountInUI.equalsIgnoreCase("yes")))
		isShowUniqueUserCountInUI = true;

	boolean liveDataFromVirtualApps = false;
	String strliveDataFromVirtualApps=ini.getValue("END_USER_DASHBOARD_SETTINGS","LiveDataFromVirtualApps");
	strliveDataFromVirtualApps=(strliveDataFromVirtualApps==null || strliveDataFromVirtualApps.trim().length()==0)?"false":strliveDataFromVirtualApps;
	if(strliveDataFromVirtualApps != null && strliveDataFromVirtualApps.trim().length() > 0 && (strliveDataFromVirtualApps.equalsIgnoreCase("true") || strliveDataFromVirtualApps.equalsIgnoreCase("yes")))
		liveDataFromVirtualApps = true;
	
	String decimalFormatMeasure = ini.getValue("USER_DESKTOP_METRICS_DECIMAL_FORMAT_MEASURES",userType);
	ArrayList decimalFormatTestMeasureList = new ArrayList();
	if(decimalFormatMeasure!=null && decimalFormatMeasure.length()>0)
		decimalFormatTestMeasureList = StringUtils.egTokenizer(decimalFormatMeasure,",",false,true,true);//param 3-->includeEmpty,4-->unique,5-->trim
	String convertToDaysMeasure = ini.getValue("USER_DESKTOP_METRICS_CONVERT_TO_DAYS_MEASURES",userType);
	ArrayList convertToDaysTestMeasureList = new ArrayList();
	if(convertToDaysMeasure!=null && convertToDaysMeasure.trim().length()>0)
		convertToDaysTestMeasureList = StringUtils.egTokenizer(convertToDaysMeasure,",",false,true,true);//param 3-->includeEmpty,4-->unique,5-->trim

	String default_Filter=ini.getValue("END_USER_DASHBOARD_SETTINGS","defaultFilter");
	String sub_Filter=ini.getValue("END_USER_DASHBOARD_SETTINGS","subFilter");
	String isRetrieveUserExpDatafromDB = ini.getValue("END_USER_DASHBOARD_SETTINGS","RetrieveUserExpDatafromDB");
	boolean isRetrieveFDB=false;
	if(isRetrieveUserExpDatafromDB!=null && isRetrieveUserExpDatafromDB.length()>0 && (isRetrieveUserExpDatafromDB.equalsIgnoreCase("true") || isRetrieveUserExpDatafromDB.equalsIgnoreCase("yes")))
		isRetrieveFDB=true;

	ArrayList tmpSubFilList = new ArrayList(); 
	if(sub_Filter!=null && sub_Filter.length()>0)
		tmpSubFilList = StringUtils.egTokenizer(sub_Filter,",",true,false,true);//param 3-->includeEmpty,4-->unique,5-->trim

	String udm_hide_unit = ini.getValue("USER_DESKTOP_METRICS_HIDE_UNIT",userType);
	ArrayList udm_hide_unit_list = (ArrayList)getTokenList(udm_hide_unit,",");

	String esxStr=ini.getValue("USER_TYPE_COMPONENTS","ESX");
	ArrayList esx_list = new ArrayList();
	if(esxStr!=null && esxStr.trim().length()>0)
		esx_list = (ArrayList)getTokenList(esxStr,",");

	String vdiStr=ini.getValue("USER_TYPE_COMPONENTS","VDI");
	ArrayList vdi_list = new ArrayList();
	if(vdiStr!=null && vdiStr.trim().length()>0)
		vdi_list = (ArrayList)getTokenList(vdiStr,",");
	
	JSONObject isEnableFilterJson = new JSONObject();
	String tmp_metrics = ini.getValue("USER_DESKTOP_METRICS",userName+":"+userType);
	if(tmp_metrics==null || tmp_metrics.trim().length()==0)
	{
		String tmp_metricsD = ini.getValue("USER_DESKTOP_METRICS","DEFAULT_"+userType);
		String tmp_metricsT = ini.getValue("USER_DESKTOP_METRICS",userType);
		if(tmp_metricsD != null && tmp_metricsD.trim().length() > 0)
			tmp_metrics = (String)getMeasureForUI(tmp_metricsD,tmp_metricsT);
		else
			tmp_metrics = tmp_metricsT;
	}
	ArrayList tmp_metricsList = new ArrayList();
	ArrayList filterList = new ArrayList();
	if(tmp_metrics != null && tmp_metrics.trim().length() > 0)
	{
		tmp_metricsList = com.egurkha.util.StringUtils.egTokenizer(tmp_metrics, ",", true,false,true);
		if(tmp_metricsList != null && tmp_metricsList.size() > 0){
			for(int i=0;i<tmp_metricsList.size();i++){
				String met = (String)tmp_metricsList.get(i);
				if(met == null || met.trim().length() == 0)
					continue;

				ArrayList check = com.egurkha.util.StringUtils.egTokenizer(met, ":", true,false,true);
				if(check != null && check.size() ==2){
					String geoCheck = (String)check.get(0);
					String geoCheckValue = (String)check.get(1);

					if(geoCheck != null && geoCheck.trim().length()  > 0)
					{
						if(geoCheck.equalsIgnoreCase("GeoDetails") )
						{
							ArrayList valList = com.egurkha.util.StringUtils.egTokenizer(geoCheckValue, "~$~", true,false,true);
							//geoCheckValue = geoCheckValue.subtring(0,geoCheckValue.indexOf("~$~"));
							if(valList != null && valList.size() ==2)
							{
								//ob2 = new JSONObject();
								//ob2.put("displayField",(String)valList.get(1));
								//ob2.put("valueField",(String)valList.get(0));
								filterList.add((String)valList.get(0));
							}
						}
					}
				}
			}
		}
	}

	boolean isdefaultFilter=false;
	boolean istmpSubFilter=false;
	boolean istmpnextSubFilter=false;
	if(filterList!=null && filterList.size()>0)
	{
		if(default_Filter!=null && default_Filter.length()>0 && filterList.contains(default_Filter))
			isdefaultFilter=true;
	}
	
	isEnableFilterJson.put("isdefaultFilter",isdefaultFilter);

	if(tmpSubFilList!=null && tmpSubFilList.size()>0)
	{
		String tmp_Sub_Val=(String)tmpSubFilList.get(0);
		if(tmp_Sub_Val!=null && tmp_Sub_Val.length()>0 && filterList.contains(tmp_Sub_Val))
			istmpSubFilter = true;
		
		if(tmpSubFilList.size()>1)
		{
			String tmp_Sub_Val_2=(String)tmpSubFilList.get(1);
			if((istmpSubFilter) && tmp_Sub_Val_2!=null && tmp_Sub_Val_2.length()>0 && filterList.contains(tmp_Sub_Val_2))
				istmpnextSubFilter=true;
		}
	}
	isEnableFilterJson.put("istmpSubFilter",istmpSubFilter);
	isEnableFilterJson.put("istmpnextSubFilter",istmpnextSubFilter);
	json.put("isEnableFilterJson",isEnableFilterJson);

	String user_test = ini.getValue("USER_DESKTOP_TYPES_TEST",userType);
	Hashtable metaTest=(Hashtable)EgMetaThread.metaTest;
	if(metaTest == null)
		metaTest=new Hashtable(); 
	
	String dsInfo = request.getParameter("dsInfo");
	dsInfo=com.egurkha.util.StringUtils.decodeSecurityChar(dsInfo);
	String showDSInfo=null;
	Hashtable vmsHash = new Hashtable();
	String dscomp = request.getParameter("dscomp");
	String dscomptype = request.getParameter("dscomptype");
	String dsmsmt_host = request.getParameter("dsmsmt_host");
	if(isFromVCDS!=null && (isFromVCDS.equalsIgnoreCase("true") || isFromVCDS.equalsIgnoreCase("yes")))
	{
		showDSInfo = dsInfo;
		if(dsInfo!=null && dsInfo.trim().length()>0 && (dsInfo.startsWith("+") || dsInfo.startsWith("*")))
			showDSInfo = dsInfo.substring(1);
		vmsHash = (Hashtable)vmDashHelper.getVMsFromVCDatastore("VCDataStore",userType,dscomp,dscomptype,dsInfo,dsmsmt_host);
		if(vmsHash==null)
			vmsHash=new Hashtable();
	}

	Hashtable finalEndUserDatas = (Hashtable)vmDashHelper.getEndUserDatas(userType);
	Hashtable infoResHash = new Hashtable();
	Hashtable dataResHash = new Hashtable();
	Hashtable fullInfoHash = new Hashtable();
	//boolean orderByCol_flag=false;
	boolean isDataAvailable = false;
	int measuresCount = 0;
	if(!EgInstallInfo.isSuperManager && finalEndUserDatas!=null && finalEndUserDatas.size()>0)
	{
		//if(!showKeyUser)
		//{
			infoResHash = (Hashtable)finalEndUserDatas.get("users");
			dataResHash = (Hashtable)finalEndUserDatas.get("usersDetails");
		//}
	}

	if(orderByColumnName!=null && orderByColumnName.trim().length()>0 && !orderByColumnName.equalsIgnoreCase("null") && !orderByColumnName.equalsIgnoreCase("default"))
	{
		tmp_priority="ALL";
		//orderByCol_flag=true;
	}
	else if(isUDSortByAllValue)
		tmp_priority="ALL";
	else if(isAdtnlSearch)
		tmp_priority="ALL";
	else if(isEndUserOverview)
		tmp_priority="ALL";

	String tmpOrderByColumnName=orderByColumnName;
	if(columnDispName!=null && columnDispName.trim().length()>0 && !columnDispName.equalsIgnoreCase("null"))
	{
		ArrayList metricsList = (ArrayList)getTokenList(tmp_metrics,",");

		String newObCN = (String)getRelavantOrderByColumnNames(metricsList,columnDispName,Dbdata);

		//if(newObCN!=null && newObCN.trim().length()>0)
			//tmpOrderByColumnName = newObCN;
	}

	String treeFlag_SBD = request.getParameter("treeFlag_SBD");
	String outsideService_SBD = request.getParameter("outsideService_SBD");
	String titleText_SBD = request.getParameter("titleText_SBD");
	String selectNode_SBD = request.getParameter("selectNode_SBD");
	String isEmulTrans_SBD = request.getParameter("isEmulTrans_SBD");
	String serviceName = request.getParameter("serviceName");
	String serviceState_SBD = request.getParameter("serviceState_SBD");
	String isServiceBusiDash = request.getParameter("isServiceBusiDash");

	String groupByStr = ini.getValue("LOC_USER_DESKTOP_METRICS",userType+":GroupBy");
	ArrayList groupByList = new ArrayList();
	if(groupByStr!=null && groupByStr.trim().length()>0)
		groupByList = StringUtils.egTokenizer(groupByStr,",",false,true,true);		//param 3-->includeEmpty,4-->unique,5-->trim
	else
		isEndUserOverview = false;

	String filterFlag = request.getParameter("filterFlag");
	ArrayList filterInfo = null;
	Hashtable filterInfoHash = null;
	String detail = request.getParameter("detail");
	if(detail != null && detail.equals("ComponentType"))
		detail = "componentType";
	String compCombo = request.getParameter("compCombo");
	//String compCombo = request.getParameterValues("msmtHostNames");;
	String filterBy = request.getParameter("filterBy");
	String subFilter = request.getParameter("subFilter");
	String searchFilter = request.getParameter("searchFilter");
	searchFilter = (searchFilter==null || searchFilter.trim().length()==0 || searchFilter.equalsIgnoreCase("NULL"))?"All":searchFilter;
	if(searchFilter != null && searchFilter.trim().length() > 0)
		searchFilter = searchFilter.trim();
	String nextSearch = request.getParameter("nextSearch");
	nextSearch = (nextSearch==null || nextSearch.trim().length()==0 || nextSearch.equalsIgnoreCase("NULL"))?"All":nextSearch;
	if(nextSearch != null && nextSearch.trim().length() > 0)
		nextSearch = nextSearch.trim();
	String nextSubSearch = request.getParameter("nextSubSearch");
	nextSubSearch = (nextSubSearch==null || nextSubSearch.trim().length()==0 || nextSubSearch.equalsIgnoreCase("NULL"))?"All":nextSubSearch;
	if(nextSubSearch != null && nextSubSearch.trim().length() > 0)
		nextSubSearch = nextSubSearch.trim();
	String priorityFilter = request.getParameter("priorityFilter");
	String gatewayFilter = request.getParameter("gatewayFilter");
	priorityFilter = (priorityFilter==null || priorityFilter.trim().length()==0||priorityFilter.equalsIgnoreCase("NULL"))?"All":priorityFilter;
	gatewayFilter = (gatewayFilter==null || gatewayFilter.trim().length()==0||gatewayFilter.equalsIgnoreCase("NULL"))?"All":gatewayFilter;
	String searchFilDispTxt = request.getParameter("searchFilDispTxt");
	String nextSearchFilDispTxt = request.getParameter("nextSearchFilDispTxt");
	Hashtable statesList = null;
	
	JSONObject fil_json = new JSONObject();
	JSONArray fil = new JSONArray();
	if(filterFlag != null && filterFlag.equals("true"))
	{
		filterInfo = new ArrayList();
		filterInfoHash =  new Hashtable();
		
		Hashtable InfoSession = (Hashtable)session.getAttribute(userType+"InfoSession");
		Hashtable InfoFilterSession = (Hashtable)session.getAttribute(userType+"InfoFilterSession");
		Hashtable geoLocMapInfos = (Hashtable)session.getAttribute(userType+"geoLocMapInfos");
		if(InfoSession==null && InfoFilterSession==null && dataResHash!=null && dataResHash.size()>0)
		{
			Hashtable TotalMeasureInfoTmp = new Hashtable();
			TotalMeasureInfoTmp=(Hashtable)dataResHash.clone();
			
			if(TotalMeasureInfoTmp != null && TotalMeasureInfoTmp.containsKey("InfoSession") && TotalMeasureInfoTmp.containsKey("InfoFilterSession"))
			{
				InfoSession = (Hashtable)TotalMeasureInfoTmp.get("InfoSession");
				InfoFilterSession = (Hashtable)TotalMeasureInfoTmp.get("InfoFilterSession");
				geoLocMapInfos = (Hashtable)TotalMeasureInfoTmp.get("geoLocMapInfos");

				if(InfoSession != null && InfoSession.size() > 0)
				{
					Iterator it = InfoSession.entrySet().iterator();
					while(it.hasNext()){
						Entry en = (Entry)it.next();
						Set set = (HashSet)en.getValue();
						ArrayList list = new ArrayList(set);
						if(list != null && list.size() > 0)
							fil.add((String)en.getKey());
					}
					session.setAttribute(userType+"InfoSession",InfoSession);
					session.setAttribute(userType+"tmpInfoSession",InfoSession);
					session.setAttribute(userType+"geoLocMapInfos",geoLocMapInfos);
				}

				if(InfoFilterSession != null && InfoFilterSession.size() > 0)
					session.setAttribute(userType+"InfoFilterSession",InfoFilterSession);
			}
		}
		
		filterInfoHash.put("detail",detail);
		filterInfoHash.put("compCombo",compCombo);
		
		fil_json.put("detail",detail);
		fil_json.put("compCombo",compCombo);
		fil_json.put("filterBy",filterBy);

		json.put("fil_json",fil_json);
		filterInfoHash = (Hashtable)getFilterTypeDetails(user,detail,filterBy,filterInfoHash);

		filterInfoHash.put("filterBy",filterBy);
		filterInfoHash.put("searchFilter",searchFilter);
		filterInfoHash.put("nextSearch",nextSearch);
		if(nextSubSearch == null )
			nextSubSearch="";
		filterInfoHash.put("nextSubSearch",nextSubSearch);
		filterInfoHash.put("priorityFilter",priorityFilter);
		filterInfoHash.put("gatewayFilter",gatewayFilter);
		if(InfoSession == null)
			InfoSession = new Hashtable();
		filterInfoHash.put("InfoSession",InfoSession);
		if(InfoFilterSession == null)
			InfoFilterSession = new Hashtable();
		filterInfoHash.put("InfoFilterSession",InfoFilterSession);
		if(geoLocMapInfos == null)
			geoLocMapInfos = new Hashtable();
		filterInfoHash.put("geoLocMapInfos",geoLocMapInfos);

		List temp_listZone = user.getZones();
		ArrayList notZoneList = new ArrayList();
		notZoneList = (ArrayList)getNotZoneList(temp_listZone,groupInfo);
		
		filterInfoHash.put("notZoneList",notZoneList);

		if(isFromVCDS!=null && (isFromVCDS.equalsIgnoreCase("true") || isFromVCDS.equalsIgnoreCase("yes")))
		{
			if(vmsHash!=null)
				filterInfoHash.put("isFromVCDSHash",(Hashtable)vmsHash);
		}
	}
	else if(isFromVCDS!=null && (isFromVCDS.equalsIgnoreCase("true") || isFromVCDS.equalsIgnoreCase("yes")))
	{
		filterInfoHash =  new Hashtable();
		if(vmsHash!=null)
			filterInfoHash.put("isFromVCDSHash",(Hashtable)vmsHash);
	}
	
	String isfromctx = request.getParameter("fromctx");
	boolean isFromctx = false;
	if(isfromctx != null && isfromctx.equalsIgnoreCase("true"))
		isFromctx =true;
	String host_comp_type="";
	if(isFromctx)
	{
		infoResHash = new Hashtable();
		dataResHash = new Hashtable();
		if(filterInfoHash == null)
			filterInfoHash = new Hashtable();

		filterInfoHash.put("isFromHost","true");
	}

	if(searchFrom!=null && !searchFrom.equals("") && searchFrom.equalsIgnoreCase("InsideEndUserDashboard"))
	{
		String searchStringData = request.getParameter("searchStringData");
		searchStringData=com.egurkha.util.StringUtils.decodeSecurityChar(searchStringData);
		desktopUserName = searchStringData;
		searchString = searchStringData;
		if(infoResHash!=null && infoResHash.size()>0)
		{
			finalDesktopVmsHash = (Hashtable)vmDashHelper.getAllUsersDesktopsForUED(searchString,tmp_priority,userType,vdiType,pageNo,infoResHash,searchFrom,aduserFilter,filterInfoHash);
		}
		else
		{
			finalDesktopVmsHash = (Hashtable)vmDashHelper.getVmDesktopsForTheComponentForGenericEUD(searchStringData,tmp_priority,userType,vdiType,pageNo,searchFrom,aduserFilter,filterInfoHash);
		}
	}
	else
	{
		if(isEndUserOverview || isFromUEDSort)
		{
			finalDesktopVmsHash = (Hashtable)vmDashHelper.getVmDesktopsForTheComponentForGenericEUD(null,tmp_priority,userType,vdiType,pageNo,aduserFilter,filterInfoHash);
		}
		else if(infoResHash!=null && infoResHash.size()>0)
		{
			finalDesktopVmsHash = (Hashtable)vmDashHelper.getAllUsersDesktopsForUED(searchString,tmp_priority,userType,vdiType,pageNo,infoResHash,null,aduserFilter,filterInfoHash);
		} 
		else
		{
			finalDesktopVmsHash = (Hashtable)vmDashHelper.getVmDesktopsForTheComponentForGenericEUD(searchString,tmp_priority,userType,vdiType,pageNo,aduserFilter,filterInfoHash);
		}
	}
	
	String adFilter = "";
	ArrayList adFilterKeys = new ArrayList();
	Integer uniqueUserCount=new Integer(0);
	Hashtable userRelatedAd = new Hashtable();
	int userTotalCount=0;
	boolean isGetLiveData=false;
	Hashtable keyStateCountHash = new Hashtable();

	if(finalDesktopVmsHash!=null && finalDesktopVmsHash.size()>0)
	{
		vdiDesktopsList = (EgList)finalDesktopVmsHash.get("EgList");
		vdiDesktopsListTotalCount = (Integer)finalDesktopVmsHash.get("EgListCount");
		uniqueUserCount = (Integer)finalDesktopVmsHash.get("UniqueUserCount");

		//if(isShowUniqueUserCountInUI && uniqueUserCount!=null && uniqueUserCount>0)
			//vdiDesktopsListTotalCount = uniqueUserCount;

		if((userType.equals("OverviewAppXenApp7") || userType.equals("OverviewAppVDI")) && show_app_overview!=null && (show_app_overview.equalsIgnoreCase("true") || show_app_overview.equalsIgnoreCase("yes")))
		{
			vdiDesktopsList = (EgList)finalDesktopVmsHash.get("OverviewEgList");
			vdiDesktopsListTotalCount = (Integer)finalDesktopVmsHash.get("OverviewEgListCount");
		}

		if(showKeyUser && isKeyUserUED)
		{
			vdiDesktopsList = (EgList)finalDesktopVmsHash.get("KeyEgList");
			vdiDesktopsListTotalCount = (Integer)finalDesktopVmsHash.get("KeyEgListCount");
			keyStateCountHash = (Hashtable)finalDesktopVmsHash.get("KeyEgStateCount");
			List resAllUserList = (List)finalDesktopVmsHash.get("AllUserList");
			List resSelectedUserList = (List)finalDesktopVmsHash.get("SelectedUserList");
			session.setAttribute("SelectedUserList",(List)resSelectedUserList);
			session.setAttribute("AllUserList",(List)resAllUserList);
		}
		else
		{
			session.removeAttribute("SelectedUserList");
			session.removeAttribute("AllUserList");
		}

		statesList = (Hashtable)finalDesktopVmsHash.get("statesList");
		infosCompHash = (Hashtable)finalDesktopVmsHash.get("INFOS_COMP");
		Hashtable tmp_CTHash = (Hashtable)finalDesktopVmsHash.get("TYPE_COMP_INFO");
		typeCompInfoHash = tmp_CTHash;
		if(liveDataFromVirtualApps && isFromGeo && usercountval != null && usercountval.trim().length() > 0 && !usercountval.equalsIgnoreCase("null"))
		{
			try
			{
				userTotalCount = Integer.parseInt(usercountval);
			}
			catch(Exception ee)
			{
				usercountval = null;
			}
			//if(vdiDesktopsListTotalCount!=userTotalCount && userTotalCount!=0 && geoInfo!=null && geoInfo.equalsIgnoreCase("All"))
			if(vdiDesktopsListTotalCount!=userTotalCount && userTotalCount!=0)
			{
				finalDesktopVmsHash=new Hashtable();
				if(isEndUserOverview || isFromUEDSort)
				{
					//writeLog(" vmDashHelper {getVmDesktopsForTheComponentForGenericEUD} Method call in ",isDebugEnabled,logFileSize);
					finalDesktopVmsHash = (Hashtable)vmDashHelper.getVmDesktopsForTheComponentForGenericEUD(null,tmp_priority,userType,vdiType,pageNo,aduserFilter,filterInfoHash);
					//writeLog(" vmDashHelper {getVmDesktopsForTheComponentForGenericEUD} Method call out ",isDebugEnabled,logFileSize);
				}
				else
				{
					//writeLog(" vmDashHelper {getVmDesktopsForTheComponentForGenericEUD} Method call in ",isDebugEnabled,logFileSize);
					finalDesktopVmsHash = (Hashtable)vmDashHelper.getVmDesktopsForTheComponentForGenericEUD(searchString,tmp_priority,userType,vdiType,pageNo,aduserFilter,filterInfoHash);
					//writeLog(" vmDashHelper {getVmDesktopsForTheComponentForGenericEUD} Method call out ",isDebugEnabled,logFileSize);
				}

				if(finalDesktopVmsHash!=null && finalDesktopVmsHash.size()>0)
				{
					isGetLiveData=true;
					vdiDesktopsList = (EgList)finalDesktopVmsHash.get("EgList");
					vdiDesktopsListTotalCount = (Integer)finalDesktopVmsHash.get("EgListCount");
					uniqueUserCount = (Integer)finalDesktopVmsHash.get("UniqueUserCount");

					//if(isShowUniqueUserCountInUI && uniqueUserCount!=null && uniqueUserCount>0)
						//vdiDesktopsListTotalCount = uniqueUserCount;

					if((userType.equals("OverviewAppXenApp7") || userType.equals("OverviewAppVDI")) && show_app_overview!=null && (show_app_overview.equalsIgnoreCase("true") || show_app_overview.equalsIgnoreCase("yes")))
					{
						vdiDesktopsList = (EgList)finalDesktopVmsHash.get("OverviewEgList");
						vdiDesktopsListTotalCount = (Integer)finalDesktopVmsHash.get("OverviewEgListCount");
					}

					statesList = (Hashtable)finalDesktopVmsHash.get("statesList");
					infosCompHash = (Hashtable)finalDesktopVmsHash.get("INFOS_COMP");
					tmp_CTHash = (Hashtable)finalDesktopVmsHash.get("TYPE_COMP_INFO");
					typeCompInfoHash = tmp_CTHash;

					try
					{
						if(isFromGeo && usercountval != null && usercountval.trim().length() > 0 && !usercountval.equalsIgnoreCase("null"))
						{
							//userTotalCount = Integer.parseInt(usercountval);
							userTotalCount = vdiDesktopsListTotalCount;
						}
					}
					catch(Exception ee)
					{
						usercountval = null;
					}

					if(userType!=null && (userType.equalsIgnoreCase("AppXenApp7") || userType.equalsIgnoreCase("AppDDXenApp7") || userType.equalsIgnoreCase("AppVDI") || userType.equalsIgnoreCase("AppDDVDI") || userType.equalsIgnoreCase("AppLaunchDDXenApp7") || userType.equals("OverviewAppXenApp7") || userType.equals("OverviewAppVDI")))
					{
						userTotalCount = vdiDesktopsListTotalCount;
					}
					else
					{
						if(isFromGeo && usercountval != null && usercountval.trim().length() > 0 && !usercountval.equalsIgnoreCase("null"))
						{
							//userTotalCount = Integer.parseInt(usercountval);
							userTotalCount = vdiDesktopsListTotalCount;
						}
						else
						{
							if(isRetrieveFDB)
							{
								//userTotalCount=vdiDesktopsListTotalCount;
								infolist1 = (ArrayList)finalDesktopVmsHash.get("TMPINFOS");
								if(tmp_priority!=null && (!tmp_priority.equals("ALL")))
									userTotalCount=vdiDesktopsListTotalCount;
								else if(infolist1!=null && infolist1.size()>0)
									userTotalCount=infolist1.size();
								else
									userTotalCount=vdiDesktopsListTotalCount;
							}
							else
							{
								infolist = (ArrayList)finalDesktopVmsHash.get("INFOS");
								if(tmp_priority!=null && (!tmp_priority.equals("ALL")))
									userTotalCount=vdiDesktopsListTotalCount;
								else if(infolist!=null && infolist.size()>0)
									userTotalCount=infolist.size();
							}
						}
					}
				}
			}
			//else if(vdiDesktopsListTotalCount!=userTotalCount && geoInfo!=null && !geoInfo.equalsIgnoreCase("All"))
			//{
				//if(isFromGeo && usercountval != null && usercountval.trim().length() > 0 && !usercountval.equalsIgnoreCase("null"))
					//userTotalCount = vdiDesktopsListTotalCount;
			//}
		}
		else
		{
			if(showKeyUser && isKeyUserUED)
			{
				userTotalCount = vdiDesktopsListTotalCount;
			}
			else
			{
				if(isRetrieveFDB)
				{
					//userTotalCount=vdiDesktopsListTotalCount;
					infolist1 = (ArrayList)finalDesktopVmsHash.get("TMPINFOS");
					if(tmp_priority!=null && (!tmp_priority.equals("ALL")))
						userTotalCount=vdiDesktopsListTotalCount;
					else if(infolist1!=null && infolist1.size()>0)
						userTotalCount=infolist1.size();
					else
						userTotalCount=vdiDesktopsListTotalCount;
				}
				else
				{	
					//infolist = (ArrayList)finalDesktopVmsHash.get("INFOS");
					infolist = (ArrayList)finalDesktopVmsHash.get("TMPINFOS");
					if(tmp_priority!=null && (!tmp_priority.equals("ALL")))
						userTotalCount=vdiDesktopsListTotalCount;
					else if(infolist!=null && infolist.size()>0)
						userTotalCount=infolist.size();
					else
						userTotalCount=vdiDesktopsListTotalCount;
				}
			}
		}
		if(isShowUniqueUserCountInUI && uniqueUserCount!=null && uniqueUserCount>0 && (!isFromctx))
		{
			userTotalCount = uniqueUserCount;
		}

		//dbinfolist = (ArrayList)finalDesktopVmsHash.get("DBINFOS");

		resTypeList = (List)finalDesktopVmsHash.get("CTYPE");
		componentTypeList = resTypeList;
		//resCnameList = (List)finalDesktopVmsHash.get("CNAME");
		//resCompsList = (List)finalDesktopVmsHash.get("COMPS");
		//resNickList = (List)finalDesktopVmsHash.get("NICKS");
		//resPortList = (List)finalDesktopVmsHash.get("PORTS");

		fullInfoHash = (Hashtable)finalDesktopVmsHash.get("FULLINFOS");
		//maxUser = (String)finalDesktopVmsHash.get("MAX_USER");
		//user_count_hash = (Hashtable)finalDesktopVmsHash.get("MAX_USER_HASH");

		if(finalDesktopVmsHash.containsKey("adFilter"))
			adFilter = (String)finalDesktopVmsHash.get("adFilter");
		if(finalDesktopVmsHash.containsKey("adFilterKeys"))
			adFilterKeys = (ArrayList)finalDesktopVmsHash.get("adFilterKeys");
		if(finalDesktopVmsHash.containsKey("userRelatedAd"))
			userRelatedAd = (Hashtable)finalDesktopVmsHash.get("userRelatedAd");
		if(finalDesktopVmsHash.containsKey("groupByUserKeys"))
			groupByUserKeys = (ArrayList)finalDesktopVmsHash.get("groupByUserKeys");
		if(groupByUserKeys==null||groupByUserKeys.size()==0)
			isEndUserOverview = false;
	}
	String inner_header="";
	String header_display = "";
	String header_display_icon="";
	String is_Header_DispName=ini.getValue("END_USER_DASHBOARD_SETTINGS","ShowUserCountInUI");
	//String skipDesktopsForUserType = ini.getValue("END_USER_DASHBOARD_SETTINGS","SkipDesktopsFor"+userType);

	try
	{
		pageSize = Integer.parseInt(priority);
	}
	catch(Exception e)
	{
		pageSize = vdiDesktopsListTotalCount;
	}

	int pageStartIndex = 0;
	int pageEndIndex = 0;
	

	if(vdiType != null && vdiType.indexOf(":") != -1)
		host_comp_type = vdiType.substring(0,vdiType.indexOf(":"));
	else if(vdiType != null)
		host_comp_type=vdiType;	

	Hashtable TotalMeasureInfo = new Hashtable();
	//session.removeAttribute(userType+"InfoSession");
	//session.removeAttribute(userType+"InfoFilterSession");
	
	//TotalMeasureInfo = vmDashHelper.getAllDesktopVmsMeasureData(finalDesktopVmsHash);
	if(searchFrom==null || searchFrom.trim().length()==0)
	{
		if((!isGetLiveData) && dataResHash!=null && dataResHash.size()>0 && ((vdiDesktopsList!=null && vdiDesktopsList.size()>0 && vdiDesktopsListTotalCount>0) || (groupByUserKeys!=null && groupByUserKeys.size()>0)))
		{
			TotalMeasureInfo=(Hashtable)dataResHash.clone();
		}
		else if((vdiDesktopsList!=null && vdiDesktopsList.size()>0 && vdiDesktopsListTotalCount>0) || (groupByUserKeys!=null && groupByUserKeys.size()>0))
		{
			String temp_user_type = userType;
			if(isFromctx)
			{
				if(finalDesktopVmsHash == null)
					finalDesktopVmsHash = new Hashtable();

				temp_user_type = temp_user_type+":"+host_comp_type;
				finalDesktopVmsHash.put("isFromHost","true");
			}
			else if(isFromGeo)
			{
				finalDesktopVmsHash.put("isFromGeo","true");
			}
			//TotalMeasureInfo = vmDashHelper.getAllDesktopVmsMeasureDataForGenericEUD(finalDesktopVmsHash,userType);
			TotalMeasureInfo = vmDashHelper.getAllDesktopVmsMeasureDataForGenericEUD(finalDesktopVmsHash,temp_user_type,userName);
		}

		if(TotalMeasureInfo != null && TotalMeasureInfo.containsKey("InfoSession") && TotalMeasureInfo.containsKey("InfoFilterSession"))
		{
			Hashtable geoMapInfo = (Hashtable)TotalMeasureInfo.get("InfoSession");
			Hashtable InfoFilterSession = (Hashtable)TotalMeasureInfo.get("InfoFilterSession");
			Hashtable geoLocMapInfos = (Hashtable)TotalMeasureInfo.get("geoLocMapInfos");

			TotalMeasureInfo.remove("InfoSession");
			TotalMeasureInfo.remove("InfoFilterSession");
			TotalMeasureInfo.remove("geoLocMapInfos");
			//TotalMeasureInfo.remove("statesList");

			if(geoMapInfo != null && geoMapInfo.size() > 0)
			{
				Iterator it = geoMapInfo.entrySet().iterator();
				while(it.hasNext()){
					Entry en = (Entry)it.next();
					Set set = (HashSet)en.getValue();
					ArrayList list = new ArrayList(set);
					if(list != null && list.size() > 0)
						fil.add((String)en.getKey());
				}

				session.setAttribute(userType+"InfoSession",geoMapInfo);
				session.setAttribute(userType+"tmpInfoSession",geoMapInfo);
				session.setAttribute(userType+"geoLocMapInfos",geoLocMapInfos);
				//session.setAttribute("statesList",statesList);
			}

			if(InfoFilterSession != null && InfoFilterSession.size() > 0)
				session.setAttribute(userType+"InfoFilterSession",InfoFilterSession);
		}
		if(statesList!=null && statesList.size()>0)
			session.setAttribute("statesList",statesList);
		if(TotalMeasureInfo!=null && TotalMeasureInfo.containsKey("finalGroupByUserTab"))
			finalGroupByUserTab = (Hashtable) TotalMeasureInfo.get("finalGroupByUserTab");
		if(TotalMeasureInfo!=null && TotalMeasureInfo.containsKey("finalallMeasureDataLen"))
			finalallMeasureDataLen = (Hashtable) TotalMeasureInfo.get("finalallMeasureDataLen");

		if(tmpOrderByColumnName!=null && tmpOrderByColumnName.trim().length()>0 && !tmpOrderByColumnName.equalsIgnoreCase("null") && !tmpOrderByColumnName.equalsIgnoreCase("default"))
		{
			if(col_Type!=null && col_Type.trim().length()>0 && (!col_Type.equalsIgnoreCase("NULL")))
			{
				if(isFromUEDSort)
					groupByUserKeys = (ArrayList)vmDashHelper.getSortedListForUEDOverview(groupByUserKeys,TotalMeasureInfo,"enduseroverview",tmpOrderByColumnName,orderBy,col_Type);
				else
					vdiDesktopsList=vmDashHelper.getSortedList(vdiDesktopsList,TotalMeasureInfo,"virtual",tmpOrderByColumnName,orderBy,col_Type);
			}
			else
			{
				if(tmpOrderByColumnName.equalsIgnoreCase("HOST"))
					vdiDesktopsList=vmDashHelper.getSortedList(vdiDesktopsList,tmpOrderByColumnName,null,orderBy);
				else
					vdiDesktopsList=vmDashHelper.getSortedList(vdiDesktopsList,TotalMeasureInfo,"virtual",tmpOrderByColumnName,orderBy);
			}
			if(priority!=null && !priority.equalsIgnoreCase("ALL"))
				vdiDesktopsList = vmDashHelper.getSubList(vdiDesktopsList,priority,pageNo);
		}
		else if(isUDSortByAllValue)
		{
			String tempUserType = userType;
			if(isFromctx)
				tempUserType = userType+":"+host_comp_type;

			vdiDesktopsList=vmDashHelper.getAllMeasureValueBasedSortedList(vdiDesktopsList,TotalMeasureInfo,tempUserType,strMValueOrder,isFromctx);
			if(priority!=null && !priority.equalsIgnoreCase("ALL"))
			{
				vdiDesktopsList = vmDashHelper.getSubList(vdiDesktopsList,priority,pageNo);
			}
		}
	}
	if(groupByUserKeys!=null && groupByUserKeys.size()>0)
		groupByUserCount = groupByUserKeys.size();
	
	int userPageCount=0;
	if(isAdtnlSearch)
	{
		boolean isOnlyStartsWithCheck = false;
		String startsWithCheck=ini.getValue("Additional_Search","EnableStartsWithSearch");
		if(startsWithCheck != null && startsWithCheck.trim().length()>0 && startsWithCheck.equalsIgnoreCase("true"))
			isOnlyStartsWithCheck = true;
		vdiDesktopsList = (EgList)vmDashHelper.getAdditionalSearchVdiDesktopsList(vdiDesktopsList,TotalMeasureInfo,adtnlSearchStr,adtnlSearchColumns,isOnlyStartsWithCheck);
		if(isShowUniqueUserCountInUI)
		{
			ArrayList uniquUserList =(ArrayList) getUniqueUserList(vdiDesktopsList);
			if(uniquUserList!=null)
				userTotalCount = uniquUserList.size();
		}
		else
			userTotalCount = vdiDesktopsList.size();

		userPageCount = vdiDesktopsList.size();

		if(priority!=null && !priority.equalsIgnoreCase("ALL"))
			vdiDesktopsList = vmDashHelper.getSubList(vdiDesktopsList,priority,pageNo);
	}
	if(isDetailsFromADOnly)
	{
		if(searchFilter!=null && searchFilter.trim().length()>0 && !searchFilter.equalsIgnoreCase("All") && nextSearch!=null && nextSearch.trim().length()>0 && !nextSearch.equalsIgnoreCase("All"))
		{
			vdiDesktopsList = (EgList)vmDashHelper.getFilteredVdiDesktopsListWithLocation(vdiDesktopsList,TotalMeasureInfo,nextSearch,searchFilter);
			/*if(vdiDesktopsList!=null && vdiDesktopsList.size()>0)
			{
				if(isShowUniqueUserCountInUI)
				{
					ArrayList uniquUserList =(ArrayList) getUniqueUserList(vdiDesktopsList);
					if(uniquUserList!=null)
						userTotalCount = uniquUserList.size();
				}
				else
					userTotalCount = vdiDesktopsList.size();

				userPageCount = vdiDesktopsList.size();
			}
			if(priority!=null && !priority.equalsIgnoreCase("ALL"))
				vdiDesktopsList = vmDashHelper.getSubList(vdiDesktopsList,priority,pageNo);*/
		}
	}
	if(!isEndUserOverview)
	{
		if((isAdtnlSearch || isDetailsFromADOnly) && vdiDesktopsList!=null && vdiDesktopsList.size()>0 && userPageCount!=0)
			recount=userPageCount;
		else
			recount=vdiDesktopsListTotalCount;
		if(pageSize > 0)
			pagesizec=recount/pageSize;
		int tem = recount;
		int mod = 0;
		if(pageSize > 0)
			mod = tem%pageSize;

		if(mod > 0)
			pagesizec=pagesizec+1;
		countJson.put("recount",recount);
		countJson.put("pagesizec",pageSize);
		countJson.put("totalPages",pagesizec);
		if(pagesizec<=1)
			countJson.put("isHidePaging",new Boolean(true));
		else
			countJson.put("isHidePaging",new Boolean(false));

		String pageNoReqN = request.getParameter("pageNo");
		if(pageNoReqN==null || pageNoReqN.trim().length()==0 || pageNoReqN.equalsIgnoreCase("null"))
			pageNoReqN="1";
		//int pageStartIndex = 0;
		//int pageEndIndex = pageSize;
		 pageStartIndex = 0;
		 pageEndIndex = pageSize;
		int pageNum = 1;
		try
		{
			pageNum = Integer.parseInt(pageNoReqN.trim());
			pageNum = (pageNum == 0 )?1:pageNum;
			if(pageNum==1)
			{
				pageStartIndex=0;
				//pageEndIndex = pageStartIndex+(pageSize-1);//10+10-1
				pageEndIndex = pageSize+pageStartIndex;
			}
			else 
			{
				//pageStartIndex=((pageNum-1)*pageSize);//2-1*10
				//pageEndIndex = pageStartIndex+(pageSize-1);//10+10-1
				pageStartIndex = (pageNum*pageSize)-pageSize;
				pageEndIndex = pageSize+pageStartIndex;
			}
		}
		catch(Exception ee)
		{
			ee.printStackTrace();
			pageNum=1;
		}
	}
	//String inner_header="";
	//String header_display="";
	//String header_display_icon="";
	//String is_Header_DispName=ini.getValue("END_USER_DASHBOARD_SETTINGS","ShowUserCountInUI");
	if(isFromctx)
	{
		//String header_display ="User details for $comptpe : $compName";
		if(vdiType.indexOf(":") != -1)
		{
			String countHeader = "";
			String s_compTy=vdiType.substring(0,vdiType.indexOf(":"));
			host_comp_type = s_compTy;
			String compWithPort = vdiType.substring(vdiType.indexOf(":")+1);
			String s_compName=vdiType.substring(vdiType.indexOf(":")+1,vdiType.lastIndexOf(":"));
			String compTypeDisp = mappingInfo.getComponentTypeDescription(s_compTy);

			Hashtable titleHash=(Hashtable)titleFormation(userType);
			if(titleHash!=null)
			{
				header_display = (String)titleHash.get("header_display");
				header_display_icon= (String)titleHash.get("header_display_icon");
				countHeader = (String)titleHash.get("countHeader");
			}

			header_display=mappingInfo.getTextDescription("monitor.endUserDashboard."+header_display);
			if(userType.equals("ESX"))
				header_display += " "+compTypeDisp+" : "+s_compName;

			if(is_Header_DispName!=null && (is_Header_DispName.equalsIgnoreCase("true") || is_Header_DispName.equalsIgnoreCase("yes")))
			{
				if(userTotalCount>0)
				{
					header_display = header_display+" ("+countHeader+": "+userTotalCount+")";
				}
			}
			//jsonRoot.put("header_display",header_display);
			//jsonRoot.put("header_display_icon",header_display_icon);
			json.put("header_display",header_display);
			json.put("header_display_icon",header_display_icon);
			
			if(userType.equals("VDI"))
			{
				//inner_header = "Server Resource Consumption for "+compTypeDisp+" : "+s_compName;
				inner_header = mappingInfo.getTextDescription("monitor.endUserDashboard.COMPARISON OF RESOURCE CONSUMPTION BETWEEN")+" "+s_compName+" ("+compTypeDisp+") "+mappingInfo.getTextDescription("monitor.endUserDashboard.AND USERS/DESKTOPS");
			}
			else
			{
				//inner_header = "Server Resource Consumption for "+compTypeDisp+" : "+s_compName;
				inner_header = mappingInfo.getTextDescription("monitor.endUserDashboard.COMPARISON OF RESOURCE CONSUMPTION BETWEEN")+" "+s_compName+" ("+compTypeDisp+") "+mappingInfo.getTextDescription("monitor.endUserDashboard.AND USERS");
			}
			
			//if(userType.equals("ESX"))
			//	inner_header = "Resource Consumption on "+compTypeDisp+" : "+s_compName;
				//inner_header = "Resource Usage for VMs on "+compTypeDisp+" : "+s_compName;
			
			//jsonRoot.put("inner_header",inner_header);
			json.put("inner_header",inner_header);
			
			ArrayList temp_comp_list = new ArrayList();
			temp_comp_list.add(compWithPort);

			JSONArray desk_metrics = vmDashHelper.getDesktopMetricsPanelData(userType,s_compTy,temp_comp_list);

			//jsonRoot.put("isFromHost","true");
			//jsonRoot.put("HostMetrics",desk_metrics);
			
			json.put("isFromHost","true");
			json.put("HostMetrics",desk_metrics);
		}
	}
	else
	{
		if(is_Header_DispName!=null && (is_Header_DispName.equalsIgnoreCase("true") || is_Header_DispName.equalsIgnoreCase("yes")))
		{
			if(!isEndUserOverview && userTotalCount>0)
			{
				if(showKeyUser && isKeyUserUED)
				{
					String countHeader = (userType.equals("XenApp7") || userType.equals("XenApp"))?"Unique Users":"Unique Users/Desktops";
					String text_UserType=userType;
					header_display=mappingInfo.getTextDescription("monitor.endUserDashboard.User Experience Overview for High Profile "+text_UserType+" Users ("+countHeader+": "+userTotalCount+")");
				}
				else
				{
					if(userType!=null && userType.equals("CitrixXenVDI"))
						header_display=mappingInfo.getTextDescription("monitor.endUserDashboard.User Experience Overview (Unique Users : "+userTotalCount+")");
					else if(userType!=null && userType.equals("ESX"))
					{
						header_display=mappingInfo.getTextDescription("monitor.endUserDashboard.Performance Metrics for VMs (Total VMs : "+userTotalCount+")");
					}
					else
					{
						String countHeader = "";
						if(isFromGeo && (selectedMeasure!=null && selectedMeasure.trim().length()>0 && selectedMeasure.equalsIgnoreCase("UniqueSessionCount")))
							countHeader = (userType.equals("XenApp7") || userType.equals("XenApp"))?"Sessions":"Unique Users/Desktops";
						else
							countHeader = (userType.equals("XenApp7") || userType.equals("XenApp"))?"Unique Users":"Unique Users/Desktops";

						String text_UserType=userType;
						if(userType!=null && (userType.equals("AppXenApp7") || userType.equals("AppDDXenApp7") || userType.equals("AppLaunchDDXenApp7") || userType.equals("OverviewAppXenApp7")))
						{
							countHeader="Unique Applications";
							text_UserType = "XenApp7";

							if(userType.equals("OverviewAppXenApp7"))
							{
								header_display=mappingInfo.getTextDescription("monitor.endUserDashboard.Applications Statistics for "+text_UserType+" ("+countHeader+": "+userTotalCount+")");
							}
							else if(userType.equals("AppXenApp7") && overviewType!=null && overviewType.equals("OverviewAppXenApp7") && searchString!=null && searchString.trim().length()>0)
							{
								header_display=mappingInfo.getTextDescription("monitor.endUserDashboard.Users using '"+searchString.replace(".","&#46")+"' Application for "+text_UserType);
							}
							else
							{
								header_display=mappingInfo.getTextDescription("monitor.endUserDashboard.Applications Overview for "+text_UserType+" ("+countHeader+": "+userTotalCount+")");
							}
						}
						else if(userType!=null && userType.equalsIgnoreCase("VDIESX"))
						{
							countHeader = "Total Users/VMs";
							header_display=mappingInfo.getTextDescription("monitor.endUserDashboard.Users/Desktops Overview for Datastore")+" '"+showDSInfo+"' - ("+countHeader+": "+userTotalCount+")";
						}
						else if(userType!=null && userType.equalsIgnoreCase("VCDataStore"))
						{
							countHeader = "Total Datastores";
							header_display=mappingInfo.getTextDescription("monitor.endUserDashboard.VC - Datastores View")+" ("+countHeader+": "+userTotalCount+")";
						}
						else if(userType!=null && (userType.equals("AppVDI") || userType.equals("AppDDVDI") || userType.equals("OverviewAppVDI")))
						{
							countHeader="Unique Applications";
							text_UserType = "VDI";

							if(userType.equals("OverviewAppVDI"))
							{
								header_display=mappingInfo.getTextDescription("monitor.endUserDashboard.Applications Statistics for "+text_UserType+" ("+countHeader+": "+userTotalCount+")");
							}
							else if(userType.equals("AppVDI") && overviewType!=null && overviewType.equals("OverviewAppVDI") && searchString!=null && searchString.trim().length()>0)
							{
								header_display=mappingInfo.getTextDescription("monitor.endUserDashboard.Users using '"+searchString+"' Application for "+text_UserType);
							}
							else
							{
								header_display=mappingInfo.getTextDescription("monitor.endUserDashboard.Applications Overview for "+text_UserType+" ("+countHeader+": "+userTotalCount+")");
							}
						}
						else
						{
							header_display=mappingInfo.getTextDescription("monitor.endUserDashboard.User Experience Overview for "+text_UserType+" ("+countHeader+": "+userTotalCount+")");
						}
					}
				}

				//jsonRoot.put("header_display",header_display);
				//jsonRoot.put("isShowLocColumn",isShowUserLocation);
				json.put("header_display",header_display);
			}
			else if(isEndUserOverview)
			{
				header_display=mappingInfo.getTextDescription("monitor.endUserDashboard.Citrix User Experience By Location for")+" "+userType;
				//jsonRoot.put("header_display",header_display);
				json.put("header_display",header_display);
			}
			else
			{
				if(showKeyUser && isKeyUserUED)
				{
					header_display=mappingInfo.getTextDescription("monitor.endUserDashboard.User Experience Overview for High Profile "+userType+" Users");
				}
				else
				{
					if(userType!=null && userType.equals("CitrixXenVDI"))
						header_display=mappingInfo.getTextDescription("monitor.endUserDashboard.User Experience Overview");
					else if(userType!=null && userType.equals("ESX"))
						header_display=mappingInfo.getTextDescription("monitor.endUserDashboard.Performance Metrics for VMs");
					else if(userType!=null && userType.equalsIgnoreCase("VDIESX"))
						header_display=mappingInfo.getTextDescription("monitor.endUserDashboard.Users/Desktops Overview for Datastore")+" '"+showDSInfo+"'";
					else if(userType!=null && userType.equalsIgnoreCase("VCDataStore"))
						header_display=mappingInfo.getTextDescription("monitor.endUserDashboard.VC - Datastores View");
					else if(userType!=null && (userType.equals("AppXenApp7") || userType.equals("AppDDXenApp7") || userType.equals("AppLaunchDDXenApp7") || userType.equals("OverviewAppXenApp7")))
					{
						if(userType.equals("OverviewAppXenApp7"))
							header_display=mappingInfo.getTextDescription("monitor.endUserDashboard.Applications Statistics for XenApp7");
						else if(userType.equals("AppXenApp7") && overviewType!=null && overviewType.equals("OverviewAppXenApp7") && searchString!=null && searchString.trim().length()>0)
							header_display=mappingInfo.getTextDescription("monitor.endUserDashboard.Users using '"+searchString.replace(".","&#46")+"' Application for XenApp7");
						else
							header_display=mappingInfo.getTextDescription("monitor.endUserDashboard.Applications Overview for XenApp7");
					}
					else if(userType!=null && (userType.equals("AppVDI") || userType.equals("AppDDVDI") || userType.equals("OverviewAppVDI")))
					{
						if(userType.equals("OverviewAppVDI"))
							header_display=mappingInfo.getTextDescription("monitor.endUserDashboard.Applications Statistics for VDI");
						else if(userType.equals("AppVDI") && overviewType!=null && overviewType.equals("OverviewAppVDI") && searchString!=null && searchString.trim().length()>0)
							header_display=mappingInfo.getTextDescription("monitor.endUserDashboard.Users using '"+searchString+"' Application for VDI");
						else
							header_display=mappingInfo.getTextDescription("monitor.endUserDashboard.Applications Overview for VDI");
					}
					else
						header_display=mappingInfo.getTextDescription("monitor.endUserDashboard.User Experience Overview for "+userType);
				}
				//jsonRoot.put("header_display",header_display);
				json.put("header_display",header_display);
			}
		}
	}

	if(desktopUserName!=null && !desktopUserName.equalsIgnoreCase("") && desktopUserName.length()>0 && (vdiDesktopsList==null || vdiDesktopsList.size()==0 || vdiDesktopsList.size()>0))
	{
		String tempDesktopComponent = "";
		String tempDesktopState = "";
		if(vdiDesktopsList!=null && vdiDesktopsList.size()>0)
		{
			EgService tempServ = (EgService)vdiDesktopsList.get(0);
			tempDesktopComponent = tempServ.getName();
			tempDesktopState = tempServ.getState().getName();
		}

		String tempDesktopName = "";
		String tempComp = "";
		String tempCompValue = "";
		String tempCompName = "";
		String tempCompNameWithOutPort = "";

		if(tempDesktopComponent!=null && tempDesktopComponent.indexOf("^")>-1)
		{
			tempDesktopName = tempDesktopComponent.substring(0,tempDesktopComponent.indexOf("^"));
			tempComp = tempDesktopComponent.substring(tempDesktopComponent.indexOf("^")+1);
		}
		else
			tempDesktopName = desktopUserName;

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

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

		String tempMsmtHost = "";
		String ctype_layer="";
		if(tempCompValue!=null && tempCompValue.trim().length()>0)
			ctype_layer=ini.getValue("USER_DESKTOP_LAYERS",tempCompValue);

		ctype_layer=(ctype_layer==null || ctype_layer.trim().length()==0)?"VIRTUAL_DESKTOP":ctype_layer;
		//ArrayList arr = tablesInfo.getTestsForLayer(ctype_layer);
		tempMsmtHost =(String)getMsmtHost(tablesInfo,egExternalInfo,ctype_layer,tempCompValue,tempCompNameWithOutPort);
		tempMsmtHost=(tempMsmtHost==null || tempMsmtHost.trim().length()==0)?"":tempMsmtHost;

		String temp_url_desktopName=com.egurkha.util.StringUtils.replace(tempDesktopName, "\\", "\\");
		String searchString_EN=com.egurkha.util.StringUtils.encodeSecurityChar(searchString);

		String url = "/final/monitor/endUserDashboardDetailsData.jsp?comp="+EgURLEncoder.encode(tempCompName,"UTf-8")+"&comptype="+tempCompValue+"&info=*"+EgURLEncoder.encode(temp_url_desktopName,"UTf-8")+"&compName="+EgURLEncoder.encode(tempCompName,"UTf-8")+":"+tempCompValue+"&componentName="+EgURLEncoder.encode(tempCompNameWithOutPort,"UTf-8")+"&msmt_host="+EgURLEncoder.encode(tempMsmtHost,"UTf-8")+"&user="+EgURLEncoder.encode(userName,"UTf-8")+"&searchString="+EgURLEncoder.encode(searchString_EN,"UTF-8")+"&priority="+priority+"&vdiType="+vdiType+"&userType="+userType+"&enableBackButton="+enableBackButton+"&directEndDetail=true&desktopState="+tempDesktopState+"&detail="+detail+"&compCombo="+compCombo+"&showKeyUser="+showKeyUser;

		if(tempCompName==null || tempCompName.trim().length()==0)
			url = "/final/monitor/endUserDashboardDetailsData.jsp?comp=&comptype=&info=*"+EgURLEncoder.encode(temp_url_desktopName,"UTf-8")+"&compName=&componentName=&msmt_host=&user="+userName+"&searchString="+EgURLEncoder.encode(searchString_EN,"UTf-8")+"&priority="+priority+"&vdiType="+vdiType+"&userType="+userType+"&enableBackButton="+enableBackButton+"&directEndDetail=true";

		if(isAdtnlSearch)
			url = url+"&adtnlSearchStr="+EgURLEncoder.encode(adtnlSearchStr_EN,"UTf-8");

		url=url+"&fromf5="+isfromf5;

		String layer_for_url=egEx.getValue("VMSearch_InsideviewLayer",tempCompValue);
		layer_for_url=(layer_for_url==null)?"VIRTUAL_SERVERS":layer_for_url;

		if(userType!=null && userType.equalsIgnoreCase("ESX"))
		{
			url ="/final/monitor/egInsideviewDashboard.jsp?getFor=measure&comp="+EgURLEncoder.encode(tempCompName,"UTF-8")+"&comptype="+tempCompValue+"&Layer="+layer_for_url+"&info="+EgURLEncoder.encode(temp_url_desktopName,"UTF-8")+"&compName="+EgURLEncoder.encode(tempCompName+":"+tempCompValue,"UTF-8")+"&msmt_host="+tempMsmtHost+"&user="+userName+"&searchString="+EgURLEncoder.encode(searchString_EN,"UTF-8")+"&priority="+priority+"&vdiType="+vdiType+"&userType="+userType+"&enableBackButton="+enableBackButton+"&directEndDetail=true&desktopState="+tempDesktopState+"&source=true&detail="+detail+"&compCombo="+compCombo+"&filterFlag="+filterFlag+"&showKeyUser="+showKeyUser;
			if(isAdtnlSearch)
				url = url+"&adtnlSearchStr="+EgURLEncoder.encode(adtnlSearchStr_EN,"UTf-8");
		}

		if(fromMenuStr!=null && fromMenuStr.trim().length()>0)
		{
			url=url+"&fromMenu="+fromMenuStr;
		}
		if(fromGeoStr!=null && fromGeoStr.trim().length()>0)
		{
			url=url+"&fromGeo="+fromGeoStr+"&iniName="+iniName+"&user_name="+user_name+"&isUserBased="+isUserBased+"&dashboard_name="+dashboard_name+"&view_name="+view_name+"&dashboard_mapping="+EgURLEncoder.encode(dashboard_mapping,"UTf-8")+"&time_line="+EgURLEncoder.encode(time_line,"UTf-8")+"&ginfo="+EgURLEncoder.encode(geoInfo,"UTf-8")+"&usercountval="+usercountval+"&fromServiceHomePage="+fromServiceHomePage+"&fromZonePage="+fromZonePage+"&selectedTest="+selectedTest+"&selectedMeasure="+EgURLEncoder.encode(selectedMeasure,"UTf-8");
		}
		if(filterBy!=null && filterBy.trim().length()>0)
		{
			url=url+"&filterBy="+filterBy;
		}
		if(priorityFilter!=null && priorityFilter.trim().length()>0 && !priorityFilter.equalsIgnoreCase("NULL"))
		{
			url=url+"&priorityFilter="+priorityFilter;
		}
		if(gatewayFilter!=null && gatewayFilter.trim().length()>0 && !gatewayFilter.equalsIgnoreCase("NULL"))
		{
			url=url+"&gatewayFilter="+gatewayFilter;
		}
		
		url=url+"&fromf5="+isfromf5;
		//jsonRoot.put("REDIRECT",true);
		//jsonRoot.put("REDIRECT_URL",url);
		
		json.put("REDIRECT",true);
		json.put("REDIRECT_URL",url);
	}
	else if(TotalMeasureInfo!=null && TotalMeasureInfo.size()>0)
	{
		String searchString_EN=com.egurkha.util.StringUtils.encodeSecurityChar(searchString);

		JSONObject columnObj  = new JSONObject();
		StringBuffer addSearchEmptyText = new StringBuffer();
		/*if(!orderByCol_flag)
		{
			if(userType!=null && (userType.equalsIgnoreCase("VDI") || userType.equalsIgnoreCase("VDIESX")))
				columnObj.put("text",mappingInfo.getTextDescription("monitor.VirtualDashboard.Users/Desktops"));
			else if(userType!=null && userType.equalsIgnoreCase("VCDataStore"))
				columnObj.put("text",mappingInfo.getTextDescription("monitor.VirtualDashboard.Datastores"));
			else if(userType!=null && userType.equalsIgnoreCase("ESX"))
				columnObj.put("text",mappingInfo.getTextDescription("monitor.VirtualDashboard.VMs"));
			else if(userType!=null && (userType.equalsIgnoreCase("AppXenApp7") || userType.equalsIgnoreCase("AppDDXenApp7") || userType.equals("AppLaunchDDXenApp7") || userType.equalsIgnoreCase("AppVDI") || userType.equalsIgnoreCase("AppDDVDI") || userType.equals("OverviewAppXenApp7") || userType.equals("OverviewAppVDI")))
				columnObj.put("text",mappingInfo.getTextDescription("monitor.VirtualDashboard.Applications"));
			else
				columnObj.put("text",mappingInfo.getTextDescription("monitor.VirtualDashboard.Users"));
		}
		else
		{*/
			if(userType!=null && (userType.equalsIgnoreCase("VDI") || userType.equalsIgnoreCase("VDIESX")))
				columnObj.put("text",mappingInfo.getTextDescription("monitor.VirtualDashboard.Users/Desktops"));
			else if(userType!=null && userType.equalsIgnoreCase("VCDataStore"))
				columnObj.put("text",mappingInfo.getTextDescription("monitor.VirtualDashboard.Datastores"));
			else if(userType!=null && userType.equalsIgnoreCase("ESX"))
				columnObj.put("text",mappingInfo.getTextDescription("monitor.VirtualDashboard.VMs"));
			else if(userType!=null && (userType.equalsIgnoreCase("AppXenApp7") || userType.equalsIgnoreCase("AppDDXenApp7") || userType.equals("AppLaunchDDXenApp7") || userType.equalsIgnoreCase("AppVDI") || userType.equalsIgnoreCase("AppDDVDI") || userType.equals("OverviewAppXenApp7") || userType.equals("OverviewAppVDI")))
				columnObj.put("text",mappingInfo.getTextDescription("monitor.VirtualDashboard.Applications"));
			else
				columnObj.put("text",mappingInfo.getTextDescription("monitor.VirtualDashboard.Users"));
		//}
		
		String SortTypeForCompName="asc";
		if(orderBy!=null && orderBy.equalsIgnoreCase("desc"))
			SortTypeForCompName="asc";
		else if(orderBy!=null && orderBy.equalsIgnoreCase("asc"))
			SortTypeForCompName="desc";
		columnObj.put("SortTypeForCompName",SortTypeForCompName);
		if(!isEndUserOverview)
		{
			columns.add(columnObj);
			columnObj  = new JSONObject();
		}
		//String widthOfTheHead="";
		//String strVdiHostCombo="";
		//boolean showVdiHostCombo =false;
		//boolean isSkipVal = false;
		//ArrayList skippedColumns = new ArrayList();
		String measures=null;
		String measuresD=null;
		String measuresT=null;
		String measuresToSkip=null;
		String extra_measures="";
		String extra_filter=null;
		String measures_with_extra="";
		if((!isEndUserOverview) && ((adFilter != null && aduserFilter != null) || ((!isEndUserOverview) && (!isFromUEDSort))))
		{
			if(!isFromctx && !isOnlyVMAssigned && !userType.equals("OverviewAppXenApp7") && !userType.equals("OverviewAppVDI"))
			{
				if(orderByColumnName!=null && orderByColumnName.equalsIgnoreCase("Host"))
				{
					String nextOrderBy="desc";
					
					if(orderBy!=null && orderBy.equals("desc"))
						nextOrderBy="asc";
					else if(orderBy!=null && orderBy.equals("asc"))
						nextOrderBy="desc";
					
					columnObj.put("text",mappingInfo.getTextDescription("monitor.VirtualDashboard.Host"));
				}
				else
					columnObj.put("text",mappingInfo.getTextDescription("monitor.VirtualDashboard.Host"));

				String SortTypeForHostName="asc";
				if(orderBy!=null && orderBy.equalsIgnoreCase("desc"))
					SortTypeForHostName="asc";
				else if(orderBy!=null && orderBy.equalsIgnoreCase("asc"))
					SortTypeForHostName="desc";
				columnObj.put("SortTypeForCompName",SortTypeForHostName);
				columns.add(columnObj);
			}
			
			//strVdiHostCombo=ini.getValue("END_USER_DASHBOARD_SETTINGS","showVdiHostCombo");
			//strVdiHostCombo=(strVdiHostCombo==null || strVdiHostCombo.trim().length()==0)?"false":strVdiHostCombo;

			//showVdiHostCombo = "true".equalsIgnoreCase(strVdiHostCombo)?true:false;
			
			if(userName!=null && userName.trim().length()>0)
				measures = ini.getValue("USER_DESKTOP_METRICS",userName+":"+userType);
		
			if(measures==null || measures.trim().length()==0)
			{
				measuresD = ini.getValue("USER_DESKTOP_METRICS","DEFAULT_"+userType);
				measuresT = ini.getValue("USER_DESKTOP_METRICS",userType);
				if(measuresD != null && measuresD.trim().length() > 0)
				{
					//measures = measuresD;
					measures = (String)getMeasureForUI(measuresD,measuresT);
				}
				else
					measures = measuresT;
			}

			if(detail!=null && filterBy!=null && (detail.equalsIgnoreCase("componentType") || detail.equalsIgnoreCase("Component")) && (!filterBy.equalsIgnoreCase("All")))
			{
				measuresToSkip = ini.getValue("USER_DESKTOP_METRICS","SKIP_METRICS:"+userType+":"+filterBy);
				if(measuresToSkip!=null && measuresToSkip.trim().length()>0)
					measures =  (String)removeSkipMetrics(measures,measuresToSkip);
			}
			else if(resTypeList!=null && resTypeList.size()==1)
			{
				measuresToSkip = ini.getValue("USER_DESKTOP_METRICS","SKIP_METRICS:"+userType+":"+(String)resTypeList.get(0));
				if(measuresToSkip!=null && measuresToSkip.trim().length()>0)
					measures =  (String)removeSkipMetrics(measures,measuresToSkip);
			}

			if(isFromctx)
				measures = ini.getValue("USER_DESKTOP_METRICS_VIEW",userType+":"+host_comp_type);
			else if(isFromGeo)
				extra_measures = ini.getValue("EXTERNAL_USER_DESKTOP_METRICS",userType+"_Extra");

			
			if(measures!=null && measures.trim().length()>0 && measures.endsWith(",") && extra_measures!=null && extra_measures.trim().length()>0)
				measures_with_extra = measures+extra_measures;
			else if(measures!=null && measures.trim().length()>0 && (!measures.endsWith(",")) && extra_measures!=null && extra_measures.trim().length()>0)
				measures_with_extra = measures+","+extra_measures;
		}
		
		// hide Measures in UI whose Component Type is Disabled
		measures = (String) HideDisabledTest(measures, userType, user, specsInfo,ini,isDetailsFromADOnly,isShowUserLocation);

		if((!isEndUserOverview) && adFilter != null && aduserFilter != null)
		{
			String secondPosMeaVal=null;
			/*if(measures_with_extra!=null && measures_with_extra.trim().length()>0 && extra_measures!=null && extra_measures.trim().length()>0)
			{
				StringBuffer iniValue=new StringBuffer(128);
				ArrayList tmpTestMeasureList = StringUtils.egTokenizer(measures_with_extra,",",true,false,true);//param 3-->includeEmpty,4-->unique,5-->trim
				//ArrayList tmpTestMeasureListExt = StringUtils.egTokenizer(extra_measures,",",true,false,true);//param 3-->includeEmpty,4-->unique,5-->trim
				if(tmpTestMeasureList!=null && tmpTestMeasureList.size()>0 && selectedTestMea!=null && selectedTestMea.trim().length()>0)
				{
					String swapTestMea = ini.getValue("SWAP_USER_DESKTOP_METRICS",selectedTestMea);
					swapTestMea = (swapTestMea==null || swapTestMea.trim().length()==0)?"":swapTestMea;
					for(int v=0;v<tmpTestMeasureList.size();v++)
					{
						String test_with_measure = (String)tmpTestMeasureList.get(v);
						StringTokenizer testTok=new StringTokenizer(test_with_measure.trim(),":");
						int tokenCount=testTok.countTokens();
						if(tokenCount>=3)
						{
							String tmpTest=testTok.nextToken();
							String tmpMea=testTok.nextToken();
							String tmpColumn=null;
							if(tokenCount>=3)
								tmpColumn=testTok.nextToken();

							String tmpTestMea=tmpTest+":"+tmpMea;
							String tmpTestMea2=tmpTestMea;
							if(tmpColumn!=null && tmpColumn.trim().length()>0)
								tmpTestMea2=tmpTest+":"+tmpColumn;

							if(selectedTestMea!=null && selectedTestMea.trim().length()>0 && (selectedTestMea.equals(tmpTestMea) || selectedTestMea.equals(tmpTestMea2)))
							{
								secondPosMeaVal = test_with_measure;//Desktop_sessions
								if(selectedMeasure!=null && selectedMeasure.trim().length()>0 && (selectedMeasure.equalsIgnoreCase("UniqueSessionDesktopCount") || selectedMeasure.equalsIgnoreCase("Desktop_sessions")))
									extra_filter="Desktop";
								else if(selectedMeasure!=null && selectedMeasure.trim().length()>0 && (selectedMeasure.equalsIgnoreCase("UniqueSessionMobileCount") || selectedMeasure.equalsIgnoreCase("Mobile_sessions")))
									extra_filter="Mobile";
								else if(selectedMeasure!=null && selectedMeasure.trim().length()>0 && (selectedMeasure.equalsIgnoreCase("UniqueSessionTabletCount") || selectedMeasure.equalsIgnoreCase("Tablet_sessions")))
									extra_filter="Tablet";

								break;
							}
							else if(swapTestMea!=null && swapTestMea.trim().length()>0 && (swapTestMea.equals(tmpTestMea) || swapTestMea.equals(tmpTestMea2)))
							{
								secondPosMeaVal = test_with_measure;
								if(selectedMeasure!=null && selectedMeasure.trim().length()>0 && (selectedMeasure.equalsIgnoreCase("UniqueSessionDesktopCount") || selectedMeasure.equalsIgnoreCase("Desktop_sessions")))
									extra_filter="Desktop";
								else if(selectedMeasure!=null && selectedMeasure.trim().length()>0 && (selectedMeasure.equalsIgnoreCase("UniqueSessionMobileCount") || selectedMeasure.equalsIgnoreCase("Mobile_sessions")))
									extra_filter="Mobile";
								else if(selectedMeasure!=null && selectedMeasure.trim().length()>0 && (selectedMeasure.equalsIgnoreCase("UniqueSessionTabletCount") || selectedMeasure.equalsIgnoreCase("Tablet_sessions")))
									extra_filter="Tablet";
								break;
							}
						}
					}

					if(secondPosMeaVal!=null && secondPosMeaVal.trim().length()>0)
					{
						ArrayList tmpTestMeasureListOrg = StringUtils.egTokenizer(measures,",",true,false,true);//param 3-->includeEmpty,4-->unique,5-->trim

						try
						{
							tmpTestMeasureListOrg.remove(secondPosMeaVal);
							for(int v=0;v<tmpTestMeasureListOrg.size();v++)
							{
								String test_with_measure = (String)tmpTestMeasureListOrg.get(v);
								if(v==1)
								{
									iniValue.append(","+secondPosMeaVal);
									iniValue.append(","+test_with_measure);
								}
								else
								{
									if(test_with_measure!=null && test_with_measure.trim().length()>0)
										iniValue.append(","+test_with_measure);
								}
							}
						}
						catch (Exception ee)
						{
							ee.printStackTrace();
						}
					}

					String iniValueStr=iniValue.toString();

					if(iniValueStr!=null && iniValueStr.trim().length()>0)
					{
						if(iniValueStr.startsWith(","))
							iniValueStr=iniValueStr.substring(1);

						measures = iniValueStr;
					}
				}
			}*/

			String[] measureArray = measures.split(",");
			ArrayList displayColsList = new ArrayList();
			ArrayList validColsList = new ArrayList();
			Hashtable sameLabelHash = new Hashtable();
			measuresCount = measureArray.length;
			int colCount=measuresCount+2;
			ArrayList addString=new ArrayList();
			for(int x=0;x<measureArray.length;x++)
			{
				String tempValue = measureArray[x];
				String tempTest = "";
				String tempMeasure = "";
				String tempDispName = "";
				String tempLocColName = "";
				//String locKeyName = "";
				String colName = "";
				ArrayList locColumnsList = null;
				if (addSearchColList!=null && tempValue!=null &&  addSearchColList.contains(tempValue))
				{
					addtionalSearchFlag = true;
					if(tempValue!=null && tempValue.indexOf(":")!=-1)
					{
						String new_addString=tempValue.substring(tempValue.lastIndexOf(":")+1);
						if(new_addString!=null && !addString.contains(new_addString))
						{
							addSearchEmptyText.append(new_addString + ",");
							addString.add(new_addString);
						}
					}
				}
				StringTokenizer valTokens = new StringTokenizer(tempValue,":");
				int count = valTokens.countTokens();
				boolean isDDDColumn = false;
				boolean isLocColumn = false;
				boolean isTestColumn = false;
				String meas ="";
				if (valTokens.hasMoreTokens())
				{
					if(count==3)
					{
						tempTest = valTokens.nextToken();
						tempMeasure = valTokens.nextToken();
						tempDispName = valTokens.nextToken();
						isTestColumn=true;
					}
					else if(count==2)
					{
						if(isShowUserLocation)
						{
							tempTest = valTokens.nextToken();
							tempMeasure = valTokens.nextToken();
							//tempDispName = mappingInfo.getMeasureDescription(tempTest,tempMeasure);
							isLocColumn = true;
							meas = "NONE";

							ArrayList tmpMeasureList = new ArrayList(); 
							tmpMeasureList = StringUtils.egTokenizer(tempMeasure,"~$~",true,false,true);//param 3-->includeEmpty,4-->unique,5-->trim
							if(tmpMeasureList!=null && tmpMeasureList.size()>0)
							{
								int meaListSize=tmpMeasureList.size();
								if(meaListSize==1)
								{
									tempDispName = tempMeasure;
									tempLocColName = tempMeasure;
								}
								else if(meaListSize>1)
								{
									tempLocColName = (String)tmpMeasureList.get(0);
									tempDispName = (String)tmpMeasureList.get(1);

									//if(x == 0 && searchFilter != null && searchFilter.trim().length() > 0 && !searchFilter.equalsIgnoreCase("All") && !searchFilter.equalsIgnoreCase("null")){
									if(searchFilter != null && searchFilter.trim().length() > 0 && !searchFilter.equalsIgnoreCase("All") && !searchFilter.equalsIgnoreCase("null")){
										continue;
									}
									//else if(x == 1 && nextSearch != null && nextSearch.trim().length() > 0 && !nextSearch.equalsIgnoreCase("All") && !nextSearch.equalsIgnoreCase("null")){
									else if(nextSearch != null && nextSearch.trim().length() > 0 && !nextSearch.equalsIgnoreCase("All") && !nextSearch.equalsIgnoreCase("null")){
										continue;
									}
									//else if(x == 2 && nextSubSearch != null && nextSubSearch.trim().length() > 0 && !nextSubSearch.equalsIgnoreCase("All") && !nextSubSearch.equalsIgnoreCase("null")){
									else if(nextSubSearch != null && nextSubSearch.trim().length() > 0 && !nextSubSearch.equalsIgnoreCase("All") && !nextSubSearch.equalsIgnoreCase("null")){
										continue;
									}
								}
							}
						}
					}
					else if(count==5)
					{
						tempTest = valTokens.nextToken();
						tempMeasure = valTokens.nextToken();
						colName = valTokens.nextToken();
						meas = valTokens.nextToken();
						tempDispName = valTokens.nextToken();
						isDDDColumn = true;
					}
				}

				if(isTestColumn || isDDDColumn || isLocColumn)
				{
					if(displayColsList!=null && displayColsList.contains(tempDispName))
					{
						if(sameLabelHash!=null && sameLabelHash.containsKey(tempDispName))
						{
							ArrayList tmp_list=(ArrayList)sameLabelHash.get(tempDispName);
							tmp_list.add(tempValue);
							sameLabelHash.put(tempDispName,(ArrayList)tmp_list);
						}
						else
						{
							ArrayList tmp_list=new ArrayList();
							tmp_list.add(tempValue);
							sameLabelHash.put(tempDispName,(ArrayList)tmp_list);
						}

						continue;
					}

					String unitForMeasure="";
					String meaUnit="";
					if(isDDDColumn && meas!=null && meas.trim().length()>0 && (!meas.equalsIgnoreCase("NONE")&&!meas.equalsIgnoreCase("DATE")))
					{
						unitForMeasure = "("+meas+")";
					}
					else if(!isDDDColumn && !isLocColumn)
					{
						String unitVal=tablesInfo.getUnitForMeasure(tempTest,tempMeasure.trim());

						if(unitVal!=null && unitVal.trim().length()>0)
						{
							unitForMeasure="("+unitVal+")";

							meaUnit=unitVal;
						}
					}

					if(unitForMeasure!=null && unitForMeasure.indexOf("MB")>-1)
						unitForMeasure ="(GB)";

					if(tempDispName!=null && tempDispName.equalsIgnoreCase("Status"))
					{
						unitForMeasure="";
					}
					else if(tempDispName!=null && (tempDispName.equalsIgnoreCase("Disk Used") || tempDispName.equalsIgnoreCase("Used Space")))
					{
						unitForMeasure="("+mappingInfo.getTextDescription("monitor.VirtualDashboard.GB")+")";
					}

					String orderByColumn = "";
					if(isLocColumn)
					{
						//orderByColumn = tempDispName;
						orderByColumn = tempLocColName;
						//orderByColumnName = tempDispName;
					}
					else if (isDDDColumn)
					{
						orderByColumn = Dbdata.getColumnForMeasure(tempTest+"_DDD",colName);
					}
					else
					{
						orderByColumn = Dbdata.getColumnForMeasure(tempTest,tempMeasure); 
					}

					if((convertToDaysTestMeasureList!=null && convertToDaysTestMeasureList.size()>0 && convertToDaysTestMeasureList.contains(tempTest+":"+tempMeasure)) || (udm_hide_unit_list!=null && udm_hide_unit_list.size()>0 && udm_hide_unit_list.contains(tempTest+":"+tempMeasure)))
					{
						unitForMeasure="";
					}

					columnObj  = new JSONObject();
					columnObj.put("text",mappingInfo.getTextDescription("monitor.VirtualDashboard."+tempDispName));
					columnObj.put("unit",unitForMeasure);
					
					String sortType="asc";
					if(orderBy!=null && orderBy.equalsIgnoreCase("desc"))
					{
						sortType="asc";
					}
					else if(orderBy!=null && orderBy.equalsIgnoreCase("asc"))
					{
						sortType="desc";
					}
					columnObj.put("sortType",sortType);

					if(orderByColumn!=null && orderByColumn.trim().length()>0 && orderByColumnName!=null && orderByColumnName.trim().length()>0 && orderByColumnName.equalsIgnoreCase(orderByColumn))
					{
						String nextOrderBy="desc";
						
						if(orderBy!=null && orderBy.equals("desc"))
							nextOrderBy="asc";
						else if(orderBy!=null && orderBy.equals("asc"))
							nextOrderBy="desc";

						if(isDDDColumn || isLocColumn)
						{
							if(isLocColumn)
							{
								columnObj.put("tempLocColName",tempLocColName);
								columnObj.put("tempDispName",tempDispName);
								if((unitForMeasure==null || unitForMeasure.equals(""))&& (meas!=null && !meas.equalsIgnoreCase("DATE")))
								{
									columnObj.put("tempDate","NONE");
								}
								else
								{
									columnObj.put("tempDate",meas);
								}
							}
							else
							{
								columnObj.put("tempLocColName",orderByColumn);
								columnObj.put("tempDispName",tempDispName);
								if((unitForMeasure==null || unitForMeasure.equals(""))&& (meas!=null && !meas.equalsIgnoreCase("DATE")))
								{
									columnObj.put("tempDate","NONE");
								}
								else
								{
									
									columnObj.put("tempDate",meas);
								}
							}
						}
						else
						{
							columnObj.put("tempLocColName",orderByColumn);
							columnObj.put("tempDispName",tempDispName);
						}
					}
					else
					{
						if(isDDDColumn || isLocColumn)
						{
							if(isLocColumn)
							{
								columnObj.put("tempLocColName",tempLocColName);
								columnObj.put("tempDispName",tempDispName);
								if((unitForMeasure==null || unitForMeasure.equals("")) && (meas!=null && !meas.equalsIgnoreCase("DATE")))
								{
									columnObj.put("tempDate","NONE");
								}
								else
								{
									columnObj.put("tempDate",meas);
								}
							}
							else
							{
								columnObj.put("tempLocColName",orderByColumn);
								columnObj.put("tempDispName",tempDispName);
								if((unitForMeasure==null || unitForMeasure.equals("")) && (meas!=null && !meas.equalsIgnoreCase("DATE")))
								{
									columnObj.put("tempDate","NONE");
								}
								else
								{
									columnObj.put("tempDate",meas);
								}
							}
						}
						else
						{
							columnObj.put("tempLocColName",orderByColumn);
							columnObj.put("tempDispName",tempDispName);
						}
					}
					columns.add(columnObj);
					if(displayColsList!=null && tempDispName!=null && !displayColsList.contains(tempDispName))
					{
						displayColsList.add(tempDispName);
						if(sameLabelHash!=null && sameLabelHash.containsKey(tempDispName))
						{
							ArrayList tmp_list=(ArrayList)sameLabelHash.get(tempDispName);
							tmp_list.add(tempValue);
							sameLabelHash.put(tempDispName,(ArrayList)tmp_list);
						}
						else
						{
							ArrayList tmp_list=new ArrayList();
							tmp_list.add(tempValue);
							sameLabelHash.put(tempDispName,(ArrayList)tmp_list);
						}
					}
					if(validColsList!=null && tempValue!=null && !validColsList.contains(tempValue)) 
						validColsList.add(tempValue);
				}
			}

			if(validColsList!=null && validColsList.size()>0)
			{
				measureArray = new String[validColsList.size()];
				int yy=0;
				for(int y=0;y<validColsList.size();y++)
				{
					String tempValue1 = (String)validColsList.get(y);
					if(tempValue1!=null && tempValue1.trim().length()>0)
						measureArray[yy++]=tempValue1;
				}
			}
			EgService serv = null;
			int desktopsSize = (vdiDesktopsList!=null && vdiDesktopsList.size()>0)?vdiDesktopsList.size():0;
			Hashtable desktopHtml = new Hashtable();
			ArrayList deskTopList = new ArrayList();
			
			int componentList_count=0;
			if(desktopsSize>=pageEndIndex)
			{
				componentList_count=pageEndIndex;
			}
			else if(desktopsSize<pageEndIndex)
			{
				//componentList_count=componentList.size();
				componentList_count=desktopsSize;
			}

			for(int i=0;i<componentList_count;i++)
			{
				JSONObject measure  = new JSONObject();

				StringBuffer bufRow = new StringBuffer();
				serv = (EgService)vdiDesktopsList.get(i);

				String desktopComponent = serv.getName();
				String desktopState = serv.getState().getName();
				String desktopName = "";
				String comp = "";
				String compValue = "";
				String compName = "";
				String compNameWithOutPort = "";
				String port="NULL";

				if(desktopComponent!=null && desktopComponent.indexOf("^")>-1)
				{
					desktopName = desktopComponent.substring(0,desktopComponent.indexOf("^"));
					comp = desktopComponent.substring(desktopComponent.indexOf("^")+1);
				}
				deskTopList.add(desktopName);

				Hashtable formation = new Hashtable();
				ArrayList defaultList = new ArrayList();
				if(userRelatedAd != null && userRelatedAd.containsKey("+"+desktopName)  ){
					ArrayList adList = (ArrayList)userRelatedAd.get("+"+desktopName);
					for(int m=0;m<adList.size();m++){
						String adName = (String)adList.get(m);

						if(formation.containsKey(adName)){
							ArrayList userList = (ArrayList)formation.get(adName);
							userList.add(desktopName);
							formation.put(adName,userList);
						}else{
							ArrayList userL = new ArrayList();
							userL.add(desktopName);
							formation.put(adName,userL);
						}
					}
				}
				else if(userRelatedAd != null && userRelatedAd.containsKey(desktopName)){
					ArrayList adList = (ArrayList)userRelatedAd.get(desktopName);
					for(int m=0;m<adList.size();m++){
						String adName = (String)adList.get(m);

						if(formation.containsKey(adName)){
							ArrayList userList = (ArrayList)formation.get(adName);
							userList.add(desktopName);
							formation.put(adName,userList);
						}else{
							ArrayList userL = new ArrayList();
							userL.add(desktopName);
							formation.put(adName,userL);
						}
					}
				}
				else
				{
					defaultList.add(desktopName);
					if(!aduserFilter.equalsIgnoreCase("All"))
						continue;
				}

				if(comp!=null && comp.indexOf(":")>-1)
				{
					compValue = comp.substring(0,comp.indexOf(":"));
					compName = comp.substring(comp.indexOf(":")+1);
				}
				if(compName!=null && compName.indexOf(":")>-1)
				{
					compNameWithOutPort = compName.substring(0,compName.indexOf(":"));
					port = compName.substring(compName.indexOf(":")+1);
				}
				measureValues = (Hashtable)TotalMeasureInfo.get(comp);
				String msmtHost = "";
				String ctype_layer=ini.getValue("USER_DESKTOP_LAYERS",compValue);
				ctype_layer=(ctype_layer==null || ctype_layer.trim().length()==0)?"VIRTUAL_DESKTOP":ctype_layer;
				String ctype_test=ini.getValue("USER_DESKTOP_TESTS",compValue);
				ctype_test=(ctype_test==null || ctype_test.trim().length()==0)?"null":ctype_test;
				msmtHost =(String)getMsmtHost(tablesInfo,egExternalInfo,ctype_layer,compValue,compNameWithOutPort);

				Hashtable testDetails = new Hashtable();
				if(compValue!=null && compValue.trim().length()>0 && compName!=null && compName.length()>0)
					testDetails =(Hashtable) metaTest.get(compValue+":"+compName);
				
				if(testDetails == null)
					testDetails = new Hashtable();

				String tempHostType = compValue;
				String url_desktopName=com.egurkha.util.StringUtils.replace(desktopName, "\\", "\\");

				String userTypeTmp=userType;
				/*if(userType!=null && userType.equalsIgnoreCase("CitrixXenVDI") && vdi_list!=null && vdi_list.contains(compValue))
					userTypeTmp="VDI";
				else if(userType!=null && userType.equalsIgnoreCase("CitrixXenVDI") && vdi_list!=null && !vdi_list.contains(compValue))
					userTypeTmp="XenApp7";*/

				String url = "/final/monitor/endUserDashboardDetailsData.jsp?comp="+EgURLEncoder.encode(compName,"UTF-8")+"&comptype="+compValue+"&info=*"+EgURLEncoder.encode(url_desktopName,"UTF-8")+"&compName="+EgURLEncoder.encode(compName+":"+compValue,"UTF-8")+"&componentName="+EgURLEncoder.encode(compNameWithOutPort,"UTF-8")+"&msmt_host="+EgURLEncoder.encode(msmtHost,"UTF-8")+"&user="+EgURLEncoder.encode(userName,"UTF-8")+"&searchString="+EgURLEncoder.encode(searchString,"UTF-8")+"&priority="+priority+"&vdiType="+vdiType+"&userType="+userTypeTmp+"&desktopState="+desktopState+"&detail="+detail+"&compCombo="+compCombo+"&showKeyUser="+showKeyUser+"&orgUserType="+userType;

				url=url+"&fromf5="+isfromf5;

				if(isAdtnlSearch)
					url = url+"&adtnlSearchStr="+EgURLEncoder.encode(adtnlSearchStr,"UTF-8");
				String layer_for_url=egEx.getValue("VMSearch_InsideviewLayer",compValue);
				layer_for_url=(layer_for_url==null)?"VIRTUAL_SERVERS":layer_for_url;

				if(userType!=null && userType.equalsIgnoreCase("ESX"))
				{
					url ="/final/monitor/egInsideviewDashboard.jsp?getFor=measure&comp="+EgURLEncoder.encode(compName,"UTF-8")+"&comptype="+compValue+"&Layer="+layer_for_url+"&info="+EgURLEncoder.encode(url_desktopName,"UTF-8")+"&compName="+EgURLEncoder.encode(compName+":"+compValue,"UTF-8")+"&msmt_host="+EgURLEncoder.encode(msmtHost,"UTF-8")+"&user="+EgURLEncoder.encode(userName,"UTF-8")+"&searchString="+EgURLEncoder.encode(searchString_EN,"UTF-8")+"&priority="+priority+"&vdiType="+vdiType+"&userType="+userType+"&desktopState="+desktopState+"&source=UEDVMs&detail="+detail+"&compCombo="+compCombo+"&filterFlag="+filterFlag+"&showKeyUser="+showKeyUser;
					if(isAdtnlSearch)
						url = url+"&adtnlSearchStr="+EgURLEncoder.encode(adtnlSearchStr_EN,"UTF-8");
				}

				if(fromMenuStr!=null && fromMenuStr.trim().length()>0)
				{
					url=url+"&fromMenu="+fromMenuStr;
				}
				if(fromGeoStr!=null && fromGeoStr.trim().length()>0)
				{
					url=url+"&fromGeo="+fromGeoStr+"&iniName="+iniName+"&user_name="+user_name+"&isUserBased="+isUserBased+"&dashboard_name="+dashboard_name+"&view_name="+view_name+"&dashboard_mapping="+EgURLEncoder.encode(dashboard_mapping,"UTf-8")+"&time_line="+EgURLEncoder.encode(time_line,"UTf-8")+"&ginfo="+EgURLEncoder.encode(geoInfo,"UTf-8")+"&usercountval="+usercountval+"&fromServiceHomePage="+fromServiceHomePage+"&fromZonePage="+fromZonePage+"&selectedTest="+selectedTest+"&selectedMeasure="+EgURLEncoder.encode(selectedMeasure,"UTf-8");
				}

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

				if(searchFilter!=null && searchFilter.trim().length()>0)
				{
					url=url+"&searchFilter="+EgURLEncoder.encode(searchFilter,"UTF-8");
				}
				if(nextSearch!=null && nextSearch.trim().length()>0)
				{
					url=url+"&nextSearch="+EgURLEncoder.encode(nextSearch,"UTF-8");
				}
				if(nextSubSearch!=null && nextSubSearch.trim().length()>0)
				{
					url=url+"&nextSubSearch="+EgURLEncoder.encode(nextSubSearch,"UTF-8");
				}
				if(priorityFilter!=null && priorityFilter.trim().length()>0 && !priorityFilter.equalsIgnoreCase("NULL"))
				{
					url=url+"&priorityFilter="+priorityFilter;
				}
				
				if(gatewayFilter!=null && gatewayFilter.trim().length()>0 && !gatewayFilter.equalsIgnoreCase("NULL"))
				{
					url=url+"&gatewayFilter="+gatewayFilter;
				}

				String link ="";
				if((fromMenuStr!=null && !fromMenuStr.equalsIgnoreCase("null") && fromMenuStr.trim().length()>0) || (fromGeoStr!=null && !fromGeoStr.equalsIgnoreCase("null") && fromGeoStr.trim().length()>0))
				{
					//link = "/final/servlet/com.eg.EgDashboardController?site=NULL"+"&from=list&comptype="+EgURLEncoder.encode(compValue,"UTF-8")+"&host="+EgURLEncoder.encode(compName,"UTF-8")+"&tab=LayerModel";

					String info_to_lower=desktopName;
					String infoKey = compValue+":"+compName+":"+ctype_test+":"+info_to_lower;
					HashSet infosSet = null;
					if(fullInfoHash!=null && fullInfoHash.size()>0)
						infosSet = (HashSet)fullInfoHash.get(infoKey);
					ArrayList infosList = null;
					if(infosSet!=null && infosSet.size()>0)
						infosList = new ArrayList(infosSet);
					String info_name = "";
					if(infosList!=null && infosList.size()>1)
					{
						for(int is=0;is<infosList.size();is++)
						{
							String tmpInfo = (String)infosList.get(is);
							if(tmpInfo!=null && (tmpInfo.endsWith(":Summary") || tmpInfo.endsWith(":Total")))
							{
								info_name = tmpInfo;
								break;
							}
						}
						if(info_name==null || info_name.equalsIgnoreCase("null") || info_name.trim().length()==0)
						{
							info_name = (String)infosList.get(0);
						}
					}
					else if(infosList!=null && infosList.size()==1)
					{
						info_name = (String)infosList.get(0);
					}
					
					if(info_name==null || info_name.equalsIgnoreCase("null") || info_name.trim().length()==0)
					{
						info_name = "+" + info_to_lower;
					}
					
					if(info_name!=null && info_name.indexOf("\\")!=-1)
						info_name = com.egurkha.util.StringUtils.replace(info_name, "\\", "\\\\");
					
					//link = "/final/monitor/EgSiteInfraView.jsp?qctr=2"+"&site=NULL"+"&fromalarm=0"+"&newWindow=false"+"&host="+EgURLEncoder.encode(compName,"UTF-8")+"&msmt_host="+EgURLEncoder.encode(msmtHost,"UTF-8")+"&comptype="+compValue+"&layer="+ctype_layer+"&test="+ctype_test+"-"+EgURLEncoder.encode(info_name,"UTF-8")+"&tstate=&toDashBoardLayer=true"+"&tab=LayerModel"+"&enableBackButton="+enableBackButton+"&isfromuedoverview="+isFromUEDOverview+"&overviewsearchstr="+overviewSearchStr+"&filterFlag="+filterFlag+"&searchFilter="+searchFilter+"&nextSearch="+nextSearch+"&isFromUEDView=true&showKeyUser="+showKeyUser+"&filterName="+filterName;
					link = "/final/monitor/EgSiteInfraView.jsp?qctr=2"+"&site=NULL"+"&fromalarm=0"+"&newWindow=false"+"&host="+EgURLEncoder.encode(compName,"UTF-8")+"&msmt_host="+EgURLEncoder.encode(msmtHost,"UTF-8")+"&comptype="+compValue+"&toDashBoardLayer=true"+"&tab=LayerModel"+"&enableBackButton="+enableBackButton+"&isfromuedoverview="+isFromUEDOverview+"&overviewsearchstr="+overviewSearchStr+"&filterFlag="+filterFlag+"&searchFilter="+searchFilter+"&nextSearch="+nextSearch+"&isFromUEDView=true&showKeyUser="+showKeyUser+"&filterName="+filterName;
				}
				else
				{
					link = "/final/monitor/endUserDashboardDetailsData.jsp?comp="+EgURLEncoder.encode(compName,"UTF-8")+"&comptype="+compValue+"&info=*"+EgURLEncoder.encode(url_desktopName,"UTF-8")+"&compName="+EgURLEncoder.encode(compName+":"+compValue,"UTF-8")+"&componentName="+EgURLEncoder.encode(compNameWithOutPort,"UTF-8")+"&msmt_host="+EgURLEncoder.encode(msmtHost,"UTF-8")+"&user="+EgURLEncoder.encode(userName,"UTF-8")+"&searchString="+EgURLEncoder.encode(searchString,"UTF-8")+"&priority="+priority+"&vdiType="+vdiType+"&userType="+userType+"&desktopState="+desktopState+"&detail="+detail+"&compCombo="+compCombo+"&showKeyUser="+showKeyUser+"&filterName="+filterName;
					if(isAdtnlSearch)
						url = url+"&adtnlSearchStr="+EgURLEncoder.encode(adtnlSearchStr_EN,"UTF-8");

					link=link+"&fromf5="+isfromf5;
				}
				if(filterBy!=null && filterBy.trim().length()>0)
				{
					link=link+"&filterBy="+filterBy;
				}
				if(priorityFilter!=null && priorityFilter.trim().length()>0 && !priorityFilter.equalsIgnoreCase("NULL"))
				{
					link=link+"&priorityFilter="+priorityFilter;
				}
				if(gatewayFilter!=null && gatewayFilter.trim().length()>0 && !gatewayFilter.equalsIgnoreCase("NULL"))
				{
					link=link+"&gatewayFilter="+gatewayFilter;
				}

				String disp_desktopName=desktopName;
				//if(disp_desktopName!=null && disp_desktopName.length()>30)
					//disp_desktopName=disp_desktopName.substring(0,30)+"..";

				String strName = compName;
				if (strName.endsWith(EgConstants.NULL_PORT) && (strName.indexOf(EgConstants.NULL_PORT) > -1))
				{
					strName = Server.getServerNameWithoutPort(strName, false);
				}

				String disp_StrName = strName;

				measure.put("systemIconClass","eud_"+desktopState);
				measure.put("systemIconTitle",desktopState);

				if(userType!=null && (userType.equalsIgnoreCase("AppXenApp7") || userType.equalsIgnoreCase("AppDDXenApp7") || userType.equalsIgnoreCase("AppVDI") || userType.equalsIgnoreCase("AppDDVDI") || userType.equalsIgnoreCase("AppLaunchDDXenApp7") || userType.equals("OverviewAppXenApp7") || userType.equals("OverviewAppVDI")))
				{
					if(disp_desktopName.indexOf("~SEQ~")>-1)
					{
						disp_desktopName=disp_desktopName.substring(0,disp_desktopName.indexOf("~SEQ~"));
					}
				}

				boolean checkCase=false;
				if(formation != null && formation.size() > 0 && !defaultAdCase )
				{
					Iterator it = formation.entrySet().iterator();
					if(aduserFilter == null || aduserFilter.trim().length() == 0)
						aduserFilter="All";
					while(it.hasNext())
					{
						Entry entry = (Entry)it.next();
						String key = (String)entry.getKey();
						ArrayList value = (ArrayList)entry.getValue();

						if(!aduserFilter.equalsIgnoreCase("All") ){
							if(!aduserFilter.equals(key))
								continue;
						}
						if(value != null && value.size() > 0)
						{
							checkCase = true;
							measure.put("groupingIndex",key);
						}
					}
				}

				if(aduserFilter.equalsIgnoreCase("All") ){
					if(defaultList != null && defaultList.size() > 0){
						checkCase = true;
						measure.put("groupingIndex","Default");
					}
				}

				measure.put("layerModelUrl",url);
				measure.put("systemTitle",disp_desktopName);
				measure.put("system",disp_desktopName);
				
				if(!isFromctx && !isOnlyVMAssigned && !userType.equals("OverviewAppXenApp7") && !userType.equals("OverviewAppVDI"))
				{
					measure.put("layerModelUrl1",link);
					measure.put("systemTitle1",disp_StrName);
					measure.put("system1",disp_StrName);
				}

				measureList = Arrays.asList(measureArray);
				if(measureValues!=null && measureValues.size()>0)
				{
					String ctype_out_layer=ui.getValue("Layer_for_ComponentType",compValue);
					ctype_out_layer=(ctype_out_layer==null || ctype_out_layer.trim().length()==0)?"VIRTUAL_GUESTS":ctype_out_layer;
					ArrayList listOfTest=(ArrayList)tablesInfo.getTestsForLayer(ctype_out_layer,compValue);

					if(userType!=null && (userType.equals("CitrixXenVDI") || userType.equals("VDI") || userType.equals("ESX")))
					{
						String ctype_in_layer=ini.getValue("USER_DESKTOP_LAYERS",compValue);
						ctype_in_layer=(ctype_in_layer==null || ctype_in_layer.trim().length()==0)?"VIRTUAL_DESKTOP":ctype_in_layer;
						listOfTest.addAll((ArrayList)tablesInfo.getTestsForLayer(ctype_in_layer,compValue));
					}

					int p=0;
					String info_to_lower=desktopName;
					Hashtable temp_Desc_Hash= new Hashtable();
					Hashtable temp_Test_Hash= new Hashtable();
					while(p<measureList.size())
					{
						String keyForList=(String)measureList.get(p);
						String keyMeasure="";
						String keyOrgMeasure="";
						String keyTest="";
						String keydisplayMeasure="";
						StringTokenizer valTokens = new StringTokenizer(keyForList,":");
						int tokCount = valTokens.countTokens();
						boolean isDDDTestColumn = false;
						boolean isLocationColumn = false;

						if(tokCount==5)
							isDDDTestColumn = true;
						else if(tokCount==2)
							isLocationColumn = true;

						String orgColName = "";
						String funcName = "";
						String dispName = "";
						String tempDispName = "";
						String locKeyName = "";
						String Value="";
						String units="";
						
						ArrayList keyMeasureList = null; 
						ArrayList locMeasuresList = new ArrayList(); 
						
						if(isDDDTestColumn && !isLocationColumn)
						{
							if(keyForList!=null && keyForList.indexOf(":")>-1)
							{
								keyTest=keyForList.substring(0,keyForList.indexOf(":"));
								keyMeasure=keyForList.substring(keyForList.indexOf(":")+1);
								if(keyMeasure!=null && keyMeasure.indexOf(":")>-1)
								{
									orgColName=keyMeasure.substring(keyMeasure.indexOf(":")+1);
									keyMeasure = keyMeasure.substring(0,keyMeasure.indexOf(":"));
									if(orgColName!=null && orgColName.indexOf(":")>-1)
									{
										funcName=orgColName.substring(orgColName.indexOf(":")+1);
										orgColName = orgColName.substring(0,orgColName.indexOf(":"));

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

							if(keyTest!=null && keyTest.trim().length()>0 && listOfTest!=null && !listOfTest.contains(keyTest) && dispName!=null)
							{
								ArrayList tmpArry=(ArrayList)sameLabelHash.get(dispName);
								if(tmpArry!=null && tmpArry.size()>0)
								{
									for(int kk=0;kk<tmpArry.size();kk++)
									{
										String newKeyForList =(String)tmpArry.get(kk);
										String newKeyTest=null;
										if(newKeyForList!=null && newKeyForList.indexOf(":")>-1)
										{
											newKeyTest=newKeyForList.substring(0,newKeyForList.indexOf(":"));
										}

										if(newKeyTest!=null && newKeyTest.trim().length()>0 && listOfTest!=null && listOfTest.contains(newKeyTest))
										{
											keyForList = newKeyForList;
											if(keyForList!=null && keyForList.indexOf(":")>-1)
											{
												keyTest=keyForList.substring(0,keyForList.indexOf(":"));
												keyMeasure=keyForList.substring(keyForList.indexOf(":")+1);
												if(keyMeasure!=null && keyMeasure.indexOf(":")>-1)
												{
													orgColName=keyMeasure.substring(keyMeasure.indexOf(":")+1);
													keyMeasure = keyMeasure.substring(0,keyMeasure.indexOf(":"));
													if(orgColName!=null && orgColName.indexOf(":")>-1)
													{
														funcName=orgColName.substring(orgColName.indexOf(":")+1);
														orgColName = orgColName.substring(0,orgColName.indexOf(":"));

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

						if(isDDDTestColumn)
						{
							String colKeyName = Dbdata.getColumnForMeasure(keyTest+"_DDD",orgColName);
							String tmpK = colKeyName+"^"+info_to_lower.toLowerCase()+"^"+compNameWithOutPort;

							Value=getMeasureValue(measureValues,keyTest,colKeyName,info_to_lower,compNameWithOutPort);
						}
						else if(isShowUserLocation && isLocationColumn)
						{
							if(keyForList!=null && keyForList.indexOf(":")>-1)
							{
								keyTest = keyForList.substring(0,keyForList.indexOf(":"));
								keyMeasure = keyForList.substring(keyForList.indexOf(":")+1);
							}

							funcName ="NONE";

							if(keyMeasure!=null && keyMeasure.trim().length()>0)
							{
								keyMeasureList = StringUtils.egTokenizer(keyMeasure,"~$~",true,false,true);//param 3-->includeEmpty,4-->unique,5-->trim
								if(keyMeasureList!=null && keyMeasureList.size()>0)
								{
									int meaListSize=keyMeasureList.size();
									if(meaListSize==1)
									{
										locKeyName = (String)keyMeasureList.get(0);
									}
									else if(meaListSize>1)
									{
										locKeyName = (String)keyMeasureList.get(0);
									}

									Value=getMeasureValue(measureValues,keyTest,locKeyName,info_to_lower,compNameWithOutPort);

									if(meaListSize==1 && strSeparator!=null && strSeparator.trim().length()>0 && strReplaceSep!=null && strReplaceSep.trim().length()>0 && Value!=null && !Value.equals("-"))
									{
										Value = com.egurkha.util.StringUtils.replace(Value,strSeparator,strReplaceSep);
									}
								}
							}
						}
						else
						{
							if(keyForList!=null && keyForList.indexOf(":")>-1)
							{
								keyTest=keyForList.substring(0,keyForList.indexOf(":"));
								keyMeasure=keyForList.substring(keyForList.indexOf(":")+1);
								if(keyMeasure!=null && keyMeasure.indexOf(":")>-1)
								{
									keydisplayMeasure=keyMeasure.substring(keyMeasure.indexOf(":")+1);
									keyMeasure=keyMeasure.substring(0,keyMeasure.indexOf(":"));
								}
							}
							units=tablesInfo.getUnitForMeasure(keyTest,keyMeasure);
							keyOrgMeasure = keyMeasure;
							keyMeasure = Dbdata.getColumnForMeasure(keyTest,keyMeasure);
							if(specsInfo.isTestRelevantForServer(compValue,keyTest))
							{
								Value=getMeasureValue(measureValues,keyTest,keyMeasure,info_to_lower,compNameWithOutPort);
							}
						}

						//if((Value==null || Value.trim().length()==0) && compValue!=null && compValue.equals("Xen_desktop_server"))
						if(Value==null || Value.trim().length()==0)
						{
							if(info_to_lower!=null && (info_to_lower.indexOf(" ")>-1 && info_to_lower.indexOf("on")>-1))
							{
								ArrayList tokenList =  com.egurkha.util.StringUtils.egTokenizer(info_to_lower, " on ",false,false,true);//param 3-->includeEmpty,4-->unique,5-->trim
								if(tokenList!=null && tokenList.size()==2)
								{
									info_to_lower=(String)tokenList.get(0)+"_on_"+(String)tokenList.get(1);
								}
							}
							Value=getMeasureValue(measureValues,keyTest,keyMeasure,info_to_lower,compNameWithOutPort);
						}
						
						String mes_state="";
						String mes_name="";
						String total_spc="0";

						if(Value!=null && Value.indexOf("^")>-1)
						{
							mes_state=Value.substring(Value.indexOf("^")+1);
							if(mes_state!=null && mes_state.indexOf("^")>-1)
							{
								mes_name=mes_state.substring(mes_state.indexOf("^")+1);
								mes_state=mes_state.substring(0,mes_state.indexOf("^"));
								if(mes_name!=null && mes_name.indexOf("^")>-1)
								{
									total_spc=mes_name.substring(mes_name.indexOf("^")+1);
									mes_name=mes_name.substring(0,mes_name.indexOf("^"));
								}
							}
							Value=Value.substring(0,Value.indexOf("^"));
						}
						else if(Value==null)
						{
							Value="-";
							mes_name=keyMeasure;
							mes_state="GOOD";
						}

						boolean sameLabelFlag=false;
						if(sameLabelHash!=null && sameLabelHash.size()>0 && keydisplayMeasure!=null && sameLabelHash.containsKey(keydisplayMeasure))
						{
							ArrayList tmpArry=(ArrayList)sameLabelHash.get(keydisplayMeasure);
							ArrayList tmpNewArry=new ArrayList();
							tmpNewArry.addAll(tmpArry);
							if(tmpNewArry!=null && tmpNewArry.size()>0 && keyForList!=null && tmpNewArry.contains(keyForList))
								tmpNewArry.remove(keyForList);

							if(tmpNewArry!=null && tmpNewArry.size()>0)
							{
								sameLabelFlag=true;
								if(!dashboardModel.isTestActive(compValue, compName, keyTest, "custom"))
									Value="-";
							}
						}

						if((Value==null || Value.equals("-")) && sameLabelFlag && (sameLabelHash!=null && sameLabelHash.size()>0 && sameLabelHash.containsKey(keydisplayMeasure)))
						{
							ArrayList tmpArry=(ArrayList)sameLabelHash.get(keydisplayMeasure);
							ArrayList tmpOldArry=new ArrayList();
							if(tmpArry!=null && tmpArry.size()>0)
							{
								tmpOldArry.addAll(tmpArry);
								if(tmpOldArry.contains(keyForList))
									tmpOldArry.remove(keyForList);

								for(int kk=0;kk<tmpOldArry.size();kk++)
								{
									keyForList =(String)tmpOldArry.get(kk);
									String tmp_keyTest=null;
									String tmp_keyMeasure=null;
									String tmp_keydisplayMeasure=null;
									String tmp_keyDDMeasure=null;
									if(keyForList!=null && keyForList.indexOf(":")>-1)
									{
										ArrayList keyTokenList =  com.egurkha.util.StringUtils.egTokenizer(keyForList, ":",true,false,true);//param 3-->includeEmpty,4-->unique,5-->trim
										if(keyTokenList!=null && keyTokenList.size()==3)
										{
											tmp_keyTest=(String)keyTokenList.get(0);
											tmp_keyMeasure=(String)keyTokenList.get(1);
											tmp_keydisplayMeasure=(String)keyTokenList.get(2);
										}
										else if(keyTokenList!=null && keyTokenList.size()==5)//VmgPcoIPSessionTest:Round_trip:ClientIp:NONE:Client IP
										{
											tmp_keyTest=(String)keyTokenList.get(0);
											tmp_keyMeasure=(String)keyTokenList.get(1);
											tmp_keyDDMeasure=(String)keyTokenList.get(2);
											tmp_keydisplayMeasure=(String)keyTokenList.get(4);
										}
									}
									
									//String tmp_units=tablesInfo.getUnitForMeasure(tmp_keyTest,tmp_keyMeasure);
									String tmp_keyOrgMeasure = tmp_keyMeasure;
									if(tmp_keyDDMeasure!=null)
										tmp_keyMeasure = Dbdata.getColumnForMeasure(tmp_keyTest+"_DDD",tmp_keyDDMeasure);
									else
										tmp_keyMeasure = Dbdata.getColumnForMeasure(tmp_keyTest,tmp_keyMeasure);

									String tmp_Value=null;
									boolean isTimeout = false;

									if(tmp_keyDDMeasure==null)
										isTimeout = isTimeoutCheck(compName,tmp_keyTest,msmtHost,compValue,info_to_lower);

									if(!isTimeout)
									{
										if(specsInfo.isTestRelevantForServer(compValue,tmp_keyTest))
										{
											tmp_Value=getMeasureValue(measureValues,tmp_keyTest,tmp_keyMeasure,info_to_lower,compNameWithOutPort);
											if(tmp_Value==null || tmp_Value.trim().length()==0)
											{
												if(info_to_lower!=null && (info_to_lower.indexOf(" ")>-1 && info_to_lower.indexOf("on")>-1))
												{
													ArrayList tokenList =  com.egurkha.util.StringUtils.egTokenizer(info_to_lower, " on ",false,false,true);//param 3-->includeEmpty,4-->unique,5-->trim
													if(tokenList!=null && tokenList.size()==2)
													{
														info_to_lower=(String)tokenList.get(0)+"_on_"+(String)tokenList.get(1);
													}
												}
												tmp_Value=getMeasureValue(measureValues,tmp_keyTest,tmp_keyMeasure,info_to_lower,compNameWithOutPort);
											}
										}

										if(tmp_Value!=null && tmp_Value.indexOf("^")>-1)
										{
											String tmp_mes_state=tmp_Value.substring(tmp_Value.indexOf("^")+1);
											String tmp_total_spc=null;
											String tmp_mes_name=null;
											if(tmp_mes_state!=null && tmp_mes_state.indexOf("^")>-1)
											{
												tmp_mes_name=tmp_mes_state.substring(tmp_mes_state.indexOf("^")+1);
												tmp_mes_state=tmp_mes_state.substring(0,tmp_mes_state.indexOf("^"));
												if(tmp_mes_name!=null && tmp_mes_name.indexOf("^")>-1)
												{
													total_spc=tmp_mes_name.substring(tmp_mes_name.indexOf("^")+1);
													tmp_mes_name=tmp_mes_name.substring(0,tmp_mes_name.indexOf("^"));
												}
											}
											tmp_Value=tmp_Value.substring(0,tmp_Value.indexOf("^"));

											if(tmp_Value!=null && !tmp_Value.trim().equals("-"))
											{
												keyTest=tmp_keyTest;
												keyMeasure=tmp_keyMeasure;
												keyOrgMeasure = tmp_keyOrgMeasure;
												Value=tmp_Value;
												total_spc= tmp_total_spc;
												mes_name=tmp_mes_name;
												mes_state=tmp_mes_state;
												break;
											}
										}
									}
								}
							}
						}
						String desc_key=compNameWithOutPort+":"+port+":"+compValue+":"+keyTest;
						Vector getDescs =(Vector)temp_Desc_Hash.get(desc_key);
						if(getDescs==null || getDescs.size()==0)
						{
							getDescs=(Vector)dashboardDAO.getDescriptorsForTest(compNameWithOutPort+":"+port, compValue, keyTest, "custom");
							if(getDescs!=null && getDescs.size()>0)
								temp_Desc_Hash.put(desc_key,(Vector)getDescs);
						}
						String test_key=compValue+":"+compNameWithOutPort+":"+port;
						Hashtable getTests =(Hashtable)temp_Test_Hash.get(test_key);
						if(getTests==null || getTests.size()==0)
						{
							getTests =(Hashtable) metaTest.get(test_key);
							if(getTests!=null)
								temp_Test_Hash.put(test_key,(Hashtable) getTests);
						}
						
						String orgValue="0.0";
						String result_Val=getValueForDouble(Value,decimalFormatTestMeasureList,convertToDaysTestMeasureList, keyTest,keyOrgMeasure,egDashboard);
						if(result_Val !=null && result_Val.trim().length() >0 && result_Val.indexOf("~$~")>-1)
						{
							Value=result_Val.substring(0,result_Val.indexOf("~$~"));
							orgValue=result_Val.substring(result_Val.indexOf("~$~")+3);
						}					
						if(!isFromctx && !isOnlyVMAssigned && !userType.equals("OverviewAppXenApp7") && !userType.equals("OverviewAppVDI"))
						{
							columns.getJSONObject(p+2).put("textType", "asFloat");
							columns.getJSONObject(p+2).put("dataIndex",p+"MeasureValue");
						}
						else
						{
							columns.getJSONObject(p+1).put("textType", "asFloat");
							columns.getJSONObject(p+1).put("dataIndex",p+"MeasureValue");
						}
						if(Value!=null && (Value.equalsIgnoreCase("0.0") || Value.equalsIgnoreCase("0.00")))
						{
							Value="0";
						}
						String meaLenVal="";
						if(finalallMeasureDataLen!=null && finalallMeasureDataLen.size()>0)
						{
							meaLenVal=(String)finalallMeasureDataLen.get(keyMeasure+"_Length");
							
						}
						if(meaLenVal!=null && meaLenVal.length()>0 && !meaLenVal.equalsIgnoreCase("undefined"))
						{
							int mVal=Integer.parseInt(meaLenVal);
							String mvalSt="";
							/*if(mVal<5)
							{*/
								mVal=mVal*7;
								mvalSt=String.valueOf(mVal);
							/*}
							else if(mVal==5)
							{
								mVal=mVal*7;
								mvalSt=String.valueOf(mVal);
							}else if(mVal>5)
							{
								mVal=mVal*8;
								mvalSt=String.valueOf(mVal);
							}*/
							
							if(units!=null && !units.equals("%"))
							{
								measure.put(p+"MeasureValueLenWidth",mvalSt);
							}
						}

						Value = formatDbValue(Value);

						String iniVar=keyTest+":"+keyOrgMeasure+":"+Value;
						boolean isMDV=false;
						String iniValue=(String)egUi.getValue("Measure_value_display",iniVar);
						if(iniValue!=null && iniValue.trim().length()>0)
						{
							Value = iniValue;
							isMDV=true;
						}

						measure.put(p+"MeasureValue",Value);
						measure.put(p+"MeasureValueState",mes_state);
						
						if(mes_state==null || mes_state.trim().length()==0 || mes_state.equalsIgnoreCase("NONE"))
							mes_state="GOOD";

						String measuresLink = "";
						if((fromMenuStr!=null && !fromMenuStr.equalsIgnoreCase("null") && fromMenuStr.trim().length()>0 && fromMenuStr.equalsIgnoreCase("true")) || (fromGeoStr!=null && !fromGeoStr.equalsIgnoreCase("null") && fromGeoStr.trim().length()>0))
						{
							String layerName = tablesInfo.getRelevantLayer(compValue,keyTest,keyOrgMeasure);
							layerName=(layerName==null || layerName.trim().length()==0)?ctype_layer:layerName;
							
							String infoKey = compValue+":"+compName+":"+keyTest+":"+info_to_lower;
							HashSet infosSet = null;
							if(fullInfoHash!=null && fullInfoHash.size()>0)
								infosSet = (HashSet)fullInfoHash.get(infoKey);
							ArrayList infosList = null;
							if(infosSet!=null && infosSet.size()>0)
								infosList = new ArrayList(infosSet);
							String info_name = "";
							if(infosList!=null && infosList.size()>1)
							{
								for(int is=0;is<infosList.size();is++)
								{
									String tmpInfo = (String)infosList.get(is);
									if(tmpInfo!=null && (tmpInfo.endsWith(":Summary") || tmpInfo.endsWith(":Total")))
									{
										info_name = tmpInfo;
										break;
									}
								}
								if(info_name==null || info_name.equalsIgnoreCase("null") || info_name.trim().length()==0)
								{
									info_name = (String)infosList.get(0);
								}
							}
							else if(infosList!=null && infosList.size()==1)
							{
								info_name = (String)infosList.get(0);
							}
							if(info_name==null || info_name.equalsIgnoreCase("null") || info_name.trim().length()==0)
							{
								info_name = "+" + info_to_lower;
							}

							ArrayList testData = new ArrayList();
							if(keyTest!=null && keyTest.length()>0 && testDetails!=null && testDetails.size()>0)
							{
								testData = (ArrayList)testDetails.get(keyTest);
							}
							
							String meta_info=info_name;
							String tmp_info_name = info_name;
							boolean isAddEntry=false;
							if(testData!=null && testData.size()>0)
							{
								isAddEntry=true;
								if(testData!=null && testData.size()>3)
								{
									meta_info=info_name;
								}
								else if(testData!=null && testData.size()==3)
								{
									meta_info=(String)testData.get(1);
									if(meta_info!=null && tmp_info_name!=null && meta_info.equals(tmp_info_name))
									{
										meta_info=tmp_info_name;
									}
									else
									{
										if(meta_info!=null && meta_info.trim().equals("+"))
											meta_info=meta_info;
									}
								}
							}

							if(isAddEntry)
							{
								measuresLink = "/final/monitor/EgSiteInfraView.jsp?qctr=2"+"&site=NULL"+"&fromalarm=0"+"&newWindow=false"+"&host="+EgURLEncoder.encode(compName,"UTF-8")+"&msmt_host="+EgURLEncoder.encode(msmtHost,"UTF-8")+"&comptype="+compValue+"&layer="+layerName+"&test="+keyTest+"-"+EgURLEncoder.encode(meta_info,"UTF-8")+"&tstate="+mes_state+"&toDashBoardLayer=true"+"&userType="+userType+"&vdiType_SBD="+vdiType_SBD+"&filterName="+filterName;
							}
							else
							{
								if(keyTest!=null && keyTest.length()>0 && keyTest.equalsIgnoreCase("GeoDetails"))
								{
									if(user_test!=null && user_test.length()>0)
									{
										if(user_test.indexOf(":")>-1)
											user_test = user_test.substring(0,user_test.indexOf(":"));
									}
									if(user_test!=null && user_test.indexOf("Vmg")>-1)
									{
										user_test="VmgOSMemoryTest";
									}
									measuresLink = "/final/monitor/EgSiteInfraView.jsp?qctr=2"+"&site=NULL"+"&fromalarm=0"+"&newWindow=false"+"&host="+EgURLEncoder.encode(compName,"UTF-8")+"&msmt_host="+EgURLEncoder.encode(msmtHost,"UTF-8")+"&comptype="+compValue+"&layer="+layerName+"&test="+user_test+"-"+EgURLEncoder.encode(info_name,"UTF-8")+"&tstate="+mes_state+"&toDashBoardLayer=true"+"&userType="+userType+"&vdiType_SBD="+vdiType_SBD+"&filterName="+filterName;
								}
								else
								{
									measuresLink = "/final/monitor/EgSiteInfraView.jsp?qctr=2"+"&site=NULL"+"&fromalarm=0"+"&newWindow=false"+"&host="+EgURLEncoder.encode(compName,"UTF-8")+"&msmt_host="+EgURLEncoder.encode(msmtHost,"UTF-8")+"&comptype="+compValue+"&layer="+layerName+"&test="+keyTest+"-"+EgURLEncoder.encode(info_name,"UTF-8")+"&tstate="+mes_state+"&toDashBoardLayer=true"+"&userType="+userType+"&vdiType_SBD="+vdiType_SBD+"&filterName="+filterName;
								}
							}

							if(isServiceBusiViewMetrics!=null && isServiceBusiViewMetrics.trim().length()>0 && isServiceBusiViewMetrics.equalsIgnoreCase("true"))
							{
								measuresLink = measuresLink + "&isServiceBusiViewMetrics="+isServiceBusiViewMetrics+"&treeFlag_SBD="+treeFlag_SBD+"&outsideService_SBD="+outsideService_SBD+"&titleText_SBD="+titleText_SBD+"&selectNode_SBD="+selectNode_SBD+"&serviceFromZone="+serviceName+"&isEmulTrans_SBD="+isEmulTrans_SBD+"&serviceName="+serviceName+"&serviceState_SBD="+serviceState_SBD+"&isServiceBusiDash="+isServiceBusiDash+"&fromMetricView=true";
							}
							if(filterBy!=null && filterBy.trim().length()>0)
							{
								measuresLink=measuresLink+"&filterBy="+filterBy+"&subFilter="+subFilter;
							}
							if(isfromCitrix!=null && isfromCitrix.trim().length()>0 && isfromCitrix.equalsIgnoreCase("true")){
								measuresLink = measuresLink +"&fromMetricView=true&isfromCitrix="+isfromCitrix+"&iniName="+iniName+"&action=loadViewData&user_name="+user_name+"&fromMenu=true&showConfig=true&fromUED=true&dashboard_name="+dashboard_name+"&dashboard_mapping="+dashboard_mapping+"&view_name="+view_name;
							}
							if(priorityFilter!=null && priorityFilter.trim().length()>0 && !priorityFilter.equalsIgnoreCase("NULL"))
							{
								measuresLink=measuresLink+"&priorityFilter="+priorityFilter;
							}
							
							if(gatewayFilter!=null && gatewayFilter.trim().length()>0 && !gatewayFilter.equalsIgnoreCase("NULL"))
							{
								measuresLink=measuresLink+"&gatewayFilter="+gatewayFilter;
							}
						}
						
						if(Value!=null && !Value.trim().equals("-"))
						{
							if(funcName!=null && (funcName.equalsIgnoreCase("NONE") || funcName.equalsIgnoreCase("DATE")))
							{
								measure.put(p+"MeasureValueFtype",new Boolean(true));
							}
							else
							{
								measure.put(p+"MeasureValueFtype",new Boolean(false));
							}

							if(units!=null && units.equals("%") && (!isMDV))
							{
								int columnWidth = 100;
								Long tempValue=new Long(Math.round(Double.parseDouble(Value)));
								long fillColorValue=tempValue.longValue();
								long tempValue2 = (fillColorValue*100)/columnWidth;
								measure.put(p+"MeasureValueWidth",tempValue2);
							}

							String paramForBackButton ="isFromZoneMenu&iszoneName&parentZone&fromHomepage&fromPageView&filterBy";
							StringTokenizer paramForBack = new StringTokenizer(paramForBackButton,"&");
							String keyParam="";
							while(paramForBack.hasMoreTokens())
							{
								keyParam = (String) paramForBack.nextToken();
								String requestParam=request.getParameter(keyParam);
								if(measuresLink.indexOf(keyParam)<0 && requestParam!= null && !requestParam.equalsIgnoreCase("") && !requestParam.equalsIgnoreCase("NULL"))
								{
									measuresLink+="&"+keyParam+"="+requestParam;
									
								}
								if(url.indexOf(keyParam)<0 && requestParam!= null && !requestParam.equalsIgnoreCase("") && !requestParam.equalsIgnoreCase("NULL"))
								{
									url+="&"+keyParam+"="+requestParam;
									
								}
							}

							if(!isOnlyVMAssigned)
							{
								measure.put(p+"MeasureValueUrl",measuresLink);
							}
							else if(isOnlyVMAssigned)
							{
								measure.put(p+"MeasureValueUrl",url);
							}
						}

						p++;
					}
					measuresjson.add(measure);
				}
				else
				{
					int p=0;
					while(p<measureList.size())
					{
						//bufRow.append("<td style=\"font-size:11px;text-align:right;width:20px;padding-right:10px;!important\" align=\"right\" class=\"x-grid-cell x-grid-cell-gridcolumn x-grid-cell-first\">-</td>"); 
						bufRow.append("<td  style=\"padding-top:4px;border:none\" align=\"center\" class=\"x-grid-cell x-grid-cell-gridcolumn \" >");
							bufRow.append("<table cellspacing=\"0\" cellpadding=\"0\" style=\"table-layout:auto;border:0px solid red\" align=\"right\">");
								bufRow.append("<tr style=\"background:none !important\">");
									//bufRow.append("<td align=\"right\" style=\"font-size:11px;text-align:right;width:20px;padding-right:10px\">");
									//bufRow.append("</td>");
									bufRow.append("<td style=\"text-align:right;padding-right:15px;width:20px;\">");
									bufRow.append("-</td>");
								bufRow.append("</tr>");
							bufRow.append("</table>");
						bufRow.append("</td>");

						measure.put(p+"MeasureValue","-");
						p++;
					}
				}
				bufRow.append("</tr>");
				desktopHtml.put(desktopName,bufRow.toString());
			}

			Hashtable formation = new Hashtable();
			ArrayList defaultList = new ArrayList();
			for(int p=0;p<deskTopList.size();p++){
				String deskName = (String)deskTopList.get(p);
				if(userRelatedAd != null && userRelatedAd.containsKey("+"+deskName)  ){
					ArrayList adList = (ArrayList)userRelatedAd.get("+"+deskName);
					for(int m=0;m<adList.size();m++){
						String adName = (String)adList.get(m);

						if(formation.containsKey(adName)){
							ArrayList userList = (ArrayList)formation.get(adName);
							userList.add(deskName);
							formation.put(adName,userList);
						}else{
							ArrayList userL = new ArrayList();
							userL.add(deskName);
							formation.put(adName,userL);
						}
					}
				}
				else if(userRelatedAd != null && userRelatedAd.containsKey(deskName)){
					ArrayList adList = (ArrayList)userRelatedAd.get(deskName);
					for(int m=0;m<adList.size();m++){
						String adName = (String)adList.get(m);

						if(formation.containsKey(adName)){
							ArrayList userList = (ArrayList)formation.get(adName);
							userList.add(deskName);
							formation.put(adName,userList);
						}else{
							ArrayList userL = new ArrayList();
							userL.add(deskName);
							formation.put(adName,userL);
						}
					}
				}
				else{
					defaultList.add(deskName);
					if(!aduserFilter.equalsIgnoreCase("All"))
						continue;
				}
			}

			boolean checkCase=false;
			if(formation != null && formation.size() > 0 && !defaultAdCase )
			{
				Iterator it = formation.entrySet().iterator();
				if(aduserFilter == null || aduserFilter.trim().length() == 0)
					aduserFilter="All";
				while(it.hasNext())
				{
					Entry entry = (Entry)it.next();
					String key = (String)entry.getKey();
					ArrayList value = (ArrayList)entry.getValue();

					if(!aduserFilter.equalsIgnoreCase("All") ){
						if(!aduserFilter.equals(key))
							continue;
					}
					if(value != null && value.size() > 0)
					{
						checkCase = true;
						for(int q=0;q<value.size();q++){
							String usName = (String)value.get(q);
							if(desktopHtml != null && desktopHtml.containsKey(usName)){
								String html = (String)desktopHtml.get(usName);
								//buf.append(html);
							}
						}
					}
				}
			}
			
			if(aduserFilter.equalsIgnoreCase("All") )
			{
				if(defaultList != null && defaultList.size() > 0)
				{
					checkCase = true;
					for(int i=0;i<defaultList.size();i++)
					{
						String defaultdesName = (String)defaultList.get(i);
						if(desktopHtml != null && desktopHtml.containsKey(defaultdesName))
						{
							String html = (String)desktopHtml.get(defaultdesName);
						}
					}
				}
			}
			isDataAvailable = true;
			if(!checkCase)
			{
				if(showKeyUser && isKeyUserUED)
					header_display=mappingInfo.getTextDescription("monitor.endUserDashboard.User Experience Overview for High Profile "+userType+" Users");
				else
					header_display=mappingInfo.getTextDescription("monitor.endUserDashboard.User Experience Overview for "+userType);
				//jsonRoot.put("header_display",header_display);
				isDataAvailable = false;
			}

			int pageLimit = 0;
			try
			{
				pageLimit = Integer.parseInt(priority);
			}
			catch(Exception e)
			{
				pageLimit = vdiDesktopsListTotalCount;
			}
			if(vdiDesktopsListTotalCount>pageLimit)
			{
				int pages = vdiDesktopsListTotalCount/pageLimit;
				if(vdiDesktopsListTotalCount%pageLimit!=0)
					pages +=1;
				int currPage = pageNo;
				if(currPage==0)currPage++;
				if(pageNo!=pages)
				{
					if(pageNo==0)
						pageNo = 1;
				}
			}
			//jsonRoot.put("FIlTER",fil);
			//jsonRoot.put("isDataAvail",isDataAvailable);
			
			json.put("groupingGrid",true);
			if(enableBackButton!=null && !enableBackButton.equalsIgnoreCase("null") && enableBackButton.trim().length()>0){
				//jsonRoot.put("enableBackButton",enableBackButton); 
				json.put("enableBackButton",enableBackButton);
			}
			json.put("columns",columns);
			if(addSearchEmptyText!=null)
			{
				json.put("addtionalSearchFlag",addtionalSearchFlag);
				String tmpAddSearchEmptyText = addSearchEmptyText.toString();
				if(tmpAddSearchEmptyText!=null && tmpAddSearchEmptyText.endsWith(","))
					tmpAddSearchEmptyText = "Search "+tmpAddSearchEmptyText.substring(0,tmpAddSearchEmptyText.lastIndexOf(","));
				json.put("addSearchEmptyText",tmpAddSearchEmptyText);
			}
			json.put("measures",measuresjson);
			json.put("countJson",countJson);
			json.put("FIlTER",fil);
			json.put("isDataAvail",isDataAvailable);
		}
		else if(isEndUserOverview || isFromUEDSort)
		{
			//JSONObject columnObj  = new JSONObject();
			//StringBuffer addSearchEmptyText = new StringBuffer();
			columnObj  = new JSONObject();
			addSearchEmptyText = new StringBuffer();
			//boolean isPriority = false;
			boolean isAllRow = false;
			int locCount = 0;

			String statenames[] = {"HIGH","INTERMEDIATE","LOW","UNKNOWN","GOOD"};
			ArrayList searchUserKeys = new ArrayList();
			if(priority!=null && !priority.equalsIgnoreCase("ALL"))
			{
				groupByUserKeys = (ArrayList)vmDashHelper.getUEDSubList(groupByUserKeys,priority,pageNo);
				//isPriority = true;
			}
			if((!isFromUEDSort) && vmDashHelper!=null && TotalMeasureInfo!=null)
				groupByUserKeys = (ArrayList)vmDashHelper.getSortedListForUEDOverview(groupByUserKeys,TotalMeasureInfo,"enduseroverview","Health",orderBy,"Health");
			if(searchString!=null && searchString.trim().length()>0 && !searchString.equalsIgnoreCase("null") && !searchString.equalsIgnoreCase("all"))
			{
				if(groupByUserKeys!=null && groupByUserKeys.size()>0)
				{
					int groupByUserKeysSize = groupByUserKeys.size();
					for(int s=0;s<groupByUserKeysSize;s++)
					{
						String search_key = (String)groupByUserKeys.get(s);
						String search_str = "";
						if(search_key!=null && search_key.trim().length()>0 && !search_key.equalsIgnoreCase("null") && search_key.indexOf("~$~")>-1)
						{
							search_str = search_key.substring(0,search_key.indexOf("~$~"));
						}
						else
						{
							search_str = search_key;
						}
						if(search_str!=null && search_str.trim().length()>0 && !search_str.equalsIgnoreCase("null") && (search_str.trim().toLowerCase().indexOf(searchString.trim().toLowerCase())>-1) && !searchUserKeys.contains(search_key))
							searchUserKeys.add(search_key); 
					}
					groupByUserKeys = searchUserKeys;
				}
			}
			else if(searchString!=null && searchString.trim().length()>0 && searchString.equalsIgnoreCase("all"))
			{
				if(isAllCompAccess)
					searchUserKeys.add("All"); 
				//groupByUserKeys = searchUserKeys;
			}
			else
			{
				//groupByUserKeys.add(0,"All");
				if(isAllCompAccess)
					isAllRow = true;
			}
			if(groupByUserKeys!=null && groupByUserKeys.size()>0)
			{
				locCount = groupByUserKeys.size();
				if(isAllRow)
					locCount = locCount - 1;
			}
			String grpByStr = ini.getValue("LOC_USER_DESKTOP_METRICS","Header:"+userType);
			if(grpByStr!=null && grpByStr.trim().length()>0 && !grpByStr.equalsIgnoreCase("null"))
			{
				if(grpByStr.indexOf(":")>-1 && grpByStr.indexOf(",")>-1)
					grpByStr = grpByStr.substring(grpByStr.indexOf(":")+1,grpByStr.indexOf(","));
			}
			if(locCount>0 && (searchString!=null && !searchString.equalsIgnoreCase("all")))
			{
				if(userType!=null && userType.trim().length()>0 && (userType.equalsIgnoreCase("XenApp") || userType.equalsIgnoreCase("XenApp7")))
					header_display=mappingInfo.getTextDescription("monitor.endUserDashboard.Citrix User Experience By "+grpByStr+" for")+" "+userType+" (Total "+grpByStr+"s: "+locCount+")";
				else
					header_display=mappingInfo.getTextDescription("monitor.endUserDashboard.User Experience By "+grpByStr+" for")+" "+userType+" (Total "+grpByStr+"s: "+locCount+")";
			}
			else
			{
				if(userType!=null && userType.trim().length()>0 && (userType.equalsIgnoreCase("XenApp") || userType.equalsIgnoreCase("XenApp7")))
					header_display=mappingInfo.getTextDescription("monitor.endUserDashboard.Citrix User Experience By "+grpByStr+" for")+" "+userType;
				else
					header_display=mappingInfo.getTextDescription("monitor.endUserDashboard.User Experience By "+grpByStr+" for")+" "+userType;
			}

			try
			{
				pageSize = Integer.parseInt(priority);
			}
			catch(Exception e)
			{
				pageSize = groupByUserKeys.size();
			}
			recount=groupByUserKeys.size();
			//recount=groupByUserCount;
			if(pageSize > 0)
				pagesizec=recount/pageSize;
			int tem = recount;
			int mod = 0;
			if(pageSize > 0)
				mod = tem%pageSize;

			if(mod > 0)
				pagesizec=pagesizec+1;

			countJson.put("recount",recount);
			countJson.put("pagesizec",pageSize);
			countJson.put("totalPages",pagesizec);
			if(pagesizec<=1)
				countJson.put("isHidePaging",new Boolean(true));
			else
				countJson.put("isHidePaging",new Boolean(false));

			String pageNoReqN = request.getParameter("pageNo");
			if(pageNoReqN==null || pageNoReqN.trim().length()==0 || pageNoReqN.equalsIgnoreCase("null"))
				pageNoReqN="1";
			int pageStartIndexEnd = 0;
			int pageEndIndexEnd = pageSize;
			int pageNum = 1;
			try
			{
				pageNum = Integer.parseInt(pageNoReqN.trim());
				pageNum = (pageNum == 0 )?1:pageNum;
				if(pageNum==1)
				{
					pageStartIndexEnd=0;
					//pageEndIndex = pageStartIndex+(pageSize-1);//10+10-1
					pageEndIndexEnd = pageSize+pageStartIndexEnd;
				}
				else 
				{
					//pageStartIndex=((pageNum-1)*pageSize);//2-1*10
					//pageEndIndex = pageStartIndex+(pageSize-1);//10+10-1
					pageStartIndexEnd = (pageNum*pageSize)-pageSize;
					pageEndIndexEnd = pageSize+pageStartIndexEnd;
				}
			}
			catch(Exception ee)
			{
				ee.printStackTrace();
				pageNum=1;
			}

			if(groupByUserKeys!=null && groupByUserKeys.size()>0 &&  finalGroupByUserTab!=null && finalGroupByUserTab.size()>0)
			{
				measures=null;
				if(userName!=null && userName.trim().length()>0)
				{
					measures = ini.getValue("LOC_USER_DESKTOP_METRICS","Header:"+userType);
				}
				
				String[] measureArray = measures.split(",");
				measuresCount = measureArray.length;
				int colCount = measuresCount+1;
				
				for(int x=0;x<measureArray.length;x++)
				{
					String tempValue = measureArray[x];
					String tempTest = "";
					String function_name = "";
					String tempMeasure = "";
					String tempLocColName = "";
					String tempDispName = "";
					String locKeyName = "";
					String colName = "";
					ArrayList locColumnsList = null;
					if (addSearchColList!=null && tempValue!=null &&  addSearchColList.contains(tempValue))
					{
						addtionalSearchFlag = true;
						if(tempValue!=null && tempValue.indexOf(":")!=-1)
						{
							addSearchEmptyText.append(tempValue.substring(tempValue.lastIndexOf(":")+1) + ",");
						}
					}
					StringTokenizer valTokens = new StringTokenizer(tempValue,":");
					int count = valTokens.countTokens();
					boolean isDDDColumn = false;
					boolean isLocColumn = false;
					boolean isTestColumn = false;
					String meas ="";
					if(valTokens.hasMoreTokens())
					{
						if(count==2)
						{
							tempLocColName = valTokens.nextToken();
							tempDispName = valTokens.nextToken();
							isLocColumn = true;
							meas = "NONE";
						}
						else if(count==4)
						{
							tempTest = valTokens.nextToken();
							tempMeasure = valTokens.nextToken();
							tempDispName = valTokens.nextToken();
							meas = valTokens.nextToken();
							isDDDColumn = true;
						}
					}
					if(isDDDColumn || isLocColumn)
					{
						String unitForMeasure="";
						String meaUnit="";
						if(isDDDColumn && meas!=null && meas.trim().length()>0)
						{
							unitForMeasure = "("+meas+")";
						}
						String orderByColumn = "";
						if(isLocColumn)
						{
							orderByColumn = tempLocColName;
						}
						else if(isDDDColumn)
						{
							orderByColumn = Dbdata.getColumnForMeasure(tempTest,tempMeasure);	
						}

						columnObj.put("text",mappingInfo.getTextDescription("monitor.VirtualDashboard."+tempDispName));
						columnObj.put("unit",unitForMeasure);
						
						String sortType="asc";
						if(orderBy!=null && orderBy.equalsIgnoreCase("desc"))
						{
							sortType="asc";
						}
						else if(orderBy!=null && orderBy.equalsIgnoreCase("asc"))
						{
							sortType="desc";
						}
						columnObj.put("sortType",sortType);

						if(isFromUEDSort && (orderByColumn!=null && orderByColumn.trim().length()>0 && orderByColumnName!=null && orderByColumnName.trim().length()>0 && orderByColumnName.equalsIgnoreCase(orderByColumn)))
						{
							String nextOrderBy="desc";
							
							if(orderBy!=null && orderBy.equals("desc"))
							{
								nextOrderBy="asc";
							}
							else if(orderBy!=null && orderBy.equals("asc"))
							{
								nextOrderBy="desc";
							}
							if(isDDDColumn || isLocColumn)
							{
								if(isLocColumn)
								{
									columnObj.put("tempLocColName",tempLocColName);
									columnObj.put("tempDispName",tempDispName);
									if(tempDispName!=null && tempDispName.trim().length()>0 && tempDispName.equals("Health"))
										columnObj.put("tempDate","Health");
									else if(tempLocColName!=null && tempLocColName.trim().length()>0 && tempLocColName.equalsIgnoreCase("Total_Users"))
										columnObj.put("tempDate","Total_Users");
									else
										columnObj.put("tempDate","NONE");
								}
								else
								{
									columnObj.put("tempLocColName",orderByColumn);
									columnObj.put("tempDispName",tempDispName);
									if((unitForMeasure==null || unitForMeasure.equals("")))
										columnObj.put("tempDate","NONE");
									else
										columnObj.put("tempDate",meas);
								}
							}
						}
						else
						{
							if(isDDDColumn || isLocColumn)
							{
								if(isLocColumn)
								{
									columnObj.put("tempLocColName",tempLocColName);
									columnObj.put("tempDispName",tempDispName);
									if(tempDispName!=null && tempDispName.trim().length()>0 && tempDispName.equals("Health"))
										columnObj.put("tempDate","Health");
									else if(tempLocColName!=null && tempLocColName.trim().length()>0 && tempLocColName.equalsIgnoreCase("Total_Users"))
										columnObj.put("tempDate","Total_Users");
									else
										columnObj.put("tempDate","NONE");
								}
								else
								{
									columnObj.put("tempLocColName",orderByColumn);
									columnObj.put("tempDispName",tempDispName);
									if((unitForMeasure==null || unitForMeasure.equals("")))
										columnObj.put("tempDate","Total_Users");
									else
										columnObj.put("tempDate",meas);
								}
							}
						}
					}
					columns.add(columnObj);
				}

				measureList = Arrays.asList(measureArray);
				
				int groupByUserKeysSize = (groupByUserKeys!=null && groupByUserKeys.size()>0)?groupByUserKeys.size():0;
				int componentList_count=0;
				if(groupByUserKeysSize>=pageEndIndexEnd)
				{
					componentList_count=pageEndIndexEnd;
				}
				else if(groupByUserKeysSize<pageEndIndexEnd)
				{
					//componentList_count=componentList.size();
					componentList_count=groupByUserKeysSize;
				}

				for(int k=0;k<componentList_count;k++)
				{
					JSONObject measure  = new JSONObject();
					String usrMeasKey = (String)groupByUserKeys.get(k);
					if(measureList!=null && measureList.size()>0)
					{
						for(int m=0;m<measureList.size();m++)
						{
							columns.getJSONObject(m).put("textType", "asFloat");
							columns.getJSONObject(m).put("dataIndex",m+"MeasureValue");
							
							String header_str = (String)measureList.get(m);
							String searchFilterVal = (String)measureList.get(0);
							if(searchFilterVal!=null && searchFilterVal.trim().length()>0 && searchFilterVal.indexOf(":")>-1)
								searchFilterVal = searchFilterVal.substring(0,searchFilterVal.indexOf(":"));
							String header_key = "";
							String header_disp = "";
							String tmpKetTest="";
							String tmpKetMeasure="";
							
							if(header_str!=null && header_str.trim().length()>0 && header_str.indexOf(":")>-1)
							{
								StringTokenizer hTok = new StringTokenizer(header_str.trim(),":");
								if(hTok.countTokens()==4)
								{
									String h_test = hTok.nextToken();
									String h_meas = hTok.nextToken();
									String h_disp = hTok.nextToken();
									String h_fun = hTok.nextToken();
									tmpKetTest=h_test;
									tmpKetMeasure=h_meas;
									header_key = Dbdata.getColumnForMeasure(h_test,h_meas);
								}
								else
								{
									header_key = header_str.substring(0,header_str.indexOf(":"));
								}
							}
							String Value = "";
							String nextSearchVal = "";
							String nextSubSearchVal = nextSubSearch;
							if(finalGroupByUserTab!=null && finalGroupByUserTab.size()>0 && finalGroupByUserTab.containsKey(usrMeasKey+"_"+header_key))
							{
								String measure_val = ""; 
								HashMap state_map = new HashMap();
								if(header_key!=null && header_key.trim().length()>0 && header_key.equals("Health"))
								{
									state_map = (HashMap)finalGroupByUserTab.get(usrMeasKey+"_"+header_key);
									if(usrMeasKey!=null && usrMeasKey.trim().length()>0 && searchFilterVal!=null && finalGroupByUserTab.containsKey(usrMeasKey+"_"+searchFilterVal))
									{
										nextSearchVal = (String)finalGroupByUserTab.get(usrMeasKey+"_"+searchFilterVal);
									}
									if(!isDetailsFromADOnly)
									{
										if(default_Filter!=null && default_Filter.length()>0 && groupByList.contains(default_Filter))
										{
											searchFilterVal =
											(String)finalGroupByUserTab.get(usrMeasKey+"_"+default_Filter);
										}
										else
										{
											searchFilterVal =
											(String)finalGroupByUserTab.get(usrMeasKey+"_"+(String)groupByList.get(0));
										}
										if(tmpSubFilList!=null && tmpSubFilList.size()>0)
										{
											String tmp_Sub_Val=(String)tmpSubFilList.get(0);
											if(tmp_Sub_Val!=null && tmp_Sub_Val.length()>0 && groupByList.contains(tmp_Sub_Val)){
												nextSearchVal = (String)finalGroupByUserTab.get(usrMeasKey+"_"+tmp_Sub_Val);
											}
											else if(groupByList!=null && groupByList.size()>1)
											{
												nextSearchVal = (String)finalGroupByUserTab.get(usrMeasKey+"_"+(String)groupByList.get(1));
											}
										
											if(tmpSubFilList.size()>1)
											{
												String tmp_Sub_Val_2=(String)tmpSubFilList.get(1);
												if(tmp_Sub_Val_2!=null && tmp_Sub_Val_2.length()>0 && groupByList.contains(tmp_Sub_Val_2)){
												
													nextSubSearchVal = (groupByList != null && groupByList.size() > 2)?((String)finalGroupByUserTab.get(usrMeasKey+"_"+tmp_Sub_Val_2)):"";
												}
												else
												{
													nextSubSearchVal = (groupByList != null && groupByList.size() > 2)?((String)finalGroupByUserTab.get(usrMeasKey+"_"+(String)groupByList.get(2))):"";
												}
											}
										}
									}
									StringBuffer htmlStr = new StringBuffer();
									htmlStr.append("<div class=\"healthviewgridbar\" style=\"margin-top:0px\"><div style=\"margin-top:-2px;width:100%;\" class=\"outer12\">");
									if(state_map!=null && state_map.size()>0 && statenames!=null && statenames.length>0)
									{
										for(int n=0;n<statenames.length;n++)
										{
											String state_constant = statenames[n];
											if(state_map.containsKey(state_constant))
											{
												String state_val = (String)state_map.get(state_constant);
												if(state_val!=null && state_val.trim().length()>0 && state_val.indexOf("^|^")>-1)
												{
													String user_per = state_val.substring(0,state_val.indexOf("^|^"));
													String cnt = state_val.substring(state_val.indexOf("^|^")+3);
													String drillDownLink = "/final/monitor/endUserDashboard.jsp?access=allusers&user="+EgURLEncoder.encode(userName,"UTF-8")+"&userType="+userType+"&priority="+priority+"&filterFlag=true&filterBy=All&fromMenu=true&vdiType="+vdiType+"&enableBackButton=true&isfromuedoverview=true"+"&overviewsearchstr="+EgURLEncoder.encode(searchString,"UTF-8")+"&priorityFilter="+state_constant+"&gatewayFilter="+gatewayFilter;
													if(searchFilterVal!=null && searchFilterVal.trim().length()>0)
													{
														drillDownLink = drillDownLink + "&searchFilter="+EgURLEncoder.encode(searchFilterVal,"UTF-8");
													}
													if(nextSearchVal!=null && nextSearchVal.trim().length()>0)
													{
														drillDownLink = drillDownLink + "&nextSearch="+EgURLEncoder.encode(nextSearchVal,"UTF-8");
													}
													if(nextSubSearchVal!=null && nextSubSearchVal.trim().length()>0)
													{
														drillDownLink = drillDownLink + "&nextSubSearch="+EgURLEncoder.encode(nextSubSearchVal,"UTF-8");
													}
													htmlStr.append("<a class=\"mouse\" href=\"javascript:void(0);\" onClick=\"javascript:goToDetails('"+drillDownLink+"');\" data-qclass=\"yellowTip\"><div id=\""+state_constant+"_bg\" style=\"color:#fff;width:"+user_per+"%;height:14px;padding-top:2px;\" class=\"innerLeftRight12\">"+cnt+"</div></a>");
												}
											}
										}
									}
									htmlStr.append("</div><div style=\"clear:both\"></div></div>");
									measure.put(m+"MeasureValue",htmlStr.toString());
								}
								else
								{
									if(groupByList!=null && groupByList.size()>0 && groupByList.contains(header_key))
									{
										Value = (String)finalGroupByUserTab.get(usrMeasKey+"_"+header_key);

										String con_value = null;
										String reg_value = null;
										String city_value = null;
										try
										{
											con_value = (String)finalGroupByUserTab.get(usrMeasKey+"_Country");
											reg_value = (String)finalGroupByUserTab.get(usrMeasKey+"_Region");
											city_value = (String)finalGroupByUserTab.get(usrMeasKey+"_City");
										}
										catch(Exception eee)
										{
											con_value = "All";
											reg_value = "All";
											city_value = "All";
										}

										if(Value==null||Value.trim().length()==0||Value.equals("-5.0000")||Value.equalsIgnoreCase("null"))
											Value = "-";

										String orgValue="0.0";
										String result_Val=getValueForDouble(Value,decimalFormatTestMeasureList,convertToDaysTestMeasureList, tmpKetTest,tmpKetMeasure,egDashboard);

										if(result_Val !=null && result_Val.trim().length() >0 && result_Val.indexOf("~$~")>-1)
										{
											Value=result_Val.substring(0,result_Val.indexOf("~$~"));
											orgValue=result_Val.substring(result_Val.indexOf("~$~")+3);
										}

										if(Value==null||Value.trim().length()==0||Value.equals("-5.0000")||Value.equalsIgnoreCase("null"))
											Value = "-";

										String drillDownLink = "";
										searchFilter=con_value;
										nextSearch=reg_value;
										nextSubSearch=city_value;

										if(isDetailsFromADOnly)
											drillDownLink = "/final/monitor/endUserDashboard.jsp?access=allusers&user="+EgURLEncoder.encode(userName,"UTF-8")+"&userType="+userType+"&priority="+priority+"&filterFlag=true&filterBy=All&searchFilter="+EgURLEncoder.encode(header_key,"UTF-8")+"&nextSearch="+EgURLEncoder.encode(Value,"UTF-8")+"&fromMenu=true"+"&vdiType="+vdiType+"&enableBackButton=true&isfromuedoverview=true"+"&overviewsearchstr="+EgURLEncoder.encode(searchString,"UTF-8");
										else
										{
											String tmpsearchFilter = searchFilter;
											String tmpnextSearch = nextSearch;
											String tmpnextSubSearch = nextSubSearch;

											if(tmpnextSubSearch == null || tmpnextSubSearch.equalsIgnoreCase("null") || tmpnextSubSearch.trim().length() == 0 ||tmpnextSearch == null || tmpnextSearch.equalsIgnoreCase("null") || tmpnextSearch.trim().length() == 0 || tmpsearchFilter == null || tmpsearchFilter.equalsIgnoreCase("null") || tmpsearchFilter.trim().length() == 0)
											{
												if(default_Filter!=null && default_Filter.length()>0 && groupByList.contains(default_Filter))
												{
													tmpsearchFilter =
													(String)finalGroupByUserTab.get(usrMeasKey+"_"+default_Filter);
												}
												else
												{
													tmpsearchFilter =
													(String)finalGroupByUserTab.get(usrMeasKey+"_"+(String)groupByList.get(0));
												}
												
												if(tmpSubFilList!=null && tmpSubFilList.size()>0)
												{
													//for(int t=0;t<tmpSubFilList.size();t++)
													{
														String tmp_Sub_Val=(String)tmpSubFilList.get(0);
														if(tmp_Sub_Val!=null && tmp_Sub_Val.length()>0 && groupByList.contains(tmp_Sub_Val)){
															tmpnextSearch = (String)finalGroupByUserTab.get(usrMeasKey+"_"+tmp_Sub_Val);
														}
														else if(groupByList!=null && groupByList.size()>1)
														{
															tmpnextSearch = (String)finalGroupByUserTab.get(usrMeasKey+"_"+(String)groupByList.get(1));
														}
														
														if(tmpSubFilList.size()>1)
														{
															String tmp_Sub_Val_2=(String)tmpSubFilList.get(1);
															if(tmp_Sub_Val_2!=null && tmp_Sub_Val_2.length()>0 && groupByList.contains(tmp_Sub_Val_2)){
																
																tmpnextSubSearch = (groupByList != null && groupByList.size() > 2)?((String)finalGroupByUserTab.get(usrMeasKey+"_"+tmp_Sub_Val_2)):"";
															}
															else
															{
																tmpnextSubSearch = (groupByList != null && groupByList.size() > 2)?((String)finalGroupByUserTab.get(usrMeasKey+"_"+(String)groupByList.get(2))):"";
															}
														}
													}
												}
												
												//drillDownLink = "/final/monitor/endUserDashboard.jsp?access=allusers&user="+EgURLEncoder.encode(userName,"UTF-8")+"&userType="+userType+"&priority="+priority+"&filterFlag=true&filterBy=All&searchFilter="+EgURLEncoder.encode(tmpsearchFilter,"UTF-8")+"&nextSearch="+EgURLEncoder.encode(tmpnextSearch,"UTF-8")+"&nextSubSearch="+EgURLEncoder.encode(tmpnextSubSearch,"UTF-8")+"&fromMenu=true"+"&vdiType="+vdiType+"&enableBackButton=true&isfromuedoverview=true"+"&overviewsearchstr="+EgURLEncoder.encode(searchString,"UTF-8");
												drillDownLink = "/final/monitor/endUserDashboard.jsp?access=allusers&user="+EgURLEncoder.encode(userName,"UTF-8")+"&userType="+userType+"&priority="+priority+"&filterFlag=true&filterBy=All&fromMenu=true"+"&vdiType="+vdiType+"&enableBackButton=true&isfromuedoverview=true"+"&overviewsearchstr="+EgURLEncoder.encode(searchString,"UTF-8")+"&priorityFilter="+priorityFilter+"&gatewayFilter="+gatewayFilter;
											
												if(tmpsearchFilter!=null && tmpsearchFilter.trim().length()>0)
												{
													drillDownLink = drillDownLink + "&searchFilter="+EgURLEncoder.encode(tmpsearchFilter,"UTF-8");
												}
												if(tmpnextSearch!=null && tmpnextSearch.trim().length()>0)
												{
													drillDownLink = drillDownLink + "&nextSearch="+EgURLEncoder.encode(tmpnextSearch,"UTF-8");
												}
												if(tmpnextSubSearch!=null && tmpnextSubSearch.trim().length()>0)
												{
													drillDownLink = drillDownLink + "&nextSubSearch="+EgURLEncoder.encode(tmpnextSubSearch,"UTF-8");
												}
												if(priorityFilter!=null && priorityFilter.trim().length()>0 && !priorityFilter.equalsIgnoreCase("NULL"))
												{
													drillDownLink = drillDownLink + "&priorityFilter="+priorityFilter;
												}
												if(gatewayFilter!=null && gatewayFilter.trim().length()>0 && !gatewayFilter.equalsIgnoreCase("NULL"))
												{
													drillDownLink = drillDownLink + "&gatewayFilter="+gatewayFilter;
												}
											}
											else
											{
												drillDownLink = "/final/monitor/endUserDashboard.jsp?access=allusers&user="+EgURLEncoder.encode(userName,"UTF-8")+"&userType="+userType+"&priority="+priority+"&filterFlag=true&filterBy=All&fromMenu=true"+"&vdiType="+vdiType+"&enableBackButton=true&isfromuedoverview=true"+"&overviewsearchstr="+EgURLEncoder.encode(searchString,"UTF-8")+"&priorityFilter="+priorityFilter+"&gatewayFilter="+gatewayFilter;
												if(searchFilter!=null && searchFilter.trim().length()>0)
												{
													drillDownLink = drillDownLink + "&searchFilter="+EgURLEncoder.encode(searchFilter,"UTF-8");
												}
												if(nextSearch!=null && nextSearch.trim().length()>0)
												{
													drillDownLink = drillDownLink + "&nextSearch="+EgURLEncoder.encode(nextSearch,"UTF-8");
												}
												if(nextSubSearch!=null && nextSubSearch.trim().length()>0)
												{
													drillDownLink = drillDownLink + "&nextSubSearch="+EgURLEncoder.encode(nextSubSearch,"UTF-8");
												}
												if(priorityFilter!=null && priorityFilter.trim().length()>0 && !priorityFilter.equalsIgnoreCase("NULL"))
												{
													drillDownLink = drillDownLink + "&priorityFilter="+priorityFilter;
												}
												if(gatewayFilter!=null && gatewayFilter.trim().length()>0 && !gatewayFilter.equalsIgnoreCase("NULL"))
												{
													drillDownLink = drillDownLink + "&gatewayFilter="+gatewayFilter;
												}
											}
										}
										
										if(Value!=null && (Value.equalsIgnoreCase("0.0") || Value.equalsIgnoreCase("0.00")))
										{
											Value="0";
										}
										Value = formatDbValue(Value);
										measure.put(m+"MeasureValue",Value);
									
										String paramForBackButton ="isFromZoneMenu&iszoneName&parentZone&fromHomepage&fromPageView&filterBy";
										StringTokenizer paramForBack = new StringTokenizer(paramForBackButton,"&");
										String keyParam="";
										while(paramForBack.hasMoreTokens())
										{
											keyParam = (String) paramForBack.nextToken();
											String requestParam=request.getParameter(keyParam);
											if(drillDownLink.indexOf(keyParam)<0 && requestParam!= null && !requestParam.equalsIgnoreCase("") && !requestParam.equalsIgnoreCase("NULL"))
											{
												drillDownLink+="&"+keyParam+"="+requestParam;
												
											}
										}
								
										if(Value!=null && !Value.trim().equals("-"))
										{
											if(!isOnlyVMAssigned)
											{
												measure.put(m+"MeasureValueUrl",drillDownLink);
											}
											else if(isOnlyVMAssigned)
											{
												measure.put(m+"MeasureValueUrl","javacscript:void(0);");
											}
										}
									}
									else
									{
										Value = (String)finalGroupByUserTab.get(usrMeasKey+"_"+header_key);
										if(Value==null||Value.trim().length()==0||Value.equals("-5.0000")||Value.equalsIgnoreCase("null"))
											Value = "-";

										String orgValue="0.0";
										String result_Val=getValueForDouble(Value,decimalFormatTestMeasureList,convertToDaysTestMeasureList, tmpKetTest,tmpKetMeasure,egDashboard);
										if(result_Val !=null && result_Val.trim().length() >0 && result_Val.indexOf("~$~")>-1)
										{
											Value=result_Val.substring(0,result_Val.indexOf("~$~"));
											orgValue=result_Val.substring(result_Val.indexOf("~$~")+3);
										}

										/*if(Value!=null && Value.trim().length()>0 && Value.indexOf(".")>-1 && Double.parseDouble(Value)>0)
										{
											if(decimalFormatTestMeasureList!=null && decimalFormatTestMeasureList.size()>0 && decimalFormatTestMeasureList.contains(tmpKetTest+":"+tmpKetMeasure))
											{
												Value=String.valueOf(com.egurkha.util.MathUtils.round(Double.parseDouble(Value),4));
											}
											else if(convertToDaysTestMeasureList!=null && convertToDaysTestMeasureList.size()>0 && convertToDaysTestMeasureList.contains(tmpKetTest+":"+tmpKetMeasure))
											{
												Value = getConvertDays(Value,egDashboard);
											}
											else
											{
												Value=String.valueOf(com.egurkha.util.MathUtils.round(Double.parseDouble(Value),2));
											}
										}*/

										if(Value!=null && (Value.equalsIgnoreCase("0.0") || Value.equalsIgnoreCase("0.00")))
										{
											Value="0";
										}
										Value = formatDbValue(Value);
										measure.put(m+"MeasureValue",Value);
									}
								}
							}
							else
							{
								if(Value==null||Value.trim().length()==0||Value.equals("-5.0000")||Value.equalsIgnoreCase("null"))
									Value = "-";
								measure.put(m+"MeasureValue","-");
							}
						}
					}
					/*else
					{
						int p=0;
						while(p<measureList.size())
						{
							String keyForList=(String)measureList.get(p);
							StringTokenizer valTokens = new StringTokenizer(keyForList,":");
							int tokCount = valTokens.countTokens();
							boolean isDDDTestColumn = false;
							boolean isLocationColumn = false;

							if(tokCount==4)
								isDDDTestColumn = true;
							else if(tokCount==2)
								isLocationColumn = true;

							measure.put(p+"MeasureValue","-");
							p++;
						}
					}*/
					measuresjson.add(measure);
				}
				int pageLimit = 0;
				try
				{
					pageLimit = Integer.parseInt(priority);
				}
				catch(Exception e)
				{
					pageLimit = groupByUserCount;
				}
				if(groupByUserCount>pageLimit)
				{
					int pages = groupByUserCount/pageLimit;
					if(groupByUserCount%pageLimit!=0)
						pages +=1;

					int currPage = pageNo;
					if(currPage==0)currPage++;

					if(pageNo!=pages)
					{
						if(pageNo==0)
							pageNo = 1;
					}
				}
				
				json.put("columns",columns);
				json.put("measures",measuresjson);
				json.put("countJson",countJson);
				json.put("FIlTER",fil);
				isDataAvailable = true;
				json.put("isDataAvail",isDataAvailable); 
			}
			else
			{
				int col_span=measureList.size();
				isDataAvailable = false;
				json.put("error",mappingInfo.getTextDescription("monitor.endUserDashboard.No Records Found"));
			}
			
			json.put("isEndUserOverview",true); 
			
			//jsonRoot.put("FIlTER",fil);
			isDataAvailable = true;
			//jsonRoot.put("isDataAvail",isDataAvailable); 

			json.put("columns",columns);
			if(addSearchEmptyText!=null)
			{
				json.put("addtionalSearchFlag",addtionalSearchFlag);
				String tmpAddSearchEmptyText = addSearchEmptyText.toString();
				if(tmpAddSearchEmptyText!=null && tmpAddSearchEmptyText.endsWith(","))
					tmpAddSearchEmptyText = "Search "+tmpAddSearchEmptyText.substring(0,tmpAddSearchEmptyText.lastIndexOf(","));
				json.put("addSearchEmptyText",tmpAddSearchEmptyText);
			}
			json.put("measures",measuresjson);
			json.put("countJson",countJson);
			json.put("FIlTER",fil);
			json.put("isDataAvail",isDataAvailable);
		}
		else if((!isEndUserOverview) && (!isFromUEDSort))
		{
			String secondPosMeaVal=null;
			if(measures_with_extra!=null && measures_with_extra.trim().length()>0 && extra_measures!=null && extra_measures.trim().length()>0)
			{
				StringBuffer iniValue=new StringBuffer(128);
				ArrayList tmpTestMeasureList = StringUtils.egTokenizer(measures_with_extra,",",true,false,true);//param 3-->includeEmpty,4-->unique,5-->trim
				//ArrayList tmpTestMeasureListExt = StringUtils.egTokenizer(extra_measures,",",true,false,true);//param 3-->includeEmpty,4-->unique,5-->trim
				if(tmpTestMeasureList!=null && tmpTestMeasureList.size()>0 && selectedTestMea!=null && selectedTestMea.trim().length()>0)
				{
					String swapTestMea = ini.getValue("SWAP_USER_DESKTOP_METRICS",selectedTestMea);
					swapTestMea = (swapTestMea==null || swapTestMea.trim().length()==0)?"":swapTestMea;
					for(int v=0;v<tmpTestMeasureList.size();v++)
					{
						String test_with_measure = (String)tmpTestMeasureList.get(v);
						StringTokenizer testTok=new StringTokenizer(test_with_measure.trim(),":");
						int tokenCount=testTok.countTokens();
						if(tokenCount>=3)
						{
							String tmpTest=testTok.nextToken();
							String tmpMea=testTok.nextToken();
							String tmpColumn=null;
							if(tokenCount>=3)
								tmpColumn=testTok.nextToken();

							String tmpTestMea=tmpTest+":"+tmpMea;
							String tmpTestMea2=tmpTestMea;
							if(tmpColumn!=null && tmpColumn.trim().length()>0)
								tmpTestMea2=tmpTest+":"+tmpColumn;

							if(selectedTestMea!=null && selectedTestMea.trim().length()>0 && (selectedTestMea.equals(tmpTestMea) || selectedTestMea.equals(tmpTestMea2)))
							{
								secondPosMeaVal = test_with_measure;//Desktop_sessions
								if(selectedMeasure!=null && selectedMeasure.trim().length()>0 && (selectedMeasure.equalsIgnoreCase("UniqueSessionDesktopCount") || selectedMeasure.equalsIgnoreCase("Desktop_sessions")))
									extra_filter="Desktop";
								else if(selectedMeasure!=null && selectedMeasure.trim().length()>0 && (selectedMeasure.equalsIgnoreCase("UniqueSessionMobileCount") || selectedMeasure.equalsIgnoreCase("Mobile_sessions")))
									extra_filter="Mobile";
								else if(selectedMeasure!=null && selectedMeasure.trim().length()>0 && (selectedMeasure.equalsIgnoreCase("UniqueSessionTabletCount") || selectedMeasure.equalsIgnoreCase("Tablet_sessions")))
									extra_filter="Tablet";

								break;
							}
							else if(swapTestMea!=null && swapTestMea.trim().length()>0 && (swapTestMea.equals(tmpTestMea) || swapTestMea.equals(tmpTestMea2)))
							{
								secondPosMeaVal = test_with_measure;
								if(selectedMeasure!=null && selectedMeasure.trim().length()>0 && (selectedMeasure.equalsIgnoreCase("UniqueSessionDesktopCount") || selectedMeasure.equalsIgnoreCase("Desktop_sessions")))
									extra_filter="Desktop";
								else if(selectedMeasure!=null && selectedMeasure.trim().length()>0 && (selectedMeasure.equalsIgnoreCase("UniqueSessionMobileCount") || selectedMeasure.equalsIgnoreCase("Mobile_sessions")))
									extra_filter="Mobile";
								else if(selectedMeasure!=null && selectedMeasure.trim().length()>0 && (selectedMeasure.equalsIgnoreCase("UniqueSessionTabletCount") || selectedMeasure.equalsIgnoreCase("Tablet_sessions")))
									extra_filter="Tablet";
								break;
							}
						}
					}
					if(secondPosMeaVal!=null && secondPosMeaVal.trim().length()>0)
					{
						ArrayList tmpTestMeasureListOrg = StringUtils.egTokenizer(measures,",",true,false,true);//param 3-->includeEmpty,4-->unique,5-->trim

						try
						{
							tmpTestMeasureListOrg.remove(secondPosMeaVal);
							for(int v=0;v<tmpTestMeasureListOrg.size();v++)
							{
								String test_with_measure = (String)tmpTestMeasureListOrg.get(v);
								if(v==1)
								{
									iniValue.append(","+secondPosMeaVal);
									iniValue.append(","+test_with_measure);
								}
								else
								{
									if(test_with_measure!=null && test_with_measure.trim().length()>0)
										iniValue.append(","+test_with_measure);
								}
							}
						}
						catch (Exception ee)
						{
							ee.printStackTrace();
						}
					}

					String iniValueStr=iniValue.toString();

					if(iniValueStr!=null && iniValueStr.trim().length()>0)
					{
						if(iniValueStr.startsWith(","))
							iniValueStr=iniValueStr.substring(1);

						measures = iniValueStr;
					}
				}
			}
			
			String[] measureArray = measures.split(",");
			ArrayList displayColsList = new ArrayList();
			ArrayList validColsList = new ArrayList();
			Hashtable sameLabelHash = new Hashtable();
			measuresCount = measureArray.length;
			int colCount=measuresCount+1;
			ArrayList addString=new ArrayList();
			for(int x=0;x<measureArray.length;x++)
			{
				String tempValue = measureArray[x];
				String tempTest = "";
				String tempMeasure = "";
				String tempLocColName = "";
				String tempDispName = "";
				String locKeyName = "";
				String colName = "";
				ArrayList locColumnsList = null;
				if (addSearchColList!=null && tempValue!=null &&  addSearchColList.contains(tempValue))
				{
					addtionalSearchFlag = true;
					if(tempValue!=null && tempValue.indexOf(":")!=-1)
					{
						String new_addString=tempValue.substring(tempValue.lastIndexOf(":")+1);
						if(new_addString!=null && !addString.contains(new_addString))
						{
							addSearchEmptyText.append(new_addString + ",");
							addString.add(new_addString);
						}
					}
				}
				StringTokenizer valTokens = new StringTokenizer(tempValue,":");
				int count = valTokens.countTokens();
				boolean isDDDColumn = false;
				boolean isLocColumn = false;
				boolean isTestColumn = false;
				String meas ="";
				if (valTokens.hasMoreTokens())
				{
					if(count==3)
					{
						tempTest = valTokens.nextToken();
						tempMeasure = valTokens.nextToken();
						tempDispName = valTokens.nextToken();
						isTestColumn=true;
					}
					else if(count==2)
					{
						if(isShowUserLocation)
						{
							tempTest = valTokens.nextToken();
							tempMeasure = valTokens.nextToken();
							//tempDispName = mappingInfo.getMeasureDescription(tempTest,tempMeasure);
							isLocColumn = true;
							meas = "NONE";

							ArrayList tmpMeasureList = new ArrayList(); 
							tmpMeasureList = StringUtils.egTokenizer(tempMeasure,"~$~",true,false,true);//param 3-->includeEmpty,4-->unique,5-->trim
							if(tmpMeasureList!=null && tmpMeasureList.size()>0)
							{
								int meaListSize=tmpMeasureList.size();
								if(meaListSize==1)
								{
									tempDispName = tempMeasure;
									tempLocColName = tempMeasure;
								}
								else if(meaListSize>1)
								{
									tempLocColName = (String)tmpMeasureList.get(0);
									tempDispName = (String)tmpMeasureList.get(1);
								}
							}
						}
					}
					else if(count==5)
					{
						tempTest = valTokens.nextToken();
						tempMeasure = valTokens.nextToken();
						colName = valTokens.nextToken();
						meas = valTokens.nextToken();
						tempDispName = valTokens.nextToken();
						isDDDColumn = true;
					}
				}

				if(isTestColumn || isDDDColumn || isLocColumn)
				{
					if(displayColsList!=null && displayColsList.contains(tempDispName))
					{
						if(sameLabelHash!=null && sameLabelHash.containsKey(tempDispName))
						{
							ArrayList tmp_list=(ArrayList)sameLabelHash.get(tempDispName);
							tmp_list.add(tempValue);
							sameLabelHash.put(tempDispName,(ArrayList)tmp_list);
						}
						else
						{
							ArrayList tmp_list=new ArrayList();
							tmp_list.add(tempValue);
							sameLabelHash.put(tempDispName,(ArrayList)tmp_list);
						}

						continue;
					}

					String unitForMeasure="";
					String meaUnit="";
					if(isDDDColumn && meas!=null && meas.trim().length()>0 && (!meas.equalsIgnoreCase("NONE")&&!meas.equalsIgnoreCase("DATE")))
						unitForMeasure = "("+meas+")";
					else if(!isDDDColumn && !isLocColumn)
					{
						String unitVal=tablesInfo.getUnitForMeasure(tempTest,tempMeasure.trim());

						if(unitVal!=null && unitVal.trim().length()>0)
						{
							unitForMeasure="("+unitVal+")";
							meaUnit = unitVal;
						}
					}

					if(tempDispName!=null && tempDispName.equalsIgnoreCase("Status"))
						unitForMeasure="";
					else if(tempDispName!=null && (tempDispName.equalsIgnoreCase("Disk Used") || tempDispName.equalsIgnoreCase("Used Space")))
						unitForMeasure="("+mappingInfo.getTextDescription("monitor.VirtualDashboard.GB")+")";

					String orderByColumn = "";
					if(isLocColumn)
					{
						//orderByColumn = tempDispName;
						orderByColumn = tempLocColName;
						//orderByColumnName = tempDispName;
					}
					else if (isDDDColumn)
						orderByColumn = Dbdata.getColumnForMeasure(tempTest+"_DDD",colName);
					else
						orderByColumn = Dbdata.getColumnForMeasure(tempTest,tempMeasure); 

					if((convertToDaysTestMeasureList!=null && convertToDaysTestMeasureList.size()>0 && convertToDaysTestMeasureList.contains(tempTest+":"+tempMeasure)) || (udm_hide_unit_list!=null && udm_hide_unit_list.size()>0 && udm_hide_unit_list.contains(tempTest+":"+tempMeasure)))
						unitForMeasure="";
					
					columnObj  = new JSONObject();
					columnObj.put("text",mappingInfo.getTextDescription("monitor.VirtualDashboard."+tempDispName));
					columnObj.put("unit",unitForMeasure);
					
					String sortType="asc";
					if(orderBy!=null && orderBy.equalsIgnoreCase("desc"))
						sortType="asc";
					else if(orderBy!=null && orderBy.equalsIgnoreCase("asc"))
						sortType="desc";
					columnObj.put("sortType",sortType);
					
					if(orderByColumn!=null && orderByColumn.trim().length()>0 && orderByColumnName!=null && orderByColumnName.trim().length()>0 && orderByColumnName.equalsIgnoreCase(orderByColumn))
					{
						String nextOrderBy="desc";
						
						if(orderBy!=null && orderBy.equals("desc"))
							nextOrderBy="asc";
						else if(orderBy!=null && orderBy.equals("asc"))
							nextOrderBy="desc";

						if(isDDDColumn || isLocColumn)
						{
							if(isLocColumn)
							{
								columnObj.put("tempLocColName",tempLocColName);
								columnObj.put("tempDispName",tempDispName);
								if((unitForMeasure==null || unitForMeasure.equals(""))&& (meas!=null && !meas.equalsIgnoreCase("DATE")))
									columnObj.put("tempDate","NONE");
								else
									columnObj.put("tempDate",meas);
							}
							else
							{
								columnObj.put("tempLocColName",orderByColumn);
								columnObj.put("tempDispName",tempDispName);
								if((unitForMeasure==null || unitForMeasure.equals(""))&& (meas!=null && !meas.equalsIgnoreCase("DATE")))
									columnObj.put("tempDate","NONE");
								else
									columnObj.put("tempDate",meas);
							}
						}
						else
						{
							columnObj.put("tempLocColName",orderByColumn);
							columnObj.put("tempDispName",tempDispName);
						}
					}
					else
					{
						if(isDDDColumn || isLocColumn)
						{
							if(isLocColumn)
							{
								columnObj.put("tempLocColName",tempLocColName);
								columnObj.put("tempDispName",tempDispName);
								if((unitForMeasure==null || unitForMeasure.equals("")) && (meas!=null && !meas.equalsIgnoreCase("DATE")))
									columnObj.put("tempDate","NONE");
								else
									columnObj.put("tempDate",meas);
							}
							else
							{
								columnObj.put("tempLocColName",orderByColumn);
								columnObj.put("tempDispName",tempDispName);
								if((unitForMeasure==null || unitForMeasure.equals("")) && (meas!=null && !meas.equalsIgnoreCase("DATE")))
									columnObj.put("tempDate","NONE");
								else
									columnObj.put("tempDate",meas);
							}
						}
						else
						{
							columnObj.put("tempLocColName",orderByColumn);
							columnObj.put("tempDispName",tempDispName);
						}
					}

					columns.add(columnObj);
					if(displayColsList!=null && tempDispName!=null && !displayColsList.contains(tempDispName))
					{
						displayColsList.add(tempDispName);
						if(sameLabelHash!=null && sameLabelHash.containsKey(tempDispName))
						{
							ArrayList tmp_list=(ArrayList)sameLabelHash.get(tempDispName);
							tmp_list.add(tempValue);
							sameLabelHash.put(tempDispName,(ArrayList)tmp_list);
						}
						else
						{
							ArrayList tmp_list=new ArrayList();
							tmp_list.add(tempValue);
							sameLabelHash.put(tempDispName,(ArrayList)tmp_list);
						}
					}
					if(validColsList!=null && tempValue!=null && !validColsList.contains(tempValue))
						validColsList.add(tempValue);
				}
			}

			if(validColsList!=null && validColsList.size()>0)
			{
				measureArray = new String[validColsList.size()];
				int yy=0;
				for(int y=0;y<validColsList.size();y++)
				{
					String tempValue1 = (String)validColsList.get(y);
					if(tempValue1!=null && tempValue1.trim().length()>0)
						measureArray[yy++]=tempValue1;
				}
			}
			EgService serv = null;
			int desktopsSize = (vdiDesktopsList!=null && vdiDesktopsList.size()>0)?vdiDesktopsList.size():0;
			
			int componentList_count=0;
			if(desktopsSize>=pageEndIndex)
			{
				componentList_count=pageEndIndex;
			}
			else if(desktopsSize<pageEndIndex)
			{
				//componentList_count=componentList.size();
				componentList_count=desktopsSize;
			}

			for(int i=0;i<componentList_count;i++)
			{
				JSONObject measure  = new JSONObject();
				
				serv = (EgService)vdiDesktopsList.get(i);

				String desktopComponent = serv.getName();
				String desktopState = serv.getState().getName();
				String desktopName = "";
				String comp = "";
				String compValue = "";
				String compName = "";
				String compNameWithOutPort = "";
				String port = "NULL";
				
				if(desktopComponent!=null && desktopComponent.indexOf("^")>-1)
				{
					desktopName = desktopComponent.substring(0,desktopComponent.indexOf("^"));
					comp = desktopComponent.substring(desktopComponent.indexOf("^")+1);
				}

				if(comp!=null && comp.indexOf(":")>-1)
				{
					compValue = comp.substring(0,comp.indexOf(":"));
					compName = comp.substring(comp.indexOf(":")+1);
				}
				if(compName!=null && compName.indexOf(":")>-1)
				{
					compNameWithOutPort = compName.substring(0,compName.indexOf(":"));
					port = compName.substring(compName.indexOf(":")+1);
				}
				measureValues = (Hashtable)TotalMeasureInfo.get(comp);
				String msmtHost = "";
				String ctype_layer = "";
				String ctype_test = "";

				if(userType!=null)
					 ctype_layer=ini.getValue("USER_DESKTOP_LAYERS",userType+":"+compValue);

				if(ctype_layer==null || ctype_layer.trim().length()==0)
					ctype_layer=ini.getValue("USER_DESKTOP_LAYERS",compValue);
				ctype_layer=(ctype_layer==null || ctype_layer.trim().length()==0)?"VIRTUAL_DESKTOP":ctype_layer;

				//String ctype_test=ini.getValue("USER_DESKTOP_TESTS",compValue);
				if(userType!=null)
					ctype_test=ini.getValue("USER_DESKTOP_TESTS",userType+":"+compValue);

				
				if(ctype_test==null || ctype_test.trim().length()==0)
					ctype_test=ini.getValue("USER_DESKTOP_TESTS",compValue);

				//ctype_test=(ctype_test==null || ctype_test.trim().length()==0)?"null":ctype_test;

				msmtHost =(String)getMsmtHost(tablesInfo,egExternalInfo,ctype_layer,compValue,compNameWithOutPort);

				Hashtable testDetails = new Hashtable();
				if(compValue!=null && compValue.trim().length()>0 && compName!=null && compName.length()>0)
					testDetails =(Hashtable) metaTest.get(compValue+":"+compName);
				if(testDetails == null)
					testDetails = new Hashtable();

				String tempHostType = compValue;
				String url_desktopName=com.egurkha.util.StringUtils.replace(desktopName, "\\", "\\");

				String userTypeTmp=userType;
				String fromVCDSDrilldown="";
				String add_url="";
				if(userType!=null && userType.equalsIgnoreCase("VDIESX") && vdi_list!=null && vdi_list.contains(compValue))
				{
					userTypeTmp="VDI";
					fromVCDSDrilldown="yes";
					searchString = searchStringVCDS;
				}
				else if(userType!=null && userType.equalsIgnoreCase("VDIESX") && esx_list!=null && esx_list.contains(compValue))
				{
					userTypeTmp="ESX";
					fromVCDSDrilldown="yes";
					searchString = searchStringVCDS;
				}

				if(userType!=null && userType.equalsIgnoreCase("CitrixXenVDI") && vdi_list!=null && vdi_list.contains(compValue))
					userTypeTmp="VDI";
				else if(userType!=null && userType.equalsIgnoreCase("CitrixXenVDI") && vdi_list!=null && !vdi_list.contains(compValue))
					userTypeTmp="XenApp7";

				String url = "/final/monitor/endUserDashboardDetailsData.jsp?comp="+EgURLEncoder.encode(compName,"UTF-8")+"&comptype="+compValue+"&info=*"+EgURLEncoder.encode(url_desktopName,"UTF-8")+"&compName="+EgURLEncoder.encode(compName+":"+compValue,"UTF-8")+"&componentName="+EgURLEncoder.encode(compNameWithOutPort,"UTF-8")+"&msmt_host="+EgURLEncoder.encode(msmtHost,"UTF-8")+"&user="+EgURLEncoder.encode(userName,"UTF-8")+"&searchString="+EgURLEncoder.encode(searchString,"UTF-8")+"&priority="+priority+"&vdiType="+vdiType+"&userType="+userTypeTmp+"&desktopState="+desktopState+"&enableBackButton="+enableBackButton+"&isfromuedoverview="+isFromUEDOverview+"&overviewsearchstr="+overviewSearchStr+"&filterFlag="+filterFlag+"&detail="+detail+"&compCombo="+compCombo+"&showKeyUser="+showKeyUser+"&filterName="+filterName+"&orgUserType="+userType+"&fromVCDSDrilldown="+fromVCDSDrilldown;
				if(isAdtnlSearch)
					url = url+"&adtnlSearchStr="+EgURLEncoder.encode(adtnlSearchStr_EN,"UTF-8");
				
				url=url+"&fromf5="+isfromf5;

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

				if(fromGeoStr!=null && fromGeoStr.trim().length()>0)
				{
					//url=url+"&fromGeo="+fromGeoStr+"&iniName="+iniName+"&user_name="+user_name+"&isUserBased="+isUserBased+"&dashboard_name="+dashboard_name+"&view_name="+view_name+"&dashboard_mapping="+EgURLEncoder.encode(dashboard_mapping,"UTf-8")+"&time_line="+EgURLEncoder.encode(time_line,"UTf-8")+"&ginfo="+EgURLEncoder.encode(geoInfo,"UTf-8")+"&usercountval="+usercountval+"&fromServiceHomePage="+fromServiceHomePage+"&fromZonePage="+fromZonePage+"&selectedTest="+selectedTest+"&selectedMeasure="+selectedMeasure;
					add_url=add_url+"&fromGeo="+fromGeoStr+"&iniName="+iniName+"&user_name="+user_name+"&isUserBased="+isUserBased+"&dashboard_name="+dashboard_name+"&view_name="+view_name+"&dashboard_mapping="+EgURLEncoder.encode(dashboard_mapping,"UTf-8")+"&time_line="+EgURLEncoder.encode(time_line,"UTf-8")+"&ginfo="+EgURLEncoder.encode(geoInfo,"UTf-8")+"&usercountval="+usercountval+"&fromServiceHomePage="+fromServiceHomePage+"&fromZonePage="+fromZonePage+"&selectedTest="+selectedTest+"&selectedMeasure="+EgURLEncoder.encode(selectedMeasure,"UTf-8");
				}

				if(filterBy!=null && filterBy.trim().length()>0)
				{
					//url=url+"&filterBy="+filterBy;
					add_url=add_url+"&filterBy="+filterBy;
				}
				if(priorityFilter!=null && priorityFilter.trim().length()>0 && !priorityFilter.equalsIgnoreCase("NULL"))
				{
					//url=url+"&priorityFilter="+priorityFilter;
					add_url=add_url+"&priorityFilter="+priorityFilter;
				}
				if(gatewayFilter!=null && gatewayFilter.trim().length()>0 && !gatewayFilter.equalsIgnoreCase("NULL"))
				{
					add_url=add_url+"&gatewayFilter="+gatewayFilter;
				}

				if(searchFilter!=null && searchFilter.trim().length()>0)
				{
					//url=url+"&searchFilter="+EgURLEncoder.encode(searchFilter,"UTF-8");
					add_url=add_url+"&searchFilter="+EgURLEncoder.encode(searchFilter,"UTF-8");
				}
				if(nextSearch!=null && nextSearch.trim().length()>0)
				{
					//url=url+"&nextSearch="+EgURLEncoder.encode(nextSearch,"UTF-8");
					add_url=add_url+"&nextSearch="+EgURLEncoder.encode(nextSearch,"UTF-8");
				}
				if(nextSubSearch!=null && nextSubSearch.trim().length()>0)
				{
					//url=url+"&nextSubSearch="+EgURLEncoder.encode(nextSubSearch,"UTF-8");
					add_url=add_url+"&nextSubSearch="+EgURLEncoder.encode(nextSubSearch,"UTF-8");
				}

				url=url+add_url;

				String layer_for_url=egEx.getValue("VMSearch_InsideviewLayer",compValue);
				layer_for_url=(layer_for_url==null)?"VIRTUAL_SERVERS":layer_for_url;
				String tempurl_desktopName="";
				tempurl_desktopName=com.egurkha.util.StringUtils.encodeSecurityChar(url_desktopName);
				if(userType!=null && userType.equalsIgnoreCase("VCDataStore"))
				{	
					//url = "/final/monitor/endUserDashboard.jsp?dscomp="+EgURLEncoder.encode(compName,"UTF-8")+"&dscomptype="+compValue+"&dsInfo=*"+EgURLEncoder.encode(url_desktopName,"UTF-8")+"&dscompName="+EgURLEncoder.encode(compName+":"+compValue,"UTF-8")+"&dscomponentName="+EgURLEncoder.encode(compNameWithOutPort,"UTF-8")+"&dsmsmt_host="+EgURLEncoder.encode(msmtHost,"UTF-8")+"&access=allusers&user="+EgURLEncoder.encode(userName,"UTF-8")+"&userType=VDIESX&priority=&filterFlag=true&filterBy="+filterBy+"&searchFilter="+searchFilter+"&nextSearch="+nextSearch+"&fromMenu=true&vdiType="+vdiType+"&enableBackButton=true&isfromuedoverview=false&isFromVCDS=true&overviewsearchstr="+EgURLEncoder.encode(overviewSearchStr,"UTF-8")+"&priorityFilter=All&searchString="+EgURLEncoder.encode(searchString,"UTF-8");
					url = "/final/monitor/endUserDashboard.jsp?dscomp="+EgURLEncoder.encode(compName,"UTF-8")+"&dscomptype="+compValue+"&dsInfo=*"+EgURLEncoder.encode(tempurl_desktopName,"UTF-8")+"&dscompName="+EgURLEncoder.encode(compName+":"+compValue,"UTF-8")+"&dscomponentName="+EgURLEncoder.encode(compNameWithOutPort,"UTF-8")+"&dsmsmt_host="+EgURLEncoder.encode(msmtHost,"UTF-8")+"&access=allusers&user="+EgURLEncoder.encode(userName,"UTF-8")+"&userType=VDIESX&priority=&filterFlag=true&fromMenu=true&vdiType="+vdiType+"&enableBackButton=true&isfromuedoverview=false&isFromVCDS=true&overviewsearchstr="+EgURLEncoder.encode(overviewSearchStr,"UTF-8")+"&searchString="+EgURLEncoder.encode(searchString,"UTF-8")+add_url+"&detail="+detail+"&compCombo="+compCombo+"&subFilter="+detail;
				}
				else 
				{
					if(userType!=null && userType.equalsIgnoreCase("VDIESX") && ((esx_list!=null && esx_list.contains(compValue)) || (vdi_list!=null && vdi_list.contains(compValue))))
					{
						url ="/final/monitor/egInsideviewDashboard.jsp?getFor=measure&comp="+EgURLEncoder.encode(compName,"UTF-8")+"&comptype="+compValue+"&Layer="+layer_for_url+"&info="+EgURLEncoder.encode(tempurl_desktopName,"UTF-8")+"&compName="+EgURLEncoder.encode(compName+":"+compValue,"UTF-8")+"&msmt_host="+EgURLEncoder.encode(msmtHost,"UTF-8")+"&user="+EgURLEncoder.encode(userName,"UTF-8")+"&searchString="+EgURLEncoder.encode(searchString,"UTF-8")+"&priority="+priority+"&vdiType="+vdiType+"&userType="+userTypeTmp+"&desktopState="+desktopState+"&enableBackButton="+enableBackButton+"&isfromuedoverview="+isFromUEDOverview+"&overviewsearchstr="+overviewSearchStr+"&filterFlag="+filterFlag+"&source=UEDVMs&detail="+detail+"&compCombo="+compCombo+"&orgUserType="+userType+"&subFilter="+detail+add_url;
					}
					else if(userType!=null && userType.equalsIgnoreCase("ESX"))
					{
						url ="/final/monitor/egInsideviewDashboard.jsp?getFor=measure&comp="+EgURLEncoder.encode(compName,"UTF-8")+"&comptype="+compValue+"&Layer="+layer_for_url+"&info="+EgURLEncoder.encode(tempurl_desktopName,"UTF-8")+"&compName="+EgURLEncoder.encode(compName+":"+compValue,"UTF-8")+"&msmt_host="+EgURLEncoder.encode(msmtHost,"UTF-8")+"&user="+EgURLEncoder.encode(userName,"UTF-8")+"&searchString="+EgURLEncoder.encode(searchString_EN,"UTF-8")+"&priority="+priority+"&vdiType="+vdiType+"&userType="+userType+"&desktopState="+desktopState+"&enableBackButton="+enableBackButton+"&isfromuedoverview="+isFromUEDOverview+"&overviewsearchstr="+overviewSearchStr+"&filterFlag="+filterFlag+"&source=UEDVMs&detail="+detail+"&compCombo="+compCombo+"&showKeyUser="+showKeyUser+"&filterName="+filterName;
						if(isAdtnlSearch)
							url = url+"&adtnlSearchStr="+EgURLEncoder.encode(adtnlSearchStr_EN,"UTf-8");
					}
				}

				if(isFromVCDS!=null && (isFromVCDS.equalsIgnoreCase("true") || isFromVCDS.equalsIgnoreCase("yes")) && dscomp!=null && dscomp.trim().length()>0)
				{
					dsInfo=com.egurkha.util.StringUtils.encodeSecurityChar(dsInfo);
					url=url+"&dscomp="+EgURLEncoder.encode(dscomp,"UTF-8")+"&dscomptype="+dscomptype+"&dsInfo="+EgURLEncoder.encode(dsInfo,"UTF-8")+"&dsmsmt_host="+EgURLEncoder.encode(dsmsmt_host,"UTF-8");
				}

				String link ="";
				if((fromMenuStr!=null && !fromMenuStr.equalsIgnoreCase("null") && fromMenuStr.trim().length()>0) || (fromGeoStr!=null && !fromGeoStr.equalsIgnoreCase("null") && fromGeoStr.trim().length()>0))
				{
					//link = "/final/servlet/com.eg.EgDashboardController?site=NULL"+"&from=list&comptype="+EgURLEncoder.encode(compValue,"UTF-8")+"&host="+EgURLEncoder.encode(compName,"UTF-8")+"&tab=LayerModel"+"&enableBackButton="+enableBackButton+"&isfromuedoverview="+isFromUEDOverview+"&overviewsearchstr="+overviewSearchStr+"&filterFlag="+filterFlag;

					String info_to_lower=desktopName;
					String infoKey = compValue+":"+compName+":"+ctype_test+":"+info_to_lower;
					HashSet infosSet = null;
					if(fullInfoHash!=null && fullInfoHash.size()>0)
						infosSet = (HashSet)fullInfoHash.get(infoKey);
					ArrayList infosList = null;
					if(infosSet!=null && infosSet.size()>0)
						infosList = new ArrayList(infosSet);
					String info_name = "";
					if(infosList!=null && infosList.size()>1)
					{
						for(int is=0;is<infosList.size();is++)
						{
							String tmpInfo = (String)infosList.get(is);
							if(tmpInfo!=null && (tmpInfo.endsWith(":Summary") || tmpInfo.endsWith(":Total")))
							{
								info_name = tmpInfo;
								break;
							}
						}
						if(info_name==null || info_name.equalsIgnoreCase("null") || info_name.trim().length()==0)
						{
							info_name = (String)infosList.get(0);
						}
					}
					else if(infosList!=null && infosList.size()==1)
					{
						info_name = (String)infosList.get(0);
					}
					String info_name2="";
					if(info_name==null || info_name.equalsIgnoreCase("null") || info_name.trim().length()==0)
					{
						info_name2 = info_to_lower;
						info_name = "+" + info_to_lower;
					}
					//String linkTest = (isFromGeo)?selectedTest:ctype_test;
					String linkTest = ctype_test;
					if(isFromGeo && !selectedTest.endsWith("_DDD") && selectedTest.startsWith("CtxXcXA") && !selectedTest.equalsIgnoreCase("CtxXcXARegionTest") && !selectedTest.equalsIgnoreCase("CtxXcXACityTest") && !selectedTest.equalsIgnoreCase("CtxXcXACountryTest"))
					{
						linkTest = selectedTest;
					}
					String linkLayer = ctype_layer;
					//if(linkTest != null && linkTest.trim().length() > 0)
						//linkLayer = tablesInfo.getLayerForTest(linkTest);
					if(info_name!=null && info_name.indexOf("\\")!=-1)
						info_name = com.egurkha.util.StringUtils.replace(info_name, "\\", "\\\\");
					
					if(userType!=null && (userType.equalsIgnoreCase("AppXenApp7") || userType.equalsIgnoreCase("AppDDXenApp7") || userType.equalsIgnoreCase("AppVDI") || userType.equalsIgnoreCase("AppDDVDI") || userType.equalsIgnoreCase("AppLaunchDDXenApp7") || userType.equals("OverviewAppXenApp7") || userType.equals("OverviewAppVDI")))
					{
						if(info_name!=null && info_name.indexOf("~SEQ~")>-1)
							info_name=info_name.substring(0,info_name.indexOf("~SEQ~"));
					}
					link = "/final/monitor/EgSiteInfraView.jsp?qctr=2"+"&site=NULL"+"&fromalarm=0"+"&newWindow=false"+"&host="+EgURLEncoder.encode(compName,"UTF-8")+"&msmt_host="+EgURLEncoder.encode(msmtHost,"UTF-8")+"&comptype="+compValue+"&layer="+linkLayer+"&test="+linkTest+"-"+EgURLEncoder.encode(info_name,"UTF-8")+"&tstate=&toDashBoardLayer=true"+"&tab=LayerModel"+"&enableBackButton="+enableBackButton+"&isfromuedoverview="+isFromUEDOverview+"&overviewsearchstr="+overviewSearchStr+"&filterFlag="+filterFlag+"&searchFilter="+searchFilter+"&isFromUEDView=true&showKeyUser="+showKeyUser+"&filterName="+filterName;

					if(userType.equals("OverviewAppXenApp7") || userType.equals("OverviewAppVDI"))
					{
						String newUserType="AppXenApp7";
						if(userType.equals("OverviewAppVDI"))
							newUserType="AppVDI";

						link = "/final/monitor/endUserDashboard.jsp?access=allusers&userType="+newUserType+"&selectedString="+EgURLEncoder.encode(info_name2,"UTF-8")+"&selectedTest="+linkTest+"&enableBackButton=true&overviewType="+userType;

						link=link+"&fromGeo="+fromGeoStr+"&iniName="+iniName+"&user_name="+user_name+"&isUserBased="+isUserBased+"&dashboard_name="+dashboard_name+"&view_name="+view_name+"&dashboard_mapping="+EgURLEncoder.encode(dashboard_mapping,"UTf-8")+"&time_line="+EgURLEncoder.encode(time_line,"UTf-8")+"&ginfo="+EgURLEncoder.encode(geoInfo,"UTf-8")+"&usercountval="+usercountval+"&fromServiceHomePage="+fromServiceHomePage+"&fromZonePage="+fromZonePage+"&selectedTest="+selectedTest+"&selectedMeasure="+EgURLEncoder.encode(selectedMeasure,"UTf-8");
					}
				}
				else
				{
					link = "/final/monitor/endUserDashboardDetailsData.jsp?comp="+EgURLEncoder.encode(compName,"UTF-8")+"&comptype="+compValue+"&info=*"+EgURLEncoder.encode(url_desktopName,"UTF-8")+"&compName="+EgURLEncoder.encode(compName+":"+compValue,"UTF-8")+"&componentName="+EgURLEncoder.encode(compNameWithOutPort,"UTF-8")+"&msmt_host="+EgURLEncoder.encode(msmtHost,"UTF-8")+"&user="+EgURLEncoder.encode(userName,"UTF-8")+"&searchString="+EgURLEncoder.encode(searchString,"UTF-8")+"&priority="+priority+"&vdiType="+vdiType+"&userType="+userType+"&desktopState="+desktopState+"&enableBackButton="+enableBackButton+"&isfromuedoverview="+isFromUEDOverview+"&overviewsearchstr="+overviewSearchStr+"&filterFlag="+filterFlag+"&detail="+detail+"&compCombo="+compCombo+"&showKeyUser="+showKeyUser+"&filterName="+filterName;
					if(isAdtnlSearch)
						url = url+"&adtnlSearchStr="+EgURLEncoder.encode(adtnlSearchStr_EN,"UTf-8");

					link=link+"&fromf5="+isfromf5;
				}

				if(filterBy!=null && filterBy.trim().length()>0)
				{
					link=link+"&filterBy="+filterBy;
				}
				if(searchFilter!=null && searchFilter.trim().length()>0)
				{
					link = link + "&searchFilter="+EgURLEncoder.encode(searchFilter,"UTF-8");
				}
				if(nextSearch!=null && nextSearch.trim().length()>0)
				{
					link = link + "&nextSearch="+EgURLEncoder.encode(nextSearch,"UTF-8");
				}
				if(nextSubSearch!=null && nextSubSearch.trim().length()>0)
				{
					link = link + "&nextSubSearch="+EgURLEncoder.encode(nextSubSearch,"UTF-8");
				}
				if(priorityFilter!=null && priorityFilter.trim().length()>0 && !priorityFilter.equalsIgnoreCase("NULL"))
				{
					link = link + "&priorityFilter="+priorityFilter;
				}
				if(gatewayFilter!=null && gatewayFilter.trim().length()>0 && !gatewayFilter.equalsIgnoreCase("NULL"))
				{
					link = link + "&gatewayFilter="+gatewayFilter;
				}

				if(overviewType!=null && overviewType.trim().length()>0 && !overviewType.equalsIgnoreCase("NULL"))
				{
					link = link + "&overviewType="+overviewType;
				}
				
				if(isFromctx)
				{
					try
					{
						String host_test = ini.getValue("METRIC_VIEW_USER_DESKTOP_TYPES_TEST",userType);
						String host_layer_name = "";
						if(host_test != null && host_test.trim().length() > 0){
							if(host_test.toLowerCase().indexOf("like") != -1){
								if(measureArray != null && measureArray.length > 0){
									String ctx_mesure = measureArray[0];
									ctx_mesure =ctx_mesure.trim();
									host_test = ctx_mesure.substring(0,ctx_mesure.indexOf(":"));
								}
							}else{
								host_test = host_test.substring(0,host_test.indexOf(":"));
							}
						}
						host_layer_name=tablesInfo.getLayerForTest(host_test);
						String ctx_measuresLink = "/final/monitor/EgSiteInfraView.jsp?qctr=2";
						
						if((fromMetricView!=null && fromMetricView.trim().length()>0 && fromMetricView.equalsIgnoreCase("true")) && (url_desktopName!=null && url_desktopName.indexOf("\\")!=-1))
						{
							url_desktopName = com.egurkha.util.StringUtils.replace(url_desktopName, "\\", "\\\\");
							ctx_measuresLink = ctx_measuresLink + "&isFromUEDView=true";
						}

						ctx_measuresLink = ctx_measuresLink +"&site=NULL"+"&fromalarm=0"+"&newWindow=false"+"&host="+EgURLEncoder.encode(compName,"UTF-8")+"&msmt_host="+EgURLEncoder.encode(msmtHost,"UTF-8")+"&comptype="+compValue+"&layer="+host_layer_name+"&test="+host_test+"-"+EgURLEncoder.encode(url_desktopName,"UTF-8")+"&tstate=GOOD&toDashBoardLayer=true"+"&userType="+userType+"&vdiType_SBD="+vdiType_SBD+"&filterName="+filterName;
						if(filterBy!=null && filterBy.trim().length()>0)
						{
							ctx_measuresLink=ctx_measuresLink+"&filterBy="+filterBy+"&subFilter="+subFilter;
						}
						if(isServiceBusiViewMetrics!=null && isServiceBusiViewMetrics.trim().length()>0 && isServiceBusiViewMetrics.equalsIgnoreCase("true"))
						{
							ctx_measuresLink = ctx_measuresLink + "&isServiceBusiViewMetrics="+isServiceBusiViewMetrics+"&treeFlag_SBD="+treeFlag_SBD+"&outsideService_SBD="+outsideService_SBD+"&titleText_SBD="+titleText_SBD+"&selectNode_SBD="+selectNode_SBD+"&serviceFromZone="+serviceName+"&isEmulTrans_SBD="+isEmulTrans_SBD+"&serviceName="+serviceName+"&serviceState_SBD="+serviceState_SBD+"&isServiceBusiDash="+isServiceBusiDash+"&fromMetricView=true";
						}
						if(isfromCitrix!=null && isfromCitrix.trim().length()>0 && isfromCitrix.equalsIgnoreCase("true")){
							ctx_measuresLink = ctx_measuresLink +"&fromMetricView=true&isfromCitrix="+isfromCitrix+"&iniName="+iniName+"&action=loadViewData&user_name="+user_name+"&fromMenu=true&showConfig=true&fromUED=true&dashboard_name="+dashboard_name+"&dashboard_mapping="+dashboard_mapping+"&view_name="+view_name;
						}
						url = ctx_measuresLink+"&filterName="+filterName;
						
					}catch(Exception ctx_url)
					{
					}
				}

				String disp_desktopName=desktopName;

				String strName = compName;
				if (strName.endsWith(EgConstants.NULL_PORT) && (strName.indexOf(EgConstants.NULL_PORT) > -1))
					strName = Server.getServerNameWithoutPort(strName, false);

				String disp_StrName = strName;
				measure.put("systemIconClass","eud_"+desktopState);
				measure.put("systemIconTitle",desktopState);

				if(userType!=null && (userType.equalsIgnoreCase("AppXenApp7") || userType.equalsIgnoreCase("AppDDXenApp7") || userType.equals("AppLaunchDDXenApp7") || userType.equalsIgnoreCase("AppVDI") || userType.equalsIgnoreCase("AppDDVDI") || userType.equalsIgnoreCase("AppLaunchDDXenApp7") || userType.equals("OverviewAppXenApp7") || userType.equals("OverviewAppVDI")))
				{
					measure.put("layerModelUrl",link);

					if(disp_desktopName.indexOf("~SEQ~")>-1)
					{
						disp_desktopName=disp_desktopName.substring(0,disp_desktopName.indexOf("~SEQ~"));
					}
				}
				else
				{
					measure.put("layerModelUrl",url);
				}

				measure.put("systemTitle",disp_desktopName);
				measure.put("system",disp_desktopName);
				
				if(!isFromctx && !isOnlyVMAssigned && !userType.equals("OverviewAppXenApp7") && !userType.equals("OverviewAppVDI"))
				{
					measure.put("layerModelUrl1",link);
					measure.put("systemTitle1",disp_StrName);
					measure.put("system1",disp_StrName);
				}

				measureList = Arrays.asList(measureArray);
				boolean isAllNeg=true;
				if(measureValues!=null && measureValues.size()>0)
				{
					String ctype_out_layer=ui.getValue("Layer_for_ComponentType",compValue);
					ctype_out_layer=(ctype_out_layer==null || ctype_out_layer.trim().length()==0)?"VIRTUAL_GUESTS":ctype_out_layer;
					ArrayList listOfTest=(ArrayList)tablesInfo.getTestsForLayer(ctype_out_layer,compValue);

					if(userType!=null && (userType.equals("CitrixXenVDI") || userType.equals("VDI") || userType.equals("ESX")))
					{
						String ctype_in_layer=ini.getValue("USER_DESKTOP_LAYERS",compValue);
						ctype_in_layer=(ctype_in_layer==null || ctype_in_layer.trim().length()==0)?"VIRTUAL_DESKTOP":ctype_in_layer;
						listOfTest.addAll((ArrayList)tablesInfo.getTestsForLayer(ctype_in_layer,compValue));
					}
					int p=0;
					String info_to_lower=desktopName;
					Hashtable temp_Desc_Hash= new Hashtable();
					Hashtable temp_Test_Hash= new Hashtable();
					while(p<measureList.size())
					{
						String keyForList=(String)measureList.get(p);
						String keyMeasure="";
						String keyOrgMeasure="";
						String keyTest="";
						String keydisplayMeasure="";
						StringTokenizer valTokens = new StringTokenizer(keyForList,":");
						int tokCount = valTokens.countTokens();
						boolean isDDDTestColumn = false;
						boolean isLocationColumn = false;

						boolean isCheckMeasureValue = false;
						if(secondPosMeaVal!=null && secondPosMeaVal.trim().length()>0 && keyForList!=null && keyForList.equals(secondPosMeaVal))
							isCheckMeasureValue = true;

						if(tokCount==5)
							isDDDTestColumn = true;
						else if(tokCount==2)
							isLocationColumn = true;

						String orgColName = "";
						String funcName = "";
						String dispName = "";
						String tempDispName = "";
						String locKeyName = "";
						String Value="";
						String units="";
						
						ArrayList keyMeasureList = null; 
						ArrayList locMeasuresList = new ArrayList(); 

						if(isDDDTestColumn || (!isLocationColumn))
						{
							if(isDDDTestColumn)
							{
								if(keyForList!=null && keyForList.indexOf(":")>-1)
								{
									keyTest=keyForList.substring(0,keyForList.indexOf(":"));
									keyMeasure=keyForList.substring(keyForList.indexOf(":")+1);
									if(keyMeasure!=null && keyMeasure.indexOf(":")>-1)
									{
										orgColName=keyMeasure.substring(keyMeasure.indexOf(":")+1);
										keyMeasure = keyMeasure.substring(0,keyMeasure.indexOf(":"));
										if(orgColName!=null && orgColName.indexOf(":")>-1)
										{
											funcName=orgColName.substring(orgColName.indexOf(":")+1);
											orgColName = orgColName.substring(0,orgColName.indexOf(":"));

											if(funcName!=null && funcName.indexOf(":")>-1)
											{
												dispName=funcName.substring(funcName.indexOf(":")+1);
												funcName = funcName.substring(0,funcName.indexOf(":"));
											}
										}
									}
								}
							}
							else
							{
								if(keyForList!=null && keyForList.indexOf(":")>-1)
								{
									keyTest=keyForList.substring(0,keyForList.indexOf(":"));
									keyMeasure=keyForList.substring(keyForList.indexOf(":")+1);
									if(keyMeasure!=null && keyMeasure.indexOf(":")>-1)
									{
										dispName=keyMeasure.substring(keyMeasure.indexOf(":")+1);
										keyMeasure=keyMeasure.substring(0,keyMeasure.indexOf(":"));
									}
								}
							}

							if(keyTest!=null && keyTest.trim().length()>0 && listOfTest!=null && listOfTest.size()>0 && !listOfTest.contains(keyTest) && dispName!=null)
							{
								ArrayList tmpArry=(ArrayList)sameLabelHash.get(dispName);
								if(tmpArry!=null && tmpArry.size()>0)
								{
									for(int kk=0;kk<tmpArry.size();kk++)
									{
										String newKeyForList =(String)tmpArry.get(kk);
										String newKeyTest=null;
										if(newKeyForList!=null && newKeyForList.indexOf(":")>-1)
										{
											newKeyTest=newKeyForList.substring(0,newKeyForList.indexOf(":"));
										}

										if(newKeyTest!=null && newKeyTest.trim().length()>0 && listOfTest!=null && listOfTest.contains(newKeyTest))
										{
											keyForList = newKeyForList;
											if(isDDDTestColumn)
											{
												if(keyForList!=null && keyForList.indexOf(":")>-1)
												{
													keyTest=keyForList.substring(0,keyForList.indexOf(":"));
													keyMeasure=keyForList.substring(keyForList.indexOf(":")+1);
													if(keyMeasure!=null && keyMeasure.indexOf(":")>-1)
													{
														orgColName=keyMeasure.substring(keyMeasure.indexOf(":")+1);
														keyMeasure = keyMeasure.substring(0,keyMeasure.indexOf(":"));
														if(orgColName!=null && orgColName.indexOf(":")>-1)
														{
															funcName=orgColName.substring(orgColName.indexOf(":")+1);
															orgColName = orgColName.substring(0,orgColName.indexOf(":"));

															if(funcName!=null && funcName.indexOf(":")>-1)
															{
																dispName=funcName.substring(funcName.indexOf(":")+1);
																funcName = funcName.substring(0,funcName.indexOf(":"));
															}
														}
													}
												}
											}
											else
											{
												if(keyForList!=null && keyForList.indexOf(":")>-1)
												{
													keyTest=keyForList.substring(0,keyForList.indexOf(":"));
													keyMeasure=keyForList.substring(keyForList.indexOf(":")+1);
													if(keyMeasure!=null && keyMeasure.indexOf(":")>-1)
													{
														dispName=keyMeasure.substring(keyMeasure.indexOf(":")+1);
														keyMeasure=keyMeasure.substring(0,keyMeasure.indexOf(":"));
													}
												}
											}

											break;
										}
									}
								}
							}
						}

						if(isDDDTestColumn)
						{
							String colKeyName = Dbdata.getColumnForMeasure(keyTest+"_DDD",orgColName);
							String tmpK = colKeyName+"^"+info_to_lower.toLowerCase()+"^"+compNameWithOutPort;
							keydisplayMeasure = dispName;
							Value=getMeasureValue(measureValues,keyTest,colKeyName,info_to_lower,compNameWithOutPort);
							if(keyMeasure!=null && keyMeasure.trim().length()>0)
								keyOrgMeasure = keyMeasure;
							Value = getManagerTimeToUserTimeConvertion(egFormat,convert,user,keyTest,orgColName,Value);	
						}
						else if(isShowUserLocation && isLocationColumn)
						{
							if(keyForList!=null && keyForList.indexOf(":")>-1)
							{
								keyTest = keyForList.substring(0,keyForList.indexOf(":"));
								keyMeasure = keyForList.substring(keyForList.indexOf(":")+1);
							}

							funcName ="NONE";

							if(keyMeasure!=null && keyMeasure.trim().length()>0)
							{
								keyMeasureList = StringUtils.egTokenizer(keyMeasure,"~$~",true,false,true);//param 3-->includeEmpty,4-->unique,5-->trim
								if(keyMeasureList!=null && keyMeasureList.size()>0)
								{
									int meaListSize=keyMeasureList.size();
									if(meaListSize==1)
										locKeyName = (String)keyMeasureList.get(0);
									else if(meaListSize>1)
										locKeyName = (String)keyMeasureList.get(0);

									Value=getMeasureValue(measureValues,keyTest,locKeyName,info_to_lower,compNameWithOutPort);
									if(meaListSize==1 && strSeparator!=null && strSeparator.trim().length()>0 && strReplaceSep!=null && strReplaceSep.trim().length()>0 && Value!=null && !Value.equals("-"))
										Value = com.egurkha.util.StringUtils.replace(Value,strSeparator,strReplaceSep);
								}
							}
						}
						else
						{
							if(keyForList!=null && keyForList.indexOf(":")>-1)
							{
								keyTest=keyForList.substring(0,keyForList.indexOf(":"));
								keyMeasure=keyForList.substring(keyForList.indexOf(":")+1);
								if(keyMeasure!=null && keyMeasure.indexOf(":")>-1)
								{
									keydisplayMeasure=keyMeasure.substring(keyMeasure.indexOf(":")+1);
									keyMeasure=keyMeasure.substring(0,keyMeasure.indexOf(":"));
								}
							}
							units=tablesInfo.getUnitForMeasure(keyTest,keyMeasure);
							keyOrgMeasure = keyMeasure;
							keyMeasure = Dbdata.getColumnForMeasure(keyTest,keyMeasure);
							if(specsInfo.isTestRelevantForServer(compValue,keyTest))
							{
								Value=getMeasureValue(measureValues,keyTest,keyMeasure,info_to_lower,compNameWithOutPort);
							}
						}

						//if((Value==null || Value.trim().length()==0) && compValue!=null && compValue.equals("Xen_desktop_server"))
						if(Value==null || Value.trim().length()==0)
						{
							if(info_to_lower!=null && (info_to_lower.indexOf(" ")>-1 && info_to_lower.indexOf("on")>-1))
							{
								ArrayList tokenList =  com.egurkha.util.StringUtils.egTokenizer(info_to_lower, " on ",false,false,true);//param 3-->includeEmpty,4-->unique,5-->trim
								if(tokenList!=null && tokenList.size()==2)
									info_to_lower=(String)tokenList.get(0)+"_on_"+(String)tokenList.get(1);
							}
							Value=getMeasureValue(measureValues,keyTest,keyMeasure,info_to_lower,compNameWithOutPort);
						}
						
						String mes_state="";
						String mes_name="";
						String total_spc="0";

						if(Value!=null && Value.indexOf("^")>-1)
						{
							mes_state=Value.substring(Value.indexOf("^")+1);
							if(mes_state!=null && mes_state.indexOf("^")>-1)
							{
								mes_name=mes_state.substring(mes_state.indexOf("^")+1);
								mes_state=mes_state.substring(0,mes_state.indexOf("^"));
								if(mes_name!=null && mes_name.indexOf("^")>-1)
								{
									total_spc=mes_name.substring(mes_name.indexOf("^")+1);
									mes_name=mes_name.substring(0,mes_name.indexOf("^"));
								}
							}
							Value=Value.substring(0,Value.indexOf("^"));
						}
						else if(Value==null)
						{
							Value="-";
							mes_name=keyMeasure;
							mes_state="GOOD";
						}

						boolean sameLabelFlag=false;
						if(sameLabelHash!=null && sameLabelHash.size()>0 && keydisplayMeasure!=null && sameLabelHash.containsKey(keydisplayMeasure))
						{
							ArrayList tmpArry2=(ArrayList)sameLabelHash.get(keydisplayMeasure);
							ArrayList tmpNewArry=new ArrayList();
							tmpNewArry.addAll(tmpArry2);
							if(userType!=null && !userType.equals("CitrixXenVDI"))
							{
								if(tmpNewArry!=null && tmpNewArry.size()>0 && keyForList!=null && tmpNewArry.contains(keyForList))
									tmpNewArry.remove(keyForList);
							}
							if(tmpNewArry!=null && tmpNewArry.size()>0)
							{
								sameLabelFlag=true;
								if(!dashboardModel.isTestActive(compValue, compName, keyTest, "custom"))
									Value="-";
							}
						}
						
						if((Value==null || Value.equals("-")) && sameLabelFlag && (sameLabelHash!=null && sameLabelHash.size()>0 && sameLabelHash.containsKey(keydisplayMeasure)))
						{
							ArrayList tmpArry3=(ArrayList)sameLabelHash.get(keydisplayMeasure);
							ArrayList tmpOldArry=new ArrayList();
							if(tmpArry3!=null && tmpArry3.size()>0)
							{
								tmpOldArry.addAll(tmpArry3);
								if(tmpOldArry.contains(keyForList))
								{
									tmpOldArry.remove(keyForList);
								}
								for(int kk=0;kk<tmpOldArry.size();kk++)
								{
									keyForList =(String)tmpOldArry.get(kk);
									String tmp_keyTest=null;
									String tmp_keyMeasure=null;
									String tmp_keydisplayMeasure=null;
									String tmp_keyDDMeasure=null;
									//String tmp_units=null;
									if(keyForList!=null && keyForList.indexOf(":")>-1)
									{
										ArrayList keyTokenList =  com.egurkha.util.StringUtils.egTokenizer(keyForList, ":",true,false,true);//param 3-->includeEmpty,4-->unique,5-->trim
										if(keyTokenList!=null && keyTokenList.size()==3)
										{
											tmp_keyTest=(String)keyTokenList.get(0);
											tmp_keyMeasure=(String)keyTokenList.get(1);
											tmp_keydisplayMeasure=(String)keyTokenList.get(2);
											//tmp_units=tablesInfo.getUnitForMeasure(tmp_keyTest,tmp_keyMeasure);
										}
										else if(keyTokenList!=null && keyTokenList.size()==5)//VmgPcoIPSessionTest:Round_trip:ClientIp:NONE:Client IP
										{
											tmp_keyTest=(String)keyTokenList.get(0);
											tmp_keyMeasure=(String)keyTokenList.get(1);
											tmp_keyDDMeasure=(String)keyTokenList.get(2);
											//tmp_units=(String)keyTokenList.get(3);
											tmp_keydisplayMeasure=(String)keyTokenList.get(4);
										}
									}
									
									//String tmp_units=tablesInfo.getUnitForMeasure(tmp_keyTest,tmp_keyMeasure);
									String tmp_keyOrgMeasure = tmp_keyMeasure;
									if(tmp_keyDDMeasure!=null)
										tmp_keyMeasure = Dbdata.getColumnForMeasure(tmp_keyTest+"_DDD",tmp_keyDDMeasure);
									else
										tmp_keyMeasure = Dbdata.getColumnForMeasure(tmp_keyTest,tmp_keyMeasure);

									String tmp_Value=null;
									boolean isTimeout = false;
									if(tmp_keyDDMeasure==null)
										isTimeout = isTimeoutCheck(compName,tmp_keyTest,msmtHost,compValue,info_to_lower);

									if(!isTimeout)
									{
										if(specsInfo.isTestRelevantForServer(compValue,tmp_keyTest))
										{
											tmp_Value=getMeasureValue(measureValues,tmp_keyTest,tmp_keyMeasure,info_to_lower,compNameWithOutPort);
											if(tmp_Value==null || tmp_Value.trim().length()==0)
											{
												if(info_to_lower!=null && (info_to_lower.indexOf(" ")>-1 && info_to_lower.indexOf("on")>-1))
												{
													ArrayList tokenList =  com.egurkha.util.StringUtils.egTokenizer(info_to_lower, " on ",false,false,true);//param 3-->includeEmpty,4-->unique,5-->trim
													if(tokenList!=null && tokenList.size()==2)
														info_to_lower=(String)tokenList.get(0)+"_on_"+(String)tokenList.get(1);
												}
												tmp_Value=getMeasureValue(measureValues,tmp_keyTest,tmp_keyMeasure,info_to_lower,compNameWithOutPort);
											}
										}

										if(tmp_Value!=null && tmp_Value.indexOf("^")>-1)
										{
											String tmp_mes_state=tmp_Value.substring(tmp_Value.indexOf("^")+1);
											String tmp_total_spc=null;
											String tmp_mes_name=null;
											if(tmp_mes_state!=null && tmp_mes_state.indexOf("^")>-1)
											{
												tmp_mes_name=tmp_mes_state.substring(tmp_mes_state.indexOf("^")+1);
												tmp_mes_state=tmp_mes_state.substring(0,tmp_mes_state.indexOf("^"));
												if(tmp_mes_name!=null && tmp_mes_name.indexOf("^")>-1)
												{
													total_spc=tmp_mes_name.substring(tmp_mes_name.indexOf("^")+1);
													tmp_mes_name=tmp_mes_name.substring(0,tmp_mes_name.indexOf("^"));
												}
											}
											tmp_Value=tmp_Value.substring(0,tmp_Value.indexOf("^"));

											if(tmp_Value!=null && !tmp_Value.trim().equals("-"))
											{
												keyTest=tmp_keyTest;
												keyMeasure=tmp_keyMeasure;
												keyOrgMeasure = tmp_keyOrgMeasure;
												Value=tmp_Value;
												total_spc= tmp_total_spc;
												mes_name=tmp_mes_name;
												mes_state=tmp_mes_state;
												break;
											}
										}
									}
								}
							}
						}
						String desc_key=compNameWithOutPort+":"+port+":"+compValue+":"+keyTest;
						Vector getDescs = (Vector)temp_Desc_Hash.get(desc_key);
						if(getDescs==null || getDescs.size()==0)
						{
							getDescs=(Vector)dashboardDAO.getDescriptorsForTest(compNameWithOutPort+":"+port, compValue, keyTest, "custom");
							if(getDescs!=null && getDescs.size()>0)
								temp_Desc_Hash.put(desc_key,(Vector)getDescs);
						}
						String test_key=compValue+":"+compNameWithOutPort+":"+port;
						Hashtable getTests = (Hashtable)temp_Test_Hash.get(test_key);
						if(getTests==null || getTests.size()==0)
						{
							getTests =(Hashtable) metaTest.get(test_key);
							if(getTests!=null)
								temp_Test_Hash.put(test_key,getTests);
						}
						
						String meaLenVal="";
						if(finalallMeasureDataLen!=null && finalallMeasureDataLen.size()>0)
						{
							meaLenVal=(String)finalallMeasureDataLen.get(keyMeasure+"_Length");
						}
						if(meaLenVal!=null && meaLenVal.length()>0)
						{
							int mVal = Integer.parseInt(meaLenVal);
							String mvalSt="";
							//if(mVal<5)
							//{
								mVal=mVal*7;
								mvalSt=String.valueOf(mVal);
							/*}
							else if(mVal==5)
							{
								mVal=mVal*7;
								mvalSt=String.valueOf(mVal);
							}else if(mVal>5)
							{
								mVal=mVal*7;
								mvalSt=String.valueOf(mVal);
							}*/
							if(units!=null && !units.equals("%"))
							{
								measure.put(p+"MeasureValueLenWidth",mvalSt);
							}
						}
						
						String orgValue="0.0";
						String result_Val=getValueForDouble(Value,decimalFormatTestMeasureList,convertToDaysTestMeasureList, keyTest,keyOrgMeasure,egDashboard);
						if(result_Val !=null && result_Val.trim().length() >0 && result_Val.indexOf("~$~")>-1)
						{
							Value=result_Val.substring(0,result_Val.indexOf("~$~"));
							orgValue=result_Val.substring(result_Val.indexOf("~$~")+3);
						}
						
						if(!isFromctx && !isOnlyVMAssigned && !userType.equals("OverviewAppXenApp7") && !userType.equals("OverviewAppVDI"))
						{
							columns.getJSONObject(p+2).put("textType", "asFloat");
							columns.getJSONObject(p+2).put("dataIndex",p+"MeasureValue");
						}
						else
						{
							columns.getJSONObject(p+1).put("textType", "asFloat");
							columns.getJSONObject(p+1).put("dataIndex",p+"MeasureValue");
						}

						if(Value!=null && (Value.equalsIgnoreCase("0.0") || Value.equalsIgnoreCase("0.00")))
						{
							Value="0";
						}
						Value = formatDbValue(Value);

						String iniVar=keyTest+":"+keyOrgMeasure+":"+Value;
						boolean isMDV=false;
						String iniValue=(String)egUi.getValue("Measure_value_display",iniVar);
						if(iniValue!=null && iniValue.trim().length()>0)
						{
							Value = iniValue;
							isMDV=true;
						}

						if(isCheckMeasureValue)
						{
							if(Value!=null && extra_filter!=null && extra_filter.trim().length()>0 && !Value.equals(extra_filter))
							{
								measure = new JSONObject();
								break;
							}
						}
						measure.put(p+"MeasureValue",Value);
						measure.put(p+"MeasureValueState",mes_state);
						if(mes_state==null || mes_state.trim().length()==0 || mes_state.equalsIgnoreCase("NONE"))
							mes_state="GOOD";

						String measuresLink = "";

						if( (fromMetricView!=null && fromMetricView.equalsIgnoreCase("true"))  || (fromMenuStr!=null && !fromMenuStr.equalsIgnoreCase("null") && fromMenuStr.trim().length()>0 && fromMenuStr.equalsIgnoreCase("true")) || (fromGeoStr!=null && !fromGeoStr.equalsIgnoreCase("null") && fromGeoStr.trim().length()>0))
						{
							String layerName = tablesInfo.getRelevantLayer(compValue,keyTest,keyOrgMeasure);
							layerName=(layerName==null || layerName.trim().length()==0)?ctype_layer:layerName;
							
							String infoKey = compValue+":"+compName+":"+keyTest+":"+info_to_lower;
							HashSet infosSet = null;
							if(fullInfoHash!=null && fullInfoHash.size()>0)
								infosSet = (HashSet)fullInfoHash.get(infoKey);
							ArrayList infosList = null;
							if(infosSet!=null && infosSet.size()>0)
								infosList = new ArrayList(infosSet);
							String info_name = "";
							if(infosList!=null && infosList.size()>1)
							{
								for(int is=0;is<infosList.size();is++)
								{
									String tmpInfo = (String)infosList.get(is);
									if(tmpInfo!=null && (tmpInfo.endsWith(":Summary") || tmpInfo.endsWith(":Total")))
									{
										info_name = tmpInfo;
										break;
									}
								}
								if(info_name==null || info_name.equalsIgnoreCase("null") || info_name.trim().length()==0)
									info_name = (String)infosList.get(0);
							}
							else if(infosList!=null && infosList.size()==1)
								info_name = (String)infosList.get(0);

							if(info_name==null || info_name.equalsIgnoreCase("null") || info_name.trim().length()==0)
								info_name = "+" + info_to_lower;

							ArrayList testData = new ArrayList();
							if(keyTest!=null && keyTest.length()>0 && testDetails!=null && testDetails.size()>0)
								testData = (ArrayList)testDetails.get(keyTest);
							
							String meta_info=info_name;
							String tmp_info_name = info_name;
							boolean isAddEntry=false;
							if(testData!=null && testData.size()>0)
							{
								isAddEntry=true;
								if(testData!=null && testData.size()>3)
								{
									meta_info=info_name;
								}
								else if(testData!=null && testData.size()==3)
								{
									meta_info=(String)testData.get(1);
									if(meta_info!=null && tmp_info_name!=null && meta_info.equals(tmp_info_name))
									{
										meta_info=tmp_info_name;
									}
									else
									{
										if(meta_info!=null && meta_info.trim().equals("+"))
											meta_info=meta_info;
									}
								}
							}
							
							//measuresLink = "/final/monitor/EgSiteInfraView.jsp?qctr=2"+"&site=NULL"+"&fromalarm=0"+"&newWindow=false"+"&host="+EgURLEncoder.encode(compName,"UTF-8")+"&msmt_host="+EgURLEncoder.encode(msmtHost,"UTF-8")+"&comptype="+compValue+"&layer="+layerName+"&test="+keyTest+"-"+EgURLEncoder.encode(info_name,"UTF-8")+"&tstate="+mes_state+"&toDashBoardLayer=true"+"&userType="+userType+"&vdiType_SBD="+vdiType_SBD;
							if (info_name!=null && info_name.indexOf("\\")!=-1)
								info_name = com.egurkha.util.StringUtils.replace(info_name,"\\","\\\\");
							if (meta_info!=null && meta_info.indexOf("\\")!=-1)
								meta_info = com.egurkha.util.StringUtils.replace(meta_info,"\\","\\\\");
							if(isAddEntry)
							{
								if(userType!=null && userType.equalsIgnoreCase("ESX"))
								{
									if(fromMetricView!=null && fromMetricView.trim().length()>0 && fromMetricView.equalsIgnoreCase("true"))
									{
										measuresLink = "/final/monitor/EgSiteInfraView.jsp?qctr=2"+"&site=NULL"+"&fromalarm=0"+"&newWindow=false"+"&host="+EgURLEncoder.encode(compName,"UTF-8")+"&msmt_host="+EgURLEncoder.encode(msmtHost,"UTF-8")+"&comptype="+compValue+"&layer="+layerName+"&test="+keyTest+"-"+EgURLEncoder.encode(info_name,"UTF-8")+"&tstate="+mes_state+"&toDashBoardLayer=true"+"&userType="+userType+"&vdiType_SBD="+vdiType_SBD+"&filterName="+filterName;
									}
									else
									{
										measuresLink ="/final/monitor/egInsideviewDashboard.jsp?getFor=measure&comp="+EgURLEncoder.encode(compName,"UTF-8")+"&comptype="+compValue+"&Layer="+layer_for_url+"&info="+EgURLEncoder.encode(url_desktopName,"UTF-8")+"&compName="+EgURLEncoder.encode(compName+":"+compValue,"UTF-8")+"&msmt_host="+EgURLEncoder.encode(msmtHost,"UTF-8")+"&user="+EgURLEncoder.encode(userName,"UTF-8")+"&searchString="+EgURLEncoder.encode(searchString_EN,"UTF-8")+"&priority="+priority+"&vdiType="+vdiType+"&userType="+userType+"&desktopState="+desktopState+"&enableBackButton="+enableBackButton+"&isfromuedoverview="+isFromUEDOverview+"&overviewsearchstr="+overviewSearchStr+"&filterFlag="+filterFlag+"&source=UEDVMs&layer="+layerName+"&test="+keyTest+"-"+EgURLEncoder.encode(meta_info,"UTF-8")+"&tstate="+mes_state+"&vdiType_SBD="+vdiType_SBD+"&detail="+detail+"&compCombo="+compCombo+"&filterName="+filterName;
										if(isAdtnlSearch)
											url = url+"&adtnlSearchStr="+EgURLEncoder.encode(adtnlSearchStr_EN,"UTf-8");

									}
								}
								else
									measuresLink = "/final/monitor/EgSiteInfraView.jsp?&qctr=2"+"&site=NULL"+"&fromalarm=0"+"&newWindow=false"+"&host="+EgURLEncoder.encode(compName,"UTF-8")+"&msmt_host="+EgURLEncoder.encode(msmtHost,"UTF-8")+"&comptype="+compValue+"&layer="+layerName+"&test="+keyTest+"-"+EgURLEncoder.encode(meta_info,"UTF-8")+"&tstate="+mes_state+"&toDashBoardLayer=true"+"&userType="+userType+"&vdiType_SBD="+vdiType_SBD+"&filterName="+filterName;
								
								if(fromMenuStr!=null && fromMenuStr.trim().length()>0)
								{
									measuresLink=measuresLink+"&fromMenu="+fromMenuStr;
								}
								if(fromGeoStr!=null && fromGeoStr.trim().length()>0)
								{
									measuresLink=measuresLink+"&fromGeo="+fromGeoStr+"&iniName="+iniName+"&user_name="+user_name+"&isUserBased="+isUserBased+"&dashboard_name="+dashboard_name+"&view_name="+view_name+"&dashboard_mapping="+EgURLEncoder.encode(dashboard_mapping,"UTf-8")+"&time_line="+EgURLEncoder.encode(time_line,"UTf-8")+"&ginfo="+EgURLEncoder.encode(geoInfo,"UTf-8")+"&usercountval="+usercountval+"&fromServiceHomePage="+fromServiceHomePage+"&fromZonePage="+fromZonePage+"&selectedTest="+selectedTest+"&selectedMeasure="+EgURLEncoder.encode(selectedMeasure,"UTf-8");
								}

								if(filterBy!=null && filterBy.trim().length()>0)
								{
									measuresLink=measuresLink+"&filterBy="+filterBy;
								}

								if(searchFilter!=null && searchFilter.trim().length()>0)
								{
									measuresLink=measuresLink+"&searchFilter="+EgURLEncoder.encode(searchFilter,"UTF-8");
								}
								if(nextSearch!=null && nextSearch.trim().length()>0)
								{
									measuresLink=measuresLink+"&nextSearch="+EgURLEncoder.encode(nextSearch,"UTF-8");
								}
								if(nextSubSearch!=null && nextSubSearch.trim().length()>0)
								{
									measuresLink=measuresLink+"&nextSubSearch="+EgURLEncoder.encode(nextSubSearch,"UTF-8");
								}
							}
							else
							{
								if(keyTest!=null && keyTest.length()>0 && keyTest.equalsIgnoreCase("GeoDetails"))
								{
									if(user_test!=null && user_test.length()>0)
									{
										if(user_test.indexOf(":")>-1)
											user_test = user_test.substring(0,user_test.indexOf(":"));
									}
									if(user_test!=null && user_test.indexOf("Vmg")>-1)
									{
										user_test="VmgOSMemoryTest";
									}
									measuresLink = "/final/monitor/EgSiteInfraView.jsp?qctr=2"+"&site=NULL"+"&fromalarm=0"+"&newWindow=false"+"&host="+EgURLEncoder.encode(compName,"UTF-8")+"&msmt_host="+EgURLEncoder.encode(msmtHost,"UTF-8")+"&comptype="+compValue+"&layer="+layerName+"&test="+user_test+"-"+EgURLEncoder.encode(info_name,"UTF-8")+"&tstate="+mes_state+"&toDashBoardLayer=true"+"&userType="+userType+"&vdiType_SBD="+vdiType_SBD+"&filterName="+filterName;
								}
								else
								{
									measuresLink = "/final/monitor/EgSiteInfraView.jsp?qctr=2"+"&site=NULL"+"&fromalarm=0"+"&newWindow=false"+"&host="+EgURLEncoder.encode(compName,"UTF-8")+"&msmt_host="+EgURLEncoder.encode(msmtHost,"UTF-8")+"&comptype="+compValue+"&layer="+layerName+"&test="+keyTest+"-"+EgURLEncoder.encode(info_name,"UTF-8")+"&tstate="+mes_state+"&toDashBoardLayer=true"+"&userType="+userType+"&vdiType_SBD="+vdiType_SBD+"&filterName="+filterName;
								}
							}
							if(filterBy!=null && filterBy.trim().length()>0)
								measuresLink = measuresLink+"&filterBy="+filterBy+"&subFilter="+subFilter;
							if(isServiceBusiViewMetrics!=null && isServiceBusiViewMetrics.trim().length()>0 && isServiceBusiViewMetrics.equalsIgnoreCase("true"))
							{
								measuresLink = measuresLink + "&isServiceBusiViewMetrics="+isServiceBusiViewMetrics+"&treeFlag_SBD="+treeFlag_SBD+"&outsideService_SBD="+outsideService_SBD+"&titleText_SBD="+titleText_SBD+"&selectNode_SBD="+selectNode_SBD+"&serviceFromZone="+serviceName+"&isEmulTrans_SBD="+isEmulTrans_SBD+"&serviceName="+serviceName+"&serviceState_SBD="+serviceState_SBD+"&isServiceBusiDash="+isServiceBusiDash+"&fromMetricView=true";
							}
							if(isfromCitrix!=null && isfromCitrix.trim().length()>0 && isfromCitrix.equalsIgnoreCase("true")){
								measuresLink = measuresLink +"&fromMetricView=true&isfromCitrix="+isfromCitrix+"&iniName="+iniName+"&action=loadViewData&user_name="+user_name+"&fromMenu=true&showConfig=true&fromUED=true&dashboard_name="+dashboard_name+"&dashboard_mapping="+dashboard_mapping+"&view_name="+view_name;
							}
							if(priorityFilter!=null && priorityFilter.trim().length()>0 && !priorityFilter.equalsIgnoreCase("NULL"))
								measuresLink=measuresLink+"&priorityFilter="+priorityFilter;
							if(gatewayFilter!=null && gatewayFilter.trim().length()>0 && !gatewayFilter.equalsIgnoreCase("NULL"))
								measuresLink=measuresLink+"&gatewayFilter="+gatewayFilter;
							
							measuresLink = measuresLink + "&isFromUEDView=true";
						}
						
						if(Value!=null && !Value.trim().equals("-"))
						{
							isAllNeg = false;
							if(funcName!=null && (funcName.equalsIgnoreCase("NONE") || funcName.equalsIgnoreCase("DATE")))
								measure.put(p+"MeasureValueFtype",new Boolean(true));
							else
								measure.put(p+"MeasureValueFtype",new Boolean(false));

							if(units!=null && units.equals("%") && (!isMDV))
							{
								int columnWidth = 100;
								Long tempValue=new Long(Math.round(Double.parseDouble(Value)));
								long fillColorValue=tempValue.longValue();
								long tempValue2 = (fillColorValue*100)/columnWidth;
								measure.put(p+"MeasureValueWidth",tempValue2);
							}
							
							//measureValueUrl="/final/monitor/EgSiteInfraView.jsp?qctr=2"+"&site=NULL"+"&fromalarm=0"+"&newWindow=false"+"&host="+EgURLEncoder.encode(compName,"UTF-8")+"&msmt_host="+EgURLEncoder.encode(msmtHost,"UTF-8")+"&comptype="+compValue+"&layer="+host_layer_name+"&test="+host_test+"-"+EgURLEncoder.encode(url_desktopName,"UTF-8")+"&tstate=GOOD&toDashBoardLayer=true";
						
							String paramForBackButton ="isFromZoneMenu&iszoneName&parentZone&fromHomepage&fromPageView&filterBy";
							StringTokenizer paramForBack = new StringTokenizer(paramForBackButton,"&");
							String keyParam="";
							while(paramForBack.hasMoreTokens())
							{
								keyParam = (String) paramForBack.nextToken();
								String requestParam=request.getParameter(keyParam);
								
								if(link.indexOf(keyParam)<0 && requestParam!= null && !requestParam.equalsIgnoreCase("") && !requestParam.equalsIgnoreCase("NULL"))
									link+="&"+keyParam+"="+requestParam;
								
								if(measuresLink.indexOf(keyParam)<0 && requestParam!= null && !requestParam.equalsIgnoreCase("") && !requestParam.equalsIgnoreCase("NULL"))
									measuresLink+="&"+keyParam+"="+requestParam;
								
								if(url.indexOf(keyParam)<0 && requestParam!= null && !requestParam.equalsIgnoreCase("") && !requestParam.equalsIgnoreCase("NULL"))
									url+="&"+keyParam+"="+requestParam;
							}

							if(!isOnlyVMAssigned)
							{
								if(userType!=null && (userType.equalsIgnoreCase("AppXenApp7") || userType.equalsIgnoreCase("AppDDXenApp7") || userType.equals("AppLaunchDDXenApp7") || userType.equalsIgnoreCase("AppVDI") || userType.equalsIgnoreCase("AppDDVDI") || userType.equals("OverviewAppXenApp7") || userType.equals("OverviewAppVDI")))
									measure.put(p+"MeasureValueUrl",link);
								else
									measure.put(p+"MeasureValueUrl",measuresLink);
							}
							else if(isOnlyVMAssigned)
								measure.put(p+"MeasureValueUrl",url);
						}
						p++;
					}
					if((!isAllNeg) && measure!=null && measure.size()>0)
						measuresjson.add(measure);
				}
				else if(userType!=null && !(userType.equalsIgnoreCase("AppXenApp7") || userType.equalsIgnoreCase("AppDDXenApp7") || userType.equals("AppLaunchDDXenApp7") || userType.equalsIgnoreCase("AppVDI") || userType.equalsIgnoreCase("AppDDVDI") || userType.equals("OverviewAppXenApp7") || userType.equals("OverviewAppVDI")))
				{
					int p=0;
					while(p<measureList.size())
					{
						String keyForList=(String)measureList.get(p);
						StringTokenizer valTokens = new StringTokenizer(keyForList,":");
						int tokCount = valTokens.countTokens();
						boolean isDDDTestColumn = false;
						boolean isLocationColumn = false;

						if(tokCount==5)
							isDDDTestColumn = true;
						else if(tokCount==2)
							isLocationColumn = true;
						measure.put(p+"MeasureValue","-");
						p++;
					}

					if((!isAllNeg) && measure!=null && measure.size()>0)
						measuresjson.add(measure);
				}
				isDataAvailable = true;
			}
			if(desktopsSize==0)
			{
				isDataAvailable = false;
				if(showKeyUser && isKeyUserUED)
				{
					header_display=mappingInfo.getTextDescription("monitor.endUserDashboard.User Experience Overview for High Profile "+userType+" Users");
				}
				else
				{
					header_display=mappingInfo.getTextDescription("monitor.endUserDashboard.User Experience Overview for "+userType);
				}
				//jsonRoot.put("header_display",header_display);
			}
			int pageLimit = 0;
			try
			{
				pageLimit = Integer.parseInt(priority);
			}
			catch(Exception e)
			{
				pageLimit = vdiDesktopsListTotalCount;
			}
			if(vdiDesktopsListTotalCount>pageLimit)
			{
				int pages = vdiDesktopsListTotalCount/pageLimit;
				if(vdiDesktopsListTotalCount%pageLimit!=0)
					pages +=1;
				int currPage = pageNo;
				if(currPage==0)currPage++;

				if(pageNo!=pages)
				{
					if(pageNo==0)
						pageNo = 1;
				}
			}

			//jsonRoot.put("FIlTER",fil);
			//jsonRoot.put("isDataAvail",isDataAvailable);
			if(enableBackButton!=null && !enableBackButton.equalsIgnoreCase("null") && enableBackButton.trim().length()>0){
				//jsonRoot.put("enableBackButton",enableBackButton); 
				json.put("enableBackButton",enableBackButton);
			}

			json.put("columns",columns);
			if(addSearchEmptyText!=null)
			{
				json.put("addtionalSearchFlag",addtionalSearchFlag);
				String tmpAddSearchEmptyText = addSearchEmptyText.toString();
				if(tmpAddSearchEmptyText!=null && tmpAddSearchEmptyText.endsWith(","))
					tmpAddSearchEmptyText = "Search "+tmpAddSearchEmptyText.substring(0,tmpAddSearchEmptyText.lastIndexOf(","));
				json.put("addSearchEmptyText",tmpAddSearchEmptyText);
			}
			json.put("measures",measuresjson);
			json.put("countJson",countJson);
			json.put("FIlTER",fil);
			json.put("isDataAvail",isDataAvailable);
		}
		/*if(userType!=null && searchString!=null && searchString.trim().length()>0 && (userType.equalsIgnoreCase("AppXenApp7") || userType.equalsIgnoreCase("AppDDXenApp7") || userType.equals("AppLaunchDDXenApp7") || userType.equalsIgnoreCase("AppVDI") || userType.equalsIgnoreCase("AppDDVDI")))
		{
			//json.put("hideFirstColumn",new Boolean(true));
		}*/
	}
	else
	{
		int col_span=measureList.size();
		Hashtable tmpInfoSession = (Hashtable)session.getAttribute("tmpInfoSession");
		if(tmpInfoSession != null && tmpInfoSession.size() > 0)
		{
			Iterator it = tmpInfoSession.entrySet().iterator();
			while(it.hasNext()){
				Entry en = (Entry)it.next();
				Set set = (HashSet)en.getValue();
				ArrayList list = new ArrayList(set);
				if(list != null && list.size() > 0)
					fil.add((String)en.getKey());
			}
		}
		//jsonRoot.put("FIlTER",fil);
		isDataAvailable = false;
		//jsonRoot.put("isDataAvail",isDataAvailable);
		
		json.put("columns",columns);
		json.put("measures",measuresjson);
		json.put("countJson",countJson);
		json.put("error",mappingInfo.getTextDescription("monitor.endUserDashboard.No Records Found"));
		json.put("isDataAvail",isDataAvailable);
		if(enableBackButton!=null && !enableBackButton.equalsIgnoreCase("null") && enableBackButton.trim().length()>0)
		{
			//jsonRoot.put("enableBackButton",enableBackButton); 
			json.put("enableBackButton",enableBackButton);
		}
	}
	String mngrIProc = new IniFile(new com.eg.EgConfigInfo("manager").getDbFile()).getValue("DB_PROPERTIES","ManagerUrl");
	String htmlFileName = mngrIProc + "/final/monitor/endUserDashboardDataPrint.jsp;jsessionid="+session.getId()+"?";
	int pdfPageWidth = 1100; 
	measuresCount= measuresCount + 2;

	if(measuresCount > 7 && measuresCount <= 10)
		pdfPageWidth = 1600;
	else if(measuresCount > 10 && measuresCount <= 20)
		pdfPageWidth = 2400;
	else if(measuresCount > 20)
		pdfPageWidth = 3600;
	session.setAttribute("UED_PDF_URL",htmlFileName);
	if(isEndUserOverview || isFromUEDSort)
		session.setAttribute("REPORT_NAME","UserExperienceOverview");
	else if(userType!=null && userType.equalsIgnoreCase("VCDataStore"))
	{
		session.setAttribute("REPORT_NAME","DatastoresOverview");
	}
	else if(userType!=null && userType.equalsIgnoreCase("VDIESX"))
	{
		session.setAttribute("REPORT_NAME","DatastoreVMsOverview");
	}
	else if(userType!=null && userType.equals("ESX"))
		session.setAttribute("REPORT_NAME","Performance_Metrics_for_VMs");
	else
		session.setAttribute("REPORT_NAME","UserExperienceDashboard");
	session.setAttribute("REPORT_LAYOUT","Landscape");
	session.setAttribute("PAGE_WIDTH_PDF",pdfPageWidth);
	//session.setAttribute("title","User Experience Dashboard");
	if(userType!=null && userType.equals("ESX"))
		session.setAttribute("title","Performance Metrics for VMs");
	else
		session.setAttribute("title","User Experience Overview");
	session.setAttribute("frmPage","UsrExpDash");
	if(isDataManagerLogin)
	{
		String isXenVDI = request.getParameter("isXenVDI");
		String isFromXenVdi = request.getParameter("isFromXenVdi");
		if(isXenVDI == null)
		{
			if(request.getQueryString()!=null)
			{
				String qry=request.getQueryString();
				qry=com.egurkha.util.StringUtils.replace(qry, "\\", "\\\\");
				if(isServiceBusiViewMetrics!=null && isServiceBusiViewMetrics.trim().length()>0 && isServiceBusiViewMetrics.equalsIgnoreCase("true"))
					qry = qry +"&fromMetricView=true";
				else
				{
					if(isFromctx)
						qry = qry +"&fromMetricView=true";
					else
						qry = qry;
				}

				if(isFromXenVdi==null || isFromXenVdi.trim().length()==0 || isFromXenVdi.equals("null") || isFromXenVdi.equals("false") || isFromXenVdi.equals("no"))
					session.setAttribute("monitorLastSession","/final/monitor/endUserDashboard.jsp?access=allusers&"+qry);
			}
			else if(isFromXenVdi==null || isFromXenVdi.trim().length()==0 || isFromXenVdi.equals("null") || isFromXenVdi.equals("false") || isFromXenVdi.equals("no"))
				session.setAttribute("monitorLastSession","/final/monitor/endUserDashboard.jsp?access=allusers");
		}
	}

	json.put("userType",userType);
	
	response.getWriter().write(json.toString());

%>

<%!
	private static DecimalFormat df = (DecimalFormat)NumberFormat.getNumberInstance();
	static{
        DecimalFormatSymbols dfs = new DecimalFormatSymbols();
        dfs.setDecimalSeparator('.');

        df.applyPattern("#.##");
        df.setDecimalFormatSymbols(dfs);
        df.setGroupingSize(0);
	}

	private static DecimalFormat df2 = (DecimalFormat)NumberFormat.getNumberInstance();
	static{
        DecimalFormatSymbols dfs2 = new DecimalFormatSymbols();
        dfs2.setDecimalSeparator('.');

        df2.applyPattern("#.####");
        df2.setDecimalFormatSymbols(dfs2);
        df2.setGroupingSize(0);
	}

	private static DecimalFormat df3 = (DecimalFormat)NumberFormat.getNumberInstance();
	static{
        DecimalFormatSymbols dfs3 = new DecimalFormatSymbols();
        dfs3.setDecimalSeparator('.');

        df3.applyPattern("#");
        df3.setDecimalFormatSymbols(dfs3);
        df3.setGroupingSize(0);
	}

	public static String formatDbValue(String measure)
	{
		String value="";
		try
		{
			/*
				* Check the indexOf "e", For avoid Exponent or Scientific Notation in a String, 
				Because of Address and other String field changed like double data type value
				when we use Double.parseDouble, Its wrong, So put this fix.

				* The real double value not affected because of this change. its shown as per db..

				* changed by Saravanan.A on 31-1-2012.
			*/

			/*
				* Double parsing have problem when double value range exceed, So used BigDecimal instead of Double parsing.

				* changed by Saravanan.A on 15-2-2012.
			*/

			String measure_lower=null;
			if(measure!=null && measure.length()>0)
				measure_lower=measure.toLowerCase().trim();
			
			if(measure_lower!=null && measure_lower.indexOf("e")>-1)
			{
				try
				{
					BigDecimal bigDecRef = new BigDecimal(measure);
					value=df2.format(bigDecRef);
				}
				catch(Exception eee)
				{
					value=measure;
				}
			}
			else
			{
				//double val=Double.parseDouble(measure);
				//value = df.format(val);

				BigDecimal bigDecRef = new BigDecimal(measure);
				value = df.format(bigDecRef);
				double xxx=bigDecRef.doubleValue();
				if(xxx>=100.0)
				{
					value = df3.format(bigDecRef);
				}
				else if(xxx>=1 && xxx<100)
				{
					value = df.format(bigDecRef);
				}
				else
				{
					value=df2.format(bigDecRef);
				}

			}
		}catch(Exception e)
		{
			value=measure;
		}
		return value;
	}

	public void writeLog(String content,boolean isDebugEnabledField,int logFileSizeField)
	{
		if(isDebugEnabledField)
		{
			boolean append = true;
				try
				{
					String path = EgInstallInfo.getInstallDir()+ "/manager/logs/userExpDashBoard.txt";
					File f = new File(path); 
					if(f.exists())
					{
						int size = new FileInputStream(f).available();
						if(size>(1024*1024*logFileSizeField))
						{
							append = false;
							content = "";
						}
					}
					PrintWriter pw = new PrintWriter(new FileWriter(path,append));
					pw.write(new java.util.Date()+" endUserDashboardData.jsp "+content);
					pw.write("\n");
					pw.flush();
					pw.close();
				}
				catch (Exception e)
				{
					e.printStackTrace();
				}
		}
	}

	public static String getConvertDays(String Value,EgDashBoardModel egDashboard)
	{
		String dateDiff="";
		String currentValue=Value;
		try
		{
			if(currentValue!=null && !currentValue.trim().equals(""))
			{
				long minutes=0;
				float seconds=0.0f;
				if(currentValue!=null && currentValue.indexOf(".")>0)
				{
					minutes=Long.parseLong(currentValue.substring(0,currentValue.indexOf(".")));
					if(currentValue.substring(currentValue.indexOf(".")+1).length()>2)
					{
						seconds=Float.parseFloat(currentValue.substring(currentValue.indexOf("."),currentValue.indexOf(".")+3));
					}
					else
					{
						seconds=Float.parseFloat(currentValue.substring(currentValue.indexOf(".")));
					}
				}
				else
				{
					minutes=Long.parseLong(currentValue);
				}
				long valueInSecond=(minutes*60)+(long)(seconds*60);
				dateDiff=egDashboard.getDateDifferenceStringforUptime(valueInSecond);
			}
			else
			{
				dateDiff=currentValue;
			}
		}
		catch(Exception eeew)
		{
			dateDiff=currentValue;
		}

		if(dateDiff!=null && dateDiff.indexOf("M")!=-1 && dateDiff.indexOf("S")!=-1)
		{
			try
			{
				dateDiff=dateDiff.substring(0,dateDiff.indexOf("M")+4);
			}
			catch(Throwable ee)
			{
				ee.printStackTrace();
				dateDiff=dateDiff;
			}
		}
		return dateDiff;
	}
	//------- Time Out Check -------
	public boolean isTimeoutCheck(String compName,String tmp_keyTest,String msmtHost,String compValue,String info_to_lower)
	{
		Hashtable lastMsmtTime =  (Hashtable)EgLastMeasureThread.lastMsmtTime;
		MonitorDAOFactory monitorDaoFactory = MonitorDAOFactory.getInstance();
		MeasuresDAO tmpMeasuresDao = monitorDaoFactory.getMeasuresDAO();

		//lastMsmtTime for Test
		String measureLastKey = compName+":"+tmp_keyTest+":"+msmtHost;
		String infoML = "";
		String msmtTimeML = "";
		boolean MlFinds = false;
		boolean isTimeout = true;
		
		if(info_to_lower.indexOf("+")<0)
		{
			info_to_lower = "+"+info_to_lower;
		}
		
		if(lastMsmtTime != null && lastMsmtTime.containsKey(measureLastKey))
		{
			ArrayList infoLastMsmtList = (ArrayList) lastMsmtTime.get(measureLastKey);
			if(infoLastMsmtList != null && infoLastMsmtList.size() > 0)
			{
				for(int k=0;k<infoLastMsmtList.size();k=k+2)
				{
					infoML = (String)infoLastMsmtList.get(k);
					msmtTimeML = (String)infoLastMsmtList.get(k+1);
					if(info_to_lower.equals(infoML))
					{
						MlFinds = true;
						break;
					}
				}
			}
		}

		String db_str_msmt_time = "";
		SimpleDateFormat currForm = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		SimpleDateFormat outForm = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
		
		try
		{
			 db_str_msmt_time = outForm.format(currForm.parse(msmtTimeML));
		}
		catch(Exception e)
		{
			MlFinds = false;
		}

		if(MlFinds)
		{
			isTimeout = tmpMeasuresDao.isTimeOut(db_str_msmt_time,tmp_keyTest+"#"+msmtHost,compName,compValue);
		}
		return isTimeout;
	}

	public String removeSkipMetrics(String measuresOrg, String measuresToSkipTmp)
	{
		String measures="";
		try
		{
			ArrayList measures_t_list=new ArrayList();
			if(measuresToSkipTmp!=null && measuresToSkipTmp.trim().length()>0)
			{
				measures_t_list = StringUtils.egTokenizer(measuresToSkipTmp,",",false,true,true);//param 3-->includeEmpty,4-->unique,5-->trim
			}

			if(measures_t_list!=null && measures_t_list.size()>0)
			{
				boolean commaNeeded=false;
				String temp="";
				StringTokenizer values = new StringTokenizer(measuresOrg,",");
				while(values.hasMoreTokens())
				{
					String value = values.nextToken();
					if(value!=null && !value.equals(""))
					{
						if(!measures_t_list.contains(value))
						{
							temp += commaNeeded?","+value:value;
							commaNeeded = true;
						}
					}
				}

				if(temp!=null && temp.length()>0)
				{
					measures = temp;
				}
				else
					measures = measuresOrg;
			}
			else
			{
				measures = measuresOrg;
			}
		}
		catch(Throwable eee)
		{
			eee.printStackTrace();
			measures = measuresOrg;
		}

		return measures;
	}

	public String getMeasureForUI(String measuresD, String measuresT)
	{
		String measures="";
		try
		{
			ArrayList measures_t_list=new ArrayList();
			if(measuresT!=null && measuresT.trim().length()>0)
			{
				measures_t_list = StringUtils.egTokenizer(measuresT,",",false,true,true);//param 3-->includeEmpty,4-->unique,5-->trim
			}

			if(measures_t_list!=null && measures_t_list.size()>0)
			{
				boolean commaNeeded=false;
				String temp="";
				StringTokenizer values = new StringTokenizer(measuresD,",");
				while(values.hasMoreTokens())
				{
					String value = values.nextToken();
					if(value!=null && !value.equals(""))
					{
						StringTokenizer valTokens = new StringTokenizer(value,":");
						int count = valTokens.countTokens();
						if(count==3)
						{
							String tempTestMeasure = "";
							tempTestMeasure = value.substring(0,value.lastIndexOf(":"));
							String tempDisplayName = value.substring(value.lastIndexOf(":")+1);
							String tempTestMeasureDisp = tempTestMeasure+":"+tempDisplayName.trim();
							
							//if(!tempTestMeasure.equalsIgnoreCase(testMeasure))
							if(measures_t_list.contains(tempTestMeasureDisp))
							{
								temp += commaNeeded?","+tempTestMeasureDisp:tempTestMeasureDisp;
								commaNeeded = true;
							}
						}
						else
						{
							temp+= commaNeeded?","+value:value;
							commaNeeded = true;
						}
					}
				}

				if(temp!=null && temp.length()>0)
				{
					measures = temp;
				}
				else
					measures = measuresD;
			}
			else
			{
				measures = measuresD;
			}
		}
		catch(Throwable eee)
		{
			eee.printStackTrace();
			measures = measuresD;
		}

		return measures;
	}
	public String getInfoForTests(String userType,String testName,String comptype,String compname, String Port,String info,Vector getDescs, Hashtable testDetails,IniFile ini, ArrayList infoBaseTestList)
	{
		String infoVar=info;
		if(infoBaseTestList!=null && testName!=null && infoBaseTestList.contains(testName))
		{
			if(testDetails!=null && testDetails.size()>0)
			{
				ArrayList testData = (ArrayList)testDetails.get(testName);
				if(testData!=null && testData.size()>=3)
				{
					String toAppendInfo = ini.getValue("UED_INFO_BASED_TESTS",userType+"_"+testName);

					if(toAppendInfo!=null && toAppendInfo.trim().length()>0)
					{
						toAppendInfo=toAppendInfo.trim();
						if(testData.contains(infoVar+toAppendInfo))
						{
							infoVar = infoVar+toAppendInfo;
						}
						else
						{
							if(!getDescs.contains(infoVar))
							{
								for(int z=0;z<getDescs.size();z++)
								{
									String infodesc = (String)getDescs.get(z);
									if(infodesc.startsWith(infoVar))
									{
										infoVar=infodesc;
										break;
									}
								}
							}
						}
					}
					else
					{
						if(testName.equalsIgnoreCase("VmgSystemTest") || testName.equalsIgnoreCase("VmgSystemDemoTest"))
						{
							if(testData.contains(infoVar+":Summary"))
							{
								infoVar = infoVar+":Summary";
							}
							else
							{
								if(!getDescs.contains(infoVar))
								{
									for(int z=0;z<getDescs.size();z++)
									{
										String infodesc = (String)getDescs.get(z);
										if(infodesc.startsWith(infoVar))
										{
											infoVar=infodesc;
											break;
										}
									}
								}
							}
						}
						else if(testName.equalsIgnoreCase("VmgDiskSpaceTest"))
						{
							if(testData.contains(infoVar+":Total"))
							{
								infoVar = infoVar+":Total";
							}
							else
							{
								if(!getDescs.contains(infoVar))
								{
									for(int z=0;z<getDescs.size();z++)
									{
										String infodesc = (String)getDescs.get(z);
										if(infodesc.startsWith(infoVar))
										{
											infoVar=infodesc;
											break;
										}
									}
								}
							}
						}
						else if(testName.equalsIgnoreCase("VmgDiskActivityTest") || testName.equalsIgnoreCase("VmgDiskActDemoTest"))
						{
							if(!getDescs.contains(infoVar))
							{
								for(int z=0;z<getDescs.size();z++)
								{
									String infodesc = (String)getDescs.get(z);
									if(infodesc.startsWith(infoVar))
									{
										infoVar=infodesc;
										break;
									}
								}
							}
						}
						else if(testName.equalsIgnoreCase("VmgWinNetTrafficTest"))
						{
							if(!getDescs.contains(infoVar))
							{
								for(int z=0;z<getDescs.size();z++)
								{
									String infodesc = (String)getDescs.get(z);
									if(infodesc.startsWith(infoVar))
									{
										infoVar=infodesc;
										break;
									}
								}
							}
						}
						else if(testName.equalsIgnoreCase("VmgBrowsActTest"))
						{
							if(!getDescs.contains(infoVar))
							{
								for(int z=0;z<getDescs.size();z++)
								{
									String infodesc = (String)getDescs.get(z);
									if(infodesc.startsWith(infoVar))
									{
										infoVar=infodesc;
										break;
									}
								}
							}
						}
						else if(getDescs!=null && getDescs.size()>0)
						{
							if(!getDescs.contains(infoVar))
							{
								for(int z=0;z<getDescs.size();z++)
								{
									String infodesc = (String)getDescs.get(z);
									if(infodesc.startsWith(infoVar))
									{
										infoVar=infodesc;
										break;
									}
								}
							}
						}
					}
				}
			}
		}
		return infoVar;
	}
	public String getValueForDouble(String Value, ArrayList decimalFormatTestMeasureList,ArrayList  convertToDaysTestMeasureList, String keyTest,String keyOrgMeasure, EgDashBoardModel  egDashboard)
	{
		String result_Val="";
		String orgValue="0.0";
		try
		{
			if(Value!=null && Value.trim().length()>0 && Value.indexOf(".")>-1 && Double.parseDouble(Value)>0)
			{
				orgValue=Value;
				//Value=String.valueOf(com.egurkha.util.MathUtils.round(Double.parseDouble(Value),2));
				if(decimalFormatTestMeasureList!=null && decimalFormatTestMeasureList.size()>0 && decimalFormatTestMeasureList.contains(keyTest+":"+keyOrgMeasure))
				{
					Value=String.valueOf(com.egurkha.util.MathUtils.round(Double.parseDouble(Value),4));
				}
				else if(convertToDaysTestMeasureList!=null && convertToDaysTestMeasureList.size()>0 && convertToDaysTestMeasureList.contains(keyTest+":"+keyOrgMeasure))
				{
					Value = getConvertDays(Value,egDashboard);
				}
				else
				{
					Value=String.valueOf(com.egurkha.util.MathUtils.round(Double.parseDouble(Value),2));
				}
				Value=String.valueOf(Value);
			}
			else if(Value!=null && Value.trim().length()>0  && Double.parseDouble(Value)>0)
			{
				orgValue=Value;
				//Value=String.valueOf(com.egurkha.util.MathUtils.round(Double.parseDouble(Value),2));
				if(decimalFormatTestMeasureList!=null && decimalFormatTestMeasureList.size()>0 && decimalFormatTestMeasureList.contains(keyTest+":"+keyOrgMeasure))
				{
					Value=String.valueOf(com.egurkha.util.MathUtils.round(Double.parseDouble(Value),4));
				}
				else if(convertToDaysTestMeasureList!=null && convertToDaysTestMeasureList.size()>0 && convertToDaysTestMeasureList.contains(keyTest+":"+keyOrgMeasure))
				{
					Value = getConvertDays(Value,egDashboard);
				}
				else
				{
					Value=String.valueOf(com.egurkha.util.MathUtils.round(Double.parseDouble(Value),2));
				}
				Value=String.valueOf(Value);
			}
		}
		catch(Exception ee)
		{
			if(Value==null || Value.equalsIgnoreCase("unknown"))
				Value = "-";

			Value=Value;
			orgValue=Value;
		}
		result_Val=Value+"~$~"+orgValue;

		return result_Val;
	}

	public String[] getMeasuresArray(ArrayList tmpValidColsList)
	{
		String[] tmpMeasureArray =null;
		if(tmpValidColsList!=null && tmpValidColsList.size()>0)
		{
			tmpMeasureArray = new String[tmpValidColsList.size()];
			int yy=0;
			for(int y=0;y<tmpValidColsList.size();y++)
			{
				String tempValue1 = (String)tmpValidColsList.get(y);
				if(tempValue1!=null && tempValue1.trim().length()>0)
				{
					tmpMeasureArray[yy++]=tempValue1;
				}
			}
		}

		return tmpMeasureArray;
	}

	public ArrayList getTokenList(String inputStr,String sep)
	{
		ArrayList tmpList = new ArrayList();
		if(inputStr!=null && inputStr.trim().length()>0)
		{
			tmpList = com.egurkha.util.StringUtils.egTokenizer(inputStr,sep,false,true,true);//param 3-->includeEmpty,4-->unique,5-->trim
		}

		return tmpList;
	}

	public String getMsmtHost(EgTablesInfo tablesInfo1,EgExternalInfo egExternalInfo1,String ctype_layer1,String tempCompType,String tempCompNameWithOutPort2)
	{
		String outputMsmtHost=null;
		try
		{
			ArrayList listOfTest=(ArrayList)tablesInfo1.getTestsForLayer(ctype_layer1,tempCompType);
			if(listOfTest!=null && listOfTest.size()>0)
			{
				boolean flag=true;
				for (int t=0;t<listOfTest.size();t++)
				{
					String insideviewTest=(String) listOfTest.get(t);
					if(insideviewTest!=null && insideviewTest.trim().length()>0)
					{
						List tempAgents=egExternalInfo1.getAgentsFor(insideviewTest.trim(),tempCompType,tempCompNameWithOutPort2);

						if(tempAgents!=null && tempAgents.size()>0)
						{
							outputMsmtHost=(String)tempAgents.get(0);
							flag=false;
							break;
						}
					}
				}

				if(flag)
					outputMsmtHost=tempCompNameWithOutPort2;
			}
			else
				outputMsmtHost=tempCompNameWithOutPort2;
		}
		catch(Exception ee)
		{
			outputMsmtHost=tempCompNameWithOutPort2;
			ee.printStackTrace();
		}

		if(outputMsmtHost==null || outputMsmtHost.trim().length()==0)
			outputMsmtHost=tempCompNameWithOutPort2;

		return outputMsmtHost;
	}

	public String getRelavantOrderByColumnNames(ArrayList metricsList,String columnDispName,EgDbInfo Dbdata)
	{
		String tmpOrderByColumnName=null;
		StringBuffer orderByColumnNameSb = new StringBuffer();
		if(metricsList != null && metricsList.size()>0)
		{
			int val_count = 0;
			for(int i=0;i<metricsList.size();i++)
			{
				String met = (String)metricsList.get(i);
				if(met == null || met.trim().length() == 0)
					continue;
				ArrayList check = com.egurkha.util.StringUtils.egTokenizer(met, ":", true,false,true);
				if(check != null)
				{
					int sizeCheck=check.size();
					if(sizeCheck==3 || sizeCheck==5)
					{
						String tempTest = "";
						String tempMeasure = "";
						String tempDispName = "";
						String tempLocColName = "";
						String meas = "";
						String colName = "";

						if(sizeCheck==3)
						{
							tempTest =  (String)check.get(0);
							tempMeasure =  (String)check.get(1);
							tempDispName =  (String)check.get(2);
						}
						else if(sizeCheck==5)
						{
							tempTest = (String)check.get(0);
							tempMeasure = (String)check.get(1);
							colName = (String)check.get(2);
							meas = (String)check.get(3);
							tempDispName = (String)check.get(4);
						}

						if(tempDispName!=null && tempDispName.equalsIgnoreCase(columnDispName))
						{
							if(sizeCheck==3)
							{
								String neworderByColumn = Dbdata.getColumnForMeasure(tempTest,tempMeasure);
								if(neworderByColumn==null || neworderByColumn.trim().length()==0)
									neworderByColumn = tempMeasure;

								orderByColumnNameSb.append(","+neworderByColumn);
							}
							else if(sizeCheck==5)
							{
								String neworderByColumn = Dbdata.getColumnForMeasure(tempTest+"_DDD",colName);
								if(neworderByColumn==null || neworderByColumn.trim().length()==0)
									neworderByColumn = colName;

								orderByColumnNameSb.append(","+neworderByColumn);
							}
						}
					}
				}
			}
		}

		if(orderByColumnNameSb!=null)
			tmpOrderByColumnName = orderByColumnNameSb.toString();
	
		if(tmpOrderByColumnName!=null && tmpOrderByColumnName.startsWith(","))
			tmpOrderByColumnName = tmpOrderByColumnName.substring(1);

		return tmpOrderByColumnName;
	}

	public Hashtable getFilterTypeDetails(User user,String detail,String filterBy,Hashtable filterInfoHash)
	{
		if(detail != null && detail.equalsIgnoreCase("componentType"))
		{
			if(filterBy !=null && filterBy.equalsIgnoreCase("Virtual_Machine"))
			{
				ArrayList allNickForVms = new ArrayList();
				ArrayList allNickForVmComp = new ArrayList();
				List temp_listComps = user.getOnlyVMServers();
				if(temp_listComps!=null && temp_listComps.size()>0)
				{
					for(int l=0;l<temp_listComps.size();l++)
					{
						String compDetails = (String)temp_listComps.get(l);
						allNickForVmComp.add(compDetails);
					}

					filterInfoHash.put("allNickForVMComp",allNickForVmComp);
					//filterInfoHash.put("allNickForVMList",allNickForVms);
				}
			}
			else if(filterBy !=null && !filterBy.equalsIgnoreCase("All"))
			{
				ArrayList allNickForComp = new ArrayList();
				List temp_listComps = user.getServers(false);
				for(int l=0;l<temp_listComps.size();l++)
				{
					String compDetails = (String)temp_listComps.get(l);
					if(compDetails.indexOf(filterBy) != -1)
						allNickForComp.add(compDetails);

				}
				filterInfoHash.put("allNickForComp",allNickForComp);
			}
		}

		return filterInfoHash;
	}

	public ArrayList getNotZoneList(List temp_listZone,EgGroupInfo groupInfo)
	{
		ArrayList notZoneList2 = new ArrayList();
		if(temp_listZone != null && temp_listZone.size() > 0){
			for(int l=0;l<temp_listZone.size();l++){
				String zone1 = (String) temp_listZone.get(l);
				List temp_zoneComps = groupInfo.getAllComponentsUnderZone(zone1,true);
				if(temp_zoneComps != null && temp_zoneComps.size() > 0){
					for(int p=0;p<temp_zoneComps.size();p++){
						String compType = (String)temp_zoneComps.get(p);
						notZoneList2.add(compType);
					}
				}
			}
		}

		return notZoneList2;
	}
	public String getMeasureValue(Hashtable measureValues,String test,String measure,String info,String compNameWithOutPort)
	{
		String value=(String)measureValues.get(test+"^"+measure+"^"+info+"^"+compNameWithOutPort);

		if(value==null || value.trim().length()==0)
			value=(String)measureValues.get(test+"^"+measure+"^"+info.toLowerCase()+"^"+compNameWithOutPort);

		if(value==null || value.trim().length()==0)
			value=(String)measureValues.get(measure+"^"+info+"^"+compNameWithOutPort);


		if(value==null || value.trim().length()==0)
			value=(String)measureValues.get(measure+"^"+info.toLowerCase()+"^"+compNameWithOutPort);

		return value;
	}

	public String getManagerTimeToUserTimeConvertion(IniFile egFormat, EgTimeZoneConverter convert, User user, String testName, String measureName, String orgValue)
	{
		String value = orgValue;
		
		try
		{		
			String dateColumn ="";			
			if(measureName!=null && measureName.trim().length()>0)			
				dateColumn=(String)egFormat.getValue("Convert_ManagerTime_To_UserTime",testName+":"+measureName);	
			
			if(dateColumn!=null && dateColumn.trim().length()>0 && orgValue!=null && orgValue.indexOf(" ")>-1)
			{						
				String date = orgValue.substring(0,orgValue.indexOf(" ")).trim();
				String time = orgValue.substring(orgValue.indexOf(" ")).trim();						

				if(user != null)
				{
					String userFormat = user.getUserDateFormat();											
					date = DateUtil.changeDateFormat(date,dateColumn,userFormat);									
					convert = new EgTimeZoneConverter(date+" "+time,user);										
					date = convert.getDate(false)+" "+convert.getHour()+":"+convert.getMinute()+":"+convert.getSecond();		
					value = date;																	
				}
			}
		}
		catch(Exception e)
		{
			return value;
		}
		return value;
	}
	public String HideDisabledTest(String measure, String userType , User user, EgSpecsInfo specsInfo ,IniFile ini,boolean isDetailsFromADOnly,boolean isShowUserLocation)
	{
		String tem_measures= measure;
		String result_measure= "";
		try
		{

			List test_comps = user.getServerTypes();
			List vmTypeList = user.getOnlyVMTypes();
			List vmServersList = user.getOnlyVMServers(false);
			String userTypeStr=ini.getValue("USER_TYPE_COMPONENTS",userType);
			ArrayList userTypeList = new ArrayList();
			if(userTypeStr!=null && userTypeStr.trim().length()>0)
				userTypeList = (ArrayList)getTokenList(userTypeStr,",");
			else
				 return tem_measures;
			
			ArrayList measure_List = new ArrayList();
			ArrayList tmp_measure_List = new ArrayList();
			
			if(measure!=null && measure.trim().length()>0)
				measure_List = (ArrayList)getTokenList(measure,",");
			else
				 return tem_measures;

			String selectedComp ="";
			if(test_comps!=null && test_comps.size()>0)
			{
				for(int b=0;b<test_comps.size();b++)
				{
					String compTypr= (String) test_comps.get(b);
					if(userTypeList.contains(compTypr))
					{
						selectedComp = (String) test_comps.get(b);
						if(selectedComp!= null && selectedComp.trim().length()>0)
						{
							for(int c=0;c<measure_List.size();c++)
							{
								String meas = (String)measure_List.get(c);
								String meas_test = meas.substring(0,meas.indexOf(":"));
								if(specsInfo.isTestRelevantForServer(selectedComp,meas_test))
								{
									if(!tmp_measure_List.contains(meas))
									{
										tmp_measure_List.add(meas);
										result_measure+=meas+",";
									}
								}
								else if(isDetailsFromADOnly && isShowUserLocation && meas_test.equals("GeoDetails"))
								{
									if(!tmp_measure_List.contains(meas))
									{
										tmp_measure_List.add(meas);
										result_measure+=meas+",";
									}
								}
							}
						}
					}
				}
				if(tmp_measure_List!=null && tmp_measure_List.size()==0 && (user.isOnlyVMAssigned() || user.isVMAssigned()) && user.getOnlyVMs().size()>0 && vmTypeList!=null && vmTypeList.size()>0)
				{
					for(int b=0;b<vmTypeList.size();b++)
					{
						String compTypr= (String) vmTypeList.get(b);
						if(userTypeList.contains(compTypr))
						{
							selectedComp = (String) vmTypeList.get(b);
							if(selectedComp!= null && selectedComp.trim().length()>0)
							{
								for(int c=0;c<measure_List.size();c++)
								{
									String meas = (String)measure_List.get(c);
									String meas_test = meas.substring(0,meas.indexOf(":"));
									if(specsInfo.isTestRelevantForServer(selectedComp,meas_test))
									{
										if(!tmp_measure_List.contains(meas))
										{
											tmp_measure_List.add(meas);
											result_measure+=meas+",";
										}
									}
									else if(isDetailsFromADOnly && isShowUserLocation && meas_test.equals("GeoDetails"))
									{
										if(!tmp_measure_List.contains(meas))
										{
											tmp_measure_List.add(meas);
											result_measure+=meas+",";
										}
									}
								}
							}
						}
					}
				}
			}
			else
				return tem_measures;

			if(result_measure.trim().length()>0 && result_measure.endsWith(","))
				result_measure = result_measure.substring(0,result_measure.lastIndexOf(","));
		}
		catch(Exception eeb)
		{
			eeb.printStackTrace();
			return tem_measures;
		}
		return result_measure;
	}

	public ArrayList getUniqueUserList(EgList vdiDesktopsList)
	{
		ArrayList tmpList = new ArrayList();
		HashSet uniqueUserSet=new HashSet();
		if(vdiDesktopsList!=null)
		{
			for(int i=0;i<vdiDesktopsList.size();i++)
			{
				EgService serv = (EgService)vdiDesktopsList.get(i);
				String desktopComponent = serv.getName();
				String desktopState = serv.getState().getName();

				String desktopName = "";
				String info="";
				String comp = "";
				
				if(desktopComponent!=null && desktopComponent.indexOf("^")>-1)
				{
					desktopName = desktopComponent.substring(0,desktopComponent.lastIndexOf("^"));
					info = desktopName;
					comp = desktopComponent.substring(desktopComponent.lastIndexOf("^")+1);
				}

				if(info.indexOf("\\") > -1 && info.indexOf("_on_") > -1 && info.indexOf("\\") < info.indexOf("_on_"))
				{
					ArrayList user_and_desktop =  com.egurkha.util.StringUtils.egTokenizer(info, "_on_",false,false,true);//param 3-->includeEmpty,4-->unique,5-->trim

					if(user_and_desktop!=null && user_and_desktop.size()>0)
					{
						String only_user=(String)user_and_desktop.get(0);
						if(only_user!=null && only_user.trim().length()>0)
							uniqueUserSet.add(only_user);
					}
				}
				else
					uniqueUserSet.add(info);
			}
			if(uniqueUserSet!=null && uniqueUserSet.size()>0)
				tmpList.addAll(uniqueUserSet);
		}
		return tmpList;
	}

	public Hashtable titleFormation(String userType)
	{
		Hashtable tmpTitleHash=new Hashtable();
		String header_display="";
		String header_display_icon="";
		String countHeader="";
		if(userType.equals("ESX"))
		{
			//header_display = "VM Resource Consumption for "+compTypeDisp+" : "+s_compName;
			header_display = "VM Resource Consumption for ";
			header_display_icon = "iconComponent";
			countHeader = "Total VMs";
		}
		else if(userType.equals("VDI"))
		{
			//header_display = "Desktop Resource Consumption for "+compTypeDisp+" : "+s_compName;
			header_display = "Users/Desktops Resource Consumption ";
			header_display_icon = "iconDesktop";
			countHeader = "Unique Users/Desktops";
		}
		else
		{
			//header_display = "User Resource Consumption for "+compTypeDisp+" : "+s_compName;
			header_display = "User Resource Consumption ";
			header_display_icon = "descriptor_user";
			countHeader = "Unique Users";
		}

		tmpTitleHash.put("header_display",header_display);
		tmpTitleHash.put("header_display_icon",header_display_icon);
		tmpTitleHash.put("countHeader",countHeader);

		return tmpTitleHash;
	}
%>

