IoT CAS Frameworks/IOT_Server/Report_Generator_Framework/source/DashBoard-JSONgenerator-ArbitraryDate/src/com/merit/dashboard/queryexecuter/QueryExecuter.java
public LinkedHashMap<String, String> generateJsonFromGivenQuery(String szQueryString, String[] headingNames, String customer) {
        LinkedHashMap<String, String> szMetricTypemap = new LinkedHashMap<String, String>();

        try {
//            Statement stat2 = dataBaseConnection.createStatement();
            String szMetricTypeValueJson = "";
            ResultSet rs4 = ConnectionDAO.executerQuery(szQueryString, customer);//stat2.executeQuery(szQueryString);
            String szConcatColumn;//
            while (rs4.next()) {
                System.out.println("rs4.next====> while");
                szConcatColumn = "";
                szMetricTypeValueJson = "";
                for (int i = 0; i < headingNames.length - 1; i++) {
                    System.out.println("headingNames[i]==>>" + headingNames[i]);
                    if (!headingNames[headingNames.length - 1].equals("Alert")) {
                        System.out.println("rs4.getString(headingNames[i])==>>" + rs4.getString(headingNames[i]));
                        if (rs4.getString(headingNames[i]) != null) {
                            szConcatColumn = szConcatColumn + ",\"" + headingNames[i] + "\":\"" + rs4.getString(headingNames[i]) + "\"";
                        }
                    }
                    szMetricTypeValueJson = szMetricTypeValueJson + "," + rs4.getString(headingNames[i]);
                }
                szConcatColumn = szConcatColumn + ",\"" + headingNames[headingNames.length - 1] + "\":\"" + rs4.getString(headingNames[headingNames.length - 1]) + "\"";
                szMetricTypemap.put(szMetricTypeValueJson.substring(1), szConcatColumn.substring(1));
                System.out.println("");
                
            }
            ConnectionDAO.closeStatement();
        } catch (Exception e) {
            e.printStackTrace();
            log.error("Error in generateJsonFromGivenQuery" + e.getMessage());
        }
        return szMetricTypemap;
    }
/**
     * ***************************************************************************************************
     * Here we are Executing both Ticket and Metric Query one by one because
     * both having different dataBase Connection and sending as LinkedHashMap
     *
     * @param szQueryString Query to be Executed
     * @param headingNames Name of Columns in Executed Query
     * @param dataBaseConnection Specific query specific Connection
     * @return szMetricTypemap return LinkedHashMap
     * ***************************************************************************************************
     */
Here we are Executing both Ticket and Metric Query one by one because
both having different dataBase Connection and sending as LinkedHashMap

@param szQueryString Query to be Executed
@param headingNames Name of Columns in Executed Query
@param dataBaseConnection Specific query specific Connection
@return szMetricTypemap return LinkedHashMap
Here we are Executing both Ticket and Metric Query one by one because both having different dataBase Connection and sending as LinkedHashMap @param szQueryString Query to be Executed @param headingNames Name of Columns in Executed Query @param dataBaseConnection Specific query specific Connection @return szMetricTypemap return LinkedHashMap
public LinkedHashMap<String, String> generateJsonFromGivenQuery(String szQueryString, String[] headingNames, String customer) {
        LinkedHashMap<String, String> szMetricTypemap = new LinkedHashMap<String, String>();
        try {
            String szMetricTypeValueJson = "";
            ResultSet rs4 = ConnectionDAO.executerQuery(szQueryString, customer);
            String szConcatColumn;
            while (rs4.next()) {
                System.out.println("rs4.next====> while");
                szConcatColumn = "";
                szMetricTypeValueJson = "";
                for (int i = 0; i < headingNames.length - 1; i++) {
                    System.out.println("headingNames[i]==>>" + headingNames[i]);
                    if (!headingNames[headingNames.length - 1].equals("Alert")) {
                        System.out.println("rs4.getString(headingNames[i])==>>" + rs4.getString(headingNames[i]));
                        if (rs4.getString(headingNames[i]) != null) {
                            szConcatColumn = szConcatColumn + ",\"" + headingNames[i] + "\":\"" + rs4.getString(headingNames[i]) + "\"";
                        }
                    }
                    szMetricTypeValueJson = szMetricTypeValueJson + "," + rs4.getString(headingNames[i]);
                }
                szConcatColumn = szConcatColumn + ",\"" + headingNames[headingNames.length - 1] + "\":\"" + rs4.getString(headingNames[headingNames.length - 1]) + "\"";
                szMetricTypemap.put(szMetricTypeValueJson.substring(1), szConcatColumn.substring(1));
                System.out.println("");
            }
            ConnectionDAO.closeStatement();
        } catch (Exception e) {
            e.printStackTrace();
            log.error("Error in generateJsonFromGivenQuery" + e.getMessage());
        }
        return szMetricTypemap;
    }
public LinkedHashMap < String , String > generateJsonFromGivenQuery ( String szQueryString , String [ ] headingNames , String customer ) { LinkedHashMap < String , String > szMetricTypemap = new LinkedHashMap < String , String > ( ) ; try { String szMetricTypeValueJson = "" ; ResultSet rs4 = ConnectionDAO . executerQuery ( szQueryString , customer ) ; String szConcatColumn ; while ( rs4 . next ( ) ) { System . out . println ( "rs4.next====> while" ) ; szConcatColumn = "" ; szMetricTypeValueJson = "" ; for ( int i = 0 ; i < headingNames . length - 1 ; i ++ ) { System . out . println ( "headingNames[i]==>>" + headingNames [ i ] ) ; if ( ! headingNames [ headingNames . length - 1 ] . equals ( "Alert" ) ) { System . out . println ( "rs4.getString(headingNames[i])==>>" + rs4 . getString ( headingNames [ i ] ) ) ; if ( rs4 . getString ( headingNames [ i ] ) != null ) { szConcatColumn = szConcatColumn + ",\"" + headingNames [ i ] + "\":\"" + rs4 . getString ( headingNames [ i ] ) + "\"" ; } } szMetricTypeValueJson = szMetricTypeValueJson + "," + rs4 . getString ( headingNames [ i ] ) ; } szConcatColumn = szConcatColumn + ",\"" + headingNames [ headingNames . length - 1 ] + "\":\"" + rs4 . getString ( headingNames [ headingNames . length - 1 ] ) + "\"" ; szMetricTypemap . put ( szMetricTypeValueJson . substring ( 1 ) , szConcatColumn . substring ( 1 ) ) ; System . out . println ( "" ) ; } ConnectionDAO . closeStatement ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; log . error ( "Error in generateJsonFromGivenQuery" + e . getMessage ( ) ) ; } return szMetricTypemap ; }
Here we are Executing both Ticket and Metric Query one by one because
 both having different dataBase Connection and sending as LinkedHashMap
Here we are Executing both Ticket and Metric Query one by one because both having different dataBase Connection and sending as LinkedHashMap
//            Statement stat2 = dataBaseConnection.createStatement(); //stat2.executeQuery(szQueryString); //