Examples of SameNode


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

                                                       selector);
        assertThat(constraint, is(instanceOf(Or.class)));
        Or or = (Or)constraint;

        assertThat(or.left(), is(instanceOf(SameNode.class)));
        SameNode first = (SameNode)or.left();
        assertThat(first.selectorName(), is(selectorName("tableA")));
        assertThat(first.getPath(), is("/a/b"));

        assertThat(or.right(), is(instanceOf(And.class)));
        And and = (And)or.right();

        assertThat(and.left(), is(instanceOf(SameNode.class)));
        SameNode second = (SameNode)and.left();
        assertThat(second.selectorName(), is(selectorName("tableA")));
        assertThat(second.getPath(), is("/c/d"));

        assertThat(and.right(), is(instanceOf(SameNode.class)));
        SameNode third = (SameNode)and.right();
        assertThat(third.selectorName(), is(selectorName("tableA")));
        assertThat(third.getPath(), is("/e/f"));
    }
View Full Code Here

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

                                                       selector);
        assertThat(constraint, is(instanceOf(And.class)));
        And and = (And)constraint;

        assertThat(and.left(), is(instanceOf(SameNode.class)));
        SameNode same = (SameNode)and.left();
        assertThat(same.selectorName(), is(selectorName("tableA")));
        assertThat(same.getPath(), is("/a/b/c"));

        assertThat(and.right(), is(instanceOf(FullTextSearch.class)));
        FullTextSearch search = (FullTextSearch)and.right();
        assertThat(search.selectorName(), is(selectorName("tableA")));
        assertThat(search.getPropertyName(), is("p1"));
View Full Code Here

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

                                                       selector);
        assertThat(constraint, is(instanceOf(And.class)));
        And and = (And)constraint;

        assertThat(and.left(), is(instanceOf(SameNode.class)));
        SameNode same = (SameNode)and.left();
        assertThat(same.selectorName(), is(selectorName("tableA")));
        assertThat(same.getPath(), is("/a/b/c"));

        assertThat(and.right(), is(instanceOf(And.class)));
        And secondAnd = (And)and.right();

        assertThat(secondAnd.left(), is(instanceOf(FullTextSearch.class)));
View Full Code Here

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

        Constraint constraint = parser.parseConstraint(tokens("ISSAMENODE('/a/b/c') OR CONTAINS(p1,term1)"), typeSystem, selector);
        assertThat(constraint, is(instanceOf(Or.class)));
        Or or = (Or)constraint;

        assertThat(or.left(), is(instanceOf(SameNode.class)));
        SameNode same = (SameNode)or.left();
        assertThat(same.selectorName(), is(selectorName("tableA")));
        assertThat(same.getPath(), is("/a/b/c"));

        assertThat(or.right(), is(instanceOf(FullTextSearch.class)));
        FullTextSearch search = (FullTextSearch)or.right();
        assertThat(search.selectorName(), is(selectorName("tableA")));
        assertThat(search.getPropertyName(), is("p1"));
View Full Code Here

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

    public void shouldParseConstraintFromStringWithNotSameNodeExpression() {
        Constraint constraint = parser.parseConstraint(tokens("NOT(ISSAMENODE(tableA,'/a/b/c'))"), typeSystem, mock(Source.class));
        assertThat(constraint, is(instanceOf(Not.class)));
        Not not = (Not)constraint;
        assertThat(not.getConstraint(), is(instanceOf(SameNode.class)));
        SameNode same = (SameNode)not.getConstraint();
        assertThat(same.selectorName(), is(selectorName("tableA")));
        assertThat(same.getPath(), is("/a/b/c"));
    }
View Full Code Here

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

    @Test
    public void shouldParseConstraintFromStringWithIsSameNodeExpressionWithPathOnlyIfThereIsOneSelectorSource() {
        NamedSelector selector = new NamedSelector(selectorName("tableA"));
        Constraint constraint = parser.parseConstraint(tokens("ISSAMENODE('/a/b/c')"), typeSystem, selector);
        assertThat(constraint, is(instanceOf(SameNode.class)));
        SameNode same = (SameNode)constraint;
        assertThat(same.selectorName(), is(selectorName("tableA")));
        assertThat(same.getPath(), is("/a/b/c"));
    }
View Full Code Here

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

    @Test
    public void shouldParseConstraintFromStringWithIsSameNodeExpressionWithSelectorNameAndPath() {
        Constraint constraint = parser.parseConstraint(tokens("ISSAMENODE(tableA,'/a/b/c')"), typeSystem, mock(Source.class));
        assertThat(constraint, is(instanceOf(SameNode.class)));
        SameNode same = (SameNode)constraint;
        assertThat(same.selectorName(), is(selectorName("tableA")));
        assertThat(same.getPath(), is("/a/b/c"));
    }
View Full Code Here

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

                    return "(filter " + Visitors.readable(constraint) + ")";
                }
            };
        }
        if (constraint instanceof SameNode) {
            SameNode sameNode = (SameNode)constraint;
            PathFactory paths = context.getExecutionContext().getValueFactories().getPathFactory();
            final Path path = paths.create(sameNode.getPath());
            final NodeCache cache = context.getNodeCache(sources.getWorkspaceName());
            final CachedNode node = sources.getNodeAtPath(path, cache);
            if (node == null) {
                return NodeSequence.NO_PASS_ROW_FILTER;
            }
            final NodeKey nodeKey = node.getKey();
            final String selectorName = sameNode.getSelectorName();
            final int index = columns.getSelectorIndex(selectorName);
            return new RowFilter() {
                @Override
                public boolean isCurrentRowValid( Batch batch ) {
                    CachedNode node = batch.getNode(index);
View Full Code Here

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

            Constraint wrapped = replaceReferencesToRemovedSource(context, not.getConstraint(), rewrittenSelectors);
            if (wrapped == not.getConstraint()) return not;
            return new Not(wrapped);
        }
        if (constraint instanceof SameNode) {
            SameNode sameNode = (SameNode)constraint;
            SelectorName replacement = rewrittenSelectors.get(sameNode.selectorName());
            if (replacement == null) return sameNode;
            return new SameNode(replacement, sameNode.getPath());
        }
        if (constraint instanceof ChildNode) {
            ChildNode childNode = (ChildNode)constraint;
            SelectorName replacement = rewrittenSelectors.get(childNode.selectorName());
            if (replacement == null) return childNode;
View Full Code Here

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

            Not not = (Not)constraint;
            Constraint wrapped = replaceReferences(context, not.getConstraint(), mapping, node);
            return wrapped == not.getConstraint() ? not : new Not(wrapped);
        }
        if (constraint instanceof SameNode) {
            SameNode sameNode = (SameNode)constraint;
            if (!mapping.getOriginalName().equals(sameNode.selectorName())) return sameNode;
            if (!mapping.isMappedToSingleSelector()) return sameNode;
            SelectorName selector = mapping.getSingleMappedSelectorName();
            node.addSelector(selector);
            return new SameNode(selector, sameNode.getPath());
        }
        if (constraint instanceof ChildNode) {
            ChildNode childNode = (ChildNode)constraint;
            if (!mapping.getOriginalName().equals(childNode.selectorName())) return childNode;
            if (!mapping.isMappedToSingleSelector()) return childNode;
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.