本文整理汇总了Java中com.couchbase.client.CouchbaseClient.query方法的典型用法代码示例。如果您正苦于以下问题:Java CouchbaseClient.query方法的具体用法?Java CouchbaseClient.query怎么用?Java CouchbaseClient.query使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.couchbase.client.CouchbaseClient
的用法示例。
在下文中一共展示了CouchbaseClient.query方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRowData
import com.couchbase.client.CouchbaseClient; //导入方法依赖的package包/类
@Override
public Object getRowData() {
try {
if (!cached_.contains(getRowIndex())) {
int min = getRowIndex() / PAGE_SIZE * PAGE_SIZE;
CouchbaseClient client = getClient();
View view = getView();
Query query = new Query();
query.setIncludeDocs(true);
query.setSkip(min);
query.setLimit(PAGE_SIZE);
ViewResponse result = client.query(view, query);
int i = min;
for (ViewRow row : result) {
cache_.put(i, new CouchbaseViewEntry(row));
cached_.add(i);
i++;
}
}
} catch (Exception e) {
throw new RuntimeException(e);
}
return cache_.get(this.getRowIndex());
}
示例2: CouchbaseView
import com.couchbase.client.CouchbaseClient; //导入方法依赖的package包/类
public CouchbaseView(final String connectionName, final String designDoc, final String viewName) throws IOException {
connectionName_ = connectionName;
designDoc_ = designDoc;
viewName_ = viewName;
CouchbaseClient client = getClient();
View view = getView();
Query query = new Query();
query.setIncludeDocs(false);
ViewResponse result = client.query(view, query);
rowCount_ = result.size();
}
示例3: copyWorkflowNoSQL
import com.couchbase.client.CouchbaseClient; //导入方法依赖的package包/类
private static int copyWorkflowNoSQL(ViewResponse result, int limit, CouchbaseClient client, int currentSize, CouchbaseClient hiwayClient) {
Gson gson = new Gson();
WfRunDoc newRun = null;
WfRunDoc run = null;
System.out.println("copy NoSQL anzwahl wf:" + currentSize + " resultSize:" + result.size());
int i = 0;
// Iterate over the found wf documents
for (ViewRow row : result) {
i++;
if (currentSize + i >= limit + 1) {
System.out.println("Break and raus: all: " + currentSize + " | i: " + i + " limit: " + limit);
return i;
}
run = gson.fromJson((String) row.getDocument(), WfRunDoc.class);
if (run.getRunId() != null) {
String newName = run.getRunId().substring(0, 36) + "_" + Calendar.getInstance().getTimeInMillis();
System.out.println("Run: " + run.getName() + " , I: " + i + " | " + newName);
newRun = new WfRunDoc();
newRun.setRunId(newName);
newRun.setName(run.getName());
newRun.setWfTime(run.getWfTime());
newRun.setHiwayEvent(run.getHiwayEvent());
newRun.setTaskIDs(run.getTaskIDs());
client.set(newName, gson.toJson(newRun));
View view = hiwayClient.getView("Workflow", "WfRunInvocs");
Query query = new Query();
query.setIncludeDocs(true).setKey(run.getRunId());
// Query the Cluster
ViewResponse newResult = hiwayClient.query(view, query);
InvocDoc newInvoc = null;
InvocDoc oldInvoc = null;
for (ViewRow invocDoc : newResult) {
oldInvoc = gson.fromJson((String) invocDoc.getDocument(), InvocDoc.class);
newInvoc = new InvocDoc();
newInvoc.setHostname(oldInvoc.getHostname());
newInvoc.setLang(oldInvoc.getLang());
newInvoc.setRealTime(oldInvoc.getRealTime());
newInvoc.setRealTimeIn(oldInvoc.getRealTimeIn());
newInvoc.setRealTimeOut(oldInvoc.getRealTimeOut());
newInvoc.setRunId(newName);
newInvoc.setScheduleTime(oldInvoc.getScheduleTime());
newInvoc.setStandardError(oldInvoc.getStandardError());
newInvoc.setStandardOut(oldInvoc.getStandardOut());
newInvoc.setTaskId(oldInvoc.getTaskId());
newInvoc.setTaskname(oldInvoc.getTaskname());
newInvoc.setTimestamp(Calendar.getInstance().getTimeInMillis());
newInvoc.setInvocId(oldInvoc.getInvocId());
newInvoc.setFiles(oldInvoc.getFiles());
newInvoc.setInput(oldInvoc.getInput());
newInvoc.setOutput(oldInvoc.getOutput());
newInvoc.setUserevents(oldInvoc.getUserevents());
String invocID = newName + "_" + newInvoc.getInvocId();
System.out.println("save invoc..." + invocID);
client.set(invocID, gson.toJson(newInvoc));
}
}
}
return i;
}