summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk
diff options
context:
space:
mode:
authorManoop Talasila <talasila@research.att.com>2019-08-13 18:24:49 +0000
committerGerrit Code Review <gerrit@onap.org>2019-08-13 18:24:49 +0000
commitee7109350ce80e838be35503bda7e0c56f527869 (patch)
tree796f463110450b8913d00774fccca11e662656a8 /ecomp-sdk
parent824d93f9d0ada807402b66153cc41b30b31fde3a (diff)
parent04fb89b1f2f09f9df1b7527120ae50e8174e52c4 (diff)
Merge "Fix sonar issues in ActionHandler"
Diffstat (limited to 'ecomp-sdk')
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ActionHandler.java51
1 files changed, 21 insertions, 30 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 f76d58df..3eca7c68 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
@@ -147,7 +147,7 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
private static final String REPORT_DOWNLOAD = "report.download";
private static final String REPORT_DOWNLOAD_PAGE = ";report.download.page";
private static final String FALSE = "false";
-
+ private static final String COLNAME = "[colName]";
private void preserveReportRuntimeAsBackup(HttpServletRequest request) {
HttpSession session = request.getSession();
ArrayList repAl = null;
@@ -1315,8 +1315,7 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
FormField ff = rr.getFormField(request.getParameter(AppConstants.RI_FIELD_NAME));
ReportFormFields rff = rr.getReportFormFields();
-
- int idx = 0;
+
FormField ff1 = null;
Map fieldNameMap = new HashMap();
int countOfFields = 0 ;
@@ -1325,27 +1324,27 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
String oldSQL = lookup.getOldSql();
if(AppUtils.getRequestFlag(request, AppConstants.RI_TEXTFIELD_POP)) {
- for(rff.resetNext(); rff.hasNext(); idx++) {
+ for(rff.resetNext(); rff.hasNext(); ) {
ff1 = rff.getNext();
fieldNameMap.put(ff1.getFieldName(), ff1.getFieldDisplayName());
countOfFields++;
}
-
-
- //List formParameter = new ArrayList();
+
String formField = "";
HashMap valuesMap = new HashMap();
for(int i = 0 ; i < rff.size(); i++) {
- formField = ((FormField)rff.getFormField(i)).getFieldName();
+ formField = (rff.getFormField(i)).getFieldName();
if(request.getParameterValues(formField) != null && request.getParameterValues(formField).length > 1 ) {
- String[] vals = (String[]) request.getParameterValues(formField);
+ String[] vals = request.getParameterValues(formField);
String value = "";
- StringBuffer valueBuf = new StringBuffer();
+ StringBuilder valueBuf = new StringBuilder();
for(int ii = 0 ; ii < vals.length; ii++) {
- if(ii == 0) valueBuf.append("(");
+ if(ii == 0)
+ valueBuf.append("(");
valueBuf.append(vals[ii]);
- if(ii == vals.length-1) valueBuf.append(")");
- else valueBuf.append(",");
+ if(ii == vals.length-1)
+ valueBuf.append(")");
+ else valueBuf.append(",");
}
value = valueBuf.toString();
valuesMap.put(fieldNameMap.get(formField), value);
@@ -1359,16 +1358,18 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
oldSQL = SQL;
Set set = valuesMap.entrySet();
String value = "";
- StringBuffer valueBuf = new StringBuffer();
+ StringBuilder valueBuf = new StringBuilder();
for(Iterator iter = set.iterator(); iter.hasNext(); ) {
Map.Entry entry = (Entry) iter.next();
if(entry.getValue() instanceof String[]) {
String[] vals = (String[]) entry.getValue();
for(int i = 0 ; i < vals.length; i++) {
- if(i == 0) valueBuf.append("(");
+ if(i == 0)
+ valueBuf.append("(");
valueBuf.append(vals[i]);
- if(i == vals.length-1) valueBuf.append(")");
- else valueBuf.append(",");
+ if(i == vals.length-1)
+ valueBuf.append(")");
+ else valueBuf.append(",");
}
value = valueBuf.toString();
} else {
@@ -1427,27 +1428,19 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
if (Utils.isNull(dbInfo)) {
dbInfo = (String) request.getSession().getAttribute("remoteDB");
}
- /*String query = "SELECT x FROM (SELECT DISTINCT "
- + (colType.equals(AppConstants.CT_DATE) ? ("TO_CHAR(" + colName + ", '"
- + nvl(displayFormat, AppConstants.DEFAULT_DATE_FORMAT) + "')")
- : colName) + " x FROM "
- + rdef.getTableById(tableId).getTableName() + " WHERE " + colName
- + " IS NOT NULL ORDER BY 1) xx WHERE ROWNUM <= "
- + Globals.getDefaultPageSize();*/
-
String q1 = Globals.getReportValuesMapDefA();
String q2 = Globals.getReportValuesMapDefB();
- q2 = q2.replace("[colName]", colName);
+ q2 = q2.replace(COLNAME, colName);
q2 = q2.replace("[nvl(displayFormat, AppConstants.DEFAULT_DATE_FORMAT)]", nvl(displayFormat, AppConstants.DEFAULT_DATE_FORMAT));
String q3 = Globals.getReportValuesMapDefC();
- q3 = q3.replace("[colName]", colName);
+ q3 = q3.replace(COLNAME, colName);
String q4 = Globals.getReportValuesMapDefD();
q4 = q4.replace("[rdef.getTableById(tableId).getTableName()]", rdef.getTableById(tableId).getTableName());
- q4 = q4.replace("[colName]", colName);
+ q4 = q4.replace(COLNAME, colName);
q4 = q4.replace("[Globals.getDefaultPageSize()]", String.valueOf(Globals.getDefaultPageSize()));
String query = q1 + (colType.equals(AppConstants.CT_DATE) ? q2 : q3) + q4;
@@ -1463,8 +1456,6 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
public String reportDrillDownToReportDefPopup(HttpServletRequest request, String nextPage) {
try {
- // ReportDefinition rdef = (ReportDefinition)
- // request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
String ddReportID = AppUtils
.getRequestNvlValue(request, AppConstants.RI_REPORT_ID);
ReportRuntime ddRr = (new ReportHandler()).loadReportRuntime(request, ddReportID,