From 2d7b0d8a2c72e6b8254a5beb0386c4292ac95053 Mon Sep 17 00:00:00 2001 From: Pawel Date: Thu, 23 May 2019 05:36:31 -0400 Subject: Fix sonar issues in ChartWebRuntime Issue-ID: PORTAL-589 Signed-off-by: Pawel Change-Id: I66daba54fe1557bd268a2dda754142916c6dcd0d --- .../analytics/model/runtime/ChartWebRuntime.java | 28 ++++++++++------------ 1 file changed, 13 insertions(+), 15 deletions(-) (limited to 'ecomp-sdk/epsdk-analytics/src') diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartWebRuntime.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartWebRuntime.java index fcb0541e..361f405d 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartWebRuntime.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartWebRuntime.java @@ -70,7 +70,7 @@ public class ChartWebRuntime implements Serializable { public final String QRY_DATA_REPORT = ""; // Not used planning to use when filter is used - private StringBuffer whereClause = new StringBuffer(""); + private StringBuilder whereClause = new StringBuilder(""); // request used to grab request parameters private HttpServletRequest request; @@ -79,11 +79,11 @@ public class ChartWebRuntime implements Serializable { public ReportData reportData; //Used to pass user information - private final Map params = new HashMap(); + private final Map params = new HashMap<>(); //from chart generator retrieves list of charts to render - public ArrayList chartList; - public ArrayList infoList; + public List chartList; + public List infoList; private String totalSql; @@ -94,8 +94,6 @@ public class ChartWebRuntime implements Serializable { public List getRolesCommaSeperated(HttpServletRequest request) { Map roles = UserUtils.getRoles(request); List roleList = null; -// StringBuffer roleBuf = new StringBuffer(""); - int count = 0; if( roles != null ) { roleList = Arrays.asList(roles.keySet().toArray()); } @@ -119,7 +117,7 @@ public class ChartWebRuntime implements Serializable { long currentTime = System.currentTimeMillis(); HttpSession session = request.getSession(); String action = nvl(request.getParameter(AppConstants.RI_ACTION), request.getParameter("action")); - boolean genReportData = (!action.equals("chart.json") || action.equals("chart.data.json")); + boolean genReportData = (!"chart.json".equals(action) || "chart.data.json".equals(action)); @@ -165,7 +163,7 @@ public class ChartWebRuntime implements Serializable { reportData = getReportData(); - HashMap chartOptionsMap = new HashMap(); + HashMap chartOptionsMap = new HashMap<>(); String rotateLabelsStr = ""; rotateLabelsStr = AppUtils.nvl(reportRuntime.getLegendLabelAngle()); @@ -244,11 +242,11 @@ public class ChartWebRuntime implements Serializable { if(reportRuntime!=null) { - StringBuffer title = new StringBuffer(""); + StringBuilder title = new StringBuilder(""); title.append(reportRuntime.getReportName()); } - if(! (action.equals("chart.json") || action.equals("chart.data.json"))) { + if(! ("chart.json".equals(action) || "chart.data.json".equals(action))) { //Chart @@ -328,28 +326,28 @@ public class ChartWebRuntime implements Serializable { /** * @return the chartList */ - public ArrayList getChartList() { + public List getChartList() { return chartList; } /** * @param chartList the chartList to set */ - public void setChartList(ArrayList chartList) { + public void setChartList(List chartList) { this.chartList = chartList; } /** * @return the infoList */ - public ArrayList getInfoList() { + public List getInfoList() { return infoList; } /** * @param infoList the infoList to set */ - public void setInfoList(ArrayList infoList) { + public void setInfoList(List infoList) { this.infoList = infoList; } @@ -408,7 +406,7 @@ public class ChartWebRuntime implements Serializable { } */ - public String drawD3Charts(HashMap chartOptionsMap, HttpServletRequest request) { + public String drawD3Charts(Map chartOptionsMap, HttpServletRequest request) { ChartD3Helper chartHelper = new ChartD3Helper(reportRuntime); chartHelper.setChartType(reportRuntime.getChartType()); -- cgit 1.2.3-korg