use of org.apache.jackrabbit.spi.commons.query.qom.BindVariableValueImpl in project jackrabbit by apache.
the class QueryObjectModelImpl method init.
/**
* Initializes a query instance from a query object model.
*
* @param sessionContext component context of the current session
* @param handler the query handler of the search index.
* @param qomTree the query object model tree.
* @param language the original query syntax from where the JQOM was
* created.
* @param node a nt:query node where the query was read from or
* <code>null</code> if it is not a stored query.
* @throws InvalidQueryException if the qom tree cannot be serialized
* according to the given language.
* @throws RepositoryException if another error occurs
*/
public void init(SessionContext sessionContext, QueryHandler handler, QueryObjectModelTree qomTree, String language, Node node) throws InvalidQueryException, RepositoryException {
checkNotInitialized();
this.sessionContext = sessionContext;
this.language = language;
this.handler = handler;
this.qomTree = qomTree;
this.node = node;
this.statement = QueryObjectModelBuilderRegistry.getQueryObjectModelBuilder(language).toString(this);
try {
qomTree.accept(new DefaultTraversingQOMTreeVisitor() {
@Override
public Object visit(BindVariableValueImpl node, Object data) {
variables.put(node.getBindVariableName(), null);
return data;
}
}, null);
} catch (Exception ignore) {
}
this.lqf = new LuceneQueryFactory(sessionContext.getSessionImpl(), (SearchIndex) handler, variables);
setInitialized();
}
Aggregations