private void processResultNode(TreeNode<Resource> node) {
    Resource resource = node.getObject();
    if (resource != null && ( resource.getType() != m_rootType || m_isCollection)) {
      Resource.Type type = resource.getType();
      Set<String> requestedProperties = m_originalProperties.get(type);
      Map<String, Map<String, Object>> properties = resource.getPropertiesMap();

      Iterator<Map.Entry<String, Map<String, Object>>> iter;
      for(iter = properties.entrySet().iterator(); iter.hasNext(); ) {
        Map.Entry<String, Map<String, Object>> entry = iter.next();
        String categoryName = entry.getKey();
        Iterator<String> valueIter;

        for(valueIter = entry.getValue().keySet().iterator(); valueIter.hasNext(); ) {
          String propName = valueIter.next();
          // if property was not requested and it is not a pk, remove
          String absPropertyName = PropertyHelper.getPropertyId(categoryName, propName);
          if ((requestedProperties == null ||
              (! requestedProperties.contains(absPropertyName) &&
              ! isSubCategory(requestedProperties, categoryName))) &&
              ! getPrimaryKeys(type).contains(absPropertyName)) {
            valueIter.remove();
          }
        }
        if (entry.getValue().isEmpty()) {
          iter.remove();
        }
      }
    }
    for (TreeNode<Resource> child : node.getChildren()) {
      processResultNode(child);
    }
  }
Recursively strip all unwanted properties from the result nodes.
During normal processing, foreign keys are always added to the request which need
to be stripped unless they were requested.

@param node  node to process for extra properties
ambari-server/src/main/java/org/apache/ambari/server/api/query/render/MinimalRenderer.java