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

Commit

Permalink
Merge pull request #134 from kuzzleio/ref-23-remove-fetchalldocuments
Browse files Browse the repository at this point in the history
remove fetchAllDocuments route
  • Loading branch information
stafyniaksacha committed Jun 7, 2017
2 parents 35d807f + 0cf82b2 commit aeda174
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 220 deletions.
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);
}

/**
* 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.

0 comments on commit aeda174

Please sign in to comment.