IoT CAS Frameworks/IOT_Server/Report_Generator_Framework/IT/source/DashBoard-JSONgenerator/src/com/merit/dashboard/Controller.java
public void generateDirectoryStructureByCustomerID(String customerName, String timestampselection, String tomcat_home) {

        String szProjectName = DBUtilHelper.getMetrics_mapping_properties().getProperty("projectName");
        String[] types = DBUtilHelper.getMetrics_mapping_properties().getProperty("ResourceName").split(",");

        System.out.println("\n ProjectName:" + szProjectName + ";\n Customer Name:" + customerName + "\n Resource Type List::" + types.length);
        log.debug("\n ProjectName:" + szProjectName + ";\n Customer Name:" + customerName + "\n Resource Type List::" + types.length);

        File f1 = new File(
                tomcat_home + File.separator + 
                //"webapps" + File.separator + 
                szProjectName + File.separator + 
                customerName
        );
        if (!f1.exists()) {
            //System.out.println(" Customer directory not found:" + tomcat_home + File.separator +   "webapps" + File.separator +   szProjectName + File.separator + customerName);
            System.out.println(" Customer directory not found:" + tomcat_home + File.separator + /*"webapps" + File.separator +*/ szProjectName + File.separator + customerName);
            String[] timedFOLDR = {"Hour", "Day", "Week", "Month", "Year"};
            List<String> arrMetricList = new ArrayList();
            try {
                System.out.println("generating folder structure....");
                for (int t = 0; t < timedFOLDR.length; t++) {
                    for (int i = 0; i < types.length; i++) {

                        //getArray of JSON Folders remoove space from names { }
                        //create one more for loop add the named folder except TIME LINE
                        //System.out.println("types[i].trim() = " + types[i].trim());
                        //Set<String> arrMetricGroup =
                        arrMetricList.clear();
                        arrMetricList.addAll(ServiceThreadListener.getJSONLocationSet(types[i].trim()));
                        for (String mtricgroup : arrMetricList) {
                            if (mtricgroup != null) {
                                folderstructure = new File(
                                        tomcat_home + File.separator
                                        //+ "webapps" + File.separator
                                        + szProjectName + File.separator
                                        + customerName + File.separator
                                        + timedFOLDR[t] + File.separator
                                        + types[i].trim() + File.separator
                                        + mtricgroup
                                );
                                folderstructure.mkdirs();
                                System.out.println("generating folder structure. .. " + folderstructure.getPath());
                            }
                        }
                    }
                }
                folderstructure = null;
            } catch (Exception e) {
                e.printStackTrace();
            }
        } else {
            //System.out.println(" Ok! Customer directory found: webapps" + File.separator + szProjectName + File.separator + customerName);
            System.out.println(" Ok! Customer directory found: " + szProjectName + File.separator + customerName);
        }
        f1 = null;
    }
/**
     * This method is creating Directory like merit inside
     * hour,day,week,month,year then inside hour:
     * server,Desktop,DataBase,Network,JVM etc
     *
     * @param customerName customerId
     * @param timestampselection means (hour, days, week, month, year)
     * @param tomcat_home where you want to create a directory
     *
     */
This method is creating Directory like merit inside
hour,day,week,month,year then inside hour:
server,Desktop,DataBase,Network,JVM etc

