private Collection<ExportedHostGroup> processHostGroups(TreeNode<Resource> hostNode) {
    Map<ExportedHostGroup, ExportedHostGroup> mapHostGroups = new HashMap<>();
    int count = 1;
    for (TreeNode<Resource> host : hostNode.getChildren()) {
      ExportedHostGroup group = new ExportedHostGroup(host);
      String hostName = (String) host.getObject().getPropertyValue(
          PropertyHelper.getPropertyId("Hosts", "host_name"));

      if (mapHostGroups.containsKey(group)) {
        ExportedHostGroup hostGroup = mapHostGroups.get(group);
        hostGroup.incrementCardinality();
        hostGroup.addHost(hostName);
      } else {
        mapHostGroups.put(group, group);
        group.setName("host_group_" + count++);
        group.addHost(hostName);
      }
    }

    return mapHostGroups.values();
  }
Process cluster host groups.

@param hostNode  host node

@return collection of host groups
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ExportBlueprintRequest.java