|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

java.lang.Objectorg.mmbase.storage.search.legacy.ConstraintParser
public class ConstraintParser
Parser, tries to parse a SQL-search-condition for a query to a
Constraint object.
This class is provided for the sole purpose of alignment of old code with
the new SearchQuery framework,
and should not be called by new code.
A SQL-search-condition can be one of these forms:
'A string value'
123.456
'123.456'
See StringSearchConstraint for more info on string-search constraints.
A search condition that is not of one of these forms will be converted to a
LegacyConstraint, i.e.
in that case the search condition string will not be interpreted, but
instead be used "as-is".
Each time this occurs is logged with priority service to
category org.mmbase.storage.search.legacyConstraintParser.fallback.
| Field Summary | |
|---|---|
protected static QueryContext |
BRIDGE
|
protected QueryContext |
queryContext
|
| Constructor Summary | |
|---|---|
ConstraintParser(Query query)
|
|
ConstraintParser(QueryContext queryContext,
SearchQuery query)
Creates a new instance of ConstraintParser |
|
| Method Summary | |
|---|---|
static String |
convertClauseToDBS(QueryContext queryContext,
String constraints)
Converts a constraint by turning all 'quoted' fields into database supported fields. |
static StepField |
getField(QueryContext queryContext,
String token,
List<? extends Step> steps)
Creates StepField corresponding to field indicated by
token, of one of the specified steps. |
(package private) static StepField |
getField(QueryContext queryContext,
String token,
List<BasicStep> steps,
SearchQuery query)
Creates StepField corresponding to field indicated by
token, of one of the specified steps. |
(package private) StepField |
getField(String token)
Parses a field string, and produces a corresponding StepField object. |
static StepField |
getField(String token,
List<? extends Step> steps)
|
(package private) BasicConstraint |
parseCondition(ListIterator<String> iTokens)
Parses SQL-search-condition string from list of tokens, and produces a corresponding BasicConstraint object. |
(package private) BasicConstraint |
parseSimpleCondition(ListIterator<String> iTokens)
Parses a simple-SQL-search-condition string from list of tokens, and produces a corresponding BasicConstraint object. |
(package private) static Object |
parseValue(Iterator<String> iTokens,
StepField field)
Parses string or numerical value from list of tokens, to match the type of the specified field. |
Constraint |
toConstraint(String sqlConstraint)
Parses SQL-search-condition, and produces a corresponding Constraint object. |
(package private) static List<String> |
tokenize(String sqlConstraint)
Parses SQL search condition string into separate tokens, discarding white spaces, concatenating strings between (single/double) quotes, and replacing escaped (single/double) quotes in strings by the original character. |
static boolean |
validConstraints(String constraints)
returns false, when escaping wasnt closed, or when a ";" was found outside a escaped part (to prefent spoofing) This is used by createQuery (i wonder if it still makes sense) |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final QueryContext queryContext
protected static final QueryContext BRIDGE
| Constructor Detail |
|---|
public ConstraintParser(QueryContext queryContext,
SearchQuery query)
query - public ConstraintParser(Query query)
| Method Detail |
|---|
public static String convertClauseToDBS(QueryContext queryContext,
String constraints)
constraints - constraints to convert
public static boolean validConstraints(String constraints)
constraints - constraint to check
static Object parseValue(Iterator<String> iTokens,
StepField field)
throws NumberFormatException
iTokens - Tokens iterator, must be positioned before the (first)
token representing the value.field - The field.
String or Double object representing
the value.
NumberFormatException - when the first token is not (the start of)
a valid value expression (it may be a field instead).static List<String> tokenize(String sqlConstraint)
sqlConstraint - The SQL constraint string.
public static StepField getField(QueryContext queryContext,
String token,
List<? extends Step> steps)
StepField corresponding to field indicated by
token, of one of the specified steps.
A field can be one of these forms:
token - The token.steps - The steps.
public static StepField getField(String token,
List<? extends Step> steps)
static StepField getField(QueryContext queryContext,
String token,
List<BasicStep> steps,
SearchQuery query)
StepField corresponding to field indicated by
token, of one of the specified steps.
A field can be one of these forms:
token - The token.steps - The steps.query - The used query
public Constraint toConstraint(String sqlConstraint)
Constraint object.
See above for the format of a
SQL-search-condition.
sqlConstraint - The non-null SQL constraint string.
StepField getField(String token)
StepField object.
See above for the format of a
field
token - The token.
BasicConstraint parseCondition(ListIterator<String> iTokens)
BasicConstraint object.
See above for the format of a
SQL-search-condition
iTokens - Tokens iterator, must be positioned before the (first)
token representing the condition.
BasicConstraint parseSimpleCondition(ListIterator<String> iTokens)
BasicConstraint object.
See above for the format of a
simple-SQL-search-condition
iTokens - Tokens iterator, must be positioned before the (first)
token representing the condition.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||