improved code structure 27/105127/5
authorRupinder <rupinsi1@in.ibm.com>
Sun, 5 Apr 2020 13:43:15 +0000 (19:13 +0530)
committerRupinderjeet Singh <rupinsi1@in.ibm.com>
Wed, 8 Apr 2020 09:29:39 +0000 (09:29 +0000)
Removed code smells

Issue-ID: PORTAL-865
Change-Id: If444f9d8c1048a4c0696f9bc9d4a124c117e9651
Signed-off-by: Rupinder<rupinsi1@in.ibm.com>
ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/pdf/PdfReportHandler.java

index b42bdf9..d77e6bc 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * ============LICENSE_START==========================================
  * ONAP Portal SDK
- * ===================================================================
+ * =================================================================== 
  * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
  * ===================================================================
  *
@@ -10,7 +10,7 @@
  * you may not use this software except in compliance with the License.
  * You may obtain a copy of the License at
  *
- *             http://www.apache.org/licenses/LICENSE-2.0
+ *             http://www.apache.org/licenses/LICENSE-2.0 
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -124,7 +124,7 @@ import org.onap.portalsdk.analytics.view.ReportData;
 import org.onap.portalsdk.analytics.view.RowHeader;
 import org.onap.portalsdk.analytics.view.RowHeaderCol;
 import org.onap.portalsdk.analytics.xmlobj.DataColumnType;
-import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; 
 
 /**
  * @author mwliu and sundar
@@ -161,7 +161,8 @@ public class PdfReportHandler extends org.onap.portalsdk.analytics.RaptorObject{
         int returnValue = 0;
 
         ReportRuntime rr = null;
-        if(rr==null) rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME);
+        if(rr==null)
+           rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME);
         
         boolean isDashboard = false;
         if ((request.getSession().getAttribute(AppConstants.SI_DASHBOARD_REP_ID)!=null) && ( ((String) request.getSession().getAttribute(AppConstants.SI_DASHBOARD_REP_ID)).equals(rr.getReportID())) ) {
@@ -247,17 +248,21 @@ public class PdfReportHandler extends org.onap.portalsdk.analytics.RaptorObject{
                        //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;
+                       ReportData rd = null;
                        String parent = "";
                        int parentFlag = 0;
-                       if(!nvl(request.getParameter("parent"), "").equals("N")) parent = nvl(request.getParameter("parent"), "");
-                       if(parent.startsWith("parent_")) parentFlag = 1;
+                       if(!nvl(request.getParameter("parent"), "").equals("N"))
+                               parent = nvl(request.getParameter("parent"), "");
+                       if(parent.startsWith("parent_"))
+                               parentFlag = 1;
                        if(parentFlag == 1) {
                                rr = (ReportRuntime) request.getSession().getAttribute(parent+"_rr");
                                rd = (ReportData) request.getSession().getAttribute(parent+"_rd");
                        }
-                       if(rr==null) rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME);
-                       if(rd==null) rd = (ReportData)    request.getSession().getAttribute(AppConstants.RI_REPORT_DATA);
+                       if(rr==null)
+                               rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME);
+                       if(rd==null)
+                               rd = (ReportData)    request.getSession().getAttribute(AppConstants.RI_REPORT_DATA);
                        
                        pb = preparePdfBean(request,rr);
                        FONT_FAMILY = rr.getPDFFont();
@@ -738,9 +743,11 @@ public class PdfReportHandler extends org.onap.portalsdk.analytics.RaptorObject{
                                        //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("|"));
+                                       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;
+                                       if(tempChartGroupCurrent.equals(tempChartGroupPrev))
+                                                               continue;
                                        //System.out.println("CHARTGROUPORG " + chartGroupOrg + " " + lGroups) ;
                                        //String chartGroup = chartGroupOrg.substring(0,chartGroupOrg.lastIndexOf("|"));
                                        String chartGroup = chartGroupOrg;
@@ -1422,7 +1429,8 @@ public class PdfReportHandler extends org.onap.portalsdk.analytics.RaptorObject{
                        DataRow dr = rd.reportDataRows.getNext();
                        for(dr.resetNext();dr.hasNext();) {
                                DataValue dv = dr.getNext();
-                               if(!dv.isVisible()) totalVisbleColumn--;
+                               if(!dv.isVisible())
+                                   totalVisbleColumn--;
                        }
                        
                        break;