use of org.apache.jackrabbit.commons.query.QueryObjectModelBuilder in project jackrabbit by apache.
the class QueryManagerImpl method getQuery.
/**
* @see QueryManager#getQuery(Node)
*/
public Query getQuery(Node node) throws InvalidQueryException, RepositoryException {
checkIsAlive();
NamePathResolver resolver = mgrProvider.getNamePathResolver();
if (!node.isNodeType(resolver.getJCRName(NameConstants.NT_QUERY))) {
throw new InvalidQueryException("Node is not of type nt:query");
}
if (node.getSession() != session) {
throw new InvalidQueryException("Node belongs to a different session.");
}
String statement = node.getProperty(resolver.getJCRName(NameConstants.JCR_STATEMENT)).getString();
String language = node.getProperty(resolver.getJCRName(NameConstants.JCR_LANGUAGE)).getString();
if (Query.JCR_JQOM.equals(language)) {
QueryObjectModelFactory qomFactory = new QOMFactory(node, resolver);
QueryObjectModelBuilder builder = QueryObjectModelBuilderRegistry.getQueryObjectModelBuilder(language);
return builder.createQueryObjectModel(statement, qomFactory, valueFactory);
} else {
return new QueryImpl(session, mgrProvider, itemMgr, wspManager, statement, language, node);
}
}
Aggregations