Example #1
0
 /**
  * @param Will be JSON-encoded.
  * @return the view query for chained calls
  */
 public ViewQuery endKey(Object o) {
   reset();
   try {
     endKey = mapper.writeValueAsString(o);
   } catch (Exception e) {
     throw Exceptions.propagate(e);
   }
   return this;
 }
Example #2
0
 public ViewQuery designDocId(String s) {
   reset();
   designDocId = s;
   return this;
 }
Example #3
0
 /**
  * The include_docs option will include the associated document. Although, the user should keep in
  * mind that there is a race condition when using this option. It is possible that between reading
  * the view data and fetching the corresponding document that the document has changed. If you
  * want to alleviate such concerns you should emit an object with a _rev attribute as in emit(key,
  * {"_rev": doc._rev}). This alleviates the race condition but leaves the possiblity that the
  * returned document has been deleted (in which case, it includes the "_deleted": true attribute).
  *
  * @param b the includeDocs flag
  * @return the view query for chained calls
  */
 public ViewQuery includeDocs(boolean b) {
   reset();
   includeDocs = b;
   return this;
 }
Example #4
0
 public ViewQuery groupLevel(int i) {
   reset();
   groupLevel = i;
   return this;
 }
Example #5
0
 /**
  * The skip option should only be used with small values, as skipping a large range of documents
  * this way is inefficient (it scans the index from the startkey and then skips N elements, but
  * still needs to read all the index values to do that). For efficient paging you'll need to use
  * startkey and limit. If you expect to have multiple documents emit identical keys, you'll need
  * to use startkey_docid in addition to startkey to paginate correctly. The reason is that
  * startkey alone will no longer be sufficient to uniquely identify a row.
  *
  * @param i the skip count
  * @return the view query for chained calls
  */
 public ViewQuery skip(int i) {
   reset();
   skip = i;
   return this;
 }
Example #6
0
 /**
  * Same as staleOk(true) but will also trigger a rebuild of the view index after the results of
  * the view have been retrieved. (since CouchDB 1.1.0)
  *
  * @return
  */
 public ViewQuery staleOkUpdateAfter() {
   reset();
   staleOk = "update_after";
   return this;
 }
Example #7
0
 /**
  * limit=0 you don't get any data, but all meta-data for this View. The number of documents in
  * this View for example.
  *
  * @param i the limit
  * @return the view query for chained calls
  */
 public ViewQuery limit(int i) {
   reset();
   limit = i;
   return this;
 }
Example #8
0
 /**
  * @param Will be JSON-encoded.
  * @return the view query for chained calls
  */
 public ViewQuery startKey(long l) {
   reset();
   startKey = Long.toString(l);
   return this;
 }
Example #9
0
 /**
  * @param Will be JSON-encoded.
  * @return the view query for chained calls
  */
 public ViewQuery startKey(float f) {
   reset();
   startKey = Float.toString(f);
   return this;
 }
Example #10
0
 /**
  * For multiple-key queries (as of CouchDB 0.9). Keys will be JSON-encoded.
  *
  * @param keyList a list of Object, will be JSON encoded according to each element's type.
  * @return the view query for chained calls
  */
 public ViewQuery keys(Collection<?> keyList) {
   reset();
   keys = Keys.of(keyList);
   return this;
 }
Example #11
0
 /**
  * @param Will be JSON-encoded.
  * @return the view query for chained calls
  */
 public ViewQuery startKey(int i) {
   reset();
   startKey = Integer.toString(i);
   return this;
 }
Example #12
0
 public ViewQuery listName(String s) {
   reset();
   listName = s;
   return this;
 }
Example #13
0
 public ViewQuery viewName(String s) {
   reset();
   viewName = s;
   return this;
 }
Example #14
0
 /**
  * Will automatically set the query special _all_docs URI. In this case, setting designDocId will
  * have no effect.
  *
  * @return
  */
 public ViewQuery allDocs() {
   reset();
   viewName = ALL_DOCS_VIEW_NAME;
   return this;
 }
