Module org.eclipse.persistence.core
Class ParseTree
java.lang.Object
org.eclipse.persistence.internal.jpa.parsing.ParseTree
- Direct Known Subclasses:
JPQLParseTree
INTERNAL
Purpose: A ParseTree contains Node(s). This contains a root Node and provides traversal utilities.
Responsibilities:
- Add parameters to the query
- Generate an expression for the query
- Answer true if the tree has parameters
- Maintain the primary class name for the query
- Maintain the root of the parse tree
- Maintain the context for the parse tree
- Maintain the distinct state for the parse tree
- Print the contents of the parse tree on a string
- Since:
- TopLink 4.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addGroupingToQuery
(ObjectLevelReadQuery theQuery, GenerationContext generationContext) INTERNAL Add the grouping to the passed queryvoid
addHavingToQuery
(ObjectLevelReadQuery theQuery, GenerationContext generationContext) INTERNAL Add the having to the passed queryvoid
addNonFetchJoinAttributes
(ObjectLevelReadQuery theQuery, GenerationContext generationContext) INTERNALvoid
addOrderingToQuery
(ObjectLevelReadQuery theQuery, GenerationContext generationContext) INTERNAL Add the ordering to the passed queryvoid
INTERNAL Add parameters to the queryvoid
addUpdatesToQuery
(UpdateAllQuery theQuery, GenerationContext generationContext) INTERNAL Add the updates to the passed queryvoid
adjustReferenceClassForQuery
(DatabaseQuery theQuery, GenerationContext generationContext) INTERNAL Adjust the reference class of the passed query if necessary Need to test this for Employee, employee.getAddress(), report queryvoid
applyQueryNodeToQuery
(DatabaseQuery theQuery, GenerationContext generationContext) INTERNAL Apply the select or update to the passed query.buildContext
(DatabaseQuery query, AbstractSession sessionForContext) INTERNAL Build the context to be used when generating the expression from the parse treebuildContextForReadQuery
(AbstractSession sessionForContext) INTERNAL Build the context to be used when generating the expression from the parse treeINTERNAL Returns a DatabaseQuery instance for this ParseTree.generateExpression
(DatabaseQuery readQuery, GenerationContext generationContext) INTERNAL Build a context for the expression generationINTERNAL Return a class loaderReturn the context for this parse treeshort
INTERNAL Return the DISTINCT state for the treeINTERNAL Return the FROM NodeINTERNAL Return the GroupByNodeINTERNAL Return the HavingNodeINTERNAL Return the OrderByNodeINTERNAL Return the root node for the treeClass
<?> getReferenceClass
(DatabaseQuery query, GenerationContext generationContext) getReferenceClass(): Answer the class which will be the reference class for the query.INTERNAL Return the set node for the treeINTERNAL Return the Where nodeboolean
INTERNAL Does this EJBQL have a Grouping Clauseboolean
INTERNAL Does this EJBQL have a Having Clauseboolean
INTERNAL Does this EJBQL have an Ordering Clausevoid
initBaseExpression
(ModifyAllQuery theQuery, GenerationContext generationContext) INTERNAL Initialize the base expression in the generation context.void
initBaseExpression
(ObjectLevelReadQuery theQuery, GenerationContext generationContext) INTERNAL Initialize the base expression in the generation context.protected void
qualifyAttributeAccess
(ParseTreeContext context) INTERNAL This method handles any unqualified field access in bulk UPDATE and DELETE statements.void
setClassLoader
(ClassLoader loader) INTERNAL: Set the class loader for this parse treevoid
setContext
(ParseTreeContext newContext) INTERNAL Set the context for this parse treevoid
setDistinctState
(short newDistinctState) INTERNAL Set the DISTINCT state for the treevoid
setFromNode
(FromNode fromNode) INTERNAL Set the FROM node for the queryvoid
setGroupByNode
(GroupByNode newGroupByNode) INTERNAL Set the Group by nodevoid
setHavingNode
(HavingNode newHavingNode) INTERNAL Set the Having nodevoid
setOrderByNode
(OrderByNode newOrderByNode) INTERNAL Set the Order by nodevoid
setQueryNode
(QueryNode newQueryNode) INTERNAL Set the Select nodevoid
setSelectionCriteriaForQuery
(DatabaseQuery theQuery, GenerationContext generationContext) void
setSetNode
(SetNode newSetNode) INTERNAL Set the Where nodevoid
setWhereNode
(WhereNode newWhereNode) INTERNAL Set the Where nodetoString()
INTERNAL Print the contents of the parse tree on a stringboolean
INTERNAL Answer true if DISTINCT has been chosen.void
validate
(ParseTreeContext context) INTERNAL Validate the parse tree.void
validate
(TypeHelper typeHelper) INTERNAL Validate the parse tree.protected void
validate
(AbstractSession session, ClassLoader classLoader) INTERNAL Validate the parse tree.void
verifySelect
(DatabaseQuery theQuery, GenerationContext generationContext) INTERNAL Verify that the alias in the SELECT is valid.
-
Constructor Details
-
ParseTree
public ParseTree()Return a new ParseTree.
-
-
Method Details
-
createDatabaseQuery
INTERNAL Returns a DatabaseQuery instance for this ParseTree. -
adjustReferenceClassForQuery
public void adjustReferenceClassForQuery(DatabaseQuery theQuery, GenerationContext generationContext) INTERNAL Adjust the reference class of the passed query if necessary Need to test this for Employee, employee.getAddress(), report query -
initBaseExpression
INTERNAL Initialize the base expression in the generation context. -
initBaseExpression
INTERNAL Initialize the base expression in the generation context. -
validate
INTERNAL Validate the parse tree. -
validate
INTERNAL Validate the parse tree. -
validate
INTERNAL Validate the parse tree. -
qualifyAttributeAccess
INTERNAL This method handles any unqualified field access in bulk UPDATE and DELETE statements. A UPDATE or DELETE statement may not define an identification variable. In this case any field accessed from the current class is not qualified with an identification variable, e.g. UPDATE Customer SET name = :newname The method goes through the expressions of the SET clause and the WHERE clause of such an DELETE and UPDATE statement and qualifies the field access using the abstract schema name as qualifier. -
addOrderingToQuery
INTERNAL Add the ordering to the passed query -
addGroupingToQuery
INTERNAL Add the grouping to the passed query -
addHavingToQuery
INTERNAL Add the having to the passed query -
addNonFetchJoinAttributes
public void addNonFetchJoinAttributes(ObjectLevelReadQuery theQuery, GenerationContext generationContext) INTERNAL -
addUpdatesToQuery
INTERNAL Add the updates to the passed query -
addParametersToQuery
INTERNAL Add parameters to the query -
applyQueryNodeToQuery
INTERNAL Apply the select or update to the passed query. If there is a single attribute being selected, add it to the query result set If an aggregate is being used, add it to the query result set -
buildContext
INTERNAL Build the context to be used when generating the expression from the parse tree -
buildContextForReadQuery
INTERNAL Build the context to be used when generating the expression from the parse tree -
generateExpression
INTERNAL Build a context for the expression generation -
getContext
Return the context for this parse tree -
getFromNode
INTERNAL Return the FROM Node -
getClassLoader
INTERNAL Return a class loader- Returns:
- java.lang.ClassLoader
-
getOrderByNode
INTERNAL Return the OrderByNode -
getGroupByNode
INTERNAL Return the GroupByNode -
getHavingNode
INTERNAL Return the HavingNode -
getReferenceClass
getReferenceClass(): Answer the class which will be the reference class for the query. Resolve this using the node parsed from the "SELECT" of the EJBQL query string -
getQueryNode
INTERNAL Return the root node for the tree -
getSetNode
INTERNAL Return the set node for the tree -
getWhereNode
INTERNAL Return the Where node -
getDistinctState
public short getDistinctState()INTERNAL Return the DISTINCT state for the tree -
hasOrderBy
public boolean hasOrderBy()INTERNAL Does this EJBQL have an Ordering Clause -
hasGroupBy
public boolean hasGroupBy()INTERNAL Does this EJBQL have a Grouping Clause -
hasHaving
public boolean hasHaving()INTERNAL Does this EJBQL have a Having Clause -
setClassLoader
INTERNAL: Set the class loader for this parse tree -
setContext
INTERNAL Set the context for this parse tree -
setFromNode
INTERNAL Set the FROM node for the query -
setOrderByNode
INTERNAL Set the Order by node -
setGroupByNode
INTERNAL Set the Group by node -
setHavingNode
INTERNAL Set the Having node -
setSelectionCriteriaForQuery
public void setSelectionCriteriaForQuery(DatabaseQuery theQuery, GenerationContext generationContext) -
setQueryNode
INTERNAL Set the Select node -
setSetNode
INTERNAL Set the Where node -
setWhereNode
INTERNAL Set the Where node -
setDistinctState
public void setDistinctState(short newDistinctState) INTERNAL Set the DISTINCT state for the tree -
toString
INTERNAL Print the contents of the parse tree on a string -
verifySelect
INTERNAL Verify that the alias in the SELECT is valid. Invalid: SELECT OBJECT(badAlias) FROM Employee employee.... Valid: SELECT OBJECT(employee) FROM Employee employee.... -
usesDistinct
public boolean usesDistinct()INTERNAL Answer true if DISTINCT has been chosen.
-