private void populateConfigurations(ObjectNode root,
                                      StackAdvisorRequest request) {
    Map<String, Map<String, Map<String, String>>> configurations =
        request.getConfigurations();
    ObjectNode configurationsNode = root.putObject(CONFIGURATIONS_PROPERTY);
    for (String siteName : configurations.keySet()) {
      ObjectNode siteNode = configurationsNode.putObject(siteName);

      Map<String, Map<String, String>> siteMap = configurations.get(siteName);
      for (String properties : siteMap.keySet()) {
        ObjectNode propertiesNode = siteNode.putObject(properties);

        Map<String, String> propertiesMap = siteMap.get(properties);
        for (String propertyName : propertiesMap.keySet()) {
          String propertyValue = propertiesMap.get(propertyName);
          propertiesNode.put(propertyName, propertyValue);
        }
      }
    }

    JsonNode changedConfigs = mapper.valueToTree(request.getChangedConfigurations());
    root.put(CHANGED_CONFIGURATIONS_PROPERTY, changedConfigs);

    JsonNode userContext = mapper.valueToTree(request.getUserContext());
    root.put(USER_CONTEXT_PROPERTY, userContext);
    root.put(GPL_LICENSE_ACCEPTED, request.getGplLicenseAccepted());
  }
Retrieves the Ambari configuration if exists and adds it to services.json

@param root The JSON document that will become service.json when passed to the stack advisor engine
ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/StackAdvisorCommand.java