public void addChild(Expression child) { getChildren().addElement(child); }
public void addChild(Expression child) { getChildren().addElement(child); }
public void addChild(Expression child) { getChildren().addElement(child); }
/** * INTERNAL: * Compute a consistent hash-code for the expression. * This is used to allow dynamic expression's SQL to be cached. */ public int computeHashCode() { int hashCode = super.computeHashCode(); if (this.operator != null) { hashCode = hashCode + this.operator.hashCode(); } List children = getChildren(); int size = children.size(); for (int index = 0; index < size; index++) { hashCode = hashCode + children.get(index).hashCode(); } return hashCode; }
@Override public void postBuild(DescriptorEvent event) { FunctionExpression expression = (FunctionExpression)event.getObject(); for (int index = 0; index < expression.getChildren().size(); index++) { Expression child = expression.getChildren().get(index); if (child.isValueExpression()) { child.setLocalBase(new ExpressionBuilder()); } } if (expression.getChildren().size() > 0) { expression.setBaseExpression(expression.getChildren().get(0)); } else { expression.setBaseExpression(new ExpressionBuilder()); } } });
public void postBuild(DescriptorEvent event) { FunctionExpression expression = (FunctionExpression)event.getObject(); for (int index = 0; index < expression.getChildren().size(); index++) { Expression child = (Expression)expression.getChildren().get(index); if (child.isValueExpression()) { child.setLocalBase(new ExpressionBuilder()); } } if (expression.getChildren().size() > 0) { expression.setBaseExpression((Expression)expression.getChildren().get(0)); } else { expression.setBaseExpression(new ExpressionBuilder()); } } });
/** * INTERNAL: * Compute a consistent hash-code for the expression. * This is used to allow dynamic expression's SQL to be cached. */ @Override public int computeHashCode() { int hashCode = super.computeHashCode(); if (this.operator != null) { hashCode = hashCode + this.operator.hashCode(); } List<?> children = getChildren(); int size = children.size(); for (int index = 0; index < size; index++) { hashCode = hashCode + children.get(index).hashCode(); } return hashCode; }
public void postBuild(DescriptorEvent event) { FunctionExpression expression = (FunctionExpression)event.getObject(); for (int index = 0; index < expression.getChildren().size(); index++) { Expression child = (Expression)expression.getChildren().get(index); if (child.isValueExpression()) { child.setLocalBase(new ExpressionBuilder()); } } if (expression.getChildren().size() > 0) { expression.setBaseExpression((Expression)expression.getChildren().get(0)); } else { expression.setBaseExpression(new ExpressionBuilder()); } } });
/** * INTERNAL: * Add a child and ensure it is the rightmost in the tree as long as it * is in the tree * If there is already a node that is set as therightmost node, replace it * @param argument */ public synchronized void addRightMostChild(Expression argument){ if (hasLastChild != null && hasLastChild.booleanValue()){ getChildren().remove(super.getChildren().size() - 1); super.addChild(argument); } else { this.addChild(argument); } this.hasLastChild = Boolean.valueOf(true); }
/** * INTERNAL: * Add a child and ensure it is the rightmost in the tree as long as it * is in the tree * If there is already a node that is set as therightmost node, replace it * @param argument */ public synchronized void addRightMostChild(Expression argument){ if (hasLastChild != null && hasLastChild.booleanValue()){ getChildren().remove(super.getChildren().size() - 1); super.addChild(argument); } else { this.addChild(argument); } this.hasLastChild = Boolean.TRUE; }
/** * INTERNAL: * Add a child and ensure it is the rightmost in the tree as long as it * is in the tree * If there is already a node that is set as therightmost node, replace it * @param argument */ public synchronized void addRightMostChild(Expression argument){ if (hasLastChild != null && hasLastChild.booleanValue()){ getChildren().remove(super.getChildren().size() - 1); super.addChild(argument); } else { this.addChild(argument); } this.hasLastChild = Boolean.TRUE; }
return false; List<?> children = getChildren(); List<?> otherChildren = expression.getChildren(); int size = children.size(); if (size != otherChildren.size()) {
return false; List children = getChildren(); List otherChildren = expression.getChildren(); int size = children.size(); if (size != otherChildren.size()) {
/** * INTERNAL: * Compute a consistent hash-code for the expression. * This is used to allow dynamic expression's SQL to be cached. */ public int computeHashCode() { int hashCode = super.computeHashCode(); if (getOperator() != null) { hashCode = hashCode + getOperator().hashCode(); } List children = getChildren(); int size = children.size(); for (int index = 0; index < size; index++) { hashCode = hashCode + children.get(index).hashCode(); } return hashCode; }
return false; List children = getChildren(); List otherChildren = expression.getChildren(); int size = children.size(); if (size != otherChildren.size()) {
/** * 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); } }
/** * Create a negation of the given restriction. * * @param restriction * restriction expression * @return not predicate */ public Predicate not(Expression<Boolean> restriction){ if (((InternalExpression)restriction).isPredicate()){ return ((Predicate)restriction).not(); } org.eclipse.persistence.expressions.Expression parentNode = null; List<Expression<?>> compoundExpressions = null; String name = "not"; if (((InternalExpression)restriction).isCompoundExpression() && ((CompoundExpressionImpl)restriction).getOperation().equals("exists")){ FunctionExpression exp = (FunctionExpression) ((InternalSelection)restriction).getCurrentNode(); SubSelectExpression sub = (SubSelectExpression) exp.getChildren().get(0); parentNode = ExpressionOperator.getOperator(Integer.valueOf(ExpressionOperator.NotExists)).expressionFor(sub); name = "notExists"; compoundExpressions = ((CompoundExpressionImpl)restriction).getChildExpressions(); }else{ parentNode = ((InternalSelection)restriction).getCurrentNode().not(); compoundExpressions = buildList(restriction); } CompoundExpressionImpl expr = new CompoundExpressionImpl(this.metamodel, parentNode, compoundExpressions, name); expr.setIsNegated(true); return expr; }
funcExp.getChildren().set(funcExp.getChildren().indexOf(baseIn), this.currentNode);
/** * 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); } }