removed unwanted codes in FormField comp 62/107862/1
authorIndrijeet kumar <indriku1@in.ibm.com>
Tue, 19 May 2020 10:14:15 +0000 (15:44 +0530)
committerIndrijeet kumar <indriku1@in.ibm.com>
Tue, 19 May 2020 10:16:07 +0000 (15:46 +0530)
removed unwanted codes in FormFields component

Issue-ID: PORTAL-813
Change-Id: Ibe9312cc558443bfbc84d7c836df35ec9e450c64
Signed-off-by: Indrijeet Kumar <indriku1@in.ibm.com>
ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/FormField.java

index f3633a6..49ed35b 100644 (file)
@@ -142,9 +142,6 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme
 
        public static final String FFT_TEXTAREA = "TEXT";
 
-// Changed to "TEXT"   
-//     public static final String FFT_TEXTAREA = "TEXTAREA";
-
        public static final String FFT_COMBO_BOX = "COMBO_BOX";
 
        public static final String FFT_LIST_BOX = "LIST_BOX";
@@ -186,7 +183,6 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme
                        boolean required, String defaultValue, String helpText, boolean visible, String dependsOn,
                        Calendar rangeStartDate, Calendar rangeEndDate, String rangeStartDateSQL, String rangeEndDateSQL,
                        String multiSelectListSize) {
-               // super();
                this(fieldName, fieldDisplayName, fieldType, validationType, required, defaultValue, helpText, dependsOn,
                                rangeStartDate, rangeEndDate, rangeStartDateSQL, rangeEndDateSQL, multiSelectListSize);
                setVisible(visible);
@@ -251,7 +247,6 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme
                        String rangeStartDateSQL, String rangeEndDateSQL, String multiSelectListSize) {
                this(fieldName, fieldDisplayName, fieldType, validationType, required, defaultValue, helpText, dependsOn,
                                rangeStartDate, rangeEndDate, rangeStartDateSQL, rangeEndDateSQL, multiSelectListSize);
-               // if(dependsOn !=null){ this.dependsOn = dependsOn; }else { this.dependsOn = ""
                if (defaultValue != null && defaultValue.length() > 10
                                && defaultValue.substring(0, 10).trim().toLowerCase().startsWith("select")) {
                        setFieldDefaultSQL(defaultValue);
@@ -388,14 +383,7 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme
        }
 
        public String getHelpLink(String fieldName) {
-               // return "<a href=\"#\" onclick=\"javascript:ShowContent('" + fieldName +
-               // "_div')\"><img src=\""+AppUtils.getBaseFolderURL()+"images/quickhelp_dk.gif\"
-               // width=\"12\" height=\"12\" alt=\"\" border=\"0\" class=\"qh-element\"
-               // /></a>";
                return ((getHelpText() != null && getHelpText().length() > 0) ? "tooltipText=\"" + getHelpText() + "\">" : ">");
-               // return ((getHelpText()!=null && getHelpText().length()>0)? "<img
-               // src=\"static/fusion/raptor/images/quickhelp_lt.gif\" tooltipText=\""+
-               // getHelpText() + "\"/>": "");
        }
 
        public String getCallableAfterChainingJavascript(String fieldName, ReportRuntime rr) {
@@ -459,7 +447,6 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme
                }
                if (fieldType.equals(FFT_COMBO_BOX)) {
                        StringBuffer sb = new StringBuffer();
-                       // System.out.println("COMBO BOX " + fieldName);
                        String oldSQL = "";
                        if (!required)
                                sb.append("obj.options[obj.options.length] = new Option('-->select value<--','');");
@@ -467,18 +454,10 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme
                        IdNameList lookup = getLookupList();
                        try {
                                if (!hasPredefinedList) {
-                                       // if(dependsOn != null && dependsOn != "") {
-                                       // if(dependsOn != null && dependsOn != "" ) {
                                        IdNameSql lu = (IdNameSql) lookup;
                                        String SQL = "";
                                        SQL = lu.getSql();
-                                       /*
-                                        * if(nvl(fieldValue,"").length()<=0) SQL = lu.getSql(); else SQL =
-                                        * lu.getBaseSQLForPDFExcel(false);
-                                        */
-                                       // System.out.println("FORMFIELD 6666667 First" + ((IdNameSql)lookup).getSql());
                                        oldSQL = lu.getSql();
-                                       // SQL = Utils.replaceInString(SQL, "[VALUE]", fieldValue);
                                        if (formValues != null) {
                                                Set set = formValues.entrySet();
                                                String value = "";
@@ -502,10 +481,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) {
@@ -519,12 +495,6 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme
                                for (lookup.resetNext(); lookup.hasNext();) {
                                        IdNameValue value = lookup.getNext();
                                        if (value != null && value.getId() != null && value.getName() != null) {
-                                               /*
-                                                * if (count == 0 && required) { selectedValue = value.getId(); count++; } else
-                                                * if (nvl(fieldValue).length()>0){ if (fieldValue != null &&
-                                                * fieldValue.equals(value.getId())){ selectedValue = value.getId(); } count++;
-                                                * } else { count++; }
-                                                */
                                                if (count == 0) {
                                                        if (required) {
                                                                selectedValue = value.getId();
@@ -550,14 +520,12 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme
                                }
                                formValues.put(fieldDisplayName, selectedValue);
                        } catch (Exception e) {
-                               // throw new RaptorRuntimeException(e);
                        }
                        if (!hasPredefinedList) {
                                if (oldSQL != null && !oldSQL.equals("")) {
                                        ((IdNameSql) lookup).setSQL(oldSQL);
                                }
                        }
-                       // System.out.println("FORMFIELD 6666667 " + ((IdNameSql)lookup).getSql());
                        if (isVisible())
                                return sb.toString();
                        else
@@ -570,16 +538,9 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme
                        IdNameList lookup = getLookupList();
                        try {
                                if (!hasPredefinedList) {
-                                       // if(dependsOn != null && dependsOn != "") {
-                                       // if(dependsOn != null && dependsOn != "" ) {
                                        IdNameSql lu = (IdNameSql) lookup;
                                        String SQL = "";
                                        SQL = lu.getSql();
-                                       /*
-                                        * if(nvl(fieldValue,"").length()<=0) SQL = lu.getSql(); else SQL =
-                                        * lu.getBaseSQLForPDFExcel(false); SQL = Utils.replaceInString(SQL, "[VALUE]",
-                                        * fieldValue);
-                                        */
                                        oldSQL = lu.getSql();
                                        if (formValues != null) {
                                                Set set = formValues.entrySet();
@@ -633,7 +594,6 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme
                        else
                                return "";
                } else if (fieldType.equals(FFT_TEXT_W_POPUP)) {
-                       // System.out.println("TEXT POPUP " + fieldName);
                        String oldSQL = "";
                        IdNameValue idNamevalue = null;
                        String fieldDefValue = "";
@@ -661,7 +621,6 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme
                                                                }
                                                        }
                                                        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
@@ -698,7 +657,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)) {
@@ -739,7 +697,6 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme
                                                }
 
                                        } catch (Exception e) {
-                                               // throw new RaptorRuntimeException(e);
                                        }
 
                                        // ----- END ---//
@@ -757,16 +714,9 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme
                                        }
 
                                }
-                       } catch (Exception e) { // throw new RaptorRuntimeException(e);
+                       } catch (Exception e) {
                        }
                        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);
-                                */
                                return "obj.value=\"" + Utils.singleQuoteEncode(nvl(fieldDefValue)) + "\";";
 
                        } else
