@Override
  public Set<Resource> populateResources(Set<Resource> resources,
      Request request, Predicate predicate) throws SystemException {
    Set<String> propertyIds = getRequestPropertyIds(request, predicate);

    try {
      // Optimization:
      // Some information can be determined more efficiently when requested in bulk 
      // for an entire cluster at once. 
      // For Example:
      //   (1) Cluster level alert-status counts
      //   (2) Per host alert-status counts
      // These can be determined in 1 SQL call per cluster, and results used multiple times.
      Map<Long, Map<String, AlertSummaryDTO>> perHostSummaryMap = new HashMap<>();
      Map<Long, AlertHostSummaryDTO> hostsSummaryMap = new HashMap<>();
      Map<String, Cluster> resourcesClusterMap = new HashMap<>();
      for (Resource res : resources) {
        String clusterName = (String) res.getPropertyValue(m_clusterPropertyId);
        if (clusterName == null || resourcesClusterMap.containsKey(clusterName)) {
          continue;
        }
        Cluster cluster = s_clusters.get().getCluster(clusterName);
        resourcesClusterMap.put(clusterName, cluster);
      }
      for (Cluster cluster : resourcesClusterMap.values()) {
        long clusterId = cluster.getClusterId();
        switch (m_resourceType.getInternalType()) {
          case Cluster:
            // only make the calculation if asked
            if (BaseProvider.isPropertyRequested(ALERTS_SUMMARY_HOSTS, propertyIds)) {
              hostsSummaryMap.put(clusterId, s_dao.findCurrentHostCounts(clusterId));
            }
            break;
          case Host:
            if (resources.size() > 1) {
              // More efficient to get information for all hosts in 1 call
              Map<String, AlertSummaryDTO> perHostCounts = s_dao.findCurrentPerHostCounts(clusterId);
              perHostSummaryMap.put(clusterId, perHostCounts);
            }
            break;
          default:
            break;
        }
      }

      for (Resource res : resources) {
        populateResource(res, propertyIds, perHostSummaryMap, hostsSummaryMap);
      }
    } catch (AmbariException e) {
      LOG.error("Could not load built-in alerts - Executor exception ({})",
          e.getMessage());
    }
    return resources;
  }
Constructor.

@param type
@param clusterPropertyId
@param typeIdPropertyId
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertSummaryPropertyProvider.java