From a043ada00870d1423c2513d0ba26a6dd22d3c29c Mon Sep 17 00:00:00 2001
From: Indrijeet kumar <indriku1@in.ibm.com>
Date: Mon, 1 Jun 2020 09:45:55 +0530
Subject: lowered code smells in ChartJSONHelper.java

Lowered code smells in ChartJSONHelper.java

Issue-ID: PORTAL-813
Change-Id: I12dc20c3f1af90a6713636eb7cffb3e88d4c996a
Signed-off-by: Indrijeet Kumar <indriku1@in.ibm.com>
---
 .../analytics/model/runtime/ChartJSONHelper.java   | 39 +---------------------
 1 file changed, 1 insertion(+), 38 deletions(-)

(limited to 'ecomp-sdk/epsdk-analytics')

diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartJSONHelper.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartJSONHelper.java
index 268b20cc..797333cc 100644
--- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartJSONHelper.java
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartJSONHelper.java
@@ -825,7 +825,6 @@ public class ChartJSONHelper {
 		private String getColumnSelectStr(DataColumnType dc, HttpServletRequest request) {
 			String colName = dc.getColName();
 			String paramValue = null;
-			//if (dc.isCalculated()) {
 			if (reportRuntime.getFormFieldList() != null) {
 				for (Iterator iter = reportRuntime.getFormFieldList().getFormField().iterator(); iter.hasNext();) {
 					FormFieldType fft = (FormFieldType) iter.next();
@@ -835,8 +834,6 @@ public class ChartJSONHelper {
 					formfield_value = AppUtils.getRequestNvlValue(request, fieldId);
 	                paramValue = nvl(formfield_value);
 	                	if(paramValue.length()>0) {
-		                	/*sql = Utils.replaceInString(sql, "'" + fieldDisplay + "'", nvl(
-		                            paramValue, "NULL"));*/
 							colName = Utils.replaceInString(colName, "'" + fieldDisplay + "'", "'"+nvl(
 		                             paramValue, "NULL")+"'");
 							colName = Utils.replaceInString(colName,  fieldDisplay, nvl(
@@ -844,8 +841,7 @@ public class ChartJSONHelper {
 	                	}
 				}
 				return colName;
-			}						
-		//}
+			}
 			return colName;
 		} // getColumnSelectStr
 		
@@ -873,7 +869,6 @@ public class ChartJSONHelper {
 	        colName =  colName.trim();
 	        colName = Utils.replaceInString(colName, "TO_CHAR", "to_char");
 	        colName = Utils.replaceInString(colName, "to_number", "TO_NUMBER");
-	        //reportSQL = reportSQL.replaceAll("[\\s]*\\(", "(");
 	        colName = colName.replaceAll(",[\\s]*\\(", ",(");
 	        StringBuffer colNameBuf = new StringBuffer(colName);
 	        int pos = 0, posFormatStart = 0, posFormatEnd = 0;
@@ -890,14 +885,11 @@ public class ChartJSONHelper {
 	            	colNameBuf.insert(pos, " TO_NUMBER ( CR_RAPTOR.SAFE_TO_NUMBER (");
 	            	pos = colNameBuf.indexOf("to_char");
 	            	colNameBuf.replace(pos, pos+7, "TO_CHAR");
-	                //colName = Utils.replaceInString(colNameBuf.toString(), "to_char", " TO_NUMBER ( CR_RAPTOR.SAFE_TO_NUMBER ( TO_CHAR ");
 	                logger.debug(EELFLoggerDelegate.debugLogger, ("After adding to_number " + colNameBuf.toString()));
-	                //posFormatStart = colNameBuf.lastIndexOf(",'")+1;
 	                posFormatStart = colNameBuf.indexOf(",'", pos)+1;
 	                posFormatEnd = colNameBuf.indexOf(")",posFormatStart);
 	                logger.debug(EELFLoggerDelegate.debugLogger, (posFormatStart + " " + posFormatEnd + " "+ pos));
 	                format = colNameBuf.substring(posFormatStart, posFormatEnd);
-	                //posFormatEnd = colNameBuf.indexOf(")",posFormatEnd);
 	                colNameBuf.insert(posFormatEnd+1, " ," + format + ") , "+ format + ")");
 	                logger.debug(EELFLoggerDelegate.debugLogger, ("colNameBuf " + colNameBuf.toString()));
 	            }
@@ -914,7 +906,6 @@ public class ChartJSONHelper {
 			for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
 				flag = 0;
 				DataColumnType dc = (DataColumnType) iter.next();
-//			    if(filter == 2 || filter == 1) {
 				flag = reportRuntime.getDependsOnFormFieldFlag(dc, formValues);
 				
 				if( (dc.getChartSeq()!=null &&  dc.getChartSeq()> 0) && flag == 0 && !(nvl(dc.getColOnChart()).equals(AppConstants.GC_LEGEND))) {
@@ -928,8 +919,6 @@ public class ChartJSONHelper {
 							chartValueCols.add(dc);
 					} else chartValueCols.add(dc);
 				}
-//				} else
-//					chartValueCols.add(dc);	
 			} // for
 			Collections.sort(chartValueCols, new ChartSeqComparator());
 			return chartValueCols;
@@ -985,16 +974,6 @@ public class ChartJSONHelper {
 		        final int MILLISECFLAG = 7;
 		        final int DAYOFTHEWEEKFLAG = 8;
 		        final int FLAGDATE = 9;
-				/*int yearFlag  		= 1;
-		        int monthFlag 		= 2;
-		        int dayFlag   		= 3;
-		        int hourFlag  		= 4;
-		        int minFlag   		= 5;
-		        int secFlag   		= 6;
-		        int milliSecFlag 	= 7;
-		        int dayoftheweekFlag  = 8;					
-				int flagDate        = 10;
-				*/
 
 				date = MMDDYYYYHHMMSSFormat.parse(dateStr, new ParsePosition(0));
 	            if(date!=null)
@@ -1010,7 +989,6 @@ public class ChartJSONHelper {
 						formatFlag = MINFLAG;
 	            }
 	            if(date==null) {
-	            	//MMDDYYYYHHFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
 	                date = MMDDYYYYHHFormat.parse(dateStr, new ParsePosition(0));
 	                if(date!=null)
 						formatFlag = HOURFLAG;
@@ -1173,16 +1151,6 @@ public class ChartJSONHelper {
 		        final int MILLISECFLAG = 7;
 		        final int DAYOFTHEWEEKFLAG = 8;
 		        final int FLAGDATE = 9;
-				/*int yearFlag  		= 1;
-		        int monthFlag 		= 2;
-		        int dayFlag   		= 3;
-		        int hourFlag  		= 4;
-		        int minFlag   		= 5;
-		        int secFlag   		= 6;
-		        int milliSecFlag 	= 7;
-		        int dayoftheweekFlag  = 8;					
-				int flagDate        = 10;
-				*/
 
 				date = MMDDYYYYHHMMSSFormat.parse(dateStr, new ParsePosition(0));
 	            if(date!=null)
@@ -1198,7 +1166,6 @@ public class ChartJSONHelper {
 						formatFlag = MINFLAG;
 	            }
 	            if(date==null) {
-	            	//MMDDYYYYHHFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
 	                date = MMDDYYYYHHFormat.parse(dateStr, new ParsePosition(0));
 	                if(date!=null)
 						formatFlag = HOURFLAG;
@@ -1371,8 +1338,6 @@ public class ChartJSONHelper {
     
        
    	private void clearReportRuntimeBackup(HttpServletRequest request) {
-		//Session sess = Sessions.getCurrent(true)getCurrent();
-        //HttpSession session = (HttpSession)sess.getNativeSession();
         HttpSession session = request.getSession();
 		session.removeAttribute(AppConstants.DRILLDOWN_REPORTS_LIST);
 		request.removeAttribute(AppConstants.DRILLDOWN_INDEX);
@@ -1477,8 +1442,6 @@ public class ChartJSONHelper {
 							value.append(")");
 						}
 					}
-					
-					//value = value.substring(0 , value.length());	
 				 
 				 valuesMap.put(fieldNameMap.get(formField), value.toString());
 				 value = new StringBuffer("");
-- 
cgit 1.2.3-korg