use of org.eclipse.persistence.internal.expressions.BaseExpression in project eclipselink by eclipse-ee4j.
the class JoinedAttributeManager method addExpressionAndBaseToGroupedList.
/**
* adds expression and its base expressions recursively to the expressionList in groups, so that an expression is never listed before
* its base expression
*/
protected Expression addExpressionAndBaseToGroupedList(Expression expression, List expressionlist, Expression lastJoinedAttributeBaseExpression) {
if (!expressionlist.contains(expression)) {
int baseExpressionIndex = -1;
// better than using instanceof BaseExpression. If its not an objectExpression, it will get an exception in prepare anyway
boolean sameBase = false;
if ((expression.isObjectExpression())) {
Expression baseExpression = ((BaseExpression) expression).getBaseExpression();
// filter out aggregate expressions between this and the next node.
while (!baseExpression.isExpressionBuilder() && ((QueryKeyExpression) baseExpression).getMapping().isAggregateMapping()) {
baseExpression = ((BaseExpression) baseExpression).getBaseExpression();
}
if (baseExpression != null && !baseExpression.isExpressionBuilder()) {
addExpressionAndBaseToGroupedList(baseExpression, expressionlist, lastJoinedAttributeBaseExpression);
// EL bug 307497
if (baseExpression != lastJoinedAttributeBaseExpression) {
baseExpressionIndex = getJoinedAttributeExpressions().indexOf(baseExpression);
} else {
sameBase = true;
}
}
}
// EL bug 307497
if (baseExpressionIndex == -1) {
expressionlist.add(expression);
if (!sameBase) {
lastJoinedAttributeBaseExpression = expression;
}
} else {
// Add attributeExpression at baseExpressionIndex + 1.
expressionlist.add(baseExpressionIndex + 1, expression);
}
}
return lastJoinedAttributeBaseExpression;
}
Aggregations