X-Git-Url: https://gerrit.onap.org/r/gitweb?p=holmes%2Fcommon.git;a=blobdiff_plain;f=holmes-actions%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fholmes%2Fcommon%2Fapi%2Fstat%2FAlarm.java;h=b6cfc06b4bb3bdc156d6d800d17f00277ea88308;hp=40463077404a337453a606b6fc91a89aa67bb01c;hb=4f48419205730ecc3e34d93efc99cd76b81f9a59;hpb=dd26bae61d5323e03bde0bbf8570f0af1de1af41 diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/api/stat/Alarm.java b/holmes-actions/src/main/java/org/onap/holmes/common/api/stat/Alarm.java index 4046307..b6cfc06 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/api/stat/Alarm.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/api/stat/Alarm.java @@ -37,8 +37,8 @@ public class Alarm implements AplusData, Cloneable, Serializable { public static final byte EVENT_RAISED = 0; private static final long serialVersionUID = 4520003737132012000L; - private final static Date clearedServerTime = null; - private final Map linkIdNodeIdxMap = new HashMap(); + private static final Date clearedServerTime = null; + private final Map linkIdNodeIdxMap = new HashMap<>(); private byte eventType = EVENT_RAISED; private long id = 0L; private String alarmKey = ""; @@ -64,9 +64,9 @@ public class Alarm implements AplusData, Cloneable, Serializable { private boolean rootAlarmFlag = false; private int linkId = -1; private int nodeIdx = -1; - private Set linkIds = new HashSet(); - private HashMap priorityMap = new HashMap(); - private HashMap rootAlarmTypeMap = new HashMap(); + private Set linkIds = new HashSet<>(); + private HashMap priorityMap = new HashMap<>(); + private HashMap rootAlarmTypeMap = new HashMap<>(); private int rootAlarmType = -1; private boolean keyAlarmFlag = false; private int keyAlarmType = -1; @@ -86,7 +86,7 @@ public class Alarm implements AplusData, Cloneable, Serializable { * number of locations in otherIdIdx (otherIdIdx) with the site):1, */ public int CompareLinkPosition(Map otherIdIdx) { - Set myIdSet = new HashSet(); + Set myIdSet = new HashSet<>(); myIdSet.addAll(this.linkIdNodeIdxMap.keySet()); myIdSet.retainAll(otherIdIdx.keySet()); @@ -175,10 +175,7 @@ public class Alarm implements AplusData, Cloneable, Serializable { public boolean containsPriority(String ruleId) { - if (priorityMap.keySet().contains(ruleId)) { - return true; - } - return false; + return priorityMap.keySet().contains(ruleId); } public int getPriority(String ruleId) { @@ -190,11 +187,8 @@ public class Alarm implements AplusData, Cloneable, Serializable { } public int getRootAlarmType(String ruleId) { - Integer rootAlarmType = this.rootAlarmTypeMap.get(ruleId); - if (rootAlarmType == null) { - rootAlarmType = -1; - } - return rootAlarmType; + Integer rootAlarmTypeVar = this.rootAlarmTypeMap.get(ruleId); + return (rootAlarmTypeVar == null) ? -1 : rootAlarmTypeVar; } }