@@ -776,11 +726,8 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme
                        String oldSQL = "";
                        try {
                                IdNameList lookup = getLookupList();
-                               // if(dependsOn != null && dependsOn != "") {
-                               // if(dependsOn != null && dependsOn != "" ) {
                                IdNameSql lu = (IdNameSql) lookup;
                                String SQL = lu.getSql();
-                               // System.out.println("SQL HIDDEN 1 " + SQL);
                                oldSQL = lu.getSql();
                                if (formValues != null) {
                                        Set set = formValues.entrySet();
@@ -798,14 +745,11 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme
 
                                                        }
                                                }
-                                               // System.out.println("HIDDEN " + "["+entry.getKey()+"]" + "-" + value);
                                                SQL = Utils.replaceInString(SQL, "[" + entry.getKey() + "]", value);
                                        }
 
                                        lookup = new IdNameSql(-1, SQL, lu.getDefaultSQL());
                                }
-                               // System.out.println("SQL HIDDEN 2 " + SQL);
-                               // }
                                lookupList = lookup;
                                // }
                                if (nvl(fieldValue).length() > 0 && (dependsOn == null || dependsOn.length() <= 0)) {
@@ -815,7 +759,6 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme
                                        int iCnt = 0;
                                        for (lookup.resetNext(); lookup.hasNext(); iCnt++) {
                                                IdNameValue value = lookup.getNext();
-                                               // System.out.println("HIDDEN " + value.getId() + " " + value.getName());
                                                sb.append((value != null) ? "obj.value=\"" + nvl(value.getId()) + "\";" : "");
                                                if (value.isReadOnly())
                                                        sb.append("obj.disabled=true;");
@@ -834,15 +777,12 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme
                                if (oldSQL != null && !oldSQL.equals("")) {
                                        ((IdNameSql) lookup).setSQL(oldSQL);
                                }
-                               // lookup.clearData();
                        } catch (Exception e) {
-                               // throw new RaptorRuntimeException(e);
                        }
                        // if(isVisible())
                        return sb.toString();
                } else if (fieldType.equals(FFT_LIST_BOX)) {
                        StringBuffer sb = new StringBuffer();
-                       // System.out.println("COMBO BOX " + fieldName);
                        String oldSQL = "";
                        if (!required)
                                sb.append("obj.options[obj.options.length] = new Option('-->select value<--','');");
@@ -850,18 +790,10 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme
                        IdNameList lookup = getLookupList();
                        try {
                                if (!hasPredefinedList) {
-                                       // if(dependsOn != null && dependsOn != "") {
-                                       // if(dependsOn != null && dependsOn != "" ) {
                                        IdNameSql lu = (IdNameSql) lookup;
                                        String SQL = "";
                                        SQL = lu.getSql();
-                                       /*
-                                        * if(nvl(fieldValue,"").length()<=0) SQL = lu.getSql(); else SQL =
-                                        * lu.getBaseSQLForPDFExcel(false);
-                                        */
-                                       // System.out.println("FORMFIELD 6666667 First" + ((IdNameSql)lookup).getSql());
                                        oldSQL = lu.getSql();
-                                       // SQL = Utils.replaceInString(SQL, "[VALUE]", fieldValue);
                                        if (formValues != null) {
                                                Set set = formValues.entrySet();
                                                String value = "";
@@ -903,12 +835,6 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme
                                for (lookup.resetNext(); lookup.hasNext();) {
                                        IdNameValue value = lookup.getNext();
                                        if (value != null && value.getId() != null && value.getName() != null) {
-                                               /*
-                                                * if (count == 0 && required) { selectedValue = value.getId(); count++; } else
-                                                * if (nvl(fieldValue).length()>0){ if (fieldValue != null &&
-                                                * fieldValue.equals(value.getId())){ selectedValue = value.getId(); } count++;
-                                                * } else { count++; }
-                                                */
                                                if (count == 0) {
                                                        if (required) {
                                                                selectedValue = value.getId();