public interface SqlHandler
SearchQuery objects.
A number of SqlHandler objects can create a chain of handlers,
following the Chain Of Responsibility design pattern.
In short:
SqlHandler objects, where each
element in the chain, except the last one, is called a chained
handler.
Each chained handler has a successor, which is the next element
in the chain.
Each handler in the chain adds functionality to its successor(s), in a way similar to subclassing. The chained design enables a chain of handlers to be configured and created at runtime.
In addition to the methods defined in the interface, the concrete
SqlHandler class for the last element in the chain
is required to have a constructor with this signature:
public <constructor>(Map disallowedValues) { .. }
where disallowedValues is a map that maps disallowed
table/fieldnames to allowed alternatives.
The concrete SqlHandler class for the other, chained,
elements in the chain are required to have a constructor
with this signature:
public <constructor>(SqlHandler successor) { .. }
where successor is the successor in the chain
of responsibility.| Modifier and Type | Method and Description |
|---|---|
void |
appendConstraintToSql(StringBuilder sb,
Constraint constraint,
SearchQuery query,
boolean inverse,
boolean inComposite)
Represents Constraint object, that is not a CompositeConstraint,
as a constraint in SQL format, appending the result to a stringbuffer.
|
void |
appendQueryBodyToSql(StringBuilder sb,
SearchQuery query,
SqlHandler firstInChain)
Represents body of a SearchQuery object as a string in SQL format,
using the database configuration.
|
String |
getAllowedValue(String value)
Deprecated.
|
int |
getSupportLevel(Constraint constraint,
SearchQuery query)
Gets the level at which a constraint is supported for a query
by this handler.
|
int |
getSupportLevel(int feature,
SearchQuery query)
Gets the level at which a feature is supported for a query
by this handler.
|
String |
toSql(SearchQuery query,
SqlHandler firstInChain)
Represents a SearchQuery object as a string in SQL format,
using the database configuration.
|
String toSql(SearchQuery query, SqlHandler firstInChain) throws SearchQueryException
query - The searchquery.firstInChain - The first element in the chain of handlers.
At some point appendQueryBodyToSql() will have
to be called on this handler, to generate the body of the query.SearchQueryExceptionvoid appendQueryBodyToSql(StringBuilder sb, SearchQuery query, SqlHandler firstInChain) throws SearchQueryException
sb - The stringbuffer to append to.query - The searchquery.firstInChain - The first element in the chain of handlers.
At some point appendConstraintToSql() will have
to be called on this handler, to generate the constraints in
the query.SearchQueryExceptionvoid appendConstraintToSql(StringBuilder sb, Constraint constraint, SearchQuery query, boolean inverse, boolean inComposite) throws SearchQueryException
sb - The stringbuffer to append to.constraint - The (non-composite) constraint.query - The searchquery containing the constraint.inverse - True when the inverse constraint must be represented,
false otherwise.inComposite - True when the constraint is part of
a composite expression.SearchQueryExceptionint getSupportLevel(int feature,
SearchQuery query)
throws SearchQueryException
SearchQueryExceptionint getSupportLevel(Constraint constraint, SearchQuery query) throws SearchQueryException
SearchQueryExceptionString getAllowedValue(String value)
StorageManagerFactory.getStorageIdentifier()value - The string value.MMBase 1.9-SNAPSHOT - ${javadoctimestamp}