public class JoinedAttributeManager
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable
Purpose: A common class to be used by ObjectLevelReadQueries and ReportItems. This Class will be used to store Joined Attribute Expressions. It will also store the indexes for object construction.
Constructor and Description |
---|
JoinedAttributeManager() |
JoinedAttributeManager(ClassDescriptor descriptor,
ExpressionBuilder baseBuilder,
ObjectBuildingQuery baseQuery) |
Modifier and Type | Method and Description |
---|---|
Expression |
addAndPrepareJoinedMapping(ForeignReferenceMapping mapping,
AbstractSession session)
Add the mapping for join fetch, prepare and return the join expression being used.
|
void |
addJoinedAttribute(Expression attributeExpression) |
void |
addJoinedAttributeExpression(Expression attributeExpression) |
void |
addJoinedMapping(java.lang.String attributeName)
Add an attribute represented by the given attribute name to the list of joins for this query.
|
void |
addJoinedMappingExpression(Expression mappingExpression)
Add an attribute represented by the given attribute name to the list of joins for this query.
|
void |
clear()
Clear the joining state.
|
void |
clearDataResults()
Clear the data-results for joined data for a 1-m join.
|
JoinedAttributeManager |
clone()
Clones the Joined Attribute Manager.
|
int |
computeJoiningMappingIndexes(boolean includeAllSubclassFields,
AbstractSession session,
int offset)
For joining the resulting rows include the field/values for many objects.
|
void |
computeJoiningMappingQueries(AbstractSession session)
Used to optimize joining by pre-computing the nested join queries for the mappings.
|
void |
copyFrom(JoinedAttributeManager otherJoinManager)
Copies settings from another manager.
|
java.util.List<Expression> |
getAdditionalFieldExpressions_()
Get the list of additional field expressions.
|
java.util.List<Expression> |
getAdditionalFieldExpressions()
Get the list of additional field expressions.
|
ExpressionBuilder |
getBaseExpressionBuilder()
Returns the base expression builder for this query.
|
ObjectBuildingQuery |
getBaseQuery()
Returns the base query.
|
java.util.List<AbstractRecord> |
getDataResults_()
Return all of the rows fetched by the query, used for 1-m joining.
|
java.util.Map<java.lang.Object,java.util.List<AbstractRecord>> |
getDataResultsByPrimaryKey()
Return all of the rows fetched by the query by cache-key, used for 1-m joining.
|
ClassDescriptor |
getDescriptor() |
java.util.List<DatabaseMapping> |
getJoinedAggregateMappings()
Return the attributes that must be joined.
|
java.util.List<Expression> |
getJoinedAttributeExpressions()
Return the attributes that must be joined.
|
java.util.List<DatabaseMapping> |
getJoinedAttributeMappings()
Return the attributes that must be joined.
|
java.util.List<Expression> |
getJoinedAttributes()
Return the attributes that must be joined.
|
java.util.List<Expression> |
getJoinedMappingExpressions()
Get the list of expressions that represent elements that are joined because of their
mapping for this query.
|
java.util.Map<DatabaseMapping,java.lang.Object> |
getJoinedMappingIndexes_()
Return the joined mapping indexes, used to compute mapping row partitions.
|
java.util.Map<DatabaseMapping,ObjectLevelReadQuery> |
getJoinedMappingQueries_()
Return the joined mapping queries, used optimize joining, only compute the nested queries once.
|
java.util.Map<DatabaseMapping,ObjectLevelReadQuery> |
getJoinedMappingQueryClones() |
ObjectLevelReadQuery |
getNestedJoinedMappingQuery(Expression expression)
INTERNAL:
Returns the nested query corresponding to the expression.
|
java.util.List<Expression> |
getOrderByExpressions_()
Get the list of orderBy expressions.
|
java.util.List<Expression> |
getOrderByExpressions()
Get the list of orderBy expressions.
|
int |
getParentResultIndex() |
java.lang.Object |
getValueFromObjectForExpression(AbstractSession session,
java.lang.Object clone,
ObjectExpression expression)
INTERNAL:
Helper method to get the value from the clone for the expression passed in, triggering joins on
all intermediate steps.
|
boolean |
hasAdditionalFieldExpressions()
Return if there are additional field expressions.
|
boolean |
hasJoinedAttributeExpressions()
Return the attributes that must be joined.
|
boolean |
hasJoinedAttributes()
Return if any attributes are joined.
|
boolean |
hasJoinedExpressions()
This method checks both attribute expressions and mapping expressions and
determines if there are any joins to be made.
|
boolean |
hasJoinedMappingExpressions()
Return the attributes that must be joined.
|
boolean |
hasOrderByExpressions()
Return if there are orderBy expressions.
|
boolean |
hasOuterJoinedAttributeQuery()
PERF: Return if the query uses any outer attribute joins, used to avoid null checks in building objects.
|
boolean |
isAttributeJoined(ClassDescriptor mappingDescriptor,
DatabaseMapping attributeMapping)
Return if the attribute is specified for joining.
|
boolean |
isToManyJoin()
Return if the query uses any -m joins, and thus return duplicate/multiple rows.
|
void |
prepareJoinExpressions(AbstractSession session)
Validate and prepare join expressions.
|
AbstractRecord |
processDataResults(AbstractRecord row,
Cursor cursor,
boolean forward)
Process the data-results for joined data for a 1-m join.
|
void |
processJoinedMappings(AbstractSession session)
This method collects the Joined Mappings from the descriptor and initializes them.
|
void |
reset()
Reset the JoinedAttributeManager.
|
void |
setAdditionalFieldExpressions_(java.util.List<Expression> expressions)
Set the list of additional field expressions.
|
void |
setBaseQuery(ObjectLevelReadQuery query)
This method is called from within this package it is used when
initializing a report Item
|
void |
setDataResults(java.util.List dataResults,
AbstractSession session)
Set all of the rows fetched by the query, used for 1-m joining.
|
void |
setDescriptor(ClassDescriptor descriptor)
Called to set the descriptor on a Join Managerwith in a ReportItem, durring
initialization, and durring DatabaseQuery.checkDescriptor.
|
void |
setIsToManyJoinQuery(boolean isToManyJoin)
Set if the query uses any -m joins, and thus return duplicate/multiple rows.
|
void |
setJoinedAttributeExpressions_(java.util.List joinedExpressions)
Set the list of expressions that represent elements that are joined because of their
mapping for this query.
|
void |
setJoinedMappingExpressions_(java.util.List joinedMappingExpressions)
Set the list of expressions that represent elements that are joined because of their
mapping for this query.
|
void |
setJoinedMappingIndexes_(java.util.Map joinedMappingIndexes)
Set the joined mapping indexes, used to compute mapping row partitions.
|
void |
setJoinedMappingQueries_(java.util.Map joinedMappingQueries)
Set the joined mapping queries, used optimize joining, only compute the nested queries once.
|
void |
setJoinedMappingQueryClones(java.util.Map joinedMappingQueryClones) |
void |
setOrderByExpressions_(java.util.List<Expression> expressions)
Set the list of orderBy expressions.
|
void |
setParentResultIndex(int parentsResultIndex) |
void |
setShouldFilterDuplicates(boolean shouldFilterDuplicates)
Set if duplicate rows should be filter when using 1-m joining.
|
ForUpdateOfClause |
setupLockingClauseForJoinedExpressions(ForUpdateOfClause lockingClause,
AbstractSession session)
Used for joining in conjunction with pessimistic locking.
|
boolean |
shouldFilterDuplicates()
Return if duplicate rows should be filter when using 1-m joining.
|
public JoinedAttributeManager()
public JoinedAttributeManager(ClassDescriptor descriptor, ExpressionBuilder baseBuilder, ObjectBuildingQuery baseQuery)
public boolean shouldFilterDuplicates()
public void setShouldFilterDuplicates(boolean shouldFilterDuplicates)
public void addJoinedAttribute(Expression attributeExpression)
public void addJoinedAttributeExpression(Expression attributeExpression)
public void addJoinedMappingExpression(Expression mappingExpression)
public void addJoinedMapping(java.lang.String attributeName)
public JoinedAttributeManager clone()
clone
in class java.lang.Object
public void copyFrom(JoinedAttributeManager otherJoinManager)
public void clear()
public int computeJoiningMappingIndexes(boolean includeAllSubclassFields, AbstractSession session, int offset)
public void computeJoiningMappingQueries(AbstractSession session)
public java.util.List<Expression> getAdditionalFieldExpressions()
public java.util.List<Expression> getAdditionalFieldExpressions_()
public ExpressionBuilder getBaseExpressionBuilder()
public ObjectBuildingQuery getBaseQuery()
public java.util.List<AbstractRecord> getDataResults_()
public ClassDescriptor getDescriptor()
public boolean hasAdditionalFieldExpressions()
public void setAdditionalFieldExpressions_(java.util.List<Expression> expressions)
public java.util.List<DatabaseMapping> getJoinedAggregateMappings()
public java.util.List<Expression> getJoinedAttributeExpressions()
public java.util.List<DatabaseMapping> getJoinedAttributeMappings()
public java.util.List<Expression> getJoinedAttributes()
public java.util.List<Expression> getJoinedMappingExpressions()
public boolean hasJoinedAttributeExpressions()
public boolean hasJoinedExpressions()
public boolean hasJoinedMappingExpressions()
public boolean hasJoinedAttributes()
public boolean hasOuterJoinedAttributeQuery()
public java.util.List<Expression> getOrderByExpressions()
public java.util.List<Expression> getOrderByExpressions_()
public java.lang.Object getValueFromObjectForExpression(AbstractSession session, java.lang.Object clone, ObjectExpression expression)
session
- clone
- expression
- public boolean hasOrderByExpressions()
public void setOrderByExpressions_(java.util.List<Expression> expressions)
public boolean isToManyJoin()
public boolean isAttributeJoined(ClassDescriptor mappingDescriptor, DatabaseMapping attributeMapping)
public void setJoinedAttributeExpressions_(java.util.List joinedExpressions)
public void setJoinedMappingExpressions_(java.util.List joinedMappingExpressions)
public java.util.Map<DatabaseMapping,java.lang.Object> getJoinedMappingIndexes_()
public java.util.Map<DatabaseMapping,ObjectLevelReadQuery> getJoinedMappingQueries_()
public ObjectLevelReadQuery getNestedJoinedMappingQuery(Expression expression)
public void setJoinedMappingQueries_(java.util.Map joinedMappingQueries)
public void setJoinedMappingIndexes_(java.util.Map joinedMappingIndexes)
public void setIsToManyJoinQuery(boolean isToManyJoin)
public void prepareJoinExpressions(AbstractSession session)
public void processJoinedMappings(AbstractSession session)
public Expression addAndPrepareJoinedMapping(ForeignReferenceMapping mapping, AbstractSession session)
public void reset()
public void setBaseQuery(ObjectLevelReadQuery query)
public java.util.Map<java.lang.Object,java.util.List<AbstractRecord>> getDataResultsByPrimaryKey()
public void setDataResults(java.util.List dataResults, AbstractSession session)
public void clearDataResults()
public AbstractRecord processDataResults(AbstractRecord row, Cursor cursor, boolean forward)
public void setDescriptor(ClassDescriptor descriptor)
public ForUpdateOfClause setupLockingClauseForJoinedExpressions(ForUpdateOfClause lockingClause, AbstractSession session)
public void setParentResultIndex(int parentsResultIndex)
public int getParentResultIndex()
public java.util.Map<DatabaseMapping,ObjectLevelReadQuery> getJoinedMappingQueryClones()
public void setJoinedMappingQueryClones(java.util.Map joinedMappingQueryClones)
EclipseLink 2.6.3, "build v20160428-59c81c5" API Reference