summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-analytics
diff options
context:
space:
mode:
authorIndrijeet kumar <indriku1@in.ibm.com>2020-06-09 08:44:46 +0530
committerIndrijeet kumar <indriku1@in.ibm.com>2020-06-09 08:44:53 +0530
commit34dad1cdfd40a80fd37e5f68139e68743d1963d4 (patch)
tree8b66d5465327c09edf0f5d8cb25ae8f45e856f0f /ecomp-sdk/epsdk-analytics
parent6d48b04c34a009323b92b23efc507c63e40b1d87 (diff)
lowered code smells in PdfReportHandler.java
lowered code smells in PdfReportHandler.java Issue-ID: PORTAL-813 Change-Id: I93bcc30c44d8cd5c4b5583584ff5b131a3dad6e1 Signed-off-by: Indrijeet Kumar <indriku1@in.ibm.com>
Diffstat (limited to 'ecomp-sdk/epsdk-analytics')
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/pdf/PdfReportHandler.java52
1 files changed, 3 insertions, 49 deletions
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/pdf/PdfReportHandler.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/pdf/PdfReportHandler.java
index f3aad70f..496b1598 100644
--- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/pdf/PdfReportHandler.java
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/pdf/PdfReportHandler.java
@@ -1108,7 +1108,6 @@ public class PdfReportHandler extends org.onap.portalsdk.analytics.RaptorObject{
for(dr.resetNext();dr.hasNext();)
{
DataValue dv = dr.getNext();
- //System.out.println(columnCount +" --> "+dv);
if(dv.isVisible()) {
HtmlFormatter cfmt = dv.getCellFormatter();
HtmlFormatter rfmt = dv.getRowFormatter();
@@ -1161,7 +1160,6 @@ public class PdfReportHandler extends org.onap.portalsdk.analytics.RaptorObject{
for(;dr.hasNext();)
{
DataValue dv = dr.getNext();
- //System.out.println(columnCount +" --> "+dv);
if(dv.isVisible()) {
HtmlFormatter cfmt = dv.getCellFormatter();
HtmlFormatter rfmt = dv.getRowFormatter();
@@ -1226,8 +1224,6 @@ public class PdfReportHandler extends org.onap.portalsdk.analytics.RaptorObject{
font.setColor(Color.decode(fmt.getFontColor()));
if(fmt.getFontSize().trim().length()>0)
font.setSize(Float.parseFloat(fmt.getFontSize())-Globals.getDataFontSizeOffset());
-// if(fmt.getFontFace().trim().length()>0)
-// cellFont.setFamily()
}
@@ -1363,7 +1359,6 @@ public class PdfReportHandler extends org.onap.portalsdk.analytics.RaptorObject{
String title = (String) session.getAttribute("TITLE_"+index);
String subtitle = (String) session.getAttribute("SUBTITLE_"+index);
if(nvl(title).length()>0) {
- //PdfPTable table = new PdfPTable(1);
table.setWidthPercentage(100f);
table.getDefaultCell().setHorizontalAlignment(Rectangle.ALIGN_CENTER);
table.getDefaultCell().setVerticalAlignment(Rectangle.ALIGN_BOTTOM);
@@ -1374,17 +1369,11 @@ public class PdfReportHandler extends org.onap.portalsdk.analytics.RaptorObject{
Font.BOLD,
Color.BLACK);
- //addEmptyRows(table,1);
table.getDefaultCell().setHorizontalAlignment(Rectangle.ALIGN_CENTER);
- //table.getDefaultCell().setBackgroundColor(Color.decode(Globals.getDataTableHeaderBackgroundFontColor()));
title = Utils.replaceInString(title, "<BR/>", " ");
title = Utils.replaceInString(title, "<br/>", " ");
title = Utils.replaceInString(title, "<br>", " ");
title = strip.stripHtml(nvl(title).trim());
- //subtitle = Utils.replaceInString(subtitle, "<BR/>", " ");
- //subtitle = Utils.replaceInString(subtitle, "<br/>", " ");
- //subtitle = Utils.replaceInString(subtitle, "<br>", " ");
- //subtitle = strip.stripHtml(nvl(subtitle).trim());
StyleSheet styles = new StyleSheet();
HTMLWorker htmlWorker = new HTMLWorker(document);
@@ -1401,17 +1390,11 @@ public class PdfReportHandler extends org.onap.portalsdk.analytics.RaptorObject{
}
p1.add(elem);
}
- //cell = new PdfPCell(p1);
StyleSheet style = new StyleSheet();
style.loadTagStyle("font", "font-size", "3");
style.loadTagStyle("font", "size", "3");
styles.loadStyle("pdfFont1", "size", "11px");
styles.loadStyle("pdfFont1", "font-size", "11px");
- /*ArrayList p = HTMLWorker.parseToList(new StringReader(nvl(title)), style);
- for (int k = 0; k < p.size(); ++k){
- document.add((com.lowagie.text.Element)p.get(k));
- }*/
- //p1.font().setSize(3.0f);
PdfPCell titleCell = new PdfPCell(new Phrase(title, font));
titleCell.setColspan(rr.getVisibleColumnCount());
PdfPCell subtitleCell = new PdfPCell(p1);
@@ -1420,7 +1403,6 @@ public class PdfReportHandler extends org.onap.portalsdk.analytics.RaptorObject{
subtitleCell.setHorizontalAlignment(1);
table.addCell(titleCell);
table.addCell(subtitleCell);
- //document.add(table);
}
return table;
}
@@ -1450,14 +1432,7 @@ public class PdfReportHandler extends org.onap.portalsdk.analytics.RaptorObject{
Font.BOLD,
Color.BLACK);
-
- //addEmptyRows(table,1);
table.getDefaultCell().setHorizontalAlignment(Rectangle.ALIGN_CENTER);
- //table.getDefaultCell().setBackgroundColor(Color.decode(Globals.getDataTableHeaderBackgroundFontColor()));
- /*title = Utils.replaceInString(title, "<BR/>", " ");
- title = Utils.replaceInString(title, "<br/>", " ");
- title = Utils.replaceInString(title, "<br>", " ");
- title = strip.stripHtml(nvl(title).trim());*/
StyleSheet style = new StyleSheet();
HTMLWorker htmlWorker = new HTMLWorker(document);
@@ -1475,15 +1450,12 @@ public class PdfReportHandler extends org.onap.portalsdk.analytics.RaptorObject{
p1.add(elem);
}
-/*
- HTMLWorker.parseToList(new StringReader(nvl(title)), style);*/
PdfPCell titleCell = new PdfPCell(p1);
titleCell.setHorizontalAlignment(Element.ALIGN_LEFT);
table.addCell(titleCell);
//table.
document.add(table);
}
- //return table;
}
@@ -1494,39 +1466,26 @@ public class PdfReportHandler extends org.onap.portalsdk.analytics.RaptorObject{
FONT_SIZE+1f,
Font.BOLD,
Color.decode(Globals.getDataTableHeaderFontColor()));
- //table.setHeaderRows(1);
table.getDefaultCell().setHorizontalAlignment(Rectangle.ALIGN_CENTER);
table.getDefaultCell().setBackgroundColor(Color.decode(Globals.getDataTableHeaderBackgroundFontColor()));
String title = "";
boolean firstPass = true;
- /*if(rd.reportTotalRowHeaderCols!=null) {
- if(firstPass) {
- table.addCell(new Paragraph("No.", font));
- firstPass = false;
- }
- }*/
for (rd.reportColumnHeaderRows.resetNext(); rd.reportColumnHeaderRows.hasNext();)
{
if(firstPass) {
for(rd.reportRowHeaderCols.resetNext();rd.reportRowHeaderCols.hasNext();) {
- /*if(firstPass) {
- table.addCell(new Paragraph("No.", font));
- firstPass = false;
- } else {*/
RowHeaderCol rhc = rd.reportRowHeaderCols.getNext();
title = rhc.getColumnTitle();
title = Utils.replaceInString(title,"_nl_", " \n");
table.addCell(new Paragraph(title,font));
- //}
}
}
ColumnHeaderRow chr = rd.reportColumnHeaderRows.getNext();
for (chr.resetNext(); chr.hasNext();) {
ColumnHeader ch = chr.getNext();
- //System.out.println(ch);
if(ch.isVisible()) {
title = ch.getColumnTitle();
title = Utils.replaceInString(title,"_nl_", " \n");
@@ -1542,13 +1501,10 @@ public class PdfReportHandler extends org.onap.portalsdk.analytics.RaptorObject{
Date sysdate = oracleDateFormat.parse(ReportLoader.getSystemDateTime());
SimpleDateFormat dtimestamp = new SimpleDateFormat(Globals.getScheduleDatePattern());
return dtimestamp.format(sysdate)+" "+Globals.getTimeZone();
- //paramList.add(new IdNameValue("DATE", dtimestamp.format(sysdate)+" "+Globals.getTimeZone()));
} catch(Exception ex) {}
SimpleDateFormat s = new SimpleDateFormat(pattern);
s.setTimeZone(TimeZone.getTimeZone(Globals.getTimeZone()));
- //System.out.println("^^^^^^^^^^^^^^^^^^^^ " + Calendar.getInstance().getTime());
- //System.out.println("^^^^^^^^^^^^^^^^^^^^ " + s.format(Calendar.getInstance().getTime()));
return s.format(Calendar.getInstance().getTime());
}
@@ -1567,12 +1523,10 @@ public class PdfReportHandler extends org.onap.portalsdk.analytics.RaptorObject{
} catch (NumberFormatException e) {}
pb.setCurrentPage(temp);
- //pb.setPortrait( trueORfalse(request.getParameter("isPortrait"),true));
pb.setPortrait(trueORfalse(rr.getPDFOrientation() == "portait"?"true":"false", true));
- //pb.setCoverPageIncluded( trueORfalse(request.getParameter("isCoverPageIncluded"), true));
- //if(Globals.isCoverPageNeeded()) {
- pb.setCoverPageIncluded(Globals.isCoverPageNeeded()?rr.isPDFCoverPage():false);
- //}
+
+ pb.setCoverPageIncluded(Globals.isCoverPageNeeded()?rr.isPDFCoverPage():false);
+
pb.setTitle(nvl(request.getParameter("title")));
pb.setPagesize(nvls(request.getParameter("pagesize"),"LETTER"));