summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk')
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ActionHandler.java115
1 files changed, 42 insertions, 73 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 1eea72e1..d6ae3e2d 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
@@ -140,6 +140,13 @@ 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_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";
+ private static final String REPORT_DOWNLOAD = "report.download";
+ private static final String REPORT_DOWNLOAD_PAGE = "report.download.page";
+
private void preserveReportRuntimeAsBackup(HttpServletRequest request) {
HttpSession session = request.getSession();
ArrayList repAl = null;
@@ -188,6 +195,13 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
return false;
}
+ private boolean isReportActionKey(String actionKey)
+ {
+ return REPORT_DOWNLOAD_PAGE.equals(actionKey) || REPORT_DOWNLOAD.equals(actionKey) ||
+ REPORT_DOWNLOAD_PDF.equals(actionKey) || REPORT_DOWNLOAD_EXCEL2007.equals(actionKey) ||
+ REPORT_CSV_DOWNLOAD.equals(actionKey) || REPORT_TEXT_DOWNLOAD.equals(actionKey);
+ }
+
public String reportRun(HttpServletRequest request, String nextPage) {
String action = nvl(request.getParameter(AppConstants.RI_ACTION), request.getParameter("action"));
ReportRuntime rr = null;
@@ -224,18 +238,18 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
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((pdfAttachmentKey.length()<=0) && isReportActionKey(actionKey)) {
+ 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();
- if(actionKey.equals("report.csv.download"))
+ if(REPORT_CSV_DOWNLOAD.equals(actionKey))
downloadLimit = Globals.getCSVDownloadLimit();
if(rr!=null && rr.getReportType().equals(AppConstants.RT_LINEAR)) {
@@ -247,25 +261,25 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
}
if(!isFromReportLog) {
if(pdfAttachmentKey!=null && pdfAttachmentKey.length()>0) {
- if(actionKey.equals("report.download")) {
+ if(REPORT_DOWNLOAD.equals(actionKey)) {
rr.logReportExecutionTime(userId, "",AppConstants.RLA_SCHEDULED_DOWNLOAD_EXCEL, formFields);
- } else if (actionKey.equals("report.download.pdf")) {
+ } else if (REPORT_DOWNLOAD_PDF.equals(actionKey)) {
rr.logReportExecutionTime(userId, "",AppConstants.RLA_SCHEDULED_DOWNLOAD_PDF, formFields);
- } else if (actionKey.equals("report.download.excel2007")) {
+ } else if (REPORT_DOWNLOAD_EXCEL2007.equals(actionKey)) {
rr.logReportExecutionTime(userId, "",AppConstants.RLA_SCHEDULED_DOWNLOAD_EXCELX, formFields);
}
} else {
- if(actionKey.equals("report.download") ) {
+ if(REPORT_DOWNLOAD.equals(actionKey) ) {
rr.logReportExecutionTime(userId, "",AppConstants.RLA_DOWNLOAD_EXCEL, formFields);
- } else if (actionKey.equals("report.download.pdf")) {
+ } else if (REPORT_DOWNLOAD_PDF.equals(actionKey)) {
rr.logReportExecutionTime(userId, "",AppConstants.RLA_DOWNLOAD_PDF, formFields);
- } else if (actionKey.equals("report.csv.download")) {
+ } else if (REPORT_CSV_DOWNLOAD.equals(actionKey)) {
rr.logReportExecutionTime(userId, "",AppConstants.RLA_DOWNLOAD_CSV, formFields);
- } else if (actionKey.equals("report.text.download")) {
+ } else if (REPORT_TEXT_DOWNLOAD.equals(actionKey)) {
rr.logReportExecutionTime(userId, "",AppConstants.RLA_DOWNLOAD_TEXT, formFields);
- } else if (actionKey.equals("report.download.page")) {
+ } else if (REPORT_DOWNLOAD_PAGE.equals(actionKey)) {
rr.logReportExecutionTime(userId, "",AppConstants.RLA_DOWNLOAD_PAGE_EXCEL, formFields);
- } else if (actionKey.equals("report.download.excel2007")) {
+ } else if (REPORT_DOWNLOAD_EXCEL2007.equals(actionKey)) {
rr.logReportExecutionTime(userId, "",AppConstants.RLA_DOWNLOAD_EXCELX, formFields);
}
}
@@ -273,43 +287,29 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
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;
@@ -319,12 +319,9 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
//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 = "";
@@ -337,7 +334,6 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
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;
@@ -354,8 +350,6 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
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);
@@ -403,11 +397,6 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
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) {
@@ -416,21 +405,16 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
}
}
-
- /*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);
}
@@ -704,16 +688,6 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
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);
@@ -723,11 +697,6 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
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);
@@ -740,19 +709,19 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
boolean isFromReportLog = AppUtils.getRequestFlag(request, "fromReportLog");
if(!isFromReportLog) {
if(pdfAttachmentKey!=null && pdfAttachmentKey.length()>0) {
- if(actionKey.equals("report.download")) {
+ if(actionKey.equals(REPORT_DOWNLOAD)) {
rr.logReportExecutionTime(userId, String.valueOf(totalTime),AppConstants.RLA_SCHEDULED_DOWNLOAD_EXCEL, formFields);
- } else if (actionKey.equals("report.download.pdf")) {
+ } 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") ) {
+ if(actionKey.equals(REPORT_DOWNLOAD) ) {
rr.logReportExecutionTime(userId, String.valueOf(totalTime),AppConstants.RLA_DOWNLOAD_EXCEL, formFields);
- } else if (actionKey.equals("report.download.pdf")) {
+ } 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")) {
+ } 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")) {
+ } else if (actionKey.equals(REPORT_TEXT_DOWNLOAD)) {
rr.logReportExecutionTime(userId, String.valueOf(totalTime),AppConstants.RLA_DOWNLOAD_TEXT, formFields);
} else {