Package org.modeshape.jcr.query.plan

Examples of org.modeshape.jcr.query.plan.PlanNode.removeFromParent()


        // For each of the JOIN nodes ...
        for (PlanNode joinNode : plan.findAllAtOrBelow(Type.JOIN)) {
            if (JoinType.RIGHT_OUTER == joinNode.getProperty(Property.JOIN_TYPE, JoinType.class)) {
                // Swap the information ...
                PlanNode left = joinNode.getFirstChild();
                left.removeFromParent(); // right is now the first child ...
                left.setParent(joinNode);
                joinNode.setProperty(Property.JOIN_TYPE, JoinType.LEFT_OUTER);
                // None of the Constraints or JoinCondition need to be changed (they refer to named selectors) ...
            }
        }
View Full Code Here


            }

            JoinType joinType = join.getProperty(Property.JOIN_TYPE, JoinType.class);
            if (swapChildren) {
                PlanNode first = join.getFirstChild();
                first.removeFromParent();
                join.addLastChild(first);
                if (joinType == JoinType.LEFT_OUTER){
                    //we've reversed an outer join, so we need to change the join type
                    join.setProperty(Property.JOIN_TYPE, JoinType.RIGHT_OUTER);
                } else if (joinType == JoinType.RIGHT_OUTER) {
View Full Code Here

    protected void rewriteJoinNode( QueryContext context,
                                    PlanNode joinNode,
                                    Map<SelectorName, SelectorName> rewrittenSelectors ) {
        // Remove the right source node from the join node ...
        PlanNode rightChild = joinNode.getLastChild();
        rightChild.removeFromParent();
        PlanNode rightSource = rightChild.findAtOrBelow(Type.SOURCE);

        // Replace the join node with the left source node ...
        PlanNode leftChild = joinNode.getFirstChild();
        joinNode.extractFromParent();
View Full Code Here

                // Swap them so that duplicate removal happens first (it's lower in the plan) ...
                PlanNode parent = distinct.getParent();
                PlanNode sort = distinct.getFirstChild();
                assert sort.getParent() == distinct;
                // First, remove SORT from DUP_REMOVE (which will be empty) ...
                sort.removeFromParent();
                assert sort.getParent() == null;
                // Move all children of SORT into the currently-empty DUP_REMOVE ...
                distinct.addChildren(sort.getChildren());
                assert sort.getChildCount() == 0;
                assert sort.getParent() == 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.