if (request.getDocumentRevision() != null) {
queryBuilder.add("rev", request.getDocumentRevision());
}
} else if (request.getViewQuery() != null) {
// View query
CouchViewQuery viewQuery = request.getViewQuery();
path = UriUtil.buildPath(
databaseName,
"_design",
viewQuery.getDesignName(),
"_view",
viewQuery.getViewName());
queryBuilder.add("include_docs", String.valueOf(viewQuery.isIncludeDocs()));
if (viewQuery.hasKey()) {
queryBuilder.add("key", viewQuery.getKeyJson());
}
if (viewQuery.hasStartKey()) {
queryBuilder.add("startkey", viewQuery.getStartKeyJson());
}
if (viewQuery.hasEndKey()) {
queryBuilder.add("endkey", viewQuery.getEndKeyJson());
}
if (viewQuery.getLimit() > 0) {
queryBuilder.add("limit", String.valueOf(viewQuery.getLimit() + 1));
}
if (viewQuery.isDescending()) {
queryBuilder.add("descending", String.valueOf(viewQuery.isDescending()));
}
} else if (request.getPageQuery() != null) {
// Page query
CouchPageQuery pageQuery = request.getPageQuery();