@Test @JUnitTemporaryDatabase public void testClearAlarms(){ Alarm alarm = m_alarmRepo.getAlarm(1); assertNotNull(alarm); assertEquals(OnmsSeverity.NORMAL.getId(), alarm.severity.getId()); int[] alarmIds = {1}; m_alarmRepo.clearAlarms(alarmIds, "TestUser", new Date()); alarm = m_alarmRepo.getAlarm(1); assertNotNull(alarm); assertEquals(OnmsSeverity.CLEARED.getId(), alarm.severity.getId()); }
@Transactional public void clearAlarms(int[] alarmIds, String user, Date timestamp) { List<OnmsAlarm> alarms = m_alarmDao.findMatching(getOnmsCriteria(new AlarmCriteria(new AlarmIdListFilter(alarmIds)))); Iterator<OnmsAlarm> alarmsIt = alarms.iterator(); while (alarmsIt.hasNext()) { OnmsAlarm alarm = alarmsIt.next(); OnmsAcknowledgment ack = new OnmsAcknowledgment(alarm, user); ack.setAckTime(timestamp); ack.setAckAction(AckAction.CLEAR); m_ackService.processAck(ack); m_alarmDao.update(alarm); } }
DaoWebAlarmRepository implements WebAlarmRepository, InitializingBean { @Transactional public void clearAlarms(int[] alarmIds, String user, Date timestamp) { List<OnmsAlarm> alarms = m_alarmDao.findMatching(getOnmsCriteria(new AlarmCriteria(new AlarmIdListFilter(alarmIds)))); Iterator<OnmsAlarm> alarmsIt = alarms.iterator(); while (alarmsIt.hasNext()) { OnmsAlarm alarm = alarmsIt.next(); OnmsAcknowledgment ack = new OnmsAcknowledgment(alarm, user); ack.setAckTime(timestamp); ack.setAckAction(AckAction.CLEAR); m_ackService.processAck(ack); m_alarmDao.update(alarm); } } }
DaoWebAlarmRepository implements WebAlarmRepository, InitializingBean { @Transactional public void clearAlarms(int[] alarmIds, String user, Date timestamp) { List<OnmsAlarm> alarms = m_alarmDao.findMatching(getOnmsCriteria(new AlarmCriteria(new AlarmIdListFilter(alarmIds)))); Iterator<OnmsAlarm> alarmsIt = alarms.iterator(); while (alarmsIt.hasNext()) { OnmsAlarm alarm = alarmsIt.next(); OnmsAcknowledgment ack = new OnmsAcknowledgment(alarm, user); ack.setAckTime(timestamp); ack.setAckAction(AckAction.CLEAR); m_ackService.processAck(ack); m_alarmDao.update(alarm); } }  }
DaoWebAlarmRepository implements WebAlarmRepository, InitializingBean { @Transactional public void clearAlarms(int[] alarmIds, String user, Date timestamp) { List<OnmsAlarm> alarms = m_alarmDao.findMatching(getOnmsCriteria(new AlarmCriteria(new AlarmIdListFilter(alarmIds)))); Iterator<OnmsAlarm> alarmsIt = alarms.iterator(); while (alarmsIt.hasNext()) { OnmsAlarm alarm = alarmsIt.next(); OnmsAcknowledgment ack = new OnmsAcknowledgment(alarm, user); ack.setAckTime(timestamp); ack.setAckAction(AckAction.CLEAR); m_ackService.processAck(ack); m_alarmDao.update(alarm); } }  @Override void afterPropertiesSet(); @Transactional void acknowledgeAll(String user, Date timestamp); @Transactional void acknowledgeAlarms(String user, Date timestamp, int[] alarmIds); @Transactional void acknowledgeMatchingAlarms(String user, Date timestamp, AlarmCriteria criteria); @Transactional void clearAlarms(int[] alarmIds, String user, Date timestamp); @Transactional int countMatchingAlarms(AlarmCriteria criteria); @Transactional int[] countMatchingAlarmsBySeverity(final AlarmCriteria criteria); @Transactional void escalateAlarms(int[] alarmIds, String user, Date timestamp); @Transactional Alarm getAlarm(int alarmId); @Transactional Alarm[] getMatchingAlarms(AlarmCriteria criteria); @Transactional void unacknowledgeAll(String user); @Transactional void unacknowledgeMatchingAlarms(AlarmCriteria criteria, String user); @Transactional void acknowledgeAlarms(int[] alarmIds, String user, Date timestamp); @Transactional void unacknowledgeAlarms(int[] alarmIds, String user); @Override @Transactional void updateStickyMemo(Integer alarmId, String body, String user); @Override @Transactional void updateReductionKeyMemo(Integer alarmId, String body, String user); @Override @Transactional void removeStickyMemo(Integer alarmId); @Override @Transactional void removeReductionKeyMemo(int alarmId); @Override @Transactional List<OnmsAcknowledgment> getAcknowledgments(int alarmId); @Override @Transactional List<AlarmSummary> getCurrentNodeAlarmSummaries(); }
DaoWebAlarmRepository implements WebAlarmRepository, InitializingBean { @Transactional public void clearAlarms(int[] alarmIds, String user, Date timestamp) { List<OnmsAlarm> alarms = m_alarmDao.findMatching(getOnmsCriteria(new AlarmCriteria(new AlarmIdListFilter(alarmIds)))); Iterator<OnmsAlarm> alarmsIt = alarms.iterator(); while (alarmsIt.hasNext()) { OnmsAlarm alarm = alarmsIt.next(); OnmsAcknowledgment ack = new OnmsAcknowledgment(alarm, user); ack.setAckTime(timestamp); ack.setAckAction(AckAction.CLEAR); m_ackService.processAck(ack); m_alarmDao.update(alarm); } }  @Override void afterPropertiesSet(); @Transactional void acknowledgeAll(String user, Date timestamp); @Transactional void acknowledgeAlarms(String user, Date timestamp, int[] alarmIds); @Transactional void acknowledgeMatchingAlarms(String user, Date timestamp, AlarmCriteria criteria); @Transactional void clearAlarms(int[] alarmIds, String user, Date timestamp); @Transactional int countMatchingAlarms(AlarmCriteria criteria); @Transactional int[] countMatchingAlarmsBySeverity(final AlarmCriteria criteria); @Transactional void escalateAlarms(int[] alarmIds, String user, Date timestamp); @Transactional Alarm getAlarm(int alarmId); @Transactional Alarm[] getMatchingAlarms(AlarmCriteria criteria); @Transactional void unacknowledgeAll(String user); @Transactional void unacknowledgeMatchingAlarms(AlarmCriteria criteria, String user); @Transactional void acknowledgeAlarms(int[] alarmIds, String user, Date timestamp); @Transactional void unacknowledgeAlarms(int[] alarmIds, String user); @Override @Transactional void updateStickyMemo(Integer alarmId, String body, String user); @Override @Transactional void updateReductionKeyMemo(Integer alarmId, String body, String user); @Override @Transactional void removeStickyMemo(Integer alarmId); @Override @Transactional void removeReductionKeyMemo(int alarmId); @Override @Transactional List<OnmsAcknowledgment> getAcknowledgments(int alarmId); @Override @Transactional List<AlarmSummary> getCurrentNodeAlarmSummaries();  }