Method to read the query response from QueryResponse and set into QueryResult

@param queryResponse
the query response
@return queryResult
486161
protected QueryResult getQueryResult(QueryResponse queryResponse) {
        QueryResult queryResult = null;
        if (queryResponse != null) {
            queryResult = new QueryResult();
            queryResult.setEntities(getEntities(queryResponse));
            queryResult.setFault(queryResponse.getFault());
            queryResult.setMaxResults(queryResponse.getMaxResults());
            queryResult.setStartPosition(queryResponse.getStartPosition());
            queryResult.setTotalCount(queryResponse.getTotalCount());
        }

        return queryResult;
    }
36716
public static String get(String url, Map<String, String> queryParas, Map<String, String> headers) {
		HttpURLConnection conn = null;
		try {
			conn = getHttpConnection(buildUrlWithQueryString(url, queryParas), GET, headers);
			conn.connect();
			return readResponseString(conn);
		}
		catch (Exception e) {
			throw new RuntimeException(e);
		}
		finally {
			if (conn != null) {
				conn.disconnect();
			}
		}
	}
387882
private CompletableFuture<QueryResponse> query(QueryEntry entry) {
    Query.ConsistencyLevel consistency = entry.getQuery().consistency();
    if (consistency == null)
      return queryLinearizable(entry);

    switch (consistency) {
      case SEQUENTIAL:
        return queryLocal(entry);
      case LINEARIZABLE_LEASE:
        return queryBoundedLinearizable(entry);
      case LINEARIZABLE:
        return queryLinearizable(entry);
      default:
        throw new IllegalStateException("unknown consistency level");
    }
  }
1292137
@SuppressWarnings("unchecked")
    @Override
    public <T> T get(EntityGetOperation<T> getter) throws ServiceException {
        getter.setProxyData(createProxyData());
        Object rawResponse = getResource(getter).get(getter.getResponseClass());
        Object processedResponse = getter.processResponse(rawResponse);
        return (T) processedResponse;
    }
224166
func (o *GetFqdnCacheIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {

	case 200:
		result := NewGetFqdnCacheIDOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil

	case 400:
		result := NewGetFqdnCacheIDBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result

	case 404:
		result := NewGetFqdnCacheIDNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result

	default:
		return nil, runtime.NewAPIError("unknown error", response, response.Code())
	}
}
333022
def results(self, query_name):
        

        url = "{0}/{1}/result".format(self.saved_query_url, query_name)
        response = self._get_json(HTTPMethods.GET, url, self._get_read_key())

        return response
188670
public ClientResponse getPostResponse(String queryUrl, String params,
      TokenResult token, Object pFormDataObject) throws Exception {
    params = params.replace("|", "%7C");
    params = params.replace("+", "%20");  
    // modal handling of post
    FormDataMultiPart form = null;
    MultivaluedMap<String, String> lFormData = null;
    if (pFormDataObject instanceof FormDataMultiPart) {
      form = (FormDataMultiPart) pFormDataObject;
    } else {
      @SuppressWarnings("unchecked")
      Map<String, String> pFormData = (Map<String, String>) pFormDataObject;
      lFormData = new MultivaluedMapImpl();
      if (pFormData != null) {
        for (String key : pFormData.keySet()) {
          lFormData.add(key, pFormData.get(key));
        }
      }
    }
    if (token != null) {
      switch (token.tokenMode) {
      case token1_24:
        if (lFormData != null) {
          lFormData.add(token.tokenName, token.token);
        } else {
          form.field(token.tokenName, token.token);
        }
        break;
      default:
        params += token.asParam();
      }
    }
    Builder resource = getResource(queryUrl + params);
    // FIXME allow to specify content type (not needed for Mediawiki itself
    // but
    // could be good for interfacing )
    ClientResponse response = null;
    if (lFormData != null) {
      response = resource.type(MediaType.APPLICATION_FORM_URLENCODED_TYPE)
          .post(ClientResponse.class, lFormData);
    } else {
      response = resource.type(MediaType.MULTIPART_FORM_DATA_TYPE)
          .post(ClientResponse.class, form);
    }
    return response;
  }
157240
private HttpResponse getResponse(StringBuilder q, String _id) throws URISyntaxException, IOException,
            ClientProtocolException
    {
        URI uri = new URI(CouchDBConstants.PROTOCOL, null, httpHost.getHostName(), httpHost.getPort(), _id,
                q.toString(), null);
        HttpGet get = new HttpGet(uri);
        get.addHeader("Accept", "application/json");
        return httpClient.execute(httpHost, get, CouchDBUtils.getContext(httpHost));
    }
563430
public <T extends ApiObject> EntityResponse<T> query(Request<T> request)
    {
        return executeRequest(request, objectMapper.getTypeFactory()
                .constructParametrizedType(EntityResponse.class, EntityResponse.class, request.getEntityType()));
    }
820931
@Override
	public Promise<QueryResult> query(CubeQuery cubeQuery) throws QueryException {
		DefiningClassLoader queryClassLoader = getQueryClassLoader(new CubeClassLoaderCache.Key(
				new LinkedHashSet<>(cubeQuery.getAttributes()),
				new LinkedHashSet<>(cubeQuery.getMeasures()),
				cubeQuery.getWhere().getDimensions()));
		long queryStarted = eventloop.currentTimeMillis();
		return new RequestContext<>().execute(queryClassLoader, cubeQuery)
				.whenComplete((queryResult, e) -> {
					if (e == null) {
						queryTimes.recordValue((int) (eventloop.currentTimeMillis() - queryStarted));
					} else {
						queryErrors++;
						queryLastError = e;

						if (e instanceof NoSuchFileException) {
							logger.warn("Query failed because of NoSuchFileException. " + cubeQuery.toString(), e);
						}
					}
				});
	}
