public static List<HostComponentSummary> getHostComponentSummaries(String serviceName, String componentName) {
    List<HostComponentSummary> hostComponentSummaries = new ArrayList<>();
    List<HostComponentStateEntity> hostComponentStates = hostComponentStateDao.findByServiceAndComponent(serviceName, componentName);

    if (hostComponentStates != null) {
      for (HostComponentStateEntity hcse : hostComponentStates) {
        // Find the corresponding record for HostComponentDesiredStateEntity
        HostComponentDesiredStateEntity hcdse = hostComponentDesiredStateDao.findByServiceComponentAndHost(hcse.getServiceName(), hcse.getComponentName(), hcse.getHostName());
        if (hcdse != null) {
          HostComponentSummary s = new HostComponentSummary(hcse.getServiceName(), hcse.getComponentName(), hcse.getHostId(), hcdse.getDesiredState(), hcse.getCurrentState());

          hostComponentSummaries.add(s);
        }
      }
    }
    return hostComponentSummaries;
  }
The {@link HostComponentSum1mary} class provides a concise representation of
the state of a component on a given host. Some of its fields are serializable
to JSON.
ambari-server/src/main/java/org/apache/ambari/server/orm/models/HostComponentSummary.java