@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; NotificationSourceWrapperImpl other = (NotificationSourceWrapperImpl) obj; if (notificationSource == null) { if (other.notificationSource != null) return false; } else if (!notificationSource.equals(other.notificationSource)) return false; return true; }
public String[] getAlarms(NotificationSource notificationSource) throws NullPointerException, UnrecognizedNotificationSourceException, ManagementException { if (notificationSource == null) { throw new NullPointerException("NotificationSource must not be null"); } mandateSource(notificationSource); try { Set<String> ids = new HashSet<String>(); for (Map.Entry<AlarmPlaceHolder, NotificationSource> e : placeHolderToNotificationSource.entrySet()) { if (e.getValue().equals(notificationSource)) { ids.add(e.getKey().getAlarm().getAlarmID()); } } return ids.toArray(new String[ids.size()]); } catch (Exception e) { throw new ManagementException("Failed to get alarm id list due to: ", e); } }
public boolean isSourceOwnerOfAlarm(NotificationSourceWrapper notificationSource, String alarmID) { AlarmPlaceHolder aph = this.alarmIdToAlarm.get(alarmID); if (aph == null) return false; return aph.getNotificationSource().getNotificationSource().equals(notificationSource.getNotificationSource()); }
public int clearAlarms(NotificationSource notificationSource, String alarmType) throws NullPointerException, UnrecognizedNotificationSourceException, ManagementException { if (notificationSource == null) { throw new NullPointerException("NotificationSource must not be null"); } if (alarmType == null) { throw new NullPointerException("AlarmType must not be null"); } mandateSource(notificationSource); int count = 0; try { for (Map.Entry<AlarmPlaceHolder, NotificationSource> e : placeHolderToNotificationSource.entrySet()) { if (e.getValue().equals(notificationSource) && e.getKey().getAlarmType().equals(alarmType)) { if (clearAlarm(e.getKey().getAlarm().getAlarmID())) { count++; } } } } catch (Exception e) { throw new ManagementException("Failed to get alarm id list due to: ", e); } return count; }
public int clearAlarms(NotificationSource notificationSource) throws NullPointerException, UnrecognizedNotificationSourceException, ManagementException { if (notificationSource == null) { throw new NullPointerException("NotificationSource must not be null"); } mandateSource(notificationSource); int count = 0; try { for (Map.Entry<AlarmPlaceHolder, NotificationSource> e : placeHolderToNotificationSource.entrySet()) { if (e.getValue().equals(notificationSource)) { if (clearAlarm(e.getKey().getAlarm().getAlarmID())) { count++; } } } } catch (Exception e) { throw new ManagementException("Failed to get alarm id list due to: ", e); } return count; }