164048
private void readQueryResult(InH3 hIn, HeadersAmp headers)
      throws IOException
  {
    ServiceRefAmp serviceRef = readToAddress(hIn);
  
    long id = hIn.readLong();

    QueryRefAmp queryRef = serviceRef.removeQueryRef(id);
  
    if (queryRef != null) {
      ClassLoader loader = queryRef.getClassLoader();

      Thread thread = Thread.currentThread();
      thread.setContextClassLoader(loader);
      // XXX: _serializer.setClassLoader(loader);
    }
    else {
      // XX: _serializer.setClassLoader(null);
    }

    Object value = hIn.readObject();

    if (log.isLoggable(_logLevel)) {
      log.log(_logLevel, "query-result-r " + value + " (in " + this + ")"
              + "\n  {id:" + id + ", to:" + serviceRef + "," + headers + "}");
    }

    if (queryRef != null) {
      queryRef.complete(headers, value);
    }
    else if (log.isLoggable(Level.WARNING)) {
      log.warning("query-result qid=" + id + " for service " + serviceRef +
                  " does not match any known queries.\n" + headers);
    }
  }
815540
public QueryResponse executeQueryPost(Query query) throws ApiException {
        ApiResponse<QueryResponse> resp = executeQueryPostWithHttpInfo(query);
        return resp.getData();
    }
45240
func (o *GetPollersIdentifierDataReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {

	case 200:
		result := NewGetPollersIdentifierDataOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil

	case 404:
		result := NewGetPollersIdentifierDataNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result

	default:
		result := NewGetPollersIdentifierDataDefault(response.Code())
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	}
}
1190825
func (o *GetLogoutRequestReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {

	case 200:
		result := NewGetLogoutRequestOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil

	case 404:
		result := NewGetLogoutRequestNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result

	case 500:
		result := NewGetLogoutRequestInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result

	default:
		return nil, runtime.NewAPIError("unknown error", response, response.Code())
	}
}
974830
public QueryResponse<DatastoreKey> executeKeyQueryRequest(KeyQueryRequest request) {
    try {
      GqlQuery.Builder<Key> queryBuilder = Query.newGqlQueryBuilder(ResultType.KEY,
          request.getQuery());
      queryBuilder.setNamespace(entityManager.getEffectiveNamespace());
      queryBuilder.setAllowLiteral(request.isAllowLiterals());
      QueryUtils.applyNamedBindings(queryBuilder, request.getNamedBindings());
      QueryUtils.applyPositionalBindings(queryBuilder, request.getPositionalBindings());
      GqlQuery<Key> gqlQuery = queryBuilder.build();
      QueryResults<Key> results = nativeReader.run(gqlQuery);
      List<DatastoreKey> entities = new ArrayList<>();
      DefaultQueryResponse<DatastoreKey> response = new DefaultQueryResponse<>();
      response.setStartCursor(new DefaultDatastoreCursor(results.getCursorAfter().toUrlSafe()));
      while (results.hasNext()) {
        Key result = results.next();
        DatastoreKey datastoreKey = new DefaultDatastoreKey(result);
        entities.add(datastoreKey);
      }
      response.setResults(entities);
      response.setEndCursor(new DefaultDatastoreCursor(results.getCursorAfter().toUrlSafe()));
      response.setQueryResponseMetadata(
          new DefaultQueryResponseMetadata(
              QueryResponseMetadata.QueryState.forMoreResultsType(results.getMoreResults())));
      return response;
    } catch (DatastoreException exp) {
      throw new EntityManagerException(exp);
    }
  }
112711
protected function processResponse(\Smile\ElasticsuiteCore\Search\Adapter\Elasticsuite\Response\QueryResponse $response)
    {
        $data = array_merge(array_fill_keys($this->defaultKeys, 0), ['page_views_count' => $response->count()]);

        foreach ($this->getBucketValues($response) as $value) {
            if ($value->getValue() == 'all') {
                $data['sessions_count'] = (int) $value->getMetrics()['unique_sessions'];
                $data['visitors_count'] = (int) $value->getMetrics()['unique_visitors'];
            } else {
                $data['search_page_views_count'] = (int) $value->getMetrics()['count'];
                $data['search_sessions_count']   = (int) $value->getMetrics()['unique_sessions'];
                $data['search_usage_rate']       = round($data['search_page_views_count'] / ($data['search_sessions_count'] ?: 1), 1);
                $data['spellcheck_usage_count']  = (int) $value->getMetrics()['spellcheck_usage']['sum'];
                $data['spellcheck_usage_rate']   = $value->getMetrics()['spellcheck_usage']['avg'];
            }
        }

        return $data;
    }
1115482
public static Query fromProto(@Nonnull ReadRowsRequest request) {
    Preconditions.checkArgument(request != null, "ReadRowsRequest must not be null");

    Query query = new Query(NameUtil.extractTableIdFromTableName(request.getTableName()));
    query.builder = request.toBuilder();

    return query;
  }