Class Template
- java.lang.Object
-
- org.mapfish.print.config.Template
-
- All Implemented Interfaces:
ConfigurationObject
,HasConfiguration
public class Template extends java.lang.Object implements ConfigurationObject, HasConfiguration
Represents a report template configuration.
-
-
Constructor Summary
Constructors Constructor Description Template()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AccessAssertion
getAccessAssertion()
java.util.Map<java.lang.String,Attribute>
getAttributes()
Configuration
getConfiguration()
java.util.Set<java.lang.String>
getJdbcDrivers()
java.lang.String
getJdbcPassword()
java.lang.String
getJdbcUrl()
java.lang.String
getJdbcUser()
java.lang.String
getOutputFilename()
PDFConfig
getPdfConfig()
Get the merged configuration between this template and the configuration's template.ProcessorDependencyGraph
getProcessorGraph()
Get the processor graph to use for executing all the processors for the template.java.util.List<Processor>
getProcessors()
java.lang.String
getReportTemplate()
java.util.Optional<org.geotools.api.style.Style>
getStyle(java.lang.String styleName)
Look for a style in the named styles provided in the configuration.java.lang.String
getTableDataKey()
boolean
isMapExport()
boolean
isPdfA()
void
printClientConfig(org.json.JSONWriter json)
Print out the template information that the client needs for performing a request.void
setAccess(java.util.List<java.lang.String> access)
The roles required to access this template.void
setAttributes(java.util.Map<java.lang.String,Attribute> attributes)
Set the attributes for this template.void
setConfiguration(Configuration configuration)
Set the configuration that the object belongs to.void
setJdbcDrivers(java.util.Set<java.lang.String> jdbcDrivers)
void
setJdbcPassword(java.lang.String jdbcPassword)
void
setJdbcUrl(java.lang.String jdbcUrl)
void
setJdbcUser(java.lang.String jdbcUser)
void
setMapExport(boolean mapExport)
void
setOutputFilename(java.lang.String outputFilename)
The default output file name of the report (takes precedence overConfiguration.setOutputFilename(String)
).void
setPdfA(boolean pdfA)
If set to true (defaults to false), the generated maps, scalebar and north arrow will not contain any transparent images.void
setPdfConfig(PDFConfig pdfConfig)
Configure various properties related to the reports generated as PDFs.void
setProcessors(java.util.List<Processor> processors)
Set the normal processors.void
setReportTemplate(java.lang.String reportTemplate)
void
setStyles(java.util.Map<java.lang.String,java.lang.String> styles)
Set the named styles defined in the configuration for this.void
setTableData(java.lang.String tableData)
Set the key of the data that is the datasource for the main table in the report.void
validate(java.util.List<java.lang.Throwable> validationErrors, Configuration config)
validate that the configuration was correct.
-
-
-
Method Detail
-
getOutputFilename
public final java.lang.String getOutputFilename()
-
setOutputFilename
public final void setOutputFilename(java.lang.String outputFilename)
The default output file name of the report (takes precedence overConfiguration.setOutputFilename(String)
). This can be overridden by the outputFilename parameter in the request JSON.This can be a string and can also have a date section in the string that will be filled when the report is created for example a section with ${<dateFormatString>} will be replaced with the current date formatted in the way defined by the <dateFormatString> string. The format rules are the rules in java.text.SimpleDateFormat (do a google search if the link above is broken).
Example:
outputFilename: print-${dd-MM-yyyy}
should output:print-22-11-2014.pdf
Note: the suffix will be appended to the end of the name.
- Parameters:
outputFilename
- default output file name of the report.
-
getPdfConfig
public PDFConfig getPdfConfig()
Get the merged configuration between this template and the configuration's template. The settings in the template take priority over the configurations settings but if not set in the template then the default will be the configuration's options.
-
setPdfConfig
public final void setPdfConfig(PDFConfig pdfConfig)
Configure various properties related to the reports generated as PDFs.- Parameters:
pdfConfig
- the pdf configuration
-
printClientConfig
public final void printClientConfig(org.json.JSONWriter json) throws org.json.JSONException
Print out the template information that the client needs for performing a request.- Parameters:
json
- the writer to write the information to.- Throws:
org.json.JSONException
-
getAttributes
public final java.util.Map<java.lang.String,Attribute> getAttributes()
-
setAttributes
public final void setAttributes(java.util.Map<java.lang.String,Attribute> attributes)
Set the attributes for this template.- Parameters:
attributes
- the attribute map
-
getReportTemplate
public final java.lang.String getReportTemplate()
-
setReportTemplate
public final void setReportTemplate(java.lang.String reportTemplate)
-
getProcessors
public final java.util.List<Processor> getProcessors()
-
setProcessors
public final void setProcessors(java.util.List<Processor> processors)
Set the normal processors.- Parameters:
processors
- the processors to set.
-
setTableData
public final void setTableData(java.lang.String tableData)
Set the key of the data that is the datasource for the main table in the report.- Parameters:
tableData
- the key of the data that is the datasource for the main table in the report.
-
getTableDataKey
public final java.lang.String getTableDataKey()
-
getJdbcUrl
public final java.lang.String getJdbcUrl()
-
setJdbcUrl
public final void setJdbcUrl(java.lang.String jdbcUrl)
-
getJdbcDrivers
public final java.util.Set<java.lang.String> getJdbcDrivers()
-
setJdbcDrivers
public final void setJdbcDrivers(java.util.Set<java.lang.String> jdbcDrivers)
-
getJdbcUser
public final java.lang.String getJdbcUser()
-
setJdbcUser
public final void setJdbcUser(java.lang.String jdbcUser)
-
getJdbcPassword
public final java.lang.String getJdbcPassword()
-
setJdbcPassword
public final void setJdbcPassword(java.lang.String jdbcPassword)
-
getProcessorGraph
public final ProcessorDependencyGraph getProcessorGraph()
Get the processor graph to use for executing all the processors for the template.- Returns:
- the processor graph.
-
setStyles
public final void setStyles(java.util.Map<java.lang.String,java.lang.String> styles)
Set the named styles defined in the configuration for this.- Parameters:
styles
- set the styles specific for this template.
-
getStyle
@Nonnull public final java.util.Optional<org.geotools.api.style.Style> getStyle(java.lang.String styleName)
Look for a style in the named styles provided in the configuration.- Parameters:
styleName
- the name of the style to look for.
-
getConfiguration
public final Configuration getConfiguration()
-
setConfiguration
public final 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
-
validate
public final void validate(java.util.List<java.lang.Throwable> validationErrors, Configuration config)
Description copied from interface:ConfigurationObject
validate that the configuration was correct.- Specified by:
validate
in interfaceConfigurationObject
- Parameters:
validationErrors
- a list to add any detected errors to.config
- the containing configuration
-
setAccess
public final void setAccess(java.util.List<java.lang.String> access)
The roles required to access this template. If empty or not set then it is a public template. If there are many roles then a user must have one of the roles in order to access the template.The security (how authentication/authorization is done) is configured in the /WEB-INF/classes/mapfish-spring-security.xml
Any user without the required role will get an error when trying to access the template and the template will not be visible in the capabilities requests.
- Parameters:
access
- the roles needed to access this
-
getAccessAssertion
public final AccessAssertion getAccessAssertion()
-
isMapExport
public final boolean isMapExport()
-
setMapExport
public final void setMapExport(boolean mapExport)
-
isPdfA
public final boolean isPdfA()
-
setPdfA
public void setPdfA(boolean pdfA)
If set to true (defaults to false), the generated maps, scalebar and north arrow will not contain any transparent images.This is needed in case you want to output PDF/A-1a reports.
In pdfA mode, all layers are merged into a single JPEG layer at the requested resolution: WMTS tiles will be downscaled and vector layers will be rendered as bitmaps.
- Parameters:
pdfA
- the value
-
-