@Transactional
  public AlertDefinitionEntity merge(AlertDefinitionEntity alertDefinition) {
    AlertDefinitionEntity entity = entityManagerProvider.get().merge(alertDefinition);

    AlertDefinition definition = alertDefinitionFactory.coerce(entity);

    AlertDefinitionChangedEvent event = new AlertDefinitionChangedEvent(
        alertDefinition.getClusterId(), definition);

    eventPublisher.publish(event);

    return entity;
  }
Merge the speicified alert definition with the existing definition in the
database. Fires an {@link AlertDefinitionChangedEvent}.

@param alertDefinition
         the definition to merge (not {@code null}).
@return the updated definition with merged content (never {@code null}).
ambari-server/src/main/java/org/apache/ambari/server/orm/dao/AlertDefinitionDAO.java