Ejemplo n.º 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;
 }
Ejemplo n.º 2
0
 public ViewQuery designDocId(String s) {
   reset();
   designDocId = s;
   return this;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 4
0
 public ViewQuery groupLevel(int i) {
   reset();
   groupLevel = i;
   return this;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 12
0
 public ViewQuery listName(String s) {
   reset();
   listName = s;
   return this;
 }
Ejemplo n.º 13
0
 public ViewQuery viewName(String s) {
   reset();
   viewName = s;
   return this;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 19
0
 public ViewQuery endDocId(String s) {
   reset();
   endDocId = s;
   return this;
 }
Ejemplo n.º 20
0
 public ViewQuery startDocId(String s) {
   reset();
   startDocId = s;
   return this;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 30
0
 public ViewQuery dbPath(String s) {
   reset();
   dbPath = s;
   return this;
 }