summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/web/RaptorControllerAsync.java
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/web/RaptorControllerAsync.java')
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/web/RaptorControllerAsync.java540
1 files changed, 312 insertions, 228 deletions
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);