public AlertDefinition coerce(AlertDefinitionEntity entity) {
    if (null == entity) {
      return null;
    }

    AlertDefinition definition = new AlertDefinition();
    definition.setClusterId(entity.getClusterId());
    definition.setDefinitionId(entity.getDefinitionId());
    definition.setComponentName(entity.getComponentName());
    definition.setEnabled(entity.getEnabled());
    definition.setHostIgnored(entity.isHostIgnored());
    definition.setInterval(entity.getScheduleInterval());
    definition.setName(entity.getDefinitionName());
    definition.setScope(entity.getScope());
    definition.setServiceName(entity.getServiceName());
    definition.setLabel(entity.getLabel());
    definition.setHelpURL(entity.getHelpURL());
    definition.setDescription(entity.getDescription());
    definition.setUuid(entity.getHash());
    definition.setRepeatTolerance(entity.getRepeatTolerance());
    definition.setRepeatToleranceEnabled(entity.isRepeatToleranceEnabled());

    try{
      String sourceJson = entity.getSource();
      Source source = m_gson.fromJson(sourceJson, Source.class);
      definition.setSource(source);
    } catch (Exception exception) {
      LOG.error("Alert defintion is invalid for  Id : " + entity.getDefinitionId() + " Name: "+  entity.getDefinitionName() );
      LOG.error(
          "Unable to deserialize the alert definition source during coercion",
          exception);

      return null;
    }

    return definition;
  }
Gets an {@link AlertDefinition} constructed from the specified
{@link AlertDefinitionEntity}.

@param entity
         the entity to use to construct the {@link AlertDefinition} (not
         {@code null}).
@return the definiion or {@code null} if it could not be coerced.
ambari-server/src/main/java/org/apache/ambari/server/state/alert/AlertDefinitionFactory.java