diff options
author | Indrijeet kumar <indriku1@in.ibm.com> | 2020-06-09 08:27:21 +0530 |
---|---|---|
committer | Indrijeet kumar <indriku1@in.ibm.com> | 2020-06-09 08:27:50 +0530 |
commit | 9aa3957e65e0a4edb155f5334cad4cac11ef55b9 (patch) | |
tree | bb9cf6b9f5252ec3100242bc4ca1f3e02ae9f2d0 /ecomp-sdk | |
parent | 6d48b04c34a009323b92b23efc507c63e40b1d87 (diff) |
lowered code smells in ChartD3Helper & ChartJSONHe
lowered code smells in ChartD3Helper & ChartJSONHelper
Issue-ID: PORTAL-813
Change-Id: I7b0b90617750f3a4c0144ebb59b3fa1ef8072dda
Signed-off-by: Indrijeet Kumar <indriku1@in.ibm.com>
Diffstat (limited to 'ecomp-sdk')
2 files changed, 2 insertions, 47 deletions
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartD3Helper.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartD3Helper.java index 0934e35c..a63ce959 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartD3Helper.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartD3Helper.java @@ -3271,141 +3271,115 @@ public class ChartD3Helper { int flagDate = 10; */ - //date = MMDDYYYYHHMMSSFormat.parse(dateStr, new ParsePosition(0)); date = timezoneConversion(MMDDYYYYHHMMSSFormat, dateStr); if(date!=null) formatFlag = SECFLAG; if(date==null) { - //date = EEEMMDDYYYYFormat.parse(dateStr, new ParsePosition(0)); date = timezoneConversion(EEEMMDDYYYYFormat, dateStr); if(date!=null) formatFlag = DAYOFTHEWEEKFLAG; } if(date==null) { - //date = MMDDYYYYHHMMFormat.parse(dateStr, new ParsePosition(0)); date = timezoneConversion(MMDDYYYYHHMMFormat, dateStr); if(date!=null) formatFlag = MINFLAG; } if(date==null) { - //MMDDYYYYHHFormat.setTimeZone(TimeZone.getTimeZone("UTC")); - //date = MMDDYYYYHHFormat.parse(dateStr, new ParsePosition(0)); date = timezoneConversion(MMDDYYYYHHFormat, dateStr); if(date!=null) formatFlag = HOURFLAG; } if(date==null) { - //date = MMDDYYYYFormat.parse(dateStr, new ParsePosition(0)); date = timezoneConversion(MMDDYYYYFormat, dateStr); if(date!=null) formatFlag = DAYFLAG; } if(date==null) { - //date = YYYYMMDDFormat.parse(dateStr, new ParsePosition(0)); date = timezoneConversion(YYYYMMDDFormat, dateStr); if(date!=null) formatFlag = DAYFLAG; } if(date==null) { - //date = timestampFormat.parse(dateStr, new ParsePosition(0)); date = timezoneConversion(timestampFormat, dateStr); if(date!=null) formatFlag = SECFLAG; } if(date==null) { - //date = timestampHrFormat.parse(dateStr, new ParsePosition(0)); date = timezoneConversion(timestampHrFormat, dateStr); if(date!=null) formatFlag = HOURFLAG; } if(date==null) { - //date = timestampDayFormat.parse(dateStr, new ParsePosition(0)); date = timezoneConversion(timestampDayFormat, dateStr); if(date!=null) formatFlag = DAYFLAG; } if(date==null) { - //date = MONYYYYFormat.parse(dateStr, new ParsePosition(0)); date = timezoneConversion(MONYYYYFormat, dateStr); if(date!=null) formatFlag = MONTHFLAG; } if(date==null) { - //date = MMYYYYFormat.parse(dateStr, new ParsePosition(0)); date = timezoneConversion(MMYYYYFormat, dateStr); if(date!=null) formatFlag = MONTHFLAG; } if(date==null) { - //date = MMMMMDDYYYYFormat.parse(dateStr, new ParsePosition(0)); date = timezoneConversion(MMMMMDDYYYYFormat, dateStr); if(date!=null) formatFlag = DAYFLAG; } if(date==null) { - //date = MONTHYYYYFormat.parse(dateStr, new ParsePosition(0)); date = timezoneConversion(MONTHYYYYFormat, dateStr); if(date!=null) formatFlag = MONTHFLAG; } if(date==null) { - //date = YYYYMMDDHHMMSSFormat.parse(dateStr, new ParsePosition(0)); date = timezoneConversion(YYYYMMDDHHMMSSFormat, dateStr); if(date!=null) formatFlag = SECFLAG; } if(date==null) { - //date = YYYYMMDDHHMMFormat.parse(dateStr, new ParsePosition(0)); date = timezoneConversion(YYYYMMDDHHMMFormat, dateStr); if(date!=null) formatFlag = MINFLAG; } if(date==null) { - //date = DDMONYYYYHHMMSSFormat.parse(dateStr, new ParsePosition(0)); date = timezoneConversion(DDMONYYYYHHMMSSFormat, dateStr); if(date!=null) formatFlag = SECFLAG; } if(date==null) { - //date = DDMONYYYYHHMMFormat.parse(dateStr, new ParsePosition(0)); date = timezoneConversion(DDMONYYYYHHMMFormat, dateStr); if(date!=null) formatFlag = MINFLAG; } if(date==null) { - //date = DDMONYYYYFormat.parse(dateStr, new ParsePosition(0)); date = timezoneConversion(DDMONYYYYFormat, dateStr); if(date!=null) formatFlag = DAYFLAG; } if(date==null) { - //date = MMDDYYHHMMSSFormat.parse(dateStr, new ParsePosition(0)); date = timezoneConversion(MMDDYYHHMMSSFormat, dateStr); if(date!=null) formatFlag = SECFLAG; } if(date==null) { - //date = MMDDYYHHMMFormat.parse(dateStr, new ParsePosition(0)); date = timezoneConversion(MMDDYYHHMMFormat, dateStr); if(date!=null) formatFlag = MINFLAG; } if(date==null) { - //date = MMDDYYFormat.parse(dateStr, new ParsePosition(0)); date = timezoneConversion(MMDDYYFormat, dateStr); if(date!=null) formatFlag = DAYFLAG; } if(date==null) { - //date = timestampFormat1.parse(dateStr, new ParsePosition(0)); date = timezoneConversion(timestampFormat1, dateStr); if(date!=null) formatFlag = SECFLAG; } if(date==null) { - //date = MMDDYYYYHHMMZFormat.parse(dateStr, new ParsePosition(0)); date = timezoneConversion(MMDDYYYYHHMMZFormat, dateStr); if(date!=null) formatFlag = MINFLAG; } if(date==null) { - //date = YYYYFormat.parse(dateStr, new ParsePosition(0)); date = timezoneConversion(YYYYFormat, dateStr); /* Some random numbers should not satisfy this year format. */ if(dateStr.length()>4) date = null; if(date!=null) formatFlag = YEARFLAG; } if(date==null) { - //date = timestamp_W_dash.parse(dateStr, new ParsePosition(0)); date = timezoneConversion(timestamp_W_dash, dateStr); if(date!=null) formatFlag = SECFLAG; } @@ -3453,16 +3427,6 @@ public class ChartD3Helper { 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) @@ -3478,7 +3442,6 @@ public class ChartD3Helper { formatFlag = MINFLAG; } if(date==null) { - //MMDDYYYYHHFormat.setTimeZone(TimeZone.getTimeZone("UTC")); date = MMDDYYYYHHFormat.parse(dateStr, new ParsePosition(0)); if(date!=null) formatFlag = HOURFLAG; @@ -3656,8 +3619,6 @@ public class ChartD3Helper { 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); @@ -3740,7 +3701,7 @@ public class ChartD3Helper { try { if(vals[j] !=null && vals[j].length() > 0) { vals[j] = Utils.oracleSafe(vals[j]); - value.append(java.net.URLDecoder.decode(vals[j], "UTF-8"));// + ","; + value.append(java.net.URLDecoder.decode(vals[j], "UTF-8")); } else value.append(vals[j]); @@ -3762,8 +3723,6 @@ public class ChartD3Helper { value.append(")"); } } - - //value = value.substring(0 , value.length()); valuesMap.put(fieldNameMap.get(formField), value.toString()); } else if(request.getParameter(formField) != null) { 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 797333cc..088409e1 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 @@ -642,8 +642,6 @@ public class ChartJSONHelper { if (nvl(getChartType()).length() == 0) return null; //TODO: display chart function to be added. - //if (!getDisplayChart()) - // return null; String sql = null; sql = generateChartSQL(userId, request); @@ -848,8 +846,6 @@ public class ChartJSONHelper { public String getSelectExpr(DataColumnType dct) { - // String colName = - // dct.isCalculated()?dct.getColName():((nvl(dct.getTableId()).length()>0)?(dct.getTableId()+"."+dct.getColName()):dct.getColName()); return getSelectExpr(dct, dct.getColName() /* colName */); } // getSelectExpr @@ -1420,7 +1416,7 @@ public class ChartJSONHelper { try { if(vals[j] !=null && vals[j].length() > 0) { vals[j] = Utils.oracleSafe(vals[j]); - value.append(java.net.URLDecoder.decode(vals[j], "UTF-8"));// + ","; + value.append(java.net.URLDecoder.decode(vals[j], "UTF-8")); } else value.append(vals[j]); |