summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-analytics/src/main
diff options
context:
space:
mode:
authorLorraine Welch <lb2391@att.com>2020-05-20 13:49:30 +0000
committerGerrit Code Review <gerrit@onap.org>2020-05-20 13:49:30 +0000
commit848ab89ed4ef881ec913a16324a5a4d6654d7659 (patch)
treee8fd0557878b0ea7cdaa908886ada93d2036400d /ecomp-sdk/epsdk-analytics/src/main
parentcce0f0aad94690b67024dab191988814ded1fb74 (diff)
parentf89e07be16d3281bc89fd8c5d6aff5910e10d970 (diff)
Merge "removed unwanted codes in PdfReportHandler"
Diffstat (limited to 'ecomp-sdk/epsdk-analytics/src/main')
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/pdf/PdfReportHandler.java127
1 files changed, 3 insertions, 124 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 d77e6bc7..1ff21200 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
@@ -200,7 +200,6 @@ public class PdfReportHandler extends org.onap.portalsdk.analytics.RaptorObject{
reportDisplayTypeMap = (TreeMap) request.getSession().getAttribute(AppConstants.SI_DASHBOARD_DISPLAYTYPE_MAP);
if(reportRuntimeMap!=null) {
- //ServletOutputStream sos = response.getOutputStream();
Set setReportRuntime = reportRuntimeMap.entrySet();
Set setReportDataMap = reportDataMap.entrySet();
Set setReportDisplayTypeMap = reportDisplayTypeMap.entrySet();
@@ -213,7 +212,6 @@ public class PdfReportHandler extends org.onap.portalsdk.analytics.RaptorObject{
Map.Entry entryData = (Entry) iter2.next();
Map.Entry entry = (Entry) iter.next();
Map.Entry entryCheckChart = (Entry) iter3.next();
- //String rep_id = (String) entry.getKey();
ReportRuntime rrDashRep = (ReportRuntime) entry.getValue();
if(count == 1) {
@@ -224,7 +222,6 @@ public class PdfReportHandler extends org.onap.portalsdk.analytics.RaptorObject{
}
ReportData rdDashRep = (ReportData) entryData.getValue();
int col = 0;
- //pb.setDisplayChart(nvl(rr.getChartType()).trim().length()>0 && rr.getDisplayChart());
if( ((rrDashRep.getChartType()).trim().length()>0 && rrDashRep.getDisplayChart()) && entryCheckChart.getValue().toString().equals("c")) {
document.newPage();
pb.setTitle(nvl(rrDashRep.getReportTitle()).length()>0?rrDashRep.getReportTitle():rrDashRep.getReportName());
@@ -244,9 +241,6 @@ public class PdfReportHandler extends org.onap.portalsdk.analytics.RaptorObject{
logger.error(EELFLoggerDelegate.errorLogger, "RaptorException in createPdfFileContent", rex);
}
} else {
-
- //ReportRuntime rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME);
- //ReportData rd = (ReportData) request.getSession().getAttribute(AppConstants.RI_REPORT_DATA);
rr = null;
ReportData rd = null;
String parent = "";
@@ -267,7 +261,6 @@ public class PdfReportHandler extends org.onap.portalsdk.analytics.RaptorObject{
pb = preparePdfBean(request,rr);
FONT_FAMILY = rr.getPDFFont();
FONT_SIZE = rr.getPDFFontSize();
- //System.out.println(pb);
formattedReportName = new HtmlStripper().stripSpecialCharacters(rr.getReportName());
@@ -290,18 +283,14 @@ public class PdfReportHandler extends org.onap.portalsdk.analytics.RaptorObject{
writer.setPageEvent(new PageEvent(pb));//header,footer,bookmark
document.open();
- //System.out.println("Document 1 " + document);
if(pb.isCoverPageIncluded()) {
document = paintCoverPage(document, rr, request);
}
-
- //boolean isImageRotate = false;
- //System.out.println("Document 2 " + document);
+
if(pb.isDisplayChart()) {
paintPdfImage(request, document,AppUtils.getTempFolderPath()+"cr_"+ pb.getUserId()+"_"+request.getSession().getId()+"_"+rr.getReportID()+".png", rr);
}
- //System.out.println("Document 4" + document);
document.newPage();
if(type == 3 && rr.getSemaphoreList()==null && !(rr.getReportType().equals(AppConstants.RT_CROSSTAB)) ) { //type = 3 is whole
@@ -310,7 +299,6 @@ public class PdfReportHandler extends org.onap.portalsdk.analytics.RaptorObject{
} else if(type == 2) {
returnValue = paintPdfData(request, document, rd, rr, "");
} else {
- //String sql_whole = (String) request.getAttribute(AppConstants.RI_REPORT_SQL_WHOLE);
int downloadLimit = (rr.getMaxRowsInExcelDownload()>0)?rr.getMaxRowsInExcelDownload():Globals.getDownloadLimit();
String action = request.getParameter(AppConstants.RI_ACTION);
@@ -326,9 +314,6 @@ public class PdfReportHandler extends org.onap.portalsdk.analytics.RaptorObject{
}
-
- //paintPdfData(document,rd,rr);
-
} catch (DocumentException de) {
logger.error(EELFLoggerDelegate.errorLogger, "DocumentException in createPdfFileContent", de);
@@ -350,7 +335,6 @@ public class PdfReportHandler extends org.onap.portalsdk.analytics.RaptorObject{
private Document paintCoverPage(Document doc, ReportRuntime rr, HttpServletRequest request) throws IOException, DocumentException {
- //System.out.println("PDFREPORTHANDLER STARTED ... " );
if(nvl(rr.getPdfImg()).length()>0) {
Image image1 = Image.getInstance(AppUtils.getExcelTemplatePath()+"../../"+AppUtils.getImgFolderURL()+rr.getPdfImg());
image1.scalePercent(20f, 20f);
@@ -411,7 +395,6 @@ public class PdfReportHandler extends org.onap.portalsdk.analytics.RaptorObject{
Iterator it = al.iterator();
addEmptyRows(table,1);
- //if(!Globals.customizeFormFieldInfo()) {
if(rr.getFormFieldComments(request).length()<=0) {
while(it.hasNext()) {
@@ -422,9 +405,7 @@ public class PdfReportHandler extends org.onap.portalsdk.analytics.RaptorObject{
IdNameValue value = (IdNameValue)it.next();
if(!value.getId().trim().equals("BLANK"))
- //System.out.println("PDFREPORTHANDLER " + value.getId()+" : "+value.getName());
add2Cells(table, value.getId()+" : ",value.getName().replaceAll("~",","));
- //add2Cells(table, rr.getFormFieldComments(request), " ");
}
addEmptyRows(table,1);
doc.add(table);
@@ -432,10 +413,8 @@ public class PdfReportHandler extends org.onap.portalsdk.analytics.RaptorObject{
} else {
it = al.iterator();
if(it.hasNext()) {
- //add2Cells(table, "Run-time Criteria : ", " ");
addEmptyRows(table,1);
doc.add(table);
- //com.lowagie.text.html.HtmlParser.parse(doc, new StringReader(rr.getFormFieldComments(request)));
ArrayList p = HTMLWorker.parseToList(new StringReader(rr.getFormFieldComments(request).replaceAll("~",",")), style);
for (int k = 0; k < p.size(); ++k){
@@ -450,7 +429,6 @@ public class PdfReportHandler extends org.onap.portalsdk.analytics.RaptorObject{
private Document paintDashboardCoverPage(Document doc, ReportRuntime rrDashRep, ReportRuntime firstReportRuntimeObj, HttpServletRequest request) throws IOException, DocumentException {
- //System.out.println("PDFREPORTHANDLER STARTED ... " );
float firstColumnSize = Globals.getCoverPageFirstColumnSize();
float[] relativeWidths = {firstColumnSize,1f-firstColumnSize};
PdfPTable table = new PdfPTable(relativeWidths);
@@ -481,7 +459,6 @@ public class PdfReportHandler extends org.onap.portalsdk.analytics.RaptorObject{
ArrayList al = firstReportRuntimeObj.getParamNameValuePairsforPDFExcel(request, 2);
Iterator it = al.iterator();
addEmptyRows(table,1);
- //if(!Globals.customizeFormFieldInfo()) {
if(firstReportRuntimeObj.getFormFieldComments(request).length()<=0) {
while(it.hasNext()) {
@@ -492,9 +469,7 @@ public class PdfReportHandler extends org.onap.portalsdk.analytics.RaptorObject{
IdNameValue value = (IdNameValue)it.next();
if(!value.getId().trim().equals("BLANK"))
- //System.out.println("PDFREPORTHANDLER " + value.getId()+" : "+value.getName());
add2Cells(table, value.getId()+" : ",value.getName());
- //add2Cells(table, rr.getFormFieldComments(request), " ");
}
addEmptyRows(table,1);
doc.add(table);
@@ -502,10 +477,8 @@ public class PdfReportHandler extends org.onap.portalsdk.analytics.RaptorObject{
} else {
it = al.iterator();
if(it.hasNext()) {
- //add2Cells(table, "Run-time Criteria : ", " ");
addEmptyRows(table,1);
doc.add(table);
- //com.lowagie.text.html.HtmlParser.parse(doc, new StringReader(rr.getFormFieldComments(request)));
HTMLWorker worker = new HTMLWorker(doc);
StyleSheet style = new StyleSheet();
style.loadTagStyle("body", "leading", "16,0");
@@ -547,7 +520,6 @@ public class PdfReportHandler extends org.onap.portalsdk.analytics.RaptorObject{
{
ArrayList images = getImage(request, fileName,pb.isAttachmentOfEmail()?true:false, rr);
- //Image image = getImage(request, fileName,pb.isAttachmentOfEmail()?true:false);
PdfPTable table = null;
PdfPCell cellValue = null;
if(images!=null) {
@@ -558,16 +530,12 @@ public class PdfReportHandler extends org.onap.portalsdk.analytics.RaptorObject{
cellValue.setHorizontalAlignment(Rectangle.ALIGN_CENTER);
Image image = (Image) images.get(i);
image.setAlignment(Image.ALIGN_CENTER);
- //System.out.println("Document 3 " + document + " i-" + i);
if(i%2 ==0)
document.newPage();
- //System.out.println("Document 31 " + document);
cellValue.setImage(image);
//table.getDefaultCell().setHorizontalAlignment(Rectangle.ALIGN_CENTER);
table.addCell(cellValue);
- //System.out.println("Document 32 " + document + "table " + table);
document.add(table);
- //System.out.println("Document 33 " + document);
}
}
}
@@ -599,7 +567,6 @@ public class PdfReportHandler extends org.onap.portalsdk.analytics.RaptorObject{
if(isGenerateNewImage && retryCreateNewImageCount<RetryCreateNewImage){
retryCreateNewImageCount++;
return generateNewImage(request, rr);
- //return getImage(request,fileName, false);
}
return null;
@@ -692,31 +659,7 @@ public class PdfReportHandler extends org.onap.portalsdk.analytics.RaptorObject{
String chartTitle = Globals.getDisplayChartTitle()? rr.getReportName():"";
chartTitle = rr.getFormFieldFilled(chartTitle);
downloadFileName = AppUtils.getTempFolderPath()+"cr_"+pb.getUserId()+"_"+request.getSession().getId()+"_"+rr.getReportID()+"_"+i+".png";
- filename = null;/*(String) ChartGen.generateChart( chartType,
- request.getSession(),
- ds,
- legendColumnName,
- chartLeftAxisLabel,
- chartRightAxisLabel,
- rr.getChartDisplayNamesList(AppConstants.CHART_ALL_COLUMNS, formValues).subList(i, i+1),
- rr.getChartColumnColorsList(AppConstants.CHART_ALL_COLUMNS, formValues).subList(i, i+1),
- rr.getChartValueColumnAxisList(AppConstants.CHART_ALL_COLUMNS, formValues).subList(i, i+1),
- "",
- chartTitle,
- null,
- rr.getChartWidthAsInt(),
- rr.getChartHeightAsInt(),
- rr.getChartValueColumnsList(AppConstants.CHART_ALL_COLUMNS, formValues).subList(i,i+1),
- rr.hasSeriesColumn(),
- //rr.isChartMultiSeries(),
- rr.isMultiSeries(),
- rr.getAllColumns(),
- downloadFileName,
- totalOnChart,
- AppConstants.WEB_VERSION deviceType,
- additionalChartOptionsMap,
- true
- );*/
+ filename = null;
try {
Image image = Image.getInstance(downloadFileName);
images.add(image);
@@ -740,60 +683,25 @@ public class PdfReportHandler extends org.onap.portalsdk.analytics.RaptorObject{
for (int i=0; i<lGroups.size();i++) {
String chartGroupOrg = (String) lGroups.get(i);
String chartYAxis = (String) mapYAxis.get(chartGroupOrg);
- //System.out.println("chartGroupOrg " + chartGroupOrg);
if(nvl(chartGroupOrg).length()>0)
tempChartGroupCurrent = chartGroupOrg.substring(0,chartGroupOrg.lastIndexOf("|"));
if(i>0)
tempChartGroupPrev = ((String) lGroups.get(i-1)).substring(0,((String) lGroups.get(i-1)).lastIndexOf("|"));
- //System.out.println("TEMPCHARTGROUP " + tempChartGroupCurrent + " " + tempChartGroupPrev);
if(tempChartGroupCurrent.equals(tempChartGroupPrev))
continue;
- //System.out.println("CHARTGROUPORG " + chartGroupOrg + " " + lGroups) ;
- //String chartGroup = chartGroupOrg.substring(0,chartGroupOrg.lastIndexOf("|"));
String chartGroup = chartGroupOrg;
- //System.out.println("$$$$CHARTGROUP in JSP " +chartGroup+ " "+ chartGroupOrg );
- //System.out.println(" rr.getChartGroupDisplayNamesList(chartGroup) " + rr.getChartGroupDisplayNamesList(chartGroup));
- //System.out.println(" rr.getChartGroupColumnColorsList(chartGroup) " + rr.getChartGroupColumnColorsList(chartGroup));
- //System.out.println(" rr.getChartGroupColumnAxisList(chartGroup) " + rr.getChartGroupColumnAxisList(chartGroup));
- //System.out.println(" rr.getChartGroupValueColumnAxisList(chartGroupOrg) " + rr.getChartGroupValueColumnAxisList(chartGroupOrg));
-
downloadFileName = AppUtils.getTempFolderPath()+"cr_"+pb.getUserId()+"_"+request.getSession().getId()+"_"+rr.getReportID()+"_"+i+".png";
String chartTitle = (Globals.getDisplayChartTitle()? (chartGroup!=null && chartGroup.indexOf("|") > 0 ?chartGroup.substring(0,chartGroup.lastIndexOf("|")):rr.getReportName()):"");
chartTitle = rr.getFormFieldFilled(chartTitle);
String leftAxisLabel = "";
- //if(!rr.isChartMultiSeries()) {
if(!rr.isMultiSeries()) {
leftAxisLabel = ((chartYAxis!=null && chartYAxis.indexOf("|") > 0) ? chartYAxis.substring(0,chartYAxis.lastIndexOf("|")): chartLeftAxisLabel );
} else {
leftAxisLabel = chartLeftAxisLabel;
}
- filename = null;/*(String) ChartGen.generateChart( chartType,
- request.getSession(),
- ds,
- legendColumnName,
- leftAxisLabel,
- chartRightAxisLabel,
- ((chartType.indexOf("Stacked")>0 || chartType.equals(AppConstants.GT_PIE_MULTIPLE) || chartType.equals(AppConstants.GT_BAR_3D))?rr.getChartDisplayNamesList(AppConstants.CHART_ALL_COLUMNS, formValues):rr.getChartGroupDisplayNamesList(chartGroup, formValues)),
- ((chartType.indexOf("Stacked")>0 || chartType.equals(AppConstants.GT_PIE_MULTIPLE) || chartType.equals(AppConstants.GT_BAR_3D))?rr.getChartColumnColorsList(AppConstants.CHART_ALL_COLUMNS, formValues):rr.getChartGroupColumnColorsList(chartGroup, formValues)),
- ((chartType.indexOf("Stacked")>0 || chartType.equals(AppConstants.GT_PIE_MULTIPLE) || chartType.equals(AppConstants.GT_BAR_3D))?rr.getChartValueColumnAxisList(AppConstants.CHART_ALL_COLUMNS, formValues):rr.getChartGroupValueColumnAxisList(chartGroupOrg, formValues)),
- "",
- chartTitle,
- null,
- rr.getChartWidthAsInt(),
- rr.getChartHeightAsInt(),
- ((chartType.indexOf("Stacked")>0 || chartType.equals(AppConstants.GT_PIE_MULTIPLE))?rr.getChartValueColumnsList(AppConstants.CHART_WITHOUT_NEWCHART_COLUMNS, formValues):rr.getChartGroupValueColumnAxisList(chartGroupOrg, formValues)),
- rr.hasSeriesColumn(),
- //rr.isChartMultiSeries(),
- rr.isMultiSeries(),
- rr.getAllColumns(),
- downloadFileName,
- totalOnChart,
- AppConstants.WEB_VERSION deviceType,
- additionalChartOptionsMap,
- true
- );*/
+ filename = null;
try {
Image image = Image.getInstance(downloadFileName);
images.add(image);
@@ -813,9 +721,6 @@ public class PdfReportHandler extends org.onap.portalsdk.analytics.RaptorObject{
if(!chartType.equals(AppConstants.GT_PIE_MULTIPLE)) {
for (int i=0; i<rr.getChartValueColumnAxisList(AppConstants.CHART_NEWCHART_COLUMNS, formValues).size();i++) {
- //System.out.println(" rr.getChartDisplayNamesList(AppConstants.CHART_NEWCHART_COLUMNS).subList(i, i+1) " + rr.getChartDisplayNamesList(AppConstants.CHART_NEWCHART_COLUMNS).subList(i, i+1));
- //System.out.println(" rr.getChartValueColumnAxisList(AppConstants.CHART_NEWCHART_COLUMNS).subList(i, i+1) " + rr.getChartValueColumnAxisList(AppConstants.CHART_NEWCHART_COLUMNS).subList(i, i+1));
- //System.out.println(" rr.getChartValueColumnsList(AppConstants.CHART_NEWCHART_COLUMNS).subList(i,i+1) " + rr.getChartValueColumnsList(AppConstants.CHART_NEWCHART_COLUMNS).subList(i,i+1));
downloadFileName = AppUtils.getTempFolderPath()+"cr_"+ pb.getUserId()+"_"+request.getSession().getId()+"_"+rr.getReportID()+"_"+i+".png";
String chartTitle = Globals.getDisplayChartTitle()? rr.getReportName():"";
@@ -924,37 +829,11 @@ public class PdfReportHandler extends org.onap.portalsdk.analytics.RaptorObject{
} catch (Exception e) {
logger.error(EELFLoggerDelegate.errorLogger, "Exception in generateNewImage", e);
}
-// System.out.println("Total Images " + images.size());
return images.size()>0?images:null;
}
-/*
- private boolean isImageRotate(Document doc, Image image) {
-
- System.out.println("image size="+image.getWidthPercentage()+ " "+ image.scaledWidth()+
- " "+image.scaledHeight()+" "+image.getXYRatio());
- System.out.println("page size = "+ doc.getPageSize().width() + " " +doc.getPageSize().height() +" "+
- doc.topMargin() + " " +doc.bottomMargin() + " " + doc.leftMargin() + " " +
- doc.rightMargin());
- System.out.println(image.scaledWidth()/image.scaledHeight());
- System.out.println((PageEvent.getPageWidth(doc)/PageEvent.getPageHeight(doc)));
-// System.out.println(doc.getPageSize().getRotation());
-
- float image_w = image.scaledWidth();
- float image_h = image.scaledHeight();
- float image_ratio = image_w/image_h;
-
- float page_w = PageEvent.getPageWidth(doc);
- float page_h = PageEvent.getPageHeight(doc);
- float page_ratio = page_w/page_h;
-
- return (image_w > page_w && image_ratio > page_ratio) ||
- (image_h > page_h && image_ratio < page_ratio);
- }
-
-*/
private final int DEFAULT_PDF_DISPLAY_WIDTH = 10;
private int paintPdfData(final HttpServletRequest request, final Document document, final ReportData rd,