summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-analytics
diff options
context:
space:
mode:
authorSunder Tattavarada <statta@research.att.com>2019-04-24 22:22:50 +0000
committerGerrit Code Review <gerrit@onap.org>2019-04-24 22:22:50 +0000
commit44a068001fdf0d4fb525425c2b276ae3a6af4fdb (patch)
tree8b8cfa0be6378d031356d6d726ee03e2338a0ad2 /ecomp-sdk/epsdk-analytics
parente2e72e580e6dbac487a59afd487944f0bbdf1dc1 (diff)
parentd05c2ecc809c5aa4c2526fe2b6b868fb289ea846 (diff)
Merge "Fisx sonar issues (part)"
Diffstat (limited to 'ecomp-sdk/epsdk-analytics')
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ActionHandler.java84
1 files changed, 23 insertions, 61 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 e976f144..1eea72e1 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
@@ -137,6 +137,7 @@ import com.fasterxml.jackson.databind.SerializationFeature;
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 void preserveReportRuntimeAsBackup(HttpServletRequest request) {
@@ -146,54 +147,36 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
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));
+ int formIndex = Integer.parseInt(nvl((String) session.getAttribute(AppConstants.FORM_DRILLDOWN_INDEX), "0"));
+
+ if(repAl ==null || repAl.isEmpty()) {
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--;
+ 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));
+ formIndex = formIndex + 1;
+ session.setAttribute(AppConstants.FORM_DRILLDOWN_INDEX, Integer.toString(formIndex));
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 {
+ private boolean isDashboardInDrillDownList(HttpServletRequest request) {
ArrayList aL = (ArrayList) request.getSession().getAttribute(
AppConstants.DRILLDOWN_REPORTS_LIST);
ReportRuntime rr = null;
- if(aL ==null || aL.size() <= 0) {
+ if(aL ==null || aL.isEmpty()) {
return false;
} else {
for (int i =0; i<aL.size(); i++) {
@@ -204,33 +187,6 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
}
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"));
@@ -259,8 +215,14 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
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(!"N".equals(nvl(request.getParameter("parent"), "")))
+ {
+ 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")) {
@@ -810,8 +772,8 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
}
*/
if(rr.isDrillDownURLInPopupPresent()) {
- request.getSession().setAttribute("parent_"+rr.getReportID()+"_rr", rr);
- request.getSession().setAttribute("parent_"+rr.getReportID()+"_rd", rd);
+ request.getSession().setAttribute(PARENT+rr.getReportID()+"_rr", rr);
+ request.getSession().setAttribute(PARENT+rr.getReportID()+"_rd", rd);
}
if(rr.getReportType().equals(AppConstants.RT_CROSSTAB)) {
@@ -2112,7 +2074,7 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
String attributeName = "";
while(enum1.hasMoreElements()) {
attributeName = enum1.nextElement();
- if(attributeName.startsWith("parent_")) {
+ if(attributeName.startsWith(PARENT)) {
session.removeAttribute(attributeName);
}
}