@Test @Transactional @JUnitTemporaryDatabase public void testCountMatchingAlarmsBySeverity(){ AlarmCriteria criteria = new AlarmCriteria(); int [] matchingAlarms = m_alarmRepo.countMatchingAlarmsBySeverity(criteria); assertEquals(8, matchingAlarms.length); assertEquals(0, matchingAlarms[OnmsSeverity.CLEARED.getId()]); assertEquals(0, matchingAlarms[OnmsSeverity.CRITICAL.getId()]); assertEquals(0, matchingAlarms[OnmsSeverity.INDETERMINATE.getId()]); assertEquals(0, matchingAlarms[OnmsSeverity.MINOR.getId()]); assertEquals(1, matchingAlarms[OnmsSeverity.NORMAL.getId()]); assertEquals(0, matchingAlarms[OnmsSeverity.WARNING.getId()]); assertEquals(0, matchingAlarms[OnmsSeverity.MAJOR.getId()]); }
@Transactional public int[] countMatchingAlarmsBySeverity(final AlarmCriteria criteria) { final int[] alarmCounts = new int[8]; for (final OnmsSeverity value : OnmsSeverity.values()) { alarmCounts[value.getId()] = m_alarmDao.countMatching(getOnmsCriteria(criteria).add(Restrictions.eq("severity", value))); } return alarmCounts; }
DaoWebAlarmRepository implements WebAlarmRepository, InitializingBean { @Transactional public int[] countMatchingAlarmsBySeverity(final AlarmCriteria criteria) { final int[] alarmCounts = new int[8]; for (final OnmsSeverity value : OnmsSeverity.values()) { alarmCounts[value.getId()] = m_alarmDao.countMatching(getOnmsCriteria(criteria).add(Restrictions.eq("severity", value))); } return alarmCounts; } }
DaoWebAlarmRepository implements WebAlarmRepository, InitializingBean { @Transactional public int[] countMatchingAlarmsBySeverity(final AlarmCriteria criteria) { final int[] alarmCounts = new int[8]; for (final OnmsSeverity value : OnmsSeverity.values()) { alarmCounts[value.getId()] = m_alarmDao.countMatching(getOnmsCriteria(criteria).add(Restrictions.eq("severity", value))); } return alarmCounts; }  }
DaoWebAlarmRepository implements WebAlarmRepository, InitializingBean { @Transactional public int[] countMatchingAlarmsBySeverity(final AlarmCriteria criteria) { final int[] alarmCounts = new int[8]; for (final OnmsSeverity value : OnmsSeverity.values()) { alarmCounts[value.getId()] = m_alarmDao.countMatching(getOnmsCriteria(criteria).add(Restrictions.eq("severity", value))); } return alarmCounts; }  @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 int[] countMatchingAlarmsBySeverity(final AlarmCriteria criteria) { final int[] alarmCounts = new int[8]; for (final OnmsSeverity value : OnmsSeverity.values()) { alarmCounts[value.getId()] = m_alarmDao.countMatching(getOnmsCriteria(criteria).add(Restrictions.eq("severity", value))); } return alarmCounts; }  @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();  }