org.outerj.daisy.query.model
Class AbstractFunction

java.lang.Object
  extended by org.outerj.daisy.query.model.AbstractFunction
All Implemented Interfaces:
Expression, Function, ValueExpr
Direct Known Subclasses:
AbstractBinaryMathFunction, AbstractCaseFunction, AbstractUnaryMathFunction, ConcatFunction, ContextDocFunction, CurrentDateFunction, CurrentDateTimeFunction, DateComponentFunction, LeftFunction, LengthFunction, RandomFunction, RelativeDateTimeFunction, SubstringFunction, UserIdFunction

public abstract class AbstractFunction
extends java.lang.Object
implements Function


Field Summary
protected  java.util.List params
           
 
Constructor Summary
AbstractFunction()
           
 
Method Summary
 void addParam(ValueExpr param)
           
 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)
           
 boolean canTestAppliesTo()
           
 void generateSqlValueExpr(java.lang.StringBuffer sql, SqlGenerationContext context)
          Generates the SQL for this expression.
 int getColumn()
           
 java.lang.String getExpression()
          Get a textual representation of this expression, i.e.
 int getLine()
           
 java.lang.String getLocation()
           
protected  ValueExpr getParam(int index)
           
 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)).
 AclConditionViolation isAclAllowed()
          Returns non-null if this ValueExpr is not fitted for use in ACL document selection expressions.
 boolean isMultiValue()
           
 boolean isOutputOnly()
          Returns true for ValueExpr's which cannot be searched on (i.e.
 boolean isSymbolicIdentifier()
          Returns true if this ValueExpr represents a symbolic identifier.
 void prepare(QueryContext context)
          A method that should be called before any of the others.
 void setLocation(int line, int column)
           
 java.lang.Object translateSymbolic(ValueExpr valueExpr, org.outerj.daisy.repository.query.EvaluationContext evaluationContext)
          See ValueExpr.isSymbolicIdentifier().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.outerj.daisy.query.model.Function
getFunctionName
 
Methods inherited from interface org.outerj.daisy.query.model.ValueExpr
evaluate, evaluate, getOutputValue, getOutputValueType, getTitle, getValueType
 

Field Detail

params

protected java.util.List params
Constructor Detail

AbstractFunction

public AbstractFunction()
Method Detail

setLocation

public void setLocation(int line,
                        int column)
Specified by:
setLocation in interface Expression

getLocation

public java.lang.String getLocation()
Specified by:
getLocation in interface Expression

getLine

public int getLine()
Specified by:
getLine in interface Expression

getColumn

public int getColumn()
Specified by:
getColumn in interface Expression

addParam

public void addParam(ValueExpr param)
Specified by:
addParam in interface Function

getParam

protected ValueExpr getParam(int index)

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
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
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
Throws:
java.sql.SQLException
org.outerj.daisy.repository.query.QueryException

isSymbolicIdentifier

public boolean isSymbolicIdentifier()
Description copied from interface: ValueExpr
Returns true if this ValueExpr represents a symbolic identifier. A symbolic identifier is an identifier that identifies an object by name in the query, but uses an ID to search on the database.

If this method returns true, then ValueExpr.translateSymbolic(org.outerj.daisy.query.model.ValueExpr, org.outerj.daisy.repository.query.EvaluationContext) can be called to convert the symbolic value to the test value.

Specified by:
isSymbolicIdentifier in interface ValueExpr

isMultiValue

public boolean isMultiValue()
Specified by:
isMultiValue in interface ValueExpr

isOutputOnly

public boolean isOutputOnly()
Description copied from interface: ValueExpr
Returns true for ValueExpr's which cannot be searched on (i.e. no SQL can be generated) and which cannot be evaluated. Thus valueExpr's which can be used in the select and order by parts of a query, but not in the where part.

Specified by:
isOutputOnly in interface ValueExpr

isAclAllowed

public AclConditionViolation isAclAllowed()
Description copied from interface: ValueExpr
Returns non-null if this ValueExpr is not fitted for use in ACL document selection expressions.

Specified by:
isAclAllowed in interface ValueExpr

translateSymbolic

public java.lang.Object translateSymbolic(ValueExpr valueExpr,
                                          org.outerj.daisy.repository.query.EvaluationContext evaluationContext)
                                   throws org.outerj.daisy.repository.query.QueryException
Description copied from interface: ValueExpr
See ValueExpr.isSymbolicIdentifier(). This method should only be called if ValueExpr.isSymbolicIdentifier() returns true.

Specified by:
translateSymbolic in interface ValueExpr
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
Throws:
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
Throws:
java.sql.SQLException
org.outerj.daisy.repository.query.QueryException

getExpression

public java.lang.String getExpression()
Description copied from interface: ValueExpr
Get a textual representation of this expression, i.e. something that could be parsed again and give the same ValueExpr again.

Specified by:
getExpression in interface ValueExpr

canTestAppliesTo

public boolean canTestAppliesTo()
Specified by:
canTestAppliesTo in interface ValueExpr


Copyright © -2012 . All Rights Reserved.