diff options
author | Indrijeet kumar <indriku1@in.ibm.com> | 2020-05-12 07:57:57 +0530 |
---|---|---|
committer | Indrijeet kumar <indriku1@in.ibm.com> | 2020-05-12 07:58:09 +0530 |
commit | 313ed408f9046773cf514960e26d964388b86c7f (patch) | |
tree | 4d58bbf3d441b677c9199f4f4571c0356ab374ed /ecomp-sdk | |
parent | e1dce346175ec18962e8687479da76b59ca75ab2 (diff) |
removed some unwanted codes
removed some unwanted codes
Issue-ID: PORTAL-813
Change-Id: I1113977d884b86ea817be89faa2344ded6d404c1
Signed-off-by: Indrijeet Kumar <indriku1@in.ibm.com>
Diffstat (limited to 'ecomp-sdk')
-rw-r--r-- | ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/ReportHandler.java | 107 |
1 files changed, 10 insertions, 97 deletions
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/ReportHandler.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/ReportHandler.java index 3443cf6d..2729ebb0 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/ReportHandler.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/ReportHandler.java @@ -193,7 +193,6 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { private HashMap loadStyles(ReportRuntime rr, HSSFWorkbook wb) { HSSFCellStyle styleDefault = wb.createCellStyle(); - //System.out.println("Load Styles"); // Style default will be normal with no background HSSFFont fontDefault = wb.createFont(); // The default will be plain . @@ -206,7 +205,7 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { styleDefault.setBorderTop(BorderStyle.THIN); styleDefault.setBorderLeft(BorderStyle.THIN); styleDefault.setBorderRight(BorderStyle.THIN); - // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index); + styleDefault.setFillPattern(FillPatternType.NO_FILL); styleDefault.setFont(fontDefault); @@ -271,21 +270,14 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { SemaphoreType sem = (SemaphoreType) iter.next(); if(!semColumnList.contains(sem.getSemaphoreId())) continue; - //System.out.println("SemphoreId ----> " + sem.getSemaphoreId()); FormatList fList = sem.getFormatList(); List formatList = fList.getFormat(); for (Iterator fIter = formatList.iterator(); fIter.hasNext();) { FormatType fmt = (FormatType) fIter.next(); if(fmt!=null){ - //if (fmt.getLessThanValue().length() > 0) { cellStyle = wb.createCellStyle(); HSSFFont cellFont = wb.createFont(); - //System.out.println("Format Id " + fmt.getFormatId()); if (nvl(fmt.getBgColor()).length() > 0) { -// System.out.println("Load Styles " + -// fmt.getFormatId() -// + " " +fmt.getBgColor() + " " + -// ExcelColorDef.getExcelColor(fmt.getBgColor())); cellStyle.setFillForegroundColor(ExcelColorDef.getExcelColor(fmt .getBgColor())); cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND ); @@ -304,11 +296,9 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { cellFont.setFontName(fmt.getFontFace()); else cellFont.setFontName("Tahoma"); - //cellFont.setFontHeight((short) (10 / 0.05)); if(nvl(fmt.getFontSize()).length()>0) { try { - //cellFont.setFontHeight((short) (Integer.parseInt(fmt.getFontSize()) / 0.05)); cellFont.setFontHeight((short) (font_size/0.05)); } catch(NumberFormatException e){ cellFont.setFontHeight((short) (font_size / 0.05));//10 @@ -337,16 +327,13 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { private void paintExcelParams(final HSSFWorkbook wb, int rowNum, final int col, final List paramsList, final String customizedParamInfo, final HSSFSheet sheet, final String reportTitle, final String reportDescr) throws IOException { - //HSSFSheet sheet = wb.getSheet(getSheetName()); int cellNum = 0; HSSFRow row = null; short s1 = 0, s2 = (short) 1; HtmlStripper strip = new HtmlStripper(); // Name Style HSSFCellStyle styleName = wb.createCellStyle(); - //styleName.setFillBackgroundColor(HSSFColor.GREY_80_PERCENT.index); styleName.setFillForegroundColor(HSSFColor.GREY_25_PERCENT.index); - //styleName.setFillPattern(HSSFCellStyle.SPARSE_DOTS); styleName.setAlignment(HorizontalAlignment.CENTER); styleName.setBorderBottom(BorderStyle.THIN); styleName.setBorderTop(BorderStyle.THIN); @@ -377,16 +364,11 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { styleValue.setBorderTop(BorderStyle.THIN); styleValue.setBorderLeft(BorderStyle.THIN); styleValue.setBorderRight(BorderStyle.THIN); - // styleValue.setFillForegroundColor(HSSFColor.YELLOW.index); styleValue.setFillPattern(FillPatternType.NO_FILL); styleValue.setFont(fontDefault); HSSFCell cell = null; HSSFCellStyle styleDescription = wb.createCellStyle(); - styleDescription.setAlignment(HorizontalAlignment.CENTER); -// styleDescription.setBorderBottom(BorderStyle.THIN); -// styleDescription.setBorderTop(BorderStyle.THIN); -// styleDescription.setBorderRight(BorderStyle.THIN); -// styleDescription.setBorderLeft(BorderStyle.THIN); + styleDescription.setAlignment(HorizontalAlignment.CENTER); HSSFFont fontDescr = wb.createFont(); fontDescr.setFontHeight((short) (font_size / 0.05)); //14 fontDescr.setFontName("Tahoma"); @@ -400,7 +382,6 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { if(!Globals.customizeFormFieldInfo() || customizedParamInfo.length()<=0) { for (Iterator iter = paramsList.iterator(); iter.hasNext();) { IdNameValue value = (IdNameValue) iter.next(); - //System.out.println("\"" + value.getId() + " = " + value.getName() + "\""); if(nvl(value.getId()).trim().length()>0 && (!nvl(value.getId()).trim().equals("BLANK"))) { paramSeq += 1; if(paramSeq <= 1) { @@ -413,11 +394,9 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { strBuf.append(reportTitle+"\n"); - //strBuf.append("Run-time Parameters\n"); } row = sheet.createRow(++rowNum); cellNum = 0; - //System.out.println("RowNum " + rowNum + " " + value.getId() + " " +value.getName()); cell = row.createCell((short) cellNum); cell.setCellValue(value.getId()); cell.setCellStyle(styleName); @@ -425,8 +404,6 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { cell = row.createCell((short) cellNum); cell.setCellValue(value.getName().replaceAll("~",",")); cell.setCellStyle(styleValue); - - //strBuf.append(value.getId()+": "+ value.getName()+"\n"); } } //for } else { @@ -453,15 +430,13 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { s = s.replaceAll(",", "|"); s = s.replaceAll("~", ","); if(s.indexOf(":")!= -1) { - //System.out.println("|"+s+"|"); row = sheet.createRow(++rowNum); cell = row.createCell((short) 0); sheet.addMergedRegion(new CellRangeAddress(rowNum, rowNum, s1, s2)); cellDescr = row.createCell((short) 0); cellDescr.setCellValue("Run-time Parameters"); cellDescr.setCellStyle(styleDescription); - - //strBuf.append("Run-time Parameters\n"); + StringTokenizer st = new StringTokenizer(s.trim(), "|"); while(st.hasMoreTokens()) { token = st.nextToken(); @@ -490,7 +465,6 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { cell = row.createCell((short) cellNum); cell.setCellValue(value.trim()); cell.setCellStyle(styleValue); - //strBuf.append(name.trim()+": "+ value.trim()+"\n"); } /* if(token.endsWith(":") && (value!=null && value.trim().length()<=0) && (name!=null && name.trim().length()>0 && name.endsWith(":"))) { name = name.substring(0, name.indexOf(":")+1); @@ -581,7 +555,6 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { int mb = 1024*1024; Runtime runtime = Runtime.getRuntime(); int returnValue = 0; - // HSSFSheet sheet = wb.getSheetAt(0); HSSFCellStyle styleDefault = wb.createCellStyle(); HSSFCellStyle styleNumber = wb.createCellStyle(); HSSFCellStyle styleDecimalNumber = wb.createCellStyle(); @@ -589,9 +562,7 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { HSSFCellStyle styleCurrencyDecimalNumber = wb.createCellStyle(); HSSFCellStyle styleDate = wb.createCellStyle(); HtmlStripper strip = new HtmlStripper(); - //HSSFSheet sheet = wb.getSheet(getSheetName()); HSSFCellStyle styleDataHeader = wb.createCellStyle(); - // style.setFillBackgroundColor(HSSFColor.AQUA.index); styleDataHeader.setFillForegroundColor(HSSFColor.GREY_40_PERCENT.index); styleDataHeader.setFillPattern(FillPatternType.SOLID_FOREGROUND ); styleDataHeader.setAlignment(HorizontalAlignment.CENTER); @@ -613,25 +584,6 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { ColumnHeaderRow chr = null; String title = ""; -// System.out.println("***************** Size " + rd.reportColumnHeaderRows.size()); -// for (int i = 0; i < rd.reportColumnHeaderRows.size(); i++) { -// for (int j = 0; j < rd.reportColumnHeaderRows.getColumnHeaderRow(i).size(); j++) { -// System.out.println("Column Title " + rd.reportColumnHeaderRows.getColumnHeaderRow(i).getColumnHeader(j).getColumnTitle() -// + " " + rd.reportColumnHeaderRows.getColumnHeaderRow(i).getColumnHeader(j).isVisible()); -// } -// } -/* List dsList = rr.getDataSourceList().getDataSource(); - HashMap dataColumnTypeHashMap = new HashMap(); - for (Iterator iter = dsList.iterator(); iter.hasNext();) { - DataSourceType element = (DataSourceType) iter.next(); - List dcList = element.getDataColumnList().getDataColumn(); - for (Iterator iterator = dcList.iterator(); iterator.hasNext();) { - DataColumnType element1 = (DataColumnType) iterator.next(); - dataTypeMap.put(element1.getColId(), element1.getColType()); - dataColumnTypeHashMap.put(element1.getColName(), element1); - } - } -*/ int columnRows = rr.getVisibleColumnCount() - 1; HttpSession session = request.getSession(); @@ -722,18 +674,6 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { } // for */ - //cellNum = -1; - - -// Set mapSet = dataTypeMap.entrySet(); -// Map.Entry me; -// String element, value ; -// for (Iterator iter = mapSet.iterator(); iter.hasNext();) { -// me=(Map.Entry)iter.next(); -// element = (String) me.getKey(); -// value = (String) me.getValue(); -// System.out.println("DataTypeMap " + element + " " + value); -// } for (chr.resetNext(); chr.hasNext();) { ColumnHeader ch = chr.getNext(); @@ -782,7 +722,6 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { // Data // Create some cell styles. - //HSSFCellStyle styleDefault = wb.createCellStyle(); HSSFCellStyle styleCell = null; HSSFCellStyle styleTotal = wb.createCellStyle(); @@ -813,7 +752,6 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { styleDefault.setBorderTop(BorderStyle.THIN); styleDefault.setBorderLeft(BorderStyle.THIN); styleDefault.setBorderRight(BorderStyle.THIN); - // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index); styleDefault.setFillPattern(FillPatternType.NO_FILL); styleDefault.setFont(fontDefault); styleDefault.setWrapText(true); @@ -823,11 +761,10 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { styleNumber.setBorderTop(BorderStyle.THIN); styleNumber.setBorderLeft(BorderStyle.THIN); styleNumber.setBorderRight(BorderStyle.THIN); - // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index); styleNumber.setFillPattern(FillPatternType.NO_FILL); styleNumber.setFont(fontDefault); try { - styleNumber.setDataFormat((short)0x26);//HSSFDataFormat.getBuiltinFormat("(#,##0_);[Red](#,##0)")); + styleNumber.setDataFormat((short)0x26); } catch (Exception e) { } @@ -837,10 +774,9 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { styleDecimalNumber.setBorderTop(BorderStyle.THIN); styleDecimalNumber.setBorderLeft(BorderStyle.THIN); styleDecimalNumber.setBorderRight(BorderStyle.THIN); - // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index); styleDecimalNumber.setFillPattern(FillPatternType.NO_FILL); styleDecimalNumber.setFont(fontDefault); - styleDecimalNumber.setDataFormat((short)0x27);//HSSFDataFormat.getBuiltinFormat("(#,##0.00_);[Red](#,##0.00)")); + styleDecimalNumber.setDataFormat((short)0x27); //Decimal Number styleDecimalNumberTotal.setAlignment(HorizontalAlignment.CENTER); @@ -848,7 +784,6 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { styleDecimalNumberTotal.setBorderTop(BorderStyle.THIN); styleDecimalNumberTotal.setBorderLeft(BorderStyle.THIN); styleDecimalNumberTotal.setBorderRight(BorderStyle.THIN); - // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index); styleDecimalNumberTotal.setFillPattern(FillPatternType.NO_FILL); styleDecimalNumberTotal.setFont(fontBold); styleDecimalNumberTotal.setDataFormat((short)0x27);//HSSFDataFormat.getBuiltinFormat("(#,##0.00_);[Red](#,##0.00)")); @@ -859,10 +794,9 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { styleCurrencyDecimalNumber.setBorderTop(BorderStyle.THIN); styleCurrencyDecimalNumber.setBorderLeft(BorderStyle.THIN); styleCurrencyDecimalNumber.setBorderRight(BorderStyle.THIN); - // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index); styleCurrencyDecimalNumber.setFillPattern(FillPatternType.NO_FILL); styleCurrencyDecimalNumber.setFont(fontDefault); - styleCurrencyDecimalNumber.setDataFormat((short)8);//HSSFDataFormat.getBuiltinFormat("($#,##0.00_);[Red]($#,##0.00)")); + styleCurrencyDecimalNumber.setDataFormat((short)8); //currency number bold styleCurrencyDecimalNumberTotal.setAlignment(HorizontalAlignment.CENTER); @@ -870,7 +804,6 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { styleCurrencyDecimalNumberTotal.setBorderTop(BorderStyle.THIN); styleCurrencyDecimalNumberTotal.setBorderLeft(BorderStyle.THIN); styleCurrencyDecimalNumberTotal.setBorderRight(BorderStyle.THIN); - // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index); styleCurrencyDecimalNumberTotal.setFillPattern(FillPatternType.NO_FILL); styleCurrencyDecimalNumberTotal.setFont(fontBold); styleCurrencyDecimalNumberTotal.setDataFormat((short)8);//HSSFDataFormat.getBuiltinFormat("($#,##0.00_);[Red]($#,##0.00)")); @@ -885,7 +818,7 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index); styleCurrencyNumber.setFillPattern(FillPatternType.NO_FILL); styleCurrencyNumber.setFont(fontDefault); - styleCurrencyNumber.setDataFormat((short) 6);//HSSFDataFormat.getBuiltinFormat("($#,##0_);[Red]($#,##0)")); + styleCurrencyNumber.setDataFormat((short) 6); //CurrencyNumber @@ -897,7 +830,7 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index); styleCurrencyNumberTotal.setFillPattern(FillPatternType.NO_FILL); styleCurrencyNumberTotal.setFont(fontBold); - styleCurrencyNumberTotal.setDataFormat((short) 6);//HSSFDataFormat.getBuiltinFormat("($#,##0_);[Red]($#,##0)")); + styleCurrencyNumberTotal.setDataFormat((short) 6); //Date styleDate.setAlignment(HorizontalAlignment.CENTER); @@ -905,7 +838,6 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { styleDate.setBorderTop(BorderStyle.THIN); styleDate.setBorderLeft(BorderStyle.THIN); styleDate.setBorderRight(BorderStyle.THIN); - // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index); styleDate.setFillPattern(FillPatternType.NO_FILL); styleDate.setFont(fontDefault); styleDate.setDataFormat((short)0xe);//HSSFDataFormat.getBuiltinFormat("m/d/yy")); @@ -916,9 +848,8 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { styleTotal.setBorderTop(BorderStyle.THIN); styleTotal.setBorderLeft(BorderStyle.THIN); styleTotal.setBorderRight(BorderStyle.THIN); - // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index); styleTotal.setFillPattern(FillPatternType.NO_FILL); - styleTotal.setDataFormat((short)0x28);//HSSFDataFormat.getBuiltinFormat("(#,##0.00_);[Red](#,##0.00)")); + styleTotal.setDataFormat((short)0x28); styleTotal.setFont(fontBold); styleCurrencyTotal.setAlignment(HorizontalAlignment.CENTER); @@ -926,9 +857,8 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { styleCurrencyTotal.setBorderTop(BorderStyle.THIN); styleCurrencyTotal.setBorderLeft(BorderStyle.THIN); styleCurrencyTotal.setBorderRight(BorderStyle.THIN); - // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index); styleCurrencyTotal.setFillPattern(FillPatternType.NO_FILL); - styleCurrencyTotal.setDataFormat((short)8);//HSSFDataFormat.getBuiltinFormat("($#,##0.00_);[Red]($#,##0.00)")); + styleCurrencyTotal.setDataFormat((short)8); styleCurrencyTotal.setFont(fontBold); styleDefaultTotal.setAlignment(HorizontalAlignment.CENTER); @@ -936,10 +866,8 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { styleDefaultTotal.setBorderTop(BorderStyle.THIN); styleDefaultTotal.setBorderLeft(BorderStyle.THIN); styleDefaultTotal.setBorderRight(BorderStyle.THIN); - // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index); styleDefaultTotal.setFillPattern(FillPatternType.NO_FILL); styleDefaultTotal.setDataFormat((short)0x28); - ////styleDefaultTotal.setDataFormat(HSSFDataFormat.getBuiltinFormat("($#,##0.00_);[Red]($#,##0.00)")); styleDefaultTotal.setFont(fontBold); firstPass = true; @@ -1002,7 +930,6 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { rd.reportDataRows.resetNext(); dr = rd.reportDataRows.getNext(); j = 0; - //if(rowCount%1000 == 0) wb.write(sos); /*if(rd.reportTotalRowHeaderCols!=null) { //cellNum = -1; @@ -1022,10 +949,7 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { //} // for }*/ firstPass = false; - //cellNum = -1; for (dr.resetNext(); dr.hasNext();j++) { - //for (chr.resetNext(); chr.hasNext();) { - //ColumnHeader ch = chr.getNext(); styleCell = null; DataValue dv = dr.getNext(); HtmlFormatter htmlFormat = dv.getCellFormatter(); @@ -1040,15 +964,10 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { if(dv.isVisible()) { cellNum += 1; cell = row.createCell((short) cellNum); - //System.out.println("Stripping HTML 1"); //cell.setCellValue(strip.stripHtml(dv.getDisplayValue())); String dataType = (String) (dataTypeMap.get(dv.getColId())); //System.out.println("Value " + value + " " + (( dataType !=null && dataType.equals("DATE")) || (dv.getColName()!=null && dv.getColName().toLowerCase().endsWith("date"))) ); if (dataType!=null && dataType.equals("NUMBER")){ - //cellNumber = row.createCell((short) cellNum); - //cellNumber.setCellType(HSSFCell.CELL_TYPE_NUMERIC); - //cellNumber.setCellValue(dv.getDisplayValue()); - //cellCurrencyNumber = row.createCell((short) cellNum); int zInt = 0; if (value.equals("null")){ cell.setCellValue(zInt); @@ -1057,15 +976,9 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { if ((value.indexOf("."))!= -1){ if ((value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) { - //if (dv.getDisplayValue().startsWith("$")){ - //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("($#,##0.00);($#,##0.00)")); String tempDollar = dv.getDisplayValue().trim(); tempDollar = tempDollar.replaceAll(" ", "").substring(0); tempDollar = tempDollar.replaceAll("\\$", "").substring(0); - //System.out.println("SUBSTRING |" + tempDollar); - //System.out.println("Before copy Value |" + tempDollar); - //tempDollar = String.copyValueOf(tempDollar.toCharArray(), 1, tempDollar.length()-1); - //System.out.println("After copy Value |" + tempDollar); if ((tempDollar.indexOf(","))!= -1){ tempDollar = tempDollar.replaceAll(",", ""); } |