本文整理汇总了Java中com.couchbase.client.protocol.views.Query类的典型用法代码示例。如果您正苦于以下问题:Java Query类的具体用法?Java Query怎么用?Java Query使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Query类属于com.couchbase.client.protocol.views包,在下文中一共展示了Query类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setup
import com.couchbase.client.protocol.views.Query; //导入依赖的package包/类
@Override
public void setup(OperatorContext context)
{
super.setup(context);
try {
className = Class.forName(outputClass);
} catch (ClassNotFoundException ex) {
throw new RuntimeException(ex);
}
view = store.getInstance().getView(designDocumentName, viewName);
query = new Query();
query.setStale(Stale.FALSE);
query.setIncludeDocs(true);
query.setLimit(limit);
query.setDescending(descending);
}
开发者ID:apache,项目名称:apex-malhar,代码行数:17,代码来源:CouchBasePOJOInputOperator.java
示例2: testFindOauth2AccessTokenByUserName
import com.couchbase.client.protocol.views.Query; //导入依赖的package包/类
@Ignore
@Test
public void testFindOauth2AccessTokenByUserName() throws InterruptedException {
CouchbaseOAuth2AccessToken defaultToken = createSampleOAuth2AccessToken();
oauth2AccessTokenRepository.save(defaultToken);
Query query = new Query();
query.setKey(ComplexKey.of(DEFAULT_USER_NAME));
List<OAuth2AccessToken> accessTokens = oauth2AccessTokenRepository.findByUserName(query);
Assert.notNull(accessTokens);
Assert.notEmpty(accessTokens);
Assert.isTrue(DEFAULT_TOKEN_ID.equals(accessTokens.get(0).getValue()));
// clean data
oauth2AccessTokenRepository.delete(DEFAULT_TOKEN_ID);
Assert.isNull(oauth2AccessTokenRepository.findOne(DEFAULT_TOKEN_ID));
}
开发者ID:tcompiegne,项目名称:oauth2-couchbase-token-store,代码行数:20,代码来源:OAuth2AccessTokenRepositoryTest.java
示例3: testFindOAuth2AccessTokenByClientId
import com.couchbase.client.protocol.views.Query; //导入依赖的package包/类
@Ignore
@Test
public void testFindOAuth2AccessTokenByClientId() {
CouchbaseOAuth2AccessToken defaultToken = createSampleOAuth2AccessToken();
oauth2AccessTokenRepository.save(defaultToken);
Query query = new Query();
query.setKey(ComplexKey.of(DEFAULT_CLIENT_ID));
List<OAuth2AccessToken> accessTokens = oauth2AccessTokenRepository.findByClientId(query);
Assert.notNull(accessTokens);
Assert.notEmpty(accessTokens);
Assert.isTrue(DEFAULT_TOKEN_ID.equals(accessTokens.get(0).getValue()));
// clean data
oauth2AccessTokenRepository.delete(DEFAULT_TOKEN_ID);
Assert.isNull(oauth2AccessTokenRepository.findOne(DEFAULT_TOKEN_ID));
}
开发者ID:tcompiegne,项目名称:oauth2-couchbase-token-store,代码行数:19,代码来源:OAuth2AccessTokenRepositoryTest.java
示例4: testFindOAuth2AccessTokenByClientIdAndUserName
import com.couchbase.client.protocol.views.Query; //导入依赖的package包/类
@Ignore
@Test
public void testFindOAuth2AccessTokenByClientIdAndUserName() {
CouchbaseOAuth2AccessToken defaultToken = createSampleOAuth2AccessToken();
oauth2AccessTokenRepository.save(defaultToken);
Query query = new Query();
query.setKey(ComplexKey.of(DEFAULT_CLIENT_ID, DEFAULT_USER_NAME));
List<OAuth2AccessToken> accessTokens = oauth2AccessTokenRepository.findByClientIdAndUserName(query);
Assert.notNull(accessTokens);
Assert.notEmpty(accessTokens);
Assert.isTrue(DEFAULT_TOKEN_ID.equals(accessTokens.get(0).getValue()));
// clean data
oauth2AccessTokenRepository.delete(DEFAULT_TOKEN_ID);
Assert.isNull(oauth2AccessTokenRepository.findOne(DEFAULT_TOKEN_ID));
}
开发者ID:tcompiegne,项目名称:oauth2-couchbase-token-store,代码行数:19,代码来源:OAuth2AccessTokenRepositoryTest.java
示例5: getHostNamesTemp
import com.couchbase.client.protocol.views.Query; //导入依赖的package包/类
private Set<String> getHostNamesTemp() {
if (client == null) {
getConnection();
}
View view = client.getView("Invoc", "getHostNames");
// Set up the Query object
Query query = new Query();
// We the full documents and only the top 20
query.setIncludeDocs(false).setGroup(true).setGroupLevel(1);
// Query the Cluster
ViewResponse result = client.query(view, query);
Set<String> tempResult = new HashSet<>();
// Iterate over the found documents
for (ViewRow row : result) {
String x = row.getKey();
if (x != null && !x.equals("null")) {
tempResult.add(x);
}
}
return tempResult;
}
开发者ID:marcbux,项目名称:Hi-WAY,代码行数:27,代码来源:HiwayDBNoSQL.java
示例6: getTaskIdsForWorkflowTemp
import com.couchbase.client.protocol.views.Query; //导入依赖的package包/类
private Set<Long> getTaskIdsForWorkflowTemp(String workflowName) {
if (client == null) {
getConnection();
}
View view = client.getView("Workflow", "getTaskIdsForWorkflow");
// Set up the Query object
Query query = new Query();
query.setIncludeDocs(true).setLimit(1).setKey(workflowName);
// Query the Cluster
ViewResponse result = client.query(view, query);
WfRunDoc wfRun = null;
for (ViewRow row : result) {
wfRun = gson.fromJson((String) row.getDocument(), WfRunDoc.class);
}
if (wfRun != null) {
return wfRun.getTaskIDs();
}
return new HashSet<>();
}
开发者ID:marcbux,项目名称:Hi-WAY,代码行数:25,代码来源:HiwayDBNoSQL.java
示例7: getTaskNameTemp
import com.couchbase.client.protocol.views.Query; //导入依赖的package包/类
private String getTaskNameTemp(long taskId) {
if (client == null) {
getConnection();
}
View view = client.getView("Invoc", "getTaskname");
// Set up the Query object
Query query = new Query();
query.setIncludeDocs(false).setLimit(1).setKey("" + taskId + "");
// Query the Cluster
ViewResponse result = client.query(view, query);
String name = "";
for (ViewRow row : result) {
name = row.getValue();
}
return name;
}
开发者ID:marcbux,项目名称:Hi-WAY,代码行数:20,代码来源:HiwayDBNoSQL.java
示例8: getLogEntriesForTasks
import com.couchbase.client.protocol.views.Query; //导入依赖的package包/类
@Override
public Collection<InvocStat> getLogEntriesForTasks(Set<Long> taskIds) {
Long tick = System.currentTimeMillis();
if (client == null) {
getConnection();
}
View view = client.getView("Invoc", "getLogEntriesForTasks");
// Set up the Query object
Query query = new Query();
String keys = "[";
for (Long id : taskIds) {
keys += "[" + id.toString() + "],";
}
keys = keys.substring(0, keys.length() - 2);
keys += "]]";
query.setIncludeDocs(true).setKeys(keys);
// Query the Cluster
ViewResponse result = client.query(view, query);
Long tock = System.currentTimeMillis();
saveAccessTime(tick, tock, 1, "getLogEntriesForTasks", null);
return createInvocStat(result);
}
开发者ID:marcbux,项目名称:Hi-WAY,代码行数:27,代码来源:HiwayDBNoSQL.java
示例9: getLogEntriesForTaskOnHostSinceTemp
import com.couchbase.client.protocol.views.Query; //导入依赖的package包/类
private Collection<InvocStat> getLogEntriesForTaskOnHostSinceTemp(long taskId, String hostName, long timestamp) {
if (client == null) {
getConnection();
}
View view = client.getView("Invoc", "getLogEntriesForTaskOnHostSince");
// Set up the Query object
Query query = new Query();
query.setIncludeDocs(true).setRange(ComplexKey.of(taskId, hostName, timestamp), ComplexKey.of(taskId, hostName, 999999999999999999l));
// Query the Cluster
ViewResponse result = client.query(view, query);
return createInvocStat(result);
}
开发者ID:marcbux,项目名称:Hi-WAY,代码行数:18,代码来源:HiwayDBNoSQL.java
示例10: findByName
import com.couchbase.client.protocol.views.Query; //导入依赖的package包/类
public static F.Promise<F.Option<User>> findByName(String name) {
Query query = new Query()
.setLimit(1)
.setIncludeDocs(true)
.setStale(Stale.FALSE)
.setRangeStart(ComplexKey.of(name))
.setRangeEnd(ComplexKey.of(name + "\uefff"));
return bucket.find("users", "by_name", query, User.class)
.map(new F.Function<Collection<User>, F.Option<User>>() {
@Override
public F.Option<User> apply(Collection<User> users) throws Throwable {
if (users.isEmpty()) {
return F.Option.None();
}
return F.Option.Some(users.iterator().next());
}
});
}
开发者ID:ReactiveCouchbase,项目名称:play-java-starter-kit,代码行数:19,代码来源:User.java
示例11: findByEmail
import com.couchbase.client.protocol.views.Query; //导入依赖的package包/类
public static F.Promise<F.Option<User>> findByEmail(String email) {
Query query = new Query()
.setLimit(1)
.setIncludeDocs(true)
.setStale(Stale.FALSE)
.setRangeStart(ComplexKey.of(email))
.setRangeEnd(ComplexKey.of(email + "\uefff"));
return bucket.find("users", "by_email", query, User.class)
.map(new F.Function<Collection<User>, F.Option<User>>() {
@Override
public F.Option<User> apply(Collection<User> users) throws Throwable {
if (users.isEmpty()) {
return F.Option.None();
}
return F.Option.Some(users.iterator().next());
}
});
}
开发者ID:ReactiveCouchbase,项目名称:play-java-starter-kit,代码行数:19,代码来源:User.java
示例12: getRowData
import com.couchbase.client.protocol.views.Query; //导入依赖的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
示例13: findTokensByClientIdAndUserName
import com.couchbase.client.protocol.views.Query; //导入依赖的package包/类
@Override
public Collection<OAuth2AccessToken> findTokensByClientIdAndUserName(String clientId, String userName) {
List<OAuth2AccessToken> accessTokens = new ArrayList<OAuth2AccessToken>();
Query query = new Query();
query.setKey(ComplexKey.of(clientId, userName));
accessTokens = oAuth2AccessTokenService.findByClientIdAndUserName(query);
if (accessTokens == null) {
if (LOG.isInfoEnabled()) {
LOG.info("Failed to find access token for userName " + userName);
}
}
return accessTokens;
}
开发者ID:tcompiegne,项目名称:oauth2-couchbase-token-store,代码行数:16,代码来源:SpringDataTokenStore.java
示例14: findTokensByClientId
import com.couchbase.client.protocol.views.Query; //导入依赖的package包/类
@Override
public Collection<OAuth2AccessToken> findTokensByClientId(String clientId) {
List<OAuth2AccessToken> accessTokens = new ArrayList<OAuth2AccessToken>();
Query query = new Query();
query.setKey(ComplexKey.of(clientId));
accessTokens = oAuth2AccessTokenService.findByClientId(query);
if (accessTokens == null) {
if (LOG.isInfoEnabled()) {
LOG.info("Failed to find access token for clientId " + clientId);
}
}
return accessTokens;
}
开发者ID:tcompiegne,项目名称:oauth2-couchbase-token-store,代码行数:15,代码来源:SpringDataTokenStore.java
示例15: HiwayDBNoSQL
import com.couchbase.client.protocol.views.Query; //导入依赖的package包/类
public HiwayDBNoSQL(String bucket, String password, List<URI> dbURLs, String usernameSQL, String passwordSQL, String dbURLSQL) {
this.bucket = bucket;
this.password = password;
this.dbURLs = dbURLs;
this.usernameSQL = usernameSQL;
this.passwordSQL = passwordSQL;
this.dbURLSQL = dbURLSQL;
this.wfName = "";
this.runIDat = "";
this.config = "nix";
gson = new Gson();
getConnection();
View view = client.getView("Workflow", "WfRunCount");
Query query = new Query();
// Query the Cluster
ViewResponse result = client.query(view, query);
for (ViewRow row : result) {
// Use Google GSON to parse the JSON into a HashMap
dbVolume = Long.parseLong(row.getValue(), 10);
}
}
开发者ID:marcbux,项目名称:Hi-WAY,代码行数:29,代码来源:HiwayDBNoSQL.java
示例16: findByView
import com.couchbase.client.protocol.views.Query; //导入依赖的package包/类
private void findByView(Message<JsonObject> message) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
String designDoc = getMandatoryString("designDoc", message);
String viewName = getMandatoryString("viewName", message);
JsonObject query = getMandatoryObject("query", message);
if (designDoc == null || viewName == null || query == null) {
sendError(message, "designDoc and viewName and query must be specified");
return;
}
final Query q = new Query();
for(Entry<String, Object> entry : query.toMap().entrySet()) {
String setterMethod = "set" + capitalize(entry.getKey());
Object value = entry.getValue();
if(entry.getKey().equals("stale")) {
invokeMethod(q, setterMethod, Stale.valueOf((String)value));
}
else {
invokeMethod(q, setterMethod, value);
}
}
final View view = client.getView(designDoc, viewName);
final ViewResponse response = client.query(view, q);
final JsonArray result = new JsonArray();
for (final ViewRow row : response) {
CASValue<Object> object = client.gets(row.getId());
result.add(new JsonObject((String)object.getValue()));
}
sendOK(message, new JsonObject().putArray("result", result));
}
开发者ID:jmusacchio,项目名称:mod-couchbase-persistor,代码行数:35,代码来源:CouchbasePersistor.java
示例17: CouchbaseView
import com.couchbase.client.protocol.views.Query; //导入依赖的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
示例18: findByClientIdAndUserName
import com.couchbase.client.protocol.views.Query; //导入依赖的package包/类
@Override
public List<OAuth2AccessToken> findByClientIdAndUserName(Query query) {
return oAuth2AccessTokenRepository.findByClientIdAndUserName(query);
}
开发者ID:tcompiegne,项目名称:oauth2-couchbase-token-store,代码行数:5,代码来源:OAuth2AccessTokenServiceImpl.java
示例19: findByUserName
import com.couchbase.client.protocol.views.Query; //导入依赖的package包/类
@Override
public List<OAuth2AccessToken> findByUserName(Query query) {
return oAuth2AccessTokenRepository.findByClientId(query);
}
开发者ID:tcompiegne,项目名称:oauth2-couchbase-token-store,代码行数:5,代码来源:OAuth2AccessTokenServiceImpl.java
示例20: findByClientId
import com.couchbase.client.protocol.views.Query; //导入依赖的package包/类
@Override
public List<OAuth2AccessToken> findByClientId(Query query) {
return oAuth2AccessTokenRepository.findByUserName(query);
}
开发者ID:tcompiegne,项目名称:oauth2-couchbase-token-store,代码行数:5,代码来源:OAuth2AccessTokenServiceImpl.java
注:本文中的com.couchbase.client.protocol.views.Query类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论