SolarMetric Kodo JDO 2.5.0 Reverse Schema Tool

com.solarmetric.rd.kodo.impl.jdbc.query.listen
Class NamedQuery

java.lang.Object
  |
  +--com.solarmetric.rd.kodo.impl.jdbc.query.listen.NamedQuery
All Implemented Interfaces:
FilterListener, JDBCFilterListener

public class NamedQuery
extends java.lang.Object
implements JDBCFilterListener

Used to invoke named queries (usually stored procedures) implemented by custom class mappings. This listener works with cooperation from the JDBC query engine to bypass the standard dynamic SELECT construction.

Arguments to the query are passed using JDO's standard query parameters.

Examples:
"ext:namedQuery (\"getByName\")"


Field Summary
static java.lang.String TAG
           
static java.lang.String WHERE_TOKEN
           
 
Constructor Summary
NamedQuery()
           
 
Method Summary
 java.lang.Object evaluate(java.lang.Object target, java.lang.Object arg, java.lang.Object candidate, com.solarmetric.rd.kodo.runtime.PersistenceManagerImpl pm)
          Evaluate the given expression.
 boolean expectsArgument()
          Return true if this extension expects an argument to act on.
 boolean expectsTarget()
          Return true if this extension expects a target to act on.
 java.lang.String getTag()
          Return the tag that this extension listens for.
 boolean isExpression()
          Return true if this extension is an expression; i.e.
 void where(com.solarmetric.rd.kodo.impl.jdbc.schema.SQLBuffer buf, com.solarmetric.rd.kodo.impl.jdbc.query.exp.JDBCValue target, com.solarmetric.rd.kodo.impl.jdbc.query.exp.JDBCValue arg, com.solarmetric.rd.kodo.impl.jdbc.meta.ClassMapping type, com.solarmetric.rd.kodo.runtime.PersistenceManagerImpl pm)
          Append the SQL for this expression or value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WHERE_TOKEN

public static final java.lang.String WHERE_TOKEN
See Also:
Constant Field Values

TAG

public static final java.lang.String TAG
See Also:
Constant Field Values
Constructor Detail

NamedQuery

public NamedQuery()
Method Detail

getTag

public java.lang.String getTag()
Description copied from interface: FilterListener
Return the tag that this extension listens for.

Specified by:
getTag in interface FilterListener

expectsArgument

public boolean expectsArgument()
Description copied from interface: FilterListener
Return true if this extension expects an argument to act on. Some extensions may not need arguments; for example, an extension to switch a string to upper case might be of the form: field.ext:toUpperCase ().

Specified by:
expectsArgument in interface FilterListener

expectsTarget

public boolean expectsTarget()
Description copied from interface: FilterListener
Return true if this extension expects a target to act on. Some extensions act on a field or object value; others stand alone. field.ext:toUpperCase () acts on the target field but has no arguments, while another possible form, ext:toUpperCase (field) has no target but does have an argument.

Specified by:
expectsTarget in interface FilterListener

isExpression

public boolean isExpression()
Description copied from interface: FilterListener
Return true if this extension is an expression; i.e. if it evaluates to true or false on its own.

Specified by:
isExpression in interface FilterListener

evaluate

public java.lang.Object evaluate(java.lang.Object target,
                                 java.lang.Object arg,
                                 java.lang.Object candidate,
                                 com.solarmetric.rd.kodo.runtime.PersistenceManagerImpl pm)
Description copied from interface: FilterListener
Evaluate the given expression. This method is used when evaluating in-memory expressions. The method used when evaluating data store expressions will change depending on the data store in use.

Specified by:
evaluate in interface FilterListener
Parameters:
target - the target object / field value to act on; will be null if this extension does not expect a target
arg - the value of the argument given in the filter; will be null if this extension does not expect an argument
candidate - the candidate object being evaluated
pm - a persistence manager to use if needed
Returns:
the value of the extension for this candidate; if this extension is an expression, this method should return Boolean.TRUE or Boolean.FALSE

where

public void where(com.solarmetric.rd.kodo.impl.jdbc.schema.SQLBuffer buf,
                  com.solarmetric.rd.kodo.impl.jdbc.query.exp.JDBCValue target,
                  com.solarmetric.rd.kodo.impl.jdbc.query.exp.JDBCValue arg,
                  com.solarmetric.rd.kodo.impl.jdbc.meta.ClassMapping type,
                  com.solarmetric.rd.kodo.runtime.PersistenceManagerImpl pm)
Description copied from interface: JDBCFilterListener
Append the SQL for this expression or value.

Specified by:
where in interface JDBCFilterListener
Parameters:
buf - the SQL buffer to append to
target - the target to act on; this will usually be a SQLPath, but depending on usage could also be other values; it will be null if the listener doesn't expect a target
arg - the value of the argument given in the filter; this will usually be a Constant, but will be null if this listener doesn't expect an argument
type - the class mapping for the query's candidate class
pm - the persistence manager that owns the query

SolarMetric Kodo JDO 2.5.0 Reverse Schema Tool

Copyright 2001,2002,2003 SolarMetric, Inc. All Rights Reserved.