diff options
author | Lorraine Welch <lb2391@att.com> | 2020-04-03 22:43:51 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-04-03 22:43:51 +0000 |
commit | e65d6b9eeea8133d264223c783dab391a7af5120 (patch) | |
tree | 7081ae554d5a95f20a547fdf163d19789b60894d /ecomp-sdk | |
parent | 7cd8c0eedd2586a0ed52f84113a5d09a72dab947 (diff) | |
parent | 61e8fa6d7f81967e9f73c73dc3bd69da8222cd69 (diff) |
Merge "removed code smells"
Diffstat (limited to 'ecomp-sdk')
4 files changed, 27 insertions, 12 deletions
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/base/IdNameSql.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/base/IdNameSql.java index d727171a..3091fa96 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/base/IdNameSql.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/base/IdNameSql.java @@ -255,7 +255,9 @@ public class IdNameSql extends IdNameList { } if(searchString!=null && searchString.length()>0 && !searchString.equals("%")) { - if(pageNo == -2) query.append(" WHERE "); + if(pageNo == -2){ + query.append(" WHERE "); + } else query.append(" and "); query.append("name like '"+ searchString +"'"); } diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/base/ReportWrapper.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/base/ReportWrapper.java index 4778d2f2..69837d04 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/base/ReportWrapper.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/base/ReportWrapper.java @@ -2887,7 +2887,8 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { posFormField = sql.indexOf(fieldDisplay); int posSelectField = sql.lastIndexOf("SELECT ", posFormField); int andField = 0; - int whereField = 0, whenField = 0; + int whereField = 0; + int whenField = 0; andField = sql.lastIndexOf(" AND ", posFormField); whereField = sql.indexOf(" WHERE", posSelectField); whenField = sql.indexOf(" WHEN", posSelectField); @@ -4242,7 +4243,9 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { // reportSQL = reportSQL.replaceAll("[\\s]*\\(", "("); colName = colName.replaceAll(",[\\s]*\\(", ",("); StringBuffer colNameBuf = new StringBuffer(colName); - int pos = 0, posFormatStart = 0, posFormatEnd = 0; + int pos = 0; + int posFormatStart = 0; + int posFormatEnd = 0; String format = ""; if (colNameBuf.indexOf("999") == -1 && colNameBuf.indexOf("990") == -1) { logger.debug(EELFLoggerDelegate.debugLogger, (" return colName " + colNameBuf.toString())); diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportDefinition.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportDefinition.java index 96e8804f..e51913e4 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportDefinition.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportDefinition.java @@ -853,7 +853,8 @@ public class ReportDefinition extends ReportWrapper implements Serializable { break; } } - if(flag == 1) return javascriptItemType; + if(flag == 1) + return javascriptItemType; else { javascriptItemType = objFactory.createJavascriptItemType(); getJavascriptList().getJavascriptItem().add(javascriptItemType); @@ -1357,7 +1358,8 @@ public class ReportDefinition extends ReportWrapper implements Serializable { String extracted = null; nextToken = getNextCYMBALSQLParseToken(sql,true); while (nextToken.length() > 0) { - if (lastToken == null) lastToken = nextToken; + if (lastToken == null) + lastToken = nextToken; if( lastToken.toUpperCase().startsWith("DO DISPLAY")) { re = Pattern.compile("each(.*)\\[.(.*?)\\]"); //\\[(.*?)\\] @@ -1503,7 +1505,8 @@ public class ReportDefinition extends ReportWrapper implements Serializable { String extracted = null; nextToken = getNextCYMBALSQLParseToken(sql,true); while (nextToken.length() > 0) { - if (lastToken == null) lastToken = nextToken; + if (lastToken == null) + lastToken = nextToken; if( lastToken.toUpperCase().startsWith("DO DISPLAY")) { re = Pattern.compile("each(.*)\\[.(.*?)\\]"); //\\[(.*?)\\] diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportSchedule.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportSchedule.java index d56391ef..5db298b8 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportSchedule.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportSchedule.java @@ -666,7 +666,9 @@ public class ReportSchedule extends RaptorObject implements Serializable{ paramValue = Utils.replaceInString(paramValue, "''", "'"); ds = ConnectionUtils.getDataSet(paramValue, dbInfo); - if (ds.getRowCount() > 0) paramValue = ds.getString(0, 0); + if (ds.getRowCount() > 0){ + paramValue = ds.getString(0, 0); + } } logger.debug(EELFLoggerDelegate.debugLogger, ("SQLSQLBASED B4^^^^^^^^^ " + sql + " " + fft.getValidationType() + " " + fft.getFieldName() + " " + fft.getFieldId())); if(fft!=null && (fft.getValidationType()!=null && (fft.getValidationType().equals(FormField.VT_TIMESTAMP_HR) || fft.getValidationType().equals(FormField.VT_TIMESTAMP_MIN) ||fft.getValidationType().equals(FormField.VT_TIMESTAMP_SEC) ||fft.getValidationType().equals(FormField.VT_DATE) ))) { @@ -741,8 +743,10 @@ public class ReportSchedule extends RaptorObject implements Serializable{ re1 = Pattern.compile("(^[\r\n]|[\\s]|[^0-9a-zA-Z])AND(.*?[^\r\n]*)"+ "\\["+fft.getFieldName()+ "\\](.*?)\\s", Pattern.DOTALL); posFormField = sql.indexOf(fieldDisplay); posAnd = sql.lastIndexOf(" AND ", posFormField); - if(posAnd < 0) posAnd = 0; - else if (posAnd > 2) posAnd = posAnd - 2; + if(posAnd < 0) + posAnd = 0; + else if (posAnd > 2) + posAnd = posAnd - 2; matcher = re1.matcher(sql); if (matcher.find(posAnd)) { sql = sql.replace(matcher.group(), ""); @@ -763,8 +767,10 @@ public class ReportSchedule extends RaptorObject implements Serializable{ re1 = Pattern.compile("(^[\r\n]|[\\s]|[^0-9a-zA-Z])AND(.*?[^\r\n]*)"+ "\\["+fft.getFieldName()+ "\\](.*?)\\s", Pattern.DOTALL); //+[\'\\)|\'|\\s] posFormField = sql.indexOf(fieldDisplay); posAnd = sql.lastIndexOf(" AND ", posFormField); - if(posAnd < 0) posAnd = 0; - else if (posAnd > 2) posAnd = posAnd - 2; + if(posAnd < 0) + posAnd = 0; + else if (posAnd > 2) + posAnd = posAnd - 2; matcher = re1.matcher(sql); if (matcher.find(posAnd)) { sql = sql.replace(matcher.group(), " "); @@ -1190,7 +1196,8 @@ public class ReportSchedule extends RaptorObject implements Serializable{ }catch(NumberFormatException ex){ numInt = 0; } - if(numInt < 10) return "0"+numInt; + if(numInt < 10) + return "0"+numInt; else return ""+numInt; } |