Source:
protected AsyncQueryResult processQuery() throws URISyntaxException, IOException { UUID requestId = UUID.fromString(queryObj.getRequestId()); ElideResponse response = null; String responseBody = null; boolean isError = false; Integer recCount = null; Observable<String> observableResult = Observable.empty(); QueryType queryType = queryObj.getQueryType(); ResultFormatType resultFormatType = queryObj.getResultFormatType(); boolean isDownload = queryObj.getResultType() == ResultType.DOWNLOAD; if (isDownload && resultStorageEngine == null) { throw new IllegalStateException("ResultStorageEngine unavailable."); } log.debug("AsyncQuery Object from request: {}", queryObj); if (queryType.equals(QueryType.JSONAPI_V1_0)) { response = executeJsonApiRequest(queryObj, requestId); } else if (queryType.equals(QueryType.GRAPHQL_V1_0)) { response = executeGraphqlRequest(queryObj, requestId); } nullResponseCheck(response); responseBody = response.getBody(); isError = checkJsonStrErrorMessage(responseBody); queryResultObj = new AsyncQueryResult(); queryResultObj.setHttpStatus(response.getResponseCode()); queryResultObj.setResponseBody(responseBody); queryResultObj.setContentLength(responseBody.length()); queryResultObj.setCompletedOn(new Date()); if (isError) { queryResultObj.setResponseBody(responseBody); return queryResultObj; } recCount = calculateRecordCount(response, queryType); queryResultObj.setRecordCount(recCount); if (resultFormatType == ResultFormatType.CSV) { observableResult = convertJsonToCSV(responseBody); } if (isDownload) { queryObj.setResult(queryResultObj); resultStorageEngine.storeResults(queryObj, observableResult); queryResultObj.setResponseBody("URL to be generated"); } else if (resultFormatType == ResultFormatType.CSV) { queryResultObj.setResponseBody(mergeObservable(observableResult)); } else { queryResultObj.setResponseBody(responseBody); } return queryResultObj; }

Target:
protected AsyncQueryResult processQuery() throws URISyntaxException, IOException { UUID requestId = UUID.fromString(queryObj.getRequestId()); ElideResponse response = null; String responseBody = null; boolean isError = false; QueryType queryType = queryObj.getQueryType(); boolean isDownload = queryObj.getResultType() == ResultType.DOWNLOAD; if (isDownload && resultStorageEngine == null) { throw new IllegalStateException("ResultStorageEngine unavailable."); } log.debug("AsyncQuery Object from request: {}", queryObj); queryResultObj = new AsyncQueryResult(); if (isDownload) { Observable<String> downloadString = Observable.empty(); if (queryType.equals(QueryType.JSONAPI_V1_0)) { throw new InvalidValueException("Download not supported for JSON API Query"); } else if (queryType.equals(QueryType.GRAPHQL_V1_0)) { GraphQLQuery graphQLQuery = createGraphQLQuery(); Observable<PersistentResource> observableResults = executeDownloadRequest(graphQLQuery, requestId); downloadString = processObservablePersistentResource(observableResults); } queryResultObj.setHttpStatus(200); queryResultObj.setContentLength(null); storeResults(queryObj, downloadString); queryResultObj.setRecordCount(this.downloadRecordCount); queryResultObj.setResponseBody("URL to be generated"); } else { if (queryType.equals(QueryType.JSONAPI_V1_0)) { response = executeJsonApiRequest(queryObj, requestId); } else if (queryType.equals(QueryType.GRAPHQL_V1_0)) { GraphQLQuery graphQLQuery = createGraphQLQuery(); response = executeGraphqlRequest(graphQLQuery, requestId); } nullResponseCheck(response); responseBody = response.getBody(); isError = checkJsonStrErrorMessage(responseBody); queryResultObj.setHttpStatus(response.getResponseCode()); queryResultObj.setContentLength(responseBody.length()); queryResultObj.setResponseBody(responseBody); if (isError) { return queryResultObj; } calculateRecordCount(response, queryType); queryResultObj.setRecordCount(this.downloadRecordCount); } queryResultObj.setCompletedOn(new Date()); return queryResultObj; }