|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.jasperreports.engine.fill.JRFillDataset
public class JRFillDataset
Nested Class Summary | |
---|---|
protected static class |
JRFillDataset.VariableCalculationReq
Class used to hold expression calculation requirements. |
Field Summary | |
---|---|
protected JRCalculator |
calculator
The calculator used by the dataset. |
protected JRDataSource |
dataSource
The data source. |
protected JRAbstractScriptlet |
delegateScriptlet
|
protected JRFillElementDataset[] |
elementDatasets
The element datasets. |
protected JRFillField[] |
fields
The dataset fields. |
protected java.util.Map<java.lang.String,JRFillField> |
fieldsMap
The dataset fields indexed by name. |
protected DatasetFilter |
filter
|
protected JRFillGroup[] |
groups
The dataset groups. |
protected java.util.Locale |
locale
The Locale to be used by the dataset. |
protected JRFillElementDataset[] |
origElementDatasets
Used to save the original element datasets when filterElementDatasets is called. |
protected JRFillParameter[] |
parameters
The dataset parameters. |
protected java.util.Map<java.lang.String,JRFillParameter> |
parametersMap
The dataset parameters indexed by name. |
protected JRQuery |
query
The dataset query. |
protected int |
reportCount
The cursor used when iterating the data source. |
protected java.lang.Integer |
reportMaxCount
The value of the max count parameter. |
protected java.util.ResourceBundle |
resourceBundle
The loaded resource bundle. |
protected java.lang.String |
resourceBundleBaseName
The resource bundle base name. |
protected java.lang.String |
scriptletClassName
The scriptlet class name. |
protected java.util.List<JRAbstractScriptlet> |
scriptlets
The scriptlets used by the dataset. |
protected java.util.TimeZone |
timeZone
The TimeZone to be used by the dataset. |
protected java.util.Set<JRFillDataset.VariableCalculationReq> |
variableCalculationReqs
Set of VariableCalculationReq objects. |
protected JRFillVariable[] |
variables
The dataset variables. |
protected java.util.Map<java.lang.String,JRFillVariable> |
variablesMap
The dataset variables indexed by name. |
protected WhenResourceMissingTypeEnum |
whenResourceMissingType
The resource missing handle type. |
Constructor Summary | |
---|---|
JRFillDataset(JRBaseFiller filler,
JRDataset dataset,
JRFillObjectFactory factory)
Creates a fill dataset object. |
Method Summary | |
---|---|
protected void |
addVariableCalculationReq(java.lang.String variableName,
CalculationEnum calculation)
Adds a variable calculation requirement. |
protected boolean |
advanceDataSource(boolean limit)
|
protected void |
checkVariableCalculationReqs(JRFillObjectFactory factory)
Checks if there are variable calculation requirements and creates the required variables. |
java.lang.Object |
clone()
|
void |
closeDatasource()
Closes the data source used by this dataset if this data source was obtained via a query executer. |
void |
createCalculator(JasperReport jasperReport)
Creates the calculator |
protected static JRCalculator |
createCalculator(JasperReport jasperReport,
JRDataset dataset)
|
protected java.util.List<JRAbstractScriptlet> |
createScriptlets(java.util.Map<java.lang.String,java.lang.Object> parameterValues)
Creates the scriptlets. |
java.lang.Object |
evaluateExpression(JRExpression expression,
byte evaluation)
Evaluates an expression |
protected boolean |
evaluateFilter()
|
protected void |
filterElementDatasets(JRFillElementDataset elementDataset)
Filters the element datasets, leaving only one. |
JRField[] |
getFields()
Returns the dataset's fields. |
java.lang.Object |
getFieldValue(java.lang.String fieldName)
Returns the value of a field. |
java.lang.Object |
getFieldValue(java.lang.String fieldName,
EvaluationType evaluation)
Returns the value of a field. |
JRFillField |
getFillField(java.lang.String fieldName)
|
JRFillVariable |
getFillVariable(java.lang.String variableName)
|
JRExpression |
getFilterExpression()
Returns the dataset filter expression. |
JRGroup[] |
getGroups()
Returns the dataset's groups. |
java.util.Locale |
getLocale()
Returns the locale used by the dataset. |
java.lang.String |
getName()
Returns the dataset name. |
JRParameter[] |
getParameters()
Returns the dataset's parameters. |
java.util.Map<java.lang.String,JRFillParameter> |
getParametersMap()
|
java.lang.Object |
getParameterValue(java.lang.String parameterName)
Returns the value of a parameter. |
java.lang.Object |
getParameterValue(java.lang.String parameterName,
boolean ignoreMissing)
Returns the value of a parameter. |
protected java.util.Map<java.lang.String,java.lang.Object> |
getParameterValuesMap()
Returns the map of parameter values. |
JRPropertiesHolder |
getParentProperties()
Returns the parent properties holder, whose properties are used as defaults for this object. |
JRPropertiesMap |
getPropertiesMap()
Returns this object's properties map. |
JRQuery |
getQuery()
Returns the query of the dataset. |
java.lang.String |
getResourceBundle()
Returns the resource bundle base name. |
java.lang.String |
getScriptletClass()
The name of the scriptlet class to be used when iterating this dataset. |
JRScriptlet[] |
getScriptlets()
Returns the dataset's scriptlets. |
JRSortField[] |
getSortFields()
Returns the dataset's sort fields. |
JRVariable[] |
getVariables()
Returns the dataset's variables. |
java.lang.Object |
getVariableValue(java.lang.String variableName)
Returns the value of a variable. |
java.lang.Object |
getVariableValue(java.lang.String variableName,
EvaluationType evaluation)
Returns the value of a variable. |
WhenResourceMissingTypeEnum |
getWhenResourceMissingTypeValue()
Returns the resource missing handling type. |
boolean |
hasProperties()
Checks whether the object has any properties. |
protected void |
inheritFromMain()
Inherits properties from the report. |
void |
initCalculator()
Initializes the calculator. |
void |
initDatasource()
Initializes the data source which will be used by this dataset. |
protected void |
initElementDatasets(JRFillObjectFactory factory)
Initializes the element datasets. |
boolean |
isMainDataset()
Decides whether this dataset is the main report dataset or a sub dataset. |
protected java.util.ResourceBundle |
loadResourceBundle()
Loads the resource bundle corresponding to the resource bundle base name and locale. |
boolean |
next()
Moves to the next record in the data source. |
protected boolean |
next(boolean filter)
Moves to the next record in the data source. |
protected void |
reset()
|
protected void |
resetVariables()
|
protected void |
restoreElementDatasets()
Restores the original element datasets. |
protected void |
revertToOldValues()
|
protected void |
setCalculator(JRCalculator calculator)
|
void |
setConnectionParameterValue(java.util.Map<java.lang.String,java.lang.Object> parameterValues,
java.sql.Connection conn)
Sets the JDBC connection to be used. |
void |
setDatasourceParameterValue(java.util.Map<java.lang.String,java.lang.Object> parameterValues,
JRDataSource ds)
Sets the data source to be used. |
protected void |
setOldValues()
|
protected void |
setParameter(JRFillParameter parameter,
java.lang.Object value)
Sets the value of the parameter. |
protected void |
setParameter(java.lang.String parameterName,
java.lang.Object value)
Sets the value of a parameter. |
void |
setParameterValues(java.util.Map<java.lang.String,java.lang.Object> parameterValues)
Reads built-in parameter values from the value map. |
void |
setWhenResourceMissingType(WhenResourceMissingTypeEnum whenResourceMissingType)
Sets the resource missing handling type. |
void |
start()
Starts the iteration on the data source. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected JRQuery query
protected JRFillParameter[] parameters
protected java.util.Map<java.lang.String,JRFillParameter> parametersMap
protected JRFillField[] fields
protected java.util.Map<java.lang.String,JRFillField> fieldsMap
protected JRFillVariable[] variables
protected java.util.Map<java.lang.String,JRFillVariable> variablesMap
protected java.util.Set<JRFillDataset.VariableCalculationReq> variableCalculationReqs
VariableCalculationReq
objects.
protected JRFillElementDataset[] elementDatasets
protected JRFillElementDataset[] origElementDatasets
filterElementDatasets
is called.
protected JRFillGroup[] groups
protected java.lang.String resourceBundleBaseName
protected WhenResourceMissingTypeEnum whenResourceMissingType
protected java.lang.String scriptletClassName
protected JRDataSource dataSource
protected java.util.Locale locale
Locale
to be used by the dataset.
protected java.util.ResourceBundle resourceBundle
protected java.util.TimeZone timeZone
TimeZone
to be used by the dataset.
protected int reportCount
protected JRCalculator calculator
protected java.util.List<JRAbstractScriptlet> scriptlets
protected JRAbstractScriptlet delegateScriptlet
protected java.lang.Integer reportMaxCount
max count
parameter.
protected DatasetFilter filter
Constructor Detail |
---|
public JRFillDataset(JRBaseFiller filler, JRDataset dataset, JRFillObjectFactory factory)
filler
- the fillerdataset
- the template datasetfactory
- the fill object factoryMethod Detail |
---|
public void createCalculator(JasperReport jasperReport) throws JRException
jasperReport
- the report
JRException
protected void setCalculator(JRCalculator calculator)
protected static JRCalculator createCalculator(JasperReport jasperReport, JRDataset dataset) throws JRException
JRException
public void initCalculator() throws JRException
JRException
protected void inheritFromMain()
protected java.util.List<JRAbstractScriptlet> createScriptlets(java.util.Map<java.lang.String,java.lang.Object> parameterValues) throws JRException
JRException
protected void initElementDatasets(JRFillObjectFactory factory)
factory
- the fill object factory used by the fillerprotected void filterElementDatasets(JRFillElementDataset elementDataset)
This method is used when a dataset is instantiated by a chart or crosstab.
elementDataset
- the element dataset that should remainprotected void restoreElementDatasets()
This method should be called after filterElementDatasets
.
protected java.util.ResourceBundle loadResourceBundle()
public void setParameterValues(java.util.Map<java.lang.String,java.lang.Object> parameterValues) throws JRException
parameterValues
- the parameter values
JRException
public void initDatasource() throws JRException
JRException
protected java.util.Map<java.lang.String,java.lang.Object> getParameterValuesMap()
protected void reset()
public void setDatasourceParameterValue(java.util.Map<java.lang.String,java.lang.Object> parameterValues, JRDataSource ds)
parameterValues
- the parameter valuesds
- the data sourcepublic void setConnectionParameterValue(java.util.Map<java.lang.String,java.lang.Object> parameterValues, java.sql.Connection conn)
parameterValues
- the parameter valuesconn
- the connectionpublic void closeDatasource()
JRQueryExecuter.close()
public void start()
protected void resetVariables()
public boolean next() throws JRException
true
if the data source was not exhausted
JRException
protected boolean next(boolean filter) throws JRException
filter
- whether to apply the dataset filter and max count
true
if the data source was not exhausted
JRException
protected void setOldValues() throws JRException
JRException
protected void revertToOldValues()
protected boolean advanceDataSource(boolean limit) throws JRException
JRException
protected boolean evaluateFilter() throws JRException
JRException
protected void setParameter(java.lang.String parameterName, java.lang.Object value) throws JRException
parameterName
- the parameter namevalue
- the value
JRException
protected void setParameter(JRFillParameter parameter, java.lang.Object value) throws JRException
parameter
- the parametervalue
- the value
JRException
public java.lang.Object getVariableValue(java.lang.String variableName)
variableName
- the variable name
public java.lang.Object getVariableValue(java.lang.String variableName, EvaluationType evaluation)
DatasetFillContext
getVariableValue
in interface DatasetFillContext
variableName
- the variable nameevaluation
- the evaluation type
public JRFillVariable getFillVariable(java.lang.String variableName)
public java.lang.Object getParameterValue(java.lang.String parameterName)
getParameterValue
in interface DatasetFillContext
parameterName
- the parameter name
public java.lang.Object getParameterValue(java.lang.String parameterName, boolean ignoreMissing)
parameterName
- the parameter nameignoreMissing
- if set, null
will be returned for inexisting parameters
public java.lang.Object getFieldValue(java.lang.String fieldName)
fieldName
- the field name
public java.lang.Object getFieldValue(java.lang.String fieldName, EvaluationType evaluation)
DatasetFillContext
getFieldValue
in interface DatasetFillContext
fieldName
- the field nameevaluation
- the evaluation type
public JRFillField getFillField(java.lang.String fieldName)
protected void addVariableCalculationReq(java.lang.String variableName, CalculationEnum calculation)
variableName
- the variable namecalculation
- the required calculationprotected void checkVariableCalculationReqs(JRFillObjectFactory factory)
factory
- the fill object factorypublic java.lang.String getName()
JRDataset
getName
in interface JRDataset
public java.lang.String getScriptletClass()
JRDataset
getScriptletClass
in interface JRDataset
public JRScriptlet[] getScriptlets()
JRDataset
getScriptlets
in interface JRDataset
public JRParameter[] getParameters()
JRDataset
getParameters
in interface JRDataset
public java.util.Map<java.lang.String,JRFillParameter> getParametersMap()
public JRQuery getQuery()
JRDataset
The query is used by passing a connection is passed to the dataset when instantiating.
getQuery
in interface JRDataset
public JRField[] getFields()
JRDataset
getFields
in interface JRDataset
public JRSortField[] getSortFields()
JRDataset
getSortFields
in interface JRDataset
public JRVariable[] getVariables()
JRDataset
getVariables
in interface JRDataset
public JRGroup[] getGroups()
JRDataset
getGroups
in interface JRDataset
public boolean isMainDataset()
JRDataset
isMainDataset
in interface JRDataset
true
if and only if this dataset is the main report datasetpublic java.lang.String getResourceBundle()
JRDataset
The resource bundle is used when evaluating expressions.
getResourceBundle
in interface JRDataset
public WhenResourceMissingTypeEnum getWhenResourceMissingTypeValue()
JRDataset
getWhenResourceMissingTypeValue
in interface JRDataset
public void setWhenResourceMissingType(WhenResourceMissingTypeEnum whenResourceMissingType)
JRDataset
setWhenResourceMissingType
in interface JRDataset
whenResourceMissingType
- the resource missing handling typepublic boolean hasProperties()
JRPropertiesHolder
hasProperties
in interface JRPropertiesHolder
public JRPropertiesMap getPropertiesMap()
JRPropertiesHolder
getPropertiesMap
in interface JRPropertiesHolder
public JRPropertiesHolder getParentProperties()
JRPropertiesHolder
getParentProperties
in interface JRPropertiesHolder
null
if no parentpublic JRExpression getFilterExpression()
JRDataset
This expression is used to filter the rows of the
data source
that this dataset will iterate on.
This expression (if not null) is evaluated immediately after a new row is
produced
by the data source.
The evaluation is performed using field and variable values corresponding to the new row.
When the result of the evaluation is Boolean.TRUE
the row gets processed by the report
filling engine.
When the result is null or Boolean.FALSE
, the current row will be skipped and the datasource will be asked for the next row.
getFilterExpression
in interface JRDataset
public java.lang.Object clone()
clone
in interface JRCloneable
clone
in class java.lang.Object
public java.lang.Object evaluateExpression(JRExpression expression, byte evaluation) throws JRException
expression
- the expressionevaluation
- the evaluation type
JRException
public java.util.Locale getLocale()
DatasetFillContext
getLocale
in interface DatasetFillContext
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |