Class JRDesignDataset

    • Field Detail

      • EXCEPTION_MESSAGE_KEY_DUPLICATE_GROUP

        public static final java.lang.String EXCEPTION_MESSAGE_KEY_DUPLICATE_GROUP
        See Also:
        Constant Field Values
      • EXCEPTION_MESSAGE_KEY_DUPLICATE_FIELD

        public static final java.lang.String EXCEPTION_MESSAGE_KEY_DUPLICATE_FIELD
        See Also:
        Constant Field Values
      • EXCEPTION_MESSAGE_KEY_DUPLICATE_PARAMETER

        public static final java.lang.String EXCEPTION_MESSAGE_KEY_DUPLICATE_PARAMETER
        See Also:
        Constant Field Values
      • EXCEPTION_MESSAGE_KEY_DUPLICATE_SCRIPTLET

        public static final java.lang.String EXCEPTION_MESSAGE_KEY_DUPLICATE_SCRIPTLET
        See Also:
        Constant Field Values
      • EXCEPTION_MESSAGE_KEY_DUPLICATE_SORT_FIELD

        public static final java.lang.String EXCEPTION_MESSAGE_KEY_DUPLICATE_SORT_FIELD
        See Also:
        Constant Field Values
      • EXCEPTION_MESSAGE_KEY_DUPLICATE_VARIABLE

        public static final java.lang.String EXCEPTION_MESSAGE_KEY_DUPLICATE_VARIABLE
        See Also:
        Constant Field Values
      • EXCEPTION_MESSAGE_KEY_UNKNOWN_BUILTIN_PARAMETER_TYPE

        public static final java.lang.String EXCEPTION_MESSAGE_KEY_UNKNOWN_BUILTIN_PARAMETER_TYPE
        See Also:
        Constant Field Values
      • PROPERTY_FILTER_EXPRESSION

        public static final java.lang.String PROPERTY_FILTER_EXPRESSION
        See Also:
        Constant Field Values
      • PROPERTY_SCRIPTLETS

        public static final java.lang.String PROPERTY_SCRIPTLETS
        See Also:
        Constant Field Values
      • PROPERTY_PARAMETERS

        public static final java.lang.String PROPERTY_PARAMETERS
        See Also:
        Constant Field Values
      • PROPERTY_RESOURCE_BUNDLE

        public static final java.lang.String PROPERTY_RESOURCE_BUNDLE
        See Also:
        Constant Field Values
      • PROPERTY_SCRIPTLET_CLASS

        public static final java.lang.String PROPERTY_SCRIPTLET_CLASS
        See Also:
        Constant Field Values
      • PROPERTY_SORT_FIELDS

        public static final java.lang.String PROPERTY_SORT_FIELDS
        See Also:
        Constant Field Values
      • PROPERTY_VARIABLES

        public static final java.lang.String PROPERTY_VARIABLES
        See Also:
        Constant Field Values
      • PROPERTY_PROPERTY_EXPRESSIONS

        public static final java.lang.String PROPERTY_PROPERTY_EXPRESSIONS
        See Also:
        Constant Field Values
      • scriptletsMap

        protected java.util.Map<java.lang.String,​JRScriptlet> scriptletsMap
        Scriptlets mapped by name.
      • scriptletsList

        protected java.util.List<JRScriptlet> scriptletsList
      • parametersMap

        protected java.util.Map<java.lang.String,​JRParameter> parametersMap
        Parameters mapped by name.
      • parametersList

        protected java.util.List<JRParameter> parametersList
      • fieldsMap

        protected java.util.Map<java.lang.String,​JRField> fieldsMap
        Fields mapped by name.
      • fieldsList

        protected java.util.List<JRField> fieldsList
      • sortFieldsMap

        protected java.util.Map<java.lang.String,​JRSortField> sortFieldsMap
        Sort fields mapped by name.
      • sortFieldsList

        protected java.util.List<JRSortField> sortFieldsList
      • variablesMap

        protected java.util.Map<java.lang.String,​JRVariable> variablesMap
        Variables mapped by name.
      • variablesList

        protected java.util.List<JRVariable> variablesList
      • groupsMap

        protected java.util.Map<java.lang.String,​JRGroup> groupsMap
        Groups mapped by name.
      • groupsList

        protected java.util.List<JRGroup> groupsList
    • Constructor Detail

      • 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:
        JRDataset.isMainDataset()
      • JRDesignDataset

        public JRDesignDataset​(JasperReportsContext jasperReportsContext,
                               boolean isMain)
        Create a dataset.
        Parameters:
        isMain - whether this is the main dataset of the report or a sub dataset
        See Also:
        JRDataset.isMainDataset()
    • Method Detail

      • setUUID

        public void setUUID​(java.util.UUID uuid)
        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:
        setUUID(UUID)
      • setName

        public void setName​(java.lang.String name)
        Sets the name of the dataset.
        Parameters:
        name - the name of the dataset
        See Also:
        JRDataset.getName()
      • getScriptletsList

        public java.util.List<JRScriptlet> getScriptletsList()
        Returns the list of scriptlets, excluding the scriptletClass one.
        Returns:
        list of JRScriptlet objects
      • getScriptletsMap

        public java.util.Map<java.lang.String,​JRScriptlet> getScriptletsMap()
        Returns the map of scriptlets, excluding the scriptletClass one, indexed by name.
        Returns:
        JRScriptlet objects indexed by name
      • addScriptlet

        public void addScriptlet​(int index,
                                 JRScriptlet scriptlet)
                          throws JRException
        Inserts a scriptlet at the specified position into the dataset.
        Parameters:
        index - the scriptlet position
        scriptlet - the scriptlet to insert
        Throws:
        JRException
        See Also:
        JRDataset.getScriptlets()
      • removeScriptlet

        public JRScriptlet removeScriptlet​(java.lang.String scriptletName)
        Removes a scriptlet from the dataset.
        Parameters:
        scriptletName - the scriptlet name
        Returns:
        the removed scriptlet, or null if the scriptlet was not found
      • removeScriptlet

        public JRScriptlet removeScriptlet​(JRScriptlet scriptlet)
        Removes a scriptlet from the dataset.
        Parameters:
        scriptlet - the scriptlet to be removed
        Returns:
        the scriptlet to be removed
      • getParametersList

        public java.util.List<JRParameter> getParametersList()
        Returns the list of parameters, including build-in ones.
        Returns:
        list of JRParameter objects
      • getParametersMap

        public java.util.Map<java.lang.String,​JRParameter> getParametersMap()
        Returns the map of parameters, including build-in ones, indexed by name.
        Returns:
        JRParameter objects indexed by name
      • addParameter

        public void addParameter​(int index,
                                 JRParameter parameter)
                          throws JRException
        Inserts a parameter at the specified position into the dataset.
        Parameters:
        index - the parameter position
        parameter - the parameter to insert
        Throws:
        JRException
        See Also:
        JRDataset.getParameters()
      • removeParameter

        public JRParameter removeParameter​(java.lang.String parameterName)
        Removes a parameter from the dataset.
        Parameters:
        parameterName - the parameter name
        Returns:
        the removed parameter, or null if the parameter was not found
      • removeParameter

        public JRParameter removeParameter​(JRParameter parameter)
        Removes a parameter from the dataset.
        Parameters:
        parameter - the parameter to be removed
        Returns:
        the parameter to be removed
      • setScriptletClass

        public void setScriptletClass​(java.lang.String scriptletClass)
        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:
        JRDataset.getScriptletClass()
      • getFieldsList

        public java.util.List<JRField> getFieldsList()
        Returns the list of fields.
        Returns:
        list of JRField objects
      • getFieldsMap

        public java.util.Map<java.lang.String,​JRField> getFieldsMap()
        Returns the map of fields indexed by name.
        Returns:
        JRField objects indexed by name
      • addField

        public void addField​(int index,
                             JRField field)
                      throws JRException
        Inserts a field at the specified position into the dataset.
        Parameters:
        index - the field position
        field - the field to insert
        Throws:
        JRException
        See Also:
        JRDataset.getFields()
      • removeField

        public JRField removeField​(java.lang.String fieldName)
        Removes a field from the dataset.
        Parameters:
        fieldName - the field name
        Returns:
        the removed field, or null if the field was not found
      • removeField

        public JRField removeField​(JRField field)
        Removes a field from the dataset.
        Parameters:
        field - the field to be removed
        Returns:
        the field to be removed
      • getSortFieldsList

        public java.util.List<JRSortField> getSortFieldsList()
        Returns the list of sort fields.
        Returns:
        list of JRSortField objects
      • getSortFieldsMap

        public java.util.Map<java.lang.String,​JRSortField> getSortFieldsMap()
        Returns the map of sort fields indexed by name and type.
        Returns:
        JRField objects indexed by name
      • addSortField

        public void addSortField​(int index,
                                 JRSortField sortField)
                          throws JRException
        Inserts a sort field at specified position into the dataset.
        Parameters:
        index - the sort field position
        sortField - the sort field to insert
        Throws:
        JRException
        See Also:
        JRDataset.getSortFields()
      • removeSortField

        public JRSortField removeSortField​(JRSortField sortField)
        Removes a sort field from the dataset.
        Parameters:
        sortField - the sort field to be removed
        Returns:
        the sort field to be removed
      • getVariablesList

        public java.util.List<JRVariable> getVariablesList()
        Returns the list of variables, including build-in ones.
        Returns:
        list of JRVariable objects
      • getVariablesMap

        public java.util.Map<java.lang.String,​JRVariable> getVariablesMap()
        Returns the map of variable, including build-in ones, indexed by name.
        Returns:
        JRVariable objects indexed by name
      • addVariable

        protected void addVariable​(JRDesignVariable variable,
                                   boolean system)
                            throws JRException
        Adds a variable to the dataset.
        Parameters:
        variable - the variable to add
        system - whether the variable should be added before user defined variables or at the end of the variables list
        Throws:
        JRException
      • addVariable

        protected void addVariable​(int index,
                                   JRDesignVariable variable,
                                   boolean system)
                            throws JRException
        Inserts a variable at specified position into the dataset.
        Parameters:
        index - the variable position
        variable - the variable to insert
        system - whether the variable should be inserted before user defined variables or at the end of the variables list
        Throws:
        JRException
      • removeVariable

        public JRVariable removeVariable​(java.lang.String variableName)
        Removes a variable from the dataset.
        Parameters:
        variableName - the variable name
        Returns:
        the removed variable, or null if the variable was not found
      • removeVariable

        public JRVariable removeVariable​(JRVariable variable)
        Removes a variable from the dataset.
        Parameters:
        variable - the variable to be removed
        Returns:
        the variable to be removed
      • getGroupsList

        public java.util.List<JRGroup> getGroupsList()
        Returns the list of groups.
        Returns:
        list of JRGroup objects
      • getGroupsMap

        public java.util.Map<java.lang.String,​JRGroup> getGroupsMap()
        Returns the map of groups indexed by name.
        Returns:
        JRGroup objects indexed by name
      • removeGroup

        public JRGroup removeGroup​(java.lang.String groupName)
        Removes a group from the dataset.
        Parameters:
        groupName - the group name
        Returns:
        the removed group, or null if the group was not found
      • removeGroup

        public JRGroup removeGroup​(JRGroup group)
        Removes a group from the dataset.
        Parameters:
        group - the group to be removed
        Returns:
        the group to be removed
      • setResourceBundle

        public void setResourceBundle​(java.lang.String resourceBundle)
        Sets the base name of resource bundle to be used by the dataset.
        Parameters:
        resourceBundle - the resource bundle base name
      • queryLanguageChanged

        protected void queryLanguageChanged​(java.lang.String oldLanguage,
                                            java.lang.String newLanguage)
      • setProperty

        public void setProperty​(java.lang.String propName,
                                java.lang.String value)
        Adds/sets a property value.
        Parameters:
        propName - the name of the property
        value - the value of the property
      • removePropertyExpression

        public DatasetPropertyExpression removePropertyExpression​(java.lang.String name)
        Remove a property expression.
        Parameters:
        name - the name of the property to remove
        Returns:
        the removed property expression (if found)
      • setFilterExpression

        public void setFilterExpression​(JRExpression expression)
        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:
        JRDataset.getFilterExpression()