@Test @Transactional public void testFilterBySeverity() { NegativeSeverityFilter filter = new NegativeSeverityFilter(OnmsSeverity.NORMAL.getId()); EventCriteria criteria = new EventCriteria(filter); Event[] events = m_daoEventRepo.getMatchingEvents(criteria); assertTrue(events.length > 0); EventCriteria sortedCriteria = new EventCriteria(new Filter[] { filter }, SortStyle.ID, AcknowledgeType.UNACKNOWLEDGED, 100, 0); Event[] sortedEvents = m_daoEventRepo.getMatchingEvents(sortedCriteria); assertTrue(sortedEvents.length > 0); }
@Transactional public Event[] getMatchingEvents(EventCriteria criteria) { List<Event> events = new ArrayList<Event>(); log().debug("getMatchingEvents: try to get events for Criteria: " + criteria.toString()); List<OnmsEvent> onmsEvents = m_eventDao.findMatching(getOnmsCriteria(criteria)); log().debug("getMatchingEvents: found " + onmsEvents.size() + " events"); if(onmsEvents.size() > 0){ Iterator<OnmsEvent> eventIt = onmsEvents.iterator(); while(eventIt.hasNext()){ events.add(mapOnmsEventToEvent(eventIt.next())); } } return events.toArray(new Event[0]); }
DaoWebEventRepository implements WebEventRepository, InitializingBean { @Transactional public Event[] getMatchingEvents(EventCriteria criteria) { List<Event> events = new ArrayList<Event>(); log().debug("getMatchingEvents: try to get events for Criteria: " + criteria.toString()); List<OnmsEvent> onmsEvents = m_eventDao.findMatching(getOnmsCriteria(criteria)); log().debug("getMatchingEvents: found " + onmsEvents.size() + " events"); if(onmsEvents.size() > 0){ Iterator<OnmsEvent> eventIt = onmsEvents.iterator(); while(eventIt.hasNext()){ events.add(mapOnmsEventToEvent(eventIt.next())); } } return events.toArray(new Event[0]); } }
DaoWebEventRepository implements WebEventRepository, InitializingBean { @Transactional public Event[] getMatchingEvents(EventCriteria criteria) { List<Event> events = new ArrayList<Event>(); log().debug("getMatchingEvents: try to get events for Criteria: " + criteria.toString()); List<OnmsEvent> onmsEvents = m_eventDao.findMatching(getOnmsCriteria(criteria)); log().debug("getMatchingEvents: found " + onmsEvents.size() + " events"); if(onmsEvents.size() > 0){ Iterator<OnmsEvent> eventIt = onmsEvents.iterator(); while(eventIt.hasNext()){ events.add(mapOnmsEventToEvent(eventIt.next())); } } return events.toArray(new Event[0]); }  }
DaoWebEventRepository implements WebEventRepository, InitializingBean { @Transactional public Event[] getMatchingEvents(EventCriteria criteria) { List<Event> events = new ArrayList<Event>(); log().debug("getMatchingEvents: try to get events for Criteria: " + criteria.toString()); List<OnmsEvent> onmsEvents = m_eventDao.findMatching(getOnmsCriteria(criteria)); log().debug("getMatchingEvents: found " + onmsEvents.size() + " events"); if(onmsEvents.size() > 0){ Iterator<OnmsEvent> eventIt = onmsEvents.iterator(); while(eventIt.hasNext()){ events.add(mapOnmsEventToEvent(eventIt.next())); } } return events.toArray(new Event[0]); }  @Override void afterPropertiesSet(); @Transactional void acknowledgeAll(String user, Date timestamp); @Transactional void acknowledgeMatchingEvents(String user, Date timestamp, EventCriteria criteria); @Transactional int countMatchingEvents(EventCriteria criteria); @Transactional int[] countMatchingEventsBySeverity(EventCriteria criteria); @Transactional Event getEvent(int eventId); @Transactional Event[] getMatchingEvents(EventCriteria criteria); @Transactional void unacknowledgeAll(); @Transactional void unacknowledgeMatchingEvents(EventCriteria criteria); }
DaoWebEventRepository implements WebEventRepository, InitializingBean { @Transactional public Event[] getMatchingEvents(EventCriteria criteria) { List<Event> events = new ArrayList<Event>(); log().debug("getMatchingEvents: try to get events for Criteria: " + criteria.toString()); List<OnmsEvent> onmsEvents = m_eventDao.findMatching(getOnmsCriteria(criteria)); log().debug("getMatchingEvents: found " + onmsEvents.size() + " events"); if(onmsEvents.size() > 0){ Iterator<OnmsEvent> eventIt = onmsEvents.iterator(); while(eventIt.hasNext()){ events.add(mapOnmsEventToEvent(eventIt.next())); } } return events.toArray(new Event[0]); }  @Override void afterPropertiesSet(); @Transactional void acknowledgeAll(String user, Date timestamp); @Transactional void acknowledgeMatchingEvents(String user, Date timestamp, EventCriteria criteria); @Transactional int countMatchingEvents(EventCriteria criteria); @Transactional int[] countMatchingEventsBySeverity(EventCriteria criteria); @Transactional Event getEvent(int eventId); @Transactional Event[] getMatchingEvents(EventCriteria criteria); @Transactional void unacknowledgeAll(); @Transactional void unacknowledgeMatchingEvents(EventCriteria criteria);  }