com.bagri.core.model.Query类的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(3.5k)|赞(0)|评价(0)|浏览(199)

本文整理了Java中com.bagri.core.model.Query类的一些代码示例,展示了Query类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query类的具体详情如下:
包路径:com.bagri.core.model.Query
类名称:Query

Query介绍

[英]Represents cached compiled query
[中]表示缓存的编译查询

代码示例

代码示例来源:origin: dsukhoroslov/bagri

/**
 * {@inheritDoc}
 */
@Override
public Query clone() {
  return new Query(query, readOnly, xdmQuery.clone());
}

代码示例来源:origin: dsukhoroslov/bagri

@Override
public void write(ObjectDataOutput out, Query xQuery) throws IOException {
  out.writeUTF(xQuery.getQuery());
  out.writeBoolean(xQuery.isReadOnly());
  out.writeObject(xQuery.getXdmQuery());
}

代码示例来源:origin: dsukhoroslov/bagri

@Override
public Collection<String> prepareQuery(String query) { //throws BagriException {
  logger.trace("prepareQuery.enter; query: {}", query);
  Collection<String> result = null;
  Query xq = xqCache.get(getQueryKey(query));
  if (xq != null) {
    result = xq.getXdmQuery().getParamNames();
  }
  logger.trace("prepareQuery.exit; returning: {}", result);
  return result;
}

代码示例来源:origin: dsukhoroslov/bagri

private boolean addQuery(Query query) {
  Integer qKey = getQueryKey(query.getQuery());
  //logger.trace("addQuery.enter; got code: {}; query cache size: {}", qCode, xQueries.size());
  //boolean result = xqCache.putIfAbsent(qCode, new XDMQuery(query, readOnly, xdmQuery)) == null;
  if (!xqCache.containsKey(qKey)) {
    // throws exception: Failed to serialize 'com.bagri.core.model.Query'
    try {
      xqCache.put(qKey, query);
    } catch (Exception ex) {
      logger.error("addQuery.error", ex);
    }
    return true;
  }
  return false;
}

代码示例来源:origin: dsukhoroslov/bagri

@Override
public boolean isQueryReadOnly(String query, Properties props) throws BagriException {
  Integer qKey = getQueryKey(query);
  Query xQuery = xqCache.get(qKey);
  if (xQuery == null) {
    XQProcessor xqp;
    String clientId = props.getProperty(pn_client_id);
    if (clientId == null) {
      logger.warn("isQueryReadOnly; got no clientId");
      xqp = repo.getXQProcessor();
    } else {
      xqp = repo.getXQProcessor(clientId);
    }
    try {
      return xqp.isQueryReadOnly(query, props);
    } catch (XQException ex) {
      throw new BagriException(ex, BagriException.ecQuery);
    }
  }
  return xQuery.isReadOnly();
}

代码示例来源:origin: dsukhoroslov/bagri

private PathExpression getCachedPathExpression(Query query, int pathId) {
  for (ExpressionContainer ec: query.getXdmQuery().getContainers()) {
    for (Expression ex: ec.getBuilder().getExpressions()) {
      if (ex.isCached()) {
        QueriedPath qp = ((PathExpression) ex).getCachedPath();
        if (qp.getPathIds().contains(pathId)) {
          return (PathExpression) ex;
        }
      }
    }
  }
  return null;
}

代码示例来源:origin: dsukhoroslov/bagri

@Override
public boolean addQuery(String query, boolean readOnly, QueryBuilder xdmQuery) {
  return addQuery(new Query(query, readOnly, xdmQuery));
}

代码示例来源:origin: dsukhoroslov/bagri

private boolean intersects(Query query, Collection<Integer> pathIds, boolean checkIndexed) {
  for (ExpressionContainer ec: query.getXdmQuery().getContainers()) {
    for (Expression ex: ec.getBuilder().getExpressions()) {
      if (ex.isCached()) {
        QueriedPath qp = ((PathExpression) ex).getCachedPath();
        if (!checkIndexed || qp.isIndexed()) {
          for (Integer pid: pathIds) {
            if (qp.getPathIds().contains(pid)) {
              return true;
            }
          }
        }
      }
    }
  }
  return false;
}

代码示例来源:origin: dsukhoroslov/bagri

@Override
public Query getCurrentQuery(final String query) throws XQException {
  QueryBuilder qb = clnFinder.getQuery();
  if (qb == null) {
    // not 'collection' query?
    // yes, it is 'document' or updating query, there is no QueryBuilder for it anyway!
    return null;
  }
  return new Query(query, isQueryReadOnly(query), qb);
}

代码示例来源:origin: dsukhoroslov/bagri

xdmQuery = xQuery.getXdmQuery();

代码示例来源:origin: dsukhoroslov/bagri

@Override
public Query read(ObjectDataInput in) throws IOException {
  return new Query(in.readUTF(),
      in.readBoolean(),
      (QueryBuilder) in.readObject());
}

相关文章