Skip to content
This repository has been archived by the owner on Sep 28, 2022. It is now read-only.

remove fetchAllDocuments route #134

Merged
merged 1 commit into from
Jun 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 0 additions & 53 deletions src/main/java/io/kuzzle/sdk/core/Collection.java
Original file line number Diff line number Diff line change
Expand Up @@ -869,59 +869,6 @@ public void onError(JSONObject error) {
}
}

/**
* Retrieves all documents stored in this data collection.
*
* @param listener the listener
*/
public void fetchAllDocuments(@NonNull final ResponseListener<ArrayList<Document>> listener) {
this.fetchAllDocuments(new Options(), listener);
}

/**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You only removed a signature of fetchAlldocuments, the actual method doing the job is still just below :)

* Retrieves all documents stored in this data collection.
*
* @param options the options
* @param listener the listener
*/
public void fetchAllDocuments(final Options options, @NonNull final ResponseListener<ArrayList<Document>> listener) {
final ArrayList<Document> documents = new ArrayList<Document>();
JSONObject filters = new JSONObject();

if (listener == null) {
throw new IllegalArgumentException("Collection.fetchAllDocuments: listener required");
}

if (options.getFrom() == null) {
options.setFrom((long) 0);
}

if (options.getSize() == null) {
options.setSize((long) 1000);
}

this.search(filters, options, new ResponseListener<SearchResult>() {
@Override
public void onSuccess(SearchResult response) {
if (response != null) {
for (int i = 0; i < response.getDocuments().size(); i++) {
documents.add(response.getDocuments().get(i));
}

response.fetchNext(this);
}
else {
listener.onSuccess(documents);
}
}

@Override
public void onError(JSONObject error) {
listener.onError(error);
}
});
}

/**
* Instantiates a CollectionMapping object containing the current mapping of this collection.
*
Expand Down

This file was deleted.