public void setAlertTargets(Set<AlertTargetEntity> alertTargets) {
    // for any existing associations, remove "this" from those associations
    if (null != this.alertTargets) {
      // make a copy to prevent ConcurrentModificiationExceptions
      Set<AlertTargetEntity> copyOfAssociatedTargets = new HashSet<>(this.alertTargets);
      for (AlertTargetEntity target : copyOfAssociatedTargets) {
        target.removeAlertGroup(this);
      }
    }

    // update all new targets to reflect "this" as an associated group
    if (null != alertTargets) {
      for (AlertTargetEntity target : alertTargets) {
        target.addAlertGroup(this);
      }
    }

    // update reference
    this.alertTargets = alertTargets;
  }
Sets all of the targets that will receive notifications for alert
definitions in this group.

@param alertTargets
         the targets, or {@code null} if there are none.
ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertGroupEntity.java