/** * Used to determine if an alarm that is presently in the working memory should be updated * with the given alarm, when handling alarm snapshots. * * @param alarmInMem the alarm that is currently in the working memory * @param alarmInDb the alarm that is currently in the database * @return true if the alarm in the working memory should be updated, false otherwise */ protected static boolean shouldUpdateAlarmForSnapshot(OnmsAlarm alarmInMem, OnmsAlarm alarmInDb) { return !Objects.equals(alarmInMem.getLastEventTime(), alarmInDb.getLastEventTime()) || !Objects.equals(alarmInMem.getAckTime(), alarmInDb.getAckTime()); }
/** * Used to determine if an alarm that is presently in the working memory should be updated * with the given alarm, when handling alarm snapshots. * * @param alarmInMem the alarm that is currently in the working memory * @param alarmInDb the alarm that is currently in the database * @return true if the alarm in the working memory should be updated, false otherwise */ protected static boolean shouldUpdateAlarmForSnapshot(OnmsAlarm alarmInMem, OnmsAlarm alarmInDb) { return !Objects.equals(alarmInMem.getLastEventTime(), alarmInDb.getLastEventTime()) || !Objects.equals(alarmInMem.getAckTime(), alarmInDb.getAckTime()); }
@Override protected boolean matchesSafely(OnmsAlarm alarm) { return alarm.getAckTime() != null && alarm.getAckUser() != null; }
public List<OnmsAlarm> getUnAcknowledgedAlarms(long time) { return getAlarms(time).stream() .filter(alarm -> alarm.getAckTime() == null && alarm.getAckUser() == null) .collect(Collectors.toList()); }
public List<OnmsAlarm> getAcknowledgedAlarms(long time) { return getAlarms(time).stream() .filter(alarm -> alarm.getAckTime() != null && alarm.getAckUser() != null) .collect(Collectors.toList()); }
public boolean areAlarmsEqual(OnmsAlarm a1, OnmsAlarm a2) { if (a1 == null && a2 == null) { return true; } if (a1 == null || a2 == null) { return false; } return Objects.equals(a1.getId(), a2.getId()) && Objects.equals(a1.getLastEventTime(), a2.getLastEventTime()) && Objects.equals(a1.getLastAutomationTime(), a2.getLastAutomationTime()) && Objects.equals(a1.getSeverity(), a2.getSeverity()) && Objects.equals(a1.getAckUser(), a2.getAckUser()) && Objects.equals(a1.getAckTime(), a2.getAckTime()); }
ack.setLog(alert.getFixMessage()); acks.add(ack); } else if(alert.getAckMessage() != null && alarm.getAckTime() == null) {
setTimeIfNotNull(alarm.getAckTime(), builder::setAckTime);
setTimeIfNotNull(alarm.getAckTime(), builder::setAckTime);