List of usage examples for java.util Hashtable size
public synchronized int size()
From source file:com.afunms.report.abstraction.ExcelReport1.java
public void createReport_iisAll(String filename) { if (impReport.getTable() == null) { fileName = null;//from w w w . j a v a 2 s .c o m return; } WritableWorkbook wb = null; try { fileName = ResourceCenter.getInstance().getSysPath() + filename; wb = Workbook.createWorkbook(new File(fileName)); Hashtable allreport_has = new Hashtable(); allreport_has = reportHash; if (allreport_has != null && allreport_has.size() > 0) { Iterator keys = allreport_has.keySet().iterator(); String ip = ""; int sheetNum = 0; while (keys.hasNext()) { ip = keys.next().toString(); String newip = doip(ip); Hashtable report_has = (Hashtable) allreport_has.get(ip); reportHash = report_has; // fileName = ResourceCenter.getInstance().getSysPath() + // "temp\\dhcnms_report.xls"; // fileName = CommonAppUtil.getAppName() + // "/temp/hostnms_report.xls"; fileName = ResourceCenter.getInstance().getSysPath() + filename; wb = Workbook.createWorkbook(new File(fileName)); String starttime = (String) reportHash.get("starttime"); String totime = (String) reportHash.get("totime"); String hostname = (String) reportHash.get("equipname"); String iisnow = (String) reportHash.get("iisnow"); WritableSheet sheet = wb.createSheet(hostname + "", 0); Calendar colTime = (Calendar) reportHash.get("time"); Hashtable maxping = (Hashtable) reportHash.get("ping"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String[] memoryItemch = { "", "", "", "" }; String[] memoryItem = { "Capability", "Utilization" }; String[] diskItem = { "AllSize", "UsedSize", "Utilization" }; String[] diskItemch = { "", "", "" }; Label tmpLabel = null; tmpLabel = new Label(0, 0, hostname + "", labelFormat); sheet.addCell(tmpLabel); sheet.mergeCells(0, 0, 7, 0); tmpLabel = new Label(0, 1, ":" + impReport.getTimeStamp()); sheet.addCell(tmpLabel); sheet.mergeCells(0, 1, 7, 1); tmpLabel = new Label(0, 2, ": " + starttime + " " + totime); sheet.addCell(tmpLabel); sheet.mergeCells(0, 2, 7, 2); tmpLabel = new Label(0, 4, "", b_labelFormat); sheet.addCell(tmpLabel); sheet.mergeCells(0, 4, 0, 12); tmpLabel = new Label(1, 4, "", _labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(3, 4, "", _labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(5, 4, "", _labelFormat); sheet.addCell(tmpLabel); sheet.mergeCells(1, 4, 2, 4); sheet.mergeCells(3, 4, 4, 4); sheet.mergeCells(5, 4, 7, 4); tmpLabel = new Label(1, 5, iisnow + "%", p_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(3, 5, (String) maxping.get("pingmax"), p_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(5, 5, (String) maxping.get("avgpingcon"), p_labelFormat); sheet.addCell(tmpLabel); sheet.mergeCells(1, 5, 2, 5); sheet.mergeCells(3, 5, 4, 5); sheet.mergeCells(5, 5, 7, 5); // File file = new File(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/" + newip + "iisPing" + ".png"); sheet.addImage(new WritableImage(1, 6, 7, 7, file)); wb.write(); } } } catch (Exception e) { SysLogger.error("", e); } finally { try { if (wb != null) wb.close(); } catch (Exception e) { SysLogger.error("", e); } } }
From source file:com.afunms.report.abstraction.ExcelReport1.java
/** * @author sunqichang//*from www. j a va2 s . c o m*/ * * * @param sheet * @param ip * @param reportHash */ protected void createDisk(WritableSheet sheet, String ip, Hashtable reportHash) { Label tmpLabel = null; int allRow = 36; String[] diskItem = { "AllSize", "UsedSize", "Utilization" }; String[] diskItemch = { "", "", "" }; Hashtable Disk = (Hashtable) reportHash.get("Disk"); // String ip = (String) reportHash.get("ip"); String newip = doip(ip); try { if (Disk != null && Disk.size() > 0) { // memoryRow = Disk.size(); tmpLabel = new Label(0, allRow, "", b_labelFormat); sheet.addCell(tmpLabel); sheet.mergeCells(0, allRow, 0, allRow + Disk.size() + 9); // Label label = new Label(1, allRow, "", _labelFormat); sheet.addCell(label); sheet.mergeCells(1, allRow, 3, allRow); int count = 0; for (int i = 0; i < diskItemch.length; i++) { label = new Label(count + 4, allRow, diskItemch[i], _labelFormat); sheet.addCell(label); sheet.mergeCells(4 + count, allRow, 4 + count + 1, allRow); count += 2; } // for (int i = 0; i < Disk.size(); i++) { Hashtable diskhash = (Hashtable) (Disk.get(new Integer(i))); String name = (String) diskhash.get("name"); allRow = allRow + 1; p_labelFormat = colorChange(i); label = new Label(1, allRow, name, p_labelFormat); sheet.addCell(label); sheet.mergeCells(1, allRow, 3, allRow); int count1 = 0; for (int j = 0; j < diskItem.length; j++) { String value = ""; if (diskhash.get(diskItem[j]) != null) { value = (String) diskhash.get(diskItem[j]); } label = new Label(count1 + 4, allRow, value, p_labelFormat); sheet.addCell(label); sheet.mergeCells(4 + count1, allRow, 4 + count1 + 1, allRow); count1 += 2; } } // end // File file = new File(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/" + newip + "disk" + ".png"); // sheet,0,0,5,1,,, sheet.addImage(new WritableImage(1, allRow + 1, 9, 9, file)); } } catch (RowsExceededException e) { SysLogger.error("", e); } catch (WriteException e) { SysLogger.error("", e); } }
From source file:com.afunms.report.abstraction.ExcelReport1.java
/** * @author HONGLI MySQL xls//w ww.j av a 2s . c o m * @param filename * @throws DocumentException * @throws IOException */ public void createReportMySQLSelfExcel(String filename) { if (impReport.getTable() == null) { fileName = null; return; } WritableWorkbook wb = null; try { // fileName = ResourceCenter.getInstance().getSysPath() + // "temp\\dhcnms_report.xls"; // fileName = CommonAppUtil.getAppName() + // "/temp/hostnms_report.xls"; fileName = ResourceCenter.getInstance().getSysPath() + filename; wb = Workbook.createWorkbook(new File(fileName)); String hostname = (String) reportHash.get("dbname"); String ip = (String) reportHash.get("ip"); String newip = doip(ip); WritableSheet sheet = wb.createSheet(hostname + "", 0); String Ping = (String) reportHash.get("Ping"); String starttime = (String) reportHash.get("starttime"); String totime = (String) reportHash.get("totime"); Vector val = (Vector) reportHash.get("Val"); Hashtable maxping = (Hashtable) reportHash.get("ping"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); WritableFont labelFont = new WritableFont(WritableFont.createFont(""), 12, WritableFont.BOLD, false); WritableCellFormat labelFormat = new WritableCellFormat(labelFont); WritableCellFormat _labelFormat = new WritableCellFormat(); _labelFormat.setBackground(jxl.format.Colour.GRAY_25); WritableCellFormat p_labelFormat = new WritableCellFormat(); p_labelFormat.setBackground(jxl.format.Colour.ICE_BLUE); WritableCellFormat b_labelFormat = new WritableCellFormat(); b_labelFormat.setBackground(jxl.format.Colour.GRAY_50); Label tmpLabel = null; tmpLabel = new Label(1, 0, hostname + "", labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(0, 1, ":" + impReport.getTimeStamp()); sheet.addCell(tmpLabel); tmpLabel = new Label(0, 2, ": " + starttime + " " + totime); sheet.addCell(tmpLabel); tmpLabel = new Label(0, 4, "", b_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(1, 4, "", b_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(2, 4, "", b_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(0, 5, (String) maxping.get("pingnow"), p_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(1, 5, (String) maxping.get("pingmax"), p_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(2, 5, (String) maxping.get("avgpingcon"), p_labelFormat); sheet.addCell(tmpLabel); // File file = new File(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/" + newip + "ConnectUtilization" + ".png"); // sheet,0,0,5,1,,, // allRow = allRow+2; sheet.addImage(new WritableImage(1, 6, 7, 7, file)); // allRow = allRow+7; tmpLabel = new Label(0, 14, " ", b_labelFormat); sheet.addCell(tmpLabel); int row = 15; if (val != null && val.size() > 0) { for (int i = 0; i < val.size(); i++) { Hashtable return_value = (Hashtable) val.get(i); if (return_value != null && return_value.size() > 0) { String name = return_value.get("variable_name").toString(); String value = return_value.get("value").toString(); if (name.equalsIgnoreCase("Max_used_connections")) { name = ""; } if (name.equalsIgnoreCase("Handler_read_first")) { name = ""; } if (name.equalsIgnoreCase("Handler_read_key")) { name = ""; } if (name.equalsIgnoreCase("Handler_read_next")) { name = ""; } if (name.equalsIgnoreCase("Handler_read_prev")) { name = ""; } if (name.equalsIgnoreCase("Handler_read_rnd")) { name = "H"; } if (name.equalsIgnoreCase("Handler_read_rnd_next")) { name = ""; } if (name.equalsIgnoreCase("Open_tables")) { name = ""; } if (name.equalsIgnoreCase("Opened_tables")) { name = ""; } if (name.equalsIgnoreCase("Threads_cached")) { name = ""; } if (name.equalsIgnoreCase("Threads_connected")) { name = ""; } if (name.equalsIgnoreCase("Threads_created")) { name = ""; } if (name.equalsIgnoreCase("Threads_running")) { name = ""; } if (name.equalsIgnoreCase("Table_locks_immediate")) { name = ""; } if (name.equalsIgnoreCase("Table_locks_waited")) { name = ""; } if (name.equalsIgnoreCase("Key_read_requests")) { name = ""; } if (name.equalsIgnoreCase("Key_reads")) { name = ""; } if (name.equalsIgnoreCase("log_slow_queries")) { name = ""; } if (name.equalsIgnoreCase("slow_launch_time")) { name = "Slow_launch_threads"; } tmpLabel = new Label(0, row, name, p_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(1, row, value, p_labelFormat); sheet.addCell(tmpLabel); row++; } } } if (impReport.getChart() != null) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { ChartUtilities.writeChartAsPNG(baos, impReport.getChart().getChart(), impReport.getChart().getWidth(), impReport.getChart().getHeight()); } catch (IOException ioe) { } WritableImage wi = new WritableImage(2, 10000 + 5, 8, 12, baos.toByteArray()); sheet.addImage(wi); } wb.write(); } catch (Exception e) { // SysLogger.error("Error in ExcelReport.createReport()",e); SysLogger.error("", e); } finally { try { if (wb != null) wb.close(); } catch (Exception e) { } } }
From source file:com.afunms.report.abstraction.ExcelReport1.java
public void createReport_weball(String filename) { if (impReport.getTable() == null) { fileName = null;//from ww w. j av a2 s. c om return; } WritableWorkbook wb = null; try { // fileName = ResourceCenter.getInstance().getSysPath() + // "temp\\dhcnms_report.xls"; fileName = ResourceCenter.getInstance().getSysPath() + filename; wb = Workbook.createWorkbook(new File(fileName)); Hashtable allreporthash = new Hashtable(); allreporthash = reportHash; if (allreporthash != null && allreporthash.size() > 0) { Iterator keys = allreporthash.keySet().iterator(); String urlid = ""; int sheetNum = 0; while (keys.hasNext()) { urlid = keys.next().toString(); Hashtable report_has = (Hashtable) allreporthash.get(urlid); WritableSheet sheet = wb.createSheet((String) report_has.get("urlname") + "", sheetNum); sheetNum = sheetNum + 1; Calendar colTime = Calendar.getInstance(); Date cc = colTime.getTime(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); WritableFont labelFont = new WritableFont(WritableFont.createFont(""), 12, WritableFont.BOLD, false); WritableCellFormat labelFormat = new WritableCellFormat(labelFont); WritableCellFormat _labelFormat = new WritableCellFormat(); _labelFormat.setBackground(jxl.format.Colour.GRAY_25); WritableCellFormat p_labelFormat = new WritableCellFormat(); p_labelFormat.setBackground(jxl.format.Colour.ICE_BLUE); WritableCellFormat b_labelFormat = new WritableCellFormat(); b_labelFormat.setBackground(jxl.format.Colour.GRAY_50); Label tmpLabel = null; tmpLabel = new Label(1, 0, (String) report_has.get("urlname") + "", labelFormat); sheet.addCell(tmpLabel); String reporttime = (String) report_has.get("reporttime"); if (reporttime == null || reporttime.trim().length() == 0) { tmpLabel = new Label(0, 1, ":" + impReport.getTimeStamp()); } else { tmpLabel = new Label(0, 1, ":" + reporttime); } sheet.addCell(tmpLabel); tmpLabel = new Label(0, 2, ":" + sdf.format(cc)); sheet.addCell(tmpLabel); tmpLabel = new Label(0, 3, ":" + (String) report_has.get("urlstr")); sheet.addCell(tmpLabel); tmpLabel = new Label(0, 5, "", b_labelFormat); sheet.addCell(tmpLabel); /* * tmpLabel = new Label(1, 5, "",_labelFormat); * sheet.addCell(tmpLabel); */ tmpLabel = new Label(1, 5, "", _labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(2, 5, "", _labelFormat); sheet.addCell(tmpLabel); /* * tmpLabel = new Label(1, 5, Ping+"%",p_labelFormat); * sheet.addCell(tmpLabel); */ tmpLabel = new Label(1, 6, (String) report_has.get("minconn"), p_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(2, 6, (String) report_has.get("avgconn"), p_labelFormat); sheet.addCell(tmpLabel); // "../images/jfreechart/"+conn_name+".png" File file = new File(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/" + (String) report_has.get("wave_name") + ".png"); // sheet,0,0,5,1,,, // allRow = allRow+2; sheet.addImage(new WritableImage(1, 7, 7, 7, file)); // allRow = allRow+7; tmpLabel = new Label(0, 15, "()", b_labelFormat); sheet.addCell(tmpLabel); /* * tmpLabel = new Label(1, 14, "",_labelFormat); * sheet.addCell(tmpLabel); */ tmpLabel = new Label(1, 15, "", _labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(2, 15, "", _labelFormat); sheet.addCell(tmpLabel); /* * if((String)report_has.get("condelay") == null){ tmpLabel = * new Label(1, 15, "%",p_labelFormat); * sheet.addCell(tmpLabel); }else{ tmpLabel = new Label(1, * 15, (String)CPU.get("condelay")+"%",p_labelFormat); * sheet.addCell(tmpLabel); } */ if ((String) report_has.get("maxcondelay") == null) { tmpLabel = new Label(1, 16, "", p_labelFormat); sheet.addCell(tmpLabel); } else { tmpLabel = new Label(1, 16, (String) report_has.get("maxcondelay"), p_labelFormat); sheet.addCell(tmpLabel); } if ((String) report_has.get("avgcondelay") == null) { tmpLabel = new Label(2, 16, "", p_labelFormat); sheet.addCell(tmpLabel); } else { tmpLabel = new Label(2, 16, (String) report_has.get("avgcondelay"), p_labelFormat); sheet.addCell(tmpLabel); } int allRow = 16; // file = new File(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/" + report_has.get("delay_name") + ".png"); // sheet,0,0,5,1,,, allRow = allRow + 2; sheet.addImage(new WritableImage(1, allRow, 7, 7, file)); allRow = allRow + 8; tmpLabel = new Label(0, allRow, "", b_labelFormat); sheet.addCell(tmpLabel); // file = new File(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/" + report_has.get("conn_name") + ".png"); // sheet,0,0,5,1,,, allRow = allRow + 2; sheet.addImage(new WritableImage(1, allRow, 4, 5, file)); } wb.write(); } } catch (Exception e) { // SysLogger.error("Error in ExcelReport.createReport()",e); SysLogger.error("", e); } finally { try { if (wb != null) wb.close(); } catch (Exception e) { } } }
From source file:com.afunms.report.abstraction.ExcelReport1.java
public void createReport_monthweball(String filename) { if (impReport.getTable() == null) { fileName = null;/*from w w w .j ava 2 s . co m*/ return; } WritableWorkbook wb = null; try { // fileName = ResourceCenter.getInstance().getSysPath() + // "temp\\dhcnms_report.xls"; fileName = ResourceCenter.getInstance().getSysPath() + filename; wb = Workbook.createWorkbook(new File(fileName)); Hashtable allreporthash = new Hashtable(); allreporthash = reportHash; if (allreporthash != null && allreporthash.size() > 0) { Iterator keys = allreporthash.keySet().iterator(); String urlid = ""; int sheetNum = 0; while (keys.hasNext()) { urlid = keys.next().toString(); Hashtable report_has = (Hashtable) allreporthash.get(urlid); WritableSheet sheet = wb.createSheet((String) report_has.get("urlname") + "", sheetNum); sheetNum = sheetNum + 1; Calendar colTime = Calendar.getInstance(); Date cc = colTime.getTime(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); WritableFont labelFont = new WritableFont(WritableFont.createFont(""), 12, WritableFont.BOLD, false); WritableCellFormat labelFormat = new WritableCellFormat(labelFont); WritableCellFormat _labelFormat = new WritableCellFormat(); _labelFormat.setBackground(jxl.format.Colour.GRAY_25); WritableCellFormat p_labelFormat = new WritableCellFormat(); p_labelFormat.setBackground(jxl.format.Colour.ICE_BLUE); WritableCellFormat b_labelFormat = new WritableCellFormat(); b_labelFormat.setBackground(jxl.format.Colour.GRAY_50); Label tmpLabel = null; tmpLabel = new Label(1, 0, (String) report_has.get("urlname") + "", labelFormat); sheet.addCell(tmpLabel); String reporttime = (String) report_has.get("reporttime"); if (reporttime == null || reporttime.trim().length() == 0) { tmpLabel = new Label(0, 1, ":" + impReport.getTimeStamp()); } else { tmpLabel = new Label(0, 1, ":" + reporttime); } sheet.addCell(tmpLabel); tmpLabel = new Label(0, 2, ":" + sdf.format(cc)); sheet.addCell(tmpLabel); tmpLabel = new Label(0, 3, ":" + (String) report_has.get("urlstr")); sheet.addCell(tmpLabel); tmpLabel = new Label(0, 5, "", b_labelFormat); sheet.addCell(tmpLabel); /* * tmpLabel = new Label(1, 5, "",_labelFormat); * sheet.addCell(tmpLabel); */ tmpLabel = new Label(1, 5, "", _labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(2, 5, "", _labelFormat); sheet.addCell(tmpLabel); /* * tmpLabel = new Label(1, 5, Ping+"%",p_labelFormat); * sheet.addCell(tmpLabel); */ tmpLabel = new Label(1, 6, (String) report_has.get("minconn"), p_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(2, 6, (String) report_has.get("avgconn"), p_labelFormat); sheet.addCell(tmpLabel); // "../images/jfreechart/"+conn_name+".png" File file = new File(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/" + (String) report_has.get("wave_name") + ".png"); // sheet,0,0,5,1,,, // allRow = allRow+2; sheet.addImage(new WritableImage(1, 7, 7, 7, file)); // allRow = allRow+7; tmpLabel = new Label(0, 15, "()", b_labelFormat); sheet.addCell(tmpLabel); /* * tmpLabel = new Label(1, 14, "",_labelFormat); * sheet.addCell(tmpLabel); */ tmpLabel = new Label(1, 15, "", _labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(2, 15, "", _labelFormat); sheet.addCell(tmpLabel); /* * if((String)report_has.get("condelay") == null){ tmpLabel = * new Label(1, 15, "%",p_labelFormat); * sheet.addCell(tmpLabel); }else{ tmpLabel = new Label(1, * 15, (String)CPU.get("condelay")+"%",p_labelFormat); * sheet.addCell(tmpLabel); } */ if ((String) report_has.get("maxcondelay") == null) { tmpLabel = new Label(1, 16, "", p_labelFormat); sheet.addCell(tmpLabel); } else { tmpLabel = new Label(1, 16, (String) report_has.get("maxcondelay"), p_labelFormat); sheet.addCell(tmpLabel); } if ((String) report_has.get("avgcondelay") == null) { tmpLabel = new Label(2, 16, "", p_labelFormat); sheet.addCell(tmpLabel); } else { tmpLabel = new Label(2, 16, (String) report_has.get("avgcondelay"), p_labelFormat); sheet.addCell(tmpLabel); } int allRow = 16; // file = new File(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/" + report_has.get("delay_name") + ".png"); // sheet,0,0,5,1,,, allRow = allRow + 2; sheet.addImage(new WritableImage(1, allRow, 7, 7, file)); allRow = allRow + 8; tmpLabel = new Label(0, allRow, "", b_labelFormat); sheet.addCell(tmpLabel); // file = new File(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/" + report_has.get("conn_name") + ".png"); // sheet,0,0,5,1,,, allRow = allRow + 2; sheet.addImage(new WritableImage(1, allRow, 4, 5, file)); } wb.write(); } } catch (Exception e) { // SysLogger.error("Error in ExcelReport.createReport()",e); SysLogger.error("", e); } finally { try { if (wb != null) wb.close(); } catch (Exception e) { } } }
From source file:com.afunms.report.abstraction.ExcelReport1.java
public void createReport_syball(String filename) { if (impReport.getTable() == null) { fileName = null;// www. j a va 2 s . c om return; } WritableWorkbook wb = null; try { // fileName = ResourceCenter.getInstance().getSysPath() + // "temp\\dhcnms_report.xls"; fileName = ResourceCenter.getInstance().getSysPath() + filename; wb = Workbook.createWorkbook(new File(fileName)); Hashtable allreporthash = new Hashtable(); allreporthash = reportHash; if (allreporthash != null && allreporthash.size() > 0) { Iterator keys = allreporthash.keySet().iterator(); String ip = ""; int sheetNum = 0; while (keys.hasNext()) { ip = keys.next().toString(); String newip = doip(ip); Hashtable report_has = (Hashtable) allreporthash.get(ip); String dbname = (String) report_has.get("dbname"); WritableSheet sheet = wb.createSheet(dbname + "", sheetNum); sheetNum = sheetNum + 1; String Ping = (String) report_has.get("Ping"); // Calendar colTime = (Calendar)report_has.get("time"); // Date cc = colTime.getTime(); // Hashtable Memory = (Hashtable)report_has.get("Memory"); // Hashtable Disk = (Hashtable)report_has.get("Disk"); // Hashtable memMaxHash = // (Hashtable)report_has.get("memmaxhash"); // Hashtable memAvgHash = // (Hashtable)report_has.get("memavghash"); Hashtable maxping = (Hashtable) report_has.get("ping"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); WritableFont labelFont = new WritableFont(WritableFont.createFont(""), 12, WritableFont.BOLD, false); WritableCellFormat labelFormat = new WritableCellFormat(labelFont); WritableCellFormat _labelFormat = new WritableCellFormat(); _labelFormat.setBackground(jxl.format.Colour.GRAY_25); WritableCellFormat p_labelFormat = new WritableCellFormat(); p_labelFormat.setBackground(jxl.format.Colour.ICE_BLUE); WritableCellFormat b_labelFormat = new WritableCellFormat(); b_labelFormat.setBackground(jxl.format.Colour.GRAY_50); Label tmpLabel = null; tmpLabel = new Label(1, 0, dbname + "", labelFormat); sheet.addCell(tmpLabel); String reporttime = (String) report_has.get("reporttime"); if (reporttime == null || reporttime.trim().length() == 0) { tmpLabel = new Label(0, 1, ":" + impReport.getTimeStamp()); } else { tmpLabel = new Label(0, 1, ":" + reporttime); } sheet.addCell(tmpLabel); String starttime = (String) report_has.get("starttime"); String totime = (String) report_has.get("totime"); tmpLabel = new Label(0, 2, ": " + starttime + " " + totime); sheet.addCell(tmpLabel); tmpLabel = new Label(0, 4, "", b_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(1, 4, "", _labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(2, 4, "", _labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(1, 5, (String) maxping.get("pingmax"), p_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(2, 5, (String) maxping.get("avgpingcon"), p_labelFormat); sheet.addCell(tmpLabel); File file = null; try { // file = new File(ResourceCenter.getInstance().getSysPath() + "/images/jfreechart/" + newip + "ConnectUtilization" + ".png"); // sheet,0,0,5,1,,, // allRow = allRow+2; sheet.addImage(new WritableImage(1, 6, 7, 7, file)); // allRow = allRow+7; } catch (Exception ex) { ex.printStackTrace(); } tmpLabel = new Label(0, 14, "", b_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(1, 14, "", b_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(2, 14, "", _labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(3, 14, "MB", _labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(4, 14, "MB", _labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(5, 14, "", _labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(6, 14, "", _labelFormat); sheet.addCell(tmpLabel); int row = 14; // SybaseVO sysbaseVO = (SybaseVO) report_has.get("sysbaseVO"); if (sysbaseVO == null) sysbaseVO = new SybaseVO(); List dbsizelist = (List) sysbaseVO.getDbInfo(); if (dbsizelist != null && dbsizelist.size() > 0) { for (int i = 0; i < dbsizelist.size(); i++) { TablesVO tablesVO = (TablesVO) dbsizelist.get(i); String _dbname = tablesVO.getDb_name(); String dbsize = tablesVO.getDb_size(); String freesize = tablesVO.getDb_freesize(); String userdperc = tablesVO.getDb_usedperc(); row = row + 1; tmpLabel = new Label(0, 15 + i, i + 1 + "", p_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(1, 15 + i, _dbname, p_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(2, 15 + i, dbsize, p_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(3, 15 + i, freesize, p_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(4, 15 + i, userdperc, p_labelFormat); sheet.addCell(tmpLabel); } } } wb.write(); } } catch (Exception e) { // SysLogger.error("Error in ExcelReport.createReport()",e); SysLogger.error("", e); } finally { try { if (wb != null) wb.close(); } catch (Exception e) { } } }
From source file:com.afunms.report.abstraction.ExcelReport1.java
public void createReport_oraall(String filename) { if (impReport.getTable() == null) { fileName = null;/*from ww w . j a v a 2 s. co m*/ return; } WritableWorkbook wb = null; try { // fileName = ResourceCenter.getInstance().getSysPath() + // "temp\\dhcnms_report.xls"; fileName = ResourceCenter.getInstance().getSysPath() + filename; wb = Workbook.createWorkbook(new File(fileName)); Hashtable allreporthash = new Hashtable(); allreporthash = reportHash; if (allreporthash != null && allreporthash.size() > 0) { Iterator keys = allreporthash.keySet().iterator(); String ip = ""; int sheetNum = 0; while (keys.hasNext()) { ip = keys.next().toString(); String newip = doip(ip); Hashtable report_has = (Hashtable) allreporthash.get(ip); String dbname = (String) report_has.get("dbname"); WritableSheet sheet = wb.createSheet(dbname + "", sheetNum); sheetNum = sheetNum + 1; Vector tableinfo_v = new Vector(); if (report_has.get("tableinfo_v") != null) tableinfo_v = (Vector) report_has.get("tableinfo_v"); // Hashtable CPU = (Hashtable)report_has.get("CPU"); String Ping = (String) report_has.get("Ping"); Hashtable maxping = (Hashtable) report_has.get("ping"); // SysLogger.info("?????????????????pingmax????????????="+maxping.get("pingmax")); // SysLogger.info("?????????????????avgpingcon????????????="+maxping.get("avgpingcon")); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); WritableFont labelFont = new WritableFont(WritableFont.createFont(""), 12, WritableFont.BOLD, false); WritableCellFormat labelFormat = new WritableCellFormat(labelFont); WritableCellFormat _labelFormat = new WritableCellFormat(); _labelFormat.setBackground(jxl.format.Colour.GRAY_25); WritableCellFormat p_labelFormat = new WritableCellFormat(); p_labelFormat.setBackground(jxl.format.Colour.ICE_BLUE); WritableCellFormat b_labelFormat = new WritableCellFormat(); b_labelFormat.setBackground(jxl.format.Colour.GRAY_50); Label tmpLabel = null; tmpLabel = new Label(1, 0, dbname + "", labelFormat); sheet.addCell(tmpLabel); String reporttime = (String) report_has.get("reporttime"); if (reporttime == null || reporttime.trim().length() == 0) { tmpLabel = new Label(0, 1, ":" + impReport.getTimeStamp()); } else { tmpLabel = new Label(0, 1, ":" + reporttime); } sheet.addCell(tmpLabel); String starttime = (String) report_has.get("starttime"); String totime = (String) report_has.get("totime"); tmpLabel = new Label(0, 2, ": " + starttime + " " + totime); sheet.addCell(tmpLabel); tmpLabel = new Label(0, 4, "", b_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(1, 4, "", _labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(2, 4, "", _labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(1, 5, (String) maxping.get("pingmax"), p_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(2, 5, (String) maxping.get("avgpingcon"), p_labelFormat); sheet.addCell(tmpLabel); File file = null; try { // file = new File(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/" + newip + "ConnectUtilization" + ".png"); // sheet,0,0,5,1,,, // allRow = allRow+2; sheet.addImage(new WritableImage(1, 6, 7, 7, file)); // allRow = allRow+7; } catch (Exception ex) { ex.printStackTrace(); } tmpLabel = new Label(0, 14, "", b_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(1, 14, "", b_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(2, 14, "", _labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(3, 14, "MB", _labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(4, 14, "MB", _labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(5, 14, "", _labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(6, 14, "", _labelFormat); sheet.addCell(tmpLabel); int row = 14; // // Vector tableinfo_v = // (Vector)reportHash.get("tableinfo_v"); for (int i = 0; i < tableinfo_v.size(); i++) { Hashtable ht = (Hashtable) tableinfo_v.get(i); String _filename = ht.get("file_name").toString(); String tablespace = ht.get("tablespace").toString(); String size = ht.get("size_mb").toString(); String free = ht.get("free_mb").toString(); String percent = ht.get("percent_free").toString(); String status = ht.get("status").toString(); row = row + (i); tmpLabel = new Label(0, 15 + i, i + 1 + "", p_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(1, 15 + i, _filename, p_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(2, 15 + i, tablespace, p_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(3, 15 + i, size, p_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(4, 15 + i, free, p_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(5, 15 + i, percent, p_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(6, 15 + i, status, p_labelFormat); sheet.addCell(tmpLabel); } } wb.write(); } } catch (Exception e) { // SysLogger.error("Error in ExcelReport.createReport()",e); SysLogger.error("", e); } finally { try { if (wb != null) wb.close(); } catch (Exception e) { } } }
From source file:com.afunms.report.abstraction.ExcelReport1.java
/** * @author sqc//from w w w . j a v a 2s. c om * @param filename */ public void createReport_tomcatAll(String filename) { if (impReport.getTable() == null) { fileName = null; return; } WritableWorkbook wb = null; try { fileName = ResourceCenter.getInstance().getSysPath() + filename; wb = Workbook.createWorkbook(new File(fileName)); Hashtable allreport_has = new Hashtable(); allreport_has = reportHash; if (allreport_has != null && allreport_has.size() > 0) { Iterator keys = allreport_has.keySet().iterator(); String ip = ""; int sheetNum = 0; while (keys.hasNext()) { ip = keys.next().toString(); String newip = doip(ip); Hashtable report_has = (Hashtable) allreport_has.get(ip); reportHash = report_has; fileName = ResourceCenter.getInstance().getSysPath() + filename; String starttime = (String) reportHash.get("starttime"); String totime = (String) reportHash.get("totime"); String hostname = (String) reportHash.get("equipname"); WritableSheet sheet = wb.createSheet(hostname + "", sheetNum); sheetNum++; Hashtable CPU = (Hashtable) reportHash.get("CPU"); if (CPU == null) { CPU = new Hashtable(); } String Ping = (String) reportHash.get("Ping"); Hashtable Memory = (Hashtable) reportHash.get("Memory"); Hashtable Disk = (Hashtable) reportHash.get("Disk"); Hashtable memMaxHash = (Hashtable) reportHash.get("memmaxhash"); Hashtable memAvgHash = (Hashtable) reportHash.get("memavghash"); Hashtable maxping = (Hashtable) reportHash.get("ping"); Hashtable maxjvm = (Hashtable) reportHash.get("maxjvm"); String jvmnow = (String) reportHash.get("jvmnow"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String[] memoryItemch = { "", "", "", "" }; String[] memoryItem = { "Capability", "Utilization" }; String[] diskItem = { "AllSize", "UsedSize", "Utilization" }; String[] diskItemch = { "", "", "" }; // WritableFont labelFont = new // WritableFont(WritableFont.createFont(""), 12, // WritableFont.BOLD, false); // WritableCellFormat labelFormat = new // WritableCellFormat(labelFont); // // WritableCellFormat _labelFormat = new // WritableCellFormat(); // _labelFormat.setBackground(jxl.format.Colour.GRAY_25); // // WritableCellFormat p_labelFormat = new // WritableCellFormat(); // p_labelFormat.setBackground(jxl.format.Colour.ICE_BLUE); // // WritableCellFormat b_labelFormat = new // WritableCellFormat(); // b_labelFormat.setBackground(jxl.format.Colour.GRAY_50); Label tmpLabel = null; tmpLabel = new Label(0, 0, hostname + "", labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(0, 1, ":" + impReport.getTimeStamp(), labelFormat1); sheet.addCell(tmpLabel); tmpLabel = new Label(0, 2, ": " + starttime + " " + totime, labelFormat1); sheet.addCell(tmpLabel); sheet.mergeCells(0, 0, 9, 0); sheet.mergeCells(0, 1, 9, 1); sheet.mergeCells(0, 2, 9, 2); tmpLabel = new Label(0, 4, "", b_labelFormat); sheet.addCell(tmpLabel); sheet.mergeCells(0, 4, 0, 15); tmpLabel = new Label(1, 4, "", _labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(4, 4, "", _labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(7, 4, "", _labelFormat); sheet.addCell(tmpLabel); sheet.mergeCells(1, 4, 3, 4); sheet.mergeCells(4, 4, 6, 4); sheet.mergeCells(7, 4, 9, 4); tmpLabel = new Label(1, 5, Ping + "%", p_labelFormat); sheet.addCell(tmpLabel); if (maxping != null) { tmpLabel = new Label(4, 5, (String) maxping.get("pingmax"), p_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(7, 5, (String) maxping.get("avgpingcon"), p_labelFormat); sheet.addCell(tmpLabel); } sheet.mergeCells(1, 5, 3, 5); sheet.mergeCells(4, 5, 6, 5); sheet.mergeCells(7, 5, 9, 5); // File file = new File(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/" + newip + "TomcatPing" + ".png"); // sheet,0,0,5,1,,, // allRow = allRow+2; sheet.addImage(new WritableImage(1, 6, 9, 10, file)); // jvm------------------- tmpLabel = new Label(0, 16, "JVM", b_labelFormat); sheet.addCell(tmpLabel); sheet.mergeCells(0, 16, 0, 27); tmpLabel = new Label(1, 16, "", _labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(4, 16, "", _labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(7, 16, "", _labelFormat); sheet.addCell(tmpLabel); sheet.mergeCells(1, 16, 3, 16); sheet.mergeCells(4, 16, 6, 16); sheet.mergeCells(7, 16, 9, 16); tmpLabel = new Label(1, 17, jvmnow + "%", p_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(4, 17, (String) maxjvm.get("max_tomcat_jvm"), p_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(7, 17, (String) maxjvm.get("avg_tomcat_jvm"), p_labelFormat); sheet.addCell(tmpLabel); sheet.mergeCells(1, 17, 3, 17); sheet.mergeCells(4, 17, 6, 17); sheet.mergeCells(7, 17, 9, 17); /* * tmpLabel = new Label(0, 13, "JVM", b_labelFormat); * sheet.addCell(tmpLabel); */ // File file1 = new File(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/" + newip + "tomcat_jvm" + ".png"); // sheet,0,0,5,1,,, // allRow = allRow+2; sheet.addImage(new WritableImage(1, 18, 9, 10, file1)); // allRow = allRow+7; } } wb.write(); } catch (Exception e) { // SysLogger.error("Error in ExcelReport.createReport()",e); SysLogger.error("", e); } finally { try { if (wb != null) wb.close(); } catch (Exception e) { SysLogger.error("", e); } } }
From source file:com.afunms.report.abstraction.ExcelReport1.java
public void createReport_db2all(String filename) { if (impReport.getTable() == null) { fileName = null;//from www. j a v a 2 s .c o m return; } WritableWorkbook wb = null; try { // fileName = ResourceCenter.getInstance().getSysPath() + // "temp\\dhcnms_report.xls"; fileName = ResourceCenter.getInstance().getSysPath() + filename; wb = Workbook.createWorkbook(new File(fileName)); Hashtable allreporthash = new Hashtable(); allreporthash = reportHash; if (allreporthash != null && allreporthash.size() > 0) { Iterator keys = allreporthash.keySet().iterator(); String ip = ""; int sheetNum = 0; while (keys.hasNext()) { ip = keys.next().toString(); String newip = doip(ip); Hashtable report_has = (Hashtable) allreporthash.get(ip); String dbname = (String) report_has.get("dbname"); WritableSheet sheet = wb.createSheet(dbname + "", sheetNum); sheetNum = sheetNum + 1; // Hashtable CPU = (Hashtable)report_has.get("CPU"); String Ping = (String) report_has.get("Ping"); // Calendar colTime = (Calendar)report_has.get("time"); // Date cc = colTime.getTime(); // Hashtable Memory = (Hashtable)report_has.get("Memory"); // Hashtable Disk = (Hashtable)report_has.get("Disk"); // Hashtable memMaxHash = // (Hashtable)report_has.get("memmaxhash"); // Hashtable memAvgHash = // (Hashtable)report_has.get("memavghash"); Hashtable maxping = (Hashtable) report_has.get("ping"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); WritableFont labelFont = new WritableFont(WritableFont.createFont(""), 12, WritableFont.BOLD, false); WritableCellFormat labelFormat = new WritableCellFormat(labelFont); WritableCellFormat _labelFormat = new WritableCellFormat(); _labelFormat.setBackground(jxl.format.Colour.GRAY_25); WritableCellFormat p_labelFormat = new WritableCellFormat(); p_labelFormat.setBackground(jxl.format.Colour.ICE_BLUE); WritableCellFormat b_labelFormat = new WritableCellFormat(); b_labelFormat.setBackground(jxl.format.Colour.GRAY_50); Label tmpLabel = null; tmpLabel = new Label(1, 0, dbname + "", labelFormat); sheet.addCell(tmpLabel); String reporttime = (String) report_has.get("reporttime"); if (reporttime == null || reporttime.trim().length() == 0) { tmpLabel = new Label(0, 1, ":" + impReport.getTimeStamp()); } else { tmpLabel = new Label(0, 1, ":" + reporttime); } String starttime = (String) report_has.get("starttime"); String totime = (String) report_has.get("totime"); sheet.addCell(tmpLabel); tmpLabel = new Label(0, 2, ": " + starttime + " " + totime); sheet.addCell(tmpLabel); tmpLabel = new Label(0, 4, "", b_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(1, 4, "", _labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(2, 4, "", _labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(1, 5, (String) maxping.get("pingmax"), p_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(2, 5, (String) maxping.get("avgpingcon"), p_labelFormat); sheet.addCell(tmpLabel); File file = null; try { // file = new File(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/" + newip + "ConnectUtilization" + ".png"); // sheet,0,0,5,1,,, // allRow = allRow+2; sheet.addImage(new WritableImage(1, 6, 7, 7, file)); // allRow = allRow+7; } catch (Exception ex) { ex.printStackTrace(); } Hashtable returnhash = new Hashtable(); if (report_has.get("db2space") != null) returnhash = (Hashtable) report_has.get("db2space"); Enumeration dbs = returnhash.keys(); List retList = new ArrayList(); int row = 14; while (dbs.hasMoreElements()) { row = row + 1; tmpLabel = new Label(0, row, "", b_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(1, row, "", b_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(2, row, "MB", _labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(3, row, "MB", _labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(4, row, "(%)", _labelFormat); sheet.addCell(tmpLabel); String obj = (String) dbs.nextElement(); retList = (List) returnhash.get(obj); for (int i = 0; i < retList.size(); i++) { row = row + 1; Hashtable ht = (Hashtable) retList.get(i); if (ht == null) continue; String spacename = ""; if (ht.get("tablespace_name") != null) spacename = ht.get("tablespace_name").toString(); String size = ""; if (ht.get("totalspac") != null) size = ht.get("totalspac").toString(); String free = ""; if (ht.get("usablespac") != null) free = ht.get("usablespac").toString(); String percent = ""; if (ht.get("usableper") != null) percent = ht.get("usableper").toString(); row = row + (i); tmpLabel = new Label(0, row, i + 1 + "", p_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(1, row, spacename, p_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(2, row, size, p_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(3, row, free, p_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(4, row, percent, p_labelFormat); sheet.addCell(tmpLabel); } } } wb.write(); } } catch (Exception e) { // SysLogger.error("Error in ExcelReport.createReport()",e); SysLogger.error("", e); } finally { try { if (wb != null) wb.close(); } catch (Exception e) { } } }
From source file:com.afunms.report.abstraction.ExcelReport1.java
/** * modify HONG 2010-10-27/*from ww w .j a v a2 s . com*/ */ public void createReport_ora(String filename) { if (impReport.getTable() == null) { fileName = null; return; } WritableWorkbook wb = null; try { // fileName = ResourceCenter.getInstance().getSysPath() + // "temp\\dhcnms_report.xls"; // fileName = CommonAppUtil.getAppName() + // "/temp/hostnms_report.xls"; fileName = ResourceCenter.getInstance().getSysPath() + filename; wb = Workbook.createWorkbook(new File(fileName)); String hostname = (String) reportHash.get("dbname"); String ip = (String) reportHash.get("ip"); String newip = doip(ip); WritableSheet sheet = wb.createSheet(hostname + "", 0); String Ping = (String) reportHash.get("Ping"); String starttime = (String) reportHash.get("starttime"); String totime = (String) reportHash.get("totime"); Hashtable maxping = (Hashtable) reportHash.get("ping"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); WritableFont labelFont = new WritableFont(WritableFont.createFont(""), 12, WritableFont.BOLD, false); WritableCellFormat labelFormat = new WritableCellFormat(labelFont); WritableCellFormat _labelFormat = new WritableCellFormat(); _labelFormat.setBackground(jxl.format.Colour.GRAY_25); WritableCellFormat p_labelFormat = new WritableCellFormat(); p_labelFormat.setBackground(jxl.format.Colour.ICE_BLUE); WritableCellFormat b_labelFormat = new WritableCellFormat(); b_labelFormat.setBackground(jxl.format.Colour.GRAY_50); Label tmpLabel = null; tmpLabel = new Label(1, 0, hostname + "", labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(0, 1, ":" + impReport.getTimeStamp()); sheet.addCell(tmpLabel); tmpLabel = new Label(0, 2, ": " + starttime + " " + totime); sheet.addCell(tmpLabel); tmpLabel = new Label(0, 4, "", b_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(1, 4, "", _labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(2, 4, "", _labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(0, 5, (String) maxping.get("pingnow"), p_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(1, 5, (String) maxping.get("pingmax"), p_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(2, 5, (String) maxping.get("avgpingcon"), p_labelFormat); sheet.addCell(tmpLabel); // File file = new File(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/" + newip + "ConnectUtilization" + ".png"); // sheet,0,0,5,1,,, // allRow = allRow+2; sheet.addImage(new WritableImage(1, 6, 7, 7, file)); // allRow = allRow+7; tmpLabel = new Label(0, 14, "", b_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(1, 14, "", b_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(2, 14, "", b_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(3, 14, "", _labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(4, 14, "MB", _labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(5, 14, "MB", _labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(6, 14, "", _labelFormat); sheet.addCell(tmpLabel); // HONGLI ADD START1 tmpLabel = new Label(7, 14, "", _labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(8, 14, "", _labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(9, 14, "", _labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(10, 14, "", _labelFormat); sheet.addCell(tmpLabel); // HONGLI ADD END1 // HONGLI MODIFY START1 tmpLabel = new Label(11, 14, "", _labelFormat); // HONGLI MODIFY END1 sheet.addCell(tmpLabel); int row = 14; // Vector tableinfo_v = (Vector) reportHash.get("tableinfo_v"); // HONGLI ADD START2 Hashtable dbio = (Hashtable) reportHash.get("dbio"); // HONGLI ADD END2 for (int i = 0; i < tableinfo_v.size(); i++) { Hashtable ht = (Hashtable) tableinfo_v.get(i); String _filename = ht.get("file_name").toString(); String tablespace = ht.get("tablespace").toString(); String size = ht.get("size_mb").toString(); String free = ht.get("free_mb").toString(); String percent = ht.get("percent_free").toString(); String status = ht.get("status").toString(); // HONGLI ADD START3 String pyr = ""; String pbr = ""; String pyw = ""; String pbw = ""; if (dbio.containsKey(_filename)) { Hashtable iodetail = (Hashtable) dbio.get(_filename); if (iodetail != null && iodetail.size() > 0) { pyr = (String) iodetail.get("pyr"); pbr = (String) iodetail.get("pbr"); pyw = (String) iodetail.get("pyw"); pbw = (String) iodetail.get("pbw"); } } // HONGLI ADD END3 row = row + (i); tmpLabel = new Label(1, 15 + i, i + 1 + "", p_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(2, 15 + i, _filename, p_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(3, 15 + i, tablespace, p_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(4, 15 + i, size, p_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(5, 15 + i, free, p_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(6, 15 + i, percent, p_labelFormat); sheet.addCell(tmpLabel); // HONGLI ADD START4 tmpLabel = new Label(7, 15 + i, pyr, p_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(8, 15 + i, pbr, p_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(9, 15 + i, pyw, p_labelFormat); sheet.addCell(tmpLabel); tmpLabel = new Label(10, 15 + i, pbw, p_labelFormat); sheet.addCell(tmpLabel); // HONGLI ADD END4 tmpLabel = new Label(11, 15 + i, status, p_labelFormat); sheet.addCell(tmpLabel); } if (impReport.getChart() != null) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { ChartUtilities.writeChartAsPNG(baos, impReport.getChart().getChart(), impReport.getChart().getWidth(), impReport.getChart().getHeight()); } catch (IOException ioe) { } WritableImage wi = new WritableImage(2, 10000 + 5, 8, 12, baos.toByteArray()); sheet.addImage(wi); } wb.write(); } catch (Exception e) { // SysLogger.error("Error in ExcelReport.createReport()",e); SysLogger.error("", e); } finally { try { if (wb != null) wb.close(); } catch (Exception e) { } } }