Package org.modeshape.jcr.query.model

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


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

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


            SelectorName replacement = rewrittenSelectors.get(name.selectorName());
            if (replacement == null) return name;
            return new NodeName(replacement);
        }
        if (operand instanceof NodeLocalName) {
            NodeLocalName name = (NodeLocalName)operand;
            SelectorName replacement = rewrittenSelectors.get(name.selectorName());
            if (replacement == null) return name;
            return new NodeLocalName(replacement);
        }
        if (operand instanceof PropertyValue) {
            PropertyValue value = (PropertyValue)operand;
            SelectorName replacement = rewrittenSelectors.get(value.selectorName());
            if (replacement == null) return operand;
View Full Code Here

            if (!mapping.isMappedToSingleSelector()) return name;
            node.addSelector(mapping.getSingleMappedSelectorName());
            return new NodeName(mapping.getSingleMappedSelectorName());
        }
        if (operand instanceof NodeLocalName) {
            NodeLocalName name = (NodeLocalName)operand;
            if (!mapping.getOriginalName().equals(name.selectorName())) return name;
            if (!mapping.isMappedToSingleSelector()) return name;
            node.addSelector(mapping.getSingleMappedSelectorName());
            return new NodeLocalName(mapping.getSingleMappedSelectorName());
        }
        if (operand instanceof PropertyValue) {
            PropertyValue value = (PropertyValue)operand;
            if (!mapping.getOriginalName().equals(value.selectorName())) return value;
            Column sourceColumn = mapping.getMappedColumn(value.getPropertyName());
View Full Code Here

                    return "(nodeName " + nodeName.getSelectorName() + ")";
                }
            };
        }
        if (operand instanceof NodeLocalName) {
            final NodeLocalName nodeName = (NodeLocalName)operand;
            final int indexInRow = columns.getSelectorIndex(nodeName.getSelectorName());
            final NodeCache cache = context.getNodeCache(sources.getWorkspaceName());
            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;
                    Name name = node.getName(cache);
                    return name.getLocalName(); // works even for root
                }

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

            }
            if ("jcr:name".equals(property)) {
                return new NodeName(propValue.selectorName());
            }
            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)) {
View Full Code Here

    protected NodeName nodeName( SelectorName selector ) {
        return new NodeName(selector);
    }

    protected NodeLocalName nodeLocalName( SelectorName selector ) {
        return new NodeLocalName(selector);
    }
View Full Code Here

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

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

    @Test
    public void shouldParseDynamicOperandFromStringContainingLocalNameOfSelector() {
        DynamicOperand operand = parser.parseDynamicOperand(tokens("LOCALNAME(tableA)"), typeSystem, mock(Source.class));
        assertThat(operand, is(instanceOf(NodeLocalName.class)));
        NodeLocalName name = (NodeLocalName)operand;
        assertThat(name.selectorName(), is(selectorName("tableA")));
    }
View Full Code Here

    @Test
    public void shouldParseDynamicOperandFromStringContainingLocalNameWithNoSelectorOnlyIfThereIsOneSelectorAsSource() {
        Source source = new NamedSelector(selectorName("tableA"));
        DynamicOperand operand = parser.parseDynamicOperand(tokens("LOCALNAME()"), typeSystem, source);
        assertThat(operand, is(instanceOf(NodeLocalName.class)));
        NodeLocalName name = (NodeLocalName)operand;
        assertThat(name.selectorName(), is(selectorName("tableA")));
    }
View Full Code Here

TOP

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

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.