protected Set<RecommendationResponse.ConfigGroup> calculateConfigGroups(Request request) {

    Set<RecommendationResponse.ConfigGroup> configGroups =
      new HashSet<>();

    Set<HashMap<String, Object>> configGroupsProperties =
      (HashSet<HashMap<String, Object>>) getRequestProperty(request, CONFIG_GROUPS_PROPERTY);
    if (configGroupsProperties != null) {
      for (HashMap<String, Object> props : configGroupsProperties) {
        RecommendationResponse.ConfigGroup configGroup = new RecommendationResponse.ConfigGroup();
        configGroup.setHosts((List<String>) props.get(CONFIG_GROUPS_HOSTS_PROPERTY));

        for (Map<String, String> property : (Set<Map<String, String>>) props.get(CONFIG_GROUPS_CONFIGURATIONS_PROPERTY)) {
          for (Map.Entry<String, String> entry : property.entrySet()) {
            String[] propertyPath = entry.getKey().split("/"); // length == 3
            String siteName = propertyPath[0];
            String propertyName = propertyPath[2];

            if (!configGroup.getConfigurations().containsKey(siteName)) {
              RecommendationResponse.BlueprintConfigurations configurations =
                new RecommendationResponse.BlueprintConfigurations();
              configGroup.getConfigurations().put(siteName, configurations);
              configGroup.getConfigurations().get(siteName).setProperties(new HashMap<>());
            }
            configGroup.getConfigurations().get(siteName).getProperties().put(propertyName, entry.getValue());
          }
        }
        configGroups.add(configGroup);
      }
    }

    return configGroups;
  }
Retrieves hosts names mapped by host groups, host name is used as host group identifier
@param cluster cluster for calculating hosts mapping by host groups
@return map "host group name" -> ["host name 1"]
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackAdvisorResourceProvider.java