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()); } } });
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()); } } });
@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()); } } });
Expression key = iterator.next(); expression.addChild(key); expression.setBaseExpression(key);//base needs to be the same as the first child for reportQuery items. expression.addChild(Expression.from(caseConditions.get(key), this));
Expression key = iterator.next(); expression.addChild(key); expression.setBaseExpression(key);//base needs to be the same as the first child for reportQuery items. expression.addChild(Expression.from(caseConditions.get(key), this));
expression.setBaseExpression(this); expression.addChild(this); Iterator iterator = decodeableItems.keySet().iterator();
/** * PUBLIC: * return a string that represents the given part of a date. The equivalent * of the Sybase DATENAME function * <p>Example: * <blockquote><pre> * TopLink: employee.get("date").dateName("year") * Java: new String(date.getYear()) * SQL: DATENAME(date, year) * </blockquote></pre> * */ public Expression dateName(String datePart) { ExpressionOperator anOperator = getOperator(ExpressionOperator.DateName); FunctionExpression expression = new FunctionExpression(); expression.setBaseExpression(this); expression.addChild(Expression.fromLiteral(datePart, this)); expression.addChild(this); expression.setOperator(anOperator); return expression; }
/** * PUBLIC: * return a string that represents the given part of a date. The equivalent * of the Sybase DATENAME function * <p>Example: * <blockquote><pre> * EclipseLink: employee.get("date").dateName("year") * Java: new String(date.getYear()) * SQL: DATENAME(date, year) * </pre></blockquote> */ public Expression dateName(String datePart) { ExpressionOperator anOperator = getOperator(ExpressionOperator.DateName); FunctionExpression expression = new FunctionExpression(); expression.setBaseExpression(this); expression.addChild(Expression.fromLiteral(datePart, this)); expression.addChild(this); expression.setOperator(anOperator); return expression; }
/** * PUBLIC: * Function return an integer which represents the requested * part of the date. Equivalent of the Sybase function DATEPART * <p>Example: * <blockquote><pre> * TopLink: employee.get("date").datePart("year") * Java: date.getYear() * SQL: DATEPART(date, year) * </blockquote></pre> * */ public Expression datePart(String datePart) { ExpressionOperator anOperator = getOperator(ExpressionOperator.DatePart); FunctionExpression expression = new FunctionExpression(); expression.setBaseExpression(this); expression.addChild(Expression.fromLiteral(datePart, this)); expression.addChild(this); expression.setOperator(anOperator); return expression; }
/** * PUBLIC: * Function return an integer which represents the requested * part of the date. Equivalent of the Sybase function DATEPART * <p>Example: * <blockquote><pre> * EclipseLink: employee.get("date").datePart("year") * Java: date.getYear() * SQL: DATEPART(date, year) * </pre></blockquote> */ public Expression datePart(String datePart) { ExpressionOperator anOperator = getOperator(ExpressionOperator.DatePart); FunctionExpression expression = new FunctionExpression(); expression.setBaseExpression(this); expression.addChild(Expression.fromLiteral(datePart, this)); expression.addChild(this); expression.setOperator(anOperator); return expression; }
/** * PUBLIC: * Function return an integer which represents the requested * part of the date. Equivalent of the Sybase function DATEPART * <p>Example: * <blockquote><pre> * EclipseLink: employee.get("date").datePart("year") * Java: date.getYear() * SQL: DATEPART(date, year) * </pre></blockquote> */ public Expression datePart(String datePart) { ExpressionOperator anOperator = getOperator(ExpressionOperator.DatePart); FunctionExpression expression = new FunctionExpression(); expression.setBaseExpression(this); expression.addChild(Expression.fromLiteral(datePart, this)); expression.addChild(this); expression.setOperator(anOperator); return expression; }
/** * PUBLIC: * return a string that represents the given part of a date. The equivalent * of the Sybase DATENAME function * <p>Example: * <blockquote><pre> * EclipseLink: employee.get("date").dateName("year") * Java: new String(date.getYear()) * SQL: DATENAME(date, year) * </pre></blockquote> */ public Expression dateName(String datePart) { ExpressionOperator anOperator = getOperator(ExpressionOperator.DateName); FunctionExpression expression = new FunctionExpression(); expression.setBaseExpression(this); expression.addChild(Expression.fromLiteral(datePart, this)); expression.addChild(this); expression.setOperator(anOperator); return expression; }
/** * INTERNAL: * A utility method to build a SpatialExpression * * @param operator the ordinal of the operator * @param geom1 * @param geom2 * @param params * @return */ public static Expression getSpatialExpression(int operator, Expression geom1, Object geom2, String params) { ExpressionOperator anOperator = geom1.getOperator(operator); FunctionExpression expression = new FunctionExpression(); expression.setBaseExpression(geom1); expression.addChild(Expression.from(geom1, geom1)); expression.addChild(Expression.from(geom2, geom1)); //Bug 5885276, the empty string either like " " or "" needs to be substituted //by null prior to passing to Geometry call. if (params==null || params.trim().equals("")){ expression.addChild(Expression.from(null, geom1)); }else{ expression.addChild(Expression.from(params, geom1)); } expression.setOperator(anOperator); Expression finalExpression = expression.equal("TRUE"); return finalExpression; } }
/** * PUBLIC: * Function, Return the difference between the queried part of a date(i.e. years, days etc.) * and same part of the given date. The equivalent of the Sybase function DateDiff * <p>Example: * <blockquote><pre> * TopLink: employee.get("date").dateDifference("year", new Date(System.currentTimeMillis())) * Java: NA * SQL: DATEADD(date, 2, GETDATE) * </blockquote></pre> * */ public Expression dateDifference(String datePart, Expression comparisonExpression) { ExpressionOperator anOperator = getOperator(ExpressionOperator.DateDifference); FunctionExpression expression = new FunctionExpression(); expression.setBaseExpression(this); expression.addChild(Expression.fromLiteral(datePart, this)); expression.addChild(comparisonExpression); expression.addChild(this); expression.setOperator(anOperator); return expression; }
/** * PUBLIC: * Function, Return the difference between the queried part of a date(i.e. years, days etc.) * and same part of the given date. The equivalent of the Sybase function DateDiff * <p>Example: * <blockquote><pre> * EclipseLink: employee.get("date").dateDifference("year", new Date(System.currentTimeMillis())) * Java: NA * SQL: DATEADD(date, 2, GETDATE) * </pre></blockquote> */ public Expression dateDifference(String datePart, Expression comparisonExpression) { ExpressionOperator anOperator = getOperator(ExpressionOperator.DateDifference); FunctionExpression expression = new FunctionExpression(); expression.setBaseExpression(this); expression.addChild(Expression.fromLiteral(datePart, this)); expression.addChild(comparisonExpression); expression.addChild(this); expression.setOperator(anOperator); return expression; }
/** * PUBLIC: * Function, Return the difference between the queried part of a date(i.e. years, days etc.) * and same part of the given date. The equivalent of the Sybase function DateDiff * <p>Example: * <blockquote><pre> * EclipseLink: employee.get("date").dateDifference("year", new Date(System.currentTimeMillis())) * Java: NA * SQL: DATEADD(date, 2, GETDATE) * </pre></blockquote> */ public Expression dateDifference(String datePart, Expression comparisonExpression) { ExpressionOperator anOperator = getOperator(ExpressionOperator.DateDifference); FunctionExpression expression = new FunctionExpression(); expression.setBaseExpression(this); expression.addChild(Expression.fromLiteral(datePart, this)); expression.addChild(comparisonExpression); expression.addChild(this); expression.setOperator(anOperator); return expression; }
/** * PUBLIC: * Function, Return the difference between the queried part of a date(i.e. years, days etc.) * and same part of the given date. The equivalent of the Sybase function DateDiff * <p>Example: * <blockquote><pre> * EclipseLink: employee.get("date").dateDifference("year", new Date(System.currentTimeMillis())) * Java: NA * SQL: DATEADD(date, 2, GETDATE) * </pre></blockquote> */ public Expression dateDifference(String datePart, java.util.Date date) { ExpressionOperator anOperator = getOperator(ExpressionOperator.DateDifference); FunctionExpression expression = new FunctionExpression(); expression.setBaseExpression(this); expression.addChild(Expression.fromLiteral(datePart, this)); expression.addChild(Expression.from(date, this)); expression.addChild(this); expression.setOperator(anOperator); return expression; }
/** * PUBLIC: * Function, return an expression that adds to a date based on * the specified datePart. This is equivalent to the Sybase DATEADD function. * <p>Example: * <blockquote><pre> * TopLink: employee.get("date").addDate("year", 2) * Java: NA * SQL: DATEADD(date, 2, year) * </blockquote></pre> */ public Expression addDate(String datePart, Object numberToAdd) { ExpressionOperator anOperator = getOperator(ExpressionOperator.AddDate); FunctionExpression expression = new FunctionExpression(); expression.setBaseExpression(this); expression.addChild(this); expression.addChild(Expression.fromLiteral(datePart, this)); expression.addChild(Expression.from(numberToAdd, this)); expression.setOperator(anOperator); return expression; }
/** * PUBLIC: * Function, Return the difference between the queried part of a date(i.e. years, days etc.) * and same part of the given date. The equivalent of the Sybase function DateDiff * <p>Example: * <blockquote><pre> * TopLink: employee.get("date").dateDifference("year", new Date(System.currentTimeMillis())) * Java: NA * SQL: DATEADD(date, 2, GETDATE) * </blockquote></pre> * */ public Expression dateDifference(String datePart, java.util.Date date) { ExpressionOperator anOperator = getOperator(ExpressionOperator.DateDifference); FunctionExpression expression = new FunctionExpression(); expression.setBaseExpression(this); expression.addChild(Expression.fromLiteral(datePart, this)); expression.addChild(Expression.from(date, this)); expression.addChild(this); expression.setOperator(anOperator); return expression; }
/** * PUBLIC: * Function, Return the difference between the queried part of a date(i.e. years, days etc.) * and same part of the given date. The equivalent of the Sybase function DateDiff * <p>Example: * <blockquote><pre> * EclipseLink: employee.get("date").dateDifference("year", new Date(System.currentTimeMillis())) * Java: NA * SQL: DATEADD(date, 2, GETDATE) * </pre></blockquote> */ public Expression dateDifference(String datePart, java.util.Date date) { ExpressionOperator anOperator = getOperator(ExpressionOperator.DateDifference); FunctionExpression expression = new FunctionExpression(); expression.setBaseExpression(this); expression.addChild(Expression.fromLiteral(datePart, this)); expression.addChild(Expression.from(date, this)); expression.addChild(this); expression.setOperator(anOperator); return expression; }