org.outerj.daisy.query.model.functions
Class ContextDocFunction

java.lang.Object
  extended by org.outerj.daisy.query.model.AbstractFunction
      extended by org.outerj.daisy.query.model.functions.ContextDocFunction
All Implemented Interfaces:
Expression, Function, ValueExpr

public class ContextDocFunction
extends AbstractFunction


Field Summary
static java.lang.String NAME
           
 
Fields inherited from class org.outerj.daisy.query.model.AbstractFunction
params
 
Constructor Summary
ContextDocFunction()
           
 
Method Summary
 int bindPreConditions(java.sql.PreparedStatement stmt, int bindPos)
           
 int bindValueExpr(java.sql.PreparedStatement stmt, int bindPos, QValueType valueType, org.outerj.daisy.repository.query.EvaluationContext evaluationContext)
           
 java.lang.Object evaluate(QValueType valueType, org.outerj.daisy.repository.Document document, org.outerj.daisy.repository.Version version, org.outerj.daisy.repository.query.EvaluationContext evaluationContext)
          Evaluates this expression for the given document and/or version.
 java.lang.Object evaluate(QValueType valueType, org.outerj.daisy.repository.query.EvaluationContext evaluationContext)
          Evaluates the expression without access to document information.
 void generateSqlValueExpr(java.lang.StringBuffer sql, SqlGenerationContext context)
          Generates the SQL for this expression.
 java.lang.String getFunctionName()
           
 java.lang.Object getOutputValue(org.outerj.daisy.repository.Document document, org.outerj.daisy.repository.Version version, org.outerj.daisy.repository.query.EvaluationContext evaluationContext)
          Returns the output value of this identifier for the given document and version.
 QValueType getOutputValueType()
          Identifies the type of data returned from the ValueExpr.getOutputValue(org.outerj.daisy.repository.Document, org.outerj.daisy.repository.Version, EvaluationContext) method.
 java.lang.String getSqlPreConditions(SqlGenerationContext context)
          Generates any SQL conditions needed outside of the main value expression (which is generated using ValueExpr.generateSqlValueExpr(StringBuffer, SqlGenerationContext)).
 java.lang.String getTitle(java.util.Locale locale)
           
 QValueType getValueType()
          Returns the ValueType of this expression, or null if undetermined.
 boolean isMultiValue()
           
 void prepare(QueryContext context)
          A method that should be called before any of the others.
 
Methods inherited from class org.outerj.daisy.query.model.AbstractFunction
addParam, canTestAppliesTo, getColumn, getExpression, getLine, getLocation, getParam, isAclAllowed, isOutputOnly, isSymbolicIdentifier, setLocation, translateSymbolic
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAME

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

ContextDocFunction

public ContextDocFunction()
Method Detail

getFunctionName

public java.lang.String getFunctionName()

prepare

public void prepare(QueryContext context)
             throws org.outerj.daisy.repository.query.QueryException
Description copied from interface: ValueExpr
A method that should be called before any of the others.

Specified by:
prepare in interface ValueExpr
Overrides:
prepare in class AbstractFunction
Throws:
org.outerj.daisy.repository.query.QueryException

generateSqlValueExpr

public void generateSqlValueExpr(java.lang.StringBuffer sql,
                                 SqlGenerationContext context)
                          throws org.outerj.daisy.repository.query.QueryException
Description copied from interface: ValueExpr
Generates the SQL for this expression.

Should throw an exception if this is an output-only ValueExpr.

Specified by:
generateSqlValueExpr in interface ValueExpr
Overrides:
generateSqlValueExpr in class AbstractFunction
Throws:
org.outerj.daisy.repository.query.QueryException

getSqlPreConditions

public java.lang.String getSqlPreConditions(SqlGenerationContext context)
                                     throws org.outerj.daisy.repository.query.QueryException
Description copied from interface: ValueExpr
Generates any SQL conditions needed outside of the main value expression (which is generated using ValueExpr.generateSqlValueExpr(StringBuffer, SqlGenerationContext)).

Should throw an exception if this is an output-only ValueExpr.

Specified by:
getSqlPreConditions in interface ValueExpr
Overrides:
getSqlPreConditions in class AbstractFunction
Returns:
null if not applicable
Throws:
org.outerj.daisy.repository.query.QueryException

bindPreConditions

public int bindPreConditions(java.sql.PreparedStatement stmt,
                             int bindPos)
                      throws java.sql.SQLException,
                             org.outerj.daisy.repository.query.QueryException
Specified by:
bindPreConditions in interface ValueExpr
Overrides:
bindPreConditions in class AbstractFunction
Throws:
java.sql.SQLException
org.outerj.daisy.repository.query.QueryException

bindValueExpr

public int bindValueExpr(java.sql.PreparedStatement stmt,
                         int bindPos,
                         QValueType valueType,
                         org.outerj.daisy.repository.query.EvaluationContext evaluationContext)
                  throws java.sql.SQLException,
                         org.outerj.daisy.repository.query.QueryException
Specified by:
bindValueExpr in interface ValueExpr
Overrides:
bindValueExpr in class AbstractFunction
Throws:
java.sql.SQLException
org.outerj.daisy.repository.query.QueryException

isMultiValue

public boolean isMultiValue()
Specified by:
isMultiValue in interface ValueExpr
Overrides:
isMultiValue in class AbstractFunction

evaluate

public java.lang.Object evaluate(QValueType valueType,
                                 org.outerj.daisy.repository.query.EvaluationContext evaluationContext)
                          throws org.outerj.daisy.repository.query.QueryException
Description copied from interface: ValueExpr
Evaluates the expression without access to document information. This will only work for expressions that do not need access to information from the document (thus typically without identifiers), otherwise this will throw an exception.

Parameters:
valueType - Indicates the type of object to return. This parameter only matters when
Throws:
org.outerj.daisy.repository.query.QueryException

evaluate

public java.lang.Object evaluate(QValueType valueType,
                                 org.outerj.daisy.repository.Document document,
                                 org.outerj.daisy.repository.Version version,
                                 org.outerj.daisy.repository.query.EvaluationContext evaluationContext)
                          throws org.outerj.daisy.repository.query.QueryException
Description copied from interface: ValueExpr
Evaluates this expression for the given document and/or version. The version argument can be null, in which case the data will be retrieved from the document object.

Throws:
org.outerj.daisy.repository.query.QueryException

getValueType

public QValueType getValueType()
Description copied from interface: ValueExpr
Returns the ValueType of this expression, or null if undetermined.


getTitle

public java.lang.String getTitle(java.util.Locale locale)

getOutputValueType

public QValueType getOutputValueType()
Description copied from interface: ValueExpr
Identifies the type of data returned from the ValueExpr.getOutputValue(org.outerj.daisy.repository.Document, org.outerj.daisy.repository.Version, EvaluationContext) method.


getOutputValue

public java.lang.Object getOutputValue(org.outerj.daisy.repository.Document document,
                                       org.outerj.daisy.repository.Version version,
                                       org.outerj.daisy.repository.query.EvaluationContext evaluationContext)
                                throws org.outerj.daisy.repository.query.QueryException
Description copied from interface: ValueExpr
Returns the output value of this identifier for the given document and version. For symbolic identifiers this will be different from the value returned by ValueExpr.evaluate(QValueType, org.outerj.daisy.repository.Document, org.outerj.daisy.repository.Version, EvaluationContext). The version is allowed to be null.

Throws:
org.outerj.daisy.repository.query.QueryException


Copyright © -2012 . All Rights Reserved.