Class MergeDataSourceProcessor

  • All Implemented Interfaces:
    ConfigurationObject, CustomDependencies, Processor<MergeDataSourceProcessor.In,​MergeDataSourceProcessor.Out>

    public final class MergeDataSourceProcessor
    extends AbstractProcessor<MergeDataSourceProcessor.In,​MergeDataSourceProcessor.Out>
    implements CustomDependencies
    This processor combines DataSources and individual processor outputs (or attribute values) into a single DataSource which can be used in a jasper report's detail section.

    An example use case is where we might have zero or many of tables and zero or many legends. You can configure the template with a detail section that contains a subreport, the name of which is a field in the DataSources and the DataSources for the sub-template another field. Then you can merge the legend and the tables into a single DataSources. This way the report will nicely expand depending on if you have a legend and how many tables you have in your report. [[examples=merged_datasource]]

    • Constructor Detail

      • MergeDataSourceProcessor

        protected MergeDataSourceProcessor()
        Constructor.
    • Method Detail

      • createInputParameter

        @Nullable
        public MergeDataSourceProcessor.In createInputParameter()
        Description copied from interface: Processor
        Returns a new/clean instance of a parameter object. This instance's will be inspected using reflection to find its public fields and the properties will be set from the Values object.

        The way the properties will be looked up is to

        1. take the bean property name
        2. map it using the input mapper, (if the input mapper does not have a mapping for the property then the unmapped property name is used)
        3. Look up the property value in the Values object using the mapped property name
        4. set the value on the instance created by this method. If the value is null an exception will be thrown UNLESS the HasDefaultValue annotation is on the field for the property.
        The populated instance will be passed to the execute method. It is imperative that a new instance is created each time because they will be used in a multi-threaded environment and thus the same processor instance may be ran in multiple threads with different instances of the parameter object.

        It is important to realize that super classes will also be analyzed, so care must be had with inheritance.

        Specified by:
        createInputParameter in interface Processor<MergeDataSourceProcessor.In,​MergeDataSourceProcessor.Out>
      • getDependencies

        @Nonnull
        public java.util.Collection<java.lang.String> getDependencies()
        Description copied from interface: CustomDependencies
        Get what we dynamically depends on, for the "values" input.
        Specified by:
        getDependencies in interface CustomDependencies