Examples of ReferenceValue


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

    // parseReferenceValue
    // ----------------------------------------------------------------------------------------------------------------

    @Test
    public void shouldParseReferenceValueFromStringWithUnquotedSelectorNameAndUnquotedPropertyName() {
        ReferenceValue value = parser.parseReferenceValue(tokens("tableA.property"), typeSystem, mock(Join.class));
        assertThat(value.getPropertyName(), is("property"));
        assertThat(value.selectorName(), is(selectorName("tableA")));

        Source source = new NamedSelector(selectorName("tableA"));
        value = parser.parseReferenceValue(tokens("tableA.property"), typeSystem, source);
        assertThat(value.getPropertyName(), is("property"));
        assertThat(value.selectorName(), is(selectorName("tableA")));
    }
View Full Code Here

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

        assertThat(value.selectorName(), is(selectorName("tableA")));
    }

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

        Source source = new NamedSelector(selectorName("mode:tableA"));
        value = parser.parseReferenceValue(tokens("[mode:tableA].property"), typeSystem, source);
        assertThat(value.getPropertyName(), is("property"));
        assertThat(value.selectorName(), is(selectorName("mode:tableA")));
    }
View Full Code Here

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

        assertThat(value.selectorName(), is(selectorName("mode:tableA")));
    }

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

        Source source = new NamedSelector(selectorName("mode:tableA"));
        value = parser.parseReferenceValue(tokens("[mode:tableA].[mode:property]"), typeSystem, source);
        assertThat(value.getPropertyName(), is("mode:property"));
        assertThat(value.selectorName(), is(selectorName("mode:tableA")));
    }
View Full Code Here

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

    }

    @Test
    public void shouldParseReferenceValueFromStringWithOnlyPropertyNameIfSourceIsSelector() {
        Source source = new NamedSelector(selectorName("tableA"));
        ReferenceValue value = parser.parseReferenceValue(tokens("property)"), typeSystem, source);
        assertThat(value.getPropertyName(), is("property"));
        assertThat(value.selectorName(), is(selectorName("tableA")));
    }
View Full Code Here

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

    }

    @Test
    public void shouldParseReferenceValueFromStringWithMatchingSelectorNameIfSourceIsSelector() {
        Source source = new NamedSelector(selectorName("tableA"));
        ReferenceValue value = parser.parseReferenceValue(tokens("tableA)"), typeSystem, source);
        assertThat(value.getPropertyName(), is(nullValue()));
        assertThat(value.selectorName(), is(selectorName("tableA")));
    }
View Full Code Here

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

    }

    @Test
    public void shouldParseReferenceValueFromStringWithOnlySelectorNameIfSourceIsNotSelector() {
        Source source = mock(Join.class);
        ReferenceValue value = parser.parseReferenceValue(tokens("tableA)"), typeSystem, source);
        assertThat(value.getPropertyName(), is(nullValue()));
        assertThat(value.selectorName(), is(selectorName("tableA")));
    }
View Full Code Here

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

            return addOrdering(new PropertyValue(selector(table), property));
        }

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

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

        }

        @Override
        public OrderByBuilder referenceValue( String table,
                                              String property ) {
            return addOrdering(new ReferenceValue(selector(table), property));
        }
View Full Code Here

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

            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();
            String selectorName = refValue.selectorName().name();
            if (propertyName == null) {
                return createExtractReferencesFromRow(selectorName, context, columns, sources, defaultType);
            }
            return createExtractFromRow(selectorName, propertyName, context, columns, sources, defaultType, allowMultiValued);
        }
View Full Code Here

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

            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;
            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;
            SelectorName replacement = rewrittenSelectors.get(depth.selectorName());
            if (replacement == null) return operand;
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.