当前位置: 首页>>代码示例>>Java>>正文


Java CouchbaseClient.query方法代码示例

本文整理汇总了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());
}
 
开发者ID:jesse-gallagher,项目名称:Couchbase-Data-for-XPages,代码行数:27,代码来源:CouchbaseView.java

示例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();
}
 
开发者ID:jesse-gallagher,项目名称:Couchbase-Data-for-XPages,代码行数:13,代码来源:CouchbaseView.java

示例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;

}
 
开发者ID:marcbux,项目名称:Hi-WAY,代码行数:74,代码来源:Reader.java


注:本文中的com.couchbase.client.CouchbaseClient.query方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。