diff options
author | Lorraine Welch <lb2391@att.com> | 2020-04-20 16:45:49 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-04-20 16:45:49 +0000 |
commit | c1102bf187d2af895fb19e550820bfa73565b227 (patch) | |
tree | af901a78be6d75eedb200ff0032f91f777f29527 /ecomp-sdk/epsdk-analytics | |
parent | 22aaa0935d52eb6a85b87baf30d28d6fcef63a35 (diff) | |
parent | 5e9527d6e9cdf60b7ea4118e98ebac064d52c87d (diff) |
Merge "removed some code smells"
Diffstat (limited to 'ecomp-sdk/epsdk-analytics')
3 files changed, 115 insertions, 59 deletions
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartJSONHelper.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartJSONHelper.java index 29cbca18..6003222b 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartJSONHelper.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartJSONHelper.java @@ -995,7 +995,8 @@ public class ChartJSONHelper { } else if (filter == 1 && (dc.isCreateInNewChart()==null || !dc.isCreateInNewChart().booleanValue())) { chartValueCols.add(dc); } - else if(filter == 0) chartValueCols.add(dc); + else if(filter == 0) + chartValueCols.add(dc); } else chartValueCols.add(dc); } // } else @@ -1067,113 +1068,138 @@ public class ChartJSONHelper { */ date = MMDDYYYYHHMMSSFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = SECFLAG; + if(date!=null) + formatFlag = SECFLAG; if(date==null) { date = EEEMMDDYYYYFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = DAYOFTHEWEEKFLAG; + if(date!=null) + formatFlag = DAYOFTHEWEEKFLAG; } if(date==null) { date = MMDDYYYYHHMMFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = MINFLAG; + if(date!=null) + formatFlag = MINFLAG; } if(date==null) { //MMDDYYYYHHFormat.setTimeZone(TimeZone.getTimeZone("UTC")); date = MMDDYYYYHHFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = HOURFLAG; + if(date!=null) + formatFlag = HOURFLAG; } if(date==null) { date = MMDDYYYYFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = DAYFLAG; + if(date!=null) + formatFlag = DAYFLAG; } if(date==null) { date = YYYYMMDDFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = DAYFLAG; + if(date!=null) + formatFlag = DAYFLAG; } if(date==null) { date = timestampFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = SECFLAG; + if(date!=null) + formatFlag = SECFLAG; } if(date==null) { date = timestampHrFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = HOURFLAG; + if(date!=null) + formatFlag = HOURFLAG; } if(date==null) { date = timestampDayFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = DAYFLAG; + if(date!=null) + formatFlag = DAYFLAG; } if(date==null) { date = MONYYYYFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = MONTHFLAG; + if(date!=null) + formatFlag = MONTHFLAG; } if(date==null) { date = MMYYYYFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = MONTHFLAG; + if(date!=null) + formatFlag = MONTHFLAG; } if(date==null) { date = MMMMMDDYYYYFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = DAYFLAG; + if(date!=null) + formatFlag = DAYFLAG; } if(date==null) { date = MONTHYYYYFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = MONTHFLAG; + if(date!=null) + formatFlag = MONTHFLAG; } if(date==null) { date = YYYYMMDDHHMMSSFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = SECFLAG; + if(date!=null) + formatFlag = SECFLAG; } if(date==null) { date = YYYYMMDDHHMMFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = MINFLAG; + if(date!=null) + formatFlag = MINFLAG; } if(date==null) { date = DDMONYYYYHHMMSSFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = SECFLAG; + if(date!=null) + formatFlag = SECFLAG; } if(date==null) { date = DDMONYYYYHHMMFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = MINFLAG; + if(date!=null) + formatFlag = MINFLAG; } if(date==null) { date = DDMONYYYYFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = DAYFLAG; + if(date!=null) + formatFlag = DAYFLAG; } if(date==null) { date = MMDDYYHHMMSSFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = SECFLAG; + if(date!=null) + formatFlag = SECFLAG; } if(date==null) { date = MMDDYYHHMMFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = MINFLAG; + if(date!=null) + formatFlag = MINFLAG; } if(date==null) { date = MMDDYYFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = DAYFLAG; + if(date!=null) + formatFlag = DAYFLAG; } if(date==null) { date = timestampFormat1.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = SECFLAG; + if(date!=null) + formatFlag = SECFLAG; } if(date==null) { date = MMDDYYYYHHMMZFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = MINFLAG; + if(date!=null) + formatFlag = MINFLAG; } if(date==null) { date = YYYYFormat.parse(dateStr, new ParsePosition(0)); /* Some random numbers should not satisfy this year format. */ - if(dateStr.length()>4) date = null; - if(date!=null) formatFlag = YEARFLAG; + if(dateStr.length()>4) + date = null; + if(date!=null) + formatFlag = YEARFLAG; } if(date==null) date = null; @@ -1230,112 +1256,137 @@ public class ChartJSONHelper { */ date = MMDDYYYYHHMMSSFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = SECFLAG; + if(date!=null) + formatFlag = SECFLAG; if(date==null) { date = EEEMMDDYYYYFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = DAYOFTHEWEEKFLAG; + if(date!=null) + formatFlag = DAYOFTHEWEEKFLAG; } if(date==null) { date = MMDDYYYYHHMMFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = MINFLAG; + if(date!=null) + formatFlag = MINFLAG; } if(date==null) { //MMDDYYYYHHFormat.setTimeZone(TimeZone.getTimeZone("UTC")); date = MMDDYYYYHHFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = HOURFLAG; + if(date!=null) + formatFlag = HOURFLAG; } if(date==null) { date = MMDDYYYYFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = DAYFLAG; + if(date!=null) + formatFlag = DAYFLAG; } if(date==null) { date = YYYYMMDDFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = DAYFLAG; + if(date!=null) + formatFlag = DAYFLAG; } if(date==null) { date = timestampFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = SECFLAG; + if(date!=null) + formatFlag = SECFLAG; } if(date==null) { date = timestampHrFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = HOURFLAG; + if(date!=null) + formatFlag = HOURFLAG; } if(date==null) { date = timestampDayFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = DAYFLAG; + if(date!=null) + formatFlag = DAYFLAG; } if(date==null) { date = MONYYYYFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = MONTHFLAG; + if(date!=null) + formatFlag = MONTHFLAG; } if(date==null) { date = MMYYYYFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = MONTHFLAG; + if(date!=null) + formatFlag = MONTHFLAG; } if(date==null) { date = MMMMMDDYYYYFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = DAYFLAG; + if(date!=null) + formatFlag = DAYFLAG; } if(date==null) { date = MONTHYYYYFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = MONTHFLAG; + if(date!=null) + formatFlag = MONTHFLAG; } if(date==null) { date = YYYYMMDDHHMMSSFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = SECFLAG; + if(date!=null) + formatFlag = SECFLAG; } if(date==null) { date = YYYYMMDDHHMMFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = MINFLAG; + if(date!=null) + formatFlag = MINFLAG; } if(date==null) { date = DDMONYYYYHHMMSSFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = SECFLAG; + if(date!=null) + formatFlag = SECFLAG; } if(date==null) { date = DDMONYYYYHHMMFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = MINFLAG; + if(date!=null) + formatFlag = MINFLAG; } if(date==null) { date = DDMONYYYYFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = DAYFLAG; + if(date!=null) + formatFlag = DAYFLAG; } if(date==null) { date = MMDDYYHHMMSSFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = SECFLAG; + if(date!=null) + formatFlag = SECFLAG; } if(date==null) { date = MMDDYYHHMMFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = MINFLAG; + if(date!=null) + formatFlag = MINFLAG; } if(date==null) { date = MMDDYYFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = DAYFLAG; + if(date!=null) + formatFlag = DAYFLAG; } if(date==null) { date = timestampFormat1.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = SECFLAG; + if(date!=null) + formatFlag = SECFLAG; } if(date==null) { date = MMDDYYYYHHMMZFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = MINFLAG; + if(date!=null) + formatFlag = MINFLAG; } if(date==null) { date = YYYYFormat.parse(dateStr, new ParsePosition(0)); /* Some random numbers should not satisfy this year format. */ - if(dateStr.length()>4) date = null; - if(date!=null) formatFlag = YEARFLAG; + if(dateStr.length()>4) + date = null; + if(date!=null) + formatFlag = YEARFLAG; } if(date==null) date = null; @@ -1362,8 +1413,10 @@ public class ChartJSONHelper { public boolean getBooleanValue(String s, Boolean defaultValue) { s = nvl(s); - if(s.length()<=0 && defaultValue!=null) return defaultValue.booleanValue(); - else if(s.length()<=0) return false; + if(s.length()<=0 && defaultValue!=null) + return defaultValue.booleanValue(); + else if(s.length()<=0) + return false; else { if(s.toUpperCase().startsWith("Y") || s.toLowerCase().equals("true")) return true; @@ -1468,7 +1521,8 @@ public class ChartJSONHelper { value.append("("); } for(int j = 0 ; j < vals.length; j++) { - if(isMultiValue) value.append("'"); + if(isMultiValue) + value.append("'"); try { if(vals[j] !=null && vals[j].length() > 0) { vals[j] = Utils.oracleSafe(vals[j]); @@ -1483,7 +1537,8 @@ public class ChartJSONHelper { } - if(isMultiValue) value.append("'"); + if(isMultiValue) + value.append("'"); if(j != vals.length -1) { value.append(","); diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/FormField.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/FormField.java index 178410ab..3af59e56 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/FormField.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/FormField.java @@ -70,7 +70,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; import java.util.regex.Matcher; -import java.util.regex.Pattern; +import java.util.regex.Pattern; import org.onap.portalsdk.analytics.error.RaptorRuntimeException; import org.onap.portalsdk.analytics.error.UserDefinedException; @@ -80,7 +80,6 @@ import org.onap.portalsdk.analytics.model.base.IdNameSql; import org.onap.portalsdk.analytics.model.base.IdNameValue; import org.onap.portalsdk.analytics.system.AppUtils; import org.onap.portalsdk.analytics.system.ConnectionUtils; -import org.onap.portalsdk.analytics.system.ExecuteQuery; import org.onap.portalsdk.analytics.system.Globals; import org.onap.portalsdk.analytics.util.DataSet; import org.onap.portalsdk.analytics.util.Utils; diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/FormatProcessor.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/FormatProcessor.java index b0eb81a3..0805b22c 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/FormatProcessor.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/FormatProcessor.java @@ -274,7 +274,8 @@ public class FormatProcessor extends RaptorObject { } } - if( anyFormatter == null ) anyFormatter = formatter; + if( anyFormatter == null ) + anyFormatter = formatter; // String sValue = convertValue(dv.getDisplayValue()); //if (sValue.length() > 0) { for (Iterator iter = semaphore.getFormatList().getFormat().iterator(); iter @@ -319,7 +320,8 @@ public class FormatProcessor extends RaptorObject { //dr.setFormatId(fmt.getFormatId()); //break; } else { // if - if(!formatModified) formatter = anyFormatter; + if(!formatModified) + formatter = anyFormatter; //if(!((formatter!=null && formatter!=anyFormatter) || (defaultFormatter!=null && formatter!=defaultFormatter))) // formatter = anyFormatter; //formatter.setFormatId(anyFormatter.getFormatId()); |