Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ModeShape Distribution 3.0.0.Alpha6
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.modeshape.jcr.query.plan
Class PlanUtil

    java.lang.Object
      org.modeshape.jcr.query.plan.PlanUtil

    public class PlanUtil

extends Object

Utilities for working with `PlanNode`s.

Nested Class Summary
`protected static class` | `PlanUtil.AbsentColumn`
`static class` | `PlanUtil.ColumnMapping` Defines how the view columns are mapped (or resolved) into the columns from the source tables.
`protected static class` | `PlanUtil.RequiredColumnVisitor`

Constructor Summary
`PlanUtil()`

Method Summary
`static PlanNode` | `addMissingProjectColumns(QueryContext context, PlanNode node, List<Column> allProjectedColumns)`
`static PlanUtil.ColumnMapping` | `createMappingFor(Schemata.View view, PlanNode viewPlan)`
`static PlanUtil.ColumnMapping` | `createMappingForAliased(SelectorName tableAlias, Schemata.Table table, PlanNode tableSourceNode)`
`static PlanUtil.ColumnMapping` | `createMappingForAliased(SelectorName viewAlias, Schemata.View view, PlanNode viewPlan)`
`static List<Column>` | `findRequiredColumns(QueryContext context, PlanNode planNode)` Collected the minimum set of columns from the supplied table that are required by or used within the plan at the supplied node or above.
`static List<String>` | `findRequiredColumnTypes(QueryContext context, List<Column> columns, PlanNode node)`
`static Constraint` | `replaceAliasesWithProperties(QueryContext context, Constraint constraint, Map<String,String> propertyByAlias)`
`static DynamicOperand` | `replaceAliasesWithProperties(QueryContext context, DynamicOperand operand, Map<String,String> propertyByAlias)`
`protected static PropertyValue` | `replaceAliasesWithProperties(QueryContext context, PropertyValue value, Map<String,String> propertyByAlias)`
`static Constraint` | `replaceReferences(QueryContext context, Constraint constraint, PlanUtil.ColumnMapping mapping, PlanNode node)`
`static Constraint` | `replaceReferencesToRemovedSource(QueryContext context, Constraint constraint, Map<SelectorName,SelectorName> rewrittenSelectors)`
`static DynamicOperand` | `replaceReferencesToRemovedSource(QueryContext context, DynamicOperand operand, Map<SelectorName,SelectorName> rewrittenSelectors)`
`static JoinCondition` | `replaceReferencesToRemovedSource(QueryContext context, JoinCondition joinCondition, Map<SelectorName,SelectorName> rewrittenSelectors)`
`static void` | `replaceReferencesToRemovedSource(QueryContext context, PlanNode planNode, Map<SelectorName,SelectorName> rewrittenSelectors)`
`static Constraint` | `replaceSubqueriesWithBindVariables(QueryContext context, Constraint constraint, Map<String,Subquery> subqueriesByVariableName)`
`static StaticOperand` | `replaceSubqueriesWithBindVariables(QueryContext context, StaticOperand staticOperand, Map<String,Subquery> subqueriesByVariableName)`
`static DynamicOperand` | `replaceViewReferences(QueryContext context, DynamicOperand operand, PlanUtil.ColumnMapping mapping, PlanNode node)`
`static JoinCondition` | `replaceViewReferences(QueryContext context, JoinCondition joinCondition, PlanUtil.ColumnMapping mapping, PlanNode node)`
`static void` | `replaceViewReferences(QueryContext context, PlanNode topOfViewInPlan, PlanUtil.ColumnMapping mappings)`
`protected static void` | `replaceViewReferences(QueryContext context, PlanNode node, PlanUtil.ColumnMapping mappings, SelectorName viewName, List<PlanNode> potentiallyRemovableSources)`
`static void` | `setSelectorsOnSubplan(PlanNode subplan, Set<SelectorName> selectors)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### PlanUtil

    public PlanUtil()

Method Detail

### findRequiredColumns

    public static List<Column> findRequiredColumns(QueryContext context,
                                                   PlanNode planNode)

  Collected the minimum set of columns from the supplied table that are required by or used within the plan at the supplied node or above. This method first looks to see if the supplied node is a `PlanNode.Type.PROJECT` node, and if so immediately returns that node's list of `projected columns`. Otherwise, this method finds all of the `PlanNode.Type.SOURCE` nodes below the supplied plan node, and accumulates the set of sources for which the columns are to be found. The method then walks up the plan, looking for references to columns of the supplied table, starting with the supplied node and walking up until a `PROJECT` node is found or the top of the plan is reached.

  The resulting column list will always contain at the front the `columns` from the nearest PROJECT ancestor, followed by any columns required by criteria. This is done so that the processing of the nearest PROJECT ancestor node can simply use the sublist of each tuple.

  Parameters:
    `context` - the query context; may not be null
    `planNode` - the plan node at which the required columns need to be found; may not be null
  Returns:
    the list of `Column` objects that are used in the plan; never null but possibly empty if no columns are actually needed

### findRequiredColumnTypes

    public static List<String> findRequiredColumnTypes(QueryContext context,
                                                       List<Column> columns,
                                                       PlanNode node)

### replaceReferencesToRemovedSource

    public static void replaceReferencesToRemovedSource(QueryContext context,
                                                        PlanNode planNode,
                                                        Map<SelectorName,SelectorName> rewrittenSelectors)

### replaceReferencesToRemovedSource

    public static DynamicOperand replaceReferencesToRemovedSource(QueryContext context,
                                                                  DynamicOperand operand,
                                                                  Map<SelectorName,SelectorName> rewrittenSelectors)

### replaceReferencesToRemovedSource

    public static Constraint replaceReferencesToRemovedSource(QueryContext context,
                                                              Constraint constraint,
                                                              Map<SelectorName,SelectorName> rewrittenSelectors)

### replaceReferencesToRemovedSource

    public static JoinCondition replaceReferencesToRemovedSource(QueryContext context,
                                                                 JoinCondition joinCondition,
                                                                 Map<SelectorName,SelectorName> rewrittenSelectors)

### replaceViewReferences

    public static void replaceViewReferences(QueryContext context,
                                             PlanNode topOfViewInPlan,
                                             PlanUtil.ColumnMapping mappings)

### replaceViewReferences

    protected static void replaceViewReferences(QueryContext context,
                                                PlanNode node,
                                                PlanUtil.ColumnMapping mappings,
                                                SelectorName viewName,
                                                List<PlanNode> potentiallyRemovableSources)

### replaceReferences

    public static Constraint replaceReferences(QueryContext context,
                                               Constraint constraint,
                                               PlanUtil.ColumnMapping mapping,
                                               PlanNode node)

### replaceViewReferences

    public static DynamicOperand replaceViewReferences(QueryContext context,
                                                       DynamicOperand operand,
                                                       PlanUtil.ColumnMapping mapping,
                                                       PlanNode node)

### replaceViewReferences

    public static JoinCondition replaceViewReferences(QueryContext context,
                                                      JoinCondition joinCondition,
                                                      PlanUtil.ColumnMapping mapping,
                                                      PlanNode node)

### createMappingFor

    public static PlanUtil.ColumnMapping createMappingFor(Schemata.View view,
                                                          PlanNode viewPlan)

### createMappingForAliased

    public static PlanUtil.ColumnMapping createMappingForAliased(SelectorName viewAlias,
                                                                 Schemata.View view,
                                                                 PlanNode viewPlan)

### createMappingForAliased

    public static PlanUtil.ColumnMapping createMappingForAliased(SelectorName tableAlias,
                                                                 Schemata.Table table,
                                                                 PlanNode tableSourceNode)

### setSelectorsOnSubplan

    public static void setSelectorsOnSubplan(PlanNode subplan,
                                             Set<SelectorName> selectors)

### replaceAliasesWithProperties

    public static Constraint replaceAliasesWithProperties(QueryContext context,
                                                          Constraint constraint,
                                                          Map<String,String> propertyByAlias)

### replaceAliasesWithProperties

    protected static PropertyValue replaceAliasesWithProperties(QueryContext context,
                                                                PropertyValue value,
                                                                Map<String,String> propertyByAlias)

### replaceAliasesWithProperties

    public static DynamicOperand replaceAliasesWithProperties(QueryContext context,
                                                              DynamicOperand operand,
                                                              Map<String,String> propertyByAlias)

### replaceSubqueriesWithBindVariables

    public static Constraint replaceSubqueriesWithBindVariables(QueryContext context,
                                                                Constraint constraint,
                                                                Map<String,Subquery> subqueriesByVariableName)

### replaceSubqueriesWithBindVariables

    public static StaticOperand replaceSubqueriesWithBindVariables(QueryContext context,
                                                                   StaticOperand staticOperand,
                                                                   Map<String,Subquery> subqueriesByVariableName)

### addMissingProjectColumns

    public static PlanNode addMissingProjectColumns(QueryContext context,
                                                    PlanNode node,
                                                    List<Column> allProjectedColumns)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ModeShape Distribution 3.0.0.Alpha6
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.