@Test @Transactional @JUnitTemporaryDatabase public void testSortAndSearchBySameProperty() { Filter[] filters = new Filter[] { new NodeNameLikeFilter("node") }; AlarmCriteria sorted = new AlarmCriteria(filters, SortStyle.NODE, AcknowledgeType.UNACKNOWLEDGED, 100, 0); Alarm[] alarms = m_alarmRepo.getMatchingAlarms(sorted); assertTrue("Failed to sort with style "+SortStyle.NODE, alarms.length > 0); }
@Transactional public Alarm[] getMatchingAlarms(AlarmCriteria criteria) { List<Alarm> alarms = new ArrayList<Alarm>(); List<OnmsAlarm> onmsAlarms = m_alarmDao.findMatching(getOnmsCriteria(criteria)); for (OnmsAlarm onmsAlarm : onmsAlarms) { alarms.add(mapOnmsAlarmToAlarm(onmsAlarm)); } return alarms.toArray(new Alarm[0]); }
DaoWebAlarmRepository implements WebAlarmRepository, InitializingBean { @Transactional public Alarm[] getMatchingAlarms(AlarmCriteria criteria) { List<Alarm> alarms = new ArrayList<Alarm>(); List<OnmsAlarm> onmsAlarms = m_alarmDao.findMatching(getOnmsCriteria(criteria)); for (OnmsAlarm onmsAlarm : onmsAlarms) { alarms.add(mapOnmsAlarmToAlarm(onmsAlarm)); } return alarms.toArray(new Alarm[0]); } }
DaoWebAlarmRepository implements WebAlarmRepository, InitializingBean { @Transactional public Alarm[] getMatchingAlarms(AlarmCriteria criteria) { List<Alarm> alarms = new ArrayList<Alarm>(); List<OnmsAlarm> onmsAlarms = m_alarmDao.findMatching(getOnmsCriteria(criteria)); for (OnmsAlarm onmsAlarm : onmsAlarms) { alarms.add(mapOnmsAlarmToAlarm(onmsAlarm)); } return alarms.toArray(new Alarm[0]); }  }
DaoWebAlarmRepository implements WebAlarmRepository, InitializingBean { @Transactional public Alarm[] getMatchingAlarms(AlarmCriteria criteria) { List<Alarm> alarms = new ArrayList<Alarm>(); List<OnmsAlarm> onmsAlarms = m_alarmDao.findMatching(getOnmsCriteria(criteria)); for (OnmsAlarm onmsAlarm : onmsAlarms) { alarms.add(mapOnmsAlarmToAlarm(onmsAlarm)); } return alarms.toArray(new Alarm[0]); }  @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 Alarm[] getMatchingAlarms(AlarmCriteria criteria) { List<Alarm> alarms = new ArrayList<Alarm>(); List<OnmsAlarm> onmsAlarms = m_alarmDao.findMatching(getOnmsCriteria(criteria)); for (OnmsAlarm onmsAlarm : onmsAlarms) { alarms.add(mapOnmsAlarmToAlarm(onmsAlarm)); } return alarms.toArray(new Alarm[0]); }  @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();  }