@Test public void testGlobalTargetAssociatedWithNewGroup() throws Exception { AlertTargetEntity target1 = m_helper.createGlobalAlertTarget(); AlertTargetEntity target2 = m_helper.createGlobalAlertTarget(); assertTrue(target1.isGlobal()); assertTrue(target2.isGlobal()); AlertGroupEntity group = m_helper.createAlertGroup( m_cluster.getClusterId(), null); group = m_dao.findGroupById(group.getGroupId()); assertNotNull(group); assertEquals(2, group.getAlertTargets().size()); Iterator<AlertTargetEntity> iterator = group.getAlertTargets().iterator(); AlertTargetEntity groupTarget1 = iterator.next(); AlertTargetEntity groupTarget2 = iterator.next(); assertTrue(groupTarget1.isGlobal()); assertTrue(groupTarget2.isGlobal()); }
@RequiresSession public AlertGroupEntity findGroupById(long groupId) { return entityManagerProvider.get().find(AlertGroupEntity.class, groupId); }
AlertDispatchDAO { @RequiresSession public AlertGroupEntity findGroupById(long groupId) { return entityManagerProvider.get().find(AlertGroupEntity.class, groupId); } }
AlertDispatchDAO { @RequiresSession public AlertGroupEntity findGroupById(long groupId) { return entityManagerProvider.get().find(AlertGroupEntity.class, groupId); }  }
AlertDispatchDAO { @RequiresSession public AlertGroupEntity findGroupById(long groupId) { return entityManagerProvider.get().find(AlertGroupEntity.class, groupId); }  @RequiresSession AlertGroupEntity findGroupById(long groupId); @RequiresSession List<AlertGroupEntity> findGroupsById(List<Long> groupIds); @RequiresSession AlertTargetEntity findTargetById(long targetId); @RequiresSession List<AlertTargetEntity> findTargetsById(List<Long> targetIds); @RequiresSession AlertNoticeEntity findNoticeById(long noticeId); @RequiresSession AlertNoticeEntity findNoticeByUuid(String uuid); @RequiresSession List<AlertNoticeEntity> findPendingNotices(); @RequiresSession AlertGroupEntity findGroupByName(long clusterId, String groupName); @RequiresSession AlertTargetEntity findTargetByName(String targetName); @RequiresSession List<AlertGroupEntity> findAllGroups(); @RequiresSession List<AlertGroupEntity> findAllGroups(long clusterId); @RequiresSession List<AlertTargetEntity> findAllTargets(); @RequiresSession List<AlertTargetEntity> findAllGlobalTargets(); @RequiresSession List<AlertGroupEntity> findGroupsByDefinition(
      AlertDefinitionEntity definitionEntity); @RequiresSession AlertGroupEntity findDefaultServiceGroup(long clusterId,
      String serviceName); @RequiresSession List<AlertNoticeEntity> findAllNotices(); @RequiresSession List<AlertNoticeEntity> findAllNotices(AlertNoticeRequest request); @RequiresSession int getNoticesCount(Predicate predicate); @Transactional void createGroups(List<AlertGroupEntity> entities); @Transactional void create(AlertGroupEntity group); @Transactional AlertGroupEntity createDefaultGroup(long clusterId, String serviceName); @Transactional void refresh(AlertGroupEntity alertGroup); @Transactional AlertGroupEntity merge(AlertGroupEntity alertGroup); @Transactional void remove(AlertGroupEntity alertGroup); @Transactional void removeAllGroups(long clusterId); @Transactional void createTargets(List<AlertTargetEntity> entities); @Transactional List<AlertNoticeEntity> createNotices(List<AlertNoticeEntity> entities); @Transactional void create(AlertTargetEntity alertTarget); @Transactional void refresh(AlertTargetEntity alertTarget); @Transactional AlertTargetEntity merge(AlertTargetEntity alertTarget); @Transactional void remove(AlertTargetEntity alertTarget); @Transactional void create(AlertNoticeEntity alertNotice); @Transactional void refresh(AlertNoticeEntity alertNotice); @Transactional AlertNoticeEntity merge(AlertNoticeEntity alertNotice); @Transactional void remove(AlertNoticeEntity alertNotice); @Transactional void removeNoticeByDefinitionId(long definitionId); }
AlertDispatchDAO { @RequiresSession public AlertGroupEntity findGroupById(long groupId) { return entityManagerProvider.get().find(AlertGroupEntity.class, groupId); }  @RequiresSession AlertGroupEntity findGroupById(long groupId); @RequiresSession List<AlertGroupEntity> findGroupsById(List<Long> groupIds); @RequiresSession AlertTargetEntity findTargetById(long targetId); @RequiresSession List<AlertTargetEntity> findTargetsById(List<Long> targetIds); @RequiresSession AlertNoticeEntity findNoticeById(long noticeId); @RequiresSession AlertNoticeEntity findNoticeByUuid(String uuid); @RequiresSession List<AlertNoticeEntity> findPendingNotices(); @RequiresSession AlertGroupEntity findGroupByName(long clusterId, String groupName); @RequiresSession AlertTargetEntity findTargetByName(String targetName); @RequiresSession List<AlertGroupEntity> findAllGroups(); @RequiresSession List<AlertGroupEntity> findAllGroups(long clusterId); @RequiresSession List<AlertTargetEntity> findAllTargets(); @RequiresSession List<AlertTargetEntity> findAllGlobalTargets(); @RequiresSession List<AlertGroupEntity> findGroupsByDefinition(
      AlertDefinitionEntity definitionEntity); @RequiresSession AlertGroupEntity findDefaultServiceGroup(long clusterId,
      String serviceName); @RequiresSession List<AlertNoticeEntity> findAllNotices(); @RequiresSession List<AlertNoticeEntity> findAllNotices(AlertNoticeRequest request); @RequiresSession int getNoticesCount(Predicate predicate); @Transactional void createGroups(List<AlertGroupEntity> entities); @Transactional void create(AlertGroupEntity group); @Transactional AlertGroupEntity createDefaultGroup(long clusterId, String serviceName); @Transactional void refresh(AlertGroupEntity alertGroup); @Transactional AlertGroupEntity merge(AlertGroupEntity alertGroup); @Transactional void remove(AlertGroupEntity alertGroup); @Transactional void removeAllGroups(long clusterId); @Transactional void createTargets(List<AlertTargetEntity> entities); @Transactional List<AlertNoticeEntity> createNotices(List<AlertNoticeEntity> entities); @Transactional void create(AlertTargetEntity alertTarget); @Transactional void refresh(AlertTargetEntity alertTarget); @Transactional AlertTargetEntity merge(AlertTargetEntity alertTarget); @Transactional void remove(AlertTargetEntity alertTarget); @Transactional void create(AlertNoticeEntity alertNotice); @Transactional void refresh(AlertNoticeEntity alertNotice); @Transactional AlertNoticeEntity merge(AlertNoticeEntity alertNotice); @Transactional void remove(AlertNoticeEntity alertNotice); @Transactional void removeNoticeByDefinitionId(long definitionId);  }