Package org.modeshape.jcr.query.model

Examples of org.modeshape.jcr.query.model.NodePath


    protected NodePath nodePath( String selectorName ) {
        return nodePath(selector(selectorName));
    }

    protected NodePath nodePath( SelectorName selectorName ) {
        return new NodePath(selectorName);
    }
View Full Code Here


        assertThat(constraint, is(instanceOf(Or.class)));
        return (Or)constraint;
    }

    protected NodePath nodePath( SelectorName name ) {
        return new NodePath(name);
    }
View Full Code Here

        assertThat(constraint, is(instanceOf(Or.class)));
        return (Or)constraint;
    }

    protected NodePath nodePath( SelectorName name ) {
        return new NodePath(name);
    }
View Full Code Here

            return addOrdering(new NodeDepth(selector(table)));
        }

        @Override
        public OrderByBuilder path( String table ) {
            return addOrdering(new NodePath(selector(table)));
        }
View Full Code Here

            SelectorName replacement = rewrittenSelectors.get(depth.selectorName());
            if (replacement == null) return operand;
            return new NodeDepth(replacement);
        }
        if (operand instanceof NodePath) {
            NodePath path = (NodePath)operand;
            SelectorName replacement = rewrittenSelectors.get(path.selectorName());
            if (replacement == null) return operand;
            return new NodePath(replacement);
        }
        if (operand instanceof ChildCount) {
            ChildCount count = (ChildCount)operand;
            SelectorName replacement = rewrittenSelectors.get(count.selectorName());
            if (replacement == null) return operand;
View Full Code Here

            if (!mapping.isMappedToSingleSelector()) return depth;
            node.addSelector(mapping.getSingleMappedSelectorName());
            return new NodeDepth(mapping.getSingleMappedSelectorName());
        }
        if (operand instanceof NodePath) {
            NodePath path = (NodePath)operand;
            if (!mapping.getOriginalName().equals(path.selectorName())) return path;
            if (!mapping.isMappedToSingleSelector()) return path;
            node.addSelector(mapping.getSingleMappedSelectorName());
            return new NodePath(mapping.getSingleMappedSelectorName());
        }
        if (operand instanceof ChildCount) {
            ChildCount count = (ChildCount)operand;
            if (!mapping.getOriginalName().equals(count.selectorName())) return count;
            if (!mapping.isMappedToSingleSelector()) return count;
View Full Code Here

                    return "(nodeId " + nodeId.getSelectorName() + ")";
                }
            };
        }
        if (operand instanceof NodePath) {
            final NodePath nodePath = (NodePath)operand;
            final int indexInRow = columns.getSelectorIndex(nodePath.getSelectorName());
            final NodeCache cache = context.getNodeCache(sources.getWorkspaceName());
            if (isLike) {
                return new ExtractFromRow() {
                    @Override
                    public TypeFactory<?> getType() {
                        return stringFactory;
                    }

                    @Override
                    public Object getValueInRow( RowAccessor row ) {
                        CachedNode node = row.getNode(indexInRow);
                        if (node == null) return null;
                        Path path = node.getPath(cache);
                        if (path.isRoot()) {
                            return stringFactory.create(path);
                        }
                        // And the path that always has the SNS index ...
                        StringBuilder sb = new StringBuilder();
                        for (Path.Segment segment : path) {
                            // Add the segment WITH the index ...
                            sb.append("/");
                            sb.append(stringFactory.create(segment.getName()));
                            sb.append('[').append(segment.getIndex()).append(']');
                        }
                        return sb.toString();
                    }

                    @Override
                    public String toString() {
                        return "(nodePath " + nodePath.getSelectorName() + ")";
                    }
                };
            }
            // Otherwise, just return the single path ...
            return new ExtractFromRow() {
                @Override
                public TypeFactory<?> getType() {
                    return stringFactory;
                }

                @Override
                public Object getValueInRow( RowAccessor row ) {
                    CachedNode node = row.getNode(indexInRow);
                    if (node == null) return null;
                    Path path = node.getPath(cache);
                    return stringFactory.create(path);
                }

                @Override
                public String toString() {
                    return "(nodePath " + nodePath.getSelectorName() + ")";
                }
            };
        }
        if (operand instanceof NodeName) {
            final NodeName nodeName = (NodeName)operand;
View Full Code Here

                                      DynamicOperand operand ) {
        if (operand instanceof PropertyValue) {
            PropertyValue propValue = (PropertyValue)operand;
            String property = propValue.getPropertyName();
            if ("jcr:path".equals(property)) {
                return new NodePath(propValue.selectorName());
            }
            if ("jcr:name".equals(property)) {
                return new NodeName(propValue.selectorName());
            }
            if ("mode:localName".equals(property) || "jcr:localName".equals(property)) {
View Full Code Here

            DynamicOperand left = comparison.getOperand1();
            if (left instanceof PropertyValue) {
                PropertyValue propValue = (PropertyValue)left;
                if ("jcr:path".equals(propValue.getPropertyName())) {
                    // Rewrite this constraint as a PATH criteria ...
                    NodePath path = new NodePath(propValue.selectorName());
                    return new Comparison(path, comparison.operator(), comparison.getOperand2());
                }
                if ("jcr:score".equals(propValue.getPropertyName())) {
                    // Rewrite this constraint as a SCORE criteria ...
                    FullTextSearchScore score = new FullTextSearchScore(propValue.selectorName());
View Full Code Here

    protected NodeId nodeId( SelectorName selector ) {
        return new NodeId(selector);
    }

    protected NodePath nodePath( SelectorName selector ) {
        return new NodePath(selector);
    }
View Full Code Here

TOP

Related Classes of org.modeshape.jcr.query.model.NodePath

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.