diff options
author | Indrijeet kumar <indriku1@in.ibm.com> | 2020-06-01 15:25:26 +0530 |
---|---|---|
committer | Indrijeet kumar <indriku1@in.ibm.com> | 2020-06-01 15:25:35 +0530 |
commit | 1d5a716382901c7f998c4b965e0e30bd88b57c97 (patch) | |
tree | b3d9e65538b929b3a34c806754bc1e3fe577a385 /ecomp-sdk | |
parent | 273ccf87b2609ed82fe681e2211fc402f799307f (diff) |
lowered code smells in FormFields.java
lowered code smells in FormFields.java
Issue-ID: PORTAL-813
Change-Id: I88f346073855d3bf81aa43f634f7a6048c54253e
Signed-off-by: Indrijeet Kumar <indriku1@in.ibm.com>
Diffstat (limited to 'ecomp-sdk')
-rw-r--r-- | ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/FormField.java | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/FormField.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/FormField.java index 49ed35b3..e144ef77 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/FormField.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/FormField.java @@ -559,9 +559,7 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme } lookup = new IdNameSql(-1, SQL, lu.getDefaultSQL()); } - // } lookupList = lookup; - // } lookup.loadUserData(0, "", getDbInfo(), getUserId()); } @@ -580,9 +578,7 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme } // for - // lookup.clearData(); } catch (Exception e) { - // throw new RaptorRuntimeException(e); } if (!hasPredefinedList) { if (oldSQL != null && !oldSQL.equals("")) { @@ -751,7 +747,6 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme lookup = new IdNameSql(-1, SQL, lu.getDefaultSQL()); } lookupList = lookup; - // } if (nvl(fieldValue).length() > 0 && (dependsOn == null || dependsOn.length() <= 0)) { sb.append((fieldValue != null) ? "obj.value=\"" + nvl(fieldValue) + "\";" : ""); } else if (lookup != null) { @@ -779,7 +774,6 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme } } catch (Exception e) { } - // if(isVisible()) return sb.toString(); } else if (fieldType.equals(FFT_LIST_BOX)) { StringBuffer sb = new StringBuffer(); @@ -817,10 +811,7 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme } lookup = new IdNameSql(-1, SQL, lu.getDefaultSQL()); } - // } lookupList = lookup; - - // } try { lookup.loadUserData(0, "", getDbInfo(), getUserId()); } catch (Exception e) { @@ -867,7 +858,6 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme ((IdNameSql) lookup).setSQL(oldSQL); } } - // System.out.println("FORMFIELD 6666667 " + ((IdNameSql)lookup).getSql()); if (isVisible()) return sb.toString(); else @@ -890,9 +880,7 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme } catch (IllegalArgumentException ex1) { } catch (Exception ex2) { } - // System.out.println(fieldName + " " + fieldType + " " + fieldValue); if (fieldType.equals(FFT_TEXT_W_POPUP)) { - // System.out.println("TEXT POPUP " + fieldName); String oldSQL = ""; IdNameValue idNamevalue = null; String fieldDefValue = ""; @@ -915,7 +903,6 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme Map.Entry entry = (Entry) iter.next(); value = (String) entry.getValue(); SQL = Utils.replaceInString(SQL, "[" + entry.getKey() + "]", value); - // if(SQL.indexOf("'"+"["+entry.getKey()+"]"+"'")!=-1) { if (SQL.indexOf("'" + "[" + entry.getKey() + "]" + "'") != -1 || SQL.indexOf("'" + "[" + entry.getKey()) != -1 || SQL.indexOf(entry.getKey() + "]" + "'") != -1 @@ -952,7 +939,6 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme lookup = new IdNameSql(-1, SQL, null); } } - // lookupList = lookup; if (getFieldDefaultSQL() != null && (fieldValue == null || fieldValue.trim().equalsIgnoreCase("null") || fieldValue.trim().length() <= 0)) { @@ -1034,13 +1020,6 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme } if (isVisible()) { - /* - * return "<input type=text class=\"text\" size=30 maxlength=50 id=\"" + - * fieldName +"\" name=\"" + fieldName + "\" value=\"" + nvl(fieldDefValue) + - * "\">\n" + "<a href=\"javascript:showArgPopupNew('" + fieldName + - * "', 'document.formd." + fieldName + "')\"><img border=0 src=\"" + - * AppUtils.getImgFolderURL() + "shareicon.gif\" " + getHelpLink(fieldName); - */ String progress = "<div id=\"" + fieldName + "_content\" style=\"display:none;width:100%;height:100%;align:center;\"> <img src=\"" + AppUtils.getImgFolderURL() @@ -1070,8 +1049,6 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme if (lu.getSql().length() > 0) { valueSQL = lu.getSql(); avail_ReadOnly = (valueSQL.toLowerCase().indexOf(readOnlyInSql) != -1); - // System.out.println("OLD SQL TEXT" + valueSQL); - // oldSQL = lu.getSql(); if (formValues != null) { Set set = formValues.entrySet(); String value1 = ""; @@ -1087,11 +1064,8 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme } } // should be value one. - // lookup = new IdNameSql(-1,valueSQL,lu.getDefaultSQL()); } } - // lookupList = lookup; - // System.out.println("8888888 88 " + valueSQL); } if (valueSQL != null && valueSQL.length() > 0) { DataSet ds = ConnectionUtils.getDataSet(valueSQL.toString(), dbInfo); @@ -1113,10 +1087,6 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme && !inSchedule) ? "" : "") + getCallableJavascript(getFieldName(), rr) + " " + (readOnly ? " readonly " : " ") + " value=\""; - /* - * if(getFieldDefaultSQL()!=null) returnString += nvl(value.getId()); else - * returnString += fieldValue; - */ if (fieldValue != null && fieldValue.length() > 0 && (!(fieldValue.toUpperCase().indexOf("SELECT ") != -1 && fieldValue.toUpperCase().indexOf("FROM") != -1))) { if (validationType.startsWith("TIMESTAMP")) { @@ -1159,15 +1129,6 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme } else returnString += nvl((value != null) ? value.getId() : ""); - /* - * returnString += "\">" + (validationType.equals(VT_DATE) ? - * "\n\t\t\t<a href=\"#\" onClick=\"window.dateField=document." + HTML_FORM + - * "." + fieldName + ";calendar=window.open('" + AppUtils.getRaptorActionURL() + - * "popup.calendar','cal','WIDTH=200,HEIGHT=250');return false;\">" + - * "\n\t\t\t\t<img src=\"" + AppUtils.getImgFolderURL() + - * "calender_icon.gif\" align=absmiddle border=0 width=20 height=20></a>" : ""); - */ - SimpleDateFormat dtf = new SimpleDateFormat("MM/dd/yyyy"); String stRangeText = this.getRangeStartDate() == null ? null : dtf.format(this.getRangeStartDate().getTime()); @@ -1176,12 +1137,8 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme // get the date sqls - // System.out.println("////////////start range date before Start" + - // this.getRangeStartDateSQL()); - if (this.getRangeStartDateSQL() != null && this.getRangeStartDateSQL().trim().toLowerCase().startsWith("select")) { - // System.out.println("////////////start range date Starting"); String SQL = this.getRangeStartDateSQL(); if (formValues != null) { Set set = formValues.entrySet(); @@ -1189,15 +1146,12 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme for (Iterator iter = set.iterator(); iter.hasNext();) { Map.Entry entry = (Entry) iter.next(); v = (String) entry.getValue(); - // System.out.println("///////// key is " + entry.getKey() + " = " + v); SQL = Utils.replaceInString(SQL, "[" + entry.getKey() + "]", v); } } - // System.out.println("////////////start range date sql created" + SQL); try { DataSet ds = ConnectionUtils.getDataSet(SQL.toString(), dbInfo); - // System.out.println("////////////start range date is : " + ds.get(0)); dtf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Calendar tStart = Calendar.getInstance(); tStart.setTime(dtf.parse(ds.getString(0, 0))); @@ -1211,7 +1165,6 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme if (this.getRangeEndDateSQL() != null && this.getRangeEndDateSQL().trim().toLowerCase().startsWith("select")) { - // System.out.println("////////////end range date Starting"); String SQL = this.getRangeEndDateSQL(); if (formValues != null) { Set set = formValues.entrySet(); @@ -1225,12 +1178,10 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme } try { DataSet ds = ConnectionUtils.getDataSet(SQL.toString(), dbInfo); - // System.out.println("////////////end range date is : " + ds.get(0)); dtf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Calendar tStart = Calendar.getInstance(); tStart.setTime(dtf.parse(ds.getString(0, 0))); dtf = new SimpleDateFormat("MM/dd/yyyy"); - // endRangeText = dtf.format(tStart.getTime()); endRangeText = dtf.format(tStart.getTime().getTime() + MILLIS_IN_DAY); } catch (Exception e) { System.out.println("Exception////////// : end range date is : " + e); @@ -1267,30 +1218,17 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme if (inSchedule) hour = Integer.parseInt(nvl(((String) formValues.get(fieldName + "_Hr")), "0")); } - // System.out.println("Hour =" + hour); } catch (NumberFormatException ex) { hour = 0; } try { t_hr = Integer.parseInt(timestamphr); - // System.out.println("THR =" + t_hr); } catch (NumberFormatException ex) { t_hr = 0; } if (hour <= 0) hour = t_hr; - // System.out.println("Form Values 887 " + formValues); - /* - * if (formValues.containsKey(fieldDisplayName+"_Hr")){ - * formValues.remove(fieldDisplayName+"_Hr"); - * formValues.put(fieldDisplayName+"_Hr", hour); } else - * formValues.put(fieldDisplayName+"_Hr", hour); - * System.out.println("Form Values 887 " + formValues); - */ - - // int t_min = Integer.parseInt(timestampmin); - // int t_sec = Integer.parseInt(timestampsec); for (int i = 0; i < 24; i++) { if (i == 0) timeStampStr += "<option value=\"" + i + "\"" + ((hour == i) ? " selected" : "") |