lowered some code smells in a few components 59/108059/1
authorIndrijeet kumar <indriku1@in.ibm.com>
Thu, 21 May 2020 12:40:01 +0000 (18:10 +0530)
committerIndrijeet kumar <indriku1@in.ibm.com>
Thu, 21 May 2020 12:40:08 +0000 (18:10 +0530)
lowered some code smells in a few components

Issue-ID: PORTAL-813
Change-Id: I64eeead6f562daaeee01392eb57696d5724f1ff6
Signed-off-by: Indrijeet Kumar <indriku1@in.ibm.com>
ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/view/ReportData.java
ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/SingleSignOnController.java
ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/scheduler/LogJob.java
ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/service/OnBoardingApiServiceImpl.java
ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/ElementMapService.java

index fd87f4c..a0c35e0 100644 (file)
@@ -157,11 +157,6 @@ public class ReportData extends org.onap.portalsdk.analytics.RaptorObject implem
                        r++;
                } // for
 
-/*             for (reportDataRows.resetNext(); reportDataRows.hasNext();) {
-                       DataRow dr = reportDataRows.getNext();
-                       dr.addDataValue(colIdx, new DataValue());
-               } // for
-               */
                for(int j = 0; j < dataList.size(); j++) {
                        DataRow dr = (DataRow) dataList.get(j);
                        dr.addDataValue(colIdx, new DataValue());
@@ -183,11 +178,9 @@ public class ReportData extends org.onap.portalsdk.analytics.RaptorObject implem
                try {
                
                boolean nameFound = false;
-               // String prevColName = null;
                Vector prevColNames = new Vector();
                int columnSort = -1;
                for (int r = 0; r < colNameValues.size(); r++) {
-                       //String colName = (String) colNameValues.get(r);
                        String colName = ((DataValue) colNameValues.get(r)).getDisplayValue();
                        Integer colSortName  = null;
                        if(colNameSortValues!=null)
@@ -266,9 +259,6 @@ public class ReportData extends org.onap.portalsdk.analytics.RaptorObject implem
                for (c = 0; c < getDataColumnCount(); c++) {
                        dr.addDataValue(new DataValue());
                }
-          
-               //reportDataRows.addDataRow(rowIdx, dr);
-               //dr.setRowNum(dataList.size()==0?1:dataList.size());
                dataList.add(rowIdx, dr);
 
        } // insertRow
@@ -288,7 +278,6 @@ public class ReportData extends org.onap.portalsdk.analytics.RaptorObject implem
                boolean nameFound = false;
                Vector prevRowNames = new Vector();
                for (int c = 0; c < rowNameValues.size(); c++) {
-                       //String rowName = (String) rowNameValues.get(c);
                        String rowName = ((DataValue) rowNameValues.get(c)).getDisplayValue();
                
                        RowHeaderCol rhc = reportRowHeaderCols.getRowHeaderCol(c);
@@ -341,7 +330,6 @@ public class ReportData extends org.onap.portalsdk.analytics.RaptorObject implem
                int colIdx = findColumnIdx(colNameValues, colNameSortValues, crossTabOrderManager, true, dataList);
 
                if ((rowIdx >= 0) && (colIdx >= 0)) {
-                       //DataRow dr = reportDataRows.getDataRow(rowIdx);
                        DataRow dr = (DataRow)dataList.get(rowIdx);
                        dr.setRowValues(rowNameValues);
                        dr.setDataValue(colIdx, value);
@@ -435,11 +423,9 @@ public class ReportData extends org.onap.portalsdk.analytics.RaptorObject implem
 
        public void addRowNumbers(int pageNo, List dataList) {
                pageNo = 0;
-               //int startRowNum = ((pageNo < 0) ? 0 : pageNo) * pageSize + 1;
                int startRowNum = 0;
                RowHeaderCol rhc = new RowHeaderCol();
                reportRowHeaderCols.addRowHeaderCol(0, rhc);
-               //rhc.setColumnWidth("5%");
                for (int r = 0; r < dataList.size(); r++) {
                        rhc.add(new RowHeader(startRowNum + r+""));
                        ((DataRow)dataList.get(r)).setRowNum(r);
@@ -477,17 +463,13 @@ public class ReportData extends org.onap.portalsdk.analytics.RaptorObject implem
                        reportColumnHeaderRows.addColumnHeaderRow(chr);
                        chr.setRowHeight("30");
                } // if
-        /*ColumnHeader ch = new ColumnHeader(displayName, (displayWidth > 100) ? "10%" : (""
-                               + displayWidth + "%"), alignment, 1, isRuntimeColSortDisabled ? null : colId);
-                               */
+
                ColumnHeader ch = new ColumnHeader(displayName, displayWidthInPxls, alignment, 1, isRuntimeColSortDisabled ? null : colId);     
                ch.setGroupLevel(level);
                ch.setStartGroup(start);
                ch.setColSpanGroup(colspan);
         ch.setColId(colId);
         ch.setSortable(sortable);
-               //chr.addColumnHeader(new ColumnHeader(displayName, (displayWidth > 100) ? "10%" : (""
-                       //      + displayWidth + "%"), 1, isRuntimeColSortDisabled ? null : colId));
         
         if (displayName != "Hidden") { 
         
@@ -529,7 +511,6 @@ public class ReportData extends org.onap.portalsdk.analytics.RaptorObject implem
                } // for
         int row = 0;
                for (reportDataRows.resetNext(); reportDataRows.hasNext();) {
-                       //reportDataRows.getNext().getDataValue(colIdx).setVisible(newVisible);
                        DataRow dr = reportDataRows.getNext();
                        if(colIdx < dr.getDataValueList().size()) {
                                DataValue dv = dr.getDataValue(colIdx);
@@ -718,25 +699,16 @@ public class ReportData extends org.onap.portalsdk.analytics.RaptorObject implem
                                DataValue dataValue = new DataValue();
 
                                String totalValue = tVal.getTotalValue();
-                               // if(colDisplayTotal.length()>0&&(!
-                               // colDisplayTotal.equals(AppConstants.TOTAL_SUM_ID)))
-                               // totalValue =
-                               // nvl(AppConstants.TOTAL_FUNCTIONS.getNameById(colDisplayTotal))+":
-                               // "+totalValue;
                                dataValue.setDisplayValue(totalValue);
                 //added below statement for displaying in excel as number
                 dataValue.setDisplayTotal("SUM(");
                                dataValue.setAlignment(totalsAlignment);
                                dataValue.setBold(true);
                                totalsDataRow.setDataValue(colIdx, dataValue);
-
-                               //totalsDataRow.addDataValue(dataValue);
                                
                        } // if
                } // for
 
-               //reportDataRows.addDataRow(totalsDataRow);
-               //dr.setRowValues(rowNameValues);
                Vector rowNameValues = new Vector();
                for (int i=0; i < reportRowHeaderCols.size(); i++) {
                        if(i==0) {
@@ -745,9 +717,7 @@ public class ReportData extends org.onap.portalsdk.analytics.RaptorObject implem
                                dataValue.setAlignment("center");
                                dataValue.setDisplayValue("Total");
                                rowNameValues.add(dataValue);
-                               //rowNameValues.add("Total");
                        } else {
-                               //rowNameValues.add("");
                                DataValue dataValue = new DataValue();
                                dataValue.setDisplayValue("");
                                rowNameValues.add(dataValue);
@@ -757,7 +727,6 @@ public class ReportData extends org.onap.portalsdk.analytics.RaptorObject implem
                totalsDataRow.setRowValues(rowNameValues);
                totalsDataRow.setRowNum(dataList.size());
                dataList.add(totalsDataRow);            
-                       //reportRowHeaderCols.getNext().addRowHeader(new RowHeader("", "30", 1, 0));
        } // setColumnDataTotalsCrossTab
 
        public void setRowDataTotalsCrossTab(Vector rowDataTotals, String totalsAlignment,
@@ -792,11 +761,6 @@ public class ReportData extends org.onap.portalsdk.analytics.RaptorObject implem
                                DataValue dataValue = new DataValue();
 
                                String totalValue = tVal.getTotalValue();
-                               // if(rowDisplayTotal.length()>0&&(!
-                               // rowDisplayTotal.equals(AppConstants.TOTAL_SUM_ID)))
-                               // totalValue =
-                               // nvl(AppConstants.TOTAL_FUNCTIONS.getNameById(rowDisplayTotal))+":
-                               // "+totalValue;
                                dataValue.setDisplayValue(totalValue);
                 //added below statement for displaying in excel as number
                 dataValue.setDisplayTotal("SUM("); 
@@ -813,20 +777,13 @@ public class ReportData extends org.onap.portalsdk.analytics.RaptorObject implem
                        String displayTotal, List dataList) {
                DataValue dataValue = new DataValue();
 
-               // if(displayTotal.length()>0&&(!
-               // displayTotal.equals(AppConstants.TOTAL_SUM_ID)))
-               // totalValue =
-               // nvl(AppConstants.TOTAL_FUNCTIONS.getNameById(displayTotal))+":
-               // "+totalValue;
                dataValue.setDisplayValue(totalValue);
         //added below statement for displaying in excel as number
         dataValue.setDisplayTotal("SUM("); 
                dataValue.setAlignment(totalAlignment);
                dataValue.setBold(true);
 
-               //int colIdx = getDataColumnCount() - 1;
                int rowIdx = getDataRowCount() - 1;
-               //reportDataRows.getDataRow(rowIdx).getDataValueList().add(colIdx, dataValue);
                DataRow dr = (DataRow)dataList.get(rowIdx);
                dr.addDataValue(dr.getDataValueList().size(), dataValue);
        } // setGrandTotalCrossTab
index d04acc8..83962c6 100644 (file)
@@ -218,7 +218,7 @@ public class SingleSignOnController extends UnRestrictedBaseController {
                        final String redirectUrl = portalUrl + "?uebAppKey=" + uebAppKey + "&redirectUrl=" + encodedReturnToAppUrl;
                        logger.debug(EELFLoggerDelegate.debugLogger, "singleSignOnLogin: portal-bound redirect URL is {}",
                                        redirectUrl);
-                       // this line may not be necessary but jsessionid coockie is not getting created in all cases;
+                       // this line may not be necessary but jsessionid coockie is not getting created in all cases
                        // so force the cookie creation
                        request.getSession(true);
                        
index f71d41c..40306a4 100644 (file)
@@ -53,9 +53,6 @@ public class LogJob extends QuartzJobBean {
        @Override
        protected void executeInternal(JobExecutionContext ctx)
                        throws JobExecutionException {
-          // JobDataMap dataMap = ctx.getJobDetail().getJobDataMap();
-          //int cnt = dataMap.getInt("");
-          // JobKey jobKey = ctx.getJobDetail().getKey();
           logger.info(EELFLoggerDelegate.debugLogger, (Runtime.getRuntime().maxMemory() + " " + Runtime.getRuntime().maxMemory()));
 
        }
index ae131a0..2b75aea 100644 (file)
@@ -306,7 +306,7 @@ public class OnBoardingApiServiceImpl implements IPortalRestAPIService, IPortalR
                                // response yet ..
                                // commenting throw clauses until portal is ready
                                // throw new PortalAPIException("User + " + loginId + " doesn't
-                               // exist");
+                               // exist")
                        } else
                                return UserUtils.convertToEcompUser(user);
                } catch (Exception e) {
@@ -315,7 +315,6 @@ public class OnBoardingApiServiceImpl implements IPortalRestAPIService, IPortalR
                        return null;
                        // Unfortunately, Portal is not ready to accept proper error response
                        // yet .. commenting throw clauses until portal is ready
-                       // throw new PortalAPIException(response, e);
                }
 
        }
@@ -388,11 +387,6 @@ public class OnBoardingApiServiceImpl implements IPortalRestAPIService, IPortalR
                                logger.debug(EELFLoggerDelegate.debugLogger, "## REST API ## loginId: {}, roles Json {}", loginId,
                                                rolesJson);
                        User user = userProfileService.getUserByLoginId(loginId);
-                       /*
-                        * List<EcompRole> ecompRoles = mapper.readValue(rolesJson,
-                        * TypeFactory.defaultInstance().constructCollectionType(List.class,
-                        * EcompRole.class));
-                        */
                        SortedSet<Role> roles = new TreeSet<>();
                        for (EcompRole role : rolesJson) {
                                roles.add(roleService.getRole(loginId,role.getId()));
index b126d82..8aea7e1 100644 (file)
@@ -69,8 +69,8 @@ public class ElementMapService {
        private static HashMap<String, Domain> domainMap = new HashMap<>();
 
        private static String filePath = SystemProperties.getProperty("element_map_file_path");
-       private static String networkToscaYml = null;// "NetworkMap_topology_composition.yml";
-       private static String networkLayoutYml = null;// "network_map_layout.yml";
+       private static String networkToscaYml = null;// NetworkMap_topology_composition.yml
+       private static String networkLayoutYml = null;// network_map_layout.yml
 
        /**
         *