private AlertNotification buildNotificationFromTarget(AlertTargetEntity target) {
    String propertiesJson = target.getProperties();

    AlertTargetProperties targetProperties = m_gson.fromJson(propertiesJson,
        AlertTargetProperties.class);

    Map<String, String> properties = targetProperties.Properties;

    // create an initialize the notification
    AlertNotification notification = new AlertNotification();
    notification.Callback = new AlertNoticeDispatchCallback();
    notification.DispatchProperties = properties;

    // set dispatch credentials
    if (properties.containsKey(AMBARI_DISPATCH_CREDENTIAL_USERNAME)
        && properties.containsKey(AMBARI_DISPATCH_CREDENTIAL_PASSWORD)) {
      DispatchCredentials credentials = new DispatchCredentials();
      credentials.UserName = properties.get(AMBARI_DISPATCH_CREDENTIAL_USERNAME);
      credentials.Password = properties.get(AMBARI_DISPATCH_CREDENTIAL_PASSWORD);
      notification.Credentials = credentials;
    }

    // create recipients
    if (null != targetProperties.Recipients) {
      List<Recipient> recipients = new ArrayList<>(
        targetProperties.Recipients.size());

      for (String stringRecipient : targetProperties.Recipients) {
        Recipient recipient = new Recipient();
        recipient.Identifier = stringRecipient;
        recipients.add(recipient);
      }

      notification.Recipients = recipients;
    }

    return notification;
  }
Initializes a {@link Notification} instance from an
{@link AlertTargetEntity}. This method does most of the boilerplate work to
get a {@link Notification} that is almost ready to send.
<p/>
The {@link Notification} will not have any of the callback IDs or content
set.

@param target
         the alert target
@return the initialized notification
ambari-server/src/main/java/org/apache/ambari/server/state/services/AlertNoticeDispatchService.java