private Map<Resource.Type, String> getKeyValueMap(Resource resource,
                                                    Map<Resource.Type, String> keyValueMap) {
    Map<Resource.Type, String> resourceKeyValueMap = new HashMap<>(keyValueMap.size());
    for (Map.Entry<Resource.Type, String> resourceIdEntry : keyValueMap.entrySet()) {
      Resource.Type type = resourceIdEntry.getKey();
      String value = resourceIdEntry.getValue();

      if (value == null) {
        Object o = resource.getPropertyValue(clusterController.getSchema(type).getKeyPropertyId(type));
        value = o == null ? null : o.toString();
      }
      if (value != null) {
        resourceKeyValueMap.put(type, value);
      }
    }
    Schema schema = clusterController.getSchema(resource.getType());
    Set<Resource.Type> types = schema.getKeyTypes();

    for (Resource.Type type : types) {
      String resourceKeyProp = schema.getKeyPropertyId(type);
      Object resourceValue = resource.getPropertyValue(resourceKeyProp);
      if (null != resourceValue) {
        resourceKeyValueMap.put(type, resourceValue.toString());
      }
    }
    return resourceKeyValueMap;
  }
Merge the tree of query properties returned by the renderer with properties in
the query tree.

@param node   property tree node
@param query  query associated with the property tree node
ambari-server/src/main/java/org/apache/ambari/server/api/query/QueryImpl.java