public void setResultType(Class resultType) { this.resultType = resultType; // Set it on the attribute expression as well if it is a function. if (getAttributeExpression()!=null && getAttributeExpression().isFunctionExpression()) { ((FunctionExpression) getAttributeExpression()).setResultType(resultType); } }
public void setResultType(Class resultType) { this.resultType = resultType; // Set it on the attribute expression as well if it is a function. if (getAttributeExpression()!=null && getAttributeExpression().isFunctionExpression()) { ((FunctionExpression) getAttributeExpression()).setResultType(resultType); } }
public void setResultType(Class resultType) { this.resultType = resultType; // Set it on the attribute expression as well if it is a function. if (getAttributeExpression()!=null && getAttributeExpression().isFunctionExpression()) { ((FunctionExpression) getAttributeExpression()).setResultType(resultType); } }
/** * INTERNAL: * Return the ordering query keys. * Used for Workbench integration. */ public List<Expression> getOrderByQueryKeyExpressions() { List<Expression> expressions = new ArrayList<Expression> (); if ((getSelectionQuery() != null) && getSelectionQuery().isReadAllQuery()) { for (Expression orderExpression : ((ReadAllQuery)getSelectionQuery()).getOrderByExpressions()) { if (orderExpression.isFunctionExpression() && ((FunctionExpression)orderExpression).getBaseExpression().isQueryKeyExpression()) { expressions.add(orderExpression); } } } return expressions; }
/** * INTERNAL: * Return the ordering query keys. * Used for Workbench integration. */ public List<Expression> getOrderByQueryKeyExpressions() { List<Expression> expressions = new ArrayList<Expression> (); if ((getSelectionQuery() != null) && getSelectionQuery().isReadAllQuery()) { for (Expression orderExpression : ((ReadAllQuery)getSelectionQuery()).getOrderByExpressions()) { if (orderExpression.isFunctionExpression() && ((FunctionExpression)orderExpression).getBaseExpression().isQueryKeyExpression()) { expressions.add(orderExpression); } } } return expressions; }
/** * INTERNAL: * Return the ordering query keys. * Used for Workbench integration. */ public List<Expression> getOrderByQueryKeyExpressions() { List<Expression> expressions = new ArrayList<Expression> (); if ((getSelectionQuery() != null) && getSelectionQuery().isReadAllQuery()) { for (Expression orderExpression : ((ReadAllQuery)getSelectionQuery()).getOrderByExpressions()) { if (orderExpression.isFunctionExpression() && ((FunctionExpression)orderExpression).getBaseExpression().isQueryKeyExpression()) { expressions.add(orderExpression); } } } return expressions; }
/** * INTERNAL: * Return if the represents an object comparison. */ protected boolean isObjectComparison() { if (isObjectComparisonExpression == null) { // PERF: direct-access. if ((!this.firstChild.isObjectExpression()) || ((ObjectExpression)this.firstChild).isAttribute()) { isObjectComparisonExpression = Boolean.FALSE; } else { DatabaseMapping mapping = ((ObjectExpression)this.firstChild).getMapping(); if ((mapping != null) && (mapping.isDirectCollectionMapping()) && !(this.firstChild.isMapEntryExpression())) { isObjectComparisonExpression = Boolean.FALSE; } else { isObjectComparisonExpression = Boolean.valueOf(this.secondChild.isObjectExpression() || (this.secondChild.isValueExpression() || (this.secondChild.isFunctionExpression() && ((FunctionExpression)this.secondChild).operator.isAnyOrAll()))); } } } return isObjectComparisonExpression.booleanValue(); }
Boolean asc = null; Boolean nullsFirst = null; if (orderBy.isFunctionExpression()) { if (base.getOperator().getSelector() == ExpressionOperator.NullsFirst) { nullsFirst = true; base = ((FunctionExpression)base).getChildren().get(0); if (base.isFunctionExpression()) { if (base.getOperator().getSelector() == ExpressionOperator.Ascending) { asc = true;
Boolean asc = null; Boolean nullsFirst = null; if (orderBy.isFunctionExpression()) { if (base.getOperator().getSelector() == ExpressionOperator.NullsFirst) { nullsFirst = true; base = (Expression)((FunctionExpression)base).getChildren().get(0); if (base.isFunctionExpression()) { if (base.getOperator().getSelector() == ExpressionOperator.Ascending) { asc = true;
/** * Append the order by expression to the sort row. */ protected void appendExpressionToSortRow(Expression expression, AbstractRecord row, DatabaseQuery query) { if (expression.isFunctionExpression()) { FunctionExpression function = (FunctionExpression)expression; if (function.getOperator().getSelector() == ExpressionOperator.Ascending) { Object field = extractValueFromExpression(function.getChildren().get(0), query); row.put(field, 1); } else if (function.getOperator().getSelector() == ExpressionOperator.Descending) { Object field = extractValueFromExpression(function.getChildren().get(0), query); row.put(field, -1); } else { throw new EISException("Query too complex for Mongo translation, order by [" + expression + "] not supported in query: " + query); } } else { Object field = extractValueFromExpression(expression, query); row.put(field, 1); } }
/** * When distinct is used with order by the ordered fields must be in the select clause. */ protected void addOrderByExpressionToSelectForDistinct() { for (Expression orderExpression : getOrderByExpressions()) { Expression fieldExpression = orderExpression; while (fieldExpression.isFunctionExpression() && (fieldExpression.getOperator().isOrderOperator())) { fieldExpression = ((FunctionExpression)fieldExpression).getBaseExpression(); } // Changed to call a method to loop through the fields vector and check each element // individually. Jon D. May 4, 2000 for pr 7811 if ((fieldExpression.selectIfOrderedBy()) && !fieldsContainField(getFields(), fieldExpression)) { addField(fieldExpression); } } }
/** * When distinct is used with order by the ordered fields must be in the select clause. */ protected void addOrderByExpressionToSelectForDistinct() { for (Expression orderExpression : getOrderByExpressions()) { Expression fieldExpression = orderExpression; while (fieldExpression.isFunctionExpression() && (fieldExpression.getOperator().isOrderOperator())) { fieldExpression = ((FunctionExpression)fieldExpression).getBaseExpression(); } // Changed to call a method to loop through the fields vector and check each element // individually. Jon D. May 4, 2000 for pr 7811 if ((fieldExpression.selectIfOrderedBy()) && !fieldsContainField(getFields(), fieldExpression)) { addField(fieldExpression); } } }
/** * When distinct is used with order by the ordered fields must be in the select clause. */ protected void addOrderByExpressionToSelectForDistinct() { for (Expression orderExpression : getOrderByExpressions()) { Expression fieldExpression = null; if (orderExpression.isFunctionExpression() && (orderExpression.getOperator().isOrderOperator())) { fieldExpression = ((FunctionExpression)orderExpression).getBaseExpression(); } else { fieldExpression = orderExpression; } // Changed to call a method to loop through the fields vector and check each element // individually. Jon D. May 4, 2000 for pr 7811 if ((fieldExpression.selectIfOrderedBy()) && !fieldsContainField(getFields(), fieldExpression)) { addField(fieldExpression); } } }
if(queryExpression.isFunctionExpression()) { Vector<Expression> children = ((org.eclipse.persistence.internal.expressions.FunctionExpression)queryExpression).getChildren(); int index = 1;
|| this.firstChild.isValueExpression() || this.firstChild.isSubSelectExpression() || (this.firstChild.isFunctionExpression() && ((FunctionExpression)this.firstChild).operator.isAnyOrAll())); || this.secondChild.isValueExpression() || this.secondChild.isSubSelectExpression() || (this.secondChild.isFunctionExpression() && ((FunctionExpression)this.secondChild).operator.isAnyOrAll()));
|| this.firstChild.isValueExpression() || this.firstChild.isSubSelectExpression() || (this.firstChild.isFunctionExpression() && ((FunctionExpression)this.firstChild).operator.isAnyOrAll())); || this.secondChild.isValueExpression() || this.secondChild.isSubSelectExpression() || (this.secondChild.isFunctionExpression() && ((FunctionExpression)this.secondChild).operator.isAnyOrAll()));
/** * 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); } }
/** * 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 : (Vector<Expression>) ((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); } }
if (this.attributeExpression != null) { DatabaseMapping mapping = this.attributeExpression.getLeafMapping(query, query.getDescriptor(), query.getSession()); if (mapping == null && this.attributeExpression.isFunctionExpression() && this.getResultType() == null){ FunctionExpression expression = ((FunctionExpression)this.attributeExpression); if (expression.getOperator().equals(ExpressionOperator.maximum()) || expression.getOperator().equals(ExpressionOperator.minimum())){
if (this.attributeExpression != null) { DatabaseMapping mapping = this.attributeExpression.getLeafMapping(query, query.getDescriptor(), query.getSession()); if (mapping == null && this.attributeExpression.isFunctionExpression() && this.getResultType() == null){ FunctionExpression expression = ((FunctionExpression)this.attributeExpression); if (expression.getOperator().equals(ExpressionOperator.maximum()) || expression.getOperator().equals(ExpressionOperator.minimum())){