use of org.eclipse.persistence.internal.expressions.CompoundExpression in project eclipselink by eclipse-ee4j.
the class DescriptorQueryManager method updatePropertyParameterExpression.
/**
* INTERNAL:
* This method will walk the given expression and mark any parameter
* expressions as property expressions. This is done when additional
* criteria has been specified and parameter values must be resolved
* through session properties.
*
* @see #postInitialize
*/
protected void updatePropertyParameterExpression(Expression exp) {
if (exp.isCompoundExpression()) {
updatePropertyParameterExpression(((CompoundExpression) exp).getFirstChild());
updatePropertyParameterExpression(((CompoundExpression) exp).getSecondChild());
} else if (exp.isFunctionExpression()) {
for (Expression e : ((FunctionExpression) exp).getChildren()) {
updatePropertyParameterExpression(e);
}
} else if (exp.isSubSelectExpression()) {
ReportQuery subSelectQuery = ((SubSelectExpression) exp).getSubQuery();
for (ReportItem item : subSelectQuery.getItems()) {
updatePropertyParameterExpression(item.getAttributeExpression());
}
}
if (exp.isParameterExpression()) {
((ParameterExpression) exp).setIsProperty(true);
}
}
use of org.eclipse.persistence.internal.expressions.CompoundExpression in project eclipselink by eclipse-ee4j.
the class InImpl method value.
/**
* Add to list of values to be tested against.
* @param value expression
* @return in predicate
*/
@Override
public In<T> value(Expression<? extends T> value) {
if (!(((InternalExpression) value).isLiteral() || ((InternalExpression) value).isParameter())) {
RelationExpression baseIn = (RelationExpression) this.currentNode;
this.currentNode = baseIn.getFirstChild().in(((SubQueryImpl) value).subQuery);
if (this.parentNode != null) {
if (this.parentNode.isCompoundExpression()) {
CompoundExpression logExp = (LogicalExpression) this.parentNode;
if (logExp.getFirstChild() == baseIn) {
logExp.create(this.currentNode, logExp.getSecondChild(), logExp.getOperator());
} else {
logExp.create(logExp.getFirstChild(), this.currentNode, logExp.getOperator());
}
} else {
FunctionExpression funcExp = (FunctionExpression) this.parentNode;
funcExp.getChildren().set(funcExp.getChildren().indexOf(baseIn), this.currentNode);
}
}
} else {
if (this.currentNode.isRelationExpression()) {
RelationExpression baseIn = (RelationExpression) this.currentNode;
org.eclipse.persistence.expressions.Expression resultExp = ((InternalSelection) value).getCurrentNode();
resultExp = org.eclipse.persistence.expressions.Expression.from(resultExp, baseIn.getFirstChild());
((Collection) ((CollectionExpression) baseIn.getSecondChild()).getValue()).add(resultExp);
// Add to the expression list for #findRootAndParameters()
this.expressions.add(value);
} else {
throw new IllegalStateException(ExceptionLocalization.buildMessage("CANNOT_ADD_CONSTANTS_TO_SUBQUERY_IN"));
}
}
return this;
}
Aggregations