本文整理汇总了Java中com.couchbase.client.java.view.ViewRow类的典型用法代码示例。如果您正苦于以下问题:Java ViewRow类的具体用法?Java ViewRow怎么用?Java ViewRow使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ViewRow类属于com.couchbase.client.java.view包,在下文中一共展示了ViewRow类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: load
import com.couchbase.client.java.view.ViewRow; //导入依赖的package包/类
@Override
public List<RegisteredService> load() {
try {
logger.debug("Loading services");
final Bucket bucket = couchbase.bucket();
final ViewResult allKeys = bucket.query(ViewQuery.from(UTIL_DOCUMENT, ALL_SERVICES_VIEW.name()));
final List<RegisteredService> services = new LinkedList<>();
for (final ViewRow row : allKeys) {
final RawJsonDocument document = row.document(RawJsonDocument.class);
if (document != null) {
final String json = document.content();
logger.debug("Found service: {}", json);
final StringReader stringReader = new StringReader(json);
services.add(registeredServiceJsonSerializer.fromJson(stringReader));
}
}
return services;
} catch (final RuntimeException e) {
logger.error(e.getMessage(), e);
return new LinkedList<>();
}
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:26,代码来源:CouchbaseServiceRegistryDao.java
示例2: load
import com.couchbase.client.java.view.ViewRow; //导入依赖的package包/类
@Override
public List<RegisteredService> load() {
try {
LOGGER.debug("Loading services");
final ViewResult allKeys = executeViewQueryForAllServices();
final List<RegisteredService> services = new LinkedList<>();
for (final ViewRow row : allKeys) {
final RawJsonDocument document = row.document(RawJsonDocument.class);
if (document != null) {
final String json = document.content();
LOGGER.debug("Found service: [{}]", json);
final StringReader stringReader = new StringReader(json);
final RegisteredService service = this.registeredServiceJsonSerializer.from(stringReader);
services.add(service);
publishEvent(new CasRegisteredServiceLoadedEvent(this, service));
}
}
return services;
} catch (final RuntimeException e) {
LOGGER.error(e.getMessage(), e);
return new LinkedList<>();
}
}
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:26,代码来源:CouchbaseServiceRegistryDao.java
示例3: runQuery
import com.couchbase.client.java.view.ViewRow; //导入依赖的package包/类
private int runQuery(final String prefix) {
final ViewResult allKeys = couchbase.bucket().query(
ViewQuery.from(UTIL_DOCUMENT, "all_tickets")
.startKey(prefix)
.endKey(prefix + END_TOKEN)
.reduce());
final Iterator<ViewRow> iterator = allKeys.iterator();
if (iterator.hasNext()) {
final ViewRow res = iterator.next();
return (Integer) res.value();
} else {
return 0;
}
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:15,代码来源:CouchbaseTicketRegistry.java
示例4: getViewRowCountFromViewResultIterator
import com.couchbase.client.java.view.ViewRow; //导入依赖的package包/类
private static int getViewRowCountFromViewResultIterator(final Iterator<ViewRow> iterator) {
if (iterator.hasNext()) {
final ViewRow res = iterator.next();
final Integer count = (Integer) res.value();
LOGGER.debug("Found [{}] rows", count);
return count;
}
LOGGER.debug("No rows could be found by the query iterator.");
return 0;
}
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:11,代码来源:CouchbaseTicketRegistry.java
示例5: deleteAll
import com.couchbase.client.java.view.ViewRow; //导入依赖的package包/类
@Override
public long deleteAll() {
final Iterator<ViewRow> grantingTicketsIt = getViewResultIteratorForPrefixedTickets(TicketGrantingTicket.PREFIX + '-').iterator();
final Iterator<ViewRow> serviceTicketsIt = getViewResultIteratorForPrefixedTickets(ServiceTicket.PREFIX + '-').iterator();
final Iterator<ViewRow> proxyTicketsIt = getViewResultIteratorForPrefixedTickets(ProxyTicket.PREFIX + '-').iterator();
final Iterator<ViewRow> proxyGrantingTicketsIt = getViewResultIteratorForPrefixedTickets(ProxyGrantingTicket.PREFIX + '-').iterator();
final Iterator<ViewRow> accessTokenIt = getViewResultIteratorForPrefixedTickets(AccessToken.PREFIX + '-').iterator();
final Iterator<ViewRow> oauthcodeIt = getViewResultIteratorForPrefixedTickets(OAuthCode.PREFIX + '-').iterator();
final Iterator<ViewRow> refreshTokenIt = getViewResultIteratorForPrefixedTickets(RefreshToken.PREFIX + '-').iterator();
final int count = getViewRowCountFromViewResultIterator(grantingTicketsIt)
+ getViewRowCountFromViewResultIterator(serviceTicketsIt)
+ getViewRowCountFromViewResultIterator(proxyTicketsIt)
+ getViewRowCountFromViewResultIterator(proxyGrantingTicketsIt)
+ getViewRowCountFromViewResultIterator(accessTokenIt)
+ getViewRowCountFromViewResultIterator(oauthcodeIt)
+ getViewRowCountFromViewResultIterator(refreshTokenIt);
Stream<ViewRow> tickets = StreamSupport.stream(Spliterators.spliteratorUnknownSize(grantingTicketsIt, Spliterator.ORDERED), true);
tickets.forEach(t -> this.couchbase.bucket().remove(t.document()));
tickets = StreamSupport.stream(Spliterators.spliteratorUnknownSize(serviceTicketsIt, Spliterator.ORDERED), true);
tickets.forEach(t -> this.couchbase.bucket().remove(t.document()));
tickets = StreamSupport.stream(Spliterators.spliteratorUnknownSize(proxyTicketsIt, Spliterator.ORDERED), true);
tickets.forEach(t -> this.couchbase.bucket().remove(t.document()));
tickets = StreamSupport.stream(Spliterators.spliteratorUnknownSize(proxyGrantingTicketsIt, Spliterator.ORDERED), true);
tickets.forEach(t -> this.couchbase.bucket().remove(t.document()));
tickets = StreamSupport.stream(Spliterators.spliteratorUnknownSize(accessTokenIt, Spliterator.ORDERED), true);
tickets.forEach(t -> this.couchbase.bucket().remove(t.document()));
tickets = StreamSupport.stream(Spliterators.spliteratorUnknownSize(oauthcodeIt, Spliterator.ORDERED), true);
tickets.forEach(t -> this.couchbase.bucket().remove(t.document()));
tickets = StreamSupport.stream(Spliterators.spliteratorUnknownSize(refreshTokenIt, Spliterator.ORDERED), true);
tickets.forEach(t -> this.couchbase.bucket().remove(t.document()));
return count;
}
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:42,代码来源:CouchbaseTicketRegistry.java
示例6: runQuery
import com.couchbase.client.java.view.ViewRow; //导入依赖的package包/类
private int runQuery(final String prefix) {
final Iterator<ViewRow> iterator = getViewResultIteratorForPrefixedTickets(prefix).iterator();
return getViewRowCountFromViewResultIterator(iterator);
}
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:5,代码来源:CouchbaseTicketRegistry.java
示例7: eval
import com.couchbase.client.java.view.ViewRow; //导入依赖的package包/类
@Override
public Sequence eval(final Sequence[] args, final Sequence contextSequence) throws XPathException {
final CouchbaseClusterManager cmm = CouchbaseClusterManager.getInstance();
// Get connection details
final String clusterId = args[0].itemAt(0).getStringValue();
// Get reference to cluster
final CouchbaseCluster cluster = cmm.validate(clusterId);
// Retrieve other parameters
final String bucketName = (args[1].isEmpty()) ? Constants.DEFAULT_BUCKET : args[1].itemAt(0).getStringValue();
final String bucketPassword = cmm.getBucketPassword(clusterId);
final String design = args[2].itemAt(0).getStringValue();
final String view = args[3].itemAt(0).getStringValue();
final Map<String, Object> parameters = (args[4].isEmpty())
? new HashMap<>()
: ConversionTools.convert((AbstractMapType) args[4].itemAt(0));
try {
// Prepare query
com.couchbase.client.java.view.ViewQuery viewQuery = com.couchbase.client.java.view.ViewQuery.from(design, view);
// Set additional parameters
viewQuery = parseParameters(viewQuery, parameters);
// Perform action
final ViewResult result = cluster.openBucket(bucketName, bucketPassword).query(viewQuery);
// Return results
final ValueSequence retVal = new ValueSequence();
for (final ViewRow row : result) {
retVal.add(JsonToMap.convert(row.document().content(), context));
}
return retVal;
} catch (final Throwable ex) {
return GenericExceptionHandler.handleException(this, ex);
}
}
开发者ID:weXsol,项目名称:Couchbase,代码行数:47,代码来源:ViewQuery.java
注:本文中的com.couchbase.client.java.view.ViewRow类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论