Skip to content

Commit

Permalink
added ability to retrieve deleted items
Browse files Browse the repository at this point in the history
  • Loading branch information
Ksushik committed Sep 27, 2019
1 parent b3ce998 commit 641d0c9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ public interface QueryOperations {
*/
QueryResult query(String query);

/**
* Execute SOQL query and return the first page of results
*
* @param query The SOQL query to execute
* @param includeDeletedItems if result should include deleted items
* documentation https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_queryall.htm
* @return QueryResult
*/
QueryResult query(String query, boolean includeDeletedItems);

/*
* Retrieve next page of results based on argument from url (usually from query result "nextRecordsUrl")
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,14 @@ public QueryTemplate(Salesforce api, RestTemplate restTemplate) {

@Override
public QueryResult query(String query) {
return query(query, false);
}

@Override
public QueryResult query(String query, boolean includeDeletedItems) {
String queryType = includeDeletedItems ? "/queryAll" : "/query";
requireAuthorization();
URI uri = URIBuilder.fromUri(api.getBaseUrl() + "/" + getVersion() + "/query").queryParam("q", query).build();
URI uri = URIBuilder.fromUri(api.getBaseUrl() + "/" + getVersion() + queryType).queryParam("q", query).build();
return restTemplate.getForObject(uri, QueryResult.class);
}

Expand Down

0 comments on commit 641d0c9

Please sign in to comment.