com.mkdoc.query
Class ServletQueryBuilder

java.lang.Object
  |
  +--com.mkdoc.query.AbstractQueryBuilder
        |
        +--com.mkdoc.query.ServletQueryBuilder
All Implemented Interfaces:
QueryBuilder

public class ServletQueryBuilder
extends AbstractQueryBuilder
implements QueryBuilder

A query builder for servlets.

Version:
0.7 2005-09-12
Author:
Philip Shaw
To do:
Add state tracking to prevent repetition of build and a reset mechanism to re-use the builder for a different request. Internalise the queryUri buffer to avoid passing it around. Remove schema property arguments to avoid passing around.

Field Summary
 
Fields inherited from class com.mkdoc.query.AbstractQueryBuilder
extendable, extended, profile
 
Fields inherited from interface com.mkdoc.query.QueryBuilder
APPEND_AND, APPEND_COMMA, APPEND_OR, CONSTRUCT, DELIMITERS, DISTINCT, FROM, LIKE, NOT_LIKE, QUOTE, SELECT, SPACE, USING, WHERE
 
Constructor Summary
ServletQueryBuilder(javax.servlet.http.HttpServletRequest request)
          Construct from a servlet request.
ServletQueryBuilder(javax.servlet.http.HttpServletRequest request, boolean extended)
          Construct with extended bNode query support.
 
Method Summary
protected  void appendTerm(java.lang.String term, java.lang.StringBuffer queryUri)
          Append a query term to the query URI.
protected  int getPageNumber()
          Get the page number
 Query getQuery()
          Parse the query source and get a Query object.
protected  QueryContext getQueryContext()
          Get the query output context.
protected  int getResultsPerPage()
          Get the number of results per page.
protected  void parseParameter(java.lang.String value, SchemaProperty property, java.lang.StringBuffer queryUri)
          Parse a parameter value.
 
Methods inherited from class com.mkdoc.query.AbstractQueryBuilder
addCondition, addExpression, addNamespaceDeclaration, addSummaryExpression, addTitleExpression, addVariable, appendConditions, appendPrimaryExpressions, appendSecondaryExpressions, getQueryTerms, getSeRQLQuery, hasExtendableProperties, isDelimiter, isUriQuery, setApplicationProfile, setDistinct, setQueryType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.mkdoc.query.QueryBuilder
getQueryTerms, setApplicationProfile, setDistinct
 

Constructor Detail

ServletQueryBuilder

public ServletQueryBuilder(javax.servlet.http.HttpServletRequest request)
Construct from a servlet request.

Parameters:
request - A servlet request object.
Since:
Version 0.1 2005-07-05

ServletQueryBuilder

public ServletQueryBuilder(javax.servlet.http.HttpServletRequest request,
                           boolean extended)
Construct with extended bNode query support.

Parameters:
request - A servlet request object.
extended - Whether to enable bNode query processing.
Since:
Version 0.1 2005-07-05
Method Detail

getQuery

public final Query getQuery()
Parse the query source and get a Query object.

Specified by:
getQuery in interface QueryBuilder
Returns:
A query based on the input source.
Since:
Version 0.1 2005-07-05

getQueryContext

protected final QueryContext getQueryContext()
Get the query output context.

Returns:
A suitable query context for the request.
Since:
Version 0.6 2005-08-02

parseParameter

protected final void parseParameter(java.lang.String value,
                                    SchemaProperty property,
                                    java.lang.StringBuffer queryUri)
Parse a parameter value.

Parameters:
value - The query parameter value.
property - The schema property for this parameter.
queryUri - The query URI to which to append the parameter name and value.
Since:
Version 0.1 2005-01-24
See Also:
StringTokenizer

appendTerm

protected final void appendTerm(java.lang.String term,
                                java.lang.StringBuffer queryUri)
Append a query term to the query URI.

Parameters:
term - The query term, which may include quoted phrases.
queryUri - The query buffer to which to append the term.
Since:
Version 0.7 2005-09-12

getPageNumber

protected final int getPageNumber()
Get the page number

Returns:
The requested page number.
Since:
Version 0.5 2005-08-01

getResultsPerPage

protected final int getResultsPerPage()
Get the number of results per page.

Returns:
The number of results per page.
Since:
Version 0.5 2005-08-01