Class JRDesignDataset
java.lang.Object
net.sf.jasperreports.engine.base.JRBaseDataset
net.sf.jasperreports.engine.design.JRDesignDataset
- All Implemented Interfaces:
Serializable
,Cloneable
,JRChangeEventsSupport
,JRCloneable
,JRDataset
,JRIdentifiable
,JRPropertiesHolder
Implementation of
JRDataset
to be used for report design.- Author:
- Lucian Chirita (lucianc@users.sourceforge.net)
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
static final String
static final String
Fields mapped by name.Groups mapped by name.protected List
<JRParameter> protected Map
<String, JRParameter> Parameters mapped by name.static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
protected List
<JRScriptlet> protected Map
<String, JRScriptlet> Scriptlets mapped by name.protected List
<JRSortField> protected Map
<String, JRSortField> Sort fields mapped by name.protected List
<JRVariable> protected Map
<String, JRVariable> Variables mapped by name.Fields inherited from class net.sf.jasperreports.engine.base.JRBaseDataset
fields, filterExpression, groups, isMain, name, parameters, propertiesMap, PROPERTY_WHEN_RESOURCE_MISSING_TYPE, query, resourceBundle, scriptletClass, scriptlets, sortFields, uuid, variables, whenResourceMissingType
-
Constructor Summary
ConstructorsConstructorDescriptionJRDesignDataset
(boolean isMain) Create a dataset.JRDesignDataset
(JasperReportsContext jasperReportsContext, boolean isMain) Create a dataset. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Inserts a field at the specified position into the dataset.void
Adds a field to the dataset.void
addGroup
(int index, JRDesignGroup group) Inserts a group at the specified position into the dataset.void
addGroup
(JRDesignGroup group) Adds a group to the dataset.void
addParameter
(int index, JRParameter parameter) Inserts a parameter at the specified position into the dataset.void
addParameter
(JRParameter parameter) Adds a parameter to the dataset.void
addPropertyExpression
(DatasetPropertyExpression propertyExpression) Add a dynamic/expression-based property.void
addScriptlet
(int index, JRScriptlet scriptlet) Inserts a scriptlet at the specified position into the dataset.void
addScriptlet
(JRScriptlet scriptlet) Adds a scriptlet to the dataset.void
addSortField
(int index, JRSortField sortField) Inserts a sort field at specified position into the dataset.void
addSortField
(JRSortField sortField) Adds a sort field to the dataset.void
addVariable
(int index, JRDesignVariable variable) Inserts a variable at specified position into the dataset.protected void
addVariable
(int index, JRDesignVariable variable, boolean system) Inserts a variable at specified position into the dataset.void
addVariable
(JRDesignVariable variable) Adds a variable to the dataset.protected void
addVariable
(JRDesignVariable variable, boolean system) Adds a variable to the dataset.clone()
JRField[]
Returns the dataset's fields.Returns the list of fields.Returns the map of fields indexed by name.JRGroup[]
Returns the dataset's groups.Returns the list of groups.Returns the map of groups indexed by name.Returns the dataset's parameters.Returns the list of parameters, including build-in ones.Returns the map of parameters, including build-in ones, indexed by name.Returns the list of dynamic/expression-based properties for this dataset.Returns the list of property expressions.Returns the dataset's scriptlets.Returns the list of scriptlets, excluding the scriptletClass one.Returns the map of scriptlets, excluding the scriptletClass one, indexed by name.Returns the dataset's sort fields.Returns the list of sort fields.Returns the map of sort fields indexed by name and type.Returns the dataset's variables.Returns the list of variables, including build-in ones.Returns the map of variable, including build-in ones, indexed by name.boolean
hasUUID()
Determines whether the report has an existing unique identifier.protected void
queryLanguageChanged
(String oldLanguage, String newLanguage) removeField
(String fieldName) Removes a field from the dataset.removeField
(JRField field) Removes a field from the dataset.removeGroup
(String groupName) Removes a group from the dataset.removeGroup
(JRGroup group) Removes a group from the dataset.removeParameter
(String parameterName) Removes a parameter from the dataset.removeParameter
(JRParameter parameter) Removes a parameter from the dataset.Remove a property expression.void
removePropertyExpression
(DatasetPropertyExpression propertyExpression) Remove a property expression.removeScriptlet
(String scriptletName) Removes a scriptlet from the dataset.removeScriptlet
(JRScriptlet scriptlet) Removes a scriptlet from the dataset.removeSortField
(JRSortField sortField) Removes a sort field from the dataset.removeVariable
(String variableName) Removes a variable from the dataset.removeVariable
(JRVariable variable) Removes a variable from the dataset.protected void
void
setFilterExpression
(JRExpression expression) Sets the dataset filter expression.protected void
setGroups
(List<JRDesignGroup> groups) void
Sets the name of the dataset.protected void
setParameters
(List<JRParameter> parameters) void
setProperty
(String propName, String value) Adds/sets a property value.protected void
setPropertyExpressions
(List<DatasetPropertyExpression> properties) void
setQuery
(JRDesignQuery query) Sets the dataset query.void
setResourceBundle
(String resourceBundle) Sets the base name of resource bundle to be used by the dataset.void
setScriptletClass
(String scriptletClass) Sets the scriptlet class name.protected void
setScriptlets
(List<JRScriptlet> scriptlets) protected void
setSortFields
(List<JRSortField> sortFields) void
Sets the unique identifier for the report.protected void
setVariables
(List<JRDesignVariable> variables) Methods inherited from class net.sf.jasperreports.engine.base.JRBaseDataset
getEventSupport, getFilterExpression, getName, getParentProperties, getPropertiesMap, getQuery, getResourceBundle, getScriptletClass, getUUID, getWhenResourceMissingType, hasProperties, isMainDataset, setWhenResourceMissingType
-
Field Details
-
EXCEPTION_MESSAGE_KEY_DUPLICATE_GROUP
- See Also:
-
EXCEPTION_MESSAGE_KEY_DUPLICATE_FIELD
- See Also:
-
EXCEPTION_MESSAGE_KEY_DUPLICATE_PARAMETER
- See Also:
-
EXCEPTION_MESSAGE_KEY_DUPLICATE_SCRIPTLET
- See Also:
-
EXCEPTION_MESSAGE_KEY_DUPLICATE_SORT_FIELD
- See Also:
-
EXCEPTION_MESSAGE_KEY_DUPLICATE_VARIABLE
- See Also:
-
EXCEPTION_MESSAGE_KEY_UNKNOWN_BUILTIN_PARAMETER_TYPE
- See Also:
-
PROPERTY_FIELDS
- See Also:
-
PROPERTY_FILTER_EXPRESSION
- See Also:
-
PROPERTY_GROUPS
- See Also:
-
PROPERTY_NAME
- See Also:
-
PROPERTY_SCRIPTLETS
- See Also:
-
PROPERTY_PARAMETERS
- See Also:
-
PROPERTY_QUERY
- See Also:
-
PROPERTY_RESOURCE_BUNDLE
- See Also:
-
PROPERTY_SCRIPTLET_CLASS
- See Also:
-
PROPERTY_SORT_FIELDS
- See Also:
-
PROPERTY_VARIABLES
- See Also:
-
PROPERTY_PROPERTY_EXPRESSIONS
- See Also:
-
scriptletsMap
Scriptlets mapped by name. -
scriptletsList
-
parametersMap
Parameters mapped by name. -
parametersList
-
fieldsMap
Fields mapped by name. -
fieldsList
-
sortFieldsMap
Sort fields mapped by name. -
sortFieldsList
-
variablesMap
Variables mapped by name. -
variablesList
-
groupsMap
Groups mapped by name. -
groupsList
-
-
Constructor Details
-
JRDesignDataset
public JRDesignDataset(boolean isMain) Create a dataset.- Parameters:
isMain
- whether this is the main dataset of the report or a sub dataset- See Also:
-
JRDesignDataset
Create a dataset.- Parameters:
isMain
- whether this is the main dataset of the report or a sub dataset- See Also:
-
-
Method Details
-
setUUID
Sets the unique identifier for the report.- Parameters:
uuid
- the identifier
-
hasUUID
public boolean hasUUID()Determines whether the report has an existing unique identifier. Note that when no existing identifier is set,JRBaseDataset.getUUID()
would generate and return an identifier.- Returns:
- whether the report has an externally set unique identifier
- See Also:
-
setName
Sets the name of the dataset.- Parameters:
name
- the name of the dataset- See Also:
-
getScriptlets
Description copied from interface:JRDataset
Returns the dataset's scriptlets.- Specified by:
getScriptlets
in interfaceJRDataset
- Overrides:
getScriptlets
in classJRBaseDataset
- Returns:
- the dataset's scriptlets
-
getScriptletsList
Returns the list of scriptlets, excluding the scriptletClass one.- Returns:
- list of
JRScriptlet
objects
-
setScriptlets
-
getScriptletsMap
Returns the map of scriptlets, excluding the scriptletClass one, indexed by name.- Returns:
JRScriptlet
objects indexed by name
-
addScriptlet
Adds a scriptlet to the dataset.- Parameters:
scriptlet
- the scriptlet to add- Throws:
JRException
- See Also:
-
addScriptlet
Inserts a scriptlet at the specified position into the dataset.- Parameters:
index
- the scriptlet positionscriptlet
- the scriptlet to insert- Throws:
JRException
- See Also:
-
removeScriptlet
Removes a scriptlet from the dataset.- Parameters:
scriptletName
- the scriptlet name- Returns:
- the removed scriptlet, or
null
if the scriptlet was not found
-
removeScriptlet
Removes a scriptlet from the dataset.- Parameters:
scriptlet
- the scriptlet to be removed- Returns:
- the scriptlet to be removed
-
getParameters
Description copied from interface:JRDataset
Returns the dataset's parameters.- Specified by:
getParameters
in interfaceJRDataset
- Overrides:
getParameters
in classJRBaseDataset
- Returns:
- the dataset's parameters
-
getParametersList
Returns the list of parameters, including build-in ones.- Returns:
- list of
JRParameter
objects
-
setParameters
- Throws:
JRException
-
getParametersMap
Returns the map of parameters, including build-in ones, indexed by name.- Returns:
JRParameter
objects indexed by name
-
addParameter
Adds a parameter to the dataset.- Parameters:
parameter
- the parameter to add- Throws:
JRException
- See Also:
-
addParameter
Inserts a parameter at the specified position into the dataset.- Parameters:
index
- the parameter positionparameter
- the parameter to insert- Throws:
JRException
- See Also:
-
removeParameter
Removes a parameter from the dataset.- Parameters:
parameterName
- the parameter name- Returns:
- the removed parameter, or
null
if the parameter was not found
-
removeParameter
Removes a parameter from the dataset.- Parameters:
parameter
- the parameter to be removed- Returns:
- the parameter to be removed
-
setQuery
Sets the dataset query.- Parameters:
query
- the query- See Also:
-
setScriptletClass
Sets the scriptlet class name.If no scriptlet class name is specified, a default scriptlet is used.
- Parameters:
scriptletClass
- the class name of the scriptlet- See Also:
-
getFields
Description copied from interface:JRDataset
Returns the dataset's fields.- Specified by:
getFields
in interfaceJRDataset
- Overrides:
getFields
in classJRBaseDataset
- Returns:
- the dataset's fields
-
getFieldsList
Returns the list of fields.- Returns:
- list of
JRField
objects
-
setFields
- Throws:
JRException
-
getFieldsMap
Returns the map of fields indexed by name.- Returns:
JRField
objects indexed by name
-
addField
Adds a field to the dataset.- Parameters:
field
- the field to add- Throws:
JRException
- See Also:
-
addField
Inserts a field at the specified position into the dataset.- Parameters:
index
- the field positionfield
- the field to insert- Throws:
JRException
- See Also:
-
removeField
Removes a field from the dataset.- Parameters:
fieldName
- the field name- Returns:
- the removed field, or
null
if the field was not found
-
removeField
Removes a field from the dataset.- Parameters:
field
- the field to be removed- Returns:
- the field to be removed
-
getSortFields
Description copied from interface:JRDataset
Returns the dataset's sort fields.- Specified by:
getSortFields
in interfaceJRDataset
- Overrides:
getSortFields
in classJRBaseDataset
- Returns:
- the dataset's sort fields
-
getSortFieldsList
Returns the list of sort fields.- Returns:
- list of
JRSortField
objects
-
setSortFields
- Throws:
JRException
-
getSortFieldsMap
Returns the map of sort fields indexed by name and type.- Returns:
JRField
objects indexed by name
-
addSortField
Adds a sort field to the dataset.- Parameters:
sortField
- the sort field to add- Throws:
JRException
- See Also:
-
addSortField
Inserts a sort field at specified position into the dataset.- Parameters:
index
- the sort field positionsortField
- the sort field to insert- Throws:
JRException
- See Also:
-
removeSortField
Removes a sort field from the dataset.- Parameters:
sortField
- the sort field to be removed- Returns:
- the sort field to be removed
-
getVariables
Description copied from interface:JRDataset
Returns the dataset's variables.- Specified by:
getVariables
in interfaceJRDataset
- Overrides:
getVariables
in classJRBaseDataset
- Returns:
- the dataset's variables
-
getVariablesList
Returns the list of variables, including build-in ones.- Returns:
- list of
JRVariable
objects
-
setVariables
- Throws:
JRException
-
getVariablesMap
Returns the map of variable, including build-in ones, indexed by name.- Returns:
JRVariable
objects indexed by name
-
addVariable
Adds a variable to the dataset.- Parameters:
variable
- the variable to add- Throws:
JRException
- See Also:
-
addVariable
Inserts a variable at specified position into the dataset.- Parameters:
index
- the variable positionvariable
- the variable to insert- Throws:
JRException
- See Also:
-
addVariable
Adds a variable to the dataset.- Parameters:
variable
- the variable to addsystem
- whether the variable should be added before user defined variables or at the end of the variables list- Throws:
JRException
-
addVariable
Inserts a variable at specified position into the dataset.- Parameters:
index
- the variable positionvariable
- the variable to insertsystem
- whether the variable should be inserted before user defined variables or at the end of the variables list- Throws:
JRException
-
removeVariable
Removes a variable from the dataset.- Parameters:
variableName
- the variable name- Returns:
- the removed variable, or
null
if the variable was not found
-
removeVariable
Removes a variable from the dataset.- Parameters:
variable
- the variable to be removed- Returns:
- the variable to be removed
-
getGroups
Description copied from interface:JRDataset
Returns the dataset's groups.- Specified by:
getGroups
in interfaceJRDataset
- Overrides:
getGroups
in classJRBaseDataset
- Returns:
- the dataset's groups
-
getGroupsList
Returns the list of groups.- Returns:
- list of
JRGroup
objects
-
setGroups
- Throws:
JRException
-
getGroupsMap
Returns the map of groups indexed by name.- Returns:
JRGroup
objects indexed by name
-
addGroup
Adds a group to the dataset.- Parameters:
group
- the group to add- Throws:
JRException
- See Also:
-
addGroup
Inserts a group at the specified position into the dataset.- Parameters:
index
- the group positiongroup
- the group to insert- Throws:
JRException
- See Also:
-
removeGroup
Removes a group from the dataset.- Parameters:
groupName
- the group name- Returns:
- the removed group, or
null
if the group was not found
-
removeGroup
Removes a group from the dataset.- Parameters:
group
- the group to be removed- Returns:
- the group to be removed
-
setResourceBundle
Sets the base name of resource bundle to be used by the dataset.- Parameters:
resourceBundle
- the resource bundle base name
-
queryLanguageChanged
-
setProperty
Adds/sets a property value.- Parameters:
propName
- the name of the propertyvalue
- the value of the property
-
addPropertyExpression
Add a dynamic/expression-based property.- Parameters:
propertyExpression
- the property to add- See Also:
-
removePropertyExpression
Remove a property expression.- Parameters:
propertyExpression
- the property expression to remove- See Also:
-
removePropertyExpression
Remove a property expression.- Parameters:
name
- the name of the property to remove- Returns:
- the removed property expression (if found)
-
getPropertyExpressionsList
Returns the list of property expressions.- Returns:
- the list of property expressions (
DatasetPropertyExpression
instances) - See Also:
-
getPropertyExpressions
Description copied from interface:JRDataset
Returns the list of dynamic/expression-based properties for this dataset.- Specified by:
getPropertyExpressions
in interfaceJRDataset
- Overrides:
getPropertyExpressions
in classJRBaseDataset
- Returns:
- an array containing the expression-based properties of this dataset
-
setPropertyExpressions
-
setFilterExpression
Sets the dataset filter expression.The expression value class should be
java.lang.Boolean
.- Parameters:
expression
- the boolean expression to use as filter expression- See Also:
-
clone
- Specified by:
clone
in interfaceJRCloneable
- Overrides:
clone
in classJRBaseDataset
-