diff options
author | Arindam Mondal <arind.mondal@samsung.com> | 2019-10-25 11:48:01 +0900 |
---|---|---|
committer | arindamm <arind.mondal@samsung.com> | 2019-10-25 11:50:07 +0900 |
commit | 7589db2190a9b63d6cd3632e0f9694df88700f10 (patch) | |
tree | aa37265bd86c0e3461b5a24248224338837119b9 /ecomp-sdk | |
parent | abfa78c512476ae62bc032f7d515cf9f3f5cd837 (diff) |
Sonar fixes
+) Bug: Introduce a new variable instead of reusing the parameter "pageNo"
++) Removed unused import
+++) Removed unused local variable
Issue-ID: PORTAL-740
Change-Id: I8e0b1f19f2e33e87c9d668fdc4239e9f696be91f
Signed-off-by: arindamm <arind.mondal@samsung.com>
Diffstat (limited to 'ecomp-sdk')
-rw-r--r-- | ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/search/ReportSearchResultJSON.java | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/search/ReportSearchResultJSON.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/search/ReportSearchResultJSON.java index c3fc0a7b..2bd278e4 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/search/ReportSearchResultJSON.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/search/ReportSearchResultJSON.java @@ -38,12 +38,12 @@ package org.onap.portalsdk.analytics.model.search; import java.util.ArrayList; +import java.util.List; import javax.servlet.http.HttpServletRequest; import org.onap.portalsdk.analytics.error.RaptorException; import org.onap.portalsdk.analytics.system.AppUtils; -import org.onap.portalsdk.analytics.system.DbUtils; import org.onap.portalsdk.analytics.system.Globals; import org.onap.portalsdk.analytics.util.AppConstants; import org.onap.portalsdk.analytics.util.DataSet; @@ -102,22 +102,22 @@ class SearchReport { this.metaReport = metaReport; } - private ArrayList<ArrayList<SearchResultColumn>> columns = new ArrayList<>(); - private ArrayList<ArrayList<SearchResultRow>> rows = new ArrayList<>(); + private List<ArrayList<SearchResultColumn>> columns = new ArrayList<>(); + private List<ArrayList<SearchResultRow>> rows = new ArrayList<>(); - public ArrayList<ArrayList<SearchResultColumn>> getColumns() { + public List<ArrayList<SearchResultColumn>> getColumns() { return columns; } - public void setColumns(ArrayList<ArrayList<SearchResultColumn>> columns) { + public void setColumns(List<ArrayList<SearchResultColumn>> columns) { this.columns = columns; } - public ArrayList<ArrayList<SearchResultRow>> getRows() { + public List<ArrayList<SearchResultRow>> getRows() { return rows; } - public void setRows(ArrayList<ArrayList<SearchResultRow>> rows) { + public void setRows(List<ArrayList<SearchResultRow>> rows) { this.rows = rows; } @@ -130,9 +130,7 @@ public class ReportSearchResultJSON extends SearchResultJSON { private static final String HTML_FORM = "forma"; private String jsonString = ""; private SearchReport searchReport; - // private ArrayList<ArrayList<SearchResultColumn>> columns = new - // ArrayList<ArrayList<SearchResultColumn>>(); - // private ArrayList<ArrayList<SearchResultRow>> rows = new ArrayList<ArrayList<SearchResultRow>>(); + public ReportSearchResultJSON(int pageNo) { this(pageNo, Globals.getDefaultPageSize(), -1, -1); @@ -147,7 +145,6 @@ public class ReportSearchResultJSON extends SearchResultJSON { searchReport = new SearchReport(); MetaReport metaReport = new MetaReport(); - // if(searchReport.getMetaReport()!=null) searchReport.setMetaReport(metaReport); metaReport.setPageNo(pageNo); metaReport.setPageSize(pageSize); @@ -166,12 +163,6 @@ public class ReportSearchResultJSON extends SearchResultJSON { .getImgFolderURL() + "modify_icon.gif", "13", "12", true, false, false)); - /* - * addColumn(new SearchResultColumn(" Schedule ", "5%", "Center", "document." - * + HTML_FORM + "." + AppConstants.RI_ACTION + ".value='report.schedule_only';", "Schedule report", - * HTML_FORM, null, AppUtils .getImgFolderURL() + "calendar_icon.gif", "13", "12", true, false, - * false)); - */ addColumn(new SearchResultColumn("edit", "Edit", "5%", "Center", "document." + HTML_FORM + "." + AppConstants.RI_ACTION @@ -202,21 +193,20 @@ public class ReportSearchResultJSON extends SearchResultJSON { searchReport.getColumns().add(searchResultColumns); } // ReportSearchResult - public void parseData(DataSet ds, HttpServletRequest request, int pageNo, int pageSize, int writeAccessColIndex, + public void parseData(DataSet ds, HttpServletRequest request, int pageNumber, int pageSize, int writeAccessColIndex, int ownerIndicatorColIndex) throws RaptorException { // Presumes single ID field in the first column of the DataSet and row // number in the first SearchResultColumn - pageNo = AppUtils.getRequestNvlValue(request, "r_page").length() > 0 + int pageNo = AppUtils.getRequestNvlValue(request, "r_page").length() > 0 ? Integer.parseInt(AppUtils.getRequestNvlValue(request, "r_page")) : 0; - String userID = AppUtils.getUserID(request); + int dataSize = ds.getRowCount(); - // pageSize = 0; + if (searchReport.getMetaReport() != null) { searchReport.getMetaReport().setPageNo(pageNo); - // searchReport.getMetaReport().setPageSize(pageSize); pageSize = searchReport.getMetaReport().getPageSize(); searchReport.getMetaReport().setTotalSize(dataSize); } |