@param customerName customerId
@param timestampselection means (hour, days, week, month, year)
@param tomcat_home where you want to create a directory
This method is creating Directory like merit inside hour day week month year then inside hour : server Desktop DataBase Network JVM etc @param customerName customerId @param timestampselection means ( hour days week month year ) @param tomcat_home where you want to create a directory
public void generateDirectoryStructureByCustomerID(String customerName, String timestampselection, String tomcat_home) {
        String szProjectName = DBUtilHelper.getMetrics_mapping_properties().getProperty("projectName");
        String[] types = DBUtilHelper.getMetrics_mapping_properties().getProperty("ResourceName").split(",");
        System.out.println("\n ProjectName:" + szProjectName + ";\n Customer Name:" + customerName + "\n Resource Type List::" + types.length);
        log.debug("\n ProjectName:" + szProjectName + ";\n Customer Name:" + customerName + "\n Resource Type List::" + types.length);
        File f1 = new File(
                tomcat_home + File.separator + 
                szProjectName + File.separator + 
                customerName
        );
        if (!f1.exists()) {
            System.out.println(" Customer directory not found:" + tomcat_home + File.separator + /*"webapps" + File.separator +*/ szProjectName + File.separator + customerName);
            String[] timedFOLDR = {"Hour", "Day", "Week", "Month", "Year"};
            List<String> arrMetricList = new ArrayList();
            try {
                System.out.println("generating folder structure....");
                for (int t = 0; t < timedFOLDR.length; t++) {
                    for (int i = 0; i < types.length; i++) {
                        arrMetricList.clear();
                        arrMetricList.addAll(ServiceThreadListener.getJSONLocationSet(types[i].trim()));
                        for (String mtricgroup : arrMetricList) {
                            if (mtricgroup != null) {
                                folderstructure = new File(
                                        tomcat_home + File.separator
                                        + szProjectName + File.separator
                                        + customerName + File.separator
                                        + timedFOLDR[t] + File.separator
                                        + types[i].trim() + File.separator
                                        + mtricgroup
                                );
                                folderstructure.mkdirs();
                                System.out.println("generating folder structure. .. " + folderstructure.getPath());
                            }
                        }
                    }
                }
                folderstructure = null;
            } catch (Exception e) {
                e.printStackTrace();
            }
        } else {
            System.out.println(" Ok! Customer directory found: " + szProjectName + File.separator + customerName);
        }
        f1 = null;
    }
public void generateDirectoryStructureByCustomerID ( String customerName , String timestampselection , String tomcat_home ) { String szProjectName = DBUtilHelper . getMetrics_mapping_properties ( ) . getProperty ( "projectName" ) ; String [ ] types = DBUtilHelper . getMetrics_mapping_properties ( ) . getProperty ( "ResourceName" ) . split ( "," ) ; System . out . println ( "\n ProjectName:" + szProjectName + ";\n Customer Name:" + customerName + "\n Resource Type List::" + types . length ) ; log . debug ( "\n ProjectName:" + szProjectName + ";\n Customer Name:" + customerName + "\n Resource Type List::" + types . length ) ; File f1 = new File ( tomcat_home + File . separator + szProjectName + File . separator + customerName ) ; if ( ! f1 . exists ( ) ) { System . out . println ( " Customer directory not found:" + tomcat_home + File . separator + /*"webapps" + File.separator +*/ szProjectName + File . separator + customerName ) ; String [ ] timedFOLDR = { "Hour" , "Day" , "Week" , "Month" , "Year" } ; List < String > arrMetricList = new ArrayList ( ) ; try { System . out . println ( "generating folder structure...." ) ; for ( int t = 0 ; t < timedFOLDR . length ; t ++ ) { for ( int i = 0 ; i < types . length ; i ++ ) { arrMetricList . clear ( ) ; arrMetricList . addAll ( ServiceThreadListener . getJSONLocationSet ( types [ i ] . trim ( ) ) ) ; for ( String mtricgroup : arrMetricList ) { if ( mtricgroup != null ) { folderstructure = new File ( tomcat_home + File . separator + szProjectName + File . separator + customerName + File . separator + timedFOLDR [ t ] + File . separator + types [ i ] . trim ( ) + File . separator + mtricgroup ) ; folderstructure . mkdirs ( ) ; System . out . println ( "generating folder structure. .. " + folderstructure . getPath ( ) ) ; } } } } folderstructure = null ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } else { System . out . println ( " Ok! Customer directory found: " + szProjectName + File . separator + customerName ) ; } f1 = null ; }
This method is creating Directory like merit inside
 hour,day,week,month,year then inside hour:
 server,Desktop,DataBase,Network,JVM etc
This method is creating Directory like merit inside hour day week month year then inside hour : server Desktop DataBase Network JVM etc
//"webapps" + File.separator +  //System.out.println(" Customer directory not found:" + tomcat_home + File.separator +   "webapps" + File.separator +   szProjectName + File.separator + customerName); //getArray of JSON Folders remoove space from names { } //create one more for loop add the named folder except TIME LINE //System.out.println("types[i].trim() = " + types[i].trim()); //Set<String> arrMetricGroup = //+ "webapps" + File.separator //System.out.println(" Ok! Customer directory found: webapps" + File.separator + szProjectName + File.separator + customerName);