Class PdfferRegistryBean

java.lang.Object
org.nekosoft.pdffer.registry.PdfferRegistryBean

@Component public class PdfferRegistryBean extends Object
The PDFfer bean that deals with PDF templates. It scans a specified package for PdfTemplateComponent-annotated implementations of PdfTemplate and makes the instances available via the findTemplate(String) method.

It creates its own Spring application context, separate from the main one.

  • Constructor Details

    • PdfferRegistryBean

      public PdfferRegistryBean()
      Allows Spring to create the bean instance.
  • Method Details

    • findTemplateByPath

      public PdfTemplate<?> findTemplateByPath(String templatePath) throws TemplateNotFoundException
      Finds a PDF template given the template path.
      Parameters:
      templatePath - the template path
      Returns:
      the PDF template instance
      Throws:
      TemplateNotFoundException - if a template at the given template path could not be found
    • findTemplate

      public PdfTemplate<?> findTemplate(String templateName) throws TemplateNotFoundException
      Finds a PDF template in the root registry given the name.
      Parameters:
      templateName - the template name in the root registry
      Returns:
      the PDF template from the root registry
      Throws:
      TemplateNotFoundException - if a template with the given name in the root registry could not be found
    • findTemplate

      public PdfTemplate<?> findTemplate(String group, String templateName) throws TemplateNotFoundException
      Finds a PDF template in the given group with the given name.
      Parameters:
      group - the name of the group
      templateName - the name of the template
      Returns:
      the PDF template from the given group
      Throws:
      TemplateNotFoundException - if a template with the given name in the given group could not be found
    • listTemplatePaths

      public List<String> listTemplatePaths()
      Provides a list of all PDF template paths that were registered with this context.
      Returns:
      the list of PDF template paths
    • listGroupNames

      public List<String> listGroupNames()
      Provides a list of all PDF template groups that were registered with this context.
      Returns:
      the list of PDF template groups
    • listTemplateNamesInRoot

      public List<String> listTemplateNamesInRoot()
      Provides a list of all PDF templates that were registered in the root registry (the one with the default or no group associated to it).
      Returns:
      the list of all PDF templates in the root registry
    • listTemplateNamesInGroup

      public List<String> listTemplateNamesInGroup(String group)
      Provides a list of all PDF templates that were registered in the given group.
      Parameters:
      group - the group name
      Returns:
      the list of templates in the given group