private void queryForSubResources()
      throws UnsupportedPropertyException,
      SystemException,
      NoSuchResourceException,
      NoSuchParentResourceException {

    for (Map.Entry<String, QueryImpl> entry : requestedSubResources.entrySet()) {
      QueryImpl     subResource         = entry.getValue();
      Resource.Type resourceType        = subResource.getResourceDefinition().getType();
      Request       request             = subResource.createRequest();
      Set<Resource> providerResourceSet = new HashSet<>();

      for (QueryResult queryResult : populatedQueryResults.values()) {
        for (Resource resource : queryResult.getQueryResponse().getResources()) {
          Map<Resource.Type, String> map = getKeyValueMap(resource, queryResult.getKeyValueMap());

          Predicate     queryPredicate = subResource.createPredicate(map, subResource.processedPredicate);
          Set<Resource> resourceSet    = new LinkedHashSet<>();

          try {
            Set<Resource> queryResources =
                subResource.doQuery(resourceType, request, queryPredicate, false).getResources();

            providerResourceSet.addAll(queryResources);
            resourceSet.addAll(queryResources);
          } catch (NoSuchResourceException e) {
            // do nothing ...
          } catch (AuthorizationException e) {
            // do nothing, since the user does not have access to the data ...
            LOG.debug("User does not have authorization to get {} resources. The data will not be added to the response.", resourceType.name());
          }
          subResource.queryResults.put(resource,
              new QueryResult(request, queryPredicate, subResourcePredicate, map, new QueryResponseImpl(resourceSet)));
          subResource.populatedQueryResults.put(resource,
            new QueryResult(request, queryPredicate, subResourcePredicate, map, new QueryResponseImpl(resourceSet)));
        }
      }

      if (renderer.requiresPropertyProviderInput()) {
        clusterController.populateResources(resourceType, providerResourceSet, request, subResourcePredicate);
      }

      subResource.queryForSubResources();
    }
  }
Query the cluster controller for the sub-resources associated with
this query object.
ambari-server/src/main/java/org/apache/ambari/server/api/query/QueryImpl.java