Interface Processor<IN,OUT>
-
- Type Parameters:
IN
- A Java DTO input parameter object of the execute method. The object properties are resolved by looking at the public fields in the object and setting those fields. Only fields in the object itself will be inspected. Object is populated from theValues
object.OUT
- A Java DTO output/return object from the execute method. properties will be put into theValues
object so other processor can access the values.
- All Superinterfaces:
ConfigurationObject
- All Known Subinterfaces:
HttpProcessor<PARAM>
- All Known Implementing Classes:
AbstractClientHttpRequestFactoryProcessor
,AbstractProcessor
,AddHeadersProcessor
,AddStaticLayersProcessor
,CompositeClientHttpRequestFactoryProcessor
,CreateMapPagesProcessor
,CreateMapProcessor
,CreateNorthArrowProcessor
,CreateOverviewMapProcessor
,CreateScalebarProcessor
,DataSourceProcessor
,DateFormatProcessor
,ForwardHeadersProcessor
,JasperReportBuilder
,LegendProcessor
,MapUriProcessor
,MergeDataSourceProcessor
,PdfConfigurationProcessor
,RestrictUrisProcessor
,SetFeaturesProcessor
,SetStyleProcessor
,SetTiledWmsProcessor
,SetWmsCustomParamProcessor
,TableProcessor
,UseHttpForHttpsProcessor
public interface Processor<IN,OUT> extends ConfigurationObject
Interface for processing input attributes. A processor must NOT contain mutable state because a single processor instance can be ran in multiple threads and one running processor must not interfere with the running of the other instance.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
Processor.ExecutionContext
An execution context for a specific print task.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
MDC_APPLICATION_ID_KEY
MDC key for the application ID.static java.lang.String
MDC_JOB_ID_KEY
MDC key for the job ID.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description IN
createInputParameter()
Returns a new/clean instance of a parameter object.OUT
execute(IN values, Processor.ExecutionContext context)
Perform the process on the input attributes.com.google.common.collect.BiMap<java.lang.String,java.lang.String>
getInputMapperBiMap()
Map the variable names to the processor inputs.java.lang.String
getInputPrefix()
Get the prefix to apply to each input value.com.google.common.collect.BiMap<java.lang.String,java.lang.String>
getOutputMapperBiMap()
Map output from processor to the variable in the Jasper Report.java.lang.String
getOutputPrefix()
Get the prefix to apply to each output value.java.lang.Class<OUT>
getOutputType()
Get the class of the output type.void
toString(java.lang.StringBuilder builder, int indent, java.lang.String parent)
Create a string representing this processor.-
Methods inherited from interface org.mapfish.print.config.ConfigurationObject
validate
-
-
-
-
Field Detail
-
MDC_APPLICATION_ID_KEY
static final java.lang.String MDC_APPLICATION_ID_KEY
MDC key for the application ID.- See Also:
- Constant Field Values
-
MDC_JOB_ID_KEY
static final java.lang.String MDC_JOB_ID_KEY
MDC key for the job ID.- See Also:
- Constant Field Values
-
-
Method Detail
-
getOutputType
java.lang.Class<OUT> getOutputType()
Get the class of the output type. This is used when determining the outputs this processor produces.The public fields of the Processor will be the output of the processor and thus can be mapped to inputs of another processor.
-
getInputMapperBiMap
@Nullable com.google.common.collect.BiMap<java.lang.String,java.lang.String> getInputMapperBiMap()
Map the variable names to the processor inputs.
-
createInputParameter
@Nullable IN createInputParameter()
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.
-
execute
@Nullable OUT execute(IN values, Processor.ExecutionContext context) throws java.lang.Exception
Perform the process on the input attributes.- Parameters:
values
- 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 thegetOutputMapperBiMap()
map, the mapped name. The key is determined in a similar way as for the input object. - Throws:
java.lang.Exception
-
getOutputMapperBiMap
@Nullable com.google.common.collect.BiMap<java.lang.String,java.lang.String> getOutputMapperBiMap()
Map output from processor to the variable in the Jasper Report.
-
getInputPrefix
java.lang.String getInputPrefix()
Get the prefix to apply to each input value. This provides a simple way to make all output values have unique values.If input prefix is non-null and non-empty (whitespace is removed) then the prefix will be prepended to the normal name of the input value.
When a prefix is appended the normal name will be capitalized. For example: if the normal name is: map and the prefix is page1 then the final name will be page1Map.
Note: If a mapping is in the
getInputMapperBiMap()
then the prefix will be ignored for that value and the un-prefixed name from the input mapper will be used directly.Note: If a prefix has white space at the start or end it will be removed.
-
getOutputPrefix
java.lang.String getOutputPrefix()
Get the prefix to apply to each output value. This provides a simple way to make all output values have unique values.If output prefix is non-null and non-empty (whitespace is removed) then the prefix will be prepended to the normal name of the output value.
When a prefix is appended the normal name will be capitalized. For example: if the normal name is: map and the prefix is page1 then the final name will be page1Map.
Note: If a mapping is in the
getOutputMapperBiMap()
then the prefix will be ignored for that value and the un-prefixed name from the output mapper will be used directly.Note: If a prefix has white space at the start or end it will be removed.
-
toString
void toString(java.lang.StringBuilder builder, int indent, java.lang.String parent)
Create a string representing this processor.- Parameters:
builder
- the builder to add the string to.indent
- the number of steps of indent for this nodeparent
- the parent node's name
-
-