diff options
Diffstat (limited to 'ecomp-sdk')
-rw-r--r-- | ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ActionHandler.java | 67 |
1 files changed, 31 insertions, 36 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 3eca7c68..0b3cf05a 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 @@ -148,6 +148,9 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject { private static final String REPORT_DOWNLOAD_PAGE = ";report.download.page"; private static final String FALSE = "false"; private static final String COLNAME = "[colName]"; + private static final String FORM_FIELDS = "formFields"; + private static final String USER_ID = "user_id"; + private static final String MESSAGE = "message"; private void preserveReportRuntimeAsBackup(HttpServletRequest request) { HttpSession session = request.getSession(); ArrayList repAl = null; @@ -312,19 +315,17 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject { if(reportID !=null) rr1 = rh1.loadReportRuntime(request, reportID, true, 1); if(rr1!=null && rr1.getReportType().equals(AppConstants.RT_DASHBOARD)) { - int DASH=7; - int requestFlag = DASH; + 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(); TreeMap treeMap = getListOfReportsFromDashBoardHTML(strHTML); Set set = treeMap.entrySet(); - String value = ""; HashMap reportsRuntimeMap = new HashMap(); HashMap reportDataMap = new HashMap(); @@ -336,9 +337,6 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject { 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; @@ -367,9 +365,7 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject { } 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; @@ -392,7 +388,7 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject { long totalTime = System.currentTimeMillis() - currentTime; - formFields = AppUtils.getRequestNvlValue(request, "formFields"); + 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); @@ -423,7 +419,8 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject { return "raptor/report_dashboard_run_container.jsp"; } else { fromDashboard = AppUtils.getRequestFlag(request,"fromDashboard"); - if(isDashboardInDrillDownList(request)) fromDashboard= true; + if(isDashboardInDrillDownList(request)) + fromDashboard= true; if(!fromDashboard) { request.getSession().removeAttribute(AppConstants.SI_DASHBOARD_REPORTRUNTIME_MAP); @@ -435,31 +432,29 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject { 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 = ESAPI.encoder().encodeForSQL( SecurityCodecUtil.getCodec(),AppUtils.getRequestValue(request, "log_id")); - logger.debug(EELFLoggerDelegate.debugLogger, ("Email PDF" + pdfAttachmentKey+" "+ report_email_sent_log_id)); + + 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 && report_email_sent_log_id !=null) + if(nvl(pdfAttachmentKey).length()>0 && reportEmailSentLogId !=null) isEmailAttachment = true; if(isEmailAttachment) { 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()); + query = query.replace("[report_email_sent_log_id.trim()]", reportEmailSentLogId.trim()); DataSet ds = DbUtils.executeQuery(query, 1); if(!ds.isEmpty()) { - userId = ds.getString(0,"user_id"); + 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"); + 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); + } else + userId = AppUtils.getUserID(request); // Scheduling Dashoard report if(reportID !=null && nvl(pdfAttachmentKey).length()>0) @@ -540,7 +535,7 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject { long totalTime = System.currentTimeMillis() - currentTime; - formFields = AppUtils.getRequestNvlValue(request, "formFields"); + formFields = AppUtils.getRequestNvlValue(request, FORM_FIELDS); rrDashboardReports.logReportRun(userId, String.valueOf(totalTime),formFields); rrDashboardReports.logReportExecutionTime(userId, String.valueOf(totalTime),AppConstants.RLA_EXECUTION_TIME, formFields); @@ -703,7 +698,7 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject { request.getSession().setAttribute(AppConstants.RI_REPORT_DATA, rd); } // else long totalTime = System.currentTimeMillis() - currentTime; - formFields = AppUtils.getRequestNvlValue(request, "formFields"); + formFields = AppUtils.getRequestNvlValue(request, FORM_FIELDS); request.setAttribute(AppConstants.RLA_EXECUTION_TIME, "" + totalTime); @@ -1046,7 +1041,7 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject { 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"); + request.setAttribute(MESSAGE, "Report has been scheduled successfully"); reportSchedule = (ReportSchedule) request.getSession().getAttribute(AppConstants.SI_REPORT_SCHEDULE); reportSchedule.persistScheduleData(connection, request); DbUtils.commitTransaction(connection); @@ -1208,7 +1203,7 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject { removeVariablesFromSession(request); DataCache.refreshAll(); Globals.getAppUtils().resetUserCache(); - request.setAttribute("message", "Cache Refreshed"); + request.setAttribute(MESSAGE, "Cache Refreshed"); return nextPage; } public String reportCreate(HttpServletRequest request, String nextPage) { @@ -1739,7 +1734,7 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject { if(!isFromSchedule) userId = AppUtils.getUserID(request); else - userId = AppUtils.getRequestValue(request, "user_id"); + userId = AppUtils.getRequestValue(request, USER_ID); Runtime runtime = Runtime.getRuntime(); ReportRuntime rr = null; if(!isFromSchedule) { @@ -1763,11 +1758,11 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject { DataSet ds = DbUtils.executeQuery(query, 1); if(!ds.isEmpty()) { - userId = ds.getString(0,"user_id"); + 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"); + request.setAttribute(MESSAGE, "This link has expired, please <a href=''>login</a> and regenerate the report"); return "raptor/message.jsp"; } @@ -1803,7 +1798,7 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject { 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()); + request.setAttribute(MESSAGE, messageBuffer.toString()); } else if(!flag) { String whole_fileName = FilenameUtils.normalize (Globals.getShellScriptDir() +AppConstants.SHELL_QUERY_DIR+ fileName+AppConstants.FT_SQL); @@ -1932,8 +1927,8 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject { } //DbUtils.commitTransaction(connection); //DbUtils.clearConnection(connection); - - + + // debugLogger.debug("|"+downloadProcess.toString() + "|"); // if (downloadProcess == null) @@ -1944,7 +1939,7 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject { // retCode= downloadProcess.waitFor(); // } catch (InterruptedException e){ // e.printStackTrace(); -// } +// } // debugLogger.debug("retCode " + retCode); // Process child = rtime.exec("/bin/bash"); // BufferedWriter outCommand = new BufferedWriter(new @@ -1953,7 +1948,7 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject { // 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"); + //request.setAttribute(MESSAGE, "Shell Script is running in the background. You'll get an email once it is done"); } return nextPage; |