public class SelectorImpl extends SourceImpl
Constructor and Description |
---|
SelectorImpl(NodeTypeInfo nodeTypeInfo,
java.lang.String selectorName) |
Modifier and Type | Method and Description |
---|---|
void |
addJoinCondition(JoinConditionImpl joinCondition,
boolean forThisSelector)
Add the join condition (the ON ...
|
protected PropertyValue |
convertValueToType(PropertyValue v,
PropertyValue targetType) |
SourceImpl |
copyOf() |
FilterImpl |
createFilter(boolean preparing)
Create the filter condition for planning or execution.
|
PropertyValue |
currentOakProperty(java.lang.String oakPropertyName)
Get the property value.
|
java.lang.String |
currentPath()
Get the current absolute Oak path (normalized).
|
PropertyValue |
currentProperty(java.lang.String propertyName)
The value for the given selector for the current node.
|
PropertyValue |
currentProperty(java.lang.String propertyName,
int propertyType)
The value for the given selector for the current node, filtered by
property type.
|
@Nullable Tree |
currentTree()
Get the tree at the current path.
|
boolean |
equals(java.lang.Object other) |
void |
execute(NodeState rootState)
Execute the query.
|
SelectorExecutionPlan |
getExecutionPlan() |
java.lang.String |
getIndexCostInfo(NodeState rootState)
Get the index cost as a JSON string.
|
java.util.ArrayList<SourceImpl> |
getInnerJoinSelectors()
Get all sources that are joined via inner join.
|
protected java.lang.String |
getLocalPath(java.lang.String path)
Calculate the session local path (the path excluding the workspace name)
if possible.
|
@NotNull java.util.Set<java.lang.String> |
getMixinTypes() |
java.lang.String |
getNodeType() |
java.lang.String |
getPlan(NodeState rootState)
Get the query plan.
|
@NotNull java.util.Set<java.lang.String> |
getPrimaryTypes() |
QueryImpl |
getQuery() |
long |
getScanCount() |
SelectorImpl |
getSelector(java.lang.String selectorName)
Get the selector with the given name, or null if not found.
|
java.util.List<ConstraintImpl> |
getSelectorConstraints() |
java.lang.String |
getSelectorName() |
long |
getSize(NodeState rootState,
Result.SizePrecision precision,
long max)
Get the size if known.
|
@NotNull java.util.Set<java.lang.String> |
getSupertypes() |
java.lang.Iterable<java.lang.String> |
getWildcardColumns() |
int |
hashCode() |
boolean |
isOuterJoinRightHandSide()
Whether any selector is the outer-join right hand side.
|
boolean |
isPrepared() |
boolean |
isVirtualRow() |
boolean |
matchesAllTypes() |
boolean |
next()
Go to the next node for the given source.
|
protected java.lang.String |
normalizePath(java.lang.String path)
Validate and normalize the path.
|
protected java.lang.String |
normalizePropertyName(java.lang.String propertyName)
Normalize the property name (including namespace remapping).
|
ExecutionPlan |
prepare()
Prepare executing the query (recursively).
|
void |
prepare(ExecutionPlan p)
Re-apply a previously prepared plan.
|
protected java.lang.String |
protect(java.lang.Object expression) |
protected java.lang.String |
quote(java.lang.String pathOrName) |
protected java.lang.String |
quoteJson(java.lang.String string) |
void |
restrictSelector(ConstraintImpl constraint) |
void |
setOuterJoin(boolean outerJoinLeftHandSide,
boolean outerJoinRightHandSide)
Set whether this source is the left hand side or right hand side of a left outer join.
|
void |
setQuery(QueryImpl query) |
void |
setQueryConstraint(ConstraintImpl queryConstraint)
Set the complete constraint of the query (the WHERE ...
|
java.lang.String |
toString() |
void |
unprepare()
Undo a prepare.
|
getExistingSelector, getInnerJoinConditions
protected QueryImpl query
public SelectorImpl(NodeTypeInfo nodeTypeInfo, java.lang.String selectorName)
public java.lang.String getSelectorName()
public java.lang.String getNodeType()
public boolean matchesAllTypes()
@NotNull public @NotNull java.util.Set<java.lang.String> getSupertypes()
matchesAllTypes
flag is set@NotNull public @NotNull java.util.Set<java.lang.String> getPrimaryTypes()
matchesAllTypes
flag is set@NotNull public @NotNull java.util.Set<java.lang.String> getMixinTypes()
matchesAllTypes
flag is setpublic java.lang.Iterable<java.lang.String> getWildcardColumns()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean isPrepared()
public void unprepare()
SourceImpl
unprepare
in class SourceImpl
public void prepare(ExecutionPlan p)
SourceImpl
prepare
in class SourceImpl
p
- the plan to usepublic ExecutionPlan prepare()
SourceImpl
prepare
in class SourceImpl
public SelectorExecutionPlan getExecutionPlan()
public void setQueryConstraint(ConstraintImpl queryConstraint)
SourceImpl
setQueryConstraint
in class SourceImpl
queryConstraint
- the constraintpublic void setOuterJoin(boolean outerJoinLeftHandSide, boolean outerJoinRightHandSide)
SourceImpl
setOuterJoin
in class SourceImpl
outerJoinLeftHandSide
- true if yesouterJoinRightHandSide
- true if yespublic void addJoinCondition(JoinConditionImpl joinCondition, boolean forThisSelector)
SourceImpl
addJoinCondition
in class SourceImpl
joinCondition
- the join conditionforThisSelector
- if set, the join condition can only be evaluated
when all previous selectors are executed.public void execute(NodeState rootState)
SourceImpl
execute
in class SourceImpl
rootState
- root state of the given revisionpublic java.lang.String getPlan(NodeState rootState)
SourceImpl
getPlan
in class SourceImpl
rootState
- the rootpublic java.lang.String getIndexCostInfo(NodeState rootState)
SourceImpl
getIndexCostInfo
in class SourceImpl
rootState
- the rootpublic FilterImpl createFilter(boolean preparing)
createFilter
in class SourceImpl
preparing
- whether a filter for the prepare phase should be madepublic boolean next()
SourceImpl
next
in class SourceImpl
public java.lang.String currentPath()
@Nullable public @Nullable Tree currentTree()
public PropertyValue currentProperty(java.lang.String propertyName)
propertyName
- the JCR (not normalized) property namepublic PropertyValue currentProperty(java.lang.String propertyName, int propertyType)
propertyName
- the JCR (not normalized) property namepropertyType
- only include properties of this typepublic PropertyValue currentOakProperty(java.lang.String oakPropertyName)
oakPropertyName
- (must already be normalized)public boolean isVirtualRow()
public SelectorImpl getSelector(java.lang.String selectorName)
SourceImpl
getSelector
in class SourceImpl
selectorName
- the selector namepublic long getScanCount()
public void restrictSelector(ConstraintImpl constraint)
public java.util.List<ConstraintImpl> getSelectorConstraints()
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.util.ArrayList<SourceImpl> getInnerJoinSelectors()
SourceImpl
getInnerJoinSelectors
in class SourceImpl
public boolean isOuterJoinRightHandSide()
SourceImpl
isOuterJoinRightHandSide
in class SourceImpl
public QueryImpl getQuery()
public long getSize(NodeState rootState, Result.SizePrecision precision, long max)
SourceImpl
getSize
in class SourceImpl
rootState
- the root node state (to initialize the cursor, if needed)precision
- the required precisionmax
- the maximum nodes read (for an exact size)public SourceImpl copyOf()
AstElement
returns same reference
to this
.protected java.lang.String protect(java.lang.Object expression)
protected java.lang.String quote(java.lang.String pathOrName)
protected java.lang.String quoteJson(java.lang.String string)
public void setQuery(QueryImpl query)
protected java.lang.String normalizePropertyName(java.lang.String propertyName)
propertyName
- the property name to normalizeprotected java.lang.String normalizePath(java.lang.String path)
path
- the path to validateprotected PropertyValue convertValueToType(PropertyValue v, PropertyValue targetType)
protected java.lang.String getLocalPath(java.lang.String path)
path
- the absolute pathCopyright © 2012–2022 The Apache Software Foundation. All rights reserved.