Package org.modeshape.jcr.query.model

Examples of org.modeshape.jcr.query.model.PropertyValue.selectorName()


    @Test
    public void shouldParsePropertyValueFromStringWithUnquotedSelectorNameAndUnquotedPropertyName() {
        PropertyValue value = parser.parsePropertyValue(tokens("tableA.property"), typeSystem, mock(Join.class));
        assertThat(value.getPropertyName(), is("property"));
        assertThat(value.selectorName(), is(selectorName("tableA")));
    }

    @Test
    public void shouldParsePropertyValueFromStringWithQuotedSelectorNameAndUnquotedPropertyName() {
        PropertyValue value = parser.parsePropertyValue(tokens("[mode:tableA].property"), typeSystem, mock(Join.class));
View Full Code Here


    @Test
    public void shouldParsePropertyValueFromStringWithQuotedSelectorNameAndUnquotedPropertyName() {
        PropertyValue value = parser.parsePropertyValue(tokens("[mode:tableA].property"), typeSystem, mock(Join.class));
        assertThat(value.getPropertyName(), is("property"));
        assertThat(value.selectorName(), is(selectorName("mode:tableA")));
    }

    @Test
    public void shouldParsePropertyValueFromStringWithQuotedSelectorNameAndQuotedPropertyName() {
        PropertyValue value = parser.parsePropertyValue(tokens("[mode:tableA].[mode:property]"), typeSystem, mock(Join.class));
View Full Code Here

    @Test
    public void shouldParsePropertyValueFromStringWithQuotedSelectorNameAndQuotedPropertyName() {
        PropertyValue value = parser.parsePropertyValue(tokens("[mode:tableA].[mode:property]"), typeSystem, mock(Join.class));
        assertThat(value.getPropertyName(), is("mode:property"));
        assertThat(value.selectorName(), is(selectorName("mode:tableA")));
    }

    @Test
    public void shouldParsePropertyValueFromStringWithOnlyPropertyNameIfSourceIsSelector() {
        Source source = new NamedSelector(selectorName("tableA"));
View Full Code Here

    @Test
    public void shouldParsePropertyValueFromStringWithOnlyPropertyNameIfSourceIsSelector() {
        Source source = new NamedSelector(selectorName("tableA"));
        PropertyValue value = parser.parsePropertyValue(tokens("property"), typeSystem, source);
        assertThat(value.getPropertyName(), is("property"));
        assertThat(value.selectorName(), is(selectorName("tableA")));
    }

    @Test( expected = ParsingException.class )
    public void shouldFailToParsePropertyValueFromStringWithOnlyPropertyNameIfSourceIsNotSelector() {
        parser.parsePropertyValue(tokens("property"), typeSystem, mock(Join.class));
View Full Code Here

        assert columns != null;
        assert sources != null;
        if (operand instanceof PropertyValue) {
            PropertyValue propValue = (PropertyValue)operand;
            String propertyName = propValue.getPropertyName();
            String selectorName = propValue.selectorName().name();
            return createExtractFromRow(selectorName, propertyName, context, columns, sources, defaultType, allowMultiValued);
        }
        if (operand instanceof ReferenceValue) {
            ReferenceValue refValue = (ReferenceValue)operand;
            String propertyName = refValue.getPropertyName();
View Full Code Here

        }
        if (operand instanceof Length) {
            Length length = (Length)operand;
            final PropertyValue value = length.getPropertyValue();
            String propertyName = value.getPropertyName();
            String selectorName = value.selectorName().name();
            final ExtractFromRow getPropValue = createExtractFromRow(selectorName, propertyName, context, columns, sources,
                                                                     defaultType, allowMultiValued);
            final TypeFactory<?> longType = context.getTypeSystem().getLongFactory();
            return new ExtractFromRow() {
                @Override
View Full Code Here

            return new FullTextSearchScore(replacement);
        }
        if (operand instanceof Length) {
            Length operation = (Length)operand;
            PropertyValue wrapped = operation.getPropertyValue();
            SelectorName replacement = rewrittenSelectors.get(wrapped.selectorName());
            if (replacement == null) return operand;
            return new Length(new PropertyValue(replacement, wrapped.getPropertyName()));
        }
        if (operand instanceof LowerCase) {
            LowerCase operation = (LowerCase)operand;
View Full Code Here

            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;
            return new PropertyValue(replacement, value.getPropertyName());
        }
        if (operand instanceof ReferenceValue) {
            ReferenceValue value = (ReferenceValue)operand;
View Full Code Here

            if (replacement == null) return operand;
            return new PropertyValue(replacement, value.getPropertyName());
        }
        if (operand instanceof ReferenceValue) {
            ReferenceValue value = (ReferenceValue)operand;
            SelectorName replacement = rewrittenSelectors.get(value.selectorName());
            if (replacement == null) return operand;
            return new ReferenceValue(replacement, value.getPropertyName());
        }
        if (operand instanceof NodeDepth) {
            NodeDepth depth = (NodeDepth)operand;
View Full Code Here

            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());
            if (sourceColumn == null) {
                if (mapping.getMappedSelectorNames().size() == 1) {
                    SelectorName newSelectorName = mapping.getSingleMappedSelectorName();
                    if (newSelectorName != null) {
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.