@Test public void testFindByDate() { calendar.clear(); calendar.set(2014, Calendar.JANUARY, 1); List<AlertHistoryEntity> history = m_dao.findAll(m_cluster.getClusterId(), calendar.getTime(), null); assertNotNull(history); assertEquals(50, history.size()); history = m_dao.findAll(m_cluster.getClusterId(), null, calendar.getTime()); assertNotNull(history); assertEquals(1, history.size()); calendar.set(2014, Calendar.JANUARY, 5); Date startDate = calendar.getTime(); calendar.set(2014, Calendar.JANUARY, 10); Date endDate = calendar.getTime(); history = m_dao.findAll(m_cluster.getClusterId(), startDate, endDate); assertNotNull(history); assertEquals(6, history.size()); calendar.set(2014, Calendar.MARCH, 5); history = m_dao.findAll(m_cluster.getClusterId(), calendar.getTime(), null); assertNotNull(history); assertEquals(0, history.size()); history = m_dao.findAll(m_cluster.getClusterId(), endDate, startDate); assertNotNull(history); assertEquals(0, history.size()); }
@RequiresSession public List<AlertHistoryEntity> findAll() { TypedQuery<AlertHistoryEntity> query = m_entityManagerProvider.get().createNamedQuery( "AlertHistoryEntity.findAll", AlertHistoryEntity.class); return m_daoUtils.selectList(query); }
AlertsDAO implements Cleanable { @RequiresSession public List<AlertHistoryEntity> findAll() { TypedQuery<AlertHistoryEntity> query = m_entityManagerProvider.get().createNamedQuery( "AlertHistoryEntity.findAll", AlertHistoryEntity.class); return m_daoUtils.selectList(query); } }
AlertsDAO implements Cleanable { @RequiresSession public List<AlertHistoryEntity> findAll() { TypedQuery<AlertHistoryEntity> query = m_entityManagerProvider.get().createNamedQuery( "AlertHistoryEntity.findAll", AlertHistoryEntity.class); return m_daoUtils.selectList(query); } @Inject  AlertsDAO(Configuration configuration); }
AlertsDAO implements Cleanable { @RequiresSession public List<AlertHistoryEntity> findAll() { TypedQuery<AlertHistoryEntity> query = m_entityManagerProvider.get().createNamedQuery( "AlertHistoryEntity.findAll", AlertHistoryEntity.class); return m_daoUtils.selectList(query); } @Inject  AlertsDAO(Configuration configuration); @RequiresSession AlertHistoryEntity findById(long alertId); @RequiresSession List<AlertHistoryEntity> findAll(); @RequiresSession List<AlertHistoryEntity> findAll(long clusterId); @RequiresSession List<AlertHistoryEntity> findAll(long clusterId,
      List<AlertState> alertStates); @RequiresSession List<AlertHistoryEntity> findAll(long clusterId, Date startDate,
      Date endDate); @RequiresSession List<AlertHistoryEntity> findAll(AlertHistoryRequest request); @Transactional List<AlertCurrentEntity> findAll(AlertCurrentRequest request); int getCount(Predicate predicate); @RequiresSession List<AlertCurrentEntity> findCurrent(); @RequiresSession AlertCurrentEntity findCurrentById(long alertId); @RequiresSession List<AlertCurrentEntity> findCurrentByDefinitionId(long definitionId); @RequiresSession List<AlertCurrentEntity> findCurrentByCluster(long clusterId); @RequiresSession AlertSummaryDTO findCurrentCounts(long clusterId, String serviceName, String hostName); @RequiresSession Map<String, AlertSummaryDTO> findCurrentPerHostCounts(long clusterId); @RequiresSession AlertHostSummaryDTO findCurrentHostCounts(long clusterId); @RequiresSession List<AlertCurrentEntity> findCurrentByService(long clusterId,
      String serviceName); AlertCurrentEntity findCurrentByHostAndName(long clusterId, String hostName,
      String alertName); @Transactional void removeByDefinitionId(long definitionId); @Transactional int removeCurrentByHistoryId(long historyId); @Transactional int removeCurrentDisabledAlerts(); @Transactional int removeCurrentByService(long clusterId, String serviceName); @Transactional int removeCurrentByHost(String hostName); @Transactional int removeCurrentByServiceComponentHost(long clusterId, String serviceName,
      String componentName, String hostName); @Transactional void create(AlertHistoryEntity alert); @Transactional void refresh(AlertHistoryEntity alert); @Transactional AlertHistoryEntity merge(AlertHistoryEntity alert); @Transactional void remove(AlertHistoryEntity alert); @Transactional void create(AlertCurrentEntity alert); @Transactional void refresh(AlertCurrentEntity alert); @Transactional AlertCurrentEntity merge(AlertCurrentEntity alert); AlertCurrentEntity merge(AlertCurrentEntity alert, boolean updateCacheOnly); @Transactional void remove(AlertCurrentEntity alert); @RequiresSession AlertSummaryDTO findAggregateCounts(long clusterId, String alertName); AlertCurrentEntity findCurrentByNameNoHost(long clusterId, String alertName); @Transactional void flushCachedEntitiesToJPA(); @Transactional @Override long cleanup(TimeBasedCleanupPolicy policy); }
