|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.edustructures.sifworks.tools.queries.QueryFormatter
public abstract class QueryFormatter
The abstract base class for query formatters, which format SIF_Query queries in another form such as an SQL WHERE clause. The way in which a query is formatted is determined by the subclass implementation. A subclass must implement these methods:
| Constructor Summary | |
|---|---|
QueryFormatter()
Constructs a QueryFormatter |
|
| Method Summary | |
|---|---|
java.lang.String |
format(Query query,
java.util.Map table)
Builds a query string given a dictionary of field definitions and a Query instance. |
java.lang.String |
format(Query query,
java.util.Map table,
boolean explicit)
|
abstract java.lang.String |
getCloseBrace()
Return the text that should be inserted for a closing brace |
abstract java.lang.String |
getOpenBrace()
Return the text that should be inserted for an opening brace |
abstract java.lang.String |
getOperator(ComparisonOperators op)
Return the text that should be inserted for the particular comparison operator, such as "Equals" |
abstract java.lang.String |
getOperator(GroupOperators op)
Return the text that should be inserted for the particular grouping operator, such as "AND" |
abstract java.lang.String |
renderField(ElementDef field,
java.lang.Object def)
Return the text for a field name |
abstract java.lang.String |
renderValue(java.lang.String value,
java.lang.Object def)
Return the text for a field value |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public QueryFormatter()
| Method Detail |
|---|
public java.lang.String format(Query query,
java.util.Map table)
throws QueryFormatterException
The dictionary should contain application-defined field values that map
to ElementDef key elements. Whenever a SIF element or attribute
is found in the Query, the corresponding application-defined field is
used in its place.
A special convention allows agents to define an in-line translation table for replacing SIF element/attribute values with values defined in the table. If a field is expressed in the form "field-name{value1=cons1;value2=cons2;..}", the comma-delimited list of values within the curly braces is applied to the value of the SIF_Value element in the SIF_Query, such that "value1" is represented as "cons1". For example, the acceptable values for LibraryPatronStatus/@SifRefIdType attribute are "StudentPersonal" and "StaffPersonal". If in your application you represent these values as numeric types - say, 1 and 2, respectively - you could create the following in-line translation table to instruct the QueryFormatter to substitute "StudentPersonal" with "1" and "StaffPersonal" with "2": "CircRecord.PatronType{StudentPersonal=1;StaffPersonal=2}"
query - An ADK Query object, usually obtained during the processing
of a SIF_Request by a Publisher message handlertable - A dictionary that maps SIFDTD ElementDef constants to
application-defined field values
QueryFormatterException
public java.lang.String format(Query query,
java.util.Map table,
boolean explicit)
throws QueryFormatterException
QueryFormatterExceptionpublic abstract java.lang.String getOpenBrace()
public abstract java.lang.String getCloseBrace()
public abstract java.lang.String getOperator(ComparisonOperators op)
public abstract java.lang.String getOperator(GroupOperators op)
public abstract java.lang.String renderField(ElementDef field,
java.lang.Object def)
throws QueryFormatterException
field - The field namedef - The corresponding field definition from the Map passed to
the format method
QueryFormatterException
public abstract java.lang.String renderValue(java.lang.String value,
java.lang.Object def)
throws QueryFormatterException
field - The field valuedef - The corresponding field definition from the Map passed to
the format method
QueryFormatterException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||