removed code smells 75/104975/1
authorRupinder <rupinsi1@in.ibm.com>
Thu, 2 Apr 2020 11:08:21 +0000 (16:38 +0530)
committerRupinder <rupinsi1@in.ibm.com>
Thu, 2 Apr 2020 11:09:42 +0000 (16:39 +0530)
Removed code smells by improving code structure
Issue-ID: PORTAL-865
Change-Id: I8bc5e08fca5d7b40f59a731b1ad00e306584da39
Signed-off-by: Rupinder<rupinsi1@in.ibm.com>
ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ActionHandler.java
ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/WizardProcessor.java
ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/map/layer/SwingLayer.java
ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/ReportHandler.java
ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/BroadcastController.java
ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf/MusicSession.java
ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf/MusicSessionRepositoryHandler.java

index 0b3cf05..a50a04e 100644 (file)
@@ -369,7 +369,8 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
                                            if(record == 1) {
                                                if(rrDashboardReports.getReportFormFields()!=null && rrDashboardReports.getReportFormFields().size()>0) {
                                                        buildReportdata = false;
-                                                       if(rDisplayContent) buildReportdata = true;
+                                                       if(rDisplayContent)
+                                                                       buildReportdata = true;
                                                }
                                            }
                                            
@@ -510,12 +511,17 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
 
                                                                downloadLimit = (rrDashboardReports.getMaxRowsInExcelDownload()>0)?rrDashboardReports.getMaxRowsInExcelDownload():Globals.getDownloadLimit();
                                                                
-                                                           if (new Integer(nvl(rrDashboardReports.getDataContainerWidth(),"100")).intValue() >100) widthFlag = 1;
-                                                           if (new Integer(nvl(rrDashboardReports.getDataContainerHeight(),"100")).intValue() >100) heightFlag = 1;
+                                                           if (new Integer(nvl(rrDashboardReports.getDataContainerWidth(),"100")).intValue() >100)
+                                                                       widthFlag = 1;
+                                                           if (new Integer(nvl(rrDashboardReports.getDataContainerHeight(),"100")).intValue() >100)
+                                                                       heightFlag = 1;
                                                            if(record == 1) {
                                                                if(rrDashboardReports.getReportFormFields()!=null && rrDashboardReports.getReportFormFields().size()>0) {
                                                                        buildReportdata = false;
-                                                                       if(rDisplayContent) buildReportdata = true;
+                                                                       if(rDisplayContent){
+                                                                                       buildReportdata = true;
+                                                                               }
+                                                                               
                                                                }
                                                            }
                                                            if(buildReportdata) {
@@ -1371,7 +1377,8 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
                                                                value = (String) entry.getValue();
                                                        }
                                                        // added so empty string would be treated as null value if not given in single quotes.
-                                                       if(value==null || value.trim().length()<=0) value="NULL";
+                                                       if(value==null || value.trim().length()<=0)
+                                                               value="NULL";
                                                        SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", Utils.oracleSafe(value));
                                                }
                                                if(request.getParameter(ff.getFieldName())!=null) {
@@ -1384,7 +1391,10 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
                                                }
                                                //lookup.loadData("0");
                                        }
