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


Java ViewQuery.skip方法代码示例

本文整理汇总了Java中org.ektorp.ViewQuery.skip方法的典型用法代码示例。如果您正苦于以下问题:Java ViewQuery.skip方法的具体用法?Java ViewQuery.skip怎么用?Java ViewQuery.skip使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.ektorp.ViewQuery的用法示例。


在下文中一共展示了ViewQuery.skip方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: materializeMainSchemaTable

import org.ektorp.ViewQuery; //导入方法依赖的package包/类
@Override
protected DataSet materializeMainSchemaTable(Table table, List<Column> columns, int firstRow, int maxRows) {
    // the connector represents a handle to the the couchdb "database".
    final String databaseName = table.getName();
    final CouchDbConnector connector = _couchDbInstance.createConnector(databaseName, false);

    ViewQuery query = new ViewQuery().allDocs().includeDocs(true);

    if (maxRows > 0) {
        query = query.limit(maxRows);
    }
    if (firstRow > 1) {
        final int skip = firstRow - 1;
        query = query.skip(skip);
    }

    final StreamingViewResult streamingView = connector.queryForStreamingView(query);

    final List<SelectItem> selectItems = columns.stream().map(SelectItem::new).collect(Collectors.toList());
    return new CouchDbDataSet(selectItems, streamingView);
}
 
开发者ID:apache,项目名称:metamodel,代码行数:22,代码来源:CouchDbDataContext.java

示例2: emitTuples

import org.ektorp.ViewQuery; //导入方法依赖的package包/类
@Override
public void emitTuples()
{
  ViewQuery viewQuery = getViewQuery();
  if (pageSize > 0) {
    viewQuery.limit(pageSize);
  }
  if (nextPageKey != null) {
    viewQuery.startKey(nextPageKey);
  }
  if (skip) {
    viewQuery.skip(1);
  }
  ViewResult result = store.queryStore(viewQuery);
  List<ViewResult.Row> rows = result.getRows();
  try {
    for (ViewResult.Row row : result.getRows()) {
      T tuple = getTuple(row);
      outputPort.emit(tuple);
    }
  } catch (Throwable cause) {
    Throwables.propagate(cause);
  }
  if (rows.size() > 0) {
    // Use the last row as the start key and skip one item
    // In case we reach the end we will continue to make the request with last row till there is more data available
    // in the store
    nextPageKey = rows.get(rows.size() - 1).getKey();
    // The skip option should only be used with small values, as skipping a large range of documents this way is inefficient.
    skip = true;
  }
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:33,代码来源:AbstractCouchDBInputOperator.java

示例3: configure

import org.ektorp.ViewQuery; //导入方法依赖的package包/类
/**
 * Configures Ektorp's {@link ViewQuery} with the given {@link ViewParams}.
 * 
 * @param view the Ektorp object to be configured
 * @param params the parameters that shall be used 
 */
public void configure(ViewQuery view, ViewParams params) {
    if (params.getAttachments() != null) {
        throw new UnsupportedViewParameterException("attachments");
    }
    if (params.getAttEncodingInfo() != null) {
        throw new UnsupportedViewParameterException("att_encoding_info");
    }
    if (params.getConflicts() != null) {
        throw new UnsupportedViewParameterException("conflicts");
    }
    if (params.getDescending() != null) {
        view.descending(params.getDescending());
    }
    if (params.getGroup() != null) {
        view.group(params.getGroup());
    }
    if (params.getIncludeDocs() != null) {
        view.includeDocs(params.getIncludeDocs());
    }
    if (params.getInclusiveEnd() != null) {
        view.inclusiveEnd(params.getInclusiveEnd());
    }
    if (params.getReduce() != null) {
        view.reduce(params.getReduce());
    }
    if (params.getUpdateSeq() != null) {
        view.updateSeq(params.getUpdateSeq());
    }
    if (params.getEndKey() != null) {
        view.endKey(params.getEndKey());
    }
    if (params.getEndKeyDocId() != null) {
        view.endDocId(params.getEndKeyDocId());
    }
    if (params.getGroupLevel() != null) {
        view.groupLevel(params.getGroupLevel());
    }
    if (params.getKey() != null) {
        view.key(params.getKey());
    }
    if (params.getLimit() != null) {
        view.limit(params.getLimit());
    }
    if (params.getSkip() != null) {
        view.skip(params.getSkip());
    }
    if (params.getStale() != null) {
        if ("ok".equals(params.getStale())) {
            view.staleOk(true);
        } else if ("update_after".equals(params.getStale())) {
            view.staleOkUpdateAfter();
        }
    }
    if (params.getStartKey() != null) {
        view.startKey(params.getStartKey());
    }
    if (params.getStartKeyDocId() != null) {
        view.startDocId(params.getStartKeyDocId());
    }

    //

    if (params.getDesignDocument() != null) {
        view.designDocId("_design/" + params.getDesignDocument());
    }
    if (params.getView() != null) {
        view.viewName(params.getView());
    }
}
 
开发者ID:rwitzel,项目名称:CouchRepository,代码行数:76,代码来源:EktorpCouchViewConfigurer.java


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