diff options
author | Rupinder <rupinsi1@in.ibm.com> | 2020-04-02 16:38:21 +0530 |
---|---|---|
committer | Rupinder <rupinsi1@in.ibm.com> | 2020-04-02 16:39:42 +0530 |
commit | 59a83dcff26d5e2f53025e84d72838d223c18afc (patch) | |
tree | af7958826876ee4f74671297d11eb61cbb0e60ff /ecomp-sdk | |
parent | 20c95c7edd0861504b50cd86a65ce888b1c6efa6 (diff) |
removed code smells
Removed code smells by improving code structure
Issue-ID: PORTAL-865
Change-Id: I8bc5e08fca5d7b40f59a731b1ad00e306584da39
Signed-off-by: Rupinder<rupinsi1@in.ibm.com>
Diffstat (limited to 'ecomp-sdk')
7 files changed, 34 insertions, 17 deletions
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ActionHandler.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ActionHandler.java index 0b3cf05a..a50a04eb 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ActionHandler.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ActionHandler.java @@ -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(); diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/WizardProcessor.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/WizardProcessor.java index 8605f208..298f2517 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/WizardProcessor.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/WizardProcessor.java @@ -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; } } diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/map/layer/SwingLayer.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/map/layer/SwingLayer.java index 8ba0c783..a9a2fba6 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/map/layer/SwingLayer.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/map/layer/SwingLayer.java @@ -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();) { 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 38f6497c..dc3b1a88 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 @@ -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); diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/BroadcastController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/BroadcastController.java index 600deeb3..4392aeb5 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/BroadcastController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/BroadcastController.java @@ -39,7 +39,6 @@ package org.onap.portalapp.controller.sample; import java.io.IOException; import java.io.PrintWriter; -import java.io.UnsupportedEncodingException; import java.util.HashMap; import java.util.Map; diff --git a/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf/MusicSession.java b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf/MusicSession.java index 322e1b41..ca60d398 100644 --- a/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf/MusicSession.java +++ b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf/MusicSession.java @@ -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; diff --git a/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf/MusicSessionRepositoryHandler.java b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf/MusicSessionRepositoryHandler.java index 167ed955..5cfa89b4 100644 --- a/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf/MusicSessionRepositoryHandler.java +++ b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf/MusicSessionRepositoryHandler.java @@ -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; |