-                                       if(lookup instanceof IdNameSql)  ((IdNameSql)lookup).setDataSizeUsedinPopup(-3); // -3 indicates to run the count sql for pagination. 
+                                       if(lookup instanceof IdNameSql){
+                                               ((IdNameSql)lookup).setDataSizeUsedinPopup(-3); // -3 indicates to run the count sql for pagination. 
+                                       }
+                                       
                        }
                        if(lookup instanceof IdNameSql) {
                                ((IdNameSql)lookup).loadUserData(request.getParameter(AppConstants.RI_NEXT_PAGE),
@@ -1739,7 +1749,8 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
         ReportRuntime rr = null;
         if(!isFromSchedule) {
                rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME);
-               if(rr!=null) AppUtils.getUserEmail(request);
+               if(rr!=null)
+                               AppUtils.getUserEmail(request);
         }
         String scheduleId = "";
         
@@ -1955,7 +1966,9 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
     }
        public String getChildDropDown(HttpServletRequest request, String nextPage) throws RaptorRuntimeException  {
                
-               if(request.getParameter("firstTime") != null) { return nextPage; }
+               if(request.getParameter("firstTime") != null){
+                       return nextPage; 
+               }
                
                /*ReportRuntime rr = (ReportRuntime) request.getSession().getAttribute(
                                AppConstants.SI_REPORT_RUNTIME);
@@ -2188,7 +2201,8 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
                // "[ReportRuntime.loadLinearReportData] The number of visible columns
                // does not match the number of data columns");
         //TODO: This should be optimized to accept -1 for flat file download
-               if(maxRows > totalRows) maxRows = totalRows;
+               if(maxRows > totalRows)
+                       maxRows = totalRows;
                ArrayList reportDataList = new ArrayList();
                for (int r = 0; r < maxRows; r++) {
                        DataRow dr = new DataRow();
index 8605f20..298f251 100644 (file)
@@ -1161,7 +1161,8 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
                rdef.setClassifier(classifiers);
                String dateAttrColId = AppUtils.getRequestNvlValue(request, "timeAttribute");
                String timeFormat = AppUtils.getRequestNvlValue(request, "timeFormat");
-               if(timeFormat.equals("Default")) timeFormat = "yyyy-MM-dd HH:mm:ss";
+               if(timeFormat.equals("Default"))
+                       timeFormat = "yyyy-MM-dd HH:mm:ss";
                String forecastingPeriod = AppUtils.getRequestNvlValue(request, "forecastingPeriod");
 
                String[] forecastCols = request.getParameterValues("forecastCol");
@@ -1176,7 +1177,8 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject {
                                dct = (DataColumnType) iter.next();
                                if(dct.getColId().equals(dateAttrColId)) {
                                        dct.setDataMiningCol(AppConstants.DM_DATE_ATTR);
-                                       if(timeFormat!=null) rdef.setForecastingTimeFormat(timeFormat);
+                                       if(timeFormat!=null)
+                                               rdef.setForecastingTimeFormat(timeFormat);
                                        break;
                                }
                        }
index 8ba0c78..a9a2fba 100644 (file)
@@ -92,7 +92,8 @@ public class SwingLayer {
                int legendLength = 0;
                for (int i = 0; i < showListArr.length; i++) {
                        legendLength = ((String)showListArr[i]).length();
-                       if(legendLength > textWidth) textWidth = legendLength;
+                       if(legendLength > textWidth)
+                               textWidth = legendLength;
                }
                Point2D point = null;
            for (Iterator iterator = set.iterator(); iterator.hasNext();) {
index 38f6497..dc3b1a8 100644 (file)
@@ -269,7 +269,8 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject {
                } else {
                        for (Iterator iter = semList.getSemaphore().iterator(); iter.hasNext();) {
                                SemaphoreType sem = (SemaphoreType) iter.next();
-                if(!semColumnList.contains(sem.getSemaphoreId())) continue;
+                if(!semColumnList.contains(sem.getSemaphoreId()))
+                                       continue;
                 //System.out.println("SemphoreId ----> " + sem.getSemaphoreId());
                                FormatList fList = sem.getFormatList();
                                List formatList = fList.getFormat();
@@ -472,7 +473,9 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject {
                                                if(name.startsWith("[")) 
                                                        name = name.substring(1);
                                                value = st.nextToken();                                                 
-                                               if(nvl(value).endsWith("]"))value = nvl(value).substring(0, nvl(value).length()-1);
+                                               if(nvl(value).endsWith("]")){
+                                                                       value = nvl(value).substring(0, nvl(value).length()-1);
+                                                               }
                                        } /*else if(name != null && name.length() > 0) {
                                                value = st.nextToken();
                                                if(value.endsWith("]]"))value = value.substring(0, value.length()-1);
index 322e1b4..ca60d39 100644 (file)
@@ -63,7 +63,6 @@ import java.util.UUID;
 
 import org.onap.music.eelf.logging.EELFLoggerDelegate;
 import org.onap.music.exceptions.MusicLockingException;
-import org.onap.music.exceptions.MusicServiceException;
 import org.onap.portalapp.music.service.MusicService;
 import org.onap.portalapp.music.util.MusicProperties;
 import org.onap.portalapp.music.util.MusicUtil;
index 167ed95..5cfa89b 100644 (file)
@@ -42,7 +42,6 @@ import java.util.concurrent.ConcurrentHashMap;
 
 import org.onap.music.eelf.logging.EELFLoggerDelegate;
 import org.onap.music.exceptions.MusicLockingException;
-import org.onap.music.exceptions.MusicServiceException;
 import org.onap.portalapp.music.service.MusicService;
 import org.onap.portalapp.music.util.MusicUtil;
 import org.springframework.session.Session;