FileDocCategorySizeDatePackage
DateFunctionNode.javaAPI DocGlassfish v2 API4060Tue May 22 16:54:36 BST 2007oracle.toplink.essentials.internal.parsing

DateFunctionNode

public class DateFunctionNode extends FunctionalExpressionNode
INTERNAL

Purpose: Represent a date function: CURRENT_DATE, CURRENT_TIME, CURRENT_TIMESTAMP.

Responsibilities:

  • Generate the correct expression for the date function

Fields Summary
private Class
type
Constructors Summary
public DateFunctionNode()
DateFunctionNode constructor.

        super();
    
Methods Summary
public voidapplyToQuery(oracle.toplink.essentials.queryframework.ObjectLevelReadQuery theQuery, oracle.toplink.essentials.internal.parsing.GenerationContext context)
INTERNAL Apply this node to the passed query

        if (theQuery.isReportQuery()){
            ReportQuery reportQuery = (ReportQuery)theQuery;
            reportQuery.addAttribute("date", generateExpression(context), type);
        }
    
public oracle.toplink.essentials.expressions.ExpressiongenerateExpression(oracle.toplink.essentials.internal.parsing.GenerationContext context)
INTERNAL Generate the TopLink expression for this node

        Expression expr = context.getBaseExpression();
        if (expr == null) {
            expr = new ExpressionBuilder();
        }
        Expression result = null;
        if (type == Date.class) {
            result = expr.currentDateDate();
        } else if (type == Time.class) {
            result = expr.currentTime();
        } else if (type == Timestamp.class) {
            result = expr.currentDate();
        }
        return result;
    
public voiduseCurrentDate()

        type = Date.class;
    
public voiduseCurrentTime()

        type = Time.class;
    
public voiduseCurrentTimestamp()

        type = Timestamp.class;
    
public voidvalidate(oracle.toplink.essentials.internal.parsing.ParseTreeContext context)
INTERNAL Validate node and calculate its type.

        setType(type);