summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-analytics/src/main/java
diff options
context:
space:
mode:
authormravula <mr257h@att.com>2019-12-16 15:37:23 -0500
committermravula <mr257h@att.com>2020-01-14 10:02:31 -0500
commit28af72fc23a1e0cb67e1ac1b5fac6b6d9020270a (patch)
tree490dc3652bccb7e8752ed8a761fcc6950acb91fe /ecomp-sdk/epsdk-analytics/src/main/java
parentb51640fc222a61869c26c9fc9a5fe5034f6f39b4 (diff)
Resolved null-pointer-exception while running raptor test cases
Issue-ID: PORTAL-725 Change-Id: I31b57e200b98e616f32f73e1b6a14682555fca94 Signed-off-by: mravula <mr257h@att.com>
Diffstat (limited to 'ecomp-sdk/epsdk-analytics/src/main/java')
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/base/ReportWrapper.java54
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/DefinitionJSON.java40
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/FormFieldGroupsJSON.java78
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/DashboardRunJSON.java103
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportRuntime.java292
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/web/RaptorControllerAsync.java540
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/web/RaptorDashboardController.java119
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/xmlobj/CustomReportType.java24
8 files changed, 734 insertions, 516 deletions
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<IdNameBooleanJSON> 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<IdNameBooleanJSON> reportTypeList) {
+ this.reportTypeList = reportTypeList;
+ }
+
+ public List<IdNameBooleanJSON> getReportTypeList() {
+ return reportTypeList;
+ }
public String getDbInfo() {
return dbInfo;
@@ -335,4 +350,29 @@ public class DefinitionJSON implements WizardJSON {
public void setDbInfoList(List<IdNameBooleanJSON> 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<FormFieldJSON> formFieldJSONList) {
+ private String parseAndFillOtherFormfieldValues(HttpServletRequest request, String SQL, String userId,
+ ArrayList<FormFieldJSON> formFieldJSONList) {
ArrayList<IdNameValue> formFieldValues = new ArrayList<IdNameValue>();
- String selectedValue = "";
- String displayName = "";
- for (Iterator iter1 = formFieldJSONList.iterator(); iter1.hasNext();) {
- FormFieldJSON ffJSON = (FormFieldJSON) iter1.next();
- displayName = ffJSON.getFieldDisplayName();
- ArrayList<IdNameValue> 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<IdNameValue> 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<FormFieldJSON> formFieldJSONList) {
-// ArrayList<IdNameValue> formFieldValues = new ArrayList<IdNameValue>();
-// List<String> 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<IdNameValue>();
-// 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<String>();
-// }
-//
-//
-// 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<String> requestValueList, ArrayList<FormFieldJSON> formFieldJSONList) {
-// ArrayList<IdNameValue> formFieldValues = new ArrayList<IdNameValue>();
-// //ArrayList<FormFieldJSON> formFieldJSONList = new ArrayList<FormFieldJSON>();
-// for (Iterator iter = reportFormFields.iterator(); iter.hasNext();) {
-// formFieldValues = new ArrayList<IdNameValue>();
-// 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;
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/web/RaptorControllerAsync.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/web/RaptorControllerAsync.java
index 84649e06..517d2672 100644
--- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/web/RaptorControllerAsync.java
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/web/RaptorControllerAsync.java
@@ -78,6 +78,7 @@ import org.onap.portalsdk.analytics.model.definition.wizard.ColumnEditJSON;
import org.onap.portalsdk.analytics.model.definition.wizard.ColumnJSON;
import org.onap.portalsdk.analytics.model.definition.wizard.DefinitionJSON;
import org.onap.portalsdk.analytics.model.definition.wizard.FormEditJSON;
+import org.onap.portalsdk.analytics.model.definition.wizard.FormFieldGroupsJSON;
import org.onap.portalsdk.analytics.model.definition.wizard.IdNameBooleanJSON;
import org.onap.portalsdk.analytics.model.definition.wizard.ImportJSON;
import org.onap.portalsdk.analytics.model.definition.wizard.MessageJSON;
@@ -494,6 +495,72 @@ public class RaptorControllerAsync extends RestrictedBaseController {
}
+ @RequestMapping(value = "report/wizard/get_formfield_groups_data/{id}", method = RequestMethod.GET)
+ public @ResponseBody FormFieldGroupsJSON getFFGroupsData(@PathVariable Map<String, String> pathVariables,
+ HttpServletRequest request, HttpServletResponse response) throws IOException, RaptorException {
+
+ FormFieldGroupsJSON formFieldGroupsJSON = new FormFieldGroupsJSON();
+ if (pathVariables.containsKey("id")) {
+ formFieldGroupsJSON.setReportId(pathVariables.get("id"));
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
+ ReportRuntime rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME);
+
+ if (rdef != null && !rdef.getReportID().equals(formFieldGroupsJSON.getReportId())) {
+ removeVariablesFromSession(request);
+ rdef = (new ReportHandler()).loadReportDefinition(request, formFieldGroupsJSON.getReportId());
+ } else if (rr != null && !rr.getReportID().equals(formFieldGroupsJSON.getReportId())) {
+ removeVariablesFromSession(request);
+ rdef = (new ReportHandler()).loadReportDefinition(request, formFieldGroupsJSON.getReportId());
+ } else if (rdef == null) {
+ rdef = (new ReportHandler()).loadReportDefinition(request, formFieldGroupsJSON.getReportId());
+ }
+ if(rdef != null) {
+ formFieldGroupsJSON.setFormFieldGroupsJSON(rdef.getCustomReport().getFormFieldGroupsJSON());
+ formFieldGroupsJSON.setMessage("Success");
+ } else {
+ formFieldGroupsJSON.setErrorMessage("Unable to load report definition for Report ID:"+formFieldGroupsJSON.getReportId());
+ }
+ } else {
+ formFieldGroupsJSON.setErrorMessage("Report ID missing in the URL");
+ }
+ return formFieldGroupsJSON;
+ }
+
+ @RequestMapping(value = "report/wizard/save_formfield_groups_data", method = RequestMethod.POST)
+ public @ResponseBody MessageJSON saveFFGroupsData(@RequestBody FormFieldGroupsJSON formFieldGroupsJSON,
+ HttpServletRequest request, HttpServletResponse response) throws IOException, RaptorException {
+
+ MessageJSON messageJSON = new MessageJSON();
+ if(formFieldGroupsJSON != null && formFieldGroupsJSON.getReportId() != null) {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
+ ReportRuntime rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME);
+ if (rdef != null && !rdef.getReportID().equals(formFieldGroupsJSON.getReportId())) {
+ removeVariablesFromSession(request);
+ rdef = (new ReportHandler()).loadReportDefinition(request, formFieldGroupsJSON.getReportId());
+ } else if (rr != null && !rr.getReportID().equals(formFieldGroupsJSON.getReportId())) {
+ removeVariablesFromSession(request);
+ rdef = (new ReportHandler()).loadReportDefinition(request, formFieldGroupsJSON.getReportId());
+ } else if (rdef == null) {
+ rdef = (new ReportHandler()).loadReportDefinition(request, formFieldGroupsJSON.getReportId());
+ }
+ if (rdef != null) {
+ rdef.getCustomReport().setFormFieldGroupsJSON(formFieldGroupsJSON.getFormFieldGroupsJSON());
+ try {
+ persistReportDefinition(request, rdef);
+ messageJSON.setMessage("Success: formfield groups have been updated for report ID:"+rdef.getReportID() +" and added to session and DB.");
+ } catch (Exception ex) {
+ messageJSON.setMessage("Error occured while saving formfield groups data");
+ messageJSON.setAnyStacktrace(getStackTrace(ex));
+ }
+ } else {
+ messageJSON.setMessage("Unable to load report definition for Report ID:"+formFieldGroupsJSON.getReportId());
+ }
+ } else {
+ messageJSON.setMessage("Report ID missing in the request body.");
+ }
+ return messageJSON;
+ }
+
@RequestMapping(value = "report/wizard/save_formfield_tab_data", method = RequestMethod.POST)
public @ResponseBody MessageJSON saveFFTabWiseData(@RequestBody FormEditJSON formEditJSON,
HttpServletRequest request, HttpServletResponse response) {
@@ -707,115 +774,122 @@ public class RaptorControllerAsync extends RestrictedBaseController {
// }
if (rdef != null) {
- String dbInfo = definitionJSON.getDbInfo();
- rdef.setDBInfo(dbInfo);
- //save dbType
- String schemaSql = Globals.getRemoteDbSchemaSqlWithWhereClause();
- schemaSql = schemaSql.replace("[schema_id]", dbInfo);
- String dbType = null;
- DataSet ds = null;
- try {
- ds = DbUtils.executeQuery(schemaSql);
-
- String prefix = "", desc = "";
-
- for (int i = 0; i < ds.getRowCount(); i++) {
- dbType = ds.getItem(i, 2);
- }
- }
- catch (Exception e) {}
- rdef.setDBType(dbType);
String reportName = definitionJSON.getReportName();
+ String errorString = "";
+ if (AppUtils.nvl(reportName).length() <= 0)
+ errorString = "ReportName cannot be null;";
rdef.setReportName(reportName);
+ rdef.setReportDescr(definitionJSON.getReportDescr());
+ rdef.setReportType(definitionJSON.getReportType());
+ rdef.setDataContainerHeight(definitionJSON.getDataContainerHeight());
+ rdef.setDataContainerWidth(definitionJSON.getDataContainerWidth());
+ if(definitionJSON.getAllowScheduler()!=null)
+ rdef.setAllowSchedule(definitionJSON.getAllowScheduler().equals("Y")?"Y":"N");
- String reportDescr = definitionJSON.getReportDescr();
- rdef.setReportDescr(reportDescr);
-
- String formHelpText = definitionJSON.getFormHelpText();
- rdef.setFormHelpText(formHelpText);
-
- Integer pageSize = definitionJSON.getPageSize();
- if(pageSize!=null)
- rdef.setPageSize(pageSize);
-
- List<IdNameBooleanJSON> menuIds = definitionJSON.getDisplayArea();
- if(menuIds!=null){
- for (IdNameBooleanJSON menuId : menuIds) {
- if (menuId.isSelected()) {
- rdef.setMenuID(menuId.getName());
+
+ if(rdef.getReportType().equals(AppConstants.RT_DASHBOARD)){
+ rdef.setDashboardLayoutHTML(definitionJSON.getDashboardLayoutHTML());
+ rdef.getCustomReport().setDashboardLayoutJSON(definitionJSON.getDashboardLayoutJSON());
+ rdef.getCustomReport().setDashBoardReports(definitionJSON.getDashboardReports());
+ } else {
+ String dbInfo = definitionJSON.getDbInfo();
+ rdef.setDBInfo(dbInfo);
+ //save dbType
+ String schemaSql = Globals.getRemoteDbSchemaSqlWithWhereClause();
+ schemaSql = schemaSql.replace("[schema_id]", dbInfo);
+ String dbType = null;
+ DataSet ds = null;
+ try {
+ ds = DbUtils.executeQuery(schemaSql);
+
+ String prefix = "", desc = "";
+
+ for (int i = 0; i < ds.getRowCount(); i++) {
+ dbType = ds.getItem(i, 2);
}
+ }
+ catch (Exception e) {}
+ rdef.setDBType(dbType);
+ String formHelpText = definitionJSON.getFormHelpText();
+ rdef.setFormHelpText(formHelpText);
+
+ Integer pageSize = definitionJSON.getPageSize();
+ if(pageSize!=null)
+ rdef.setPageSize(pageSize);
+
+ List<IdNameBooleanJSON> menuIds = definitionJSON.getDisplayArea();
+ if(menuIds!=null){
+ for (IdNameBooleanJSON menuId : menuIds) {
+ if (menuId.isSelected()) {
+ rdef.setMenuID(menuId.getName());
+ }
+
+ }
}
- }
-
-
- Boolean hideFormFieldsAfterRun = definitionJSON.getHideFormFieldsAfterRun();
- rdef.setHideFormFieldAfterRun(hideFormFieldsAfterRun==null?false:hideFormFieldsAfterRun);
- Integer maxRowsInExcelCSVDownload = definitionJSON.getMaxRowsInExcelCSVDownload();
- if(maxRowsInExcelCSVDownload!=null)
- rdef.setMaxRowsInExcelDownload(maxRowsInExcelCSVDownload);
- Integer frozenColumns = definitionJSON.getFrozenColumns();
- if(frozenColumns!=null)
- rdef.setFrozenColumns(frozenColumns);
- String dataGridAlign = definitionJSON.getDataGridAlign();
- rdef.setDataGridAlign(dataGridAlign);
- String emptyMessage = definitionJSON.getEmptyMessage();
- rdef.setEmptyMessage(emptyMessage);
- String dataContainerHeight = definitionJSON.getDataContainerHeight();
- rdef.setDataContainerHeight(dataContainerHeight);
- String dataContainerWidth = definitionJSON.getDataContainerWidth();
- rdef.setDataContainerWidth(dataContainerWidth);
- Boolean runtimeColSortDisabled = definitionJSON.getRuntimeColSortDisabled();
- rdef.setRuntimeColSortDisabled(runtimeColSortDisabled==null?false:runtimeColSortDisabled);
- Integer numFormCols = definitionJSON.getNumFormCols();
- if(numFormCols!=null)
- rdef.setNumFormCols(Integer.toString(numFormCols));
- String reportTitle = definitionJSON.getReportTitle();
- rdef.setReportTitle(reportTitle);
- String reportSubTitle = definitionJSON.getReportSubTitle();
- rdef.setReportSubTitle(reportSubTitle);
-
- List<NameBooleanJSON> displayOptions = definitionJSON.getDisplayOptions();
- StringBuffer displayOptionStr = new StringBuffer("NNNNNNN");
- if(displayOptions!=null){
- for (NameBooleanJSON displayOption : displayOptions) {
- if (displayOption.isSelected()) {
- if (displayOption.getName().equals("HideFormFields")) {
- displayOptionStr.setCharAt(0, 'Y');
- } else if (displayOption.getName().equals("HideChart")) {
- displayOptionStr.setCharAt(1, 'Y');
- } else if (displayOption.getName().equals("HideReportData")) {
- displayOptionStr.setCharAt(2, 'Y');
- } else if (displayOption.getName().equals("HideExcel")) {
- displayOptionStr.setCharAt(5, 'Y');
- } else if (displayOption.getName().equals("HidePdf")) {
- displayOptionStr.setCharAt(6, 'Y');
+
+
+ Boolean hideFormFieldsAfterRun = definitionJSON.getHideFormFieldsAfterRun();
+ rdef.setHideFormFieldAfterRun(hideFormFieldsAfterRun==null?false:hideFormFieldsAfterRun);
+ Integer maxRowsInExcelCSVDownload = definitionJSON.getMaxRowsInExcelCSVDownload();
+ if(maxRowsInExcelCSVDownload!=null)
+ rdef.setMaxRowsInExcelDownload(maxRowsInExcelCSVDownload);
+ Integer frozenColumns = definitionJSON.getFrozenColumns();
+ if(frozenColumns!=null)
+ rdef.setFrozenColumns(frozenColumns);
+ String dataGridAlign = definitionJSON.getDataGridAlign();
+ rdef.setDataGridAlign(dataGridAlign);
+ String emptyMessage = definitionJSON.getEmptyMessage();
+ rdef.setEmptyMessage(emptyMessage);
+ Boolean runtimeColSortDisabled = definitionJSON.getRuntimeColSortDisabled();
+ rdef.setRuntimeColSortDisabled(runtimeColSortDisabled==null?false:runtimeColSortDisabled);
+ Integer numFormCols = definitionJSON.getNumFormCols();
+ if(numFormCols!=null)
+ rdef.setNumFormCols(Integer.toString(numFormCols));
+ String reportTitle = definitionJSON.getReportTitle();
+ rdef.setReportTitle(reportTitle);
+ String reportSubTitle = definitionJSON.getReportSubTitle();
+ rdef.setReportSubTitle(reportSubTitle);
+
+ List<NameBooleanJSON> displayOptions = definitionJSON.getDisplayOptions();
+ StringBuffer displayOptionStr = new StringBuffer("NNNNNNN");
+ if(displayOptions!=null){
+ for (NameBooleanJSON displayOption : displayOptions) {
+ if (displayOption.isSelected()) {
+ if (displayOption.getName().equals("HideFormFields")) {
+ displayOptionStr.setCharAt(0, 'Y');
+ } else if (displayOption.getName().equals("HideChart")) {
+ displayOptionStr.setCharAt(1, 'Y');
+ } else if (displayOption.getName().equals("HideReportData")) {
+ displayOptionStr.setCharAt(2, 'Y');
+ } else if (displayOption.getName().equals("HideExcel")) {
+ displayOptionStr.setCharAt(5, 'Y');
+ } else if (displayOption.getName().equals("HidePdf")) {
+ displayOptionStr.setCharAt(6, 'Y');
+ }
}
+
}
-
}
+
+ if(displayOptionStr!=null)
+ rdef.setDisplayOptions(displayOptionStr.toString());
+
+ if(definitionJSON.getSizedByContent()!=null)
+ rdef.setSizedByContent(definitionJSON.getSizedByContent().equals("Y")?"Y":"N");
+ if(definitionJSON.getOneTimeRec()!=null)
+ rdef.setIsOneTimeScheduleAllowed(definitionJSON.getOneTimeRec().equals("true")?"Y":"N");
+ if(definitionJSON.getHourlyRec()!=null)
+ rdef.setIsHourlyScheduleAllowed(definitionJSON.getHourlyRec().equals("true")?"Y":"N");
+ if(definitionJSON.getDailyRec()!=null)
+ rdef.setIsDailyScheduleAllowed(definitionJSON.getDailyRec().equals("true")?"Y":"N");
+ if(definitionJSON.getDailyMFRec()!=null)
+ rdef.setIsDailyMFScheduleAllowed(definitionJSON.getDailyMFRec().equals("true")?"Y":"N");
+ if(definitionJSON.getWeeklyRec()!=null)
+ rdef.setIsWeeklyScheduleAllowed(definitionJSON.getWeeklyRec().equals("true")?"Y":"N");
+ if(definitionJSON.getMonthlyRec()!=null)
+ rdef.setIsMonthlyScheduleAllowed(definitionJSON.getMonthlyRec().equals("true")?"Y":"N");
}
-
- if(displayOptionStr!=null)
- rdef.setDisplayOptions(displayOptionStr.toString());
-
- if(definitionJSON.getAllowScheduler()!=null)
- rdef.setAllowSchedule(definitionJSON.getAllowScheduler().equals("true")?"Y":"N");
- if(definitionJSON.getSizedByContent()!=null)
- rdef.setSizedByContent(definitionJSON.getSizedByContent().equals("true")?"Y":"N");
- if(definitionJSON.getOneTimeRec()!=null)
- rdef.setIsOneTimeScheduleAllowed(definitionJSON.getOneTimeRec().equals("true")?"Y":"N");
- if(definitionJSON.getHourlyRec()!=null)
- rdef.setIsHourlyScheduleAllowed(definitionJSON.getHourlyRec().equals("true")?"Y":"N");
- if(definitionJSON.getDailyRec()!=null)
- rdef.setIsDailyScheduleAllowed(definitionJSON.getDailyRec().equals("true")?"Y":"N");
- if(definitionJSON.getDailyMFRec()!=null)
- rdef.setIsDailyMFScheduleAllowed(definitionJSON.getDailyMFRec().equals("true")?"Y":"N");
- if(definitionJSON.getWeeklyRec()!=null)
- rdef.setIsWeeklyScheduleAllowed(definitionJSON.getWeeklyRec().equals("true")?"Y":"N");
- if(definitionJSON.getMonthlyRec()!=null)
- rdef.setIsMonthlyScheduleAllowed(definitionJSON.getMonthlyRec().equals("true")?"Y":"N");
-
}
if (id.equals("Create")) {
rdef.persistReport(request);
@@ -1405,93 +1479,100 @@ public class RaptorControllerAsync extends RestrictedBaseController {
wizardJSON.setReportName((rdef != null) ? rdef.getReportName() : "");
wizardJSON.setReportDescr((rdef != null) ? rdef.getReportDescr() : "");
wizardJSON.setReportType((rdef != null) ? rdef.getReportType() : AppConstants.RT_LINEAR);
- wizardJSON.setDbInfo((rdef != null) ? rdef.getDBInfo() : "");
- wizardJSON.setFormHelpText((rdef != null) ? rdef.getFormHelpText() : "");
- wizardJSON.setPageSize((rdef != null) ? rdef.getPageSize() : 50);
- List<IdNameBooleanJSON> displayArea = new ArrayList<IdNameBooleanJSON>();
- IdNameBooleanJSON idNameJSON = new IdNameBooleanJSON();
- String qMenu = "";
- for (int i = 0; i < AppUtils.getQuickLinksMenuIDs().size(); i++) {
- idNameJSON = new IdNameBooleanJSON();
- qMenu = (String) AppUtils.getQuickLinksMenuIDs().get(i);
- idNameJSON.setId(qMenu);
- idNameJSON.setName(qMenu);
- if (rdef != null && (rdef.getMenuID().equals(qMenu))) {
- idNameJSON.setSelected(true);
- }
- displayArea.add(idNameJSON);
- }
- wizardJSON.setDisplayArea(displayArea);
- wizardJSON.setHideFormFieldsAfterRun((rdef != null) ? rdef.isHideFormFieldAfterRun() : false);
- wizardJSON.setMaxRowsInExcelCSVDownload((rdef != null) ? rdef.getMaxRowsInExcelDownload() : 500);
- wizardJSON.setFrozenColumns((rdef != null) ? rdef.getFrozenColumns() : 0);
- wizardJSON.setDataGridAlign((rdef != null) ? rdef.getDataGridAlign() : "left");
- wizardJSON.setEmptyMessage((rdef != null) ? rdef.getEmptyMessage() : "No records found");
wizardJSON.setDataContainerHeight((rdef != null) ? rdef.getDataContainerHeight() : "600");
wizardJSON.setDataContainerWidth((rdef != null) ? rdef.getDataContainerWidth() : "900");
- List<NameBooleanJSON> displayOptions = new ArrayList<NameBooleanJSON>();
- NameBooleanJSON nameBooleanJSON = new NameBooleanJSON();
- nameBooleanJSON.setName("HideFormFields");
- nameBooleanJSON.setSelected((rdef != null) ? rdef.isDisplayOptionHideForm() : false);
- displayOptions.add(nameBooleanJSON);
-
- nameBooleanJSON = new NameBooleanJSON();
- nameBooleanJSON.setName("HideChart");
- nameBooleanJSON.setSelected((rdef != null) ? rdef.isDisplayOptionHideChart() : false);
- displayOptions.add(nameBooleanJSON);
-
- nameBooleanJSON = new NameBooleanJSON();
- nameBooleanJSON.setName("HideReportData");
- nameBooleanJSON.setSelected((rdef != null) ? rdef.isDisplayOptionHideData() : false);
- displayOptions.add(nameBooleanJSON);
-
- nameBooleanJSON = new NameBooleanJSON();
- nameBooleanJSON.setName("HideExcel");
- nameBooleanJSON.setSelected((rdef != null) ? rdef.isDisplayOptionHideExcelIcons() : false);
- displayOptions.add(nameBooleanJSON);
-
- nameBooleanJSON = new NameBooleanJSON();
- nameBooleanJSON.setName("HidePdf");
- nameBooleanJSON.setSelected((rdef != null) ? rdef.isDisplayOptionHidePDFIcons() : false);
- displayOptions.add(nameBooleanJSON);
-
- wizardJSON.setDisplayOptions(displayOptions);
-
- wizardJSON.setRuntimeColSortDisabled((rdef != null) ? rdef.isRuntimeColSortDisabled() : false);
- wizardJSON.setNumFormCols((rdef != null) ? rdef.getNumFormColsAsInt() : 1);
- wizardJSON.setReportTitle((rdef != null) ? rdef.getReportTitle() : "");
- wizardJSON.setReportSubTitle((rdef != null) ? rdef.getReportSubTitle() : "");
-
-
- String schemaSql = Globals.getRemoteDbSchemaSql();
- DataSet ds = null;
- ArrayList<IdNameBooleanJSON> dbInfoList = new ArrayList<IdNameBooleanJSON>();
- try {
- ds = DbUtils.executeQuery(schemaSql);
+ wizardJSON.setAllowScheduler((rdef != null) ? rdef.getAllowSchedule() : "false");
- String prefix = "", desc = "";
-
- for (int i = 0; i < ds.getRowCount(); i++) {
- IdNameBooleanJSON dBNameJSON = new IdNameBooleanJSON();
- dBNameJSON.setId(ds.getItem(i, 0));
- dBNameJSON.setName(ds.getItem(i, 0));
- dBNameJSON.setSelected(false);
- dbInfoList.add(dBNameJSON);
+ if(wizardJSON.getReportType().equals(AppConstants.RT_LINEAR)) {
+ wizardJSON.setDbInfo((rdef != null) ? rdef.getDBInfo() : "");
+ wizardJSON.setFormHelpText((rdef != null) ? rdef.getFormHelpText() : "");
+ wizardJSON.setPageSize((rdef != null) ? rdef.getPageSize() : 50);
+ List<IdNameBooleanJSON> displayArea = new ArrayList<IdNameBooleanJSON>();
+ IdNameBooleanJSON idNameJSON = new IdNameBooleanJSON();
+ String qMenu = "";
+ for (int i = 0; i < AppUtils.getQuickLinksMenuIDs().size(); i++) {
+ idNameJSON = new IdNameBooleanJSON();
+ qMenu = (String) AppUtils.getQuickLinksMenuIDs().get(i);
+ idNameJSON.setId(qMenu);
+ idNameJSON.setName(qMenu);
+ if (rdef != null && (rdef.getMenuID().equals(qMenu))) {
+ idNameJSON.setSelected(true);
+ }
+ displayArea.add(idNameJSON);
}
- }
- catch (Exception e) {}
- wizardJSON.setDbInfoList(dbInfoList);
-
- /*Robert add*/
- wizardJSON.setOneTimeRec((rdef != null) ? rdef.getIsOneTimeScheduleAllowed() : "false");
- wizardJSON.setHourlyRec((rdef != null) ? rdef.getIsHourlyScheduleAllowed() : "false");
- wizardJSON.setDailyRec((rdef != null) ? rdef.getIsDailyScheduleAllowed() : "false");
- wizardJSON.setDailyMFRec((rdef != null) ? rdef.getIsDailyMFScheduleAllowed() : "false");
- wizardJSON.setWeeklyRec((rdef != null) ? rdef.getIsWeeklyScheduleAllowed() : "false");
- wizardJSON.setMonthlyRec((rdef != null) ? rdef.getIsMonthlyScheduleAllowed() : "false");
- wizardJSON.setAllowScheduler((rdef != null) ? rdef.getAllowSchedule() : "false");
- wizardJSON.setSizedByContent((rdef != null) ? rdef.getSizedByContentOption() : "false");
- wizardJSON.setRepDefType(rdef.getReportDefType());
+ wizardJSON.setDisplayArea(displayArea);
+ wizardJSON.setHideFormFieldsAfterRun((rdef != null) ? rdef.isHideFormFieldAfterRun() : false);
+ wizardJSON.setMaxRowsInExcelCSVDownload((rdef != null) ? rdef.getMaxRowsInExcelDownload() : 500);
+ wizardJSON.setFrozenColumns((rdef != null) ? rdef.getFrozenColumns() : 0);
+ wizardJSON.setDataGridAlign((rdef != null) ? rdef.getDataGridAlign() : "left");
+ wizardJSON.setEmptyMessage((rdef != null) ? rdef.getEmptyMessage() : "No records found");
+ List<NameBooleanJSON> displayOptions = new ArrayList<NameBooleanJSON>();
+ NameBooleanJSON nameBooleanJSON = new NameBooleanJSON();
+ nameBooleanJSON.setName("HideFormFields");
+ nameBooleanJSON.setSelected((rdef != null) ? rdef.isDisplayOptionHideForm() : false);
+ displayOptions.add(nameBooleanJSON);
+
+ nameBooleanJSON = new NameBooleanJSON();
+ nameBooleanJSON.setName("HideChart");
+ nameBooleanJSON.setSelected((rdef != null) ? rdef.isDisplayOptionHideChart() : false);
+ displayOptions.add(nameBooleanJSON);
+
+ nameBooleanJSON = new NameBooleanJSON();
+ nameBooleanJSON.setName("HideReportData");
+ nameBooleanJSON.setSelected((rdef != null) ? rdef.isDisplayOptionHideData() : false);
+ displayOptions.add(nameBooleanJSON);
+
+ nameBooleanJSON = new NameBooleanJSON();
+ nameBooleanJSON.setName("HideExcel");
+ nameBooleanJSON.setSelected((rdef != null) ? rdef.isDisplayOptionHideExcelIcons() : false);
+ displayOptions.add(nameBooleanJSON);
+
+ nameBooleanJSON = new NameBooleanJSON();
+ nameBooleanJSON.setName("HidePdf");
+ nameBooleanJSON.setSelected((rdef != null) ? rdef.isDisplayOptionHidePDFIcons() : false);
+ displayOptions.add(nameBooleanJSON);
+
+ wizardJSON.setDisplayOptions(displayOptions);
+
+ wizardJSON.setRuntimeColSortDisabled((rdef != null) ? rdef.isRuntimeColSortDisabled() : false);
+ wizardJSON.setNumFormCols((rdef != null) ? rdef.getNumFormColsAsInt() : 1);
+ wizardJSON.setReportTitle((rdef != null) ? rdef.getReportTitle() : "");
+ wizardJSON.setReportSubTitle((rdef != null) ? rdef.getReportSubTitle() : "");
+
+
+ String schemaSql = Globals.getRemoteDbSchemaSql();
+ DataSet ds = null;
+ ArrayList<IdNameBooleanJSON> dbInfoList = new ArrayList<IdNameBooleanJSON>();
+ try {
+ ds = DbUtils.executeQuery(schemaSql);
+
+ String prefix = "", desc = "";
+
+ for (int i = 0; i < ds.getRowCount(); i++) {
+ IdNameBooleanJSON dBNameJSON = new IdNameBooleanJSON();
+ dBNameJSON.setId(ds.getItem(i, 0));
+ dBNameJSON.setName(ds.getItem(i, 0));
+ dBNameJSON.setSelected(false);
+ dbInfoList.add(dBNameJSON);
+ }
+ }
+ catch (Exception e) {}
+ wizardJSON.setDbInfoList(dbInfoList);
+
+ /*Robert add*/
+ wizardJSON.setOneTimeRec((rdef != null) ? rdef.getIsOneTimeScheduleAllowed() : "false");
+ wizardJSON.setHourlyRec((rdef != null) ? rdef.getIsHourlyScheduleAllowed() : "false");
+ wizardJSON.setDailyRec((rdef != null) ? rdef.getIsDailyScheduleAllowed() : "false");
+ wizardJSON.setDailyMFRec((rdef != null) ? rdef.getIsDailyMFScheduleAllowed() : "false");
+ wizardJSON.setWeeklyRec((rdef != null) ? rdef.getIsWeeklyScheduleAllowed() : "false");
+ wizardJSON.setMonthlyRec((rdef != null) ? rdef.getIsMonthlyScheduleAllowed() : "false");
+ wizardJSON.setSizedByContent((rdef != null) ? rdef.getSizedByContentOption() : "false");
+ wizardJSON.setRepDefType(rdef.getReportDefType());
+ } else if(wizardJSON.getReportType().equals(AppConstants.RT_DASHBOARD)){
+ wizardJSON.setDashboardLayoutHTML((rdef != null) ? rdef.getCustomReport().getDashboardLayoutHTML() : null);
+ wizardJSON.setDashboardLayoutJSON((rdef != null) ? rdef.getCustomReport().getDashboardLayoutJSON() : null);
+ wizardJSON.setDashboardReports((rdef != null) ? rdef.getCustomReport().getDashBoardReports() : null);
+ }
}
ObjectMapper mapper = new ObjectMapper();
@@ -1715,14 +1796,15 @@ public class RaptorControllerAsync extends RestrictedBaseController {
@RequestMapping(value = "save_chart", method = RequestMethod.POST)
public void reportChartReceive(@RequestBody ChartJSON chartJSON, HttpServletRequest request,
- HttpServletResponse response) {
- ReportRuntime reportRuntime;
- reportRuntime = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME); // changing
- // session
+ HttpServletResponse response) throws IOException {
+ //ReportRuntime reportRuntime;
+ //reportRuntime = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME); // changing
+ ReportDefinition reportDefn;
+ reportDefn = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION); // session
// to
// request
String reportID = request.getParameter("c_master");
- if (reportRuntime == null && AppUtils.nvl(reportID).length() > 0) {
+ /* if (reportRuntime == null && AppUtils.nvl(reportID).length() > 0) {
try {
ReportHandler rh = new ReportHandler();
reportRuntime = rh.loadReportRuntime(request, reportID);
@@ -1730,23 +1812,23 @@ public class RaptorControllerAsync extends RestrictedBaseController {
logger.error(EELFLoggerDelegate.errorLogger,
"[Controller.processRequest]Invalid raptor action [reportChartReceive].", ex);
}
- }
+ }*/
- if (reportRuntime != null) {
+ if (reportDefn != null) {
String chartType = chartJSON.getChartType();
- reportRuntime.setChartType(chartJSON.getChartType());
- reportRuntime.setChartAnimate(chartJSON.isAnimation());
- reportRuntime.setChartWidth(chartJSON.getWidth());
- reportRuntime.setChartHeight(chartJSON.getHeight());
- reportRuntime.setShowChartTitle(chartJSON.isShowTitle());
+ reportDefn.setChartType(chartJSON.getChartType());
+ reportDefn.setChartAnimate(chartJSON.isAnimation());
+ reportDefn.setChartWidth(chartJSON.getWidth());
+ reportDefn.setChartHeight(chartJSON.getHeight());
+ reportDefn.setShowChartTitle(chartJSON.isShowTitle());
String domainAxis = null;
domainAxis = chartJSON.getDomainAxis();
- List<DataColumnType> reportCols = reportRuntime.getAllColumns();
+ List<DataColumnType> reportCols = reportDefn.getAllColumns();
for (Iterator<DataColumnType> iter = reportCols.iterator(); iter.hasNext();) {
- DataColumnType dct = iter.next();
+ DataColumnType dct = (DataColumnType) iter.next();
if (dct.getColId().equals(domainAxis)) {
dct.setColOnChart(AppConstants.GC_LEGEND);
} else {
@@ -1755,14 +1837,14 @@ public class RaptorControllerAsync extends RestrictedBaseController {
}
CategoryAxisJSON categoryAxisJSON = chartJSON.getCategoryAxisJSON();
- String categoryAxis;
+ String categoryAxis = null;
categoryAxis = (categoryAxisJSON != null ? categoryAxisJSON.getValue() : "");
- reportCols = reportRuntime.getAllColumns();
+ reportCols = reportDefn.getAllColumns();
for (Iterator<DataColumnType> iter = reportCols.iterator(); iter.hasNext();) {
- DataColumnType dct = iter.next();
+ DataColumnType dct = (DataColumnType) iter.next();
if (dct.getColId().equals(categoryAxis)) {
dct.setChartSeries(true);
} else {
@@ -1785,7 +1867,7 @@ public class RaptorControllerAsync extends RestrictedBaseController {
String rangeLineType = AppUtils.nvl(rangeAxisJSON.getRangeLineType());
rangefor: for (Iterator<DataColumnType> iterator = reportCols.iterator(); iterator.hasNext();) {
- DataColumnType dct = iterator.next();
+ DataColumnType dct = (DataColumnType) iterator.next();
if (dct.getColId().equals(rangeAxis)) {
if(removeRangeAxisMap.contains(rangeAxis))
dct.setChartSeq(-1); // if we set it to -1, means this range axis will not be included
@@ -1815,57 +1897,57 @@ public class RaptorControllerAsync extends RestrictedBaseController {
}
}
- reportRuntime.setChartLeftAxisLabel(chartJSON.getPrimaryAxisLabel());
- reportRuntime.setChartRightAxisLabel(chartJSON.getSecondaryAxisLabel());
+ reportDefn.setChartLeftAxisLabel(chartJSON.getPrimaryAxisLabel());
+ reportDefn.setChartRightAxisLabel(chartJSON.getSecondaryAxisLabel());
- reportRuntime.setRangeAxisLowerLimit(chartJSON.getMinRange());
- reportRuntime.setRangeAxisUpperLimit(chartJSON.getMaxRange());
+ reportDefn.setRangeAxisLowerLimit(chartJSON.getMinRange());
+ reportDefn.setRangeAxisUpperLimit(chartJSON.getMaxRange());
if (chartType.equals(AppConstants.GT_ANNOTATION_CHART)
|| chartType.equals(AppConstants.GT_FLEX_TIME_CHARTS)) {
if (chartJSON.getFlexTimeSeriesChartOptions() != null) {
- reportRuntime.setZoomIn(chartJSON.getFlexTimeSeriesChartOptions().getZoomIn());
- reportRuntime.setTimeAxisType(chartJSON.getFlexTimeSeriesChartOptions().getTimeAxisType());
+ reportDefn.setZoomIn(chartJSON.getFlexTimeSeriesChartOptions().getZoomIn());
+ reportDefn.setTimeAxisType(chartJSON.getFlexTimeSeriesChartOptions().getTimeAxisType());
}
}
if (chartType.equals(AppConstants.GT_TIME_SERIES)) {
if (chartJSON.getTimeSeriesChartOptions() != null) {
- reportRuntime.setTimeSeriesRender(chartJSON.getTimeSeriesChartOptions().getLineChartRenderer());
- reportRuntime.setShowXAxisLabel(chartJSON.getTimeSeriesChartOptions().isShowXAxisLabel());
- reportRuntime.setAddXAxisTickers(chartJSON.getTimeSeriesChartOptions().isAddXAxisTicker());
- reportRuntime.setTimeAxis(chartJSON.getTimeSeriesChartOptions().isNonTimeAxis());
- reportRuntime.setMultiSeries(chartJSON.getTimeSeriesChartOptions().isMultiSeries());
+ reportDefn.setTimeSeriesRender(chartJSON.getTimeSeriesChartOptions().getLineChartRenderer());
+ reportDefn.setShowXAxisLabel(chartJSON.getTimeSeriesChartOptions().isShowXAxisLabel());
+ reportDefn.setAddXAxisTickers(chartJSON.getTimeSeriesChartOptions().isAddXAxisTicker());
+ reportDefn.setTimeAxis(chartJSON.getTimeSeriesChartOptions().isNonTimeAxis());
+ reportDefn.setMultiSeries(chartJSON.getTimeSeriesChartOptions().isMultiSeries());
}
}
if (chartType.equals(AppConstants.GT_BAR_3D)) {
if (chartJSON.getBarChartOptions() != null) {
- reportRuntime.setChartOrientation(
+ reportDefn.setChartOrientation(
chartJSON.getBarChartOptions().isVerticalOrientation() ? "vertical" : "horizontal");
- reportRuntime.setChartStacked(chartJSON.getBarChartOptions().isStackedChart());
- reportRuntime.setBarControls(chartJSON.getBarChartOptions().isDisplayBarControls());
- reportRuntime.setXAxisDateType(chartJSON.getBarChartOptions().isxAxisDateType());
- reportRuntime.setLessXaxisTickers(chartJSON.getBarChartOptions().isMinimizeXAxisTickers());
- reportRuntime.setTimeAxis(chartJSON.getBarChartOptions().isTimeAxis());
- reportRuntime.setLogScale(chartJSON.getBarChartOptions().isyAxisLogScale());
+ reportDefn.setChartStacked(chartJSON.getBarChartOptions().isStackedChart());
+ reportDefn.setBarControls(chartJSON.getBarChartOptions().isDisplayBarControls());
+ reportDefn.setXAxisDateType(chartJSON.getBarChartOptions().isxAxisDateType());
+ reportDefn.setLessXaxisTickers(chartJSON.getBarChartOptions().isMinimizeXAxisTickers());
+ reportDefn.setTimeAxis(chartJSON.getBarChartOptions().isTimeAxis());
+ reportDefn.setLogScale(chartJSON.getBarChartOptions().isyAxisLogScale());
}
}
- reportRuntime.setLegendLabelAngle(chartJSON.getCommonChartOptions().getLegendLabelAngle());
- reportRuntime.setLegendPosition(chartJSON.getCommonChartOptions().getLegendPosition());
- reportRuntime.setChartLegendDisplay(chartJSON.getCommonChartOptions().isHideLegend() ? "Y" : "N");
- reportRuntime.setAnimateAnimatedChart(chartJSON.getCommonChartOptions().isAnimateAnimatedChart());
+ reportDefn.setLegendLabelAngle(chartJSON.getCommonChartOptions().getLegendLabelAngle());
+ reportDefn.setLegendPosition(chartJSON.getCommonChartOptions().getLegendPosition());
+ reportDefn.setChartLegendDisplay(chartJSON.getCommonChartOptions().isHideLegend() ? "Y" : "N");
+ reportDefn.setAnimateAnimatedChart(chartJSON.getCommonChartOptions().isAnimateAnimatedChart());
- reportRuntime.setTopMargin(chartJSON.getCommonChartOptions().getTopMargin());
- reportRuntime.setBottomMargin(chartJSON.getCommonChartOptions().getBottomMargin());
- reportRuntime.setLeftMargin(chartJSON.getCommonChartOptions().getLeftMargin());
- reportRuntime.setRightMargin(chartJSON.getCommonChartOptions().getRightMargin());
+ reportDefn.setTopMargin(chartJSON.getCommonChartOptions().getTopMargin());
+ reportDefn.setBottomMargin(chartJSON.getCommonChartOptions().getBottomMargin());
+ reportDefn.setLeftMargin(chartJSON.getCommonChartOptions().getLeftMargin());
+ reportDefn.setRightMargin(chartJSON.getCommonChartOptions().getRightMargin());
for (Iterator<DataColumnType> iterator = reportCols.iterator(); iterator.hasNext();) {
- DataColumnType dct = iterator.next();
+ DataColumnType dct = (DataColumnType) iterator.next();
if (!(AppUtils.nvl(dct.getColOnChart()).equals(AppConstants.GC_LEGEND)
|| (dct.getChartSeq() != null && dct.getChartSeq() > 0) || dct.isChartSeries())) {
dct.setChartSeq(-1);
@@ -1878,7 +1960,9 @@ public class RaptorControllerAsync extends RestrictedBaseController {
}
try {
- reportRuntime.persistLinearReport(request);
+ //reportRuntime.persistLinearReport(request);
+ //reportRuntime.persistReport(request);
+ persistReportDefinition(request, reportDefn);
} catch (Exception ex) {
logger.error(EELFLoggerDelegate.errorLogger,
"[Controller.processRequest]Invalid raptor action [reportChartReceive].", ex);
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/web/RaptorDashboardController.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/web/RaptorDashboardController.java
new file mode 100644
index 00000000..dd18a1a2
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/web/RaptorDashboardController.java
@@ -0,0 +1,119 @@
+/*
+ * ============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.system.fusion.web;
+
+import java.util.HashMap;
+import java.util.TreeMap;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+
+import org.onap.portalsdk.analytics.model.ReportHandler;
+import org.onap.portalsdk.analytics.model.ReportLoader;
+import org.onap.portalsdk.analytics.model.base.ReportWrapper;
+import org.onap.portalsdk.analytics.model.runtime.DashboardRunJSON;
+import org.onap.portalsdk.analytics.system.Globals;
+import org.onap.portalsdk.analytics.xmlobj.CustomReportType;
+import org.onap.portalsdk.core.controller.RestrictedBaseController;
+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * For dashboard reports.
+ */
+@RestController
+@RequestMapping("/")
+public class RaptorDashboardController extends RestrictedBaseController {
+
+ private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(RaptorDashboardController.class);
+
+ @RequestMapping(value = { "raptor/dashboard/run/{parameter}" }, method = RequestMethod.GET, produces = "application/json")
+ @ResponseBody
+ public DashboardRunJSON dashboardRun(@PathVariable("parameter") String reportId, HttpServletRequest request) {
+ ServletContext servletContext = request.getSession().getServletContext();
+ if (!Globals.isSystemInitialized()) {
+ Globals.initializeSystem(servletContext);
+ }
+ DashboardRunJSON dashboardRunJSON = new DashboardRunJSON();
+ dashboardRunJSON.setReportId(reportId);
+ try {
+ ReportHandler rh1 = new ReportHandler();
+ if (reportId != null) {
+ String reportXML = ReportLoader.loadCustomReportXML(reportId);
+ CustomReportType crType = ReportWrapper.unmarshalCR(reportXML);
+ dashboardRunJSON.setDashboardLayoutJSON(crType.getDashboardLayoutJSON());
+
+ String strHTML = crType.getDashboardLayoutHTML();
+ dashboardRunJSON.setReportsFromDashBoardHTML(getListOfReportsFromDashBoardHTML(strHTML));
+
+ reportXML = ReportLoader.loadCustomReportXML(((String)dashboardRunJSON.getReportsFromDashBoardHTML().get("1")).substring(1));
+ crType = ReportWrapper.unmarshalCR(reportXML);
+ dashboardRunJSON.setFormFieldList(crType.getFormFieldList());
+ dashboardRunJSON.setFormFieldGroupsJSON(crType.getFormFieldGroupsJSON());
+ }
+ } catch (Exception ex) {
+ logger.error(EELFLoggerDelegate.errorLogger, "getManifest failed", ex);
+ dashboardRunJSON.setErrorMessage(ex.toString());
+ }
+ return dashboardRunJSON;
+ }
+
+ private TreeMap getListOfReportsFromDashBoardHTML(String htmlString) {
+ String sourcestring = htmlString;
+ Pattern re = Pattern.compile("\\[(.*?)\\]");
+ Matcher m = re.matcher(sourcestring);
+ HashMap hashReports = new HashMap();
+ int mIdx = 0;
+ while (m.find()) {
+ for (int groupIdx = 0; groupIdx < m.groupCount(); groupIdx++) {
+ String str = m.group(groupIdx);
+ hashReports.put(new String(Integer.toString(mIdx + 1)),
+ (str.substring(1).toLowerCase().startsWith("chart") ? "c" : "d")
+ + str.substring(str.indexOf("#") + 1, str.length() - 1));
+ }
+ mIdx++;
+ }
+ return new TreeMap(hashReports);
+ }
+} \ No newline at end of file
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/xmlobj/CustomReportType.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/xmlobj/CustomReportType.java
index 979a72e7..b043327a 100644
--- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/xmlobj/CustomReportType.java
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/xmlobj/CustomReportType.java
@@ -150,6 +150,7 @@ import javax.xml.datatype.XMLGregorianCalendar;
"reportDescr",
"numDashCols",
"dashboardLayoutHTML",
+ "dashboardLayoutJSON",
"dbInfo",
"dbType",
"chartType",
@@ -193,6 +194,7 @@ import javax.xml.datatype.XMLGregorianCalendar;
"comment",
"dataSourceList",
"formFieldList",
+ "formFieldGroupsJSON",
"javascriptList",
"semaphoreList",
"dashboardOptions",
@@ -225,6 +227,7 @@ public class CustomReportType {
protected String reportDescr;
protected String numDashCols;
protected String dashboardLayoutHTML;
+ protected String dashboardLayoutJSON;
protected String dbInfo;
protected String dbType;
@XmlElement(required = true)
@@ -281,6 +284,7 @@ public class CustomReportType {
protected String comment;
protected DataSourceList dataSourceList;
protected FormFieldList formFieldList;
+ protected String formFieldGroupsJSON;
protected JavascriptList javascriptList;
protected SemaphoreList semaphoreList;
protected String dashboardOptions;
@@ -410,7 +414,15 @@ public class CustomReportType {
this.dashboardLayoutHTML = value;
}
- /**
+ public String getDashboardLayoutJSON() {
+ return dashboardLayoutJSON;
+ }
+
+ public void setDashboardLayoutJSON(String dashboardLayoutJSON) {
+ this.dashboardLayoutJSON = dashboardLayoutJSON;
+ }
+
+ /**
* Gets the value of the dbInfo property.
*
* @return
@@ -1426,7 +1438,15 @@ public class CustomReportType {
this.formFieldList = value;
}
- /**
+ public String getFormFieldGroupsJSON() {
+ return formFieldGroupsJSON;
+ }
+
+ public void setFormFieldGroupsJSON(String formFieldGroupsJSON) {
+ this.formFieldGroupsJSON = formFieldGroupsJSON;
+ }
+
+ /**
* Gets the value of the javascriptList property.
*
* @return