Class Template

java.lang.Object
org.mapfish.print.config.Template
All Implemented Interfaces:
ConfigurationObject, HasConfiguration

public class Template extends Object implements ConfigurationObject, HasConfiguration
Represents a report template configuration.
  • Constructor Details

    • Template

      public Template()
  • Method Details

    • getOutputFilename

      public final String getOutputFilename()
    • setOutputFilename

      public final void setOutputFilename(String outputFilename)
      The default output file name of the report (takes precedence over Configuration.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 Map<String,Attribute> getAttributes()
    • setAttributes

      public final void setAttributes(Map<String,Attribute> attributes)
      Set the attributes for this template.
      Parameters:
      attributes - the attribute map
    • getReportTemplate

      public final String getReportTemplate()
    • setReportTemplate

      public final void setReportTemplate(String reportTemplate)
      Sets the report template.
    • getProcessors

      public final List<Processor> getProcessors()
    • setProcessors

      public final void setProcessors(List<Processor> processors)
      Set the normal processors.
      Parameters:
      processors - the processors to set.
    • setTableData

      public final void setTableData(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 String getTableDataKey()
      Returns table data key.
    • getJdbcUrl

      public final String getJdbcUrl()
      Returns JDBC url.
    • setJdbcUrl

      public final void setJdbcUrl(String jdbcUrl)
      Sets the JDBC url.
    • getJdbcDrivers

      public final Set<String> getJdbcDrivers()
      Returns the JDBC drivers.
    • setJdbcDrivers

      public final void setJdbcDrivers(Set<String> jdbcDrivers)
      Sets the JDBC drivers.
    • getJdbcUser

      public final String getJdbcUser()
      Returns the JDBC driver.
    • setJdbcUser

      public final void setJdbcUser(String jdbcUser)
      Sets the JDBC user.
    • getJdbcPassword

      public final String getJdbcPassword()
      Gets the JDBC password.
    • setJdbcPassword

      public final void setJdbcPassword(String jdbcPassword)
      Sets the JDBC password.
    • 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(Map<String,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 Optional<org.geotools.api.style.Style> getStyle(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 interface HasConfiguration
      Parameters:
      configuration - the configuration object
    • validate

      public final void validate(List<Throwable> validationErrors, Configuration config)
      Description copied from interface: ConfigurationObject
      validate that the configuration was correct.
      Specified by:
      validate in interface ConfigurationObject
      Parameters:
      validationErrors - a list to add any detected errors to.
      config - the containing configuration
    • setAccess

      public final void setAccess(List<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)
      Sets the map export.
    • 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