public List < ReplicatorDocument > findAll ( ) { InputStream instream = null ; try { final URI uri = buildUri ( dbURI ) . path ( "_all_docs" ) . query ( "include_docs" , "true" ) . build ( ) ; final Reader reader = new InputStreamReader ( instream = dbc . get ( uri ) , Charsets . UTF_8 ) ; final JsonArray jsonArray = new JsonParser ( ) . parse ( reader ) . getAsJsonObject ( ) . getAsJsonArray ( "rows" ) ; final List < ReplicatorDocument > list = new ArrayList < ReplicatorDocument > ( ) ; for ( JsonElement jsonElem : jsonArray ) { JsonElement elem = jsonElem . getAsJsonObject ( ) . get ( "doc" ) ; if ( ! getAsString ( elem . getAsJsonObject ( ) , "_id" ) . startsWith ( "_design" ) ) { // skip design docs ReplicatorDocument rd = dbc . getGson ( ) . fromJson ( elem , ReplicatorDocument . class ) ; list . add ( rd ) ; } } return list ; } finally { close ( instream ) ; } }
Finds all documents in the replicator database .