private Result getResult(Resource parentResource)
      throws UnsupportedPropertyException, SystemException, NoSuchResourceException, NoSuchParentResourceException {

    Result result = new ResultImpl(true);
    Resource.Type resourceType = getResourceDefinition().getType();
    TreeNode<Resource> tree = result.getResultTree();

    if (isCollectionResource()) {
      tree.setProperty("isCollection", "true");
    }

    QueryResult queryResult = queryResults.get(parentResource);

    if (queryResult != null) {
      Predicate queryPredicate     = queryResult.getPredicate();
      Predicate queryUserPredicate = queryResult.getUserPredicate();
      Request   queryRequest       = queryResult.getRequest();

      QueryResponse queryResponse = queryResult.getQueryResponse();

      if (hasSubResourcePredicate() && queryUserPredicate != null) {
        queryPredicate = getExtendedPredicate(parentResource, queryUserPredicate);
      }

      Iterable<Resource> iterResource;

      if (pageRequest == null) {
        iterResource = clusterController.getIterable(
          resourceType, queryResponse, queryRequest, queryPredicate,
          null, sortRequest
        );
      } else {
        PageResponse pageResponse = clusterController.getPage(
          resourceType, queryResponse, queryRequest, queryPredicate,
          pageRequest, sortRequest
        );
        iterResource = pageResponse.getIterable();
        tree.setProperty("count", pageResponse.getTotalResourceCount().toString());
      }

      int count = 1;
      for (Resource resource : iterResource) {

        // add a child node for the resource and provide a unique name.  The name is never used.
        TreeNode<Resource> node = tree.addChild(
            resource, resource.getType() + ":" + count++);

        for (Map.Entry<String, QueryImpl> entry : requestedSubResources.entrySet()) {
          String    subResCategory = entry.getKey();
          QueryImpl subResource    = entry.getValue();

          TreeNode<Resource> childResult = subResource.getResult(resource).getResultTree();
          childResult.setName(subResCategory);
          childResult.setProperty("isCollection", "false");
          node.addChild(childResult);
        }
      }
    }
    return renderer.finalizeResult(result);
  }
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