Example #15
0
 /**
  * @param Will be JSON-encoded.
  * @return the view query for chained calls
  */
 public ViewQuery endKey(double d) {
   reset();
   endKey = Double.toString(d);
   return this;
 }
Example #16
0
 /**
  * @param Will be JSON-encoded.
  * @return the view query for chained calls
  */
 public ViewQuery startKey(double d) {
   reset();
   startKey = Double.toString(d);
   return this;
 }
Example #17
0
 /**
  * @param Will be JSON-encoded.
  * @return the view query for chained calls
  */
 public ViewQuery endKey(boolean b) {
   reset();
   endKey = Boolean.toString(b);
   return this;
 }
Example #18
0
 /**
  * @param Will be JSON-encoded.
  * @return the view query for chained calls
  */
 public ViewQuery startKey(boolean b) {
   reset();
   startKey = Boolean.toString(b);
   return this;
 }
Example #19
0
 public ViewQuery endDocId(String s) {
   reset();
   endDocId = s;
   return this;
 }
Example #20
0
 public ViewQuery startDocId(String s) {
   reset();
   startDocId = s;
   return this;
 }
Example #21
0
 /**
  * The stale option can be used for higher performance at the cost of possibly not seeing the all
  * latest data. If you set the stale option to ok, CouchDB may not perform any refreshing on the
  * view that may be necessary.
  *
  * @param b the staleOk flag
  * @return the view query for chained calls
  */
 public ViewQuery staleOk(boolean b) {
   reset();
   staleOk = "ok";
   return this;
 }
Example #22
0
 /**
  * @param s need to be properly JSON encoded values (for example, endkey="string" for a string
  *     value).
  * @return the view query for chained calls
  */
 public ViewQuery endKey(String s) {
   reset();
   endKey = JSONEncoding.jsonEncode(s);
   return this;
 }
Example #23
0
 /**
  * View rows are sorted by the key; specifying descending=true will reverse their order. Note that
  * the descending option is applied before any key filtering, so you may need to swap the values
  * of the startkey and endkey options to get the expected results.
  *
  * @param b the descending flag
  * @return the view query for chained calls
  */
 public ViewQuery descending(boolean b) {
   reset();
   descending = b;
   return this;
 }
Example #24
0
 /**
  * @param Will be JSON-encoded.
  * @return the view query for chained calls
  */
 public ViewQuery endKey(int i) {
   reset();
   endKey = Integer.toString(i);
   return this;
 }
Example #25
0
 /**
  * The group option controls whether the reduce function reduces to a set of distinct keys or to a
  * single result row.
  *
  * @param b the group flag
  * @return the view query for chained calls
  */
 public ViewQuery group(boolean b) {
   reset();
   group = b;
   return this;
 }
Example #26
0
 /**
  * @param Will be JSON-encoded.
  * @return the view query for chained calls
  */
 public ViewQuery endKey(long l) {
   reset();
   endKey = Long.toString(l);
   return this;
 }
Example #27
0
 /**
  * If a view contains both a map and reduce function, querying that view will by default return
  * the result of the reduce function. The result of the map function only may be retrieved by
  * passing reduce=false as a query parameter.
  *
  * @param b the reduce flag
  * @return the view query for chained calls
  */
 public ViewQuery reduce(boolean b) {
   reset();
   reduce = b;
   return this;
 }
Example #28
0
 /**
  * @param Will be JSON-encoded.
  * @return the view query for chained calls
  */
 public ViewQuery endKey(float f) {
   reset();
   endKey = Float.toString(f);
   return this;
 }
Example #29
0
 /**
  * The inclusive_end option controls whether the endkey is included in the result. It defaults to
  * true.
  *
  * @param b the inclusiveEnd flag
  * @return the view query for chained calls
  */
 public ViewQuery inclusiveEnd(boolean b) {
   reset();
   inclusiveEnd = b;
   return this;
 }
Example #30
0
 public ViewQuery dbPath(String s) {
   reset();
   dbPath = s;
   return this;
 }