From 28af72fc23a1e0cb67e1ac1b5fac6b6d9020270a Mon Sep 17 00:00:00 2001 From: mravula Date: Mon, 16 Dec 2019 15:37:23 -0500 Subject: Resolved null-pointer-exception while running raptor test cases Issue-ID: PORTAL-725 Change-Id: I31b57e200b98e616f32f73e1b6a14682555fca94 Signed-off-by: mravula --- .../analytics/model/base/ReportWrapper.java | 54 ++-- .../model/definition/wizard/DefinitionJSON.java | 40 +++ .../definition/wizard/FormFieldGroupsJSON.java | 78 ++++++ .../analytics/model/runtime/DashboardRunJSON.java | 103 ++++++++ .../analytics/model/runtime/ReportRuntime.java | 292 +++------------------ 5 files changed, 281 insertions(+), 286 deletions(-) create mode 100644 ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/FormFieldGroupsJSON.java create mode 100644 ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/DashboardRunJSON.java (limited to 'ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model') diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/base/ReportWrapper.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/base/ReportWrapper.java index b76be5c2..4778d2f2 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/base/ReportWrapper.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/base/ReportWrapper.java @@ -3930,9 +3930,9 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { StringBuffer colNames = new StringBuffer(); StringBuffer colExtraIdNames = new StringBuffer(); StringBuffer colExtraDateNames = new StringBuffer(); - if (getDBType() != null && getDBType().equals(AppConstants.ORACLE)) { - colNames.append("rownum rnum"); - } +// if (getDBType() != null && getDBType().equals(AppConstants.ORACLE)) { +// colNames.append("rownum rnum"); +// } if (getColumnNamesFromReportSQL) { DataSet ds = ConnectionUtils.getDataSet(reportSQL, dbInfo); @@ -5135,30 +5135,30 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { if (nvl(cr.getDataGridAlign()).length() > 0) ncr.setDataGridAlign(cr.getDataGridAlign()); - if (nvl(cr.getReportFooter()).length() > 0) +// if (nvl(cr.getReportFooter()).length() > 0) ncr.setReportFooter(cr.getReportFooter()); - if (nvl(cr.getNumFormCols()).length() > 0) +// if (nvl(cr.getNumFormCols()).length() > 0) ncr.setNumFormCols(cr.getNumFormCols()); - if (nvl(cr.getDisplayOptions()).length() > 0) +// if (nvl(cr.getDisplayOptions()).length() > 0) ncr.setDisplayOptions(cr.getDisplayOptions()); - if (nvl(cr.getDataContainerHeight()).length() > 0) +// if (nvl(cr.getDataContainerHeight()).length() > 0) ncr.setDataContainerHeight(cr.getDataContainerHeight()); - if (nvl(cr.getDataContainerWidth()).length() > 0) +// if (nvl(cr.getDataContainerWidth()).length() > 0) ncr.setDataContainerWidth(cr.getDataContainerWidth()); - if (nvl(cr.getAllowSchedule()).length() > 0) +// if (nvl(cr.getAllowSchedule()).length() > 0) ncr.setAllowSchedule(cr.getAllowSchedule()); - if (nvl(cr.getTopDown()).length() > 0) +// if (nvl(cr.getTopDown()).length() > 0) ncr.setTopDown(cr.getTopDown()); - if (nvl(cr.getSizedByContent()).length() > 0) +// if (nvl(cr.getSizedByContent()).length() > 0) ncr.setSizedByContent(cr.getSizedByContent()); - if (nvl(cr.getComment()).length() > 0) +// if (nvl(cr.getComment()).length() > 0) ncr.setComment(cr.getComment()); - if (nvl(cr.getDashboardOptions()).length() > 0) +// if (nvl(cr.getDashboardOptions()).length() > 0) ncr.setDashboardOptions(cr.getDashboardOptions()); - if (cr.isDashboardType() != null) +// if (cr.isDashboardType() != null) ncr.setDashboardType(cr.isDashboardType()); - if (cr.isReportInNewWindow() != null) +// if (cr.isReportInNewWindow() != null) ncr.setReportInNewWindow(cr.isReportInNewWindow()); ncr.setDisplayFolderTree(cr.isDisplayFolderTree()); if (cr.getDashBoardReports() == null) { @@ -5174,17 +5174,17 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { (cr.isDrillURLInPoPUpPresent() != null && cr.isDrillURLInPoPUpPresent().booleanValue()) ? true : false); - if (nvl(cr.getIsOneTimeScheduleAllowed()).length() > 0) +// if (nvl(cr.getIsOneTimeScheduleAllowed()).length() > 0) ncr.setIsOneTimeScheduleAllowed(cr.getIsOneTimeScheduleAllowed()); - if (nvl(cr.getIsHourlyScheduleAllowed()).length() > 0) +// if (nvl(cr.getIsHourlyScheduleAllowed()).length() > 0) ncr.setIsHourlyScheduleAllowed(cr.getIsHourlyScheduleAllowed()); - if (nvl(cr.getIsDailyScheduleAllowed()).length() > 0) +// if (nvl(cr.getIsDailyScheduleAllowed()).length() > 0) ncr.setIsDailyScheduleAllowed(cr.getIsDailyScheduleAllowed()); - if (nvl(cr.getIsDailyMFScheduleAllowed()).length() > 0) +// if (nvl(cr.getIsDailyMFScheduleAllowed()).length() > 0) ncr.setIsDailyMFScheduleAllowed(cr.getIsDailyMFScheduleAllowed()); - if (nvl(cr.getIsWeeklyScheduleAllowed()).length() > 0) +// if (nvl(cr.getIsWeeklyScheduleAllowed()).length() > 0) ncr.setIsWeeklyScheduleAllowed(cr.getIsWeeklyScheduleAllowed()); - if (nvl(cr.getIsMonthlyScheduleAllowed()).length() > 0) +// if (nvl(cr.getIsMonthlyScheduleAllowed()).length() > 0) ncr.setIsMonthlyScheduleAllowed(cr.getIsMonthlyScheduleAllowed()); ncr.setPageSize(cr.getPageSize()); @@ -5389,17 +5389,17 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { ncr.setChartDrillOptions(chartDrillOptions); } - if (nvl(cr.getIsOneTimeScheduleAllowed()).length() > 0) +// if (nvl(cr.getIsOneTimeScheduleAllowed()).length() > 0) ncr.setIsOneTimeScheduleAllowed(cr.getIsOneTimeScheduleAllowed()); - if (nvl(cr.getIsHourlyScheduleAllowed()).length() > 0) +// if (nvl(cr.getIsHourlyScheduleAllowed()).length() > 0) ncr.setIsHourlyScheduleAllowed(cr.getIsHourlyScheduleAllowed()); - if (nvl(cr.getIsDailyScheduleAllowed()).length() > 0) +// if (nvl(cr.getIsDailyScheduleAllowed()).length() > 0) ncr.setIsDailyScheduleAllowed(cr.getIsDailyScheduleAllowed()); - if (nvl(cr.getIsDailyMFScheduleAllowed()).length() > 0) +// if (nvl(cr.getIsDailyMFScheduleAllowed()).length() > 0) ncr.setIsDailyMFScheduleAllowed(cr.getIsDailyMFScheduleAllowed()); - if (nvl(cr.getIsWeeklyScheduleAllowed()).length() > 0) +// if (nvl(cr.getIsWeeklyScheduleAllowed()).length() > 0) ncr.setIsWeeklyScheduleAllowed(cr.getIsWeeklyScheduleAllowed()); - if (nvl(cr.getIsMonthlyScheduleAllowed()).length() > 0) +// if (nvl(cr.getIsMonthlyScheduleAllowed()).length() > 0) ncr.setIsMonthlyScheduleAllowed(cr.getIsMonthlyScheduleAllowed()); ncr.setPageSize(cr.getPageSize()); diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/DefinitionJSON.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/DefinitionJSON.java index 483505af..9e9428cf 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/DefinitionJSON.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/DefinitionJSON.java @@ -39,6 +39,8 @@ package org.onap.portalsdk.analytics.model.definition.wizard; import java.util.List; +import org.onap.portalsdk.analytics.xmlobj.DashboardReports; + public class DefinitionJSON implements WizardJSON { private String tabName; @@ -48,6 +50,7 @@ public class DefinitionJSON implements WizardJSON { private String reportName; private String reportDescr; private String reportType; + private List reportTypeList = null; private String dbInfo; private String formHelpText; private Integer pageSize; @@ -74,6 +77,10 @@ public class DefinitionJSON implements WizardJSON { private String allowScheduler; private String sizedByContent; private String repDefType; + private String dashboardLayoutHTML; + private String dashboardLayoutJSON; + private DashboardReports dashboardReports; + @Override public String getTabName() { return tabName; @@ -127,6 +134,14 @@ public class DefinitionJSON implements WizardJSON { public void setReportType(String reportType) { this.reportType = reportType; } + + public void setReportTypeList(List reportTypeList) { + this.reportTypeList = reportTypeList; + } + + public List getReportTypeList() { + return reportTypeList; + } public String getDbInfo() { return dbInfo; @@ -335,4 +350,29 @@ public class DefinitionJSON implements WizardJSON { public void setDbInfoList(List dbInfoList) { this.dbInfoList = dbInfoList; } + + public String getDashboardLayoutHTML() { + return dashboardLayoutHTML; + } + + public void setDashboardLayoutHTML(String dashboardLayoutHTML) { + this.dashboardLayoutHTML = dashboardLayoutHTML; + } + + public String getDashboardLayoutJSON() { + return dashboardLayoutJSON; + } + + public void setDashboardLayoutJSON(String dashboardLayoutJSON) { + this.dashboardLayoutJSON = dashboardLayoutJSON; + } + + public DashboardReports getDashboardReports() { + return dashboardReports; + } + + public void setDashboardReports(DashboardReports dashboardReports) { + this.dashboardReports = dashboardReports; + } + } diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/FormFieldGroupsJSON.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/FormFieldGroupsJSON.java new file mode 100644 index 00000000..fa4f8dda --- /dev/null +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/FormFieldGroupsJSON.java @@ -0,0 +1,78 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ +package org.onap.portalsdk.analytics.model.definition.wizard; + +public class FormFieldGroupsJSON { + + private String reportId; + private String formFieldGroupsJSON; + private String message; + private String errorMessage; + private String errorStackTrace; + + public String getReportId() { + return reportId; + } + public void setReportId(String reportId) { + this.reportId = reportId; + } + public String getFormFieldGroupsJSON() { + return formFieldGroupsJSON; + } + public void setFormFieldGroupsJSON(String formFieldGroupsJSON) { + this.formFieldGroupsJSON = formFieldGroupsJSON; + } + public String getMessage() { + return message; + } + public void setMessage(String message) { + this.message = message; + } + public String getErrorMessage() { + return errorMessage; + } + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + } + public String getErrorStackTrace() { + return errorStackTrace; + } + public void setErrorStackTrace(String errorStackTrace) { + this.errorStackTrace = errorStackTrace; + } +} diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/DashboardRunJSON.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/DashboardRunJSON.java new file mode 100644 index 00000000..a645f6d5 --- /dev/null +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/DashboardRunJSON.java @@ -0,0 +1,103 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ +package org.onap.portalsdk.analytics.model.runtime; + +import java.util.TreeMap; + +import org.onap.portalsdk.analytics.xmlobj.FormFieldList; + +public class DashboardRunJSON { + + private String reportId; + private FormFieldList formFieldList; + private String formFieldGroupsJSON; + private String dashboardLayoutJSON; + private TreeMap reportsFromDashBoardHTML; + private String message; + private String errorMessage; + private String errorStackTrace; + + public String getReportId() { + return reportId; + } + public void setReportId(String reportId) { + this.reportId = reportId; + } + public FormFieldList getFormFieldList() { + return formFieldList; + } + public void setFormFieldList(FormFieldList formFieldList) { + this.formFieldList = formFieldList; + } + public String getFormFieldGroupsJSON() { + return formFieldGroupsJSON; + } + public void setFormFieldGroupsJSON(String formFieldGroupsJSON) { + this.formFieldGroupsJSON = formFieldGroupsJSON; + } + public String getDashboardLayoutJSON() { + return dashboardLayoutJSON; + } + public void setDashboardLayoutJSON(String dashboardLayoutJSON) { + this.dashboardLayoutJSON = dashboardLayoutJSON; + } + public TreeMap getReportsFromDashBoardHTML() { + return reportsFromDashBoardHTML; + } + public void setReportsFromDashBoardHTML(TreeMap reportsFromDashBoardHTML) { + this.reportsFromDashBoardHTML = reportsFromDashBoardHTML; + } + public String getMessage() { + return message; + } + public void setMessage(String message) { + this.message = message; + } + public String getErrorMessage() { + return errorMessage; + } + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + } + public String getErrorStackTrace() { + return errorStackTrace; + } + public void setErrorStackTrace(String errorStackTrace) { + this.errorStackTrace = errorStackTrace; + } +} diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportRuntime.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportRuntime.java index 4b72502f..73387b20 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportRuntime.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportRuntime.java @@ -645,6 +645,9 @@ public class ReportRuntime extends ReportWrapper implements Cloneable, Serializa if(isGoBackAction && rd!=null) return rd; if (rd == null) { // Commented So that Data is refreshed from DB again if (getReportDataSize() < 0) + if (pageNo > 0) + pageNo = 0; + if (getReportType().equals(AppConstants.RT_CROSSTAB)) rd = loadCrossTabReportData(pageNo, userId, downloadLimit, request, download); else if (getReportType().equals(AppConstants.RT_LINEAR)) @@ -2088,66 +2091,6 @@ public class ReportRuntime extends ReportWrapper implements Cloneable, Serializa return this.cr.getDbInfo(); } -// private String fixSQL(StringBuffer sql) { -// int pos = 0; -// int pos_f_format = 0; -// int pos_t_format = 0; -// int pos_alias = 0; -// String format = ""; -// String alias = null; -// if(sql.indexOf("SELECT", 7)!= -1) { -// pos = sql.indexOf("SELECT", 7); -// if(sql.indexOf("TO_CHAR", pos)!= -1){ -// pos = sql.indexOf("TO_CHAR", pos); -// if(sql.indexOf("999",pos)!= -1) { -// pos = sql.indexOf("999",pos); -// pos_f_format = sql.lastIndexOf(", '", pos); -// if(pos_f_format == -1 || (pos - pos_f_format > 10)) { -// pos_f_format = sql.lastIndexOf(",'", pos); -// pos_f_format -= 1; -// } -// pos = pos_f_format; -// if(sql.indexOf("')", pos)!= -1) { -// pos_t_format = sql.indexOf("')", pos); -// //debugLogger.debug("pos_t - " + pos_t_format + " " + pos); -// if(pos_t_format == -1 || (pos_t_format - pos > 20)) { -// pos_t_format = sql.indexOf("' )", pos); -// pos_t_format += 3; -// } -// else if (pos_t_format != -1) -// pos_t_format += 2; -// format = sql.substring(pos_f_format+3, pos_t_format); -// //alias = sql.substring(pos_t_format+3, pos_t_format+6); -// pos_alias = sql.indexOf(" ", pos_t_format); -// alias = sql.substring(pos_alias+1, pos_alias+4); -// } -// } -// } -// -// if(sql.indexOf(alias)!=-1) { -// pos = sql.indexOf(alias); -// //debugLogger.debug(pos + " " + alias.length()+1 + "\n" + sql); -// sql.delete(pos,pos+4); -// sql.insert(pos, "TO_NUMBER("+alias+", '"+format+"')),'"+ format + "')"); -// pos = sql.lastIndexOf("SUM", pos); -// if(pos==-1) -// pos = sql.lastIndexOf("AVG", pos); -// else if (pos==-1) -// pos = sql.lastIndexOf("COUNT", pos); -// else if (pos == -1) -// pos = sql.lastIndexOf("STDDEV", pos); -// else if (pos == -1) -// pos = sql.lastIndexOf("VARIANCE", pos); -// sql.insert(pos, "TO_CHAR ("); -// } -// -// } -// -// //debugLogger.debug("Alias|" + alias + "| Format " + format); -// //debugLogger.debug(sql.toString()); -// return sql.toString(); -// } // FixSQL - public String parseReportSQL(String sql) throws RaptorException { StringBuffer parsedSQL = new StringBuffer(); @@ -3009,210 +2952,41 @@ public List getMapMarkers(ReportData rd, org.onap.portalsdk.analytics.xmlobj.Rep } - private String parseAndFillOtherFormfieldValues(HttpServletRequest request, String SQL, String userId, ArrayList formFieldJSONList) { + private String parseAndFillOtherFormfieldValues(HttpServletRequest request, String SQL, String userId, + ArrayList formFieldJSONList) { ArrayList formFieldValues = new ArrayList(); - String selectedValue = ""; - String displayName = ""; - for (Iterator iter1 = formFieldJSONList.iterator(); iter1.hasNext();) { - FormFieldJSON ffJSON = (FormFieldJSON) iter1.next(); - displayName = ffJSON.getFieldDisplayName(); - ArrayList formfieldvalues = ffJSON.getFormFieldValues(); - for (int i = 0; i< formfieldvalues.size(); i++) { - IdNameValue formfieldItem = formfieldvalues.get(i); - if(formfieldItem.isDefaultValue()) { - selectedValue = formfieldItem.getId(); - } + String selectedValue = ""; + String displayName = ""; + for (Iterator iter1 = formFieldJSONList.iterator(); iter1.hasNext();) { + FormFieldJSON ffJSON = (FormFieldJSON) iter1.next(); + String fieldId = ffJSON.getFieldId(); + displayName = ffJSON.getFieldDisplayName(); + if (request.getParameter(fieldId) != null && request.getParameter(fieldId).length() > 0) { + if (ffJSON.getFieldType().equals(FormField.FFT_LIST_MULTI) + || ffJSON.getFieldType().equals(FormField.FFT_CHECK_BOX)) { + try { + selectedValue = formatListValue(displayName, Utils.oracleSafe(request.getParameter(fieldId)), + null, false, true, null, null); + } catch (RaptorException e) { + e.printStackTrace(); } - SQL = Utils.replaceInString(SQL, "["+displayName+"]", selectedValue); + } else { + selectedValue = "'" + request.getParameter(fieldId) + "'"; } - return SQL; - + } else { + ArrayList formfieldvalues = ffJSON.getFormFieldValues(); + for (int i = 0; i < formfieldvalues.size(); i++) { + IdNameValue formfieldItem = formfieldvalues.get(i); + if (formfieldItem.isDefaultValue()) { + selectedValue = formfieldItem.getId(); + } + } + } + SQL = Utils.replaceInString(SQL, "[" + displayName + "]", selectedValue); + } + return SQL; } -// private void refreshFormFieldsWithLatestValue(HttpServletRequest request, String userId, FormField ff_src, ArrayList formFieldJSONList) { -// ArrayList formFieldValues = new ArrayList(); -// List requestValueList = null; -// IdNameList lookup = null; -// lookup = ff_src.getLookupList(); -// IdNameSql lu = (IdNameSql) lookup; -// String SQL = "" ; -// String oldSQL = ""; -// String oldDefaultSQL = ""; -// String defaultSQL = ""; -// IdNameList lookupList = null; -// if(lu != null) { -// SQL = lu.getSql(); -// oldSQL = lu.getSql(); -// oldDefaultSQL = lu.getDefaultSQL(); -// defaultSQL = lu.getDefaultSQL(); -// } -// boolean readOnly = false; -// for (Iterator iter1 = formFieldJSONList.iterator(); iter1.hasNext();) { -// FormFieldJSON ffJSON = (FormFieldJSON) iter1.next(); -// if((ffJSON.getFieldId().equals(ff_src.getFieldName())) && ffJSON.isVisible()) { -// for (Iterator iter = reportFormFields.iterator(); iter.hasNext();) { -// formFieldValues = new ArrayList(); -// FormField ff = (FormField) iter.next(); -// if(!ff.getFieldName().equals(ff_src.getFieldName())) { -// //IdNameList lookup = null; -// //lookup = ff.getLookupList(); -// String selectedValue = ""; -// -// -// -// String [] requestParam = request.getParameterValues(ff.getFieldName()); -// if(requestParam != null) { -// requestValueList = Arrays.asList(request.getParameterValues(ff.getFieldName())); -// -// } else { -// requestValueList = new ArrayList(); -// } -// -// -// if(nvl(ff_src.getBaseSQL()).length()>0 && ff_src.getBaseSQL().indexOf("["+ff.getFieldDisplayName() +"]")!= -1) { -// if(lookup!=null) { -// try { -// if(!ff_src.hasPredefinedList) { -// String formatSelected = null; -// if(ff_src.getFieldType().equals(FormField.FFT_LIST_MULTI) || ff_src.getFieldType().equals(FormField.FFT_CHECK_BOX)) { -// formatSelected = formatSelectedItems(requestValueList, ff_src.getFieldType()); -// } else -// formatSelected = requestValueList.size()>0?requestValueList.get(0):""; -// SQL = Utils.replaceInString(SQL, "["+ff_src.getFieldDisplayName()+"]", formatSelected); -// defaultSQL = Utils.replaceInString(defaultSQL, "["+ff_src.getFieldDisplayName()+"]", formatSelected); -// defaultSQL = parseAndFillWithCurrentValues(request, defaultSQL, ff_src); -// defaultSQL = parseAndFillReq_Session_UserValues(request, defaultSQL, userId); -// SQL = parseAndFillReq_Session_UserValues(request, SQL, userId); -// SQL = parseAndFillWithCurrentValues(request, SQL, ff_src); -// -// } -// } catch (Exception ex) { -// ex.printStackTrace(); -// } -// -// } -// -// } -// } -// } -// -// if(nvl(ff_src.getBaseSQL()).length()>0) { -// lookup = new IdNameSql(-1,SQL,defaultSQL); -// lookupList = lookup; -// try { -// lookup.loadUserData(0, "", ff_src.getDbInfo(), ff_src.getUserId()); -// } catch (Exception e ){ -// e.printStackTrace(); //throw new RaptorRuntimeException(e); -// } -// if(!ff_src.hasPredefinedList) { -// lookup.trimToSize(); -// for (lookup.resetNext(); lookup.hasNext();) { -// IdNameValue value = lookup.getNext(); -// readOnly = value.isReadOnly(); -// formFieldValues.add(value); -// } -// } -// ffJSON.setFormFieldValues(formFieldValues); -// } -// if(!ff_src.hasPredefinedList) { -// if(oldSQL != null && !oldSQL.equals("")) { -// ((IdNameSql)lookup).setSQL(oldSQL); -// } -// if(oldDefaultSQL != null && !oldDefaultSQL.equals("")) { -// ((IdNameSql)lookup).setDefaultSQL(oldDefaultSQL); -// } -// } -// -// } -// } -// -// } - - -// private void triggerOtherFormFieldsWithThisValue(HttpServletRequest request, String userId, FormField ff_src, ArrayList requestValueList, ArrayList formFieldJSONList) { -// ArrayList formFieldValues = new ArrayList(); -// //ArrayList formFieldJSONList = new ArrayList(); -// for (Iterator iter = reportFormFields.iterator(); iter.hasNext();) { -// formFieldValues = new ArrayList(); -// FormField ff = (FormField) iter.next(); -// if(!ff_src.getFieldName().equals(ff.getFieldName())) { -// for (Iterator iter1 = formFieldJSONList.iterator(); iter1.hasNext();) { -// FormFieldJSON ffJSON = (FormFieldJSON) iter1.next(); -// if(ffJSON.getFieldId().equals(ff.getFieldName()) && ffJSON.isVisible()) { -// if(nvl(ff.getBaseSQL()).length()>0 && ff.getBaseSQL().indexOf("["+ff_src.getFieldDisplayName() +"]")!= -1) { -// IdNameList lookup = null; -// lookup = ff.getLookupList(); -// String selectedValue = ""; -// String oldSQL = ""; -// String oldDefaultSQL = ""; -// IdNameList lookupList = null; -// boolean readOnly = false; -// if(lookup!=null) { -// try { -// if(!ff.hasPredefinedList) { -// IdNameSql lu = (IdNameSql) lookup; -// String SQL = lu.getSql(); -// oldSQL = lu.getSql(); -// oldDefaultSQL = lu.getDefaultSQL(); -// String defaultSQL = lu.getDefaultSQL(); -// String formatSelected = null; -// if(ff_src.getFieldType().equals(FormField.FFT_LIST_MULTI) || ff_src.getFieldType().equals(FormField.FFT_CHECK_BOX)) { -// formatSelected = formatSelectedItems(requestValueList, ff.getFieldType()); -// } -// else -// formatSelected = requestValueList.size()>0?requestValueList.get(0):""; -// SQL = Utils.replaceInString(SQL, "["+ff_src.getFieldDisplayName()+"]", formatSelected); -// defaultSQL = Utils.replaceInString(defaultSQL, "["+ff_src.getFieldDisplayName()+"]", formatSelected); -// defaultSQL = parseAndFillWithCurrentValues(request, defaultSQL, ff_src); -// defaultSQL = parseAndFillReq_Session_UserValues(request, defaultSQL, userId); -// SQL = parseAndFillReq_Session_UserValues(request, SQL, userId); -// SQL = parseAndFillWithCurrentValues(request, SQL, ff_src); -// lookup = new IdNameSql(-1,SQL,defaultSQL); -// lookupList = lookup; -// try { -// lookup.loadUserData(0, "", ff.getDbInfo(), ff.getUserId()); -// } catch (Exception e ){ -// e.printStackTrace(); //throw new RaptorRuntimeException(e); -// } -// } -// lookup.trimToSize(); -// -// -// -// for (lookup.resetNext(); lookup.hasNext();) { -// IdNameValue value = lookup.getNext(); -// readOnly = value.isReadOnly(); -//// if(nvl(requestValue).length()>0) { -//// if(value.getId().equals(requestValue)) -//// value.setDefaultValue(true); -//// } -// formFieldValues.add(value); -// //break; -// } -// -// ffJSON.setFormFieldValues(formFieldValues); -// -// if(!ff.hasPredefinedList) { -// if(oldSQL != null && !oldSQL.equals("")) { -// ((IdNameSql)lookup).setSQL(oldSQL); -// } -// if(oldDefaultSQL != null && !oldDefaultSQL.equals("")) { -// ((IdNameSql)lookup).setDefaultSQL(oldDefaultSQL); -// } -// } -// } catch (Exception ex) { -// ex.printStackTrace(); -// } -// } -// -// } //ff baseSQL -// } -// } -// } -// } -// -// } - public String formatSelectedItems(List selectedItems, String type) { StringBuffer value = new StringBuffer(""); int count = 0; -- cgit 1.2.3-korg