本文整理了Java中com.bagri.core.model.Query
类的一些代码示例,展示了Query
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query
类的具体详情如下:
包路径:com.bagri.core.model.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());
}
内容来源于网络,如有侵权,请联系作者删除!