Multiple Sonar Fixes
[holmes/common.git] / holmes-actions / src / main / java / org / onap / holmes / common / api / stat / Alarm.java
index 4046307..b6cfc06 100644 (file)
@@ -37,8 +37,8 @@ public class Alarm implements AplusData, Cloneable, Serializable {
     public static final byte EVENT_RAISED = 0;\r
 \r
     private static final long serialVersionUID = 4520003737132012000L;\r
-    private final static Date clearedServerTime = null;\r
-    private final Map<Integer, Integer> linkIdNodeIdxMap = new HashMap<Integer, Integer>();\r
+    private static final Date clearedServerTime = null;\r
+    private final Map<Integer, Integer> linkIdNodeIdxMap = new HashMap<>();\r
     private byte eventType = EVENT_RAISED;\r
     private long id = 0L;\r
     private String alarmKey = "";\r
@@ -64,9 +64,9 @@ public class Alarm implements AplusData, Cloneable, Serializable {
     private boolean rootAlarmFlag = false;\r
     private int linkId = -1;\r
     private int nodeIdx = -1;\r
-    private Set<Integer> linkIds = new HashSet<Integer>();\r
-    private HashMap<String, Integer> priorityMap = new HashMap<String, Integer>();\r
-    private HashMap<String, Integer> rootAlarmTypeMap = new HashMap<String, Integer>();\r
+    private Set<Integer> linkIds = new HashSet<>();\r
+    private HashMap<String, Integer> priorityMap = new HashMap<>();\r
+    private HashMap<String, Integer> rootAlarmTypeMap = new HashMap<>();\r
     private int rootAlarmType = -1;\r
     private boolean keyAlarmFlag = false;\r
     private int keyAlarmType = -1;\r
@@ -86,7 +86,7 @@ public class Alarm implements AplusData, Cloneable, Serializable {
      * number of locations in otherIdIdx (otherIdIdx) with the site):1,\r
      */\r
     public int CompareLinkPosition(Map<Integer, Integer> otherIdIdx) {\r
-        Set<Integer> myIdSet = new HashSet<Integer>();\r
+        Set<Integer> myIdSet = new HashSet<>();\r
         myIdSet.addAll(this.linkIdNodeIdxMap.keySet());\r
         myIdSet.retainAll(otherIdIdx.keySet());\r
 \r
@@ -175,10 +175,7 @@ public class Alarm implements AplusData, Cloneable, Serializable {
 \r
 \r
     public boolean containsPriority(String ruleId) {\r
-        if (priorityMap.keySet().contains(ruleId)) {\r
-            return true;\r
-        }\r
-        return false;\r
+        return priorityMap.keySet().contains(ruleId);\r
     }\r
 \r
     public int getPriority(String ruleId) {\r
@@ -190,11 +187,8 @@ public class Alarm implements AplusData, Cloneable, Serializable {
     }\r
 \r
     public int getRootAlarmType(String ruleId) {\r
-        Integer rootAlarmType = this.rootAlarmTypeMap.get(ruleId);\r
-        if (rootAlarmType == null) {\r
-            rootAlarmType = -1;\r
-        }\r
-        return rootAlarmType;\r
+        Integer rootAlarmTypeVar = this.rootAlarmTypeMap.get(ruleId);\r
+        return (rootAlarmTypeVar == null) ? -1 : rootAlarmTypeVar;\r
     }\r
 \r
 }\r