Search in sources :

Example 1 with NodeTypeInfo

use of org.apache.jackrabbit.oak.query.ast.NodeTypeInfo in project jackrabbit-oak by apache.

the class NodeTypeIndexTest method createFilter.

private static FilterImpl createFilter(NodeState root, String nodeTypeName) {
    NodeTypeInfoProvider nodeTypes = new NodeStateNodeTypeInfoProvider(root);
    NodeTypeInfo type = nodeTypes.getNodeTypeInfo(nodeTypeName);
    SelectorImpl selector = new SelectorImpl(type, nodeTypeName);
    return new FilterImpl(selector, "SELECT * FROM [" + nodeTypeName + "]", new QueryEngineSettings());
}
Also used : FilterImpl(org.apache.jackrabbit.oak.query.index.FilterImpl) NodeTypeInfo(org.apache.jackrabbit.oak.query.ast.NodeTypeInfo) SelectorImpl(org.apache.jackrabbit.oak.query.ast.SelectorImpl) QueryEngineSettings(org.apache.jackrabbit.oak.query.QueryEngineSettings) NodeStateNodeTypeInfoProvider(org.apache.jackrabbit.oak.query.NodeStateNodeTypeInfoProvider) NodeTypeInfoProvider(org.apache.jackrabbit.oak.query.ast.NodeTypeInfoProvider) NodeStateNodeTypeInfoProvider(org.apache.jackrabbit.oak.query.NodeStateNodeTypeInfoProvider)

Example 2 with NodeTypeInfo

use of org.apache.jackrabbit.oak.query.ast.NodeTypeInfo in project jackrabbit-oak by apache.

the class IndexUpdateTest method find.

private Set<String> find(PropertyIndexLookup lookup, String name, String value) {
    NodeTypeInfoProvider nodeTypes = new NodeStateNodeTypeInfoProvider(root);
    NodeTypeInfo type = nodeTypes.getNodeTypeInfo(NT_BASE);
    SelectorImpl selector = new SelectorImpl(type, NT_BASE);
    Filter filter = new FilterImpl(selector, "SELECT * FROM [nt:base]", new QueryEngineSettings());
    return Sets.newHashSet(lookup.query(filter, name, PropertyValues.newString(value)));
}
Also used : FilterImpl(org.apache.jackrabbit.oak.query.index.FilterImpl) NodeTypeInfo(org.apache.jackrabbit.oak.query.ast.NodeTypeInfo) Filter(org.apache.jackrabbit.oak.spi.query.Filter) SelectorImpl(org.apache.jackrabbit.oak.query.ast.SelectorImpl) QueryEngineSettings(org.apache.jackrabbit.oak.query.QueryEngineSettings) NodeStateNodeTypeInfoProvider(org.apache.jackrabbit.oak.query.NodeStateNodeTypeInfoProvider) NodeTypeInfoProvider(org.apache.jackrabbit.oak.query.ast.NodeTypeInfoProvider) NodeStateNodeTypeInfoProvider(org.apache.jackrabbit.oak.query.NodeStateNodeTypeInfoProvider)

Example 3 with NodeTypeInfo

use of org.apache.jackrabbit.oak.query.ast.NodeTypeInfo in project jackrabbit-oak by apache.

the class SQL2Parser method parseSelector.

private SelectorImpl parseSelector() throws ParseException {
    String nodeTypeName = readName();
    if (namePathMapper != null) {
        try {
            nodeTypeName = namePathMapper.getOakName(nodeTypeName);
        } catch (RepositoryException e) {
            ParseException e2 = getSyntaxError("could not convert node type name " + nodeTypeName);
            e2.initCause(e);
            throw e2;
        }
    }
    NodeTypeInfo nodeTypeInfo = nodeTypes.getNodeTypeInfo(nodeTypeName);
    if (!nodeTypeInfo.exists()) {
        throw getSyntaxError("unknown node type");
    }
    String selectorName = nodeTypeName;
    if (readIf("AS")) {
        selectorName = readName();
    }
    return factory.selector(nodeTypeInfo, selectorName);
}
Also used : NodeTypeInfo(org.apache.jackrabbit.oak.query.ast.NodeTypeInfo) RepositoryException(javax.jcr.RepositoryException) ParseException(java.text.ParseException)

