net.sf.jasperreports.engine.query
public abstract class JRAbstractQueryExecuter extends java.lang.Object implements JRQueryExecuter
Modifier and Type | Class and Description |
---|---|
protected static class |
JRAbstractQueryExecuter.QueryParameter
A parameter present in the query.
|
Modifier and Type | Field and Description |
---|---|
protected static int |
CLAUSE_POSITION_ID |
protected java.util.Map |
clauseFunctions
Clause function registry.
|
protected JRDataset |
dataset |
Modifier | Constructor and Description |
---|---|
protected |
JRAbstractQueryExecuter(JRDataset dataset,
java.util.Map parametersMap) |
Modifier and Type | Method and Description |
---|---|
protected void |
addQueryMultiParameters(java.lang.String parameterName,
int count)
Records a multi-valued query parameter.
|
protected void |
addQueryParameter(java.lang.String parameterName)
Records a query parameter.
|
protected void |
appendClauseChunk(java.lang.StringBuffer sbuffer,
java.lang.String[] clauseTokens)
Handles a
clause query chunk . |
protected void |
appendParameterChunk(java.lang.StringBuffer sbuffer,
java.lang.String chunkText) |
protected void |
appendParameterClauseChunk(java.lang.StringBuffer sbuffer,
java.lang.String chunkText) |
protected void |
appendQueryChunk(java.lang.StringBuffer sbuffer,
JRQueryChunk chunk) |
protected void |
appendTextChunk(java.lang.StringBuffer sbuffer,
java.lang.String text) |
protected void |
applyClause(JRClauseFunction function,
JRClauseTokens tokens,
java.lang.StringBuffer sbuffer) |
protected void |
checkParameter(java.lang.String parameterName) |
protected java.util.List |
getCollectedParameterNames()
Returns the list of parameter names in the order in which they appear in the query.
|
protected java.util.List |
getCollectedParameters()
Returns the list of
query parameters in the order in which they appear in the query. |
protected JRFillParameter |
getParameter(java.lang.String parameterName)
Deprecated.
getValueParameter(String) should be used instead |
protected abstract java.lang.String |
getParameterReplacement(java.lang.String parameterName)
Returns the replacement text for a query paramter.
|
protected java.lang.Object |
getParameterValue(java.lang.String parameterName)
Returns the value of a fill paramter.
|
protected java.lang.Object |
getParameterValue(java.lang.String parameterName,
boolean ignoreMissing)
Returns the value of a fill paramter.
|
protected java.lang.String |
getQueryString()
Returns the parsed query string with the paramter clauses replaced by the paramter values and
the parameters replaced by
getParameterReplacement . |
protected JRValueParameter |
getValueParameter(java.lang.String parameterName)
Return a value parameter from the parameters map.
|
protected JRValueParameter |
getValueParameter(java.lang.String parameterName,
boolean ignoreMissing)
Return a value parameter from the paramters map.
|
protected void |
parseQuery()
Parses the query and replaces the parameter clauses by the paramter values and
the parameters by the return value of
getParameterReplacement . |
protected void |
registerClauseFunction(java.lang.String id,
JRClauseFunction function)
Registers a clause function.
|
protected JRClauseFunction |
resolveFunction(java.lang.String id)
Resolves a clause function ID to a function instance.
|
protected void |
unregisterClauseFunction(java.lang.String id)
Unregisters a clause function.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
cancelQuery, close, createDatasource
protected static final int CLAUSE_POSITION_ID
protected final java.util.Map clauseFunctions
protected final JRDataset dataset
protected JRAbstractQueryExecuter(JRDataset dataset, java.util.Map parametersMap)
protected void registerClauseFunction(java.lang.String id, JRClauseFunction function)
id
- the function IDfunction
- the functionprotected void unregisterClauseFunction(java.lang.String id)
id
- the function IDprotected JRClauseFunction resolveFunction(java.lang.String id)
id
- the function IDJRRuntimeException
- if no function for the ID is foundprotected void parseQuery()
getParameterReplacement
.protected void appendQueryChunk(java.lang.StringBuffer sbuffer, JRQueryChunk chunk)
protected void appendTextChunk(java.lang.StringBuffer sbuffer, java.lang.String text)
protected void appendParameterChunk(java.lang.StringBuffer sbuffer, java.lang.String chunkText)
protected void addQueryParameter(java.lang.String parameterName)
parameterName
- the parameter namegetCollectedParameters()
protected void addQueryMultiParameters(java.lang.String parameterName, int count)
parameterName
- the parameter namecount
- the value countgetCollectedParameters()
,
JRAbstractQueryExecuter.QueryParameter.isMulti()
protected void appendParameterClauseChunk(java.lang.StringBuffer sbuffer, java.lang.String chunkText)
protected void appendClauseChunk(java.lang.StringBuffer sbuffer, java.lang.String[] clauseTokens)
clause query chunk
.
The default implementation considers the first token as a
clause function
ID and delegates the call to the
function.
Extending query executers can override this to implement custom query clause handling.
sbuffer
- the query text bufferclauseTokens
- clause tokensJRRuntimeException
- if there is no first token or no clause function is found for the IDregisterClauseFunction(String, JRClauseFunction)
protected void applyClause(JRClauseFunction function, JRClauseTokens tokens, java.lang.StringBuffer sbuffer)
protected java.lang.String getQueryString()
getParameterReplacement
.protected java.util.List getCollectedParameterNames()
protected java.util.List getCollectedParameters()
query parameters
in the order in which they appear in the query.protected java.lang.Object getParameterValue(java.lang.String parameterName, boolean ignoreMissing)
parameterName
- the paramter nameignoreMissing
- if true
, the method will return null for non existing parameters;
otherwise, an exception will be thrown if the parameter does not existprotected java.lang.Object getParameterValue(java.lang.String parameterName)
parameterName
- the paramter nameprotected JRFillParameter getParameter(java.lang.String parameterName)
getValueParameter(String)
should be used insteadparameterName
- the paramter nameprotected void checkParameter(java.lang.String parameterName)
protected JRValueParameter getValueParameter(java.lang.String parameterName, boolean ignoreMissing)
parameterName
- the paramter nameignoreMissing
- if true
, the method will return null for non existing parameters;
otherwise, an exception will be thrown if the parameter does not existprotected JRValueParameter getValueParameter(java.lang.String parameterName)
parameterName
- the parameter nameprotected abstract java.lang.String getParameterReplacement(java.lang.String parameterName)
parameterName
- the paramter nameJRQueryChunk.TYPE_PARAMETER
© 2001-2010 Jaspersoft Corporation www.jaspersoft.com