public final class PdfConfigurationProcessor extends AbstractProcessor<PdfConfigurationProcessor.In,java.lang.Void>
This processor allows the dynamic configuration of the PDFConfig
object by obtaining data from attributes. For example the title and author could be string attributes
posted from the client, this processor would update the PDFConfig object
with the attribute data allowing per report PDF metadata.
Note: The PDFConfig can also be configured in the config.yaml either at
the config or template level.
See also: !updatePdfConfigUpdate attribute
[[examples=updatePdfMetadata]]| Modifier and Type | Class and Description |
|---|---|
static class |
PdfConfigurationProcessor.In
The input parameters object.
|
static class |
PdfConfigurationProcessor.Update
The object that defines how to update the
PDFConfig
(see !updatePdfConfig processor). |
AbstractProcessor.ContextProcessor.ExecutionContextMDC_JOB_ID_KEY| Constructor and Description |
|---|
PdfConfigurationProcessor()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
PdfConfigurationProcessor.In |
createInputParameter()
Returns a new/clean instance of a parameter object.
|
java.lang.Void |
execute(PdfConfigurationProcessor.In in,
Processor.ExecutionContext context)
Perform the process on the input attributes.
|
protected void |
extraValidation(java.util.List<java.lang.Throwable> validationErrors,
Configuration configuration)
Perform any extra validation a subclass may need to perform.
|
void |
setUpdates(java.util.Map<java.lang.String,java.lang.Object> updates)
The pdf metadata property -> attribute name map.
|
getInputMapperBiMap, getInputPrefix, getOutputMapperBiMap, getOutputPrefix, getOutputType, setInputMapper, setInputPrefix, setOutputMapper, setOutputPrefix, setPrefix, toString, toString, validatepublic void setUpdates(java.util.Map<java.lang.String,java.lang.Object> updates)
PDFConfig and the values must be the name of the attribute to obtain the the
data from. Example Configuration:
processors:
- !updatePdfConfig
updates:
title: "titleAttribute"
subject: "subjectAttribute"
The type of the attribute must be of the correct type, for example title mus be a string, keywords must
be an array of strings, compress must be a boolean.
If the value is within the attribute output object then you can use dot separators for each level. For
example suppose there is a custom attribute: myconfig, if and it has a property title then the
configuration would be:
processors:
- updatePdfConfig
updates: {title: :myconfig.title"}
For more power a "format" can be defined. The format is a printf style format string which will be
called with a single value that is identified by the value key/path. In this case the short hand key:
value can't be used instead it is as follows:
- updatePdfConfig
updates:
title: !updatePdfConfigUpdate
valueKey: "myconfig.title"
format: "Print Report %s"
updates - the attribute mapprotected void extraValidation(java.util.List<java.lang.Throwable> validationErrors,
Configuration configuration)
AbstractProcessorextraValidation in class AbstractProcessor<PdfConfigurationProcessor.In,java.lang.Void>validationErrors - a list to add errors to so that all validation errors are reported as
one.configuration - the containing configuration@Nullable public PdfConfigurationProcessor.In createInputParameter()
ProcessorValues object.
The way the properties will be looked up is to
Values object using the mapped
property name
HasDefaultValue annotation is on the field for
the property.
@Nullable public java.lang.Void execute(PdfConfigurationProcessor.In in, Processor.ExecutionContext context)
Processorin - A Java object whose public fields are populated from the Values object (which is used for transferring properties between
processors).context - The execution context for a print task.Values object. The key in the
Values
object is the name of the field or if there is a mapping in the Processor.getOutputMapperBiMap()
map, the mapped name. The key is determined in a similar way as for the input object.