summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ActionHandler.java
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ActionHandler.java')
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ActionHandler.java252
1 files changed, 162 insertions, 90 deletions
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ActionHandler.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ActionHandler.java
index b660ca95..b1e02fbc 100644
--- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ActionHandler.java
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ActionHandler.java
@@ -68,6 +68,8 @@ import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.io.Writer;
+import java.net.URLDecoder;
+import java.nio.charset.StandardCharsets;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
@@ -122,6 +124,7 @@ import org.onap.portalsdk.analytics.system.DbUtils;
import org.onap.portalsdk.analytics.system.Globals;
import org.onap.portalsdk.analytics.system.fusion.domain.QuickLink;
import org.onap.portalsdk.analytics.util.AppConstants;
+import org.onap.portalsdk.analytics.util.CachingUtils;
import org.onap.portalsdk.analytics.util.DataSet;
import org.onap.portalsdk.analytics.util.Utils;
import org.onap.portalsdk.analytics.view.DataRow;
@@ -145,7 +148,7 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
private static final String PARENT = "parent_";
private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ActionHandler.class);
- private static final String REPORT_DOWNLOAD_PDF = "report.download.pdf";
+ private static final String REPORT_DOWNLOAD_PDF = "report.download.pdf";
private static final String REPORT_TEXT_DOWNLOAD = "report.text.download";
private static final String REPORT_CSV_DOWNLOAD = "report.csv.download";
private static final String REPORT_DOWNLOAD_EXCEL2007 = "report.download.excel2007";
@@ -221,8 +224,7 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
boolean fromDashboard = AppUtils.getRequestFlag(request,"fromDashboard");
request.getSession().setAttribute("login_id", AppUtils.getUserBackdoorLoginId(request));
- boolean rDisplayContent = AppUtils.getRequestFlag(request,
- AppConstants.RI_DISPLAY_CONTENT)
+ boolean rDisplayContent = AppUtils.getRequestFlag(request, AppConstants.RI_DISPLAY_CONTENT)
|| AppUtils.getRequestFlag(request, "noFormFields");
try {
@@ -231,19 +233,17 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
removeVariablesFromSession(request);
}
-
long currentTime = System.currentTimeMillis();
+ long totalTime;
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(!"N".equals(nvl(request.getParameter("parent"), "")))
- {
+ if (!"N".equals(nvl(request.getParameter("parent"), ""))) {
parent = nvl(request.getParameter("parent"), "");
}
- if(parent.startsWith(PARENT))
- {
+ if (parent.startsWith(PARENT)) {
parentFlag = 1;
}
@@ -251,13 +251,17 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
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
+ 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();
+ downloadLimit = (rr.getMaxRowsInExcelDownload() > 0) ? rr.getMaxRowsInExcelDownload()
+ : Globals.getDownloadLimit();
if(REPORT_CSV_DOWNLOAD.equals(actionKey))
downloadLimit = Globals.getCSVDownloadLimit();
@@ -265,17 +269,21 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
String sqlWhole = rr.getReportDataSQL(userId, downloadLimit, request);
request.setAttribute(AppConstants.RI_REPORT_SQL_WHOLE, sqlWhole);
} else if(rr!=null && rr.getReportType().equals(AppConstants.RT_CROSSTAB)) {
- rd = rr.loadReportData(-1, userId, downloadLimit,request, false); /* TODO: should be changed to true */
+ 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(REPORT_DOWNLOAD.equals(actionKey)) {
- rr.logReportExecutionTime(userId, "",AppConstants.RLA_SCHEDULED_DOWNLOAD_EXCEL, formFields);
+ rr.logReportExecutionTime(userId, "", AppConstants.RLA_SCHEDULED_DOWNLOAD_EXCEL,
+ formFields);
} else if (REPORT_DOWNLOAD_PDF.equals(actionKey)) {
- rr.logReportExecutionTime(userId, "",AppConstants.RLA_SCHEDULED_DOWNLOAD_PDF, formFields);
+ rr.logReportExecutionTime(userId, "", AppConstants.RLA_SCHEDULED_DOWNLOAD_PDF,
+ formFields);
} else if (REPORT_DOWNLOAD_EXCEL2007.equals(actionKey)) {
- rr.logReportExecutionTime(userId, "",AppConstants.RLA_SCHEDULED_DOWNLOAD_EXCELX, formFields);
+ rr.logReportExecutionTime(userId, "", AppConstants.RLA_SCHEDULED_DOWNLOAD_EXCELX,
+ formFields);
}
} else {
if(REPORT_DOWNLOAD.equals(actionKey) ) {
@@ -299,13 +307,15 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
}// pdfAttachmentKey
String reportID = AppUtils.getRequestValue(request, AppConstants.RI_REPORT_ID);
- rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME); //changing session to request
+ 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));
-
- logger.debug(EELFLoggerDelegate.debugLogger, ("^^^^^^^^^^^^^^report ID from session " + ((rr!=null)?rr.getReportID():"no report id in session")));
+ logger.debug(EELFLoggerDelegate.debugLogger,
+ ("in Action Handler ********** " + reportID + " " + reportIDFromSession + " " + actionKey));
+ logger.debug(EELFLoggerDelegate.debugLogger, ("^^^^^^^^^^^^^^report ID from session "
+ + ((rr != null) ? rr.getReportID() : "no report id in session")));
ReportHandler rh1 = new ReportHandler();
ReportRuntime rr1 = null;
@@ -331,13 +341,12 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
TreeMap treeMap = getListOfReportsFromDashBoardJson(strJson);
TreeMap treeMapHtml = getListOfReportsFromDashBoardHTML(strHTML);
Set set = treeMap.entrySet();
-
HashMap reportsRuntimeMap = new HashMap();
HashMap reportDataMap = new HashMap();
HashMap reportChartDataMap = new HashMap();
- // displayTypeMap differentiates whether report need to be displayed as data or chart
+ // 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;
@@ -373,7 +382,8 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
}
downloadLimit = (rrDashboardReports.getMaxRowsInExcelDownload() > 0)
- ? rrDashboardReports.getMaxRowsInExcelDownload() : Globals.getDownloadLimit();
+ ? rrDashboardReports.getMaxRowsInExcelDownload()
+ : Globals.getDownloadLimit();
if(record == 1) {
if (rrDashboardReports.getReportFormFields() != null
@@ -385,6 +395,7 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
}
if(buildReportdata) {
+ rrDashboardReports.setFromDashBoard(true);
if(similiarReportRuntime != null ) {
rd = (ReportData) reportDataMap.get(intObj);
ds = (DataSet) reportChartDataMap.get(intObj);
@@ -399,16 +410,10 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
}
}
- long totalTime = System.currentTimeMillis() - currentTime;
+ totalTime = System.currentTimeMillis() - currentTime;
formFields = AppUtils.getRequestNvlValue(request, FORM_FIELDS);
- if(buildReportdata) {
- /*
- * rrDashboardReports.logReportRun(userId, String.valueOf(totalTime),
- * formFields); rrDashboardReports.logReportExecutionTime(userId,
- * String.valueOf(totalTime), AppConstants.RLA_EXECUTION_TIME, formFields);
- */
- }
- if(!entry.getValue().toString().toLowerCase().startsWith("c")) {
+
+ //if (!entry.getValue().toString().toLowerCase().startsWith("c")) {
reportsRuntimeMap.put(
new Integer(entry.getKey().toString()) + "_" + rrDashboardReports.getReportID(),
rrDashboardReports);
@@ -417,24 +422,31 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
entry.getValue().toString().substring(0, 1));
if(buildReportdata) {
reportDataMap.put(
- new Integer(entry.getKey().toString()) + "_" + rrDashboardReports.getReportID(), rd);
+ new Integer(entry.getKey().toString()) + "_" + rrDashboardReports.getReportID(),
+ rd);
reportChartDataMap.put(
- new Integer(entry.getKey().toString()) + "_" + rrDashboardReports.getReportID(), ds);
- }
+ new Integer(entry.getKey().toString()) + "_" + rrDashboardReports.getReportID(),
+ ds);
}
+ //}
}
- request.getSession().setAttribute(AppConstants.SI_DASHBOARD_REPORTRUNTIME_MAP, new TreeMap(reportsRuntimeMap));
- request.getSession().setAttribute(AppConstants.SI_DASHBOARD_DISPLAYTYPE_MAP, new TreeMap(reportDisplayTypeMap));
+ 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));
+ request.getSession().setAttribute(AppConstants.SI_DASHBOARD_REPORTDATA_MAP,
+ new TreeMap(reportDataMap));
+ request.getSession().setAttribute(AppConstants.SI_DASHBOARD_CHARTDATA_MAP,
+ new TreeMap(reportChartDataMap));
}
request.getSession().setAttribute(AppConstants.SI_REPORT_RUNTIME, rr1); //changing session to request
- if((String) request.getSession().getAttribute(AppConstants.SI_DASHBOARD_REP_ID)!= null || rr1.getReportType().equals(AppConstants.RT_DASHBOARD)) {
+ 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);
}
@@ -455,8 +467,10 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
request.getSession().removeAttribute(AppConstants.EMBEDDED_REPORTDATA_MAP);
}
- String reportEmailSentLogId = ESAPI.encoder().encodeForSQL( SecurityCodecUtil.getCodec(),AppUtils.getRequestValue(request, "log_id"));
- logger.debug(EELFLoggerDelegate.debugLogger, ("Email PDF" + pdfAttachmentKey+" "+ reportEmailSentLogId));
+ String reportEmailSentLogId = ESAPI.encoder().encodeForSQL(SecurityCodecUtil.getCodec(),
+ AppUtils.getRequestValue(request, "log_id"));
+ logger.debug(EELFLoggerDelegate.debugLogger,
+ ("Email PDF" + pdfAttachmentKey + " " + reportEmailSentLogId));
//email pdf attachment specific
if(nvl(pdfAttachmentKey).length()>0 && reportEmailSentLogId !=null)
@@ -472,7 +486,8 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
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");
+ request.setAttribute(MESSAGE,
+ "This link has expired, please <a href=''>login</a> and regenerate the report");
return "raptor/message.jsp";
}
} else
@@ -481,7 +496,8 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
// 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) {
+ if (rr != null && rr.getReportType().equals(AppConstants.RT_DASHBOARD)
+ && nvl(pdfAttachmentKey).length() > 0) {
int DASH=7;
int requestFlag = DASH;
ReportHandler rh = new ReportHandler();
@@ -527,14 +543,20 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
rrDashboardReports = rh.loadReportRuntime(request, reportIDFromMap, true, requestFlag);
}
- downloadLimit = (rrDashboardReports.getMaxRowsInExcelDownload()>0)?rrDashboardReports.getMaxRowsInExcelDownload():Globals.getDownloadLimit();
+ 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 (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) {
+ if (rrDashboardReports.getReportFormFields() != null
+ && rrDashboardReports.getReportFormFields().size() > 0) {
buildReportdata = false;
- if(rDisplayContent) buildReportdata = true;
+ if (rDisplayContent)
+ buildReportdata = true;
}
}
if(buildReportdata) {
@@ -544,35 +566,48 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
} else {
if (!rrDashboardReports.getReportType().equals(AppConstants.RT_HIVE))
- rd = rrDashboardReports.loadReportData(pageNo, userId, downloadLimit,request, false /*download*/);
+ rd = rrDashboardReports.loadReportData(pageNo, userId, downloadLimit, request,
+ false /* download */);
else
- rd = rrDashboardReports.loadHiveLinearReportData(rrDashboardReports.getReportSQL(), userId, 2,request);
+ rd = rrDashboardReports.loadHiveLinearReportData(rrDashboardReports.getReportSQL(),
+ userId, 2, request);
ds = rrDashboardReports.loadChartData(userId,request);
}
}
-
-
- long totalTime = System.currentTimeMillis() - currentTime;
+ totalTime = System.currentTimeMillis() - currentTime;
formFields = AppUtils.getRequestNvlValue(request, FORM_FIELDS);
rrDashboardReports.logReportRun(userId, String.valueOf(totalTime),formFields);
- rrDashboardReports.logReportExecutionTime(userId, String.valueOf(totalTime),AppConstants.RLA_EXECUTION_TIME, 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));
+ 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);
}
}
- request.getSession().setAttribute(AppConstants.SI_DASHBOARD_REPORTRUNTIME_MAP, new TreeMap(reportsRuntimeMap));
- request.getSession().setAttribute(AppConstants.SI_REPORT_RUNTIME, rr); //changing session to request
+ /*
+ * 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.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));
}
} else {
@@ -581,10 +616,8 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
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 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);
@@ -624,14 +657,13 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
pageNo = rr.getCachedPageNo();
else {
try {
- pageNo = Integer.parseInt(AppUtils.getRequestNvlValue(request, AppConstants.RI_NEXT_PAGE));
+ 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);
+ 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))
@@ -642,7 +674,8 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
} // else
} // else
- int downloadLimit = (rr.getMaxRowsInExcelDownload()>0)?rr.getMaxRowsInExcelDownload():Globals.getDownloadLimit();
+ int downloadLimit = (rr.getMaxRowsInExcelDownload() > 0) ? rr.getMaxRowsInExcelDownload()
+ : Globals.getDownloadLimit();
if(isEmailAttachment) {
String limit = nvl(request.getParameter("download_limit"),"1000");
downloadLimit = Integer.parseInt(limit);
@@ -652,11 +685,12 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
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)));
+ 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");
-
-
+ boolean hideReportMap = rr.isDisplayOptionHideMap()
+ || AppUtils.getRequestNvlValue(request, "noMap").equals("Y");
request.getSession().setAttribute(AppConstants.RI_REPORT_DATA, rd);
if(rr!=null && rr.getReportType().equals(AppConstants.RT_LINEAR)) {
String sqlWhole = rr.getReportDataSQL(userId, downloadLimit, request);
@@ -669,38 +703,50 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
long currentChartTime = System.currentTimeMillis();
DataSet chartDS = rr.loadChartData(userId,request);
if(chartDS != null)
- request.getSession().setAttribute(AppConstants.RI_CHART_DATA, rr.loadChartData(userId,request));
+ 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)));
+ logger.debug(EELFLoggerDelegate.debugLogger,
+ ("[DEBUG MESSAGE FROM RAPTOR] ------->Time Taken for the loading chart data --- "
+ + (System.currentTimeMillis() - currentChartTime)));
}
}
- request.getSession().setAttribute(AppConstants.SI_REPORT_RUNTIME, rr); //changing session to request
+ 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;
+ totalTime = System.currentTimeMillis() - currentTime;
formFields = AppUtils.getRequestNvlValue(request, FORM_FIELDS);
request.setAttribute(AppConstants.RLA_EXECUTION_TIME, "" + totalTime);
-
- boolean isFromReportLog = AppUtils.getRequestFlag(request, "fromReportLog");
- if(!isFromReportLog) {
+ String isFromReportLog = request.getParameter("fromReportLog");
+ if (isFromReportLog == null || isFromReportLog == "N") {
if(pdfAttachmentKey!=null && pdfAttachmentKey.length()>0) {
if(actionKey.equals(REPORT_DOWNLOAD)) {
- rr.logReportExecutionTime(userId, String.valueOf(totalTime),AppConstants.RLA_SCHEDULED_DOWNLOAD_EXCEL, formFields);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ rr.logReportExecutionTime(userId, String.valueOf(totalTime), AppConstants.RLA_DOWNLOAD_TEXT,
+ formFields);
} else {
+ if (rd != null && !action.equals("report.run.container"))
+ rr.logReportExecutionTime(userId, String.valueOf(totalTime),
+ AppConstants.RLA_EXECUTION_TIME, formFields);
if(rd!=null && !action.equals("report.run.container"))
rr.logReportExecutionTime(userId, String.valueOf(totalTime),AppConstants.RLA_EXECUTION_TIME, formFields);
@@ -731,12 +777,14 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
HashMap embeddedReportsRuntimeMap = null;
HashMap embeddedReportsDataMap = null;
if(request.getSession().getAttribute(AppConstants.EMBEDDED_REPORTRUNTIME_MAP)!= null){
- embeddedReportsRuntimeMap = (HashMap)request.getSession().getAttribute(AppConstants.EMBEDDED_REPORTRUNTIME_MAP);
+ 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);
+ embeddedReportsDataMap = (HashMap) request.getSession()
+ .getAttribute(AppConstants.EMBEDDED_REPORTDATA_MAP);
} else {
embeddedReportsDataMap = new HashMap();
}
@@ -750,10 +798,33 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
}
ReportJSONRuntime reportJSONRuntime = rr.createReportJSONRuntime(request, rd);
+ Set<String> keys = rr.getReportParamValues().keySet();
+ String ffValue = "";
+ for (String key : keys) {
+ ffValue = ffValue + '&' + key + "=" + rr.getReportParamValues().get(key);
+ }
+ if (ffValue != "") {
+ String groupSelectValue = request.getParameter("groupSelectValue");
+ groupSelectValue = "&groupSelectValue=" + groupSelectValue;
+ formFields = ffValue + groupSelectValue;
+ } else {
+ formFields = "";
+ }
+ String fromReportLog = request.getParameter("fromReportLog");
+ if (action.equals("report.run.container") && reportJSONRuntime.getReportTotalDataRows() != null
+ && fromReportLog == null) {
+ rr.logReportExecutionTime(userId, String.valueOf(totalTime), AppConstants.RLA_EXECUTION_TIME,
+ formFields);
+ }
+ if(rr.getWholeSQL() != null) {
+ CachingUtils.saveReportRuntime(rr.getReportID(), rr);
+ CachingUtils.saveReportData(rr.getReportID(), rd);
+ }
ObjectMapper mapper = new ObjectMapper();
mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
String jsonInString = "";
+ reportJSONRuntime.setTotalRunTime(totalTime);
try {
jsonInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(reportJSONRuntime);
} catch (Exception ex) {
@@ -765,7 +836,8 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
try {
logger.error(EELFLoggerDelegate.errorLogger,"reportRun", e);
- 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 (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