com.gentics.api.lib.expressionparser.filtergenerator
Interface FilterPart

All Superinterfaces:
java.io.Serializable

public interface FilterPart
extends java.io.Serializable

Interface for a filterpart. A filterpart is part of a filter, might be static or dynamic and might contain subparts. Most of the filterparts are generated during creation of the DatasourceFilter instance. Some are generated later (during execution of the DatasourceFilter), using FilterPartGenerators.


Method Summary
 void addFilterPartGenerator(FilterPartGenerator filterPartGenerator)
          Add a filter part generator to the filter that generates a part of the statement dynamically when the filter is used to fetch results from a datasource.
 void addFilterStatementPart(java.lang.String statementPart)
          Add a filter statement part
 void addFilterStatementPart(java.lang.String statementPart, java.lang.Object[] parameters)
          Add a filter statement part together with some parameters (e.g.
 void addFunctionToEvaluate(Function function, int type, EvaluableExpression[] operands, int expectedValueType)
          Add the given function to the filter for later evaluation.
 void addLiteral(java.lang.Object literal, int expectedValueType)
          Add the given literal to the filter.
 void addPostProcessor(PostProcessor postProcessor, EvaluableExpression data)
          Add a post processor to this filter part
 void addResolvableObject(java.lang.String expressionName, int expectedValueType)
          Add a resolvable object to the filter.
 void addVariable(java.lang.String expressionName, int expectedValueType)
          Add a variable to the filter.
 void doPostProcessing(java.util.List<Resolvable> result, ExpressionQueryRequest request)
          Do post processing for this filter part.
 boolean hasPostProcessors()
          Check whether the filterpart has post processors set
 void mergeInto(MergedFilter mergedFilter)
          Merge this filterpart into the merged filter (final step of filter generation).
 

Method Detail

addFilterStatementPart

void addFilterStatementPart(java.lang.String statementPart)
                            throws ExpressionParserException
Add a filter statement part

Parameters:
statementPart - filter statement part to add
Throws:
ExpressionParserException

addFilterStatementPart

void addFilterStatementPart(java.lang.String statementPart,
                            java.lang.Object[] parameters)
                            throws ExpressionParserException
Add a filter statement part together with some parameters (e.g. bind variables)

Parameters:
statementPart - filter statement part to add
parameters - array of parameters
Throws:
ExpressionParserException

addVariable

void addVariable(java.lang.String expressionName,
                 int expectedValueType)
                 throws ExpressionParserException
Add a variable to the filter. The expression contains the property path of the variable and will always start with "object."

Parameters:
expressionName - expression name of the variable
expectedValueType - expected value type
Throws:
ExpressionParserException

addLiteral

void addLiteral(java.lang.Object literal,
                int expectedValueType)
                throws ExpressionParserException
Add the given literal to the filter.

Parameters:
literal - literal to add to the filter
expectedValueType - expected value type
Throws:
ExpressionParserException

addFunctionToEvaluate

void addFunctionToEvaluate(Function function,
                           int type,
                           EvaluableExpression[] operands,
                           int expectedValueType)
                           throws ExpressionParserException
Add the given function to the filter for later evaluation. This is only valid when the function is not variable.

Parameters:
function - function to be added
type - type of the function
operands - array of operands
expectedValueType - expected value type of the function result
Throws:
ExpressionParserException

addResolvableObject

void addResolvableObject(java.lang.String expressionName,
                         int expectedValueType)
                         throws ExpressionParserException
Add a resolvable object to the filter. The expectedValueType must be one of (ExpressionEvaluator.OBJECTTYPE_ANY, ExpressionEvaluator.OBJECTTYPE_BOOLEAN, ExpressionEvaluator.OBJECTTYPE_COLLECTION, ExpressionEvaluator.OBJECTTYPE_DATE, ExpressionEvaluator.OBJECTTYPE_NULL, ExpressionEvaluator.OBJECTTYPE_NUMBER, ExpressionEvaluator.OBJECTTYPE_STRING).

Parameters:
expressionName - full property path of the resolvable object
expectedValueType - expected value type
Throws:
ExpressionParserException

addFilterPartGenerator

void addFilterPartGenerator(FilterPartGenerator filterPartGenerator)
                            throws ExpressionParserException
Add a filter part generator to the filter that generates a part of the statement dynamically when the filter is used to fetch results from a datasource. This shall only be used by functions that need to adjust the generated statement to the current usage (for example: the datatypes of operands that are paths to resolvables).

Parameters:
filterPartGenerator - filter part generator
Throws:
ExpressionParserException
See Also:
FilterPartGenerator

addPostProcessor

void addPostProcessor(PostProcessor postProcessor,
                      EvaluableExpression data)
                      throws ExpressionParserException
Add a post processor to this filter part

Parameters:
postProcessor - post processor instance
data - evaluable expression that will be evaluated and the result passed to the post processor in the call PostProcessor#process(List, Object).
Throws:
ExpressionParserException

doPostProcessing

void doPostProcessing(java.util.List<Resolvable> result,
                      ExpressionQueryRequest request)
                      throws ExpressionParserException
Do post processing for this filter part. Pass the given result to the post processors. Use the request to evaluate the data expression first

Parameters:
result - filter result to be post processed
request - request
Throws:
ExpressionParserException

hasPostProcessors

boolean hasPostProcessors()
Check whether the filterpart has post processors set

Returns:
true if the filterpart has post processors set, false if not

mergeInto

void mergeInto(MergedFilter mergedFilter)
               throws ExpressionParserException
Merge this filterpart into the merged filter (final step of filter generation). All nested filterparts are also merged into the mergedFilter and instances of FilterPartGenerator will generate and merge their filter parts.

Parameters:
mergedFilter - merged filter
Throws:
ExpressionParserException


Copyright © 2013 Gentics Software GmbH. All Rights Reserved.