@Transactional
  public void create(AlertTargetEntity alertTarget) {
    entityManagerProvider.get().persist(alertTarget);

    if (alertTarget.isGlobal()) {
      List<AlertGroupEntity> groups = findAllGroups();
      for (AlertGroupEntity group : groups) {
        group.addAlertTarget(alertTarget);
        merge(group);
        AlertGroupsUpdateEvent alertGroupsUpdateEvent = new AlertGroupsUpdateEvent(Collections.singletonList(
            new AlertGroupUpdate(group)),
            UpdateEventType.UPDATE);
        STOMPUpdatePublisher.publish(alertGroupsUpdateEvent);
      }
    }
  }
Persists a new alert target.

@param alertTarget
         the target to persist (not {@code null}).
ambari-server/src/main/java/org/apache/ambari/server/orm/dao/AlertDispatchDAO.java