Class SubReport
- java.lang.Object
-
- org.pentaho.reporting.engine.classic.core.Element
-
- org.pentaho.reporting.engine.classic.core.Section
-
- org.pentaho.reporting.engine.classic.core.AbstractReportDefinition
-
- org.pentaho.reporting.engine.classic.core.SubReport
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Iterable<Element>
,DataTarget
,ReportDefinition
,ReportElement
- Direct Known Subclasses:
CrosstabElement
public class SubReport extends AbstractReportDefinition
A subreport element. A subreport can be attached to a root-level band and will be printed afterwards. Subreports have their own tablemodel (queried with the sub-reports's defined query and the master report's data-factory). A sub-report that has been added to a root-level band will always be printed below the root-level band. Sub-reports can have import and export parameters. The parameter mapping can be defined freely, so a subreport is not required to use the same column names as the parent report. If a global import or export is defined (by adding the parameter mapping "*" => "*") the other defined parameter mappings will be ignored.- Author:
- Thomas Morgner
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.pentaho.reporting.engine.classic.core.Element
ANONYMOUS_ELEMENT_PREFIX
-
-
Constructor Summary
Constructors Constructor Description SubReport()
Creates a new subreport instance.SubReport(InstanceID id)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addExportParameter(String outerName, String sourceColumn)
Adds an export-parameter mapping to the subreport.void
addInputParameter(String outerName, String sourceColumn)
Adds an input-parameter mapping to the subreport.void
clearExportParameters()
void
clearInputParameters()
SubReport
clone()
Clones the report.SubReport
derive(boolean preserveElementInstanceIds)
Clones the report.Expression
getActivationExpression()
DataFactory
getDataFactory()
Returns the data factory that has been assigned to this report.ParameterMapping[]
getExportMappings()
Returns the parameter mappings for the subreport.ParameterMapping[]
getInputMappings()
Returns the input mappings defined for this subreport.PageDefinition
getPageDefinition()
Returns the page definition assigned to the report definition.ResourceBundleFactory
getResourceBundleFactory()
Deprecated.org.pentaho.reporting.libraries.resourceloader.ResourceManager
getResourceManager()
Deprecated.boolean
isGlobalExport()
Checks whether a global export is defined.boolean
isGlobalImport()
Checks whether a global import is defined.void
reconnectParent(Section parentSection)
void
removeExportParameter(String outerName)
Removes the export parameter from the mapping.void
removeInputParameter(String sourceColumn)
Removes the input parameter from the parameter mapping.void
setActivationExpression(Expression activationExpression)
void
setDataFactory(DataFactory dataFactory)
The (optional) data-factory for the subreport.void
setExportMappings(ParameterMapping[] mappings)
void
setInputMappings(ParameterMapping[] mappings)
protected void
updateChangedFlagInternal(ReportElement element, int type, Object parameter)
Updates the change flag and notifies the parent, if this element has a parent.-
Methods inherited from class org.pentaho.reporting.engine.classic.core.AbstractReportDefinition
addExpression, addGroup, addGroup, addPreProcessor, addReportModelListener, addStructureFunction, fireModelLayoutChanged, getAutoSort, getContentBase, getCrosstabCellBody, getDataSchemaDefinition, getDatasourceChangeTracker, getDefaultStyleSheet, getDefinitionSource, getDetailsFooter, getDetailsHeader, getElement, getElementCount, getExpressions, getGroup, getGroupByName, getGroupCount, getItemBand, getNoDataBand, getNonVisualsChangeTracker, getPageFooter, getPageHeader, getPreProcessor, getPreProcessorCount, getPreProcessors, getQuery, getQueryLimit, getQueryTimeout, getRelationalGroup, getReportDefinition, getReportFooter, getReportHeader, getRootGroup, getStructureFunction, getStructureFunctionCount, getStructureFunctions, getUserQueryLimit, getWatermark, isQueryLimitInherited, removeElement, removeExpression, removeGroup, removeGroup, removePreProcessor, removeReportModelListener, removeStructureFunction, setAutoSort, setContentBase, setDataSchemaDefinition, setDefinitionSource, setElementAt, setExpressions, setPageFooter, setPageHeader, setQuery, setQueryLimit, setQueryLimitInheritance, setQueryTimeout, setReportFooter, setReportHeader, setResourceBundleFactory, setRootGroup, setUserQueryLimit, setWatermark
-
Methods inherited from class org.pentaho.reporting.engine.classic.core.Section
iterator, registerAsChild, unregisterAsChild, unregisterParent, validateLooping
-
Methods inherited from class org.pentaho.reporting.engine.classic.core.Element
copyAttributes, copyInto, derive, getAttribute, getAttributeExpression, getAttributeExpressionNames, getAttributeExpressionNamespaces, getAttributeExpressions, getAttributeNames, getAttributeNamespaces, getAttributes, getAttributeTyped, getChangeTracker, getChildElementByType, getChildElementsByName, getChildElementsByType, getComputedStyle, getDataSource, getElementContext, getElementType, getElementTypeName, getFirstAttribute, getHRefTarget, getId, getMasterReport, getMetaData, getName, getObjectID, getParent, getParentSection, getStyle, getStyleExpression, getStyleExpressions, getTreeLock, isDynamicContent, isVisible, notifyElement, notifyNodeChildAdded, notifyNodeChildRemoved, notifyNodePropertiesChanged, notifyNodePropertiesChanged, notifyNodeStructureChanged, setAttribute, setAttribute, setAttributeExpression, setChangeTracker, setComputedStyle, setDataSource, setDynamicContent, setElementType, setHRefTarget, setId, setName, setParent, setStyleExpression, setVisible, toString, updateInternalChangeFlag
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface org.pentaho.reporting.engine.classic.core.ReportElement
getAttribute, getAttributeExpression, getAttributeExpressionNames, getAttributeExpressionNamespaces, getAttributeNames, getAttributeNamespaces, getAttributes, getAttributeTyped, getChangeTracker, getChildElementByType, getChildElementsByName, getChildElementsByType, getComputedStyle, getElementContext, getElementType, getFirstAttribute, getId, getMetaData, getName, getObjectID, getParentSection, getStyle, getStyleExpression, getStyleExpressions, getTreeLock, setAttribute, setAttribute, setAttributeExpression, setComputedStyle, setStyleExpression
-
-
-
-
Constructor Detail
-
SubReport
public SubReport()
Creates a new subreport instance.
-
SubReport
public SubReport(InstanceID id)
-
-
Method Detail
-
getPageDefinition
public PageDefinition getPageDefinition()
Returns the page definition assigned to the report definition. The page definition defines the report area and how the report is subdivided by the child pages.- Returns:
- null, as subreports have no page-definition at all.
-
derive
public SubReport derive(boolean preserveElementInstanceIds)
Clones the report.- Overrides:
derive
in classAbstractReportDefinition
- Parameters:
preserveElementInstanceIds
- defines whether this call generates new instance-ids for the derived elements. Instance-IDs are used by the report processor to recognize reoccurring elements and must not changed within the report run. Outside of the report processors new instance ids should be generated at all times to separate instances and to make them uniquely identifiable.- Returns:
- the clone.
-
reconnectParent
public void reconnectParent(Section parentSection)
-
clone
public SubReport clone()
Clones the report.- Specified by:
clone
in interfaceDataTarget
- Overrides:
clone
in classAbstractReportDefinition
- Returns:
- the clone.
-
addExportParameter
public void addExportParameter(String outerName, String sourceColumn)
Adds an export-parameter mapping to the subreport. The parameter specified by 'sourceColumn' will be made available with the name 'outerName' in the parent report.- Parameters:
outerName
- the name the parameter will get in the master report.sourceColumn
- the source-column in the sub-report.
-
removeExportParameter
public void removeExportParameter(String outerName)
Removes the export parameter from the mapping.- Parameters:
outerName
- the name of the parameter as it is known in the master report.
-
getExportMappings
public ParameterMapping[] getExportMappings()
Returns the parameter mappings for the subreport. The parameter mappings define how columns of the sub-report get mapped into the master report.- Returns:
- the parameter mappings array.
-
setExportMappings
public void setExportMappings(ParameterMapping[] mappings)
-
addInputParameter
public void addInputParameter(String outerName, String sourceColumn)
Adds an input-parameter mapping to the subreport. Input parameters define how columns that exist in the parent report get mapped into the subreport. Input parameter mapping happens only once, so after the report has been started, changes to the parameters will not pass through to the subreport.- Parameters:
outerName
- the name of the parent report's column that provides the data.sourceColumn
- the name under which the parameter will be available in the subreport.
-
removeInputParameter
public void removeInputParameter(String sourceColumn)
Removes the input parameter from the parameter mapping.- Parameters:
sourceColumn
- the name of the column of the subreport report that acts as source for the input parameter.
-
clearInputParameters
public void clearInputParameters()
-
clearExportParameters
public void clearExportParameters()
-
getInputMappings
public ParameterMapping[] getInputMappings()
Returns the input mappings defined for this subreport.- Returns:
- the input mappings, never null.
-
setInputMappings
public void setInputMappings(ParameterMapping[] mappings)
-
isGlobalImport
public boolean isGlobalImport()
Checks whether a global import is defined. A global import effectly overrides all other imports.- Returns:
- true, if there is a global import defined, false otherwise.
-
isGlobalExport
public boolean isGlobalExport()
Checks whether a global export is defined. A global export effectly overrides all other export mappings.- Returns:
- true, if there is a global export defined, false otherwise.
-
getDataFactory
public DataFactory getDataFactory()
Description copied from class:AbstractReportDefinition
Returns the data factory that has been assigned to this report. The data factory will never be null.- Specified by:
getDataFactory
in classAbstractReportDefinition
- Returns:
- the data factory.
-
setDataFactory
public void setDataFactory(DataFactory dataFactory)
The (optional) data-factory for the subreport. If no datafactory is defined here, the subreport will use the master report's data-factory.- Specified by:
setDataFactory
in classAbstractReportDefinition
- Parameters:
dataFactory
-
-
getActivationExpression
public Expression getActivationExpression()
-
setActivationExpression
public void setActivationExpression(Expression activationExpression)
-
updateChangedFlagInternal
protected void updateChangedFlagInternal(ReportElement element, int type, Object parameter)
Description copied from class:Element
Updates the change flag and notifies the parent, if this element has a parent.- Overrides:
updateChangedFlagInternal
in classElement
- Parameters:
element
- the element that caused the notification.type
- the notification type.parameter
- the optional parameter further describing the event.
-
getResourceManager
@Deprecated public org.pentaho.reporting.libraries.resourceloader.ResourceManager getResourceManager()
Deprecated.Description copied from class:AbstractReportDefinition
This method has only meaning for master-reports. This handle will be removed in the next majore release.- Specified by:
getResourceManager
in classAbstractReportDefinition
- Returns:
-
getResourceBundleFactory
@Deprecated public ResourceBundleFactory getResourceBundleFactory()
Deprecated.Description copied from class:AbstractReportDefinition
Returns the resource bundle factory for this report definition. TheResourceBundleFactory
is used in internationalized reports to create the resourcebundles holding the localized resources.- Overrides:
getResourceBundleFactory
in classAbstractReportDefinition
- Returns:
- the assigned resource bundle factory.
-
-