private Resource toResource(AlertHistoryEntity entity,
      Set<String> requestedIds) {
    AlertDefinitionEntity definition = entity.getAlertDefinition();
    ClusterEntity cluster = definition.getCluster();

    Resource resource = new ResourceImpl(Resource.Type.AlertHistory);
    resource.setProperty(ALERT_HISTORY_ID, entity.getAlertId());

    if (null != cluster) {
      setResourceProperty(resource, ALERT_HISTORY_CLUSTER_NAME,
          cluster.getClusterName(), requestedIds);
    }

    setResourceProperty(resource, ALERT_HISTORY_DEFINITION_ID, definition.getDefinitionId(), requestedIds);
    setResourceProperty(resource, ALERT_HISTORY_DEFINITION_NAME, definition.getDefinitionName(), requestedIds);
    setResourceProperty(resource, ALERT_HISTORY_SERVICE_NAME, entity.getServiceName(), requestedIds);
    setResourceProperty(resource, ALERT_HISTORY_COMPONENT_NAME, entity.getComponentName(), requestedIds);
    setResourceProperty(resource, ALERT_HISTORY_HOSTNAME, entity.getHostName(), requestedIds);
    setResourceProperty(resource, ALERT_HISTORY_LABEL, entity.getAlertLabel(), requestedIds);
    setResourceProperty(resource, ALERT_HISTORY_STATE, entity.getAlertState(), requestedIds);
    setResourceProperty(resource, ALERT_HISTORY_TEXT, entity.getAlertText(), requestedIds);
    setResourceProperty(resource, ALERT_HISTORY_TIMESTAMP, entity.getAlertTimestamp(), requestedIds);
    setResourceProperty(resource, ALERT_HISTORY_INSTANCE, entity.getAlertInstance(), requestedIds);

    return resource;
  }
Converts the {@link AlertHistoryEntity} to a {@link Resource}.

@param entity
         the entity to convert (not {@code null}).
@param requestedIds
         the properties requested (not {@code null}).
@return the new {@link Resource}
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertHistoryResourceProvider.java