Class JasperReportBuilder
- java.lang.Object
-
- org.mapfish.print.processor.AbstractProcessor<JasperReportBuilder.Input,java.lang.Void>
-
- org.mapfish.print.processor.jasper.JasperReportBuilder
-
- All Implemented Interfaces:
ConfigurationObject
,HasConfiguration
,Processor<JasperReportBuilder.Input,java.lang.Void>
public final class JasperReportBuilder extends AbstractProcessor<JasperReportBuilder.Input,java.lang.Void> implements HasConfiguration
A processor that actually compiles a JasperReport template file.Example
[[examples=verboseExample]]processors: - !reportBuilder # compile all reports in current directory directory: '.'
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JasperReportBuilder.Input
The input parameter object forJasperReportBuilder
.-
Nested classes/interfaces inherited from class org.mapfish.print.processor.AbstractProcessor
AbstractProcessor.Context
-
Nested classes/interfaces inherited from interface org.mapfish.print.processor.Processor
Processor.ExecutionContext
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
JASPER_REPORT_COMPILED_FILE_EXT
Extension for Compiled Jasper Report Template files.static java.lang.String
JASPER_REPORT_XML_FILE_EXT
Extension for Jasper XML Report Template files.-
Fields inherited from interface org.mapfish.print.processor.Processor
MDC_APPLICATION_ID_KEY, MDC_JOB_ID_KEY
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
JasperReportBuilder()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JasperReportBuilder.Input
createInputParameter()
Returns a new/clean instance of a parameter object.java.lang.Void
execute(JasperReportBuilder.Input param, Processor.ExecutionContext context)
Perform the process on the input attributes.protected void
extraValidation(java.util.List<java.lang.Throwable> validationErrors, Configuration config)
Perform any extra validation a subclass may need to perform.void
setConfiguration(Configuration configuration)
Set the configuration that the object belongs to.void
setDirectory(java.lang.String directory)
Set the directory and test that the directory exists and is contained within the Configuration directory.java.lang.String
toString()
-
Methods inherited from class org.mapfish.print.processor.AbstractProcessor
getInputMapperBiMap, getInputPrefix, getOutputMapperBiMap, getOutputPrefix, getOutputType, setInputMapper, setInputPrefix, setOutputMapper, setOutputPrefix, setPrefix, toString, validate
-
-
-
-
Field Detail
-
JASPER_REPORT_XML_FILE_EXT
public static final java.lang.String JASPER_REPORT_XML_FILE_EXT
Extension for Jasper XML Report Template files.- See Also:
- Constant Field Values
-
JASPER_REPORT_COMPILED_FILE_EXT
public static final java.lang.String JASPER_REPORT_COMPILED_FILE_EXT
Extension for Compiled Jasper Report Template files.- See Also:
- Constant Field Values
-
-
Method Detail
-
execute
public java.lang.Void execute(JasperReportBuilder.Input param, Processor.ExecutionContext context) throws net.sf.jasperreports.engine.JRException
Description copied from interface:Processor
Perform the process on the input attributes.- Specified by:
execute
in interfaceProcessor<JasperReportBuilder.Input,java.lang.Void>
- Parameters:
param
- A Java object whose public fields are populated from theValues
object (which is used for transferring properties between processors).context
- The execution context for a print task.- Returns:
- A Java object whose public fields will be put into the
Values
object. The key in theValues
object is the name of the field or if there is a mapping in theProcessor.getOutputMapperBiMap()
map, the mapped name. The key is determined in a similar way as for the input object. - Throws:
net.sf.jasperreports.engine.JRException
-
createInputParameter
public JasperReportBuilder.Input 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 theValues
object.The way the properties will be looked up is to
- take the bean property name
- 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)
- Look up the property value in the
Values
object using the mapped property name - 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.
It is important to realize that super classes will also be analyzed, so care must be had with inheritance.
- Specified by:
createInputParameter
in interfaceProcessor<JasperReportBuilder.Input,java.lang.Void>
-
setDirectory
public void setDirectory(java.lang.String directory)
Set the directory and test that the directory exists and is contained within the Configuration directory.- Parameters:
directory
- the new directory
-
setConfiguration
public void setConfiguration(Configuration configuration)
Description copied from interface:HasConfiguration
Set the configuration that the object belongs to.- Specified by:
setConfiguration
in interfaceHasConfiguration
- Parameters:
configuration
- the configuration object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classAbstractProcessor<JasperReportBuilder.Input,java.lang.Void>
-
extraValidation
protected void extraValidation(java.util.List<java.lang.Throwable> validationErrors, Configuration config)
Description copied from class:AbstractProcessor
Perform any extra validation a subclass may need to perform.- Specified by:
extraValidation
in classAbstractProcessor<JasperReportBuilder.Input,java.lang.Void>
- Parameters:
validationErrors
- a list to add errors to so that all validation errors are reported as one.config
- the containing configuration
-
-