Example 4 with NodeTypeInfo

use of org.apache.jackrabbit.oak.query.ast.NodeTypeInfo in project jackrabbit-oak by apache.

the class ReferenceIndexTest method createFilter.

@SuppressWarnings("Duplicates")
private static FilterImpl createFilter(NodeState root, String nodeTypeName) {
    NodeTypeInfoProvider nodeTypes = new NodeStateNodeTypeInfoProvider(root);
    NodeTypeInfo type = nodeTypes.getNodeTypeInfo(nodeTypeName);
    SelectorImpl selector = new SelectorImpl(type, nodeTypeName);
    return new FilterImpl(selector, "SELECT * FROM [" + nodeTypeName + "]", new QueryEngineSettings());
}
Also used : FilterImpl(org.apache.jackrabbit.oak.query.index.FilterImpl) NodeTypeInfo(org.apache.jackrabbit.oak.query.ast.NodeTypeInfo) SelectorImpl(org.apache.jackrabbit.oak.query.ast.SelectorImpl) QueryEngineSettings(org.apache.jackrabbit.oak.query.QueryEngineSettings) NodeStateNodeTypeInfoProvider(org.apache.jackrabbit.oak.query.NodeStateNodeTypeInfoProvider) NodeTypeInfoProvider(org.apache.jackrabbit.oak.query.ast.NodeTypeInfoProvider) NodeStateNodeTypeInfoProvider(org.apache.jackrabbit.oak.query.NodeStateNodeTypeInfoProvider)

Example 5 with NodeTypeInfo

use of org.apache.jackrabbit.oak.query.ast.NodeTypeInfo in project jackrabbit-oak by apache.

the class IndexPathServiceImpl method createFilter.

private FilterImpl createFilter(String nodeTypeName) {
    NodeTypeInfoProvider nodeTypes = new NodeStateNodeTypeInfoProvider(nodeStore.getRoot());
    NodeTypeInfo type = nodeTypes.getNodeTypeInfo(nodeTypeName);
    SelectorImpl selector = new SelectorImpl(type, nodeTypeName);
    return new FilterImpl(selector, "SELECT * FROM [" + nodeTypeName + "]", settings);
}
Also used : FilterImpl(org.apache.jackrabbit.oak.query.index.FilterImpl) NodeTypeInfo(org.apache.jackrabbit.oak.query.ast.NodeTypeInfo) SelectorImpl(org.apache.jackrabbit.oak.query.ast.SelectorImpl) NodeStateNodeTypeInfoProvider(org.apache.jackrabbit.oak.query.NodeStateNodeTypeInfoProvider) NodeTypeInfoProvider(org.apache.jackrabbit.oak.query.ast.NodeTypeInfoProvider) NodeStateNodeTypeInfoProvider(org.apache.jackrabbit.oak.query.NodeStateNodeTypeInfoProvider)

Aggregations

NodeTypeInfo (org.apache.jackrabbit.oak.query.ast.NodeTypeInfo)12 NodeStateNodeTypeInfoProvider (org.apache.jackrabbit.oak.query.NodeStateNodeTypeInfoProvider)11 NodeTypeInfoProvider (org.apache.jackrabbit.oak.query.ast.NodeTypeInfoProvider)11 SelectorImpl (org.apache.jackrabbit.oak.query.ast.SelectorImpl)11 FilterImpl (org.apache.jackrabbit.oak.query.index.FilterImpl)10 QueryEngineSettings (org.apache.jackrabbit.oak.query.QueryEngineSettings)9 ParseException (java.text.ParseException)1 RepositoryException (javax.jcr.RepositoryException)1 Filter (org.apache.jackrabbit.oak.spi.query.Filter)1