Examples of NodeDepth


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

            }
            if ("mode:localName".equals(property) || "jcr:localName".equals(property)) {
                return new NodeLocalName(propValue.selectorName());
            }
            if ("mode:depth".equals(property) || "jcr:depth".equals(property)) {
                return new NodeDepth(propValue.selectorName());
            }
            if ("mode:id".equals(property)) {
                return new NodeId(propValue.selectorName());
            }
            if ("jcr:score".equals(property)) {
View Full Code Here

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

                    return "(uppercase " + delegate + ")";
                }
            };
        }
        if (operand instanceof NodeDepth) {
            final NodeDepth nodeDepth = (NodeDepth)operand;
            final int indexInRow = columns.getSelectorIndex(nodeDepth.getSelectorName());
            final NodeCache cache = context.getNodeCache(sources.getWorkspaceName());
            final TypeFactory<?> longType = context.getTypeSystem().getLongFactory();
            return new ExtractFromRow() {
                @Override
                public TypeFactory<?> getType() {
                    return longType; // depth is always a long type
                }

                @Override
                public Object getValueInRow( RowAccessor row ) {
                    CachedNode node = row.getNode(indexInRow);
                    if (node == null) return null;
                    return new Long(node.getDepth(cache));
                }

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

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

    protected NodeLocalName nodeLocalName( SelectorName selector ) {
        return new NodeLocalName(selector);
    }

    protected NodeDepth nodeDepth( SelectorName selector ) {
        return new NodeDepth(selector);
    }
View Full Code Here

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

            return comparisonBuilder(new ChildCount(selector(table)));
        }

        @Override
        public ComparisonBuilder depth( String table ) {
            return comparisonBuilder(new NodeDepth(selector(table)));
        }
View Full Code Here

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

         * @param table the name of the table; may not be null and must refer to a valid name or alias of a table appearing in the
         *        FROM clause
         * @return the interface for completing the value portion of the criteria specification; never null
         */
        public ComparisonBuilder depth( String table ) {
            return comparisonBuilder(new NodeDepth(selector(table)));
        }
View Full Code Here

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

    @Test
    public void shouldParseDynamicOperandFromStringContainingDepthOfSelector() {
        DynamicOperand operand = parser.parseDynamicOperand(tokens("DEPTH(tableA)"), typeSystem, mock(Source.class));
        assertThat(operand, is(instanceOf(NodeDepth.class)));
        NodeDepth depth = (NodeDepth)operand;
        assertThat(depth.selectorName(), is(selectorName("tableA")));
    }
View Full Code Here

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

    @Test
    public void shouldParseDynamicOperandFromStringContainingDepthWithNoSelectorOnlyIfThereIsOneSelectorAsSource() {
        Source source = new NamedSelector(selectorName("tableA"));
        DynamicOperand operand = parser.parseDynamicOperand(tokens("DEPTH()"), typeSystem, source);
        assertThat(operand, is(instanceOf(NodeDepth.class)));
        NodeDepth depth = (NodeDepth)operand;
        assertThat(depth.selectorName(), is(selectorName("tableA")));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.