AlertsDAO implements Cleanable { @RequiresSession public List<AlertHistoryEntity> findAll() { TypedQuery<AlertHistoryEntity> query = m_entityManagerProvider.get().createNamedQuery( "AlertHistoryEntity.findAll", AlertHistoryEntity.class); return m_daoUtils.selectList(query); } @Inject  AlertsDAO(Configuration configuration); @RequiresSession AlertHistoryEntity findById(long alertId); @RequiresSession List<AlertHistoryEntity> findAll(); @RequiresSession List<AlertHistoryEntity> findAll(long clusterId); @RequiresSession List<AlertHistoryEntity> findAll(long clusterId,
      List<AlertState> alertStates); @RequiresSession List<AlertHistoryEntity> findAll(long clusterId, Date startDate,
      Date endDate); @RequiresSession List<AlertHistoryEntity> findAll(AlertHistoryRequest request); @Transactional List<AlertCurrentEntity> findAll(AlertCurrentRequest request); int getCount(Predicate predicate); @RequiresSession List<AlertCurrentEntity> findCurrent(); @RequiresSession AlertCurrentEntity findCurrentById(long alertId); @RequiresSession List<AlertCurrentEntity> findCurrentByDefinitionId(long definitionId); @RequiresSession List<AlertCurrentEntity> findCurrentByCluster(long clusterId); @RequiresSession AlertSummaryDTO findCurrentCounts(long clusterId, String serviceName, String hostName); @RequiresSession Map<String, AlertSummaryDTO> findCurrentPerHostCounts(long clusterId); @RequiresSession AlertHostSummaryDTO findCurrentHostCounts(long clusterId); @RequiresSession List<AlertCurrentEntity> findCurrentByService(long clusterId,
      String serviceName); AlertCurrentEntity findCurrentByHostAndName(long clusterId, String hostName,
      String alertName); @Transactional void removeByDefinitionId(long definitionId); @Transactional int removeCurrentByHistoryId(long historyId); @Transactional int removeCurrentDisabledAlerts(); @Transactional int removeCurrentByService(long clusterId, String serviceName); @Transactional int removeCurrentByHost(String hostName); @Transactional int removeCurrentByServiceComponentHost(long clusterId, String serviceName,
      String componentName, String hostName); @Transactional void create(AlertHistoryEntity alert); @Transactional void refresh(AlertHistoryEntity alert); @Transactional AlertHistoryEntity merge(AlertHistoryEntity alert); @Transactional void remove(AlertHistoryEntity alert); @Transactional void create(AlertCurrentEntity alert); @Transactional void refresh(AlertCurrentEntity alert); @Transactional AlertCurrentEntity merge(AlertCurrentEntity alert); AlertCurrentEntity merge(AlertCurrentEntity alert, boolean updateCacheOnly); @Transactional void remove(AlertCurrentEntity alert); @RequiresSession AlertSummaryDTO findAggregateCounts(long clusterId, String alertName); AlertCurrentEntity findCurrentByNameNoHost(long clusterId, String alertName); @Transactional void flushCachedEntitiesToJPA(); @Transactional @Override long cleanup(TimeBasedCleanupPolicy policy);  }