summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller')
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/Action.java91
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/ActionHandler.java2417
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/ActionMapping.java34
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/Controller.java125
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/ErrorHandler.java151
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardProcessor.java2356
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequence.java191
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceCrossTab.java45
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceDashboard.java40
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceLinear.java47
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedCrossTab.java44
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedHive.java46
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedLinear.java47
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedLinearDatamining.java46
14 files changed, 5680 insertions, 0 deletions
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/Action.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/Action.java
new file mode 100644
index 00000000..853901fb
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/Action.java
@@ -0,0 +1,91 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file 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.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.controller;
+
+import java.util.*;
+
+import org.openecomp.portalsdk.analytics.system.*;
+
+public class Action extends org.openecomp.portalsdk.analytics.RaptorObject {
+ private String action = null;
+
+ private String controllerClass = null;
+
+ private String controllerMethod = null;
+
+ private String jspName = null;
+
+ private Action() {
+ }
+
+ public Action(String action, String controllerClass, String controllerMethod,
+ String jspName) {
+ setAction(action);
+ setControllerClass(controllerClass);
+ setControllerMethod(controllerMethod);
+ setJspName(jspName);
+ } // Action
+
+ public static Action parse(String configFileEntry) {
+ Action a = new Action();
+
+ StringTokenizer st = new StringTokenizer(configFileEntry, "| \t", false);
+ // if(st.hasMoreTokens())
+ a.setAction(st.nextToken());
+ a.setControllerClass(st.nextToken());
+ a.setControllerMethod(st.nextToken());
+ a.setJspName(st.nextToken());
+
+ return a;
+ } // parse
+
+ public String getAction() {
+ return action;
+ }
+
+ public String getControllerClass() {
+ return controllerClass;
+ }
+
+ public String getControllerMethod() {
+ return controllerMethod;
+ }
+
+ public String getJspName() {
+ return jspName;
+ }
+
+ private void setAction(String action) {
+ this.action = action;
+ }
+
+ private void setControllerClass(String controllerClass) {
+ this.controllerClass = controllerClass;
+ }
+
+ private void setControllerMethod(String controllerMethod) {
+ this.controllerMethod = controllerMethod;
+ }
+
+ private void setJspName(String jspName) {
+ this.jspName = jspName;
+ }
+
+} // Action
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/ActionHandler.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/ActionHandler.java
new file mode 100644
index 00000000..d030c994
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/ActionHandler.java
@@ -0,0 +1,2417 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file 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.
+ * ================================================================================
+ */
+/* ===========================================================================================
+ * This class is part of <I>RAPTOR (Rapid Application Programming Tool for OLAP Reporting)</I>
+ * Raptor : This tool is used to generate different kinds of reports with lot of utilities
+ * ===========================================================================================
+ *
+ * -------------------------------------------------------------------------------------------
+ * ActionHandler.java - This class is used to call actions related to reports.
+ * -------------------------------------------------------------------------------------------
+ *
+ *
+ *
+ * Changes
+ * -------
+ * 31-Aug-2009 : Version 8.5.1 (Sundar);<UL><LI> reportFormFieldPopup iterates form field collections. </LI></UL>
+ * 18-Aug-2009 : Version 8.5.1 (Sundar);<UL><LI> request Object is passed to prevent caching user/roles - Datamining/Hosting. </LI></UL>
+ * 13-Aug-2009 : Version 8.5 (Sundar);<UL><LI> reportFormFieldPopup is changed to have effect on textfield with popup. </LI></UL>
+ * 06-Aug-2009 : Version 9.0 (Sundar);<UL><LI> reportFormFieldPopupB is changed. </LI></UL>
+ * 29-Jul-2009 : Version 8.4 (Sundar);<UL><LI> Previously report data for dashboard stored only page level data. This has been changed to show all the data up to the maximum specified. </LI></UL>
+ * 27-Jul-2009 : Version 8.4 (Sundar);<UL><LI>Bug due to not showing back button after child report in drilldown is navigated more than
+ * one page is resolved. </LI></UL>
+ * 14-Jul-2009 : Version 8.4 (Sundar); <UL><LI>Dashboard reports can now be generated excel as separate sheets or group together in PDF.
+ * They can also be scheduled.</LI></UL>
+ *
+ */
+package org.openecomp.portalsdk.analytics.controller;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.Vector;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.error.RaptorRuntimeException;
+import org.openecomp.portalsdk.analytics.error.RaptorSchedularException;
+import org.openecomp.portalsdk.analytics.error.ReportSQLException;
+import org.openecomp.portalsdk.analytics.error.UserDefinedException;
+import org.openecomp.portalsdk.analytics.error.ValidationException;
+import org.openecomp.portalsdk.analytics.model.DataCache;
+import org.openecomp.portalsdk.analytics.model.ReportHandler;
+import org.openecomp.portalsdk.analytics.model.ReportLoader;
+import org.openecomp.portalsdk.analytics.model.SearchHandler;
+import org.openecomp.portalsdk.analytics.model.base.IdNameColLookup;
+import org.openecomp.portalsdk.analytics.model.base.IdNameList;
+import org.openecomp.portalsdk.analytics.model.base.IdNameSql;
+import org.openecomp.portalsdk.analytics.model.base.ReportSecurity;
+import org.openecomp.portalsdk.analytics.model.definition.ReportDefinition;
+import org.openecomp.portalsdk.analytics.model.definition.ReportSchedule;
+import org.openecomp.portalsdk.analytics.model.runtime.ChartWebRuntime;
+import org.openecomp.portalsdk.analytics.model.runtime.ErrorJSONRuntime;
+import org.openecomp.portalsdk.analytics.model.runtime.FormField;
+import org.openecomp.portalsdk.analytics.model.runtime.FormatProcessor;
+import org.openecomp.portalsdk.analytics.model.runtime.ReportFormFields;
+import org.openecomp.portalsdk.analytics.model.runtime.ReportJSONRuntime;
+import org.openecomp.portalsdk.analytics.model.runtime.ReportRuntime;
+import org.openecomp.portalsdk.analytics.model.runtime.VisualManager;
+import org.openecomp.portalsdk.analytics.model.search.ReportSearchResultJSON;
+import org.openecomp.portalsdk.analytics.system.AppUtils;
+import org.openecomp.portalsdk.analytics.system.ConnectionUtils;
+import org.openecomp.portalsdk.analytics.system.DbUtils;
+import org.openecomp.portalsdk.analytics.system.Globals;
+import org.openecomp.portalsdk.analytics.system.fusion.domain.QuickLink;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+import org.openecomp.portalsdk.analytics.util.DataSet;
+import org.openecomp.portalsdk.analytics.util.Utils;
+import org.openecomp.portalsdk.analytics.view.DataRow;
+import org.openecomp.portalsdk.analytics.view.DataValue;
+import org.openecomp.portalsdk.analytics.view.ReportData;
+import org.openecomp.portalsdk.analytics.xmlobj.DataColumnType;
+import org.openecomp.portalsdk.analytics.xmlobj.FormFieldType;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+
+public class ActionHandler extends org.openecomp.portalsdk.analytics.RaptorObject {
+
+ //private static Log debugLogger = LogFactory.getLog(ActionHandler.class.getName());
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ActionHandler.class);
+
+ private void preserveReportRuntimeAsBackup(HttpServletRequest request) {
+ HttpSession session = request.getSession();
+ ArrayList repAl = null;
+
+ if(session.getAttribute(AppConstants.DRILLDOWN_REPORTS_LIST)!=null)
+ repAl = ((ArrayList)session.getAttribute(AppConstants.DRILLDOWN_REPORTS_LIST));
+ int index = Integer.parseInt(nvl((String) session.getAttribute(AppConstants.DRILLDOWN_INDEX), "0"));
+ int form_index = Integer.parseInt(nvl((String) session.getAttribute(AppConstants.FORM_DRILLDOWN_INDEX), "0"));
+ int flag = 0;
+ if(repAl ==null || repAl.size() <= 0) {
+ //session.setAttribute(AppConstants.SI_BACKUP_FOR_REP_ID, ((ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).getReportID());
+ //session.setAttribute(AppConstants.SI_REPORT_RUN_BACKUP, request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME));
+ repAl = new ArrayList();
+ repAl.add((ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME));
+
+ } else {
+ if(Globals.getMaxDrillDownLevel() < repAl.size()) {
+ repAl.remove(0);
+ if(index > 0) index--;
+ } else if(index < repAl.size())
+ repAl.remove(index);
+ repAl.add(index, (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME));
+ }
+ index = index + 1;
+ // needed to differentiate form and report index to store form parameters for ZK
+ form_index = form_index + 1;
+ session.setAttribute(AppConstants.FORM_DRILLDOWN_INDEX, Integer.toString(form_index));
+ session.setAttribute(AppConstants.DRILLDOWN_INDEX, Integer.toString(index));
+ request.getSession().setAttribute(AppConstants.DRILLDOWN_REPORTS_LIST, repAl);
+ } // preserveReportRuntimeAsBackup
+
+ private void clearReportRuntimeBackup(HttpServletRequest request) {
+// debugLogger.debug("in Action Handler clear is been called.");
+ HttpSession session = request.getSession();
+ session.removeAttribute(AppConstants.DRILLDOWN_REPORTS_LIST);
+ session.removeAttribute(AppConstants.DRILLDOWN_REPORTS_LIST);
+ request.removeAttribute(AppConstants.DRILLDOWN_INDEX);
+ request.removeAttribute(AppConstants.FORM_DRILLDOWN_INDEX);
+ Enumeration<String> enum1 = session.getAttributeNames();
+ String attributeName = "";
+ while(enum1.hasMoreElements()) {
+ attributeName = enum1.nextElement();
+ if(attributeName.startsWith("parent_")) {
+ session.removeAttribute(attributeName);
+ }
+ }
+ //request.getSession().removeAttribute(AppConstants.SI_REPORT_RUN_BACKUP);
+ //request.getSession().removeAttribute(AppConstants.SI_BACKUP_FOR_REP_ID);
+ } // clearReportRuntimeBackup
+
+ private boolean isDashboardInDrillDownList(HttpServletRequest request) throws RaptorException {
+ ArrayList aL = (ArrayList) request.getSession().getAttribute(
+ AppConstants.DRILLDOWN_REPORTS_LIST);
+ ReportRuntime rr = null;
+ if(aL ==null || aL.size() <= 0) {
+ return false;
+ } else {
+ for (int i =0; i<aL.size(); i++) {
+ rr = (ReportRuntime) aL.get(i);
+ if( rr!=null && rr.getReportType().equals(AppConstants.RT_DASHBOARD))
+ return true;
+ }
+ }
+ return false;
+ }
+ private ReportRuntime getReportRuntimeFromBackup(HttpServletRequest request) {
+ ArrayList aL = (ArrayList) request.getSession().getAttribute(
+ AppConstants.DRILLDOWN_REPORTS_LIST);
+ ReportRuntime rr = null;
+ HttpSession session = request.getSession();
+ /*if(aL==null || (aL.size() <=0) ) {
+ rr = (ReportRuntime) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_RUN_BACKUP);
+ request.getSession().setAttribute(AppConstants.SI_REPORT_RUNTIME, rr);
+ } else {*/
+ //clearReportRuntimeBackup(request);
+
+ int index = Integer.parseInt(nvl(AppUtils.getRequestValue(request, AppConstants.DRILLDOWN_INDEX), "0"));
+ int form_index = Integer.parseInt(nvl(AppUtils.getRequestValue(request, AppConstants.FORM_DRILLDOWN_INDEX), "0"));
+ index = index>0 ? --index : 0;
+ form_index = form_index>0 ? --form_index : 0;
+ request.setAttribute(AppConstants.DRILLDOWN_INDEX, Integer.toString(index));
+ session.setAttribute(AppConstants.DRILLDOWN_INDEX, Integer.toString(index));
+ request.setAttribute(AppConstants.FORM_DRILLDOWN_INDEX, Integer.toString(form_index));
+ session.setAttribute(AppConstants.FORM_DRILLDOWN_INDEX, Integer.toString(form_index));
+
+ rr = (ReportRuntime)aL.get(index);
+ request.getSession().setAttribute(AppConstants.SI_REPORT_RUNTIME, rr);
+ //clearReportRuntimeBackup(request);
+ //}
+ return rr;
+ } // getReportRuntimeFromBackup
+
+ public String reportRun(HttpServletRequest request, String nextPage) {
+ String action = nvl(request.getParameter(AppConstants.RI_ACTION), request.getParameter("action"));
+ ReportRuntime rr = null;
+ String userId = null;
+ String formFields = "";
+ ReportData rd = null;
+ boolean isEmailAttachment = false;
+ boolean fromDashboard = AppUtils.getRequestFlag(request,"fromDashboard");
+ request.getSession().setAttribute("login_id", AppUtils.getUserBackdoorLoginId(request));
+
+ boolean rDisplayContent = AppUtils.getRequestFlag(request,
+ AppConstants.RI_DISPLAY_CONTENT)
+ || AppUtils.getRequestFlag(request, "noFormFields");
+
+ try {
+ //if "refresh=Y" is in request parameter, session variables are removed.
+ if(AppUtils.getRequestFlag(request, AppConstants.RI_REFRESH)) {
+ removeVariablesFromSession(request);
+ }
+
+
+ long currentTime = System.currentTimeMillis();
+ request.setAttribute("triggeredStartTime", new Long(currentTime));
+ String actionKey = nvl(request.getParameter(AppConstants.RI_ACTION), request.getParameter("action"));
+ String pdfAttachmentKey = AppUtils.getRequestNvlValue(request, "pdfAttachmentKey");
+ String parent = "";
+ int parentFlag = 0;
+ if(!nvl(request.getParameter("parent"), "").equals("N")) parent = nvl(request.getParameter("parent"), "");
+ if(parent.startsWith("parent_")) parentFlag = 1;
+
+ if (pdfAttachmentKey.length()<=0) {
+ if(actionKey.equals("report.download.page") || actionKey.equals("report.download") || actionKey.equals("report.download.pdf") || actionKey.equals("report.download.excel2007") || actionKey.equals("report.csv.download") || actionKey.equals("report.text.download")) {
+ if(parentFlag == 1) rr = (ReportRuntime) request.getSession().getAttribute(parent+"_rr");
+ if(rr==null)
+ rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME); //changing session to request
+ if(!(rr!=null && fromDashboard)) {
+ userId = AppUtils.getUserID(request);
+ boolean isFromReportLog = AppUtils.getRequestFlag(request, "fromReportLog");
+ int downloadLimit = 0;
+ if(rr!=null)
+ downloadLimit = (rr.getMaxRowsInExcelDownload()>0)?rr.getMaxRowsInExcelDownload():Globals.getDownloadLimit();
+ if(actionKey.equals("report.csv.download"))
+ downloadLimit = Globals.getCSVDownloadLimit();
+
+ if(rr!=null && rr.getReportType().equals(AppConstants.RT_LINEAR)) {
+ String sql_whole = rr.getReportDataSQL(userId, downloadLimit, request);
+ request.setAttribute(AppConstants.RI_REPORT_SQL_WHOLE, sql_whole);
+ } else if(rr!=null && rr.getReportType().equals(AppConstants.RT_CROSSTAB)) {
+ rd = rr.loadReportData(-1, userId, downloadLimit,request, false); /* TODO: should be changed to true */
+ request.getSession().setAttribute(AppConstants.RI_REPORT_DATA, rd);
+ }
+ if(!isFromReportLog) {
+ if(pdfAttachmentKey!=null && pdfAttachmentKey.length()>0) {
+ if(actionKey.equals("report.download")) {
+ rr.logReportExecutionTime(userId, "",AppConstants.RLA_SCHEDULED_DOWNLOAD_EXCEL, formFields);
+ } else if (actionKey.equals("report.download.pdf")) {
+ rr.logReportExecutionTime(userId, "",AppConstants.RLA_SCHEDULED_DOWNLOAD_PDF, formFields);
+ } else if (actionKey.equals("report.download.excel2007")) {
+ rr.logReportExecutionTime(userId, "",AppConstants.RLA_SCHEDULED_DOWNLOAD_EXCELX, formFields);
+ }
+ } else {
+ if(actionKey.equals("report.download") ) {
+ rr.logReportExecutionTime(userId, "",AppConstants.RLA_DOWNLOAD_EXCEL, formFields);
+ } else if (actionKey.equals("report.download.pdf")) {
+ rr.logReportExecutionTime(userId, "",AppConstants.RLA_DOWNLOAD_PDF, formFields);
+ } else if (actionKey.equals("report.csv.download")) {
+ rr.logReportExecutionTime(userId, "",AppConstants.RLA_DOWNLOAD_CSV, formFields);
+ } else if (actionKey.equals("report.text.download")) {
+ rr.logReportExecutionTime(userId, "",AppConstants.RLA_DOWNLOAD_TEXT, formFields);
+ } else if (actionKey.equals("report.download.page")) {
+ rr.logReportExecutionTime(userId, "",AppConstants.RLA_DOWNLOAD_PAGE_EXCEL, formFields);
+ } else if (actionKey.equals("report.download.excel2007")) {
+ rr.logReportExecutionTime(userId, "",AppConstants.RLA_DOWNLOAD_EXCELX, formFields);
+ }
+ }
+ }
+ return nextPage;
+ }
+
+ }
+ }// pdfAttachmentKey
+ String reportID = AppUtils.getRequestValue(request, AppConstants.RI_REPORT_ID);
+ rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME); //changing session to request
+
+ String reportIDFromSession = (rr!=null)?rr.getReportID():"";
+ logger.debug(EELFLoggerDelegate.debugLogger, ("in Action Handler ********** " + reportID + " " + reportIDFromSession + " "+ actionKey));
+// ReportRuntime rr = (ReportRuntime) request.getAttribute(AppConstants.SI_REPORT_RUNTIME);
+ logger.debug(EELFLoggerDelegate.debugLogger, ("^^^^^^^^^^^^^^report ID from session " + ((rr!=null)?rr.getReportID():"no report id in session")));
+ // if(rr!=null && !(rr.getReportID().equals(reportID))) {
+// rr = null;
+// request.getSession().setAttribute(AppConstants.SI_REPORT_RUNTIME, null);
+// }
+
+ ReportHandler rh1 = new ReportHandler();
+ ReportRuntime rr1 = null;
+
+ //debugLogger.debug("Report ID B4 rr1 in ActionHandler "
+ // + ( request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)!=null?((ReportRuntime)request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).getReportID():"Not in session"));
+
+
+ //try {
+ boolean isGoBackAction = AppUtils.getRequestFlag(request, AppConstants.RI_GO_BACK);
+
+ if (AppUtils.getRequestFlag(request, AppConstants.RI_SHOW_BACK_BTN) && !isGoBackAction) {
+ // debugLogger.debug("Preserving report");
+ if(!reportID.equals(reportIDFromSession))
+ preserveReportRuntimeAsBackup(request);
+ }
+
+ if(reportID !=null)
+ rr1 = rh1.loadReportRuntime(request, reportID, true, 1);
+ //} catch(Exception e) {
+
+ // }
+// debugLogger.debug("Report ID After rr1 in ActionHandler "
+// + ( request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)!=null?((ReportRuntime)request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).getReportID():"Not in session"));
+ if(rr1!=null && rr1.getReportType().equals(AppConstants.RT_DASHBOARD)) {
+ int DASH=7;
+ int requestFlag = DASH;
+ ReportHandler rh = new ReportHandler();
+ // Added below statement to add parent dashboard report id in session.
+ request.getSession().setAttribute(AppConstants.SI_DASHBOARD_REP_ID, reportID);
+ //rr = null;
+ // get dashboard HTML from report runtime. getListOfReportsFromDashBoardHTML
+ String strHTML = rr1.getDashboardLayoutHTML();
+
+ //System.out.println("StrHTML " + strHTML);
+ // call getListOfReportsFromDashBoardHTML returns HashMap
+
+ TreeMap treeMap = getListOfReportsFromDashBoardHTML(strHTML);
+ //System.out.println("Size " + hashMap.size());
+ Set set = treeMap.entrySet();
+ String value = "";
+
+ HashMap reportsRuntimeMap = new HashMap();
+ HashMap reportDataMap = new HashMap();
+ HashMap reportChartDataMap = new HashMap();
+ // displayTypeMap differentiates whether report need to be displayed as data or chart
+ HashMap reportDisplayTypeMap = new HashMap();
+
+ userId = null;
+ userId = AppUtils.getUserID(request);
+ int pageNo = -1;
+ //int downloadLimit = (rr1.getMaxRowsInExcelDownload()>0)?rr1.getMaxRowsInExcelDownload():Globals.getDownloadLimit();
+ int downloadLimit = 0;
+ int rep_idx = 0;
+ int widthFlag = 0;
+ int heightFlag = 0;
+ ReportRuntime rrDashboardReports = null;
+ Integer intObj = null;
+ ReportRuntime similiarReportRuntime = null;
+ rd = null;
+ DataSet ds = null;
+ String reportIDFromMap = null;
+ int record = 0;
+ boolean buildReportdata = true;
+
+ for(Iterator iter = set.iterator(); iter.hasNext(); ) {
+ record++;
+ Map.Entry entry = (Entry) iter.next();
+ //System.out.println("Key "+ entry.getKey());
+ //System.out.println("Value "+ entry.getValue());
+ reportIDFromMap = entry.getValue().toString().substring(1);
+ // The below line is used to optimize, so that if there is already same report id it wouldn't go through the whole process
+ similiarReportRuntime = getSimiliarReportRuntime(reportsRuntimeMap, reportIDFromMap);
+ if(similiarReportRuntime != null ) {
+ rrDashboardReports = (ReportRuntime) getSimiliarReportRuntime(reportsRuntimeMap, reportIDFromMap).clone();
+ intObj = getKey(reportsRuntimeMap,reportIDFromMap);
+ } else {
+ rrDashboardReports = rh.loadReportRuntime(request, reportIDFromMap, true, requestFlag);
+ }
+ if(entry.getValue().toString().toLowerCase().startsWith("c")) {
+ rrDashboardReports.setDisplayMode(ReportRuntime.DISPLAY_CHART_ONLY);
+ } else {
+ rrDashboardReports.setDisplayMode(ReportRuntime.DISPLAY_DATA_ONLY);
+ }
+
+ downloadLimit = (rrDashboardReports.getMaxRowsInExcelDownload()>0)?rrDashboardReports.getMaxRowsInExcelDownload():Globals.getDownloadLimit();
+ if (new Integer(nvl(rrDashboardReports.getDataContainerWidth(),"100")).intValue() >100) widthFlag = 1;
+ if (new Integer(nvl(rrDashboardReports.getDataContainerHeight(),"100")).intValue() >100) heightFlag = 1;
+
+ if(record == 1) {
+ if(rrDashboardReports.getReportFormFields()!=null && rrDashboardReports.getReportFormFields().size()>0) {
+ buildReportdata = false;
+ if(rDisplayContent) buildReportdata = true;
+ }
+ }
+
+ if(buildReportdata) {
+ if(similiarReportRuntime != null ) {
+ rd = (ReportData) reportDataMap.get(intObj);
+ ds = (DataSet) reportChartDataMap.get(intObj);
+ } else {
+ if (!rrDashboardReports.getReportType().equals(AppConstants.RT_HIVE))
+ rd = rrDashboardReports.loadReportData(pageNo, userId, downloadLimit,request, false /*download*/);
+ else
+ rd = rrDashboardReports.loadHiveLinearReportData(rrDashboardReports.getReportSQL(), userId, 2,request);
+ ds = rrDashboardReports.loadChartData(userId,request);
+ }
+ }
+
+
+ long totalTime = System.currentTimeMillis() - currentTime;
+ formFields = AppUtils.getRequestNvlValue(request, "formFields");
+ if(buildReportdata) {
+ rrDashboardReports.logReportRun(userId, String.valueOf(totalTime),formFields);
+ rrDashboardReports.logReportExecutionTime(userId, String.valueOf(totalTime),AppConstants.RLA_EXECUTION_TIME, formFields);
+ }
+
+ /*reportsRuntimeMap.put(new Integer(entry.getKey().toString()), rrDashboardReports);
+ reportDataMap.put(new Integer(entry.getKey().toString()), rd);
+ reportChartDataMap.put(new Integer(entry.getKey().toString()), ds);
+ reportDisplayTypeMap.put(new Integer(entry.getKey().toString()), entry.getValue().toString().substring(0,1));*/
+
+ reportsRuntimeMap.put(new Integer(entry.getKey().toString())+"_"+rrDashboardReports.getReportID(), rrDashboardReports);
+ reportDisplayTypeMap.put(new Integer(entry.getKey().toString())+"_"+rrDashboardReports.getReportID(), entry.getValue().toString().substring(0,1));
+ if(buildReportdata) {
+ reportDataMap.put(new Integer(entry.getKey().toString())+"_"+rrDashboardReports.getReportID(), rd);
+ reportChartDataMap.put(new Integer(entry.getKey().toString())+"_"+rrDashboardReports.getReportID(), ds);
+ }
+
+ }
+
+ /*if(widthFlag ==1) request.getSession().setAttribute("extendedWidth", "Y");
+ else request.getSession().removeAttribute("extendedWidth");
+ if(heightFlag ==1) request.getSession().setAttribute("extendedHeight", "Y");
+ else request.getSession().removeAttribute("extendedHeight");
+ */
+ request.getSession().setAttribute(AppConstants.SI_DASHBOARD_REPORTRUNTIME_MAP, new TreeMap(reportsRuntimeMap));
+ request.getSession().setAttribute(AppConstants.SI_DASHBOARD_DISPLAYTYPE_MAP, new TreeMap(reportDisplayTypeMap));
+ if(buildReportdata) {
+ request.getSession().setAttribute(AppConstants.SI_DASHBOARD_REPORTDATA_MAP, new TreeMap(reportDataMap));
+ request.getSession().setAttribute(AppConstants.SI_DASHBOARD_CHARTDATA_MAP, new TreeMap(reportChartDataMap));
+ }
+// debugLogger.debug("I am inside this if " + rr1.getReportType() + " "+rr1.getReportID());
+ request.getSession().setAttribute(AppConstants.SI_REPORT_RUNTIME, rr1); //changing session to request
+ //request.setAttribute(AppConstants.SI_REPORT_RUNTIME, rr1);
+ if((String) request.getSession().getAttribute(AppConstants.SI_DASHBOARD_REP_ID)!= null || rr1.getReportType().equals(AppConstants.RT_DASHBOARD)) {
+ request.getSession().setAttribute(AppConstants.SI_DASHBOARD_REPORTRUNTIME, rr1);
+ }
+
+ return "raptor/report_dashboard_run_container.jsp";
+ } else {
+ fromDashboard = AppUtils.getRequestFlag(request,"fromDashboard");
+ if(isDashboardInDrillDownList(request)) fromDashboard= true;
+
+ if(!fromDashboard) {
+ request.getSession().removeAttribute(AppConstants.SI_DASHBOARD_REPORTRUNTIME_MAP);
+ request.getSession().removeAttribute(AppConstants.SI_DASHBOARD_REPORTDATA_MAP);
+ request.getSession().removeAttribute(AppConstants.SI_DASHBOARD_CHARTDATA_MAP);
+ request.getSession().removeAttribute(AppConstants.SI_DASHBOARD_DISPLAYTYPE_MAP);
+ request.getSession().removeAttribute(AppConstants.SI_DASHBOARD_REP_ID);
+ request.getSession().removeAttribute(AppConstants.SI_DASHBOARD_REPORTRUNTIME);
+ request.getSession().removeAttribute(AppConstants.EMBEDDED_REPORTRUNTIME_MAP);
+ request.getSession().removeAttribute(AppConstants.EMBEDDED_REPORTDATA_MAP);
+ }
+ //String pdfAttachmentKey = AppUtils.getRequestValue(request, "pdfAttachmentKey");
+ String report_email_sent_log_id = AppUtils.getRequestValue(request, "log_id");
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Email PDF" + pdfAttachmentKey+" "+ report_email_sent_log_id));
+
+ //email pdf attachment specific
+ if(nvl(pdfAttachmentKey).length()>0 && report_email_sent_log_id !=null)
+ isEmailAttachment = true;
+ if(isEmailAttachment) {
+ /* String query = "Select user_id, rep_id from CR_REPORT_EMAIL_SENT_LOG" +
+ " where rownum = 1" +
+ " and gen_key='"+pdfAttachmentKey.trim()+"'" +
+ " and log_id ="+report_email_sent_log_id.trim() +
+ " and (sysdate - sent_date) < 1 ";*/
+
+
+ String query = Globals.getDownloadAllEmailSent();
+ query = query.replace("[pdfAttachmentKey.trim()]", pdfAttachmentKey.trim());
+ query = query.replace("[report_email_sent_log_id.trim()]", report_email_sent_log_id.trim());
+
+ DataSet ds = DbUtils.executeQuery(query, 1);
+ if(!ds.isEmpty()) {
+ userId = ds.getString(0,"user_id");
+ reportID = ds.getString(0, "rep_id");
+ request.setAttribute("schedule_email_userId", userId);
+ } else {
+ request.setAttribute("message", "This link has expired, please <a href=''>login</a> and regenerate the report");
+ return "raptor/message.jsp";
+ }
+ } else userId = AppUtils.getUserID(request);
+// debugLogger.debug("Report ID b4 showbutton in ActionHandler "
+// + ( request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)!=null?((ReportRuntime)request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME)).getReportID():"Not in session"));
+// debugLogger.debug("Report ID " + reportID + " " + reportIDFromSession);
+
+ // Scheduling Dashoard report
+ if(reportID !=null && nvl(pdfAttachmentKey).length()>0)
+ rr = rh1.loadReportRuntime(request, reportID, true, 1);
+ if(rr!=null && rr.getReportType().equals(AppConstants.RT_DASHBOARD) && nvl(pdfAttachmentKey).length()>0) {
+ int DASH=7;
+ int requestFlag = DASH;
+ ReportHandler rh = new ReportHandler();
+ request.getSession().setAttribute(AppConstants.SI_DASHBOARD_REP_ID, reportID);
+ //rr = null;
+ // get dashboard HTML from report runtime. getListOfReportsFromDashBoardHTML
+ String strHTML = rr.getDashboardLayoutHTML();
+ //System.out.println("StrHTML " + strHTML);
+ // call getListOfReportsFromDashBoardHTML returns HashMap
+
+ TreeMap treeMap = getListOfReportsFromDashBoardHTML(strHTML);
+ //System.out.println("Size " + hashMap.size());
+ Set set = treeMap.entrySet();
+ String value = "";
+
+ HashMap reportsRuntimeMap = new HashMap();
+ HashMap reportDataMap = new HashMap();
+ HashMap reportChartDataMap = new HashMap();
+ HashMap reportDisplayTypeMap = new HashMap();
+
+ userId = null;
+ userId = AppUtils.getUserID(request);
+ int pageNo = -1;
+ int downloadLimit = 0;
+ int rep_idx = 0;
+ int widthFlag = 0;
+ int heightFlag = 0;
+ ReportRuntime rrDashboardReports = null;
+ Integer intObj = null;
+ ReportRuntime similiarReportRuntime = null;
+ rd = null;
+ DataSet ds = null;
+ String reportIDFromMap = null;
+ int record = 0;
+ boolean buildReportdata = true;
+ for(Iterator iter = set.iterator(); iter.hasNext(); ) {
+ record++;
+ Map.Entry entry = (Entry) iter.next();
+
+ reportIDFromMap = entry.getValue().toString().substring(1);
+ similiarReportRuntime = getSimiliarReportRuntime(reportsRuntimeMap, reportIDFromMap);
+ if(similiarReportRuntime != null ) {
+ rrDashboardReports = getSimiliarReportRuntime(reportsRuntimeMap, reportIDFromMap);
+ intObj = getKey(reportsRuntimeMap,reportIDFromMap);
+ } else {
+ rrDashboardReports = rh.loadReportRuntime(request, reportIDFromMap, true, requestFlag);
+ }
+
+ downloadLimit = (rrDashboardReports.getMaxRowsInExcelDownload()>0)?rrDashboardReports.getMaxRowsInExcelDownload():Globals.getDownloadLimit();
+
+ if (new Integer(nvl(rrDashboardReports.getDataContainerWidth(),"100")).intValue() >100) widthFlag = 1;
+ if (new Integer(nvl(rrDashboardReports.getDataContainerHeight(),"100")).intValue() >100) heightFlag = 1;
+ if(record == 1) {
+ if(rrDashboardReports.getReportFormFields()!=null && rrDashboardReports.getReportFormFields().size()>0) {
+ buildReportdata = false;
+ if(rDisplayContent) buildReportdata = true;
+ }
+ }
+ if(buildReportdata) {
+ if(similiarReportRuntime != null ) {
+ rd = (ReportData) reportDataMap.get(intObj);
+ ds = (DataSet) reportChartDataMap.get(intObj);
+ } else {
+
+ if (!rrDashboardReports.getReportType().equals(AppConstants.RT_HIVE))
+ rd = rrDashboardReports.loadReportData(pageNo, userId, downloadLimit,request, false /*download*/);
+ else
+ rd = rrDashboardReports.loadHiveLinearReportData(rrDashboardReports.getReportSQL(), userId, 2,request);
+ ds = rrDashboardReports.loadChartData(userId,request);
+ }
+ }
+
+
+
+ long totalTime = System.currentTimeMillis() - currentTime;
+ formFields = AppUtils.getRequestNvlValue(request, "formFields");
+
+ rrDashboardReports.logReportRun(userId, String.valueOf(totalTime),formFields);
+ rrDashboardReports.logReportExecutionTime(userId, String.valueOf(totalTime),AppConstants.RLA_EXECUTION_TIME, formFields);
+
+ reportsRuntimeMap.put(new Integer(entry.getKey().toString()), rrDashboardReports);
+ reportDisplayTypeMap.put(new Integer(entry.getKey().toString()), entry.getValue().toString().substring(0,1));
+ if(buildReportdata) {
+ reportDataMap.put(new Integer(entry.getKey().toString()), rd);
+ reportChartDataMap.put(new Integer(entry.getKey().toString()), ds);
+ //reportDisplayTypeMap.put(new Integer(entry.getKey().toString()), entry.getValue().toString().substring(0,1));
+ }
+ }
+
+ /*if(widthFlag ==1) request.getSession().setAttribute("extendedWidth", "Y");
+ else request.getSession().removeAttribute("extendedWidth");
+ if(heightFlag ==1) request.getSession().setAttribute("extendedHeight", "Y");
+ else request.getSession().removeAttribute("extendedHeight");
+ */
+ request.getSession().setAttribute(AppConstants.SI_DASHBOARD_REPORTRUNTIME_MAP, new TreeMap(reportsRuntimeMap));
+ request.getSession().setAttribute(AppConstants.SI_REPORT_RUNTIME, rr); //changing session to request
+ if(buildReportdata) {
+ request.getSession().setAttribute(AppConstants.SI_DASHBOARD_DISPLAYTYPE_MAP, new TreeMap(reportDisplayTypeMap));
+ request.getSession().setAttribute(AppConstants.SI_DASHBOARD_REPORTDATA_MAP, new TreeMap(reportDataMap));
+ request.getSession().setAttribute(AppConstants.SI_DASHBOARD_CHARTDATA_MAP, new TreeMap(reportChartDataMap));
+ }
+ //request.setAttribute(AppConstants.SI_REPORT_RUNTIME, rr1);
+ //return nextPage;
+ } else {
+
+ // Ends
+
+
+// debugLogger.debug("Action Handler *****************" + new java.util.Date()+ " " + isGoBackAction);
+ ReportHandler rh = new ReportHandler();
+ //rr = null; // COMMENT THIS LINE
+ boolean resetParams = AppUtils.getRequestFlag(request,
+ AppConstants.RI_RESET_PARAMS);
+ boolean resetAction = AppUtils.getRequestFlag(request,
+ AppConstants.RI_RESET_ACTION);
+ boolean refresh = false;
+ if (resetAction) {
+ rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME);
+ resetParams=true;
+ refresh = true;
+ if(rr!=null) {
+ rr.setParamValues(request, resetParams,refresh);
+ request.getSession().removeAttribute(AppConstants.RI_REPORT_DATA);
+ rr.resetVisualSettings();
+ }
+ return nextPage;
+ }
+
+ /*if (isGoBackAction) {
+// debugLogger.debug("Report back in action handler " + ((ReportRuntime) request.getSession().getAttribute(
+// AppConstants.SI_REPORT_RUN_BACKUP))!=null?((ReportRuntime) request.getSession().getAttribute(
+// AppConstants.SI_REPORT_RUN_BACKUP)).getReportID():((ReportRuntime) request.getSession().getAttribute(
+// AppConstants.SI_REPORT_RUN_BACKUP)));
+ rr = null;
+ rr = getReportRuntimeFromBackup(request);
+ if (rr == null)
+ throw new Exception("[ActionHandler.reportRun] Report backup not found");
+ reportID = rr.getReportID();
+ } else {*/
+
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Ocurring during Schedule "));
+ //TODO differentiate Schedule with other actions
+// if(isEmailAttachment) {
+//
+// } else {
+//
+// }
+ rr = rh.loadReportRuntime(request, reportID);
+ //setParamValues called for Drilldown to display formfield
+ //rr.setParamValues(request, false,true);
+
+ //} // else
+
+ ArrayList aL = (ArrayList)request.getSession().getAttribute(AppConstants.DRILLDOWN_REPORTS_LIST);
+ ReportRuntime aLR = null;
+ if(aL != null) {
+// for (int i = 1; i < aL.size(); i++) {
+// aLR = (ReportRuntime) aL.get(i);
+// if (!aLR.getReportID().equals(reportID)) {
+// request.setAttribute(AppConstants.RI_SHOW_BACK_BTN, "Y");
+// }
+// }
+// if(reportID.equals(reportIDFromSession)) {
+ aLR = (ReportRuntime) aL.get(0);
+ if (aLR!=null && !aLR.getReportID().equals(reportID)) {
+ request.setAttribute(AppConstants.RI_SHOW_BACK_BTN, "Y");
+ }
+// }
+ }
+
+ if(rDisplayContent)
+ rr.setDisplayFlags(true, true);
+
+ if (rr.getDisplayContent()) {
+ int pageNo = 0;
+ if (isGoBackAction)
+ pageNo = rr.getCachedPageNo();
+ else {
+ try {
+ pageNo = Integer.parseInt(AppUtils.getRequestNvlValue(request, AppConstants.RI_NEXT_PAGE));
+ } catch (Exception e) {
+ }
+
+ String vAction = AppUtils.getRequestNvlValue(request,
+ AppConstants.RI_VISUAL_ACTION);
+ String vCoId = AppUtils.getRequestNvlValue(request,
+ AppConstants.RI_DETAIL_ID);
+ if (vAction.equals(AppConstants.VA_HIDE))
+ rr.hideColVisual(vCoId);
+ else if (vAction.equals(AppConstants.VA_SHOW))
+ rr.showColVisual(vCoId);
+ else if (vAction.equals(AppConstants.VA_SORT)) {
+ rr.sortColVisual(vCoId);
+ pageNo = 0;
+ } // else
+ } // else
+
+ int downloadLimit = (rr.getMaxRowsInExcelDownload()>0)?rr.getMaxRowsInExcelDownload():Globals.getDownloadLimit();
+ if(isEmailAttachment) {
+ String limit = nvl(request.getParameter("download_limit"),"1000");
+ downloadLimit = Integer.parseInt(limit);
+ }
+ //if (action.startsWith("mobile")) rr.setPageSize(5);
+ long reportTime = System.currentTimeMillis();
+ if (!rr.getReportType().equals(AppConstants.RT_HIVE))
+ rd = rr.loadReportData(pageNo, userId, downloadLimit,request,false /*download*/);
+ else
+ rd = rr.loadHiveLinearReportData(rr.getReportSQL(), userId, 2,request);
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[DEBUG MESSAGE FROM RAPTOR] ------->Time Taken for the loading report data --- " + (System.currentTimeMillis() - reportTime)));
+ ReportData rd_whole = null;
+ boolean hideReportMap = rr.isDisplayOptionHideMap()||AppUtils.getRequestNvlValue(request, "noMap").equals("Y");
+/* if (Globals.getMapAllowedYN().equals("Y") && !hideReportMap && rr.getReportMap()!=null){
+ rd_whole = rr.loadReportData(-1, userId, downloadLimit,request);
+ }
+*/
+ request.getSession().setAttribute(AppConstants.RI_REPORT_DATA, rd);
+ //if (Globals.getMapAllowedYN().equals("Y") && !hideReportMap && (rr.getReportMap()!=null && rr.getReportMap().getLatColumn()!=null && rr.getReportMap().getLongColumn()!=null)) {
+ if(rr!=null && rr.getReportType().equals(AppConstants.RT_LINEAR)) {
+ String sql_whole = rr.getReportDataSQL(userId, downloadLimit, request);
+ request.setAttribute(AppConstants.RI_REPORT_SQL_WHOLE, sql_whole);
+ } else if(rr.getReportType().equals(AppConstants.RT_HIVE)) {
+ String sql_whole = rr.getReportSQL();
+ request.setAttribute(AppConstants.RI_REPORT_SQL_WHOLE, sql_whole);
+ }
+ //}
+ //request.setAttribute(AppConstants.RI_REPORT_DATA_WHOLE, rd_whole);
+ // if(rr.getReportDataSize() > Globals.getFlatFileLowerLimit() && rr.getReportDataSize() <= Globals.getFlatFileUpperLimit() ) {
+ // rr.setFlatFileName(rh.saveFlatFile(request, rd, rr
+ // .getParamNameValuePairs(), rr.getReportName(), rr.getReportDescr()));
+ // }
+ //if(actionKey!=null && actionKey.equals("report.download")) {
+// rr.setExcelPageFileName(rh.saveAsExcelFile(request, rd, rr
+// .getParamNameValuePairs(), rr.getReportName(), rr.getReportDescr()));
+ //}
+ if (!rr.getReportType().equals(AppConstants.RT_HIVE)) {
+ long currentChartTime = System.currentTimeMillis();
+ DataSet chartDS = rr.loadChartData(userId,request);
+ if(chartDS != null)
+ request.getSession().setAttribute(AppConstants.RI_CHART_DATA, rr.loadChartData(userId,request));
+ else
+ request.getSession().removeAttribute(AppConstants.RI_CHART_DATA);
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[DEBUG MESSAGE FROM RAPTOR] ------->Time Taken for the loading chart data --- " + (System.currentTimeMillis() - currentChartTime)));
+ }
+
+/* if((String) request.getSession().getAttribute(AppConstants.SI_DASHBOARD_REP_ID)!=null) {
+ request.getSession().setAttribute("FirstDashReport", rr);
+ }
+*/
+ }
+ request.getSession().setAttribute(AppConstants.SI_REPORT_RUNTIME, rr); //changing session to request
+ request.getSession().setAttribute(AppConstants.RI_REPORT_DATA, rd);
+ } // else
+ long totalTime = System.currentTimeMillis() - currentTime;
+ formFields = AppUtils.getRequestNvlValue(request, "formFields");
+ request.setAttribute(AppConstants.RLA_EXECUTION_TIME, "" + totalTime);
+
+
+ boolean isFromReportLog = AppUtils.getRequestFlag(request, "fromReportLog");
+ if(!isFromReportLog) {
+ if(pdfAttachmentKey!=null && pdfAttachmentKey.length()>0) {
+ if(actionKey.equals("report.download")) {
+ rr.logReportExecutionTime(userId, String.valueOf(totalTime),AppConstants.RLA_SCHEDULED_DOWNLOAD_EXCEL, formFields);
+ } else if (actionKey.equals("report.download.pdf")) {
+ rr.logReportExecutionTime(userId, String.valueOf(totalTime),AppConstants.RLA_SCHEDULED_DOWNLOAD_PDF, formFields);
+ }
+ } else {
+ if(actionKey.equals("report.download") ) {
+ rr.logReportExecutionTime(userId, String.valueOf(totalTime),AppConstants.RLA_DOWNLOAD_EXCEL, formFields);
+ } else if (actionKey.equals("report.download.pdf")) {
+ rr.logReportExecutionTime(userId, String.valueOf(totalTime),AppConstants.RLA_DOWNLOAD_PDF, formFields);
+ } else if (actionKey.equals("report.csv.download")) {
+ rr.logReportExecutionTime(userId, String.valueOf(totalTime),AppConstants.RLA_DOWNLOAD_CSV, formFields);
+ } else if (actionKey.equals("report.text.download")) {
+ rr.logReportExecutionTime(userId, String.valueOf(totalTime),AppConstants.RLA_DOWNLOAD_TEXT, formFields);
+ } else {
+
+ //rr.logReportRun(userId, String.valueOf(totalTime),formFields);
+ if(rd!=null && !action.equals("report.run.container"))
+ rr.logReportExecutionTime(userId, String.valueOf(totalTime),AppConstants.RLA_EXECUTION_TIME, formFields);
+ }
+ }
+ } else {
+ rr.logReportExecutionTimeFromLogList(userId, String.valueOf(totalTime),formFields);
+ }
+
+/* if((String) request.getSession().getAttribute(AppConstants.SI_DASHBOARD_REP_ID)!=null) {
+ reportID = (String) request.getSession().getAttribute(AppConstants.SI_DASHBOARD_REP_ID);
+ ReportRuntime rrDash = rh1.loadReportRuntime(request, reportID, true, 1);
+ request.getSession().setAttribute(AppConstants.SI_REPORT_RUNTIME, rrDash);
+ }
+*/
+ if(rr.isDrillDownURLInPopupPresent()) {
+ request.getSession().setAttribute("parent_"+rr.getReportID()+"_rr", rr);
+ request.getSession().setAttribute("parent_"+rr.getReportID()+"_rd", rd);
+ }
+
+ if(rr.getReportType().equals(AppConstants.RT_CROSSTAB)) {
+ return "raptor/report_crosstab_run_container.jsp";
+ } else if (rr.getReportType().equals(AppConstants.RT_HIVE) && !isEmailAttachment) {
+ return "raptor/report_hive_run_container.jsp";
+ }
+ } // else
+
+ boolean isEmbedded = false;
+ Object temp = request.getSession().getAttribute("isEmbedded");
+ if(temp!=null){
+ isEmbedded = (boolean)temp;
+ }
+ if(isEmbedded && !action.equals("chart.run")){
+ HashMap embeddedReportsRuntimeMap = null;
+ HashMap embeddedReportsDataMap = null;
+ if(request.getSession().getAttribute(AppConstants.EMBEDDED_REPORTRUNTIME_MAP)!= null){
+ embeddedReportsRuntimeMap = (HashMap)request.getSession().getAttribute(AppConstants.EMBEDDED_REPORTRUNTIME_MAP);
+ } else {
+ embeddedReportsRuntimeMap = new HashMap();
+ }
+ if(request.getSession().getAttribute(AppConstants.EMBEDDED_REPORTDATA_MAP)!= null){
+ embeddedReportsDataMap = (HashMap)request.getSession().getAttribute(AppConstants.EMBEDDED_REPORTDATA_MAP);
+ } else {
+ embeddedReportsDataMap = new HashMap();
+ }
+ embeddedReportsRuntimeMap.put(rr.getReportID(), rr);
+ embeddedReportsDataMap.put(rr.getReportID(), rd);
+
+
+ request.getSession().setAttribute(AppConstants.EMBEDDED_REPORTRUNTIME_MAP, embeddedReportsRuntimeMap);
+ request.getSession().setAttribute(AppConstants.EMBEDDED_REPORTDATA_MAP, embeddedReportsDataMap);
+
+ }
+
+ ReportJSONRuntime reportJSONRuntime = rr.createReportJSONRuntime(request, rd);
+ ObjectMapper mapper = new ObjectMapper();
+ //mapper.setVisibility(JsonMethod.FIELD, Visibility.ANY);
+ //mapper.setVisibilityChecker(mapper.getVisibilityChecker().with(JsonAutoDetect.Visibility.NONE));
+ mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ String jsonInString = "";
+ try {
+ jsonInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(reportJSONRuntime);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+
+ }
+ return jsonInString;
+ } catch (RaptorException e) {
+ try {
+ e.printStackTrace();
+
+ if(rr!=null) { // when user tries report they don't have access this should not throw exception that's why this if is added.
+ if(isEmailAttachment)
+ rr.logReportExecutionTime(userId, "", "Scheduled: " + AppConstants.RLA_ERROR, formFields);
+ else
+ rr.logReportExecutionTime(userId, "", "On Demand: " + AppConstants.RLA_ERROR, formFields);
+ }
+
+ ErrorJSONRuntime errorJSONRuntime = new ErrorJSONRuntime();
+ errorJSONRuntime.setErrormessage(e.getMessage());
+ errorJSONRuntime.setStacktrace(getStackTrace(e));
+ ObjectMapper mapper = new ObjectMapper();
+ //mapper.setVisibility(JsonMethod.FIELD, Visibility.ANY);
+ //mapper.setVisibilityChecker(mapper.getVisibilityChecker().with(JsonAutoDetect.Visibility.NONE));
+ mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ String jsonInString = "";
+ try {
+ jsonInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(errorJSONRuntime);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+
+ }
+ return jsonInString;
+
+ } catch (RaptorException ex) {
+ nextPage = (new ErrorHandler()).processFatalError(request, ex);
+ ErrorJSONRuntime errorJSONRuntime = new ErrorJSONRuntime();
+ errorJSONRuntime.setErrormessage(ex.getMessage());
+ errorJSONRuntime.setStacktrace(getStackTrace(ex));
+ ObjectMapper mapper = new ObjectMapper();
+ //mapper.setVisibility(JsonMethod.FIELD, Visibility.ANY);
+ //mapper.setVisibilityChecker(mapper.getVisibilityChecker().with(JsonAutoDetect.Visibility.NONE));
+ mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ String jsonInString = "";
+ try {
+ jsonInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(errorJSONRuntime);
+ } catch (Exception ex1) {
+ ex1.printStackTrace();
+ }
+ return jsonInString;
+ }
+ //nextPage = (new ErrorHandler()).processFatalError(request, e);
+ } catch (Throwable t) {
+ t.printStackTrace();
+ ErrorJSONRuntime errorJSONRuntime = new ErrorJSONRuntime();
+ errorJSONRuntime.setErrormessage(t.toString());
+ errorJSONRuntime.setStacktrace(getStackTrace(t));
+ ObjectMapper mapper = new ObjectMapper();
+ //mapper.setVisibility(JsonMethod.FIELD, Visibility.ANY);
+ //mapper.setVisibilityChecker(mapper.getVisibilityChecker().with(JsonAutoDetect.Visibility.NONE));
+ mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ String jsonInString = "";
+ try {
+ jsonInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(errorJSONRuntime);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+
+ }
+ return jsonInString;
+
+ }
+ //return nextPage;
+ } // reportRun
+
+ public static String getStackTrace(Throwable aThrowable) {
+ Writer result = new StringWriter();
+ PrintWriter printWriter = new PrintWriter(result);
+ aThrowable.printStackTrace(printWriter);
+ return result.toString();
+ }
+
+ /**
+ * The below method is used to optimize, so that if there is already same report id in hashMap it wouldn't go through the whole process again.
+ **/
+ private ReportRuntime getSimiliarReportRuntime(HashMap reportsRuntimeMap, String reportID) {
+ Set set = reportsRuntimeMap.entrySet();
+ for(Iterator iter = set.iterator(); iter.hasNext(); ) {
+ Map.Entry entry = (Entry) iter.next();
+ if (((ReportRuntime) entry.getValue()).getReportID().equals(reportID)) {
+ return (ReportRuntime) entry.getValue();
+ }
+ }
+ return null;
+ }
+
+ private Integer getKey(HashMap reportsRuntimeMap, String reportID) {
+ Set set = reportsRuntimeMap.entrySet();
+ for(Iterator iter = set.iterator(); iter.hasNext(); ) {
+ Map.Entry entry = (Entry) iter.next();
+ if (((ReportRuntime) entry.getValue()).getReportID().equals(reportID)) {
+ return new Integer(((String) entry.getKey()).substring(2));
+ }
+ }
+ return null;
+ }
+
+ public String reportSearch(HttpServletRequest request, String nextPage) {
+ return reportSearchExecute(request, nextPage);
+ } // reportSearch
+
+ public String reportSearchUser(HttpServletRequest request, String nextPage) {
+ removeVariablesFromSession(request);
+ request.setAttribute(AppConstants.RI_USER_REPORTS, "Y");
+ return reportSearchExecute(request, nextPage);
+ } // reportSearchUser
+
+ public String reportSearchPublic(HttpServletRequest request, String nextPage) {
+ removeVariablesFromSession(request);
+ request.setAttribute(AppConstants.RI_PUBLIC_REPORTS, "Y");
+ return reportSearchExecute(request, nextPage);
+ } // reportSearchPublic
+
+ public String reportSearchFavorites(HttpServletRequest request, String nextPage) {
+ removeVariablesFromSession(request);
+ request.setAttribute(AppConstants.RI_FAVORITE_REPORTS, "Y");
+ return reportSearchExecute(request, nextPage);
+ } // reportSearchFavorites
+
+ public String reportSearchExecute(HttpServletRequest request, String nextPage) {
+ removeVariablesFromSession(request);
+ try {
+ SearchHandler sh = new SearchHandler();
+ ReportSearchResultJSON sr = sh.loadReportSearchResult(request);
+ return sr.getJSONString();
+ //request.setAttribute(AppConstants.RI_SEARCH_RESULT, sr);
+ } catch (RaptorException e) {
+ nextPage = (new ErrorHandler()).processFatalError(request, e);
+ }
+
+ return nextPage;
+ } // reportSearchExecute
+
+ public String reportChartRun(HttpServletRequest request, String nextPage) {
+ ChartWebRuntime cwr = new ChartWebRuntime();
+ return cwr.generateChart(request, false); //no data
+ } // reportSearchExecute
+
+ public String reportChartDataRun(HttpServletRequest request, String nextPage) {
+ ChartWebRuntime cwr = new ChartWebRuntime();
+ return cwr.generateChart(request); //data
+ } // reportSearchExecute
+
+
+ // public String reportRunExecute(HttpServletRequest request, String nextPage) {
+// try {
+// ReportRunHandler rh = new ReportRunHandler();
+// ReportRunResultJSON sr = rh.loadReportRunResult(request);
+// return sr.getJSONString();
+// //request.setAttribute(AppConstants.RI_SEARCH_RESULT, sr);
+// } catch (RaptorException e) {
+// nextPage = (new ErrorHandler()).processFatalError(request, e);
+// }
+//
+// return nextPage;
+// }
+
+ public String getQuickLinksJSON(HttpServletRequest request, String nextPage) {
+ String jsonInString = null;
+ try {
+ ArrayList<QuickLink> quickLinks = ReportLoader.getQuickLinksJSON(request, request.getParameter("quick_links_menu_id"),true);
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ jsonInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(quickLinks);
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return jsonInString;
+ }
+
+ public String processScheduleReportList(HttpServletRequest request, String nextPage) {
+ String reportID = "";
+ reportID = AppUtils.getRequestNvlValue(request, "schedule_reports");
+ if (nvl(reportID).length()<=0)
+ reportID = AppUtils.getRequestNvlValue(request, AppConstants.RI_REPORT_ID);
+ // Added for form field chaining in schedule tab so that setParamValues() is called
+ request.setAttribute(AppConstants.SCHEDULE_ACTION, "Y");
+
+ try {
+ boolean isAdmin = AppUtils.isAdminUser(request);
+ boolean check = ReportLoader.doesUserCanScheduleReport(request, null);
+
+ logger.debug(EELFLoggerDelegate.debugLogger, ("^^^^^^^^^^^^^Check " + check + " Admin "+ isAdmin));
+
+ if(check || isAdmin) {
+ if(reportID.length()>0) {
+ ReportHandler rh = new ReportHandler();
+ ReportDefinition rdef = rh.loadReportDefinition(request, reportID);
+ request.getSession().setAttribute(AppConstants.SI_REPORT_DEFINITION, rdef);
+ ReportSchedule reportSchedule = null;
+ if(rdef!=null) {
+ reportSchedule = new ReportSchedule(reportID, AppUtils.getUserID(request), false, request);
+ }
+ request.getSession().setAttribute(AppConstants.SI_REPORT_SCHEDULE, reportSchedule);
+ }
+ } else {
+ //String message = "You have reached your schedule limit. Please visit this page again after removing your old schedules in \"My Schedule\" section.";
+ String message = "You have reached the scheduled report limit for your Login ID. Please remove any old schedule requests in the \"My Scheduled Reports\" screen before attempting to schedule any additional reports.";
+ nextPage = (new ErrorHandler()).processFatalError(request, new RaptorSchedularException(message));
+ }
+
+ } catch(Exception ex) { ex.printStackTrace();}
+ return nextPage;
+ }
+
+ public String processSchedule(HttpServletRequest request, String nextPage) {
+
+ // Added for form field chaining in schedule tab so that setParamValues() is called
+
+ request.setAttribute(AppConstants.SCHEDULE_ACTION, "Y");
+ if(request.getSession().getAttribute(AppConstants.SI_REPORT_SCHEDULE)!=null && (!AppUtils.getRequestNvlValue(request, AppConstants.RI_ACTION).equals("report.schedule_only_from_search"))) {
+ String action = nvl(request.getParameter(AppConstants.RI_WIZARD_ACTION),
+ AppConstants.WA_BACK);
+ String scheduleID = "";
+ scheduleID = AppUtils.getRequestValue(request, AppConstants.RI_SCHEDULE_ID);
+ ReportSchedule reportSchedule = null;
+
+ if( nvl(scheduleID).length() <= 0) {
+ reportSchedule = (ReportSchedule) request.getSession().getAttribute(AppConstants.SI_REPORT_SCHEDULE);
+ scheduleID = reportSchedule.getScheduleID();
+ }
+
+ String reportID = AppUtils.getRequestValue(request, AppConstants.RI_REPORT_ID);
+ try {
+ boolean isAdmin = AppUtils.isAdminUser(request);
+ boolean check = ReportLoader.doesUserCanScheduleReport(request, scheduleID);
+ if(!isAdmin && !check) {
+ String message = "You have reached the scheduled report limit for your Login ID. Please remove any old schedule requests in the My Scheduled Reports screen before attempting to schedule any additional reports.";
+ nextPage = (new ErrorHandler()).processFatalError(request, new RaptorSchedularException(message));
+ return nextPage;
+ }
+
+ } catch (Exception ex) { ex.printStackTrace();}
+ if(reportSchedule == null) reportSchedule = new ReportSchedule(reportID, scheduleID, AppUtils.getUserID(request), request);
+ String formFields = "";
+ formFields = reportSchedule.getFormFields();
+ formFields = (formFields.length()>1)?formFields.substring(1):formFields;
+ String formFieldsArr[] = formFields.split("&");
+ String sessionParams[] = Globals.getSessionParamsForScheduling().split(",");
+
+ for (int i=0; i<sessionParams.length; i++) {
+ for (int j = 0; j < formFieldsArr.length; j++) {
+ if(formFieldsArr[j].startsWith(sessionParams[i])) {
+ request.setAttribute(sessionParams[i], formFieldsArr[j].substring(formFieldsArr[j].indexOf("=")+1));
+ }
+
+ }
+ }
+
+ boolean reportUpdated = false;
+ WizardProcessor wp = null;
+ Connection connection = null;
+ try {
+ connection = DbUtils.startTransaction();
+ wp = new WizardProcessor();
+ String toListUpdated = nvl(request.getParameter("toListUpdated"),"false" );
+ reportUpdated = wp.processAdhocSchedule(request, action);
+ if(reportUpdated && toListUpdated.equals("false")) {
+ request.setAttribute("message", "Report has been scheduled successfully");
+ reportSchedule = (ReportSchedule) request.getSession().getAttribute(AppConstants.SI_REPORT_SCHEDULE);
+ //if(AppUtils.getRequestNvlValue(request, AppConstants.RI_SCHEDULE_ID).length()<=0) {
+ reportSchedule.persistScheduleData(connection, request);
+ DbUtils.commitTransaction(connection);
+ //}
+ }
+ } catch (ValidationException ve) {
+ (new ErrorHandler()).processError(request, ve);
+ } catch (RaptorException e) {
+ nextPage = (new ErrorHandler()).processFatalError(request, e);
+ e.printStackTrace();
+ try {
+ DbUtils.rollbackTransaction(connection);
+ } catch (Exception e1) {e1.printStackTrace();}
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ finally {
+ try {
+ DbUtils.clearConnection(connection);
+ } catch (Exception e1) {e1.printStackTrace();}
+ }
+ request.setAttribute("schedule_only", "Y");
+ //request.getSession().removeAttribute(AppConstants.SI_REPORT_SCHEDULE);
+
+ return nextPage;
+ } else {
+ try {
+ String scheduleID = "";
+ scheduleID = AppUtils.getRequestValue(request, AppConstants.RI_SCHEDULE_ID);
+ String reportID = AppUtils.getRequestValue(request, AppConstants.RI_REPORT_ID);
+ request.setAttribute("schedule_only", "Y");
+ ReportHandler rh = new ReportHandler();
+ ReportDefinition rdef = rh.loadReportDefinition(request, reportID);
+ ReportSchedule reportSchedule = null;
+ if(rdef!=null) {
+ reportSchedule = new ReportSchedule(reportID, scheduleID, AppUtils.getUserID(request), request);
+ }
+ String formFields = "";
+ formFields = reportSchedule.getFormFields();
+ formFields = (formFields.length()>1)?formFields.substring(1):formFields;
+ String formFieldsArr[] = formFields.split("&");
+ String sessionParams[] = Globals.getSessionParamsForScheduling().split(",");
+
+ for (int i=0; i<sessionParams.length; i++) {
+ for (int j = 0; j < formFieldsArr.length; j++) {
+ if(formFieldsArr[j].startsWith(sessionParams[i])) {
+ request.setAttribute(sessionParams[i], formFieldsArr[j].substring(formFieldsArr[j].indexOf("=")+1));
+ }
+
+ }
+ }
+ request.getSession().setAttribute(AppConstants.SI_REPORT_SCHEDULE, reportSchedule);
+ request.getSession().setAttribute(AppConstants.SI_REPORT_DEFINITION, rdef);
+ } catch (RaptorException e) {
+ nextPage = (new ErrorHandler()).processFatalError(request, e);
+ }
+
+ return nextPage;
+ }
+ } // processSchedule
+
+ /****Remove Report Data from Session when Javascript throw error on onSubmit***/
+ public String removeReportDataFromSession (HttpServletRequest request, String nextPage) {
+ HttpSession session = request.getSession(false);
+/* if (session.getAttribute(AppConstants.RI_REPORT_DATA)!=null)
+ request.getSession().removeAttribute(AppConstants.RI_REPORT_DATA);
+ if (request.getAttribute(AppConstants.RI_REPORT_DATA)!=null)
+ request.removeAttribute(AppConstants.RI_REPORT_DATA);
+ if (session.getAttribute(AppConstants.RI_CHART_DATA)!=null)
+ request.getSession().removeAttribute(AppConstants.RI_CHART_DATA);
+ if (request.getAttribute(AppConstants.RI_CHART_DATA)!=null)
+ request.removeAttribute(AppConstants.RI_CHART_DATA);
+*/ /*if (session.getAttribute(AppConstants.SI_REPORT_RUNTIME)!=null)
+ request.getSession().removeAttribute(AppConstants.SI_REPORT_RUNTIME);*/
+ //request.setAttribute(AppConstants.RI_RESET_ACTION, "Y");
+ return nextPage;
+
+ } // processScheduleDelete
+
+ /****Added to delete a schedule***/
+ public String processScheduleDelete(HttpServletRequest request, String nextPage) {
+
+ // Added for form field chaining in schedule tab so that setParamValues() is called
+ request.setAttribute(AppConstants.SCHEDULE_ACTION, "Y");
+ try {
+ String scheduleID = "";
+ scheduleID = AppUtils.getRequestValue(request, AppConstants.RI_SCHEDULE_ID);
+ String reportID = AppUtils.getRequestValue(request, AppConstants.RI_REPORT_ID);
+ ReportHandler rh = new ReportHandler();
+ ReportDefinition rdef = rh.loadReportDefinition(request, reportID);
+ String myScheduleRepID = AppUtils.getRequestNvlValue(request, "myScheduleRepId");
+ if (myScheduleRepID.equals(""))
+ myScheduleRepID = "2670";
+ ReportSchedule reportSchedule = null;
+ if(rdef!=null) {
+ reportSchedule = new ReportSchedule(reportID, scheduleID, AppUtils.getUserID(request), request);
+ Connection connection = null;
+
+ try {
+ connection = DbUtils.startTransaction();
+ reportSchedule.deleteScheduleData(connection);
+ DbUtils.commitTransaction(connection);
+ } catch (ValidationException ve) {
+ (new ErrorHandler()).processError(request, ve);
+ } catch (RaptorException e) {
+ nextPage = (new ErrorHandler()).processFatalError(request, e);
+ e.printStackTrace();
+ try {
+ DbUtils.rollbackTransaction(connection);
+ } catch (Exception e1) {e1.printStackTrace();}
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ finally {
+ try {
+ DbUtils.clearConnection(connection);
+ } catch (Exception e1) {e1.printStackTrace();}
+ }
+ }
+ request.setAttribute(AppConstants.RI_REPORT_ID, myScheduleRepID);
+ request.setAttribute(AppConstants.RI_REFRESH, "y");
+ nextPage = this.reportRun(request, nextPage);
+ } catch (RaptorException e) {
+ nextPage = (new ErrorHandler()).processFatalError(request, e);
+ }
+ return nextPage;
+
+ } // processScheduleDelete
+
+ public String reportWizard(HttpServletRequest request, String nextPage) {
+ String action = nvl(request.getParameter(AppConstants.RI_WIZARD_ACTION),
+ AppConstants.WA_BACK);
+ String goToStep = nvl(request.getParameter(AppConstants.RI_GO_TO_STEP));
+ try {
+ (new WizardProcessor()).processWizardStep(request);
+
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+ WizardSequence ws = rdef.getWizardSequence();
+ //debugLogger.debug("Step Count " + ws.getStepCount());
+ //debugLogger.debug("Dashboard " + ((ws instanceof WizardSequenceDashboard) ? ws.getStepCount(): "Not a Dashboard"));
+ //debugLogger.debug("GO TO STEP LENGTH " + goToStep.length());
+ //debugLogger.debug("NumDash Cols in Action Handler " + AppUtils.getRequestNvlValue(request, "numDashCols"));
+ if (goToStep.length() > 0)
+ ws.performGoToStep(goToStep);
+ else
+ ws.performAction(action, rdef);
+ } catch (ValidationException ve) {
+ (new ErrorHandler()).processError(request, ve);
+ } catch (RaptorException e) {
+ nextPage = (new ErrorHandler()).processFatalError(request, e);
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+
+ return nextPage;
+ } // reportWizard
+
+ public String refreshCache ( HttpServletRequest request, String nextPage ) {
+ //DataCache.refreshReportTableSources();
+ removeVariablesFromSession(request);
+ DataCache.refreshAll();
+ Globals.getAppUtils().resetUserCache();
+ request.setAttribute("message", "Cache Refreshed");
+ return nextPage;
+ }
+ public String reportCreate(HttpServletRequest request, String nextPage) {
+ try {
+ removeVariablesFromSession(request);
+ ReportDefinition rdef = ReportDefinition.createBlank(request);
+
+ request.getSession().setAttribute(AppConstants.SI_REPORT_DEFINITION, rdef);
+ // request.setAttribute(AppConstants.RI_CUR_STEP,
+ // AppConstants.WS_DEFINITION);
+ DataCache.refreshReportTableSources();
+ request.getSession().removeAttribute("remoteDB");
+ } catch (RaptorException e) {
+ nextPage = (new ErrorHandler()).processFatalError(request, e);
+ }
+
+ return nextPage;
+ } // reportCreate
+
+ public String reportImportSave(HttpServletRequest request, String nextPage) {
+ try {
+ String reportXML = nvl(AppUtils.getRequestValue(request, "reportXML")).trim();
+
+ ReportHandler rh = new ReportHandler();
+ ReportDefinition rdef = rh.createReportDefinition(request, "-1", reportXML);
+ rdef.updateReportDefType();
+ rdef.generateWizardSequence(request);
+ rdef.setReportName("Import: " + rdef.getReportName());
+ rdef.clearAllDrillDowns();
+
+ request.getSession().setAttribute(AppConstants.SI_REPORT_DEFINITION, rdef);
+ } catch (RaptorException e) {
+ request.setAttribute("error_extra_msg", "Unable to parse XML. Nested error: ");
+ nextPage = (new ErrorHandler()).processFatalError(request, e);
+ }
+
+ return nextPage;
+ } // reportImportSave
+
+ private String reportLoad(HttpServletRequest request, String nextPage, boolean asCopy) {
+ try {
+ String reportID = AppUtils.getRequestValue(request, AppConstants.RI_REPORT_ID);
+
+ ReportHandler rh = new ReportHandler();
+ ReportDefinition rdef = rh.loadReportDefinition(request, reportID);
+ if (asCopy)
+ rdef.setAsCopy(request);
+ else
+ rdef.checkUserWriteAccess(request);
+
+ rdef.getWizardSequence().performGoToStep(AppConstants.WS_DEFINITION);
+ request.getSession().setAttribute(AppConstants.SI_REPORT_DEFINITION, rdef);
+ // request.setAttribute(AppConstants.RI_CUR_STEP,
+ // AppConstants.WS_DEFINITION);
+ } catch (RaptorException e) {
+ nextPage = (new ErrorHandler()).processFatalError(request, e);
+ }
+
+ return nextPage;
+ } // reportLoad
+
+ public String reportCopy(HttpServletRequest request, String nextPage) {
+ return reportLoad(request, nextPage, true);
+ } // reportCopy
+
+ public String reportEdit(HttpServletRequest request, String nextPage) {
+ return reportLoad(request, nextPage, false);
+ } // reportEdit
+
+ public String reportDelete(HttpServletRequest request, String nextPage) {
+ try {
+ String reportID = AppUtils.getRequestValue(request, AppConstants.RI_REPORT_ID);
+ try {
+ int i = Integer.parseInt(reportID);
+ } catch(NumberFormatException ex) {
+ throw new UserDefinedException("Not a valid report id");
+ }
+ String userID = AppUtils.getUserID(request);
+
+ (new ReportSecurity(reportID)).checkUserDeleteAccess(request);
+
+ ReportLoader.deleteReportRecord(reportID);
+
+ return "{\"deleted\":true}";
+ //nextPage = reportSearchExecute(request, nextPage);
+ } catch (RaptorException e) {
+ nextPage = (new ErrorHandler()).processFatalError(request, e);
+ }
+
+ //return nextPage;
+ return "{\"deleted\":false}";
+ } // reportDelete
+
+ private String generateSearchString(HttpServletRequest request) {
+ String searchString = AppUtils.getRequestNvlValue(request, AppConstants.RI_SEARCH_STRING);
+ boolean containFlag = AppUtils.getRequestFlag(request, AppConstants.RI_CONTAIN_FLAG);
+ return (searchString.length() > 0) ? ((containFlag ? "%" : "") + searchString + "%"):"";
+ } // generateSearchString
+
+ public String reportFormFieldPopup(HttpServletRequest request, String nextPage) {
+ try {
+ ReportRuntime rr = (ReportRuntime) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_RUNTIME);
+
+ FormField ff = rr.getFormField(request.getParameter(AppConstants.RI_FIELD_NAME));
+ ReportFormFields rff = rr.getReportFormFields();
+
+ int idx = 0;
+ FormField ff1 = null;
+ Map fieldNameMap = new HashMap();
+ int countOfFields = 0 ;
+ String userId = AppUtils.getUserID(request);
+ IdNameList lookup = ff.getLookupList();
+ String oldSQL = lookup.getOldSql();
+
+ if(AppUtils.getRequestFlag(request, AppConstants.RI_TEXTFIELD_POP)) {
+ for(rff.resetNext(); rff.hasNext(); idx++) {
+ ff1 = rff.getNext();
+ fieldNameMap.put(ff1.getFieldName(), ff1.getFieldDisplayName());
+ countOfFields++;
+ }
+
+
+ //List formParameter = new ArrayList();
+ String formField = "";
+ HashMap valuesMap = new HashMap();
+ for(int i = 0 ; i < rff.size(); i++) {
+ formField = ((FormField)rff.getFormField(i)).getFieldName();
+ if(request.getParameterValues(formField) != null && request.getParameterValues(formField).length > 1 ) {
+ String[] vals = (String[]) request.getParameterValues(formField);
+ String value = "";
+ StringBuffer valueBuf = new StringBuffer();
+ for(int ii = 0 ; ii < vals.length; ii++) {
+ if(ii == 0) valueBuf.append("(");
+ valueBuf.append(vals[ii]);
+ if(ii == vals.length-1) valueBuf.append(")");
+ else valueBuf.append(",");
+ }
+ value = valueBuf.toString();
+ valuesMap.put(fieldNameMap.get(formField), value);
+ } else if(request.getParameter(formField) != null) {
+ valuesMap.put(fieldNameMap.get(formField), request.getParameter(formField));
+ }
+ }
+ if(countOfFields != 0) {
+ IdNameSql lu = (IdNameSql) lookup;
+ String SQL = (oldSQL==null)?lu.getSql():oldSQL;
+ oldSQL = SQL;
+ Set set = valuesMap.entrySet();
+ String value = "";
+ StringBuffer valueBuf = new StringBuffer();
+ for(Iterator iter = set.iterator(); iter.hasNext(); ) {
+ Map.Entry entry = (Entry) iter.next();
+ if(entry.getValue() instanceof String[]) {
+ String[] vals = (String[]) entry.getValue();
+ for(int i = 0 ; i < vals.length; i++) {
+ if(i == 0) valueBuf.append("(");
+ valueBuf.append(vals[i]);
+ if(i == vals.length-1) valueBuf.append(")");
+ else valueBuf.append(",");
+ }
+ value = valueBuf.toString();
+ } else {
+ value = (String) entry.getValue();
+ }
+ // added so empty string would be treated as null value if not given in single quotes.
+ if(value==null || value.trim().length()<=0) value="NULL";
+ SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", Utils.oracleSafe(value));
+ }
+ if(request.getParameter(ff.getFieldName())!=null) {
+ lookup = new IdNameSql(-1,SQL,null);
+ lookup.setOldSql(oldSQL);
+ }
+ else {
+ lookup = new IdNameSql(-1,SQL,lu.getDefaultSQL());
+ lookup.setOldSql(oldSQL);
+ }
+ //lookup.loadData("0");
+ }
+ if(lookup instanceof IdNameSql) ((IdNameSql)lookup).setDataSizeUsedinPopup(-3); // -3 indicates to run the count sql for pagination.
+ }
+ if(lookup instanceof IdNameSql) {
+ ((IdNameSql)lookup).loadUserData(request.getParameter(AppConstants.RI_NEXT_PAGE),
+ nvl(generateSearchString(request),"%"), rr.getDBInfo(),userId);
+ }
+
+ int dataSizeForPopUp = 0;
+ if(lookup instanceof IdNameSql) {
+ dataSizeForPopUp = ((IdNameSql)lookup).getDataSizeUsedinPopup();
+ } else
+ dataSizeForPopUp = lookup.getDataSize();
+
+ ff.setLookupList(lookup);
+ request.setAttribute("lookupList", lookup);
+ if(dataSizeForPopUp >= 0)
+ request.getSession().setAttribute(AppConstants.SI_DATA_SIZE_FOR_TEXTFIELD_POPUP, ""+dataSizeForPopUp);
+ } catch (RaptorException e) {
+ e.printStackTrace();
+ nextPage = (new ErrorHandler()).processFatalError(request, e);
+ }
+ return nextPage;
+ } // reportFormFieldPopup
+
+ public String reportValuesMapDefPopup(HttpServletRequest request, String nextPage) {
+ try {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+
+ String colName = AppUtils.getRequestNvlValue(request, "colName");
+ String colType = nvl(AppUtils.getRequestValue(request, "colType"),
+ AppConstants.CT_CHAR);
+ String displayName = AppUtils.getRequestNvlValue(request, "displayName");
+ String displayFormat = AppUtils.getRequestNvlValue(request, "displayFormat");
+ String tableId = AppUtils.getRequestNvlValue(request, "tableId");
+ String dbInfo = rdef.getDBInfo();
+ if (Utils.isNull(dbInfo)) {
+ dbInfo = (String) request.getSession().getAttribute("remoteDB");
+ }
+ /*String query = "SELECT x FROM (SELECT DISTINCT "
+ + (colType.equals(AppConstants.CT_DATE) ? ("TO_CHAR(" + colName + ", '"
+ + nvl(displayFormat, AppConstants.DEFAULT_DATE_FORMAT) + "')")
+ : colName) + " x FROM "
+ + rdef.getTableById(tableId).getTableName() + " WHERE " + colName
+ + " IS NOT NULL ORDER BY 1) xx WHERE ROWNUM <= "
+ + Globals.getDefaultPageSize();*/
+
+
+ String q1 = Globals.getReportValuesMapDefA();
+
+ String q2 = Globals.getReportValuesMapDefB();
+ q2 = q2.replace("[colName]", colName);
+ q2 = q2.replace("[nvl(displayFormat, AppConstants.DEFAULT_DATE_FORMAT)]", nvl(displayFormat, AppConstants.DEFAULT_DATE_FORMAT));
+
+ String q3 = Globals.getReportValuesMapDefC();
+ q3 = q3.replace("[colName]", colName);
+
+ String q4 = Globals.getReportValuesMapDefD();
+ q4 = q4.replace("[rdef.getTableById(tableId).getTableName()]", rdef.getTableById(tableId).getTableName());
+ q4 = q4.replace("[colName]", colName);
+ q4 = q4.replace("[Globals.getDefaultPageSize()]", String.valueOf(Globals.getDefaultPageSize()));
+
+ String query = q1 + (colType.equals(AppConstants.CT_DATE) ? q2 : q3) + q4;
+
+ DataSet ds = ConnectionUtils.getDataSet(query, dbInfo);
+ request.setAttribute(AppConstants.RI_DATA_SET, ds);
+ } catch (RaptorException e) {
+ nextPage = (new ErrorHandler()).processFatalError(request, e);
+ }
+
+ return nextPage;
+ } // reportValuesMapDefPopup
+
+ public String reportDrillDownToReportDefPopup(HttpServletRequest request, String nextPage) {
+ try {
+ // ReportDefinition rdef = (ReportDefinition)
+ // request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
+ String ddReportID = AppUtils
+ .getRequestNvlValue(request, AppConstants.RI_REPORT_ID);
+ ReportRuntime ddRr = (new ReportHandler()).loadReportRuntime(request, ddReportID,
+ false);
+ if (ddRr != null)
+ request.setAttribute(AppConstants.RI_FORM_FIELDS, ddRr.getReportFormFields());
+ } catch (RaptorException e) {
+ nextPage = (new ErrorHandler()).processFatalError(request, e);
+ }
+
+ return nextPage;
+ } // reportDrillDownToReportDefPopup
+
+ public String reportFilterDataPopup(HttpServletRequest request, String nextPage) {
+ try {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+
+ String colId = AppUtils.getRequestNvlValue(request, AppConstants.RI_COLUMN_ID);
+ IdNameColLookup lookup = null;
+ String dbInfo = rdef.getDBInfo();
+ if (Utils.isNull(dbInfo)) {
+ dbInfo = (String) request.getSession().getAttribute("remoteDB");
+ }
+ if (!AppUtils.getRequestFlag(request, AppConstants.RI_RESET_PARAMS))
+ lookup = (IdNameColLookup) request.getSession().getAttribute(
+ AppConstants.SI_COLUMN_LOOKUP);
+ if (lookup == null || (!colId.equals(lookup.getColId()))) {
+ DataColumnType dct = rdef.getColumnById(colId);
+ lookup = new IdNameColLookup(colId, rdef.getTableById(dct.getTableId())
+ .getTableName(), dct.getColName(), rdef.getSelectExpr(dct), dct
+ .getColName()
+ + (dct.getColType().equals(AppConstants.CT_DATE) ? " DESC" : ""));
+ request.getSession().setAttribute(AppConstants.SI_COLUMN_LOOKUP, lookup);
+ } // if
+
+ lookup.loadData(nvl(request.getParameter(AppConstants.RI_NEXT_PAGE), "0"),
+ generateSearchString(request), dbInfo);
+ } catch (RaptorException e) {
+ nextPage = (new ErrorHandler()).processFatalError(request, e);
+ }
+
+ return nextPage;
+ } // reportFilterDataPopup
+
+ public String reportShowSQLPopup(HttpServletRequest request, String nextPage) {
+ try {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+ String reportSQL = rdef.generateSQL(AppUtils.getUserID(request),request);
+
+ String[] sqlClause = { "SELECT ", "FROM ", "WHERE ", "GROUP BY ", "HAVING ",
+ "ORDER BY " };
+
+ int idxNext = 0;
+ StringBuffer sb = new StringBuffer();
+ while (idxNext < sqlClause.length) {
+ sb.append("<b>");
+ if (idxNext > 0)
+ sb.append("&nbsp;&nbsp;&nbsp;&nbsp;");
+ sb.append(sqlClause[idxNext]);
+ sb.append("</b><br>\n");
+
+ int clauseStartPos = reportSQL.indexOf(sqlClause[idxNext])
+ + sqlClause[idxNext].length();
+ do
+ idxNext++;
+ while ((idxNext < sqlClause.length)
+ && (reportSQL.indexOf(sqlClause[idxNext]) < 0));
+
+ String clauseContent = null;
+ if (idxNext < sqlClause.length)
+ clauseContent = reportSQL.substring(clauseStartPos, reportSQL
+ .indexOf(sqlClause[idxNext]) - 1);
+ else
+ clauseContent = reportSQL.substring(clauseStartPos);
+
+ while (clauseContent.length() > 0) {
+ int braketCount = 0;
+ StringBuffer nextToken = new StringBuffer();
+ for (int i = 0; i < clauseContent.length(); i++) {
+ char ch = clauseContent.charAt(i);
+ nextToken.append(ch);
+ if (ch == '(')
+ braketCount++;
+ else if (ch == ')')
+ braketCount--;
+ else if (ch == ',')
+ if (braketCount == 0)
+ break;
+ } // for %>
+
+ sb.append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
+ sb.append(nextToken.toString());
+ sb.append("<br>\n");
+
+ if (nextToken.length() < clauseContent.length())
+ clauseContent = clauseContent.substring(nextToken.length() + 1);
+ else
+ clauseContent = "";
+ } // while
+ } // while
+
+ request.setAttribute(AppConstants.RI_FORMATTED_SQL, sb.toString());
+ request.setAttribute(AppConstants.RI_PAGE_TITLE, "Generated SQL");
+ request.setAttribute(AppConstants.RI_PAGE_SUBTITLE, "Generated SQL for report "
+ + rdef.getReportName());
+ } catch (RaptorException e) {
+ nextPage = (new ErrorHandler()).processFatalError(request, e);
+ }
+
+ return nextPage;
+ } // reportShowSQLPopup
+
+ public String testSchedCondPopup(HttpServletRequest request, String nextPage) {
+ try {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+
+ String sql = AppUtils.getRequestNvlValue(request, AppConstants.RI_FORMATTED_SQL);
+
+ request.setAttribute("msg_align", " align=center");
+ request.setAttribute(AppConstants.RI_PAGE_TITLE, "Test Scheduler Condition");
+ // request.setAttribute(AppConstants.RI_PAGE_SUBTITLE, ...);
+ //String query = "SELECT 1 FROM DUAL WHERE EXISTS (" + sql + ")";
+
+ String query = Globals.getTestSchedCondPopup();
+ query = query.replace("[sql]", sql);
+
+ DataSet ds = null;
+ String remoteDb = request.getParameter("remoteDbPrefix");
+ String remoteDbPrefix = (remoteDb != null && !remoteDb.equalsIgnoreCase("null")) ? remoteDb
+ : rdef.getDBInfo();
+ ds = ConnectionUtils.getDataSet(sql, remoteDbPrefix);
+ // if ( (remoteDbPrefix!=null) &&
+ // (!remoteDbPrefix.equals(AppConstants.DB_LOCAL))) {
+ // Globals.getRDbUtils().setDBPrefix(remoteDbPrefix);
+ // ds = RemDbUtils.executeQuery(query);
+ // }
+ // else
+ // ds = DbUtils.executeQuery(query);
+ if (ds.getRowCount() == 0)
+ request
+ .setAttribute(AppConstants.RI_FORMATTED_SQL,
+ "<br><b>Condition NOT satisfied</b> - email notification will NOT be send.<br><br>");
+ else
+ request
+ .setAttribute(AppConstants.RI_FORMATTED_SQL,
+ "<br><b>Condition satisfied</b> - email notification will be send.<br><br>");
+ } catch (Exception e) {
+ // nextPage = (new ErrorHandler()).processFatalError(request, e);
+ request.setAttribute(AppConstants.RI_FORMATTED_SQL, "<br><b>SQL ERROR</b> "
+ + e.getMessage() + "<br>Email notification will NOT be send.<br><br>");
+ }
+
+ return nextPage;
+ } // testSchedCondPopup
+
+ public String testRunSQLPopup(HttpServletRequest request, String nextPage) {
+ String sql = AppUtils.getRequestNvlValue(request, AppConstants.RI_FORMATTED_SQL);
+ if(nvl(sql).length()<=0) {
+ sql = AppUtils.getRequestNvlValue(request, "reportSQL");
+ }
+
+
+ boolean chkFormFieldSQL = AppUtils.getRequestNvlValue(request,
+ AppConstants.RI_CHK_FIELD_SQL).equals("Y");
+ try {
+ if (!sql.trim().toUpperCase().startsWith("SELECT"))
+ throw new UserDefinedException(
+ "Invalid statement - the SQL must start with the keyword SELECT");
+
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+ if (!chkFormFieldSQL) {
+ if (rdef.getFormFieldList() != null)
+ for (Iterator iter = rdef.getFormFieldList().getFormField().iterator(); iter
+ .hasNext();) {
+ FormFieldType fft = (FormFieldType) iter.next();
+ String fieldId = fft.getFieldId();
+ String fieldDisplay = rdef.getFormFieldDisplayName(fft);
+ /*
+ * if(paramValues.isParameterMultiValue(fieldId))
+ * generatedSQL = Utils.replaceInString(generatedSQL,
+ * fieldDisplay, nvl(formatListValue((String)
+ * paramValues.get(fieldId), null, false, false, null),
+ * "NULL")); else
+ */
+ sql = Utils.replaceInString(sql, fieldDisplay, "NULL");
+ } // for
+ } // if
+ DataSet ds = null;
+ String remoteDb = request.getParameter("remoteDbPrefix");
+ String remoteDbPrefix = (remoteDb != null && !remoteDb.equalsIgnoreCase("null")) ? remoteDb
+ : rdef.getDBInfo();
+ String userId = AppUtils.getUserID(request);
+ sql = Utils.replaceInString(sql, "[LOGGED_USERID]", userId);
+ String[] reqParameters = Globals.getRequestParams().split(",");
+ String[] sessionParameters = Globals.getSessionParams().split(",");
+ javax.servlet.http.HttpSession session = request.getSession();
+ logger.debug(EELFLoggerDelegate.debugLogger, ("B4 testRunSQL " + sql));
+ if(request != null ) {
+ for (int i = 0; i < reqParameters.length; i++) {
+ if(!reqParameters[i].startsWith("ff"))
+ sql = Utils.replaceInString(sql, "[" + reqParameters[i].toUpperCase()+"]", request.getParameter(reqParameters[i].toUpperCase()) );
+ else
+ sql = Utils.replaceInString(sql, "[" + reqParameters[i].toUpperCase()+"]", request.getParameter(reqParameters[i]) );
+ }
+ }
+ if(session != null ) {
+ for (int i = 0; i < sessionParameters.length; i++) {
+ //if(!sessionParameters[i].startsWith("ff"))
+ //sql = Utils.replaceInString(sql, "[" + sessionParameters[i].toUpperCase()+"]", (String)session.getAttribute(sessionParameters[i].toUpperCase()) );
+ //else {
+ logger.debug(EELFLoggerDelegate.debugLogger, (" Session " + " sessionParameters[i] " + sessionParameters[i] + " " + (String)session.getAttribute(sessionParameters[i])));
+ sql = Utils.replaceInString(sql, "[" + sessionParameters[i].toUpperCase()+"]", (String)session.getAttribute(sessionParameters[i]) );
+ //}
+ }
+ }
+ logger.debug(EELFLoggerDelegate.debugLogger, ("After testRunSQL " + sql));
+
+ ds = ConnectionUtils.getDataSet(sql, remoteDbPrefix, true);
+ // if ( (remoteDbPrefix!=null) &&
+ // (!remoteDbPrefix.equals(AppConstants.DB_LOCAL))) {
+ // Globals.getRDbUtils().setDBPrefix(remoteDbPrefix);
+ // ds = RemDbUtils.executeQuery(sql,
+ // Globals.getDefaultPageSize()+1);
+ // }
+ // else
+ // ds = DbUtils.executeQuery(sql, Globals.getDefaultPageSize()+1);
+ if (chkFormFieldSQL && ds.getRowCount() > 0) {
+ String id = ds.getString(0, "id");
+ String name = ds.getString(0, "name");
+ } // if
+
+ request.setAttribute(AppConstants.RI_DATA_SET, ds);
+ } catch (RaptorException e) {
+ request.setAttribute(AppConstants.RI_EXCEPTION, e);
+ }
+
+ return nextPage;
+ } // testRunSQLPopup
+
+ public String importSemaphorePopup(HttpServletRequest request, String nextPage) {
+ try {
+ (new WizardProcessor()).processImportSemaphorePopup(request);
+ } catch (RaptorException e) {
+ nextPage = (new ErrorHandler()).processFatalError(request, e);
+ }
+
+ return nextPage;
+ } // importSemaphorePopup
+
+ public String saveSemaphorePopup(HttpServletRequest request, String nextPage) {
+ try {
+ (new WizardProcessor()).processSemaphorePopup(request);
+ } catch (RaptorException e) {
+ nextPage = (new ErrorHandler()).processFatalError(request, e);
+ }
+
+ return nextPage;
+ } // saveSemaphorePopup
+
+ public String gotoJsp(HttpServletRequest request, String nextPage) {
+ return nextPage;
+ } // gotoJsp
+
+ public String downloadAll(HttpServletRequest request, String nextPage) throws InterruptedException, IOException, Exception {
+ String emailId = null;
+ String pdfAttachmentKey = AppUtils.getRequestValue(request, "pdfAttachmentKey");
+ boolean isFromSchedule = nvl(pdfAttachmentKey).length()>0;
+ if(!isFromSchedule)
+ emailId = AppUtils.getUserEmail(request);
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
+ SimpleDateFormat sdf1 = new SimpleDateFormat("yyyyMMdd");
+ java.util.Date currDate = new java.util.Date();
+ String timestamp = sdf.format(currDate);
+ String dateStr = sdf1.format(currDate);
+
+ String userId = null;
+ if(!isFromSchedule)
+ userId = AppUtils.getUserID(request);
+ else
+ userId = AppUtils.getRequestValue(request, "user_id");
+ Runtime runtime = Runtime.getRuntime();
+ ReportRuntime rr = null;
+ if(!isFromSchedule) {
+ rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME);
+ if(rr!=null) AppUtils.getUserEmail(request);
+ }
+ String scheduleId = "";
+
+ if(isFromSchedule) {
+ String reportID = null;
+ String report_email_sent_log_id = AppUtils.getRequestValue(request, "log_id");
+ /*String query = "Select user_id, rep_id from CR_REPORT_EMAIL_SENT_LOG" +
+ " where rownum = 1" +
+ " and gen_key='"+pdfAttachmentKey.trim()+"'" +
+ " and log_id ="+report_email_sent_log_id.trim() +
+ " and (sysdate - sent_date) < 1 ";*/
+
+ String query = Globals.getDownloadAllEmailSent();
+ query = query.replace("[pdfAttachmentKey.trim()]", pdfAttachmentKey.trim());
+ query = query.replace("[report_email_sent_log_id.trim()]", report_email_sent_log_id.trim());
+
+ DataSet ds = DbUtils.executeQuery(query, 1);
+ if(!ds.isEmpty()) {
+ userId = ds.getString(0,"user_id");
+ reportID = ds.getString(0, "rep_id");
+ request.setAttribute("schedule_email_userId", userId);
+ } else {
+ request.setAttribute("message", "This link has expired, please <a href=''>login</a> and regenerate the report");
+ return "raptor/message.jsp";
+ }
+
+ ReportHandler rh1 = new ReportHandler();
+
+ if(reportID !=null && nvl(pdfAttachmentKey).length()>0) {
+ rr = rh1.loadReportRuntime(request, reportID, true, 1);
+ rr.loadReportData(-1, userId, 1000 ,request, false /*download*/);
+ }
+
+ String d_sql = Globals.getDownloadAllGenKey();
+ d_sql = d_sql.replace("[pdfAttachmentKey]", pdfAttachmentKey);
+
+ //ds = DbUtils.executeQuery("select schedule_id from cr_report_email_sent_log u where U.GEN_KEY = '"+ pdfAttachmentKey + "'");
+
+ ds = DbUtils.executeQuery(d_sql);
+ for (int i = 0; i < ds.getRowCount(); i++) {
+ scheduleId = ds.getString(i,0);
+ }
+ }
+ logger.debug(EELFLoggerDelegate.debugLogger, ("SQL2:\n"+ rr.getCachedSQL()));
+ String fileName = rr.getReportID()+"_"+userId+"_"+timestamp;
+ boolean flag = false;
+ logger.debug(EELFLoggerDelegate.debugLogger, (""+Utils.isDownloadFileExists(rr.getReportID()+"_"+userId+"_"+dateStr)));
+ // if(Utils.isDownloadFileExists(rr.getReportID()+"_"+userId+"_"+dateStr)) {
+ // flag = true;
+ // }
+
+ if(flag){
+ String strFileName = Utils.getLatestDownloadableFile(rr.getReportID()+"_"+userId+"_"+dateStr);
+ //debugLogger.debug("File Name " + strFileName);
+ StringBuffer messageBuffer = new StringBuffer("");
+ messageBuffer.append("Download data file using the following link<BR>");
+ messageBuffer.append("<a href=\"" + request.getContextPath() + "/raptor/dwnld/data/" +
+ strFileName + "\">click here</a>.</p>");
+ request.setAttribute("message", messageBuffer.toString());
+ }
+ else if(!flag) {
+ String whole_fileName = (Globals.getShellScriptDir() +AppConstants.SHELL_QUERY_DIR+ fileName+AppConstants.FT_SQL);
+ String whole_columnsfileName = (Globals.getShellScriptDir() +AppConstants.SHELL_QUERY_DIR+ fileName+AppConstants.FT_COLUMNS);
+
+ logger.debug(EELFLoggerDelegate.debugLogger, ("FILENAME "+whole_fileName));
+
+ List l = rr.getAllColumns();
+ StringBuffer allColumnsBuffer = new StringBuffer();
+ DataColumnType dct = null;
+
+ for (Iterator iter = l.iterator(); iter.hasNext();) {
+ dct = (DataColumnType) iter.next();
+ allColumnsBuffer.append(dct.getDisplayName());
+ if(iter.hasNext())
+ allColumnsBuffer.append("|");
+ }
+ try {
+ PrintWriter xmlOut = new PrintWriter(new BufferedWriter(new FileWriter(new File(whole_columnsfileName))));
+ xmlOut.println(allColumnsBuffer.toString());
+ xmlOut.flush();
+ xmlOut.close();
+ } catch (IOException e) {e.printStackTrace();}
+ try {
+ PrintWriter xmlOut = new PrintWriter(new BufferedWriter(new FileWriter(new File(whole_fileName))));
+ logger.debug(EELFLoggerDelegate.debugLogger, ("**************************"));
+ logger.debug(EELFLoggerDelegate.debugLogger, (rr.getWholeSQL()));
+ logger.debug(EELFLoggerDelegate.debugLogger, ("************************"));
+ logger.debug(EELFLoggerDelegate.debugLogger, ("************************"));
+ logger.debug(EELFLoggerDelegate.debugLogger, (rr.parseReportSQL(rr.getWholeSQL())));
+ xmlOut.println(rr.parseReportSQL(rr.getWholeSQL()));
+ //xmlOut.println("******************");
+ //xmlOut.println(rr.getWholeSQL());
+ xmlOut.flush();
+ xmlOut.close();
+ } catch (IOException e) {e.printStackTrace();}
+
+ StringBuffer command = new StringBuffer(Globals.getShellScriptDir() + AppConstants.SHELL_SCRIPTS_DIR);
+ if(nvl(emailId).length()>0) {
+ command.append(AppConstants.SHELL_SCRIPT_NAME + " " + (fileName+AppConstants.FT_SQL));
+ command.append(" "+emailId);
+ }
+ else if (nvl(scheduleId).length()>0) {
+ command.append(AppConstants.SCHEDULE_SHELL_SCRIPT_NAME + " " + (fileName+AppConstants.FT_SQL));
+ command.append(" " + scheduleId);
+ }
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Command " + command));
+ Process downloadProcess = runtime.exec(command.toString());
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Command Executed "));
+ //Connection connection = DbUtils.getConnection();
+ Enumeration enum1 = rr.getParamKeys();
+ String value = "", key = "";
+ String paramStr = "";
+ StringBuffer paramBuffer = new StringBuffer();
+ if(enum1!=null) {
+ for (; enum1.hasMoreElements();) {
+ key = (String) enum1.nextElement();
+ value = rr.getParamValue(key);
+ paramBuffer.append(key+":"+value+" ");
+ }
+ paramStr = paramBuffer.toString();
+ }
+
+ StringBuffer retrieveUserEmailQry = null;
+ ArrayList userEmailList = new ArrayList();
+ if(nvl(scheduleId).length()>0) {
+ /*retrieveUserEmailQry = new StringBuffer();
+ retrieveUserEmailQry.append(" SELECT ");
+ retrieveUserEmailQry.append(" au.user_id ");
+ retrieveUserEmailQry.append(" FROM ");
+ retrieveUserEmailQry.append(" (SELECT rs.schedule_id, rs.rep_id FROM cr_report_schedule rs WHERE rs.enabled_yn='Y' AND rs.run_date IS NOT NULL ");
+ retrieveUserEmailQry.append(" AND rs.schedule_id = " + scheduleId + " ) x, cr_report r, app_user au ");
+ retrieveUserEmailQry.append(" WHERE ");
+ retrieveUserEmailQry.append("x.rep_id = r.rep_id ");
+ retrieveUserEmailQry.append(" AND au.user_id IN (SELECT rsu.user_id FROM cr_report_schedule_users rsu WHERE rsu.schedule_id = x.schedule_id and rsu.schedule_id = " + scheduleId );
+ retrieveUserEmailQry.append(" UNION ");
+ retrieveUserEmailQry.append(" SELECT ur.user_id FROM fn_user_role ur ");
+ retrieveUserEmailQry.append(" WHERE ur.role_id IN ");
+ retrieveUserEmailQry.append(" (SELECT rsu2.role_id FROM cr_report_schedule_users rsu2 ");
+ retrieveUserEmailQry.append(" WHERE rsu2.schedule_id = x.schedule_id and ");
+ retrieveUserEmailQry.append(" rsu2.schedule_id = "+ scheduleId + ")) ");*/
+
+ String r_sql = Globals.getDownloadAllRetrieve();
+ r_sql = r_sql.replace("[scheduleId]", scheduleId);
+
+ // DataSet ds = DbUtils.executeQuery(retrieveUserEmailQry.toString());
+ DataSet ds = DbUtils.executeQuery(r_sql);
+
+ for (int i = 0; i < ds.getRowCount(); i++) {
+ userEmailList.add(ds.getString(i, 0));
+ }
+
+ }
+ // String insertQry = "insert into cr_report_dwnld_log (user_id,rep_id,file_name,dwnld_start_time,filter_params) values (?,?,?,?,?)";
+ String insertQry = Globals.getDownloadAllInsert();
+
+
+ Connection connection = null;
+ PreparedStatement pst = null;
+ try {
+ connection = DbUtils.getConnection();
+ pst = connection.prepareStatement(insertQry);
+ if(nvl(emailId).length()>0){
+ pst.setInt(1, Integer.parseInt(userId));
+ pst.setInt(2, Integer.parseInt(rr.getReportID()));
+ pst.setString(3, fileName+AppConstants.FT_ZIP);
+ pst.setTimestamp(4,new java.sql.Timestamp(currDate.getTime()));
+ pst.setString(5,paramStr);
+ pst.execute();
+ connection.commit();
+ } else {
+ for (int i = 0; i < userEmailList.size(); i++) {
+ pst.setInt(1, Integer.parseInt((String)userEmailList.get(i)));
+ pst.setInt(2, Integer.parseInt(rr.getReportID()));
+ pst.setString(3, fileName+AppConstants.FT_ZIP);
+ pst.setTimestamp(4,new java.sql.Timestamp(currDate.getTime()));
+ pst.setString(5,paramStr);
+ pst.execute();
+ connection.commit();
+ }
+ }
+ pst.close();
+ connection.close();
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Data inserted"));
+ } catch (SQLException ex) {
+ throw new RaptorException(ex);
+ } catch (ReportSQLException ex) {
+ throw new RaptorException(ex);
+ } catch (Exception ex) {
+ throw new RaptorException (ex);
+ } finally {
+ try {
+ if(connection!=null)
+ connection.close();
+ if(pst!=null)
+ pst.close();
+ } catch (SQLException ex) {
+ throw new RaptorException(ex);
+ }
+ }
+ //DbUtils.commitTransaction(connection);
+ //DbUtils.clearConnection(connection);
+
+
+
+// debugLogger.debug("|"+downloadProcess.toString() + "|");
+// if (downloadProcess == null)
+// throw new Exception("unable to create a process for command:" +
+// command);
+// int retCode= 1;
+// try {
+// retCode= downloadProcess.waitFor();
+// } catch (InterruptedException e){
+// e.printStackTrace();
+// }
+// debugLogger.debug("retCode " + retCode);
+// Process child = rtime.exec("/bin/bash");
+// BufferedWriter outCommand = new BufferedWriter(new
+// OutputStreamWriter(child.getOutputStream()));
+// outCommand.write(Globals.getShellScriptName());
+// outCommand.flush();
+// int retCode = child.waitFor();
+// debugLogger.debug("RetCode " + retCode);
+ //request.setAttribute("message", "Shell Script is running in the background. You'll get an email once it is done");
+ }
+
+ return nextPage;
+ }
+ public String getChildDropDown(HttpServletRequest request, String nextPage) throws RaptorRuntimeException {
+
+ if(request.getParameter("firstTime") != null) { return nextPage; }
+
+ /*ReportRuntime rr = (ReportRuntime) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_RUNTIME);
+
+ String c_master = request.getParameter("c_master");
+ java.util.HashMap valuesMap = Globals.getRequestParamtersMap(request);
+ request.setAttribute("c_master", c_master);
+
+ int idx = 0;
+ ReportFormFields rff = rr.getReportFormFields();
+ FormField ff = null;
+ for(rff.resetNext(); rff.hasNext(); idx++) {
+ ff = rff.getNext();
+
+
+ if(ff.getDependsOn() != null && ff.getDependsOn().trim() != "")
+ {
+ String val = request.getParameter(ff.getFieldName());
+ request.setAttribute(ff.getFieldName(), ff.getHtml(val, valuesMap, rr));
+ }
+
+ }
+ */
+ return nextPage;
+
+ }
+
+ private void removeVariablesFromSession(HttpServletRequest request) {
+ HttpSession session = request.getSession();
+ session.removeAttribute(AppConstants.DRILLDOWN_REPORTS_LIST);
+ session.removeAttribute(AppConstants.DRILLDOWN_INDEX);
+ session.removeAttribute(AppConstants.FORM_DRILLDOWN_INDEX);
+ session.removeAttribute(AppConstants.SI_BACKUP_FOR_REP_ID);
+ session.removeAttribute(AppConstants.SI_COLUMN_LOOKUP);
+ session.removeAttribute(AppConstants.SI_DASHBOARD_REP_ID);
+ session.removeAttribute(AppConstants.SI_DASHBOARD_REPORTRUNTIME_MAP);
+ session.removeAttribute(AppConstants.SI_DASHBOARD_REPORTRUNTIME);
+ session.removeAttribute(AppConstants.SI_DASHBOARD_REPORTDATA_MAP);
+ session.removeAttribute(AppConstants.SI_DASHBOARD_CHARTDATA_MAP);
+ session.removeAttribute(AppConstants.SI_DASHBOARD_DISPLAYTYPE_MAP);
+ session.removeAttribute(AppConstants.SI_DATA_SIZE_FOR_TEXTFIELD_POPUP);
+ session.removeAttribute(AppConstants.SI_MAP);
+ session.removeAttribute(AppConstants.SI_MAP_OBJECT);
+ session.removeAttribute(AppConstants.SI_REPORT_DEFINITION);
+ session.removeAttribute(AppConstants.SI_REPORT_RUNTIME);
+ session.removeAttribute(AppConstants.SI_REPORT_RUN_BACKUP);
+ session.removeAttribute(AppConstants.SI_REPORT_SCHEDULE);
+ session.removeAttribute(AppConstants.RI_REPORT_DATA);
+ session.removeAttribute(AppConstants.RI_CHART_DATA);
+ session.removeAttribute(AppConstants.SI_FORMFIELD_INFO);
+ session.removeAttribute(AppConstants.SI_FORMFIELD_DOWNLOAD_INFO);
+ session.removeAttribute(AppConstants.EMBEDDED_REPORTRUNTIME_MAP);
+ session.removeAttribute(AppConstants.EMBEDDED_REPORTDATA_MAP);
+ Enumeration<String> enum1 = session.getAttributeNames();
+ String attributeName = "";
+ while(enum1.hasMoreElements()) {
+ attributeName = enum1.nextElement();
+ if(attributeName.startsWith("parent_")) {
+ session.removeAttribute(attributeName);
+ }
+ }
+ }
+
+
+ private TreeMap getListOfReportsFromDashBoardHTML(String htmlString) {
+ //String sourcestring = "<table border=1><tr><td>[Report#123]</td><td>[Report#124]</td></tr><tr><td>[Report#125]</td><td>[Report#126]</td></tr></table>";
+ String sourcestring = htmlString;
+ //Pattern re = Pattern.compile("([a-z]+)\\[([a-z]+)([=<>]+)([a-z]+)\\]",Pattern.CASE_INSENSITIVE);
+ //Pattern re = Pattern.compile("\\[([R][e][p][o][r][t][#])[(*)]\\]");
+ 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);
+ //System.out.println(str);
+ 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++;
+ }
+ // Sorting HashMap based on Keys
+ /*List mapKeys = new ArrayList(hashReports.keySet());
+ List mapValues = new ArrayList(hashReports.values());
+ hashReports.clear();
+ hashReports = null;
+ hashReports = new HashMap();
+
+ TreeSet sortedSet = new TreeSet(mapKeys);
+ Object[] sortedArray = sortedSet.toArray();
+ int size = sortedArray.length;
+ for (int i=0; i<size; i++) {
+ hashReports.put(sortedArray[i], mapValues.get(mapKeys.indexOf(sortedArray[i])));
+ }*/
+ return new TreeMap(hashReports);
+ }
+
+ public ReportData getReportData(ReportRuntime reportRuntime, HttpServletRequest request, String sql, int maxRows) throws RaptorException {
+
+
+ // replace the request parameter specified in the drill down
+ List reportCols = reportRuntime.getAllColumns();
+ StringBuffer colNames = new StringBuffer();
+ for (Iterator<?> iter = reportCols.iterator(); iter.hasNext();) {
+
+ DataColumnType dc = (DataColumnType) iter.next();
+ if (colNames.length() > 0)
+ colNames.append(", ");
+ colNames.append(dc.getColId());
+ if (dc.isVisible()) {
+ //TODO: Drilldown URL
+ //sql = reportRuntime.parseReportSQLForDrillDownParams(sql, dc, request);
+ }
+ }
+
+ DataSet ds = null;
+ // try {
+ String dbInfo = reportRuntime.getDBInfo();
+ if(maxRows == 1)
+ sql += " limit "+ maxRows;
+ System.out.println("SQL getReportData()- " + sql);
+ ds = ConnectionUtils.getDataSet(sql, dbInfo);
+ int totalRows = 0;
+ /*if (reportRuntime.getReportDataSize() < 0) {*/
+ //String countSQL = "SELECT count(*) FROM (" + sql + ") x";
+ String dbType = "";
+
+ if (dbInfo!=null && (!dbInfo.equals(AppConstants.DB_LOCAL))) {
+ try {
+ org.openecomp.portalsdk.analytics.util.RemDbInfo remDbInfo = new org.openecomp.portalsdk.analytics.util.RemDbInfo();
+ dbType = remDbInfo.getDBType(dbInfo);
+ } catch (Exception ex) {
+ throw new RaptorException(ex);
+ }
+ }
+
+ totalRows = ds.getRowCount();
+ /*}*/
+ ReportData rd = new ReportData(0, true);
+
+ if(totalRows > 0) {
+ // Already defined changed for modifying request parameters
+ //List reportCols = getAllColumns();
+ Vector visibleCols = new Vector(reportCols.size());
+ Vector formatProcessors = new Vector(reportCols.size());
+
+ // ColumnHeaderRow chr = new ColumnHeaderRow();
+ // rd.reportColumnHeaderRows.addColumnHeaderRow(chr);
+ // chr.setRowHeight("30");
+ int count =0 ;
+
+ /* ADDED */
+ ReportFormFields rff = reportRuntime.getReportFormFields();
+ ReportFormFields childReportFormFields = null;
+ String fieldDisplayName = "";
+ String fieldValue = "";
+
+ for (int c = 0; c < reportCols.size(); c++) {
+ if(reportCols.get(c)!=null) {
+ DataColumnType dct = (DataColumnType) reportCols.get(c);
+ if(nvl(dct.getDependsOnFormField()).length()>0 && nvl(dct.getDependsOnFormField()).indexOf("[")!=-1) {
+ for(int i = 0 ; i < rff.size(); i++) {
+ fieldDisplayName = "["+((FormField)rff.getFormField(i)).getFieldDisplayName()+"]";
+ fieldValue = "";
+ //if(dct.getOriginalDisplayName()==null) dct.setOriginalDisplayName(dct.getDisplayName());
+ if (dct.getDependsOnFormField().equals(fieldDisplayName)) {
+ fieldValue = nvl(request.getParameter(((FormField)rff.getFormField(i)).getFieldName()));
+
+ if (fieldValue.length()>0) {
+ if(!fieldValue.toUpperCase().equals("Y"))
+ dct.setDisplayName(fieldValue);
+ if(!dct.isVisible())
+ dct.setVisible(true);
+ } else {
+ dct.setVisible(false);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /* ADDED */
+ String displayName = "";
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+
+ DataColumnType dc = (DataColumnType) iter.next();
+
+ formatProcessors.add(count,new FormatProcessor(
+ reportRuntime.getSemaphoreById(dc.getSemaphoreId()), dc.getColType(), dc
+ .getColFormat(), reportRuntime.getReportDefType().equals(
+ AppConstants.RD_SQL_BASED)));
+
+ /* TODO: Add Drilldown URL */
+ if (nvl(dc.getDrillDownURL()).length() > 0) {
+ childReportFormFields = reportRuntime.getChildReportFormFields(request,dc.getDrillDownURL());
+ }
+ if (dc.isVisible()) {
+ visibleCols.add(count,dc);
+ //if(dc.getColId().startsWith("group")) {
+ for (int d = 0; d < reportCols.size(); d++) {
+ if(reportCols.get(d)!=null) {
+ DataColumnType dct1 = (DataColumnType) reportCols.get(d);
+ if(dct1.getColId().equals(dc.getColId()+"_name") && ds.getRowCount()>0) {
+ displayName = ds.getString(0,dct1.getColId());
+ dc.setDisplayName(displayName);
+ }
+ }
+ }
+ //}
+
+ VisualManager visualManager = reportRuntime.getVisualManager();
+ rd.createColumn(dc.getColId(), dc.getDisplayName(), dc.getDisplayWidthInPxls(),dc.getDisplayHeaderAlignment(),
+ visualManager.isColumnVisible(dc.getColId()), visualManager
+ .getSortByColId().equals(dc.getColId()) ? visualManager
+ .getSortByAscDesc() : null, true, dc.getLevel()!=null?dc.getLevel():0, dc.getStart()!=null?dc.getStart():0, dc.getColspan()!=null?dc.getColspan():0, dc.isIsSortable()!=null?dc.isIsSortable():false);
+ // chr.addColumnHeader(new ColumnHeader(dc.getDisplayName(),
+ // (dc.getDisplayWidth()>100)?"10%":(""+dc.getDisplayWidth()+"%")));
+ } // if
+ else {
+ visibleCols.add(count,null);
+ rd.createColumn(dc.getColId(), AppConstants.HIDDEN, dc.getDisplayWidthInPxls(), dc.getDisplayHeaderAlignment(),
+ false, null,false,dc.getLevel()!=null?dc.getLevel():0, dc.getStart()!=null?dc.getStart():0, dc.getColspan()!=null?dc.getColspan():0, dc.isIsSortable()!=null?dc.isIsSortable():false);
+// formatProcessors.add(count,null);
+ }
+ count++;
+ } // for
+
+ // Utils._assert(chr.size()==ds.getColumnCount(),
+ // "[ReportRuntime.loadLinearReportData] The number of visible columns
+ // does not match the number of data columns");
+ //TODO: This should be optimized to accept -1 for flat file download
+ if(maxRows > totalRows) maxRows = totalRows;
+ ArrayList reportDataList = new ArrayList();
+ for (int r = 0; r < maxRows; r++) {
+ DataRow dr = new DataRow();
+ rd.reportDataRows.addDataRow(dr);
+
+ for (int c = 0; c < reportCols.size(); c++) {
+ if(reportCols.get(c)!=null) {
+ DataColumnType dct = (DataColumnType) reportCols.get(c);
+ //Modified since ds is null.
+ DataValue dv = new DataValue();
+
+ if(ds.getRowCount()>0){
+ if(ds.getColumnIndex(dct.getColId())!= -1) {
+ dr.addDataValue(dv);
+ dv.setDisplayValue(ds.getString(r, dct.getColId()));
+ } else {
+ continue;
+ }
+
+ } else {
+ dv.setDisplayValue("");
+ }
+ dv.setColName(dct.getColName());
+ dv.setColId(dct.getColId());
+ dv.setNowrap(nvl(dct.getNowrap(),"null").equals("false")?"null":nvl(dct.getNowrap(),"null"));
+
+ //Add Drilldown URL to dv
+ if (nvl(dct.getDrillDownURL()).length() > 0) {
+
+ if(dv.getDisplayValue().length() > 0) {
+ dv.setDrillDownURL(reportRuntime.parseDrillDownURL(r, /* c, */ds, dct, request, childReportFormFields));
+ dv.setDrillDowninPoPUp(dct.isDrillinPoPUp()!=null?dct.isDrillinPoPUp():false);
+ }
+
+ if (dv.getDisplayValue().length() == 0) {
+ //dv.setDisplayValue("[NULL]");
+ dv.setDisplayValue("");
+ }
+ } // if
+
+ StringBuffer indentation = new StringBuffer("");
+ if(dct.getIndentation()!=null && dct.getIndentation()>0) {
+ for (int indent=0; indent< dct.getIndentation(); indent++) {
+ indentation.append("\t");
+ }
+ dv.setNowrap("true");
+ }
+ dv.setIndentation(indentation.toString());
+
+ if(dct.isVisible()) {
+
+ dv.setVisible(true);
+ dv.setAlignment(dct.getDisplayAlignment());
+ dv.setDisplayTotal(dct.getDisplayTotal());
+ dv.setDisplayName(dct.getDisplayName());
+
+// if (nvl(dct.getDrillDownURL()).length() > 0) {
+
+// if(dv.getDisplayValue().length() > 0) {
+ //TODO: Below Drilldown URL
+// dv.setDrillDownURL(reportRuntime.parseDrillDownURL(r, /* c, */ds, dct,request, childReportFormFields));
+// dv.setDrillDowninPoPUp(dct.isDrillinPoPUp());
+// }
+//
+// if (dv.getDisplayValue().length() == 0) {
+// //dv.setDisplayValue("[NULL]");
+// dv.setDisplayValue("");
+// }
+// } // if
+
+ } else {
+ dv.setVisible(false);
+ dv.setHidden(true);
+ }
+ //System.out.println("in Linear report b4" + dr.getFormatId() + dr.getBgColorHtml() + dv.getDisplayValue());
+
+ if(dr.getFormatId()!=null)
+ ((FormatProcessor) formatProcessors.get(c)).setHtmlFormatters(dv, dr, true);
+ else
+ ((FormatProcessor) formatProcessors.get(c)).setHtmlFormatters(dv, dr, false);
+
+ //System.out.println("in Linear report After" + dr.getFormatId() + dr.getBgColorHtml() + dv.getDisplayValue());
+ } // if reportCols
+ } // for
+ reportDataList.add(dr);
+ } // for
+
+ rd.setReportDataList(reportDataList);
+ //Only if rownumber options is needed
+ //rd.addRowNumbers(pageNo, getPageSize());
+ DataRow colDataTotalsLinear = null;
+ if (colDataTotalsLinear == null)
+ colDataTotalsLinear = reportRuntime.generateColumnDataTotalsLinear(new ArrayList(reportCols), AppUtils.getUserID(request),
+ reportRuntime.getDbInfo(),request);
+
+ if(colDataTotalsLinear!=null)
+ rd.setColumnDataTotalsLinear(colDataTotalsLinear, "Total");
+ // Please note the below function doesn't set the visibility for dv since this is set in this function. - Sundar
+ rd.applyVisibility();
+ }
+ return rd;
+ } // loadLinearReportData
+
+ public String formFieldRun(HttpServletRequest request, String nextPage) {
+ ReportRuntime rr = null;
+ rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME);
+ if(rr!=null) {
+ ReportJSONRuntime reportJSONRuntime = rr.createFormFieldJSONRuntime(request);
+ ObjectMapper mapper = new ObjectMapper();
+ //mapper.setVisibility(JsonMethod.FIELD, Visibility.ANY);
+ //mapper.setVisibilityChecker(mapper.getVisibilityChecker().with(JsonAutoDetect.Visibility.NONE));
+ mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ String jsonInString = "";
+ try {
+ jsonInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(reportJSONRuntime);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+
+ }
+ return jsonInString;
+ }
+
+ return "";
+ }
+
+} // ActionHandler
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/ActionMapping.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/ActionMapping.java
new file mode 100644
index 00000000..723b5fd1
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/ActionMapping.java
@@ -0,0 +1,34 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file 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.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.controller;
+
+import java.util.*;
+
+public class ActionMapping extends HashMap {
+
+ public void addAction(Action action) {
+ put(action.getAction(), action);
+ } // addAction
+
+ public Action getAction(String actionKey) {
+ return (Action) get(actionKey);
+ } // getAction
+
+} // ActionMapping
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/Controller.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/Controller.java
new file mode 100644
index 00000000..c233b4a0
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/Controller.java
@@ -0,0 +1,125 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file 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.
+ * ================================================================================
+ */
+ package org.openecomp.portalsdk.analytics.controller;
+
+import java.util.*;
+import java.lang.reflect.*;
+import javax.servlet.*;
+import javax.servlet.http.*;
+
+import org.openecomp.portalsdk.analytics.controller.*;
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.error.RaptorRuntimeException;
+import org.openecomp.portalsdk.analytics.model.runtime.ReportParamValues;
+import org.openecomp.portalsdk.analytics.system.*;
+import org.openecomp.portalsdk.analytics.util.*;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+
+public class Controller extends org.openecomp.portalsdk.analytics.RaptorObject {
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(Controller.class);
+ public Controller() {
+ }
+
+ public String processRequest(HttpServletRequest request) {
+ String actionKey = nvl(request.getParameter(AppConstants.RI_ACTION), "report.run");
+
+ return processRequest(actionKey, request);
+ } // processRequest
+
+ public String processRequest(String actionKey, HttpServletRequest request) {
+ Action action = null;
+ try {
+ action = Globals.getRaptorActionMapping().getAction(actionKey);
+ if (action == null)
+ throw new RaptorRuntimeException("Action not found");
+ } catch (RaptorException e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey
+ + "]. RaptorException: " + e.getMessage()));
+// if (actionKey.equals("system_upgrade")) // System override
+// return att.raptor.util.upgrade.SystemUpgrade.upgradeDB(request);
+
+ return (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException(
+ "[Controller.processRequest]Invalid raptor action [" + actionKey
+ + "]. Exception: " + e.getMessage()));
+ }
+
+ try {
+ Class[] paramTypes = new Class[2];
+ paramTypes[0] = Class.forName("javax.servlet.http.HttpServletRequest");
+ paramTypes[1] = Class.forName("java.lang.String");
+
+ Class handlerClass = Class.forName(action.getControllerClass());
+ Object handler = handlerClass.newInstance();
+ Method handlerMethod = handlerClass.getMethod(action.getControllerMethod(),
+ paramTypes);
+
+ Object[] paramValues = new Object[2];
+ paramValues[0] = request;
+ paramValues[1] = action.getJspName();
+
+ return (String) handlerMethod.invoke(handler, paramValues);
+ } catch (ClassNotFoundException e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey
+ + "]. ClassNotFoundException: " + e.getMessage()));
+ return (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException(
+ "[Controller.processRequest] Unable to instantiate and invoke action handler. Exception: "
+ + e.getMessage()));
+ } catch (IllegalAccessException e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey
+ + "]. IllegalAccessException: " + e.getMessage()));
+ return (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException(
+ "[Controller.processRequest] Unable to instantiate and invoke action handler. Exception: "
+ + e.getMessage()));
+ }catch (InstantiationException e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey
+ + "]. InstantiationException: " + e.getMessage()));
+ return (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException(
+ "[Controller.processRequest] Unable to instantiate and invoke action handler. Exception: "
+ + e.getMessage()));
+ }catch (NoSuchMethodException e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey
+ + "]. NoSuchMethodException: " + e.getMessage()));
+ return (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException(
+ "[Controller.processRequest] Unable to instantiate and invoke action handler. Exception: "
+ + e.getMessage()));
+ }catch (InvocationTargetException e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey
+ + "]. InvocationTargetException: " + e.getMessage()));
+ return (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException(
+ "[Controller.processRequest] Unable to instantiate and invoke action handler. Exception: "
+ + e.getMessage()));
+ }
+ } // processRequest
+
+ public void handleRequest(HttpServletRequest request, HttpServletResponse response,
+ ServletContext servletContext) throws Exception {
+ String actionKey = nvl(request.getParameter(AppConstants.RI_ACTION), request.getParameter("action"));
+
+ handleRequest(actionKey, request, response, servletContext);
+ } // handleRequest
+
+ public void handleRequest(String actionKey, HttpServletRequest request,
+ HttpServletResponse response, ServletContext servletContext) throws Exception {
+ servletContext.getRequestDispatcher("/" + processRequest(actionKey, request)).forward(
+ request, response);
+ } // handleRequest
+
+} // Controller
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/ErrorHandler.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/ErrorHandler.java
new file mode 100644
index 00000000..75d88d0f
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/ErrorHandler.java
@@ -0,0 +1,151 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file 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.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.controller;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.*;
+import javax.servlet.http.*;
+
+import org.openecomp.portalsdk.analytics.error.*;
+import org.openecomp.portalsdk.analytics.model.definition.ReportDefinition;
+import org.openecomp.portalsdk.analytics.model.runtime.ErrorJSONRuntime;
+import org.openecomp.portalsdk.analytics.model.runtime.ReportRuntime;
+import org.openecomp.portalsdk.analytics.system.*;
+import org.openecomp.portalsdk.analytics.util.*;
+import org.openecomp.portalsdk.core.logging.format.AlarmSeverityEnum;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+
+public class ErrorHandler extends org.openecomp.portalsdk.analytics.RaptorObject {
+
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ErrorHandler.class);
+
+ public ErrorHandler() {
+ }
+
+ public void processError(HttpServletRequest request, String errorMsg) {
+ //Log.write(errorMsg, 2);
+ logger.error(EELFLoggerDelegate.debugLogger, (errorMsg));
+ ArrayList error_list = (ArrayList) request.getAttribute(AppConstants.RI_ERROR_LIST);
+ if (error_list == null)
+ error_list = new ArrayList(1);
+ error_list.add(errorMsg);
+ request.setAttribute(AppConstants.RI_ERROR_LIST, error_list);
+ } // processError
+
+ public void processError(HttpServletRequest request, RaptorException e) {
+ processError(request, "Exception: " + e.getMessage());
+ } // processError
+
+ private String getSessionLog(HttpServletRequest request) {
+ String[] sessionVariablesToLog = Globals.getLogVariablesInSession().split(",");
+ StringBuffer sessionLogStrBuf = new StringBuffer("\n");
+ sessionLogStrBuf.append("***** ADDITIONAL INFORMATION ******");
+ HttpSession session = request.getSession();
+ ReportRuntime rr = (ReportRuntime) session.getAttribute(AppConstants.SI_REPORT_RUNTIME);
+ ReportDefinition rdef = (ReportDefinition) session.getAttribute(AppConstants.SI_REPORT_DEFINITION);
+ if(rr!=null) {
+ sessionLogStrBuf.append("\nWHILE RUNNING");
+ sessionLogStrBuf.append("\nReport Id="+rr.getReportID()+";\t");
+ sessionLogStrBuf.append("Report Name="+rr.getReportName()+";\t\n");
+ } else if (rdef != null) {
+ sessionLogStrBuf.append("\nWHILE CREATING/UPDATING");
+ sessionLogStrBuf.append("\nReport Id="+rdef.getReportID()+";\t");
+ sessionLogStrBuf.append("Report Name="+rdef.getReportName()+";\t\n");
+ }
+ for (int i = 0; i < sessionVariablesToLog.length; i++) {
+ if(session.getAttribute(sessionVariablesToLog[i])!=null)
+ sessionLogStrBuf.append(sessionVariablesToLog[i]+"="+(String)session.getAttribute(sessionVariablesToLog[i])+";\t");
+ }
+ sessionLogStrBuf.append("\n***********************************");
+ sessionLogStrBuf.append("\n");
+ return sessionLogStrBuf.toString();
+ }
+ public String processFatalError(HttpServletRequest request, RaptorException e) {
+ //Log.write("Fatal error [" + e.getClass().getName() + "]: " + nvl(e.getMessage()), 1);
+ logger.error(EELFLoggerDelegate.debugLogger, ("[EXCEPTION ENCOUNTERED IN RAPTOR] Fatal error [" + e.getClass().getName() + "]: " + nvl(e.getMessage())+" "+ getSessionLog(request) + e.getMessage()),AlarmSeverityEnum.MAJOR);
+ if (e instanceof ReportSQLException) {
+ String errorSQL = ((ReportSQLException) e).getReportSQL();
+ if (nvl(errorSQL).length() > 0)
+ request.setAttribute("c_error_sql", errorSQL);
+ } // if
+ AppUtils.processErrorNotification(request, e);
+
+ request.setAttribute(AppConstants.RI_EXCEPTION, e);
+ return AppUtils.getErrorPage();
+ } // processFatalError
+
+ public String processFatalErrorJSON(HttpServletRequest request, RaptorException e) {
+ //Log.write("Fatal error [" + e.getClass().getName() + "]: " + nvl(e.getMessage()), 1);
+ logger.error(EELFLoggerDelegate.debugLogger, ("[EXCEPTION ENCOUNTERED IN RAPTOR] Fatal error [" + e.getClass().getName() + "]: " + nvl(e.getMessage())+" "+ getSessionLog(request) + e.getMessage()),AlarmSeverityEnum.MAJOR);
+ if (e instanceof ReportSQLException) {
+ String errorSQL = ((ReportSQLException) e).getReportSQL();
+ if (nvl(errorSQL).length() > 0)
+ request.setAttribute("c_error_sql", errorSQL);
+ } // if
+ //AppUtils.processErrorNotification(request, e);
+
+ request.setAttribute(AppConstants.RI_EXCEPTION, e);
+ ErrorJSONRuntime errorJSONRuntime = new ErrorJSONRuntime();
+ errorJSONRuntime.setErrormessage(e.toString());
+ errorJSONRuntime.setStacktrace(getStackTrace(e));
+ ObjectMapper mapper = new ObjectMapper();
+ //mapper.setVisibility(JsonMethod.FIELD, Visibility.ANY);
+ //mapper.setVisibilityChecker(mapper.getVisibilityChecker().with(JsonAutoDetect.Visibility.NONE));
+ mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ String jsonInString = "";
+ try {
+ jsonInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(errorJSONRuntime);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+
+ }
+ return jsonInString;
+ } // processFatalError
+
+ public static String getStackTrace(Throwable aThrowable) {
+ Writer result = new StringWriter();
+ PrintWriter printWriter = new PrintWriter(result);
+ aThrowable.printStackTrace(printWriter);
+ return result.toString();
+ }
+ public String processFatalErrorWMenu(HttpServletRequest request, RaptorException e) {
+ //Log.write("Fatal error [" + e.getClass().getName() + "]: " + nvl(e.getMessage()), 1);
+ logger.error(EELFLoggerDelegate.debugLogger, ("[EXCEPTION ENCOUNTERED IN RAPTOR] Fatal error [" + e.getClass().getName() + "]: " + nvl(e.getMessage())+" "+ getSessionLog(request) + e.getMessage()),AlarmSeverityEnum.MAJOR);
+ if (e instanceof ReportSQLException) {
+ String errorSQL = ((ReportSQLException) e).getReportSQL();
+ if (nvl(errorSQL).length() > 0)
+ request.setAttribute("c_error_sql", errorSQL);
+ } // if
+ AppUtils.processErrorNotification(request, e);
+
+ request.setAttribute(AppConstants.RI_EXCEPTION, e);
+ return AppUtils.getErrorPageWMenu();
+ } // processFatalError
+
+} // ErrorHandler
+
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardProcessor.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardProcessor.java
new file mode 100644
index 00000000..b193ec4b
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardProcessor.java
@@ -0,0 +1,2356 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file 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.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.controller;
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.xml.datatype.DatatypeConfigurationException;
+import javax.xml.datatype.DatatypeFactory;
+
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.error.ValidationException;
+import org.openecomp.portalsdk.analytics.model.ReportHandler;
+import org.openecomp.portalsdk.analytics.model.ReportLoader;
+import org.openecomp.portalsdk.analytics.model.base.IdNameValue;
+import org.openecomp.portalsdk.analytics.model.base.OrderBySeqComparator;
+import org.openecomp.portalsdk.analytics.model.base.OrderSeqComparator;
+import org.openecomp.portalsdk.analytics.model.definition.ReportDefinition;
+import org.openecomp.portalsdk.analytics.model.definition.ReportSchedule;
+import org.openecomp.portalsdk.analytics.model.runtime.FormField;
+import org.openecomp.portalsdk.analytics.model.runtime.ReportRuntime;
+import org.openecomp.portalsdk.analytics.system.AppUtils;
+import org.openecomp.portalsdk.analytics.system.DbUtils;
+import org.openecomp.portalsdk.analytics.system.Globals;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+import org.openecomp.portalsdk.analytics.util.DataSet;
+import org.openecomp.portalsdk.analytics.util.XSSFilter;
+import org.openecomp.portalsdk.analytics.xmlobj.ChartDrillFormfield;
+import org.openecomp.portalsdk.analytics.xmlobj.ColFilterType;
+import org.openecomp.portalsdk.analytics.xmlobj.DataColumnType;
+import org.openecomp.portalsdk.analytics.xmlobj.DataSourceType;
+import org.openecomp.portalsdk.analytics.xmlobj.FormFieldType;
+import org.openecomp.portalsdk.analytics.xmlobj.FormatType;
+import org.openecomp.portalsdk.analytics.xmlobj.JavascriptItemType;
+import org.openecomp.portalsdk.analytics.xmlobj.Marker;
+import org.openecomp.portalsdk.analytics.xmlobj.ObjectFactory;
+import org.openecomp.portalsdk.analytics.xmlobj.SemaphoreType;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+
+/**<HR/>
+ * This class is part of <B><I>RAPTOR (Rapid Application Programming Tool for OLAP Reporting)</I></B><BR/>
+ * <HR/>
+ *
+ * --------------------------------------------------------------------------------------------------<BR/>
+ * <B>WizardProcessor.java</B> - This class is used to process the user input provided in the wizard.<BR/>
+ * It is called in creation as well as updation process. It builds report xml via JAXB using user<BR/>
+ * input. This is vital one, to store meta information of each report<BR/>
+ * ---------------------------------------------------------------------------------------------------<BR/>
+ *
+ *
+ * <U>Change Log</U><BR/><BR/>
+ *
+ * 31-Aug-2009 : Version 8.5.1 (Sundar);<UL><LI> For Time Series multi series property is exposed. </LI></UL>
+ * 28-Aug-2009 : Version 8.5.1 (Sundar);<UL><LI> If user login id is null, it would display user name when user is added for schedule. </LI></UL>
+ * 18-Aug-2009 : Version 8.5.1 (Sundar);<UL><LI> request Object is passed to prevent caching user/roles - Datamining/Hosting. </LI></UL>
+ * 12-Aug-2009 : Version 8.5 (Sundar); <UL><LI> For Line Charts too options are captured and rendering is customized. </LI></UL>
+ * 29-Jul-2009 : Version 8.4 (Sundar); <UL><LI> Maximum Excel Download size would be persisted if changed. </LI></UL>
+ * 14-Jul-2009 : Version 8.4 (Sundar); <UL><LI> Schedule feature is added to Dashboard Reports. </LI></UL>
+ * 29-Jun-2009 : Version 8.4 (Sundar); <UL><LI> Options for <I>Compare to Previous year Chart</I> are processed.</LI>
+ * <LI> In the Bar chart Last Occuring Series/Category can be plotted as Bar or Line Renderer. </LI>
+ * </UL>
+ * 22-Jun-2009 : Version 8.4 (Sundar); <UL><LI> processChart method is modified to accommodate creating
+ * Bar Charts, Time Difference Charts and adding generic chart options.</LI></UL>
+ *
+ */
+
+public class WizardProcessor extends org.openecomp.portalsdk.analytics.RaptorObject {
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(WizardProcessor.class);
+
+ public WizardProcessor() {
+ }
+
+ private String adjustDataType(String oracleDataType) {
+ return oracleDataType.equals("VARCHAR2") ? AppConstants.CT_CHAR : oracleDataType;
+ // Probably should be expanded to convert any CHAR or VARCHAR type to
+ // CT_CHAR, number type to CT_NUMBER and date to CT_DATE
+ } // adjustDataType
+
+ public void persistReportDefinition(HttpServletRequest request, ReportDefinition rdef)
+ throws RaptorException {
+ ReportRuntime rr = (ReportRuntime) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_RUNTIME);
+ if (rr != null && rr.getReportID().equals(rdef.getReportID()))
+ request.getSession().removeAttribute(AppConstants.SI_REPORT_RUNTIME);
+ rdef.persistReport(request);
+ } // persistReportDefinition
+
+ public void processWizardStep(HttpServletRequest request) throws Exception {
+ String action = nvl(request.getParameter(AppConstants.RI_WIZARD_ACTION),
+ AppConstants.WA_BACK);
+
+ String reportID = AppUtils.getRequestValue(request, AppConstants.RI_REPORT_ID);
+ ReportDefinition rdef = (new ReportHandler()).loadReportDefinition(request, reportID);
+ request.getSession().setAttribute(AppConstants.SI_REPORT_DEFINITION, rdef);
+
+ String curStep = rdef.getWizardSequence().getCurrentStep();
+ String curSubStep = rdef.getWizardSequence().getCurrentSubStep();
+ if (AppUtils.getRequestNvlValue(request, "showDashboardOptions").length()<=0)
+ request.setAttribute("showDashboardOptions", "F");
+ logger.debug(EELFLoggerDelegate.debugLogger, ("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^curStep " + curStep + " " + curSubStep + " " + action));
+ boolean reportUpdated = false;
+ if (!action.equals(AppConstants.WA_BACK)) {
+ if (curStep.equals(AppConstants.WS_DEFINITION)) {
+ reportUpdated = processDefinition(request);
+ } else if (curStep.equals(AppConstants.WS_SQL)) {
+ if (action.equals(AppConstants.WA_VALIDATE))
+ reportUpdated = processValidateSQL(request);
+ } else if (curStep.equals(AppConstants.WS_TABLES)) {
+ if (curSubStep.equals(AppConstants.WSS_ADD))
+ reportUpdated = processTableAdd(request);
+ else if (curSubStep.equals(AppConstants.WSS_EDIT))
+ reportUpdated = processTableEdit(request);
+ else if (action.equals(AppConstants.WA_DELETE))
+ reportUpdated = processTableDelete(request);
+ } else if (curStep.equals(AppConstants.WS_COLUMNS)) {
+ if (curSubStep.equals(AppConstants.WSS_ADD)
+ || curSubStep.equals(AppConstants.WSS_EDIT) || action.equals(AppConstants.WA_SAVE) || action.equals(AppConstants.WA_NEXT)) {
+ reportUpdated = processColumnAddEdit(request, curSubStep
+ .equals(AppConstants.WSS_EDIT) || curSubStep
+ .equals(AppConstants.WA_MODIFY));
+ //reportUpdated = processColumnAddEdit(request, true);
+ }
+ else if (curSubStep.equals(AppConstants.WSS_ADD_MULTI))
+ reportUpdated = processColumnAddMulti(request);
+ else if (curSubStep.equals(AppConstants.WSS_ORDER_ALL))
+ reportUpdated = processColumnOrderAll(request);
+ else if (action.equals(AppConstants.WA_DELETE))
+ reportUpdated = processColumnDelete(request);
+ else if (action.equals(AppConstants.WA_MOVE_UP))
+ reportUpdated = processColumnMoveUp(request);
+ else if (action.equals(AppConstants.WA_MOVE_DOWN))
+ reportUpdated = processColumnMoveDown(request);
+ } else if (curStep.equals(AppConstants.WS_FORM_FIELDS)) {
+ if (curSubStep.equals(AppConstants.WSS_ADD)
+ || curSubStep.equals(AppConstants.WSS_EDIT))
+ reportUpdated = processFormFieldAddEdit(request, curSubStep
+ .equals(AppConstants.WSS_EDIT), action);
+ else if (action.equals(AppConstants.WA_DELETE))
+ reportUpdated = processFormFieldDelete(request);
+ else if (action.equals(AppConstants.WA_MOVE_UP))
+ reportUpdated = processFormFieldMoveUp(request);
+ else if (action.equals(AppConstants.WA_MOVE_DOWN))
+ reportUpdated = processFormFieldMoveDown(request);
+ else if (action.equals(AppConstants.WSS_ADD_BLANK))
+ reportUpdated = processFormFieldBlank(request);
+ else if (action.equals(AppConstants.WSS_INFO_BAR))
+ reportUpdated = processFormFieldInfoBar(request);
+ } else if (curStep.equals(AppConstants.WS_FILTERS)) {
+ if (curSubStep.equals(AppConstants.WSS_ADD)
+ || curSubStep.equals(AppConstants.WSS_EDIT))
+ reportUpdated = processFilterAddEdit(request, curSubStep
+ .equals(AppConstants.WSS_EDIT));
+ else if (action.equals(AppConstants.WA_DELETE))
+ reportUpdated = processFilterDelete(request);
+ } else if (curStep.equals(AppConstants.WS_SORTING)) {
+ if (curSubStep.equals(AppConstants.WSS_ADD)
+ || curSubStep.equals(AppConstants.WSS_EDIT))
+ reportUpdated = processSortAddEdit(request, curSubStep
+ .equals(AppConstants.WSS_EDIT));
+ else if (curSubStep.equals(AppConstants.WSS_ORDER_ALL))
+ reportUpdated = processSortOrderAll(request);
+ else if (action.equals(AppConstants.WA_DELETE))
+ reportUpdated = processSortDelete(request);
+ else if (action.equals(AppConstants.WA_MOVE_UP))
+ reportUpdated = processSortMoveUp(request);
+ else if (action.equals(AppConstants.WA_MOVE_DOWN))
+ reportUpdated = processSortMoveDown(request);
+ } else if (curStep.equals(AppConstants.WS_JAVASCRIPT)) {
+ if (action.equals(AppConstants.WSS_ADD))
+ reportUpdated = processAddJavascriptElement(request);
+ else if (action.equals(AppConstants.WA_SAVE))
+ reportUpdated = processSaveJavascriptElement(request);
+ else if (action.equals(AppConstants.WA_DELETE))
+ reportUpdated = processDeleteJavascriptElement(request);
+ else
+ reportUpdated = processJavascript(request);
+ } else if (curStep.equals(AppConstants.WS_CHART)) {
+ reportUpdated = processChart(request, action);
+ } else if (curStep.equals(AppConstants.WS_USER_ACCESS)) {
+ reportUpdated = processUserAccess(request, action);
+ } else if (curStep.equals(AppConstants.WS_REPORT_LOG)) {
+ if (action.equals(AppConstants.WA_DELETE_USER))
+ reportUpdated = processClearLog(request);
+ } else if (curStep.equals(AppConstants.WS_SCHEDULE)) {
+ reportUpdated = processSchedule(request, action);
+ } else if(curStep.equals(AppConstants.WS_DATA_FORECASTING)) {
+ reportUpdated = processForecasting(request, action);
+ }
+ /****For Report Maps - Start*****/
+ else if (curStep.equals(AppConstants.WS_MAP)) {
+ reportUpdated = processMap(request, action);
+ }
+ /****For Report Maps - End*****/
+
+ // else
+ }
+ if (reportUpdated)
+ persistReportDefinition(request, rdef);
+ } // processWizardStep
+
+ public void processImportSemaphorePopup(HttpServletRequest request) throws RaptorException {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+
+ String importReportId = AppUtils
+ .getRequestNvlValue(request, AppConstants.RI_REPORT_ID);
+ ReportRuntime rr = (new ReportHandler()).loadReportRuntime(request, importReportId,
+ false);
+
+ ArrayList importedList = new ArrayList();
+ if (rr.getSemaphoreList() != null)
+ for (Iterator iter = rr.getSemaphoreList().getSemaphore().iterator(); iter
+ .hasNext();) {
+ SemaphoreType sem = rdef.addSemaphore(new ObjectFactory(),
+ (SemaphoreType) iter.next());
+ importedList
+ .add(new IdNameValue(sem.getSemaphoreId(), sem.getSemaphoreName()));
+ } // for
+
+ if (importedList.size() > 0) {
+ request.setAttribute(AppConstants.RI_DATA_SET, importedList);
+ persistReportDefinition(request, rdef);
+ } // if
+ } // processImportSemaphorePopup
+
+ public void processSemaphorePopup(HttpServletRequest request) throws RaptorException {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+
+ String semaphoreId = AppUtils.getRequestNvlValue(request, "semaphoreId");
+ String semaphoreName = AppUtils.getRequestNvlValue(request, "semaphoreName");
+ String semaphoreType = AppUtils.getRequestNvlValue(request, "semaphoreType");
+
+ SemaphoreType semaphore = rdef.getSemaphoreById(semaphoreId);
+ if (semaphore == null) {
+ semaphore = rdef.addSemaphoreType(new ObjectFactory(), semaphoreName,
+ semaphoreType, null);
+ semaphoreId = semaphore.getSemaphoreId();
+ request.setAttribute("semaphoreId", semaphoreId);
+ } else {
+ rdef.deleteSemaphore(semaphore);
+ semaphore.setSemaphoreName(semaphoreName);
+ semaphore.setSemaphoreType(semaphoreType);
+
+ rdef.setSemaphore(semaphore);
+ }
+
+ String[] formatId = request.getParameterValues("formatId");
+ String[] lessThanValue = request.getParameterValues("lessThanValue");
+ String[] expression = request.getParameterValues("expression");
+ String[] bold = request.getParameterValues("bold");
+ String[] italic = request.getParameterValues("italic");
+ String[] underline = request.getParameterValues("underline");
+ String[] bgColor = request.getParameterValues("bgColor");
+ String[] fontColor = request.getParameterValues("fontColor");
+ String[] fontFace = request.getParameterValues("fontFace");
+ String[] fontSize = request.getParameterValues("fontSize");
+ //String[] anyFmt = request.getParameterValues("anyFmt");
+
+ // String[] alignment = request.getParameterValues("alignment");
+
+ for (int i = 0; i < lessThanValue.length; i++)
+ if (i == 0 || nvl(lessThanValue[i]).length() > 0) {
+ FormatType fmt = null;
+ if (i == 0 || nvl(formatId[i]).length() > 0)
+ fmt = rdef.getSemaphoreFormatById(semaphore, nvl(formatId[i]));
+ if (fmt == null)
+ fmt = rdef.addEmptyFormatType(new ObjectFactory(), semaphore);
+
+ fmt.setLessThanValue(nvl(lessThanValue[i]));
+ fmt.setExpression(nvl(expression[i]));
+ fmt.setBold(bold[i].equals("Y"));
+ fmt.setItalic(italic[i].equals("Y"));
+ fmt.setUnderline(underline[i].equals("Y"));
+ fmt.setBgColor(bgColor[i]);
+ fmt.setFontColor(fontColor[i]);
+ fmt.setFontFace(fontFace[i]);
+ fmt.setFontSize(fontSize[i]);
+ //fmt.setAnyFmt((anyFmt[i]!=null)?anyFmt[i].startsWith("Y"):false);
+ // fmt.setAlignment(alignment[i]);
+ } else if (nvl(formatId[i]).length() > 0)
+ rdef.deleteFormatType(semaphore, formatId[i]);
+
+ persistReportDefinition(request, rdef);
+ } // processSemaphorePopup
+
+ private boolean processDefinition(HttpServletRequest request) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+
+ String reportName = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "reportName"));
+ String reportDescr = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "reportDescr"));
+ String folderId = AppUtils.getRequestNvlValue(request, "folder_id");
+ boolean isAllowSchedule = (AppUtils.getRequestNvlValue(request, "allowSchedule").length()<=0?"N":AppUtils.getRequestNvlValue(request, "allowSchedule")).startsWith("Y");
+ boolean isColumnGroup = (AppUtils.getRequestNvlValue(request, "multiGroupColumn").length()<=0?"N":AppUtils.getRequestNvlValue(request, "multiGroupColumn")).startsWith("Y");
+ boolean isTopDown = (AppUtils.getRequestNvlValue(request, "topDown").length()<=0?"N":AppUtils.getRequestNvlValue(request, "topDown")).startsWith("Y");
+ boolean isSizedByContent= (AppUtils.getRequestNvlValue(request, "sizedByContent").length()<=0?"N":AppUtils.getRequestNvlValue(request, "sizedByContent")).startsWith("Y");
+ boolean reportsInNewWindow = false;
+ boolean hideFormFieldAfterRun = false;
+
+ /*recurrance in schedule tab - Start*/
+ String isOneTimeScheduleAllowed = nvl(AppUtils.getRequestValue(request, "isOneTimeScheduleAllowed"),"N");
+ String isHourlyScheduleAllowed = nvl(AppUtils.getRequestValue(request, "isHourlyScheduleAllowed"),"N");
+ String isDailyScheduleAllowed = nvl(AppUtils.getRequestValue(request, "isDailyScheduleAllowed"),"N");
+ String isDailyMFScheduleAllowed = nvl(AppUtils.getRequestValue(request, "isDailyMFScheduleAllowed"),"N");
+ String isWeeklyScheduleAllowed = nvl(AppUtils.getRequestValue(request, "isWeeklyScheduleAllowed"),"N");
+ String isMonthlyScheduleAllowed = nvl(AppUtils.getRequestValue(request, "isMonthlyScheduleAllowed"),"N");
+ //System.out.println("//////////// + isOneTimeScheduleAllowed : " + isOneTimeScheduleAllowed);
+ /*recurrance in schedule tab - End*/
+
+
+ if (reportDescr.length() > 1000)
+ reportDescr = reportDescr.substring(0, 1000);
+ boolean reportUpdated;
+
+ String reportType = AppUtils.getRequestNvlValue(request, "reportType");
+
+
+
+ //rdef.setReportName(reportName);
+ //rdef.setReportDescr(reportDescr);
+ //rdef.setReportType(reportType);
+ rdef.setFolderId(folderId);
+// debugLogger.debug("setting folder ID = " + folderId);
+ if(reportType.equals(AppConstants.RT_DASHBOARD)) {
+ rdef.setReportName(reportName);
+ rdef.setReportDescr(reportDescr);
+ rdef.setReportType(reportType);
+ String dashboardLayoutHTML = AppUtils.getRequestNvlValue(request, "dashboardLayoutHTML");
+ rdef.setDashboardLayoutHTML(dashboardLayoutHTML);
+ String dataContainerHeight = nvl(AppUtils.getRequestValue(request, "heightContainer"), "auto");
+ String dataContainerWidth = nvl(AppUtils.getRequestValue(request, "widthContainer"), "auto");
+ rdef.setDataContainerHeight(dataContainerHeight);
+ rdef.setDataContainerWidth(dataContainerWidth);
+ rdef.setAllowSchedule(isAllowSchedule?"Y":"N");
+
+
+ /*
+ String numDashCols = AppUtils.getRequestNvlValue(request, "numDashCols");
+ String reports1 = AppUtils.getRequestNvlValue(request, "reports1");
+ String reports2 = AppUtils.getRequestNvlValue(request, "reports2");
+ String reports3 = AppUtils.getRequestNvlValue(request, "reports3");
+ String reports4 = AppUtils.getRequestNvlValue(request, "reports4");
+ String repBgColor1 = AppUtils.getRequestNvlValue(request, "repBgColor1");
+ String repBgColor2 = AppUtils.getRequestNvlValue(request, "repBgColor2");
+ String repBgColor3 = AppUtils.getRequestNvlValue(request, "repBgColor3");
+ String repBgColor4 = AppUtils.getRequestNvlValue(request, "repBgColor4");
+
+ //List reports = rdef.getDashBoardReports();
+ rdef.setNumDashCols(numDashCols);
+ DashboardReports reportsList = new DashboardReportsImpl();
+
+ String reports[] = new String[]{reports1, reports2, reports3, reports4};
+ String repBgColors[] = new String[]{repBgColor1, repBgColor2, repBgColor3, repBgColor4};
+ for (int i = 0; i < reports.length; i++) {
+ Reports report = new ReportsImpl();
+ report.setReportId(reports[i]);
+ report.setBgcolor(repBgColors[i]);
+ reportsList.getReportsList().add(report);
+ }
+
+
+
+ rdef.setDashBoardReports(reportsList);
+ */
+ reportUpdated = true;
+
+// reportUpdated = (!(reportName.equals(nvl(rdef.getReportName()))
+// && reportDescr.equals(nvl(rdef.getReportDescr()))
+// && reportType.equals(nvl(rdef.getReportType()))
+// && numDashCols.equals(nvl(rdef.getNumDashCols()))));
+//// && rdef.getR
+
+ if (rdef.getWizardSequence() instanceof WizardSequence)
+ rdef.generateWizardSequence(request);
+
+ } else {
+
+ if (AppUtils.getRequestNvlValue(request, "reportType").equals(AppConstants.RT_CROSSTAB) || rdef.getReportType().equals(AppConstants.RT_CROSSTAB)) {
+
+ String widthNo = AppUtils.getRequestNvlValue(request, "widthNo");
+ if(nvl(widthNo).endsWith("px"))
+ rdef.setWidthNoColumn(widthNo);
+ else
+ rdef.setWidthNoColumn(widthNo+"px");
+ }
+
+ String dataGridAlign = AppUtils.getRequestNvlValue(request, "dataGridAlign");
+ if(nvl(dataGridAlign).length()>0) {
+ rdef.setDataGridAlign(dataGridAlign);
+ } else {
+ rdef.setDataGridAlign("left");
+ }
+
+ String pdfImgLogo = AppUtils.getRequestNvlValue(request, "pdfImg");
+ if(nvl(pdfImgLogo).length()>0)
+ rdef.setPdfImg(pdfImgLogo);
+ else
+ rdef.setPdfImg(null);
+ String emptyMessage = AppUtils.getRequestNvlValue(request, "emptyMessage");
+ if(nvl(emptyMessage).length()>0)
+ rdef.setEmptyMessage(emptyMessage);
+ else
+ rdef.setEmptyMessage("");
+ String formHelp = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "formHelp"));
+ //String rDashboardType = nvl(AppUtils.getRequestValue(request, "showDashboardOptions"), "N");
+ //rdef.setDashboardType(rDashboardType.equals("Y"));
+ int excelDownloadSize = 500;
+ try {
+ excelDownloadSize = Integer.parseInt(AppUtils.getRequestValue(request, "excelDownloadSize"));
+ } catch (NumberFormatException ex) {}
+ if(AppUtils.getRequestNvlValue(request, "excelDownloadSize").length()>0)
+ rdef.setMaxRowsInExcelDownload(Integer.parseInt(AppUtils.getRequestValue(request, "excelDownloadSize")));
+ if(AppUtils.getRequestNvlValue(request, "reportInNewWindow").length()>0)
+ reportsInNewWindow = AppUtils.getRequestNvlValue(request,"reportInNewWindow").equals("Y");
+ if(AppUtils.getRequestNvlValue(request, "hideFormFieldsAfterRun").length()>0)
+ hideFormFieldAfterRun = AppUtils.getRequestNvlValue(request,"hideFormFieldsAfterRun").equals("Y");
+
+
+ if(AppUtils.getRequestNvlValue(request, "displayFolderTree").length()>0)
+ rdef.setDisplayFolderTree(AppUtils.getRequestNvlValue(request,"displayFolderTree").equals("Y"));
+ else
+ rdef.setDisplayFolderTree(false);
+ String dataSource = AppUtils.getRequestNvlValue(request, "dataSource");
+ String dbType = Globals.getDBType();
+ String schemaSql = Globals.getRemoteDbSchemaSqlWithWhereClause();
+ schemaSql = schemaSql.replace("[schema_id]", dataSource);
+ 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) {}
+
+ int pageSize = Globals.getDefaultPageSize();
+ try {
+ pageSize = Integer.parseInt(AppUtils.getRequestValue(request, "pageSize"));
+ } catch (NumberFormatException e) {
+ }
+ String rApproved = nvl(AppUtils.getRequestValue(request, "menuApproved"), "N");
+ String menuID = "";
+ String[] menuIDs = request.getParameterValues("menuID");
+ if (menuIDs != null)
+ for (int i = 0; i < menuIDs.length; i++)
+ menuID += (menuID.length() == 0 ? "" : "|") + menuIDs[i];
+ /* else
+ menuID = "";*/
+
+// boolean additionalFieldsShown = AppUtils.getRequestNvlValue(request,
+// "additionalFieldsShown").equals("Y");
+ boolean rRCSDisabled = AppUtils.getRequestNvlValue(request, "runtimeColSortDisabled").equals("Y");
+ String reportDefType = AppUtils.getRequestNvlValue(request, "reportDefType");
+ String dataContainerHeight = nvl(AppUtils.getRequestValue(request, "heightContainer"), "auto");
+ String dataContainerWidth = nvl(AppUtils.getRequestValue(request, "widthContainer"), "auto");
+
+ String displayOptions = nvl(AppUtils.getRequestValue(request, "hideForm"), "N")
+ + nvl(AppUtils.getRequestValue(request, "hideChart"), "N")
+ + nvl(AppUtils.getRequestValue(request, "hideData"), "N")
+ + nvl(AppUtils.getRequestValue(request, "hideBtns"), "N")
+ + nvl(AppUtils.getRequestValue(request, "hideMap"), "N")
+ + nvl(AppUtils.getRequestValue(request, "hideExcelIcons"), "N")
+ + nvl(AppUtils.getRequestValue(request, "hidePDFIcons"), "N");
+/* StringBuffer dashboardOptions = new StringBuffer("");
+ dashboardOptions.append((nvl(AppUtils.getRequestValue(request, "hide"),"chart").equals("chart"))?"Y":"N");
+ dashboardOptions.append((nvl(AppUtils.getRequestValue(request, "hide"),"").equals("data"))?"Y":"N");
+ dashboardOptions.append((nvl(AppUtils.getRequestValue(request, "hideBtns"),"").equals("Y"))?"Y":"N");*/
+
+ String numFormCols = nvl(AppUtils.getRequestValue(request, "numFormCols"), "1");
+ String reportTitle = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "reportTitle"));
+ String reportSubTitle = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "reportSubTitle"));
+ String reportHeader = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "reportHeader"));
+ String reportFooter = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "reportFooter"));
+
+ int frozenColumns = 0;
+ try {
+ frozenColumns = Integer.parseInt(AppUtils.getRequestValue(request, "frozenColumns"));
+ } catch (NumberFormatException ex) {
+
+ }
+
+/* reportUpdated = (!(reportName.equals(nvl(rdef.getReportName()))))
+ && (!(reportDescr.equals(nvl(rdef.getReportDescr()))))
+ && (!(formHelp.equals(nvl(rdef.getFormHelpText()))))
+ && (!(reportType.equals(nvl(rdef.getReportType()))))
+ && (pageSize != rdef.getPageSize()) &&
+ // rPublic.equals(rdef.isPublic()?"Y":"N")&&
+ (!(menuID.equals(nvl(rdef.getMenuID()))))
+ && (!(rApproved.equals(rdef.isMenuApproved()))) && (additionalFieldsShown ? ((!(rRCSDisabled
+ .equals(rdef.isRuntimeColSortDisabled())))
+ && (!(displayOptions.equals(nvl(rdef.getDisplayOptions()))))
+ && (!(dashboardOptions.equals(nvl(rdef.getDashboardOptions()))))
+ && (!(numFormCols.equals(nvl(rdef.getNumFormCols()))))
+ && (!(reportTitle.equals(nvl(rdef.getReportTitle()))))
+ && (!(reportSubTitle.equals(nvl(rdef.getReportSubTitle()))))
+ && (!(reportHeader.equals(nvl(rdef.getReportHeader())))) && (!(reportFooter
+ .equals(nvl(rdef.getReportFooter()))))&& (reportsInNewWindow != rdef.isReportInNewWindow())):true);
+*/
+/* reportUpdated = rRCSDisabled ==(rdef.isRuntimeColSortDisabled()
+ && displayOptions.equals(nvl(rdef.getDisplayOptions()))
+ //&& dashboardOptions.equals(nvl(rdef.getDashboardOptions()))
+ && numFormCols.equals(nvl(rdef.getNumFormCols()))
+ && reportTitle.equals(nvl(rdef.getReportTitle()))
+ && reportSubTitle.equals(nvl(rdef.getReportSubTitle()))
+ && reportHeader.equals(nvl(rdef.getReportHeader()))
+ && reportsInNewWindow == rdef.isReportInNewWindow()
+ && reportFooter.equals(nvl(rdef.getReportFooter())))
+ ;*/
+
+
+ /*reportUpdated = (!(reportName.equals(nvl(rdef.getReportName()))
+ && reportDescr.equals(nvl(rdef.getReportDescr()))
+ && formHelp.equals(nvl(rdef.getFormHelpText()))
+ && reportType.equals(nvl(rdef.getReportType()))
+ && (pageSize == rdef.getPageSize())
+ && excelDownloadSize == rdef.getMaxRowsInExcelDownload()
+ && reportsInNewWindow == rdef.isReportInNewWindow()
+ && displayOptions.equals(rdef.getDisplayOptions())
+ && dataContainerHeight.equals(rdef.getDataContainerHeight())
+ && dataContainerWidth.equals(rdef.getDataContainerWidth())
+ && (isAllowSchedule ==(rdef.isAllowSchedule()))
+ // rPublic.equals(rdef.isPublic()?"Y":"N")&&
+ && menuID.equals(nvl(rdef.getMenuID()))
+ && rApproved.equals(rdef.isMenuApproved() ? "Y" : "N") && (rRCSDisabled
+ == ((rdef.isRuntimeColSortDisabled())
+ && displayOptions.equals(nvl(rdef.getDisplayOptions()))
+ //&& dashboardOptions.equals(nvl(rdef.getDashboardOptions()))
+ && numFormCols.equals(nvl(rdef.getNumFormCols()))
+ && reportTitle.equals(nvl(rdef.getReportTitle()))
+ && reportSubTitle.equals(nvl(rdef.getReportSubTitle()))
+ && isOneTimeScheduleAllowed.equals(nvl(rdef.getIsOneTimeScheduleAllowed()))
+ && isHourlyScheduleAllowed.equals(nvl(rdef.getIsHourlyScheduleAllowed()))
+ && isDailyScheduleAllowed.equals(nvl(rdef.getIsDailyScheduleAllowed()))
+ && isDailyMFScheduleAllowed.equals(nvl(rdef.getIsDailyMFScheduleAllowed()))
+ && isWeeklyScheduleAllowed.equals(nvl(rdef.getIsWeeklyScheduleAllowed()))
+ && isMonthlyScheduleAllowed.equals(nvl(rdef.getIsMonthlyScheduleAllowed()))
+ && reportHeader.equals(nvl(rdef.getReportHeader())) && reportFooter
+ .equals(nvl(rdef.getReportFooter()))))
+ )); */
+ rdef.setReportName(reportName);
+ rdef.setReportDescr(reportDescr);
+ rdef.setFormHelpText(formHelp);
+ rdef.setReportType(reportType);
+ rdef.setPageSize(pageSize);
+ rdef.setDBInfo(dataSource);
+ rdef.setDBType(dbType);
+ rdef.setDisplayOptions(displayOptions);
+ rdef.setDataContainerHeight(dataContainerHeight);
+ rdef.setDataContainerWidth(dataContainerWidth);
+ rdef.setAllowSchedule(isAllowSchedule?"Y":"N");
+ rdef.setMultiGroupColumn(isColumnGroup?"Y":"N");
+ rdef.setTopDown(isTopDown?"Y":"N");
+ rdef.setSizedByContent(isSizedByContent?"Y":"N");
+ // rdef.setPublic(rPublic.equals("Y"));
+ rdef.setMenuID(menuID);
+ rdef.setMenuApproved(rApproved.equals("Y"));
+ if (reportDefType.length() > 0)
+ rdef.setReportDefType(reportDefType);
+/* if(rdef.isDashboardType()) {
+ rdef.setDashboardOptions(dashboardOptions.toString());
+ }*/
+ rdef.setHideFormFieldAfterRun(hideFormFieldAfterRun);
+ rdef.setReportInNewWindow(reportsInNewWindow);
+ rdef.setRuntimeColSortDisabled(rRCSDisabled);
+ rdef.setNumFormCols(numFormCols);
+ rdef.setReportTitle(reportTitle);
+ rdef.setReportSubTitle(reportSubTitle);
+ rdef.setReportHeader(reportHeader);
+ rdef.setReportFooter(reportFooter);
+ rdef.setIsOneTimeScheduleAllowed(isOneTimeScheduleAllowed);
+ rdef.setIsHourlyScheduleAllowed(isHourlyScheduleAllowed);
+ rdef.setIsDailyScheduleAllowed(isDailyScheduleAllowed);
+ rdef.setIsDailyMFScheduleAllowed(isDailyMFScheduleAllowed);
+ rdef.setIsWeeklyScheduleAllowed(isWeeklyScheduleAllowed);
+ rdef.setIsMonthlyScheduleAllowed(isMonthlyScheduleAllowed);
+ rdef.setFrozenColumns(frozenColumns);
+
+ } // if
+
+ if (rdef.getWizardSequence() instanceof WizardSequence)
+ rdef.generateWizardSequence(request);
+
+
+ /*
+ * if(formHelp.length()>255) formHelp = formHelp.substring(0, 255);
+ */
+
+
+ // String rPublic = nvl(AppUtils.getRequestValue(request, "public"),
+ // "N");
+ // String menuID = AppUtils.getRequestNvlValue(request, "menuID");
+
+// boolean dashboardOptionsShown = AppUtils.getRequestNvlValue(request,
+// "dashboardOptionsShown").equals("Y");
+
+ reportUpdated = true;
+
+ if (rdef.getReportID().equals("-1"))
+ // Always need to persist new report - in case it is a copy
+ reportUpdated = true;
+
+ return reportUpdated;
+ } // processDefinition
+
+ private boolean processTableAdd(HttpServletRequest request) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+
+ String tableName = AppUtils.getRequestNvlValue(request, "tableName").toUpperCase();
+ String tableId = rdef.getUniqueTableId(tableName);
+
+ String joinTableExpr = null;
+ String joinTableId = null;
+
+ DataSourceType joinTable =
+ rdef.getTableById(AppUtils.getRequestValue(request, "joinTableName"));
+ if (joinTable != null) {
+ String joinTableName = joinTable.getTableName();
+ joinTableId = joinTable.getTableId();
+
+ String joinExpr = AppUtils.getRequestNvlValue(request, "joinExpr").toUpperCase();
+
+ joinTableExpr = joinExpr.replaceAll("\\["+tableName+"\\]", tableId);
+ joinTableExpr = joinTableExpr.replaceAll("\\["+joinTableName+"\\]", joinTableId);
+// debugLogger.debug("joinExpr : "+joinExpr+"\njoinTableExpr : "+ joinTableExpr);
+ }
+
+ rdef.addDataSourceType(new ObjectFactory(), tableId, tableName, AppUtils
+ .getRequestNvlValue(request, "tablePK"), AppUtils.getRequestNvlValue(request,
+ "displayName"), joinTableId, joinTableExpr, null);
+
+ rdef.setOuterJoin(rdef.getTableById(tableId), AppUtils.getRequestNvlValue(request,
+ "outerJoin"));
+ rdef.resetCache(true);
+
+ return true;
+ } // processTableAdd
+
+ private boolean processTableEdit(HttpServletRequest request) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+
+ DataSourceType dst = rdef.getTableById(AppUtils.getRequestNvlValue(request,
+ AppConstants.RI_DETAIL_ID));
+
+ String displayName = XSSFilter.filterRequest(AppUtils.getRequestNvlValue(request, "displayName"));
+ String outerJoin = AppUtils.getRequestNvlValue(request, "outerJoin");
+
+ String tableName = AppUtils.getRequestNvlValue(request, "tableName").toUpperCase();
+ String joinTableId = AppUtils.getRequestNvlValue(request, "joinTableName");
+
+ String joinExpr = AppUtils.getRequestNvlValue(request, "joinExpr").toUpperCase();
+
+ String joinTableExpr = null;
+ if(joinExpr.length()!=0){
+ joinTableExpr = joinExpr.replaceAll("\\["+tableName+"\\]", rdef.getTableByDBName(tableName).getTableId());
+ joinTableExpr = joinTableExpr.replaceAll("\\["+rdef.getTableById(joinTableId).getTableName().toUpperCase()+"\\]", joinTableId);
+ dst.setRefDefinition(joinTableExpr);
+ }
+ boolean reportUpdated = (!displayName.equals(nvl(dst.getDisplayName())) ||
+ !outerJoin.equals(rdef.getOuterJoinType(dst)) ||
+ !(joinExpr.length()==0));
+
+ dst.setDisplayName(displayName);
+ rdef.setOuterJoin(dst, outerJoin);
+ if (reportUpdated)
+ rdef.resetCache(true);
+
+ return true; // reportUpdated;
+ } // processTableEdit
+
+
+ private boolean processTableDelete(HttpServletRequest request) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+ rdef.deleteDataSourceType(AppUtils.getRequestNvlValue(request,
+ AppConstants.RI_DETAIL_ID));
+ return true;
+ } // processTableDelete
+
+ private boolean processColumnAddEdit(HttpServletRequest request, boolean isEdit)
+ throws Exception {
+ if(!isEdit) {
+ return true;
+ }
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+ DataColumnType currColumn = null;
+
+ String tableId = null;
+ String colName = null;
+ String dataType = null;
+ if (isEdit) {
+ currColumn = rdef.getColumnById(AppUtils.getRequestNvlValue(request,
+ AppConstants.RI_DETAIL_ID));
+
+ if(currColumn!=null) {
+ tableId = currColumn.getTableId();
+ colName = currColumn.getDbColName(); // currColumn.getColName();
+ dataType = currColumn.getDbColType();
+ }
+ } else {
+ String colData = AppUtils.getRequestNvlValue(request, "columnDetails");
+ if(nvl(colData).length()>0) {
+ tableId = colData.substring(0, colData.indexOf('|'));
+ colName = colData.substring(tableId.length() + 1,
+ colData.indexOf('|', tableId.length() + 1)).toUpperCase();
+ dataType = colData.substring(tableId.length() + colName.length() + 2);
+ }
+ } // else
+
+ String exprFormula = AppUtils.getRequestNvlValue(request, "exprFormula");
+
+ String colNameValue = null;
+ if (exprFormula.length() > 0)
+ if (exprFormula.equals("_exprText_"))
+ colNameValue = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestValue(request, "exprText"));
+ else if (exprFormula.equals("COUNT(*)"))
+ colNameValue = exprFormula;
+ else
+ colNameValue = exprFormula + " " + colName + ")";
+ else
+ colNameValue = colName;
+
+ int displayWidth = -1;
+ try {
+ displayWidth = Integer.parseInt(AppUtils.getRequestValue(request, "displayWidth"));
+ } catch (NumberFormatException e) {
+ }
+
+ String sColId = isEdit ? currColumn.getColId() : (nvl(colName).length()>0?rdef.getUniqueColumnId(colName):null);
+ String drillDownParams = AppUtils.getRequestValue(request, "drillDownParams");
+ if (drillDownParams != null) {
+ // Replacing references to [this] with [col_id]
+ while (drillDownParams.indexOf("[this]") >= 0) {
+ int startIdx = drillDownParams.indexOf("[this]");
+ StringBuffer sb = new StringBuffer();
+
+ if (startIdx > 0)
+ sb.append(drillDownParams.substring(0, startIdx));
+ sb.append("[" + sColId + "]");
+ if (startIdx + 6 < drillDownParams.length() - 1)
+ sb.append(drillDownParams.substring(startIdx + 5));
+ drillDownParams = sb.toString();
+ } // while
+ } // if
+
+ String crossTabValue = null;
+ boolean isVisible = AppUtils.getRequestFlag(request, "visible");
+ boolean isSortable = AppUtils.getRequestFlag(request, "sortable");
+ String nowrap = AppUtils.getRequestNvlValue(request, "nowrap");
+ int indentation = 0;
+ try {
+ indentation = Integer.parseInt(AppUtils.getRequestNvlValue(request, "indentation"));
+ }catch (NumberFormatException e) {
+ }
+ String dependsOnFormField = AppUtils.getRequestNvlValue(request, "dependsOnFormField");
+ boolean isGroupBreak = AppUtils.getRequestFlag(request, "groupBreak");
+ String groupByPosStr = AppUtils.nvls(AppUtils.getRequestValue(request, "groupByPos"), "0");
+ int groupByPos = Integer.parseInt(groupByPosStr);
+ currColumn.setGroupByPos(groupByPos);
+
+ if(groupByPos > 0) {
+ String subTotalCustomText = AppUtils.nvls(AppUtils.getRequestValue(request, "subTotalCustomText"), "Sub Total");
+ currColumn.setSubTotalCustomText(subTotalCustomText);
+
+ boolean hideRepeatedKey = AppUtils.getRequestFlag(request, "hideRepeatedKeys");
+ currColumn.setHideRepeatedKey(hideRepeatedKey);
+ }
+
+ String displayTotal = AppUtils.getRequestNvlValue(request, "displayTotal");
+ String widthInPxls = AppUtils.getRequestNvlValue(request, "widthInPxls");
+
+ if (rdef.getReportType().equals(AppConstants.RT_CROSSTAB)) {
+
+
+
+ crossTabValue = AppUtils.getRequestValue(request, "crossTabValue");
+ isVisible = nvl(crossTabValue).equals(AppConstants.CV_ROW)
+ || nvl(crossTabValue).equals(AppConstants.CV_COLUMN)
+ || nvl(crossTabValue).equals(AppConstants.CV_VALUE);
+ isGroupBreak = nvl(crossTabValue).equals(AppConstants.CV_ROW)
+ || nvl(crossTabValue).equals(AppConstants.CV_COLUMN);
+
+ if (nvl(crossTabValue).equals(AppConstants.CV_VALUE))
+ displayTotal += "|"
+ + AppUtils.getRequestNvlValue(request, "displayTotalPerRow");
+ else
+ displayTotal = "";
+ } // if
+
+ String displayName = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "displayName"));
+ String colType = AppUtils.getRequestNvlValue(request, "colType");
+ String displayFormat = AppUtils.getRequestNvlValue(request, "displayFormat");
+
+ //HYPERLINK
+ if(colType.equals(AppConstants.CT_HYPERLINK)) {
+ String hyperlinkURL = AppUtils.getRequestValue(request, "hyperlinkURL");
+ currColumn.setHyperlinkURL(hyperlinkURL);
+ String anchor = AppUtils.getRequestValue(request, "anchor");
+ currColumn.setHyperlinkType(anchor);
+ if(anchor.equals("IMAGE")) {
+ String actionImg = AppUtils.getRequestValue(request, "actionImg");
+ currColumn.setActionImg(actionImg);
+ }
+ }
+
+
+
+ String displayAlign = AppUtils.getRequestValue(request, "displayAlign");
+ String displayHeaderAlign = AppUtils.getRequestValue(request, "displayHeaderAlign");
+ String drillDownURL = AppUtils.getRequestValue(request, "drillDownURL");
+ String drillDownSuppress = AppUtils.getRequestValue(request, "drillDownSuppress");
+ boolean drillDownPopUp = AppUtils.getRequestFlag (request, "drillDownPopUp");
+ String semaphoreId = AppUtils.getRequestNvlValue(request, "semaphore");
+ String semaphoreType = AppUtils.getRequestNvlValue(request, "semaphoreTypeHidden");
+
+ String levelStr = AppUtils.getRequestNvlValue(request, "multiGroupColLevel");
+ String startColGroup = AppUtils.getRequestNvlValue(request, "startMultiGroup");
+ String colGroupColSpan = AppUtils.getRequestNvlValue(request, "colspan");
+ int level = 0;
+ try {
+ level = Integer.parseInt(levelStr);
+ }catch (NumberFormatException ex) {
+ level = 0;
+ }
+ int startColGroupInt = 0;
+ int colGroupColSpanInt = 0;
+ if(level > 0) {
+ try {
+ //startColGroupInt = Integer.parseInt(startColGroup);
+ colGroupColSpanInt = Integer.parseInt(colGroupColSpan);
+ } catch (NumberFormatException ex) {
+
+ }
+ }
+ currColumn.setLevel(level);
+ if(level > 0) {
+ currColumn.setStart(startColGroupInt);
+ currColumn.setColspan(colGroupColSpanInt);
+ }
+
+ String targetColumnId = (semaphoreType.indexOf("|")!= -1 ? semaphoreType.substring(semaphoreType.indexOf("|")+1):"");
+ DataColumnType targetColumn = rdef.getColumnById(targetColumnId);
+
+ SemaphoreType semaphore = rdef.getSemaphoreById(semaphoreId);
+ rdef.deleteSemaphore(semaphore);
+ if(nvl(semaphoreType).length() > 0 && semaphoreType.indexOf("|")!=-1)
+ semaphore.setSemaphoreType(semaphoreType.substring(0,semaphoreType.indexOf("|")));
+ if(semaphore!=null) {
+ semaphore.setComment(currColumn.getColId());
+ if(nvl(semaphoreType).length() > 0)
+ semaphore.setTarget(targetColumnId.length()>0? targetColumnId: "");
+ rdef.setSemaphore(semaphore);
+ }
+
+
+ if (isEdit) {
+ if(nvl(widthInPxls).length()>0) {
+ if(nvl(widthInPxls).endsWith("px"))
+ currColumn.setDisplayWidthInPxls(widthInPxls);
+ else
+ currColumn.setDisplayWidthInPxls(widthInPxls+"px");
+ } else {
+ currColumn.setDisplayWidthInPxls("");
+ }
+
+ currColumn.setCrossTabValue(crossTabValue);
+ currColumn.setDependsOnFormField(dependsOnFormField);
+ currColumn.setDisplayName(displayName);
+ //currColumn.setOriginalDisplayName(displayName);
+
+ if (displayWidth > 0)
+ currColumn.setDisplayWidth(displayWidth);
+ currColumn.setDisplayAlignment(displayAlign);
+ currColumn.setDisplayHeaderAlignment(displayHeaderAlign);
+ currColumn.setDrillDownURL(drillDownURL);
+ currColumn.setDrillDownParams(drillDownParams);
+ currColumn.setDrillDownType(drillDownSuppress);
+ currColumn.setDrillinPoPUp(drillDownPopUp);
+ //indentation
+ currColumn.setIndentation(indentation);
+ if(drillDownPopUp) {
+ rdef.setDrillDownURLInPopupPresent(true);
+ }
+ /*if(targetColumn!=null) {
+ currColumn.setSemaphoreId(null);
+ targetColumn.setSemaphoreId(semaphoreId);
+ } else */
+ currColumn.setSemaphoreId(semaphoreId);
+ currColumn.setGroupBreak(isGroupBreak);
+ logger.debug(EELFLoggerDelegate.debugLogger, (" ------------ Display Total ---------- "+ displayTotal));
+ currColumn.setDisplayTotal(displayTotal);
+ //if (currColumn.getDrillDownURL() == null || currColumn.getDrillDownURL().length() == 0)
+ currColumn.setVisible(isVisible);
+ currColumn.setIsSortable(isSortable);
+ currColumn.setNowrap(nowrap);
+ //else
+ // currColumn.setVisible(true);
+ if (rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED)) {
+ if(colType!=null)
+ currColumn.setColType(colType);
+ displayFormat = AppUtils.getRequestValue(request, "colDataFormat");
+ if (displayFormat != null){
+ currColumn.setColFormat(displayFormat);
+ }
+ if(colType!=null && colType.equals(AppConstants.CT_DATE)) {
+ boolean enhancedPagination = AppUtils.getRequestFlag(request, "enhancedPagination");
+ currColumn.setEnhancedPagination(enhancedPagination);
+ }
+ }
+ if (!rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED)) {
+ currColumn.setColName(colNameValue);
+ if (displayFormat != null)
+ currColumn.setColFormat(displayFormat);
+ //currColumn.setVisible(isVisible);
+ currColumn.setCalculated(exprFormula.length() > 0);
+
+ rdef.adjustColumnType(currColumn);
+ } // if
+
+ rdef.resetCache(true);
+ } else
+ currColumn = rdef.addDataColumnType(new ObjectFactory(), sColId, tableId, colName,
+ crossTabValue, colNameValue, displayName, displayWidth, displayAlign, rdef
+ .getAllColumns().size() + 1, isVisible,
+ (exprFormula.length() > 0), adjustDataType(dataType), displayFormat,
+ isGroupBreak, -1, null, displayTotal, null, -1, drillDownSuppress,
+ drillDownURL, drillDownParams, semaphoreId, null);
+
+ if (rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED))
+ rdef.setColumnNoParseDateFlag(currColumn, AppUtils.getRequestFlag(request,
+ "no_parse_date"));
+ if(nvl(displayName).length()>0)
+ return true;
+ else
+ return false;
+ } // processColumnAddEdit
+
+ private boolean processColumnAddMulti(HttpServletRequest request) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+
+ List reportCols = rdef.getAllColumns();
+ int nCol = reportCols.size() + 1;
+
+ String[] addColumn = request.getParameterValues("addColumn");
+ String[] tableId = request.getParameterValues("tableId");
+ String[] columnName = request.getParameterValues("columnName");
+ String[] columnType = request.getParameterValues("columnType");
+ String[] displayName = request.getParameterValues("displayName");
+
+ for (int i = 0; i < addColumn.length; i++)
+ if (addColumn[i].equals("Y")) {
+ int j = 2;
+ String uniqueDisplayName = displayName[i];
+ boolean isUnique = true;
+ do {
+ isUnique = true;
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();)
+ if (uniqueDisplayName.equals(((DataColumnType) iter.next())
+ .getDisplayName())) {
+ isUnique = false;
+ uniqueDisplayName = displayName[i] + (j++);
+ break;
+ } // if
+ } while (!isUnique);
+
+ rdef
+ .addDataColumnType(
+ new ObjectFactory(),
+ rdef.getUniqueColumnId(columnName[i]),
+ tableId[i],
+ columnName[i],
+ null,
+ columnName[i],
+ uniqueDisplayName,
+ 10,
+ "Left",
+ nCol++,
+ true,
+ false,
+ adjustDataType(columnType[i]),
+ (columnType[i].equals(AppConstants.CT_DATE) ? AppConstants.DEFAULT_DATE_FORMAT
+ : null), false, -1, null, null, null, -1, null, null,
+ null, null, null);
+ } // if
+
+ return true;
+ } // processColumnAddMulti
+
+ private boolean processColumnOrderAll(HttpServletRequest request) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+
+ String[] colId = request.getParameterValues("colId");
+ String[] colOrder = request.getParameterValues("colOrder");
+
+ boolean reportUpdated = false;
+ for (int i = 0; i < colId.length; i++) {
+ DataColumnType dct = rdef.getColumnById(nvl(colId[i]));
+ if (dct == null)
+ continue;
+
+ int iColOrder = 0;
+ try {
+ iColOrder = Integer.parseInt(colOrder[i]);
+ } catch (NumberFormatException e) {
+ }
+
+ if (iColOrder > 0) {
+ dct.setOrderSeq(iColOrder);
+ reportUpdated = true;
+ } // if
+ } // for
+
+ if (reportUpdated) {
+ List reportCols = rdef.getAllColumns();
+ Collections.sort(reportCols, new OrderSeqComparator());
+
+ int iOrder = 1;
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dct = (DataColumnType) iter.next();
+ dct.setOrderSeq(iOrder++);
+ } // for
+
+ rdef.resetCache(false);
+ } // if
+
+ return reportUpdated;
+ } // processColumnOrderAll
+
+ private boolean processColumnDelete(HttpServletRequest request) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+ rdef.deleteDataColumnType(AppUtils.getRequestNvlValue(request,
+ AppConstants.RI_DETAIL_ID));
+ return true;
+ } // processColumnDelete
+
+ private boolean processColumnMoveUp(HttpServletRequest request) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+ rdef.shiftColumnOrderUp(AppUtils
+ .getRequestNvlValue(request, AppConstants.RI_DETAIL_ID));
+ return true;
+ } // processColumnMoveUp
+
+ private boolean processColumnMoveDown(HttpServletRequest request) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+ rdef.shiftColumnOrderDown(AppUtils.getRequestNvlValue(request,
+ AppConstants.RI_DETAIL_ID));
+ return true;
+ } // processColumnMoveDown
+
+ private boolean processFormFieldAddEdit(HttpServletRequest request, boolean isEdit,
+ String action) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+
+ String fieldName = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "fieldName"));
+ String multiSelectSize = "0";
+ String colId = AppUtils.getRequestNvlValue(request, "fieldColId");
+ if (rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED)) {
+ String displayFormat = AppUtils.getRequestNvlValue(request, "displayFormat");
+ if (displayFormat.length() > 0)
+ colId += "|" + displayFormat;
+ } // if
+ String fieldType = AppUtils.getRequestNvlValue(request, "fieldType");
+ String validation = AppUtils.getRequestNvlValue(request, "validation");
+ String mandatory = nvl(AppUtils.getRequestValue(request, "mandatory"), "N");
+ String defaultValue = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "defaultValue"));
+ String fieldHelp = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "fieldHelp"));
+ String fieldSQL = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "fieldSQL"));
+ String fieldDefaultSQL = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "fieldDefaultSQL"));
+ String visible = nvl(AppUtils.getRequestValue(request, "visible"),"Y");
+ String dependsOn = nvl(AppUtils.getRequestValue(request, "dependsOn"),"");
+ String rangeStartDate = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "rangeStartDate"));
+ String rangeEndDate = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "rangeEndDate"));
+ String rangeStartDateSQL = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "rangeStartDateSQL"));
+ String rangeEndDateSQL = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "rangeEndDateSQL"));
+ boolean isGroupFormField = AppUtils.getRequestFlag(request,"isGroupFormField");
+
+ Calendar start = null;
+ Calendar end = null;
+ if (AppUtils.nvl(rangeStartDate).length()>0){
+ SimpleDateFormat dtf = new SimpleDateFormat("MM/dd/yyyy");
+ start = Calendar.getInstance();
+ start.setTime(dtf.parse(rangeStartDate));
+ }
+ if (AppUtils.nvl(rangeEndDate).length()>0){
+ SimpleDateFormat dtf = new SimpleDateFormat("MM/dd/yyyy");
+ end = Calendar.getInstance();
+ end.setTime(dtf.parse(rangeEndDate));
+ }/*
+ * if(fieldHelp.length()>255) fieldHelp = fieldHelp.substring(0, 255);
+ */
+
+ boolean reportUpdated = false;
+
+ FormFieldType currField = null;
+ if (isEdit) {
+ String fieldId = AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID);
+
+ currField = rdef.getFormFieldById(fieldId);
+ if (currField != null && nvl(fieldName).length()>0) {
+ reportUpdated = (!(fieldName.equals(nvl(currField.getFieldName()))
+ && colId.equals(nvl(currField.getColId()))
+ && fieldType.equals(nvl(currField.getFieldType()))
+ && validation.equals(nvl(currField.getValidationType()))
+ && mandatory.equals(nvl(currField.getMandatory(), "N"))
+ && defaultValue.equals(nvl(currField.getDefaultValue()))
+ && fieldSQL.equals(nvl(currField.getFieldSQL()))
+ && fieldDefaultSQL.equals(nvl(currField.getFieldDefaultSQL()))
+ && dependsOn.equals(nvl(currField.getDependsOn(), "N"))
+ && (start == null || (start != null && currField.getRangeStartDate() == null) || (start.equals(currField.getRangeStartDate())))
+ && (end == null || (end != null && currField.getRangeEndDate() == null) || (end.equals(currField.getRangeEndDate())))
+ && rangeStartDateSQL.equals(nvl(currField.getRangeStartDateSQL()))
+ && rangeEndDateSQL.equals(nvl(currField.getRangeEndDateSQL()))
+ && visible.equals(nvl(currField.getVisible(), "Y"))
+ && isGroupFormField == currField.isGroupFormField()
+ && fieldHelp.equals(nvl(currField.getComment()))));
+
+ rdef.replaceFormFieldReferences("[" + currField.getFieldName() + "]", "["
+ + fieldName + "]");
+
+ currField.setFieldName(fieldName);
+ currField.setColId(colId);
+ currField.setFieldType(fieldType);
+ currField.setValidationType(validation);
+ currField.setMandatory(mandatory);
+ currField.setDefaultValue(defaultValue);
+ currField.setFieldSQL(fieldSQL);
+ currField.setFieldDefaultSQL(fieldDefaultSQL);
+ currField.setComment(fieldHelp);
+ currField.setVisible(visible);
+ currField.setDependsOn(dependsOn);
+ try {
+ if(start!=null) {
+ currField.setRangeStartDate(DatatypeFactory.newInstance()
+ .newXMLGregorianCalendar(start.YEAR, start.MONTH, start.DAY_OF_WEEK, start.HOUR, start.MINUTE, start.SECOND, start.MILLISECOND, start.ZONE_OFFSET));
+ } else {
+ currField.setRangeStartDate(null);
+ }
+ if(end!=null) {
+ currField.setRangeEndDate(DatatypeFactory.newInstance()
+ .newXMLGregorianCalendar(end.YEAR, end.MONTH, end.DAY_OF_WEEK, end.HOUR, end.MINUTE, end.SECOND, end.MILLISECOND, end.ZONE_OFFSET));
+ } else {
+ currField.setRangeEndDate(null);
+ }
+ /*currField.setRangeEndDate(DatatypeFactory.newInstance()
+ .newXMLGregorianCalendar(end));*/
+ } catch (DatatypeConfigurationException ex) {
+
+ }
+
+ currField.setRangeStartDateSQL(rangeStartDateSQL);
+ currField.setRangeEndDateSQL(rangeEndDateSQL);
+ currField.setGroupFormField(isGroupFormField);
+ if(fieldType.equals(FormField.FFT_LIST_MULTI)) {
+ multiSelectSize = AppUtils.getRequestNvlValue(request, "multiSelectListSize");
+ currField.setMultiSelectListSize(multiSelectSize);
+ }
+
+
+ } // if
+ } else {
+ reportUpdated = true;
+
+ currField = rdef.addFormFieldType(new ObjectFactory(), fieldName, colId,
+ fieldType, validation, mandatory, defaultValue, fieldSQL, fieldHelp, start, end, rangeStartDateSQL, rangeEndDateSQL);
+
+ request.setAttribute(AppConstants.RI_DETAIL_ID, currField.getFieldId());
+ } // else
+
+ if (action.equals(AppConstants.WA_ADD_USER)) {
+ reportUpdated = true;
+ rdef.addFormFieldPredefinedValue(new ObjectFactory(), currField, XSSFilter.filterRequestOnlyScript(AppUtils
+ .getRequestNvlValue(request, "newPredefinedValue")));
+ } else if (action.equals(AppConstants.WA_DELETE_USER)) {
+ reportUpdated = true;
+ rdef.deleteFormFieldPredefinedValue(currField, AppUtils.getRequestNvlValue(
+ request, "delPredefinedValue"));
+ }
+
+ return reportUpdated;
+ } // processFormFieldAddEdit
+
+ private boolean processFormFieldDelete(HttpServletRequest request) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+
+ String fieldId = AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID);
+ rdef.deleteFormField(fieldId);
+
+ return true;
+ } // processFormFieldDelete
+
+ private boolean processFormFieldMoveUp(HttpServletRequest request) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+ rdef.shiftFormFieldUp(AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID));
+ return true;
+ } // processFormFieldMoveUp
+
+ private boolean processFormFieldMoveDown(HttpServletRequest request) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+ rdef.shiftFormFieldDown(AppUtils
+ .getRequestNvlValue(request, AppConstants.RI_DETAIL_ID));
+ return true;
+ } // processFormFieldMoveDown
+
+ private boolean processFormFieldBlank(HttpServletRequest request) throws Exception {
+ boolean reportUpdated = false;
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+ reportUpdated = true;
+ rdef.addFormFieldBlank(new ObjectFactory());
+ return true;
+ } // processFormFieldMoveDown
+
+ //processFormFieldInfoBar
+ private boolean processFormFieldInfoBar(HttpServletRequest request) throws Exception {
+ boolean reportUpdated = false;
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+ reportUpdated = true;
+ rdef.addCustomizedTextForParameters(XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "blueBarField")));
+ return true;
+ } // processFormFieldMoveDown
+
+
+ private boolean processForecasting(HttpServletRequest request, String action) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+
+ if(rdef.getDataminingOptions()==null)
+ rdef.addDataminingOptions(new ObjectFactory());
+
+ String classifiers = AppUtils.getRequestNvlValue(request, "classifiers");
+ rdef.setClassifier(classifiers);
+ String dateAttrColId = AppUtils.getRequestNvlValue(request, "timeAttribute");
+ String timeFormat = AppUtils.getRequestNvlValue(request, "timeFormat");
+ if(timeFormat.equals("Default")) timeFormat = "yyyy-MM-dd HH:mm:ss";
+ String forecastingPeriod = AppUtils.getRequestNvlValue(request, "forecastingPeriod");
+
+ String[] forecastCols = request.getParameterValues("forecastCol");
+ List reportCols = rdef.getAllColumns();
+ DataColumnType dct = null;
+ Iterator iter = null;
+
+
+
+ if(dateAttrColId != null) {
+ for(iter=reportCols.iterator(); iter.hasNext(); ) {
+ dct = (DataColumnType) iter.next();
+ if(dct.getColId().equals(dateAttrColId)) {
+ dct.setDataMiningCol(AppConstants.DM_DATE_ATTR);
+ if(timeFormat!=null) rdef.setForecastingTimeFormat(timeFormat);
+ break;
+ }
+ }
+ }
+
+ if(forecastCols != null) {
+ for (int i = 0; i < forecastCols.length; i++) {
+ for(iter=reportCols.iterator(); iter.hasNext(); ) {
+ dct = (DataColumnType) iter.next();
+ if(dct.getColId().equals(forecastCols[i])) {
+ dct.setDataMiningCol(AppConstants.DM_FORECASTING_ATTR);
+ }
+ }
+ }
+ rdef.setForecastingPeriod(forecastingPeriod);
+ }
+ boolean reportUpdated = true;
+
+ return reportUpdated;
+ } // processForecasting
+
+
+ private boolean processFilterAddEdit(HttpServletRequest request, boolean isEdit)
+ throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+
+ String colId = AppUtils.getRequestNvlValue(request, "filterColId");
+ String filterExpr = AppUtils.getRequestNvlValue(request, "filterExpr");
+ String argType = (filterExpr.equals("IS NULL") || filterExpr.equals("IS NOT NULL")) ? null
+ : AppUtils.getRequestNvlValue(request, "argType");
+ String argValue = (filterExpr.equals("IS NULL") || filterExpr.equals("IS NOT NULL")) ? null
+ : AppUtils.getRequestNvlValue(request, "argValue");
+
+ if (nvl(argType).equals(AppConstants.AT_COLUMN)) {
+ List reportCols = rdef.getAllColumns();
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dct = (DataColumnType) iter.next();
+ if (argValue.equals("[" + dct.getDisplayName() + "]")) {
+ argValue = dct.getColId();
+ break;
+ }
+ } // for
+ } // if
+
+ if (nvl(argType).equals(AppConstants.AT_VALUE)
+ && (!nvl(argValue).equals(AppConstants.FILTER_MAX_VALUE))
+ && (!nvl(argValue).equals(AppConstants.FILTER_MIN_VALUE))) {
+ // Validating the value by type
+ DataColumnType currColumn = rdef.getColumnById(colId);
+ String currColType = currColumn.getColType();
+
+ try {
+ String s_sql = Globals.getProcessFilterAddEdit();
+ s_sql = s_sql.replace("[argValue]", argValue);
+ /*DataSet ds = DbUtils.executeQuery("SELECT "
+ + (currColType.equals(AppConstants.CT_NUMBER) ? ("TO_NUMBER('"
+ + argValue + "')")
+ : (currColType.equals(AppConstants.CT_DATE) ? ("TO_DATE('"
+ + argValue
+ + "', '"
+ + nvl(currColumn.getColFormat(),
+ AppConstants.DEFAULT_DATE_FORMAT) + "')")
+ : ("'" + argValue + "'"))) + " FROM dual");*/
+
+ DataSet ds = DbUtils.executeQuery("SELECT "
+ + (currColType.equals(AppConstants.CT_NUMBER) ? ("TO_NUMBER('"
+ + argValue + "')")
+ : (currColType.equals(AppConstants.CT_DATE) ? ("TO_DATE('"
+ + argValue
+ + "', '"
+ + nvl(currColumn.getColFormat(),
+ AppConstants.DEFAULT_DATE_FORMAT) + "')")
+ : s_sql)));
+ } catch (Exception e) {
+ throw new ValidationException(
+ ""
+ + (currColType.equals(AppConstants.CT_NUMBER) ? "Invalid number"
+ : (currColType.equals(AppConstants.CT_DATE) ? ("Invalid date<br>Expected date format " + nvl(
+ currColumn.getColFormat(),
+ AppConstants.DEFAULT_DATE_FORMAT))
+ : "Invalid value<br>Possible reason: use of single quotes"))
+ + "<!--" + e.getMessage() + "--><br>Value: " + argValue);
+ }
+ } // if
+
+ if (isEdit) {
+ int filterPos = -1;
+ try {
+ filterPos = Integer.parseInt(AppUtils.getRequestValue(request, "filterPos"));
+ } catch (NumberFormatException e) {
+ }
+
+ ColFilterType currFilter = rdef.getFilterById(colId, filterPos);
+ if (currFilter != null) {
+ currFilter.setJoinCondition(AppUtils.getRequestValue(request, "filterJoin"));
+ currFilter.setOpenBrackets(AppUtils.getRequestValue(request, "openBrackets"));
+ currFilter.setExpression(filterExpr);
+ // if(argType!=null)
+ currFilter.setArgType(argType);
+ // if(argValue!=null)
+ currFilter.setArgValue(argValue);
+ currFilter
+ .setCloseBrackets(AppUtils.getRequestValue(request, "closeBrackets"));
+ } // if
+
+ rdef.resetCache(true);
+ } else {
+ rdef.addColFilterType(new ObjectFactory(), colId, AppUtils.getRequestValue(
+ request, "filterJoin"), AppUtils.getRequestValue(request, "openBrackets"),
+ filterExpr, argType, argValue, AppUtils.getRequestValue(request,
+ "closeBrackets"), null);
+ } // else
+
+ return true;
+ } // processFilterAddEdit
+
+ private boolean processFilterDelete(HttpServletRequest request) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+
+ String filterId = AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID);
+ String colId = filterId.substring(0, filterId.indexOf('|'));
+ int filterPos = -1;
+ try {
+ filterPos = Integer.parseInt(filterId.substring(colId.length() + 1));
+ } catch (NumberFormatException e) {
+ }
+
+ rdef.removeColumnFilter(colId, filterPos);
+
+ return true;
+ } // processFilterDelete
+
+ private boolean processSortAddEdit(HttpServletRequest request, boolean isEdit)
+ throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+
+ String sortAscDesc = AppUtils.getRequestNvlValue(request, "sortAscDesc");
+ if (isEdit) {
+ DataColumnType currColumn = rdef.getColumnById(AppUtils.getRequestNvlValue(
+ request, AppConstants.RI_DETAIL_ID));
+ if (currColumn != null)
+ currColumn.setOrderByAscDesc(sortAscDesc);
+ rdef.resetCache(true);
+ } else
+ rdef.addColumnSort(AppUtils.getRequestNvlValue(request, "sortColId"), sortAscDesc,
+ rdef.getNumSortColumns() + 1);
+
+ return true;
+ } // processSortAddEdit
+
+ private boolean processSortOrderAll(HttpServletRequest request) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+
+ String[] colId = request.getParameterValues("colId");
+ String[] sortOrder = request.getParameterValues("sortOrder");
+ String[] sortAscDesc = request.getParameterValues("sortAscDesc");
+
+ boolean reportUpdated = false;
+ for (int i = 0; i < colId.length; i++) {
+ DataColumnType dct = rdef.getColumnById(nvl(colId[i]));
+ if (dct == null)
+ continue;
+
+ int iSortOrder = 0;
+ try {
+ iSortOrder = Integer.parseInt(sortOrder[i]);
+ } catch (NumberFormatException e) {
+ }
+
+ if (iSortOrder > 0) {
+ if (dct.getOrderBySeq() > 0) {
+ // Update sort
+ if (dct.getOrderBySeq() != iSortOrder) {
+ dct.setOrderBySeq(iSortOrder);
+ reportUpdated = true;
+ } // if
+ if (!nvl(dct.getOrderByAscDesc()).equals(nvl(sortAscDesc[i]))) {
+ dct.setOrderByAscDesc(sortAscDesc[i]);
+ reportUpdated = true;
+ } // if
+ } else {
+ // Add sort
+ dct.setOrderBySeq(iSortOrder);
+ dct.setOrderByAscDesc(sortAscDesc[i]);
+ reportUpdated = true;
+ } // else
+ } else {
+ if (dct.getOrderBySeq() > 0) {
+ // Remove sort
+ dct.setOrderBySeq(0);
+ dct.setOrderByAscDesc(null);
+ reportUpdated = true;
+ } // if
+ } // else
+ } // for
+
+ if (reportUpdated) {
+ List reportCols = rdef.getAllColumns();
+ Collections.sort(reportCols, new OrderBySeqComparator());
+ int iOrder = 1;
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dct = (DataColumnType) iter.next();
+ if (dct.getOrderBySeq() > 0)
+ dct.setOrderBySeq(iOrder++);
+ } // for
+ Collections.sort(reportCols, new OrderSeqComparator());
+
+ rdef.resetCache(true);
+ } // if
+
+ return reportUpdated;
+ } // processSortOrderAll
+
+ private boolean processSortDelete(HttpServletRequest request) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+ rdef.removeColumnSort(AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID));
+ return true;
+ } // processSortDelete
+
+ private boolean processSortMoveUp(HttpServletRequest request) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+ rdef
+ .shiftColumnSortUp(AppUtils.getRequestNvlValue(request,
+ AppConstants.RI_DETAIL_ID));
+ return true;
+ } // processSortMoveUp
+
+ private boolean processSortMoveDown(HttpServletRequest request) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+ rdef.shiftColumnSortDown(AppUtils.getRequestNvlValue(request,
+ AppConstants.RI_DETAIL_ID));
+ return true;
+ } // processSortMoveDown
+
+ private boolean processJavascript (HttpServletRequest request) throws Exception {
+ processSaveJavascriptElement(request);
+ return true;
+ }
+
+ private boolean processSaveJavascriptElement (HttpServletRequest request) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+ rdef.setJavascriptElement(AppUtils.getRequestNvlValue(request, AppConstants.RI_JAVASCRIPT));
+ String id = AppUtils.getRequestNvlValue(request, AppConstants.RI_JAVASCRIPT_ITEM_ID);
+ String fieldId = AppUtils.getRequestNvlValue(request, "javascriptFormField-"+id);
+ if( nvl(fieldId).length()>0 && !(fieldId.startsWith("-1"))) {
+
+ String callableJavascriptText = AppUtils.getRequestNvlValue(request, "callText-"+id);
+
+ logger.debug(EELFLoggerDelegate.debugLogger, ("FieldId " + fieldId + " Call Text " + callableJavascriptText+ " id " + id));
+ JavascriptItemType javaScriptType = null;
+ if(id.length()>0 && id.startsWith("-1")) {
+ javaScriptType = rdef.addJavascriptType(new ObjectFactory(), id);
+ javaScriptType.setFieldId(fieldId);
+ if(!fieldId.equals("os1") || !fieldId.equals("ol1"))
+ javaScriptType.setId(rdef.getNextIdForJavaScriptElement(new ObjectFactory(), fieldId));
+ else {
+ if(fieldId.equals("os1"))
+ javaScriptType.setId("os1|1");
+ else
+ javaScriptType.setId("ol1|1");
+ }
+ javaScriptType.setCallText(callableJavascriptText);
+ } else {
+ javaScriptType = rdef.addJavascriptType(new ObjectFactory(), id);
+ javaScriptType.setCallText(callableJavascriptText);
+ }
+ }
+ return true;
+ }
+ private boolean processAddJavascriptElement (HttpServletRequest request) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+
+ JavascriptItemType javaScriptType = rdef.addJavascriptType(new ObjectFactory(), "");
+ javaScriptType.setId("");
+ javaScriptType.setFieldId("");
+ javaScriptType.setCallText("");
+
+ return true;
+ }
+
+ private boolean processDeleteJavascriptElement (HttpServletRequest request) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+ String id = AppUtils.getRequestNvlValue(request, AppConstants.RI_JAVASCRIPT_ITEM_ID);
+ if(rdef.deleteJavascriptType(id))
+ return true;
+ else
+ return false;
+ }
+
+ private boolean processChart(HttpServletRequest request, String action) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+
+ int valueColsCount = rdef.getChartValueColumnsList(AppConstants.CHART_ALL_COLUMNS, null).size();
+
+ String chartType = AppUtils.getRequestNvlValue(request, "chartType");
+ String chartTypeFixed = AppUtils.getRequestValue(request, "chartTypeFixed");
+ String legendColId = AppUtils.getRequestNvlValue(request, "legendCol");
+ // String valueColId = AppUtils.getRequestNvlValue(request, "valueCol");
+ String leftAxisLabel = AppUtils.getRequestValue(request, "leftAxisLabel");
+ String rightAxisLabel = AppUtils.getRequestValue(request, "rightAxisLabel");
+ String chartWidth = XSSFilter.filterRequest(AppUtils.getRequestNvlValue(request, "chartWidth"));
+ String chartHeight = XSSFilter.filterRequest(AppUtils.getRequestNvlValue(request, "chartHeight"));
+ String chartMultiseries = AppUtils.getRequestNvlValue(request, "multiSeries");
+ String lastSeriesALineChart = AppUtils.getRequestNvlValue(request, "lastSeriesALineChart");
+ String lastSeriesABarChart = AppUtils.getRequestNvlValue(request, "lastSeriesABarChart");
+ String overLayItemLabel = "N";
+ String chartDisplay = null;
+
+ String multiplePieOrder = null;
+ String multiplePieLabelDisplay = null;
+
+ String chartOrientation = null;
+ String secondaryChartRenderer = null;
+
+ String linearRegression = null;
+
+ boolean multiplePieOrderInRunPage = false;
+ boolean multiplePieLabelDisplayInRunPage = false;
+
+ boolean chartOrientationInRunPage = false;
+ boolean secondaryChartRendererInRunPage = false;
+
+ boolean chartDisplayInRunPage = false;
+
+ String intervalFromdate = null;
+ String intervalTodate = null;
+ String intervalLabel = null;
+ boolean displayIntervalInputInRunPage = false;
+ boolean animate = false;
+
+ animate = AppUtils.getRequestNvlValue(request, "animatedOption").equals("animate");
+ if(Globals.showAnimatedChartOption())
+ rdef.setChartAnimate(animate);
+
+
+ String removeColId = "";
+ if (action.equals(AppConstants.WA_DELETE_USER)) {
+ removeColId = AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID);
+ if(valueColsCount == 2 && !rdef.hasSeriesColumn()) {
+ rdef.setChartLeftAxisLabel(null);
+ rdef.setChartRightAxisLabel(null);
+
+ if(chartType.equals(AppConstants.GT_TIME_SERIES) || chartType.equals(AppConstants.GT_PIE_MULTIPLE)) {
+ chartMultiseries = "N";
+ }
+ }
+ }
+
+ if(rdef.getChartAdditionalOptions()==null)
+ rdef.addChartAdditionalOptions(new ObjectFactory());
+
+ if(rdef.getChartDrillOptions()==null)
+ rdef.addChartDrillOptions(new ObjectFactory());
+
+ //clearing already added
+ if(rdef.getChartDrillOptions().getTargetFormfield()!=null)
+ rdef.getChartDrillOptions().getTargetFormfield().removeAll(rdef.getChartDrillOptions().getTargetFormfield());
+
+
+ if(chartType.equals(AppConstants.GT_PIE_MULTIPLE)) {
+ multiplePieOrder = AppUtils.getRequestNvlValue(request, "multiplePieOrder");
+ multiplePieLabelDisplay = AppUtils.getRequestNvlValue(request, "multiplePieLabelDisplay");
+ chartDisplay = AppUtils.getRequestNvlValue(request, "chartDisplay");
+ //if(AppUtils.getRequestNvlValue(request, "multiplePieOrderInRunPage").length()>0)
+ multiplePieOrderInRunPage = AppUtils.getRequestNvlValue(request,"multiplePieOrderInRunPage").equals("Y");
+ //if(AppUtils.getRequestNvlValue(request, "multiplePieLabelDisplayInRunPage").length()>0)
+ multiplePieLabelDisplayInRunPage = AppUtils.getRequestNvlValue(request,"multiplePieLabelDisplayInRunPage").equals("Y");
+ //if(AppUtils.getRequestNvlValue(request, "chartDisplayInRunPage").length()>0)
+ chartDisplayInRunPage = AppUtils.getRequestNvlValue(request,"chartDisplayInRunPage").equals("Y");
+ if(rdef.getChartAdditionalOptions()!=null) {
+ rdef.setChartMultiplePieOrder(multiplePieOrder+(multiplePieOrderInRunPage?"|Y":""));
+ rdef.setChartMultiplePieLabelDisplay(multiplePieLabelDisplay+(multiplePieLabelDisplayInRunPage?"|Y":""));
+ rdef.setChartDisplay(chartDisplay+(chartDisplayInRunPage?"|Y":""));
+ }
+
+ }
+
+ if(chartType.equals(AppConstants.GT_REGRESSION)) {
+ linearRegression = AppUtils.getRequestNvlValue(request, "regressionType");
+ rdef.setLinearRegressionColor(AppUtils.getRequestNvlValue(request, "valueLinearRegressionColor"));
+ rdef.setExponentialRegressionColor(AppUtils.getRequestNvlValue(request, "valueExponentialRegressionColor"));
+ rdef.setCustomizedRegressionPoint(AppUtils.getRequestNvlValue(request, "regressionPointCustomization"));
+
+ if(nvl(linearRegression).length()>0)
+ rdef.setLinearRegression(linearRegression);
+ else
+ rdef.setLinearRegression("Y");
+ }
+
+ if(chartType.equals(AppConstants.GT_BAR_3D)) {
+ chartOrientation = AppUtils.getRequestNvlValue(request, "chartOrientation");
+ secondaryChartRenderer = AppUtils.getRequestNvlValue(request, "secondaryChartRenderer");
+ chartDisplay = AppUtils.getRequestNvlValue(request, "chartDisplay");
+ //if(AppUtils.getRequestNvlValue(request, "chartOrientationInRunPage").length()>0)
+ chartOrientationInRunPage = AppUtils.getRequestNvlValue(request,"chartOrientationInRunPage").equals("Y");
+ //if(AppUtils.getRequestNvlValue(request, "secondaryChartRendererInRunPage").length()>0)
+ secondaryChartRendererInRunPage = AppUtils.getRequestNvlValue(request,"secondaryChartRendererInRunPage").equals("Y");
+ //if(AppUtils.getRequestNvlValue(request, "chartDisplayInRunPage").length()>0)
+ chartDisplayInRunPage = AppUtils.getRequestNvlValue(request,"chartDisplayInRunPage").equals("Y");
+ rdef.setChartOrientation(chartOrientation+(chartOrientationInRunPage?"|Y":""));
+ rdef.setSecondaryChartRenderer(secondaryChartRenderer+(secondaryChartRendererInRunPage?"|Y":""));
+ rdef.setChartDisplay(chartDisplay+(chartDisplayInRunPage?"|Y":""));
+ rdef.setLastSeriesALineChart(nvl(lastSeriesALineChart, "N"));
+ }
+
+ if(chartType.equals(AppConstants.GT_LINE)) {
+ chartOrientation = AppUtils.getRequestNvlValue(request, "chartOrientation");
+ secondaryChartRenderer = AppUtils.getRequestNvlValue(request, "secondaryChartRenderer");
+ chartDisplay = AppUtils.getRequestNvlValue(request, "chartDisplay");
+ //if(AppUtils.getRequestNvlValue(request, "chartOrientationInRunPage").length()>0)
+ chartOrientationInRunPage = AppUtils.getRequestNvlValue(request,"chartOrientationInRunPage").equals("Y");
+ //if(AppUtils.getRequestNvlValue(request, "secondaryChartRendererInRunPage").length()>0)
+ secondaryChartRendererInRunPage = AppUtils.getRequestNvlValue(request,"secondaryChartRendererInRunPage").equals("Y");
+ //if(AppUtils.getRequestNvlValue(request, "chartDisplayInRunPage").length()>0)
+ chartDisplayInRunPage = AppUtils.getRequestNvlValue(request,"chartDisplayInRunPage").equals("Y");
+ rdef.setChartOrientation(chartOrientation+(chartOrientationInRunPage?"|Y":""));
+ rdef.setSecondaryChartRenderer(secondaryChartRenderer+(secondaryChartRendererInRunPage?"|Y":""));
+ rdef.setChartDisplay(chartDisplay+(chartDisplayInRunPage?"|Y":""));
+ rdef.setLastSeriesABarChart(nvl(lastSeriesABarChart, "N"));
+ }
+ if(chartType.equals(AppConstants.GT_TIME_DIFFERENCE_CHART)) {
+ intervalFromdate = AppUtils.getRequestNvlValue(request, "intervalFromDate");
+ intervalTodate = AppUtils.getRequestNvlValue(request, "intervalToDate");
+ intervalLabel = AppUtils.getRequestNvlValue(request, "intervalLabel");
+ displayIntervalInputInRunPage = AppUtils.getRequestNvlValue(request,"intervalInputInRunPage").equals("Y");
+ rdef.setIntervalFromdate(intervalFromdate+(displayIntervalInputInRunPage?"|Y":""));
+ rdef.setIntervalTodate(intervalTodate+(displayIntervalInputInRunPage?"|Y":""));
+ rdef.setIntervalLabel(intervalLabel);
+ }
+ if(chartType.equals(AppConstants.GT_STACKED_VERT_BAR) || chartType.equals(AppConstants.GT_STACKED_HORIZ_BAR) || chartType.equals(AppConstants.GT_STACKED_VERT_BAR_LINES)
+ || chartType.equals(AppConstants.GT_STACKED_HORIZ_BAR_LINES)) {
+ overLayItemLabel = AppUtils.getRequestNvlValue(request, "overlayItemValue");
+ rdef.setOverlayItemValueOnStackBar(nvl(overLayItemLabel, "N"));
+ animate = AppUtils.getRequestNvlValue(request, "animatedOption").equals("animate");
+ rdef.setChartAnimate(animate);
+ }
+
+ rdef.setRangeAxisLowerLimit(AppUtils.getRequestNvlValue(request, "yAxisLowerLimit"));
+ rdef.setRangeAxisUpperLimit(AppUtils.getRequestNvlValue(request, "yAxisUpperLimit"));
+ rdef.setLegendLabelAngle(AppUtils.getRequestNvlValue(request,"labelAngle"));
+ rdef.setLegendPosition(AppUtils.getRequestNvlValue(request,"legendPosition"));
+ rdef.setMaxLabelsInDomainAxis(AppUtils.getRequestNvlValue(request,"maxLabelsInDomainAxis"));
+ String chartLegendDisplay = AppUtils.getRequestNvlValue(request,"hideLegend");
+ boolean showLegendDisplayOptionsInRunPage = false;
+ showLegendDisplayOptionsInRunPage = AppUtils.getRequestNvlValue(request,"showLegendDisplayOptionsInRunPage").equals("Y");
+ rdef.setChartLegendDisplay(chartLegendDisplay+(showLegendDisplayOptionsInRunPage?"|Y":""));
+ rdef.setChartToolTips(AppUtils.getRequestNvlValue(request,"hideTooltips"));
+ rdef.setDomainAxisValuesAsString(AppUtils.getRequestNvlValue(request,"keepAsString"));
+
+ //System.out.println("KeepAsString " + AppUtils.getRequestNvlValue(request,"keepAsString"));
+ //System.out.println("From ReportDef " + rdef.keepDomainAxisValueInChartAsString());
+ // boolean reportUpdated = (!
+ // chartType.equals(nvl(rdef.getChartType())));
+ rdef.setChartType(chartType);
+ rdef.setChartTypeFixed(nvl(chartTypeFixed, "N"));
+ if (nvl(leftAxisLabel).length()>0)
+ rdef.setChartLeftAxisLabel(leftAxisLabel);
+ else
+ rdef.setChartLeftAxisLabel(null);
+ if (nvl(rightAxisLabel).length()>0)
+ rdef.setChartRightAxisLabel(rightAxisLabel);
+ else
+ rdef.setChartRightAxisLabel(null);
+ rdef.setChartWidth(nvl(chartWidth, "" + Globals.getDefaultChartWidth()));
+ rdef.setChartHeight(nvl(chartHeight, "" + Globals.getDefaultChartHeight()));
+ if(chartType.equals(AppConstants.GT_TIME_SERIES) || chartType.equals(AppConstants.GT_PIE_MULTIPLE)) {
+ rdef.setChartMultiSeries(chartMultiseries);
+ } else {
+ rdef.setChartMultiSeries("N");
+ }
+
+ List reportCols = rdef.getAllColumns();
+ for (Iterator iter = reportCols.iterator(); iter.hasNext();) {
+ DataColumnType dct = (DataColumnType) iter.next();
+
+ if (dct.getColId().equals(legendColId)) {
+ // reportUpdated = reportUpdated||(!
+ // nvl(dct.getColOnChart()).equals(AppConstants.GC_LEGEND));
+ dct.setColOnChart(AppConstants.GC_LEGEND);
+ } else {
+ // reportUpdated =
+ // reportUpdated||nvl(dct.getColOnChart()).equals(AppConstants.GC_LEGEND);
+ dct.setColOnChart(null);
+ }
+
+ /*
+ * if(dct.getColId().equals(valueColId)) { reportUpdated =
+ * reportUpdated||(dct.getChartSeq()<=0); dct.setChartSeq(1); }
+ * else { reportUpdated = reportUpdated||(dct.getChartSeq()>0);
+ */
+ dct.setChartSeq(-1);
+ /* } */
+ } // for
+
+ int idx = 1;
+ List columns = rdef.getAllColumns();
+ if(chartType.equals(AppConstants.GT_TIME_SERIES)) {
+ String chartSeries = AppUtils.getRequestNvlValue(request, "chartSeries");
+ String chartGroup = AppUtils.getRequestNvlValue(request, "chartGroup");
+ String yAxis = AppUtils.getRequestNvlValue(request, "yAxis");
+ for (Iterator iterator = columns.iterator(); iterator.hasNext();) {
+ DataColumnType alldct = (DataColumnType) iterator.next();
+ //debugLogger.debug("**********In " + chartSeries + " " + alldct.getColId());
+ alldct.setChartSeries((chartSeries.equals(alldct.getColId()))?true : false);
+ }
+
+ String drillDownReportId = AppUtils.getRequestNvlValue(request, "drillDownReport");
+ if(!drillDownReportId.equals("-1")) {
+ ReportRuntime ddRr = (new ReportHandler()).loadReportRuntime(request, drillDownReportId,
+ false);
+ if (ddRr != null)
+ request.setAttribute("CHART_FORMFIELDS", ddRr.getReportFormFields());
+
+ for(ddRr.getReportFormFields().resetNext(); ddRr.getReportFormFields().hasNext(); ) {
+ FormField ff = ddRr.getReportFormFields().getNext();
+ if(!ff.getFieldType().equals(FormField.FFT_BLANK)) {
+ String value = AppUtils.getRequestNvlValue(request, "drillDown_"+ff.getFieldName());
+ ChartDrillFormfield cdf = new ObjectFactory().createChartDrillFormfield();
+ cdf.setFormfield(value);
+ rdef.getChartDrillOptions().getTargetFormfield().add(cdf);
+ }
+ }
+ }
+
+ } else {
+ if(chartType.equals(AppConstants.GT_BAR_3D)) {
+ String chartSeries = AppUtils.getRequestNvlValue(request, "chartSeries");
+ String chartGroup = AppUtils.getRequestNvlValue(request, "chartGroup");
+ String yAxis = AppUtils.getRequestNvlValue(request, "yAxis");
+ for (Iterator iterator = columns.iterator(); iterator.hasNext();) {
+ DataColumnType alldct = (DataColumnType) iterator.next();
+ //debugLogger.debug("**********In " + chartSeries + " " + alldct.getColId());
+ alldct.setChartSeries((chartSeries.equals(alldct.getColId()))?true : false);
+ }
+ String drillDownReportId = AppUtils.getRequestNvlValue(request, "drillDownReport");
+ rdef.setDrillReportIdForChart(drillDownReportId);
+ if(drillDownReportId.equals("-1")){
+ rdef.setDrillReportIdForChart("");
+ }
+
+ if(!drillDownReportId.equals("-1")) {
+ ReportRuntime ddRr = (new ReportHandler()).loadReportRuntime(request, drillDownReportId,
+ false);
+ if (ddRr != null)
+ request.setAttribute("CHART_FORMFIELDS", ddRr.getReportFormFields());
+
+ for(ddRr.getReportFormFields().resetNext(); ddRr.getReportFormFields().hasNext(); ) {
+ FormField ff = ddRr.getReportFormFields().getNext();
+ if(!ff.getFieldType().equals(FormField.FFT_BLANK)) {
+ String value = AppUtils.getRequestNvlValue(request, "drillDown_"+ff.getFieldName());
+ ChartDrillFormfield cdf = new ObjectFactory().createChartDrillFormfield();
+ cdf.setFormfield(value);
+ rdef.getChartDrillOptions().getTargetFormfield().add(cdf);
+ }
+ }
+
+ String xAxisFormField = AppUtils.getRequestNvlValue(request, "drillDownXAxisFormfield");
+ String yAxisFormField = AppUtils.getRequestNvlValue(request, "drillDownYAxisFormfield");
+ String seriesAxisFormField = AppUtils.getRequestNvlValue(request, "drillDownSeriesAxisFormfield");
+
+ if(!xAxisFormField.equals("-1")){
+ rdef.setDrillXAxisFormField(xAxisFormField);
+
+ if(!yAxisFormField.equals("-1"))
+ rdef.setDrillYAxisFormField(yAxisFormField);
+ if(!seriesAxisFormField.equals("-1"))
+ rdef.setDrillSeriesFormField(seriesAxisFormField);
+ } else {
+ rdef.setDrillXAxisFormField("");
+ rdef.setDrillYAxisFormField("");
+ rdef.setDrillSeriesFormField("");
+ }
+ }
+
+ } else if(chartType.equals(AppConstants.GT_SCATTER)) {
+ String chartSeries = AppUtils.getRequestNvlValue(request, "chartSeries");
+ for (Iterator iterator = columns.iterator(); iterator.hasNext();) {
+ DataColumnType alldct = (DataColumnType) iterator.next();
+ //debugLogger.debug("**********In " + chartSeries + " " + alldct.getColId());
+ alldct.setChartSeries((chartSeries.equals(alldct.getColId()))?true : false);
+ }
+
+ }else if(chartType.equals(AppConstants.GT_REGRESSION)) {
+ String chartSeries = AppUtils.getRequestNvlValue(request, "chartSeries");
+ for (Iterator iterator = columns.iterator(); iterator.hasNext();) {
+ DataColumnType alldct = (DataColumnType) iterator.next();
+ //debugLogger.debug("**********In " + chartSeries + " " + alldct.getColId());
+ alldct.setChartSeries((chartSeries.equals(alldct.getColId()))?true : false);
+ }
+ }else if(chartType.equals(AppConstants.GT_STACKED_HORIZ_BAR) || chartType.equals(AppConstants.GT_STACKED_VERT_BAR)
+ || chartType.equals(AppConstants.GT_STACKED_VERT_BAR_LINES) || chartType.equals(AppConstants.GT_STACKED_HORIZ_BAR_LINES)) {
+ String chartSeries = AppUtils.getRequestNvlValue(request, "chartSeries");
+ for (Iterator iterator = columns.iterator(); iterator.hasNext();) {
+ DataColumnType alldct = (DataColumnType) iterator.next();
+ //debugLogger.debug("**********In " + chartSeries + " " + alldct.getColId());
+ alldct.setChartSeries((chartSeries.equals(alldct.getColId()))?true : false);
+ }
+ }else if(chartType.equals(AppConstants.GT_LINE)) {
+ String chartSeries = AppUtils.getRequestNvlValue(request, "chartSeries");
+ for (Iterator iterator = columns.iterator(); iterator.hasNext();) {
+ DataColumnType alldct = (DataColumnType) iterator.next();
+ //debugLogger.debug("**********In " + chartSeries + " " + alldct.getColId());
+ alldct.setChartSeries((chartSeries.equals(alldct.getColId()))?true : false);
+ }
+ } else if (chartType.equals(AppConstants.GT_TIME_DIFFERENCE_CHART)) {
+ String chartSeries = AppUtils.getRequestNvlValue(request, "chartSeries");
+ for (Iterator iterator = columns.iterator(); iterator.hasNext();) {
+ DataColumnType alldct = (DataColumnType) iterator.next();
+ //debugLogger.debug("**********In " + chartSeries + " " + alldct.getColId());
+ alldct.setChartSeries((chartSeries.equals(alldct.getColId()))?true : false);
+ }
+ } else if (chartType.equals(AppConstants.GT_COMPARE_PREVYEAR_CHART)) {
+ String chartSeries = AppUtils.getRequestNvlValue(request, "chartSeries");
+ for (Iterator iterator = columns.iterator(); iterator.hasNext();) {
+ DataColumnType alldct = (DataColumnType) iterator.next();
+ //debugLogger.debug("**********In " + chartSeries + " " + alldct.getColId());
+ alldct.setChartSeries((chartSeries.equals(alldct.getColId()))?true : false);
+ }
+
+ } else {
+ if (rdef.hasSeriesColumn()) {
+ for (Iterator iterator = columns.iterator(); iterator.hasNext();) {
+ DataColumnType alldct = (DataColumnType) iterator.next();
+ alldct.setChartSeries(false);
+ }
+ }
+
+ String drillDownReportId = AppUtils.getRequestNvlValue(request, "drillDownReport");
+ rdef.setDrillReportIdForChart(drillDownReportId);
+ if(drillDownReportId.equals("-1")){
+ rdef.setDrillReportIdForChart("");
+ }
+
+ if(!drillDownReportId.equals("-1")) {
+ ReportRuntime ddRr = (new ReportHandler()).loadReportRuntime(request, drillDownReportId,
+ false);
+ if (ddRr != null)
+ request.setAttribute("CHART_FORMFIELDS", ddRr.getReportFormFields());
+ for(ddRr.getReportFormFields().resetNext(); ddRr.getReportFormFields().hasNext(); ) {
+ FormField ff = ddRr.getReportFormFields().getNext();
+ if(!ff.getFieldType().equals(FormField.FFT_BLANK)) {
+ String value = AppUtils.getRequestNvlValue(request, "drillDown_"+ff.getFieldName());
+ ChartDrillFormfield cdf = new ObjectFactory().createChartDrillFormfield();
+ cdf.setFormfield(value);
+ rdef.getChartDrillOptions().getTargetFormfield().add(cdf);
+ }
+ }
+
+ String xAxisFormField = AppUtils.getRequestNvlValue(request, "drillDownXAxisFormfield");
+ String yAxisFormField = AppUtils.getRequestNvlValue(request, "drillDownYAxisFormfield");
+ String seriesAxisFormField = AppUtils.getRequestNvlValue(request, "drillDownSeriesAxisFormfield");
+
+ if(!xAxisFormField.equals("-1")){
+ rdef.setDrillXAxisFormField(xAxisFormField);
+
+ if(!yAxisFormField.equals("-1"))
+ rdef.setDrillYAxisFormField(yAxisFormField);
+ if(!seriesAxisFormField.equals("-1"))
+ rdef.setDrillSeriesFormField(seriesAxisFormField);
+ } else {
+ rdef.setDrillXAxisFormField("");
+ rdef.setDrillYAxisFormField("");
+ rdef.setDrillSeriesFormField("");
+ }
+ }
+
+ }
+ }
+
+ for (int i = 1; i < Math.max(valueColsCount, 1) + 1; i++) {
+ //debugLogger.debug("********** " + chartSeries);
+ if(i==1) {
+ /* Range Axis is resetted before adding */
+ for (Iterator iterator = columns.iterator(); iterator.hasNext();) {
+ DataColumnType dct = (DataColumnType) iterator.next();
+ if(!nvl(dct.getColOnChart()).equals(AppConstants.GC_LEGEND)) {
+ dct.setChartSeq(-1);
+ dct.setChartColor(null);
+ dct.setColOnChart(null);
+ dct.setCreateInNewChart(false);
+ dct.setChartGroup(null);
+ dct.setYAxis(null);
+ }
+ }
+
+ }
+ String newChartColAxis = AppUtils.getRequestNvlValue(request, "newChart" + i+"Axis");
+ String valueColId = AppUtils.getRequestNvlValue(request, "valueCol" + i);
+ String valueColColor = AppUtils.getRequestNvlValue(request, "valueCol" + i
+ + "Color");
+ String valueColAxis = AppUtils
+ .getRequestNvlValue(request, "valueCol" + valueColId + "Axis");
+ String chartGroup = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "chartGroup" + valueColId + "Axis"));
+ String yAxisGroup = "";
+ yAxisGroup = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "YAxisLabel" + valueColId));
+ //debugLogger.debug("^^^^^^^^^^^^^^^^^Chart Group " + chartGroup);
+ //if(chartType.equals(AppConstants.GT_TIME_SERIES)) {
+ // debugLogger.debug("**********Outer If " + chartSeries);
+ //}
+
+ if (valueColId.length() > 0 && (!valueColId.equals(removeColId))) {
+ DataColumnType dct = rdef.getColumnById(valueColId);
+ dct.setChartSeq(idx++);
+ dct.setChartColor(valueColColor);
+ dct.setColOnChart(valueColAxis.equals("Y") ? "1" : "0");
+ if(chartType.equals(AppConstants.GT_TIME_SERIES)) {
+ dct.setCreateInNewChart(newChartColAxis.equals("Y") ? true : false);
+ } else
+ dct.setCreateInNewChart(false);
+
+ if(chartGroup!=null && chartGroup.length()>0)
+ dct.setChartGroup(chartGroup+"|"+valueColId);
+ else dct.setChartGroup("");
+ if(chartType.equals(AppConstants.GT_TIME_SERIES))
+ dct.setYAxis(nvl(yAxisGroup)+"|"+valueColId);
+ else if (chartType.equals(AppConstants.GT_BAR_3D))
+ dct.setYAxis(nvl(yAxisGroup)+"|"+valueColId);
+ else dct.setYAxis("");
+ //}
+ //else
+ //dct.setCreateInNewChart(false);
+ } else if (valueColId.length() > 0 && (valueColId.equals(removeColId))) {// if
+ DataColumnType dct = rdef.getColumnById(valueColId);
+ dct.setChartSeq(-1);
+ dct.setChartColor(null);
+ dct.setColOnChart(null);
+ dct.setCreateInNewChart(false);
+ dct.setChartGroup(null);
+ dct.setYAxis(null);
+ } else { // else
+ DataColumnType dct = rdef.getColumnById(valueColId);
+ dct.setChartSeq(-1);
+ dct.setChartColor(null);
+ dct.setColOnChart(null);
+ dct.setCreateInNewChart(false);
+ dct.setChartGroup(null);
+ dct.setYAxis(null);
+ }
+ } // for
+
+ if (action.equals(AppConstants.WA_ADD_USER)) {
+ String valueColId = AppUtils.getRequestNvlValue(request, "valueColNew");
+ String valueColColor = AppUtils.getRequestNvlValue(request, "valueColNewColor");
+ String valueColAxis = AppUtils.getRequestNvlValue(request, "valueColNewAxis");
+
+ if (valueColId.length() > 0) {
+ DataColumnType dct = rdef.getColumnById(valueColId);
+ dct.setChartSeq(idx++);
+ dct.setChartColor(valueColColor);
+ dct.setColOnChart(valueColAxis.equals("Y") ? "1" : "0");
+ } // if
+ } // for
+
+ return true; // reportUpdated;
+ } // processChart
+
+ public boolean processAdhocSchedule(HttpServletRequest request, String action)
+ throws Exception {
+ ReportSchedule reportSchedule = (ReportSchedule) request.getSession().getAttribute(AppConstants.SI_REPORT_SCHEDULE);
+ reportSchedule.setScheduleUserID(AppUtils.getUserID(request));
+ reportSchedule.setSchedEnabled(
+ nvl(AppUtils.getRequestValue(request, "schedEnabled"), "N"));
+ reportSchedule.setStartDate(
+ AppUtils.getRequestNvlValue(request, "schedStartDate"));
+ reportSchedule.setEndDate(
+ AppUtils.getRequestNvlValue(request, "schedEndDate"));
+ reportSchedule.setEndHour(AppUtils.getRequestNvlValue(request, "schedEndHour"));
+ reportSchedule.setEndMin(AppUtils.getRequestNvlValue(request, "schedEndMin"));
+ reportSchedule.setEndAMPM(AppUtils.getRequestNvlValue(request, "schedEndAMPM"));
+ //schedRunDate
+ reportSchedule.setRunDate(
+ AppUtils.getRequestNvlValue(request, "schedRunDate").length()>0?AppUtils.getRequestNvlValue(request, "schedRunDate"):AppUtils.getRequestNvlValue(request, "schedStartDate"));
+ reportSchedule.setRunHour(AppUtils.getRequestNvlValue(request, "schedHour"));
+ reportSchedule.setRunMin(AppUtils.getRequestNvlValue(request, "schedMin"));
+ reportSchedule.setRunAMPM(AppUtils.getRequestNvlValue(request, "schedAMPM"));
+ reportSchedule.setRecurrence(
+ AppUtils.getRequestNvlValue(request, "schedRecurrence"));
+ reportSchedule.setConditional(
+ nvl(AppUtils.getRequestValue(request, "conditional"), "N"));
+ reportSchedule.setConditionSQL(
+ AppUtils.getRequestNvlValue(request, "conditionSQL"));
+ reportSchedule.setNotify_type(
+ AppUtils.getRequestNvlValue(request, "notify_type"));
+ reportSchedule.setDownloadLimit(
+ AppUtils.getRequestNvlValue(request, "downloadLimit"));
+ reportSchedule.setFormFields(
+ AppUtils.getRequestNvlValue(request, "formFields"));
+ reportSchedule.setAttachmentMode(
+ AppUtils.getRequestNvlValue(request, "sendAttachment"));
+
+ String userId = AppUtils.getRequestNvlValue(request, "schedEmailAdd");
+ String roleId = AppUtils.getRequestNvlValue(request, "schedEmailAddRole");
+ int flag = 0;
+ if ((!(userId.length()>0 || roleId.length()>0) && (reportSchedule.getEmailToUsers().isEmpty() && reportSchedule.getEmailToRoles().isEmpty())) ) {
+ flag = 1;
+ }
+
+ if (flag == 1 || (action.equals(AppConstants.WA_ADD_USER) || action.equals(AppConstants.WA_ADD_ROLE)) ) {
+ String loggedInUserId = AppUtils.getUserID(request);
+ if (Globals.getUseLoginIdInSchedYN().equals("Y")){
+ reportSchedule.addEmailToUser(loggedInUserId, AppUtils.getUserLoginId(request));
+ } else
+ reportSchedule.addEmailToUser(loggedInUserId, (AppUtils.getUserName(loggedInUserId).length()>0?AppUtils.getUserName(loggedInUserId):(AppUtils.getUserLoginId(loggedInUserId).length()>0?AppUtils.getUserLoginId(loggedInUserId):loggedInUserId) ));
+ }
+ if (action.equals(AppConstants.WA_ADD_USER)) {
+ //String userId = AppUtils.getRequestNvlValue(request, "schedEmailAdd");
+ String userName = AppUtils.getUserName(userId);
+ if (Globals.getUseLoginIdInSchedYN().equals("Y")){
+ String userLoginId = AppUtils.getUserLoginId(userId);
+ if (userId.length() > 0 && (userLoginId != null && userLoginId.length() > 0))
+ reportSchedule.addEmailToUser(userId, userLoginId);
+ else {
+ if (userId.length() > 0 && (userName != null && userName.length() > 0) )
+ reportSchedule.addEmailToUser(userId, userName);
+ else {
+ reportSchedule.addEmailToUser(userId, userId);
+ }
+ }
+ }else{
+ if (userId.length() > 0 && (userName != null && userName.length() > 0) )
+ reportSchedule.addEmailToUser(userId, userName);
+ else {
+ reportSchedule.addEmailToUser(userId, userId);
+ }
+ }
+
+ } else if (action.equals(AppConstants.WA_DELETE_USER))
+ reportSchedule.removeEmailToUser(
+ AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID));
+ else if (action.equals(AppConstants.WA_ADD_ROLE)) {
+ //String roleId = AppUtils.getRequestNvlValue(request, "schedEmailAddRole");
+ String roleName = AppUtils.getRoleName(roleId);
+ if (roleId.length() > 0 && roleName != null)
+ reportSchedule.addEmailToRole(roleId, roleName);
+ } else if (action.equals(AppConstants.WA_DELETE_ROLE))
+ reportSchedule.removeEmailToRole(
+ AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID));
+ request.getSession().setAttribute(AppConstants.SI_REPORT_SCHEDULE, reportSchedule);
+ return true;
+ } // processAdhocSchedule
+
+ private boolean processSchedule(HttpServletRequest request, String action)
+ throws Exception {
+ // Added for form field chaining in schedule tab so that setParamValues() is called
+ request.setAttribute(AppConstants.SCHEDULE_ACTION, "Y");
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+ ReportSchedule reportSchedule = rdef.getReportSchedule();
+ reportSchedule.setScheduleUserID(AppUtils.getUserID(request));
+ reportSchedule.setSchedEnabled(
+ nvl(AppUtils.getRequestValue(request, "schedEnabled"), "N"));
+ reportSchedule.setStartDate(
+ AppUtils.getRequestNvlValue(request, "schedStartDate"));
+ reportSchedule.setEndDate(
+ AppUtils.getRequestNvlValue(request, "schedEndDate"));
+ reportSchedule.setEndHour(AppUtils.getRequestNvlValue(request, "schedEndHour"));
+ reportSchedule.setEndMin(AppUtils.getRequestNvlValue(request, "schedEndMin"));
+ reportSchedule.setEndAMPM(AppUtils.getRequestNvlValue(request, "schedEndAMPM"));
+ //schedRunDate
+ reportSchedule.setRunDate(
+ AppUtils.getRequestNvlValue(request, "schedRunDate").length()>0?AppUtils.getRequestNvlValue(request, "schedRunDate"):AppUtils.getRequestNvlValue(request, "schedStartDate"));
+ reportSchedule.setRunHour(AppUtils.getRequestNvlValue(request, "schedHour"));
+ reportSchedule.setRunMin(AppUtils.getRequestNvlValue(request, "schedMin"));
+ reportSchedule.setRunAMPM(AppUtils.getRequestNvlValue(request, "schedAMPM"));
+ reportSchedule.setRecurrence(
+ AppUtils.getRequestNvlValue(request, "schedRecurrence"));
+ reportSchedule.setConditional(
+ nvl(AppUtils.getRequestValue(request, "conditional"), "N"));
+ reportSchedule.setConditionSQL(
+ AppUtils.getRequestNvlValue(request, "conditionSQL"));
+ reportSchedule.setNotify_type(
+ AppUtils.getRequestNvlValue(request, "notify_type"));
+ reportSchedule.setDownloadLimit(
+ AppUtils.getRequestNvlValue(request, "downloadLimit"));
+ reportSchedule.setFormFields(
+ AppUtils.getRequestNvlValue(request, "formFields"));
+ reportSchedule.setAttachmentMode(
+ AppUtils.getRequestNvlValue(request, "sendAttachment"));
+
+ reportSchedule.setEncryptMode(
+ AppUtils.getRequestNvlValue(request, "encryptMode"));
+ if (action.equals(AppConstants.WA_ADD_USER)) {
+ String userId = AppUtils.getRequestNvlValue(request, "schedEmailAdd");
+ String userName = AppUtils.getUserName(userId);
+ if (Globals.getUseLoginIdInSchedYN().equals("Y")){
+ String userLoginId = AppUtils.getUserLoginId(userId);
+ if (userId.length() > 0 && (userLoginId != null && userLoginId.length() > 0))
+ reportSchedule.addEmailToUser(userId, userLoginId);
+ else {
+ if (userId.length() > 0 && (userName != null && userName.length() > 0) )
+ reportSchedule.addEmailToUser(userId, userName);
+ else {
+ reportSchedule.addEmailToUser(userId, userId);
+ }
+ }
+ }else{
+ if (userId.length() > 0 && (userName != null && userName.length() > 0) )
+ reportSchedule.addEmailToUser(userId, userName);
+ else {
+ reportSchedule.addEmailToUser(userId, userId);
+ }
+ }
+ } else if (action.equals(AppConstants.WA_DELETE_USER))
+ reportSchedule.removeEmailToUser(
+ AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID));
+ else if (action.equals(AppConstants.WA_ADD_ROLE)) {
+ String roleId = AppUtils.getRequestNvlValue(request, "schedEmailAddRole");
+ String roleName = AppUtils.getRoleName(roleId);
+ if (roleId.length() > 0 && roleName != null)
+ reportSchedule.addEmailToRole(roleId, roleName);
+ } else if (action.equals(AppConstants.WA_DELETE_ROLE))
+ reportSchedule.removeEmailToRole(
+ AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID));
+
+ return true;
+ } // processSchedule
+
+ private boolean processUserAccess(HttpServletRequest request, String action)
+ throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+
+ String ownerID = AppUtils.getRequestNvlValue(request, "reportOwner");
+ String rPublic = nvl(AppUtils.getRequestValue(request, "public"), "N");
+
+ boolean reportUpdated = (!(ownerID.equals(nvl(rdef.getOwnerID())) && rPublic
+ .equals(rdef.isPublic() ? "Y" : "N")));
+
+ rdef.getReportSecurity().setOwnerID(ownerID);
+ rdef.setPublic(rPublic.equals("Y"));
+
+ if (action.equals(AppConstants.WA_ADD_USER))
+ rdef.getReportSecurity().addUserAccess(
+ AppUtils.getRequestNvlValue(request, "newUserId"), "Y");
+ else if (action.equals(AppConstants.WA_DELETE_USER))
+ rdef.getReportSecurity().removeUserAccess(
+ AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID));
+ else if (action.equals(AppConstants.WA_GRANT_USER))
+ rdef.getReportSecurity().updateUserAccess(
+ AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID), "N");
+ else if (action.equals(AppConstants.WA_REVOKE_USER))
+ rdef.getReportSecurity().updateUserAccess(
+ AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID), "Y");
+ else if (action.equals(AppConstants.WA_ADD_ROLE))
+ rdef.getReportSecurity().addRoleAccess(
+ AppUtils.getRequestNvlValue(request, "newRoleId"), "Y");
+ else if (action.equals(AppConstants.WA_DELETE_ROLE))
+ rdef.getReportSecurity().removeRoleAccess(
+ AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID));
+ else if (action.equals(AppConstants.WA_GRANT_ROLE))
+ rdef.getReportSecurity().updateRoleAccess(
+ AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID), "N");
+ else if (action.equals(AppConstants.WA_REVOKE_ROLE))
+ rdef.getReportSecurity().updateRoleAccess(
+ AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID), "Y");
+
+ return reportUpdated;
+ } // processUserAccess
+
+ private boolean processClearLog(HttpServletRequest request) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+ String user_id = AppUtils.getUserID(request);
+ // Modified so that only the logged in user entries are erased. - Sundar
+ ReportLoader.clearReportLogEntries(rdef.getReportID(), user_id);
+ return false;
+ } // processClearLog
+
+ private boolean processValidateSQL(HttpServletRequest request) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+
+ String sql = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "reportSQL"));
+ request.setAttribute("sqlValidated", "N");
+ rdef.parseReportSQL(sql);
+ request.setAttribute("sqlValidated", "Y");
+
+ return true;
+ } // processValidateSQL
+
+
+ /*****For Report Maps - Start******/
+ private boolean processMap(HttpServletRequest request, String action) throws Exception {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_DEFINITION);
+
+ org.openecomp.portalsdk.analytics.xmlobj.ReportMap repMap = rdef.getReportMap();
+ //clearing already added
+ if (repMap != null){
+ repMap.getMarkers().removeAll(repMap.getMarkers());
+ }
+ String addressColumn = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "addressColumn0"));
+ System.out.println(" #$%#$%#$% -- address col = " + addressColumn);
+ String dataColumn = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "dataColumn0"));
+ String legendColumn = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "legendColumn"));
+ //String legendDisplayName = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "dataHeaderL"));
+ //if(nvl(legendDisplayName).length()<=0) legendDisplayName = legendColumn;
+ String color = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "markerColor0"));
+ String isMapAllowed = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "isMapAllowed"));
+ String useDefaultSize = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "useDefaultSize"));
+ String height = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "height"));
+ String width = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "width"));
+ System.out.println(" #$%#$%#$% -- useDefaultSize="+ useDefaultSize+" height = " + height+" width="+width);
+
+ String addAddress = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "addAddress"));
+ String latCol = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "latColumn"));
+ String longCol = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "longColumn"));
+ String colorCol = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "colorColumn"));
+ if (isMapAllowed.equals(""))
+ isMapAllowed = "N";
+ if (useDefaultSize.equals(""))
+ useDefaultSize = "N";
+ if (repMap == null)
+ rdef.setReportMap(new ObjectFactory().createReportMap());
+ repMap.setAddressColumn(addressColumn);
+ repMap.setDataColumn(dataColumn);
+ repMap.setIsMapAllowedYN(isMapAllowed);
+ repMap.setUseDefaultSize(useDefaultSize);
+ repMap.setMarkerColor(color);
+ repMap.setAddAddressInDataYN(addAddress);
+ repMap.setLatColumn(latCol);
+ repMap.setLongColumn(longCol);
+ repMap.setColorColumn(colorCol);
+ repMap.setHeight(height.trim());
+ repMap.setWidth(width.trim());
+ repMap.setLegendColumn(legendColumn);
+ //repMap.setLegendDisplayName(legendDisplayName);
+
+ Marker m = new ObjectFactory().createMarker();
+ m.setAddressColumn(addressColumn);
+ m.setDataColumn(dataColumn);
+ repMap.getMarkers().add(m);
+ String markerCountString = AppUtils.getRequestNvlValue(request, "markerCount");
+ int markerCount = 0;
+ if (markerCountString != null && markerCountString.equals("") == false){
+ markerCount = new Integer(markerCountString).intValue();
+ }
+ for (int i = 1; i < markerCount; i ++){
+ String additionalAddressColumn = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "addressColumn" + i));
+ String additionalDataHeader = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "dataHeader" + i));
+ String additionalData = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "dataColumn" + i));
+ String additionalColor = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "markerColor" + i));
+ if (additionalAddressColumn.equals("1") == false){
+ m = new ObjectFactory().createMarker();
+ m.setAddressColumn(additionalAddressColumn);
+ m.setDataHeader(additionalDataHeader);
+ m.setDataColumn(additionalData);
+ m.setMarkerColor(additionalColor);
+ repMap.getMarkers().add(m);
+ }
+ }
+ return true;
+ } // processMap
+ /*****For Report Maps - End******/
+
+
+} // WizardProcessor
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequence.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequence.java
new file mode 100644
index 00000000..81308909
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequence.java
@@ -0,0 +1,191 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file 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.
+ * ================================================================================
+ */
+ package org.openecomp.portalsdk.analytics.controller;
+
+import java.util.*;
+
+import org.openecomp.portalsdk.analytics.model.base.*;
+import org.openecomp.portalsdk.analytics.model.definition.*;
+import org.openecomp.portalsdk.analytics.system.*;
+import org.openecomp.portalsdk.analytics.util.*;
+
+public class WizardSequence extends Vector {
+ // private String currentStep = AppConstants.WS_DEFINITION;
+ private int currentStepIdx = 0;
+
+ private String currentSubStep = "";
+
+ private int nextElemIdx = 0;
+
+ public void resetNext() {
+ resetNext(0);
+ } // resetNext
+
+ public void resetNext(int toPos) {
+ nextElemIdx = toPos;
+ } // resetNext
+
+ public boolean hasNext() {
+ return (nextElemIdx < size());
+ } // hasNext
+
+ public String getNext() {
+ return hasNext() ? getStep(nextElemIdx++) : null;
+ } // getNext
+
+ // *****************************************************
+
+ public WizardSequence() {
+ add(AppConstants.WS_DEFINITION);
+ } // WizardSequence
+
+ private String getStep(int index) {
+ return (String) get(index);
+ } // getStep
+
+ private int getStepIndex(String step) {
+ for (int i = 0; i < size(); i++)
+ if (getStep(i).equals(step))
+ return i;
+
+ throw new IndexOutOfBoundsException();
+ } // getStepIndex
+
+ /*
+ * private String getInitialStep() { return getStep(0); } // getInitialStep
+ *
+ * private String getFinalStep() { return getStep(getStepCount()-1); } //
+ * getFinalStep
+ */
+ private boolean isInitialStep(int index) {
+ return (index == 0);
+ } // isInitialStep
+
+ /*
+ * private boolean isInitialStep(String step) { return
+ * isInitialStep(getStepIndex(step)); } // isInitialStep
+ */
+ private boolean isFinalStep(int index) {
+ if (index == 0)
+ return false;
+
+ return (index == (getStepCount() - 1));
+ } // isFinalStep
+
+ /*
+ * private boolean isFinalStep(String step) { return
+ * isFinalStep(getStepIndex(step)); } // isFinalStep
+ */
+
+ private int getNextStepIndex(int index) {
+ return (index == (getStepCount() - 1)) ? index : (index + 1);
+ } // getNextStep
+
+ /*
+ * private String getNextStep(String step) { return
+ * getStep(getNextStepIndex(getStepIndex(step))); } // getNextStep
+ *
+ * private String getNextStep(String step, String subStep) {
+ * if(subStep.length()>0) return step;
+ *
+ * return getNextStep(step); } // getNextStep
+ */
+ private int getPrevStepIndex(int index) {
+ return (index == 0) ? index : (index - 1);
+ } // getPrevStepIndex
+
+ /*
+ * private String getPrevStep(String step) { return
+ * getStep(getPrevStepIndex(getStepIndex(step))); } // getPrevStep
+ *
+ * private String getPrevStep(String step, String subStep) {
+ * if(subStep.length()>0) return step;
+ *
+ * return getPrevStep(step); } // getPrevStep
+ */
+ // *****************************************************
+ public int getStepCount() {
+ return size();
+ } // getStepCount
+
+ public int getCurrentStepIndex() {
+ return currentStepIdx + 1;
+ } // getCurrentStepIndex
+
+ public String getCurrentStep() {
+ return getStep(currentStepIdx);
+ } // getCurrentStep
+
+ public String getCurrentSubStep() {
+ return currentSubStep;
+ } // getCurrentSubStep
+
+ public boolean isInitialStep() {
+ return isInitialStep(currentStepIdx);
+ } // isInitialStep
+
+ public boolean isFinalStep() {
+ return isFinalStep(currentStepIdx);
+ } // isFinalStep
+
+ public void performAction(String action, ReportDefinition rdef) {
+ if (action.equals(AppConstants.WA_BACK))
+ if (currentSubStep.length() > 0)
+ currentSubStep = "";
+ else
+ currentStepIdx = getPrevStepIndex(currentStepIdx);
+ else if (action.equals(AppConstants.WA_NEXT)) {
+ if (currentSubStep.length() > 0)
+ currentSubStep = "";
+ else {
+ currentStepIdx = getNextStepIndex(currentStepIdx);
+ if (rdef != null)
+ if (!rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED))
+ if (getCurrentStep().equals(AppConstants.WS_TABLES)
+ && (rdef.getDataSourceList().getDataSource().size() == 0))
+ currentSubStep = AppConstants.WSS_ADD;
+ else if (getCurrentStep().equals(AppConstants.WS_COLUMNS)
+ && (rdef.getAllColumns().size() == 0))
+ currentSubStep = (rdef.getReportType().equals(
+ AppConstants.RT_CROSSTAB) ? AppConstants.WSS_ADD
+ : AppConstants.WSS_ADD_MULTI);
+ }
+ } else if (action.equals(AppConstants.WA_EDIT) || action.equals(AppConstants.WA_ADD)
+ || action.equals(AppConstants.WA_ADD_MULTI)
+ || action.equals(AppConstants.WA_ORDER_ALL)|| action.equals(AppConstants.WSS_ADD_BLANK) || action.equals(AppConstants.WA_MODIFY)) {
+ currentSubStep = action;
+ }
+ else if (currentSubStep.equals(AppConstants.WSS_ADD)
+ || currentSubStep.equals(AppConstants.WSS_EDIT))
+ currentSubStep = AppConstants.WSS_EDIT;
+ else
+ currentSubStep = "";
+ } // performAction
+
+ public void performGoToStep(String step) {
+ int stepIdx = getStepIndex(step);
+
+ if (stepIdx >= 0 && stepIdx < getStepCount()) {
+ currentStepIdx = stepIdx;
+ currentSubStep = "";
+ }
+ } // performGoToStep
+
+} // WizardSequence
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceCrossTab.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceCrossTab.java
new file mode 100644
index 00000000..686c8b7b
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceCrossTab.java
@@ -0,0 +1,45 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file 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.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.controller;
+
+import java.util.*;
+
+import org.openecomp.portalsdk.analytics.system.*;
+import org.openecomp.portalsdk.analytics.util.*;
+
+public class WizardSequenceCrossTab extends WizardSequence {
+
+ public WizardSequenceCrossTab(boolean userIsAuthorizedToSeeLog) {
+ super();
+
+ add(AppConstants.WS_TABLES);
+ add(AppConstants.WS_COLUMNS);
+ add(AppConstants.WS_FORM_FIELDS);
+ add(AppConstants.WS_FILTERS);
+ add(AppConstants.WS_JAVASCRIPT);
+ add(AppConstants.WS_USER_ACCESS);
+ //add(AppConstants.WS_SCHEDULE);
+ if (userIsAuthorizedToSeeLog)
+ if (Globals.getEnableReportLog())
+ add(AppConstants.WS_REPORT_LOG);
+ add(AppConstants.WS_RUN);
+ } // WizardSequenceCrossTab
+
+} // WizardSequenceCrossTab
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceDashboard.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceDashboard.java
new file mode 100644
index 00000000..d8424f2c
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceDashboard.java
@@ -0,0 +1,40 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file 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.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.controller;
+
+import java.util.*;
+
+import org.openecomp.portalsdk.analytics.system.*;
+import org.openecomp.portalsdk.analytics.util.*;
+
+public class WizardSequenceDashboard extends WizardSequence {
+
+ public WizardSequenceDashboard(boolean userIsAuthorizedToSeeLog) {
+ super();
+
+ add(AppConstants.WS_USER_ACCESS);
+ //add(AppConstants.WS_SCHEDULE);
+ if (userIsAuthorizedToSeeLog)
+ if (Globals.getEnableReportLog())
+ add(AppConstants.WS_REPORT_LOG);
+ add(AppConstants.WS_RUN);
+ } // WizardSequenceDashboard
+
+} // WizardSequenceDashboard
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceLinear.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceLinear.java
new file mode 100644
index 00000000..2015a7b9
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceLinear.java
@@ -0,0 +1,47 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file 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.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.controller;
+
+import java.util.*;
+
+import org.openecomp.portalsdk.analytics.system.*;
+import org.openecomp.portalsdk.analytics.util.*;
+
+public class WizardSequenceLinear extends WizardSequence {
+
+ public WizardSequenceLinear(boolean userIsAuthorizedToSeeLog) {
+ super();
+
+ add(AppConstants.WS_TABLES);
+ add(AppConstants.WS_COLUMNS);
+ add(AppConstants.WS_FORM_FIELDS);
+ add(AppConstants.WS_FILTERS);
+ add(AppConstants.WS_SORTING);
+ //add(AppConstants.WS_JAVASCRIPT);
+ //add(AppConstants.WS_CHART);
+ add(AppConstants.WS_USER_ACCESS);
+ //add(AppConstants.WS_SCHEDULE);
+ if (userIsAuthorizedToSeeLog)
+ if (Globals.getEnableReportLog())
+ add(AppConstants.WS_REPORT_LOG);
+ add(AppConstants.WS_RUN);
+ } // WizardSequenceLinear
+
+} // WizardSequenceLinear
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedCrossTab.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedCrossTab.java
new file mode 100644
index 00000000..db2f8c6f
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedCrossTab.java
@@ -0,0 +1,44 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file 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.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.controller;
+
+import java.util.*;
+
+import org.openecomp.portalsdk.analytics.system.*;
+import org.openecomp.portalsdk.analytics.util.*;
+
+public class WizardSequenceSQLBasedCrossTab extends WizardSequence {
+
+ public WizardSequenceSQLBasedCrossTab(boolean userIsAuthorizedToSeeLog) {
+ super();
+
+ add(AppConstants.WS_SQL);
+ add(AppConstants.WS_COLUMNS);
+ add(AppConstants.WS_FORM_FIELDS);
+ add(AppConstants.WS_JAVASCRIPT);
+ add(AppConstants.WS_USER_ACCESS);
+ //add(AppConstants.WS_SCHEDULE);
+ if (userIsAuthorizedToSeeLog)
+ if (Globals.getEnableReportLog())
+ add(AppConstants.WS_REPORT_LOG);
+ add(AppConstants.WS_RUN);
+ } // WizardSequenceSQLBasedCrossTab
+
+} // WizardSequenceSQLBasedCrossTab
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedHive.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedHive.java
new file mode 100644
index 00000000..7f64cb9a
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedHive.java
@@ -0,0 +1,46 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file 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.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.controller;
+
+import java.util.*;
+
+import org.openecomp.portalsdk.analytics.system.*;
+import org.openecomp.portalsdk.analytics.util.*;
+
+public class WizardSequenceSQLBasedHive extends WizardSequence {
+
+ public WizardSequenceSQLBasedHive(boolean userIsAuthorizedToSeeLog) {
+ super();
+
+ add(AppConstants.WS_SQL);
+ add(AppConstants.WS_COLUMNS);
+ add(AppConstants.WS_FORM_FIELDS);
+ add(AppConstants.WS_JAVASCRIPT);
+ add(AppConstants.WS_CHART);
+ add(AppConstants.WS_USER_ACCESS);
+ //add(AppConstants.WS_MAP);
+ //add(AppConstants.WS_SCHEDULE);
+ if (userIsAuthorizedToSeeLog)
+ if (Globals.getEnableReportLog())
+ add(AppConstants.WS_REPORT_LOG);
+ add(AppConstants.WS_RUN);
+ } // WizardSequenceSQLBasedHive
+
+} // WizardSequenceSQLBasedHive
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedLinear.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedLinear.java
new file mode 100644
index 00000000..a19c66b4
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedLinear.java
@@ -0,0 +1,47 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file 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.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.controller;
+
+import java.util.*;
+
+import org.openecomp.portalsdk.analytics.system.*;
+import org.openecomp.portalsdk.analytics.util.*;
+
+public class WizardSequenceSQLBasedLinear extends WizardSequence {
+
+ public WizardSequenceSQLBasedLinear(boolean userIsAuthorizedToSeeLog) {
+ super();
+
+ add(AppConstants.WS_SQL);
+ add(AppConstants.WS_COLUMNS);
+ add(AppConstants.WS_FORM_FIELDS);
+ //add(AppConstants.WS_JAVASCRIPT);
+ //if(!Globals.showAnimatedChartOnly())
+ //add(AppConstants.WS_CHART);
+ add(AppConstants.WS_USER_ACCESS);
+ //add(AppConstants.WS_MAP);
+ //add(AppConstants.WS_SCHEDULE);
+ if (userIsAuthorizedToSeeLog)
+ if (Globals.getEnableReportLog())
+ add(AppConstants.WS_REPORT_LOG);
+ add(AppConstants.WS_RUN);
+ } // WizardSequenceSQLBasedLinear
+
+} // WizardSequenceSQLBasedLinear
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedLinearDatamining.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedLinearDatamining.java
new file mode 100644
index 00000000..5c8759d9
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/controller/WizardSequenceSQLBasedLinearDatamining.java
@@ -0,0 +1,46 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file 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.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.controller;
+
+import java.util.*;
+
+import org.openecomp.portalsdk.analytics.system.*;
+import org.openecomp.portalsdk.analytics.util.*;
+
+public class WizardSequenceSQLBasedLinearDatamining extends WizardSequence {
+
+ public WizardSequenceSQLBasedLinearDatamining(boolean userIsAuthorizedToSeeLog) {
+ super();
+
+ add(AppConstants.WS_SQL);
+ add(AppConstants.WS_COLUMNS);
+ add(AppConstants.WS_FORM_FIELDS);
+ add(AppConstants.WS_DATA_FORECASTING);
+ add(AppConstants.WS_JAVASCRIPT);
+ add(AppConstants.WS_CHART);
+ add(AppConstants.WS_USER_ACCESS);
+ //add(AppConstants.WS_SCHEDULE);
+ if (userIsAuthorizedToSeeLog)
+ if (Globals.getEnableReportLog())
+ add(AppConstants.WS_REPORT_LOG);
+ add(AppConstants.WS_RUN);
+ } // WizardSequenceSQLBasedLinear
+
+} // WizardSequenceSQLBasedLinear