diff options
author | Lorraine Welch <lb2391@att.com> | 2020-06-02 13:20:15 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-06-02 13:20:15 +0000 |
commit | 764130aaec240f6f7889b232e87ce458c88a4fe1 (patch) | |
tree | 11c81d15aec62b3c6e8763da113a4d34fb3237f1 /ecomp-sdk/epsdk-analytics/src/main/java/org/onap | |
parent | 1bfa5eb8e6481954769a99159a7cc0d32ba17a51 (diff) | |
parent | fe948593a83fc76a9f8b87d209f0b78a4e71796f (diff) |
Merge "lowered code smells in a few components"
Diffstat (limited to 'ecomp-sdk/epsdk-analytics/src/main/java/org/onap')
3 files changed, 2 insertions, 69 deletions
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/FormatProcessor.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/FormatProcessor.java index 62bf4335..1c0e1c3d 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/FormatProcessor.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/FormatProcessor.java @@ -343,7 +343,6 @@ public class FormatProcessor extends RaptorObject { count++; } } - //} } else { dv.setCellFormatter(formatter); diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportParamDateValueParser.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportParamDateValueParser.java index 73380025..037a6ec5 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportParamDateValueParser.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportParamDateValueParser.java @@ -48,22 +48,6 @@ import org.onap.portalsdk.analytics.util.Utils; public class ReportParamDateValueParser { - /*public static final SimpleDateFormat[] dateFormats; - - static { - dateFormats = new SimpleDateFormat[5]; - (dateFormats[0] = new SimpleDateFormat(AppConstants.JAVA_DATE_FORMAT_MONTHYYYY)) - .setLenient(true); - (dateFormats[1] = new SimpleDateFormat(AppConstants.JAVA_DATE_FORMAT_MONTHDDYYYY)) - .setLenient(true); - (dateFormats[2] = new SimpleDateFormat(AppConstants.JAVA_DATE_FORMAT_MMDDYYYY)) - .setLenient(true); - (dateFormats[3] = new SimpleDateFormat(AppConstants.JAVA_DATE_FORMAT_MMYYYY)) - .setLenient(true); - (dateFormats[4] = new SimpleDateFormat(AppConstants.JAVA_DATE_FORMAT_DDMONYYYY)) - .setLenient(true); - }*/ - public static boolean isDateHrParam(String param) { SimpleDateFormat[] dateFormats = new SimpleDateFormat[2]; dateFormats[0] = new SimpleDateFormat(AppConstants.JAVA_DATE_FORMAT_MMDDYYYY_HR); diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportParamValues.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportParamValues.java index 2cff3e63..98651143 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportParamValues.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportParamValues.java @@ -107,12 +107,6 @@ public class ReportParamValues extends Hashtable { } // for } // ReportParamValues - /* - * public ReportParamValues(ReportFormFields rff, HttpServletRequest - * request) { this(rff); - * - * setParamValues(request); } // ReportParamValues - */ public boolean isParameterMultiValue(String fieldName) { Boolean b = (Boolean) paramIsMultiValue.get(fieldName); return (b != null) ? b.booleanValue() : false; @@ -130,7 +124,6 @@ public class ReportParamValues extends Hashtable { public boolean setParamValues(HttpServletRequest request, boolean refresh) { long currentTime = System.currentTimeMillis(); - //System.out.println("ReportParamValues setParamValues called " + refresh); boolean paramUpdated = false; if(refresh) clearValues(); @@ -152,41 +145,24 @@ public class ReportParamValues extends Hashtable { newValue = XSSFilter.filterRequestOnlyScript(sb.toString()); } // if } else if (isParameterTextAreaValue(key)) { -/* String[] values = request.getParameterValues(key); - - if (values != null) { - StringBuffer sb = new StringBuffer(); - for (int i = 0; i < values.length; i++) { - if (sb.length() > 0) - sb.append('|'); - sb.append(values[i]); - } // for -*/ String value = ""; value = request.getParameter(key); value = Utils.oracleSafe(nvl(value)); paramIsTextAreaDrilldownValue.put(key, value); value = value.replaceAll(",", "|"); value = "('" + Utils.replaceInString(value, "|", "','") + "')"; - //value = Utils.replaceInString(value, "|", ","); newValue = XSSFilter.filterRequestOnlyScript(value); paramIsTextAreaValueModified.put(key, new Boolean(true)); //} // if } else - // newValue = nvl(request.getParameter(key)); newValue = XSSFilter.filterRequestOnlyScript(request.getParameter(key)); - //debugLogger.debug("IN REPORTPARAM ^NEW VALUE " + newValue + " OLD VALUE " + oldValue + " KEY " + key + " isParameterMultiValue(key) " + isParameterMultiValue(key)); if(!isParameterMultiValue(key) && !isParameterTextAreaValue(key)) { if(refresh && nvl(newValue).length()<=0) { put(key, oldValue); } else if ( ((newValue != null && newValue.trim().length()>0) && (oldValue!=null && oldValue.trim().length()>0) && !newValue.equals(oldValue)) || ((newValue != null && newValue.trim().length()>0) && (oldValue == null || oldValue.trim().length() <= 0)) ) { - paramUpdated = true; - //System.out.println("paramupdated1 " +paramUpdated+ " " + newValue + " " + oldValue); - // if(newValue.startsWith("[") && newValue.endsWith("]")) { - // newValue = getDateAsString(newValue); - // } + paramUpdated = true; put(key, newValue); } else if (((newValue == null || newValue.trim().length()<=0)) && (oldValue!=null && oldValue.trim().length()>0)) { paramUpdated = true; @@ -212,12 +188,10 @@ public class ReportParamValues extends Hashtable { } else if (((newValue == null || newValue.trim().length()<=0)) && (oldValue!=null && oldValue.trim().length()>0) && (isParameterMultiValue(key)||isParameterTextAreaValue(key))) { paramUpdated = true; - //System.out.println("paramupdated3 " +paramUpdated+ " N" + newValue + " O" + oldValue); put(key, ""); } } } // for - //printValues(); logger.debug(EELFLoggerDelegate.debugLogger, ("[DEBUG MESSAGE FROM RAPTOR] ------->Time Taken for Adding/Clearing Param Values for Search Field Display " + (System.currentTimeMillis() - currentTime))); return paramUpdated; } // setParamValues @@ -240,18 +214,10 @@ public class ReportParamValues extends Hashtable { } value = Utils.replaceInString(value, "~", "' , '"); value = "('" + Utils.replaceInString(value, "|", "','") + "')"; // changed from "|" - //value = Utils.replaceInString(value, "|", ","); value = XSSFilter.filterRequestOnlyScript(value); return value; } else return ""; -// if(nvl(value).length()>0) { -// value = Utils.replaceInString(value, ",", "|"); -// value = value.indexOf("('")!=-1? value.substring(2, value.length()-2):value; -// value = Utils.replaceInString(value, "'|'", ","); -// } -// return value; - } else return (String) get(key); } @@ -305,7 +271,6 @@ public class ReportParamValues extends Hashtable { if(nvl(defaultValue).length()>0) { put(key,ff.getDefaultValue()); } else if(nvl(defaultSQL).length() > 0) { - //defaultSQL = Utils.replaceInString(defaultSQL, "[LOGGED_USERID]", userId); if(!(isParameterMultiValue(key) || isParameterTextAreaValue(key))) { defaultQuery = "SELECT id, name FROM (SELECT rownum r, id, name FROM (" + defaultSQL + ") x " @@ -325,13 +290,7 @@ public class ReportParamValues extends Hashtable { } } } - } - -/* for (Enumeration enKeys = keys(); enKeys.hasMoreElements();) { - String key = (String) enKeys.nextElement(); - put(key,""); - } -*/ + } } @@ -346,28 +305,20 @@ public class ReportParamValues extends Hashtable { private String getDateAsString (String keyword) { String sql = ""; if (keyword.equals("[PROCESSING_DATE]")) { - //sql = "select to_char(trunc(sysdate,'dd'), 'mm/dd/yyyy') as dateStr from dual"; sql = "select to_char(trunc(sysdate,'dd'), 'mm/dd/yyyy') as dateStr" + Globals.getGenerateSqlVisualDual(); } else if (keyword.equals("[PROCESSING_NEXT_DATE]")) { - //sql = "select to_char(trunc(sysdate+1,'dd'), 'mm/dd/yyyy') as dateStr from dual"; sql = "select to_char(trunc(sysdate+1,'dd'), 'mm/dd/yyyy') as dateStr" + Globals.getGenerateSqlVisualDual(); } else if (keyword.equals("[PROCESSING_DAY_BEFORE_DATE]")) { - //sql = "select to_char(trunc(sysdate-1,'dd'), 'mm/dd/yyyy') as dateStr from dual"; sql = "select to_char(trunc(sysdate-1,'dd'), 'mm/dd/yyyy') as dateStr"+ Globals.getGenerateSqlVisualDual(); } else if (keyword.equals("[PROCESSING_MONTH_START_DATE]")) { - //sql = "select to_char(trunc(sysdate,'MM'), 'mm/dd/yyyy') as dateStr from dual"; sql = "select to_char(trunc(sysdate,'MM'), 'mm/dd/yyyy') as dateStr"+ Globals.getGenerateSqlVisualDual(); } else if (keyword.equals("[PROCESSING_MONTH_END_DATE]")) { - //sql = "select to_char(last_day(sysdate), 'mm/dd/yyyy') as dateStr from dual"; sql = "select to_char(last_day(sysdate), 'mm/dd/yyyy') as dateStr" + Globals.getGenerateSqlVisualDual(); } else if (keyword.equals("[CURRENT_HOUR]")) { - //sql = "select to_char(trunc(sysdate,'HH24'),'mm/dd/yyyy HH24') as dateStr from dual"; sql = "select to_char(trunc(sysdate,'HH24'),'mm/dd/yyyy HH24') as dateStr"+ Globals.getGenerateSqlVisualDual(); } else if (keyword.equals("[PREVIOUS_HOUR]")) { - //sql = "select to_char(trunc(sysdate-1/24, 'HH24'),'mm/dd/yyyy HH24') as dateStr from dual"; sql = "select to_char(trunc(sysdate-1/24, 'HH24'),'mm/dd/yyyy HH24') as dateStr" + Globals.getGenerateSqlVisualDual(); } else if (keyword.equals("[NEXT_HOUR]")) { - //sql = "select to_char(trunc(sysdate+1/24, 'HH24'),'mm/dd/yyyy HH24') as dateStr from dual"; sql = "select to_char(trunc(sysdate+1/24, 'HH24'),'mm/dd/yyyy HH24') as dateStr" + Globals.getGenerateSqlVisualDual(); } DataSet ds = null; @@ -381,7 +332,6 @@ public class ReportParamValues extends Hashtable { return ""; } catch (RaptorException ex) { logger.error(EELFLoggerDelegate.errorLogger, "RaptorException in getDateAsString", ex); - //throw ex; } return ""; } |