Examples of ChildCount


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

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

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

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

    protected NodePath nodePath( SelectorName selector ) {
        return new NodePath(selector);
    }

    protected ChildCount childCount( SelectorName selector ) {
        return new ChildCount(selector);
    }
View Full Code Here

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

                    return "(nodeDepth " + nodeDepth.getSelectorName() + ")";
                }
            };
        }
        if (operand instanceof ChildCount) {
            final ChildCount childCount = (ChildCount)operand;
            final int indexInRow = columns.getSelectorIndex(childCount.getSelectorName());
            final NodeCache cache = context.getNodeCache(sources.getWorkspaceName());
            final TypeFactory<?> longType = context.getTypeSystem().getLongFactory();
            return new ExtractFromRow() {
                @Override
                public TypeFactory<?> getType() {
                    return longType; // count 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.getChildReferences(cache).size());
                }

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

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

            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;
            return new ChildCount(replacement);
        }
        return operand;
    }
View Full Code Here

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

            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;
            node.addSelector(mapping.getSingleMappedSelectorName());
            return new ChildCount(mapping.getSingleMappedSelectorName());
        }
        return operand;
    }
View Full Code Here

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

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

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

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

         * @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 childCount( String table ) {
            return comparisonBuilder(new ChildCount(selector(table)));
        }
View Full Code Here

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

    @Test
    public void shouldParseDynamicOperandFromStringContainingChildCountOfSelector() {
        DynamicOperand operand = parser.parseDynamicOperand(tokens("CHILDCOUNT(tableA)"), typeSystem, mock(Source.class));
        assertThat(operand, is(instanceOf(ChildCount.class)));
        ChildCount count = (ChildCount)operand;
        assertThat(count.selectorName(), is(selectorName("tableA")));
    }
View Full Code Here

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

    @Test
    public void shouldParseDynamicOperandFromStringContainingChildCountWithNoSelectorOnlyIfThereIsOneSelectorAsSource() {
        Source source = new NamedSelector(selectorName("tableA"));
        DynamicOperand operand = parser.parseDynamicOperand(tokens("CHILDCOUNT()"), typeSystem, source);
        assertThat(operand, is(instanceOf(ChildCount.class)));
        ChildCount count = (ChildCount)operand;
        assertThat(count.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.