org.outerj.daisy.query.model
Class Identifier

java.lang.Object
  extended by org.outerj.daisy.query.model.Identifier
All Implemented Interfaces:
java.lang.Cloneable, Expression, ValueExpr

public final class Identifier
extends java.lang.Object
implements ValueExpr, java.lang.Cloneable


Nested Class Summary
 class Identifier.AbstractIdentifier
           
 class Identifier.AbstractLoginIdentifier
           
 class Identifier.AbstractNonAclIdentifier
           
 class Identifier.AbstractOutputIdentifier
           
 class Identifier.BranchIdIdentifier
           
 class Identifier.BranchNameIdentifier
           
 class Identifier.CollectionsIdentifier
           
 class Identifier.CollectionsValueCountIdentifier
           
 class Identifier.CreationTimeIdentifier
           
 class Identifier.CustomFieldIdentifier
           
 class Identifier.DocumentIdIdentifier
           
 class Identifier.DocumentLinkIdentifier
           
 class Identifier.DocumentNameIdentifier
           
 class Identifier.DocumentTypeIdentifier
           
 class Identifier.FieldIdentifier
           
 class Identifier.FieldValueCountIdentifier
           
 class Identifier.LanguageIdIdentifier
           
 class Identifier.LanguageNameIdentifier
           
 class Identifier.LastModifiedIdentifier
           
 class Identifier.LastModifierIdIdentifier
           
 class Identifier.LastModifierLoginIdentifier
           
 class Identifier.LastModifierNameIdentifier
           
 class Identifier.LinkFieldBranchIdentifier
           
 class Identifier.LinkFieldBranchIdIdentifier
           
 class Identifier.LinkFieldDocumentIdIdentifier
           
 class Identifier.LinkFieldLanguageIdentifier
           
 class Identifier.LinkFieldLanguageIdIdentifier
           
 class Identifier.LockDurationIdentifier
           
 class Identifier.LockOwnerIdIdentifier
           
 class Identifier.LockOwnerLoginIdentifier
           
 class Identifier.LockOwnerNameIdentifier
           
 class Identifier.LockTimeAcquiredIdentifier
           
 class Identifier.LockTypeIdentifier
           
 class Identifier.OwnerIdIdentifier
           
 class Identifier.OwnerLoginIdentifier
           
 class Identifier.OwnerNameIdentifier
           
 class Identifier.PartContentIdentifier
           
 class Identifier.PartMimeTypeIdentifier
           
 class Identifier.PartSizeIdentifier
           
 class Identifier.PrivateIdentifier
           
 class Identifier.RetiredIdentifier
           
 class Identifier.SummaryIdentifier
           
 class Identifier.TotalSizeOfPartsIdentifier
           
 class Identifier.VariantLastModifiedIdentifier
           
 class Identifier.VariantLastModifierIdIdentifier
           
 class Identifier.VariantLastModifierLoginIdentifier
           
 class Identifier.VariantLastModifierNameIdentifier
           
 class Identifier.VersionCreationTimeIdentifier
           
 class Identifier.VersionCreatorIdIdentifier
           
 class Identifier.VersionCreatorLoginIdentifier
           
 class Identifier.VersionCreatorNameIdentifier
           
 class Identifier.VersionIdIdentifier
           
 class Identifier.VersionStateIdentifier
           
 class Identifier.VersionStateLastModifiedIdentifier
           
 
Constructor Summary
  Identifier(java.lang.String id)
           
protected Identifier(java.lang.String id, QueryContext context, org.outerj.daisy.query.model.Identifier.DelegateIdentifier delegate)
           
 
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)
           
 boolean canTestAppliesTo()
          Must only be implemented by classes for which isAclAllowed returns null.
protected  java.lang.Object clone()
           
 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.
 int getColumn()
           
 org.outerj.daisy.query.model.Identifier.DelegateIdentifier getDelegate()
           
 java.lang.String getExpression()
          Get a textual representation of this expression, i.e.
 int getLine()
           
 java.lang.String getLocation()
           
 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.
 AclConditionViolation isAclAllowed()
          May this identifier be used in ACL evaluation expressions?
 boolean isComparable()
           
 boolean isMultiValue()
           
 boolean isOutputOnly()
          If true, then this identifier does not present a field on which can be searched, and only the method getOutputValue should be called on it.
 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
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Identifier

public Identifier(java.lang.String id)

Identifier

protected Identifier(java.lang.String id,
                     QueryContext context,
                     org.outerj.daisy.query.model.Identifier.DelegateIdentifier delegate)
Method Detail

clone

protected java.lang.Object clone()
Overrides:
clone in class java.lang.Object

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

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

evaluate

public java.lang.Object evaluate(QValueType valueType,
                                 org.outerj.daisy.repository.query.EvaluationContext evaluationContext)
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.

Specified by:
evaluate in interface ValueExpr
Parameters:
valueType - Indicates the type of object to return. This parameter only matters when

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.

Specified by:
evaluate 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

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

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

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

getValueType

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

Specified by:
getValueType in interface ValueExpr

isMultiValue

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

isComparable

public boolean isComparable()

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.

Specified by:
getOutputValueType in interface ValueExpr

getOutputValue

public final java.lang.Object getOutputValue(org.outerj.daisy.repository.Document document,
                                             org.outerj.daisy.repository.Version version,
                                             org.outerj.daisy.repository.query.EvaluationContext evaluationContext)
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.

Specified by:
getOutputValue in interface ValueExpr

getTitle

public java.lang.String getTitle(java.util.Locale locale)
Specified by:
getTitle in interface ValueExpr

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

isAclAllowed

public AclConditionViolation isAclAllowed()
May this identifier be used in ACL evaluation expressions?

Specified by:
isAclAllowed in interface ValueExpr

canTestAppliesTo

public boolean canTestAppliesTo()
Must only be implemented by classes for which isAclAllowed returns null.

Specified by:
canTestAppliesTo in interface ValueExpr

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

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

isOutputOnly

public boolean isOutputOnly()
If true, then this identifier does not present a field on which can be searched, and only the method getOutputValue should be called on it.

Specified by:
isOutputOnly in interface ValueExpr

getDelegate

public org.outerj.daisy.query.model.Identifier.DelegateIdentifier getDelegate()


Copyright © -2012 . All Rights Reserved.