Package cdc.impex

Class ImpExCatalog

java.lang.Object
cdc.impex.ImpExCatalog

public class ImpExCatalog extends Object
Catalog of SheetTemplates and SheetImporters.
Author:
Damien Carbonne
  • Constructor Details

    • ImpExCatalog

      public ImpExCatalog()
  • Method Details

    • register

      public ImpExCatalog register(SheetTemplate template)
      Registers a SheetTemplate.
      Parameters:
      template - The sheet template.
      Returns:
      This catalog.
      Throws:
      IllegalArgumentException - When template is null, or another template with that name is already registered.
    • register

      public ImpExCatalog register(Collection<SheetTemplate> templates)
      Registers a collection of SheetTemplates.
      Parameters:
      templates - The sheet templates.
      Returns:
      This catalog.
      Throws:
      IllegalArgumentException - When templates is null, or another template with same name is already registered.
    • register

      public ImpExCatalog register(SheetTemplate... templates)
      Registers an array of SheetTemplates.
      Parameters:
      templates - The sheet templates.
      Returns:
      This catalog.
      Throws:
      IllegalArgumentException - When templates is null, or another template with same name is already registered.
    • register

      public ImpExCatalog register(String templateName, SheetImporter sheetImporter)
      Registers a SheetImporter and associate it to a template name.
      Parameters:
      templateName - The template name.
      sheetImporter - The sheet importer.
      Returns:
      This catalog.
      Throws:
      IllegalArgumentException - When templateName or sheetImporter is null,
      or that would create a duplicate or no corresponding template is found.
    • register

      public ImpExCatalog register(SheetTemplate template, SheetImporter sheetImporter)
      Registers a SheetTemplate (if not already done) and associate it to a SheetImporter.
      Parameters:
      template - The sheet template.
      sheetImporter - The sheet importer.
      Returns:
      This catalog.
      Throws:
      IllegalArgumentException - When template or sheetImporter is null,
      or that would create a duplicate.
    • register

      public ImpExCatalog register(String templateName, SheetExporter sheetExporter)
      Registers a SheetExporter and associate it to a template name.
      Parameters:
      templateName - The template name.
      sheetExporter - The sheet exporter.
      Returns:
      This catalog.
      Throws:
      IllegalArgumentException - When templateName or sheetExporter is null,
      or that would create a duplicate or no corresponding template is found.
    • register

      public ImpExCatalog register(SheetTemplate template, SheetExporter sheetExporter)
      Registers a SheetTemplate (if not already done) and associate it to a SheetExporter.
      Parameters:
      template - The sheet template.
      sheetExporter - The sheet exporter.
      Returns:
      This catalog.
      Throws:
      IllegalArgumentException - When template or sheetExporter is null,
      or that would create a duplicate.
    • getDomainNames

      public Set<String> getDomainNames()
      Returns:
      A set of domain names for which some sheet templates are registered.
    • getDomainTemplatesAsSet

      public Set<SheetTemplate> getDomainTemplatesAsSet(String domain)
      Returns a set of sheet templates associated to a domain.
      Parameters:
      domain - The domain.
      Returns:
      A set of sheet templates associated to domain.
    • getDomainTemplatesAsList

      public List<SheetTemplate> getDomainTemplatesAsList(String domain)
      Returns a list of sheet templates associated to a domain.
      Parameters:
      domain - The domain.
      Returns:
      A list of sheet templates associated to domain.
    • getTemplateNames

      public Set<String> getTemplateNames()
      Returns:
      A set of names of registered sheet templates.
    • getTemplateOrNull

      public SheetTemplate getTemplateOrNull(String templateName)
      Parameters:
      templateName - The template name.
      Returns:
      The registered sheet template named name or null.
    • getTemplate

      public SheetTemplate getTemplate(String templateName)
      Parameters:
      templateName - The template name.
      Returns:
      The registered sheet template named name.
      Throws:
      cdc.util.lang.NotFoundException - When no sheet template named templateName is registered.
    • getTemplatesAsSet

      public Set<SheetTemplate> getTemplatesAsSet(Collection<String> templateNames)
      Parameters:
      templateNames - The template names.
      Returns:
      A set if templates from templateNames.
      Throws:
      IllegalArgumentException - When templateNames is null.
    • getTemplatesAsList

      public List<SheetTemplate> getTemplatesAsList(Collection<String> templateNames)
    • getTemplatesAsSet

      public Set<SheetTemplate> getTemplatesAsSet(String... templateNames)
      Parameters:
      templateNames - The template names.
      Returns:
      A set if templates from templateNames.
      Throws:
      IllegalArgumentException - When templateNames is null.
    • getTemplatesAsList

      public List<SheetTemplate> getTemplatesAsList(String... templateNames)
    • getImportableTemplateNames

      public Set<String> getImportableTemplateNames()
      Returns:
      A set of sheet template names for which an sheet importer is registered.
    • getExtractableTemplateNames

      public Set<String> getExtractableTemplateNames()
      Returns:
      A set of sheet template names for which an sheet exporter is registered.
    • getTemplates

      public Set<SheetTemplate> getTemplates()
      Returns:
      A set of all registered templates.
    • getSheetImporterOrNull

      public SheetImporter getSheetImporterOrNull(String templateName)
      Returns sheet importer associated to a template name or null.
      Parameters:
      templateName - The template name.
      Returns:
      The sheet importer associated to templateName or null.
    • getSheetImporter

      public SheetImporter getSheetImporter(String templateName)
      Return The sheet importer associated to template name.
      Parameters:
      templateName - The template name.
      Returns:
      The sheet importer associated to templateName.
      Throws:
      cdc.util.lang.NotFoundException - When no sheet importer is associated to templateName.
    • createWorkbookImporterFor

      public WorkbookImporter createWorkbookImporterFor(WorkbookImporter def, Collection<String> templateNames)
      Creates a delegating sheet importer for a collection of template names.
      Parameters:
      def - The default sheet importer.
      templateNames - The template names.
      Returns:
      A newly created sheet importer.
    • createWorkbookImporterFor

      public WorkbookImporter createWorkbookImporterFor(Collection<String> templateNames)
    • createWorkbookImporterFor

      public WorkbookImporter createWorkbookImporterFor(WorkbookImporter def, String... templateNames)
      Creates a delegating sheet importer for an array of template names.
      Parameters:
      def - The default sheet importer.
      templateNames - The template names.
      Returns:
      A newly created sheet importer.
    • createWorkbookImporterFor

      public WorkbookImporter createWorkbookImporterFor(String... templateNames)
    • getSheetExporterOrNull

      public SheetExporter getSheetExporterOrNull(String templateName)
      Returns sheet exporter associated to a template name or null.
      Parameters:
      templateName - The template name.
      Returns:
      The sheet exporter associated to templateName or null.
    • getSheetExporter

      public SheetExporter getSheetExporter(String templateName)
      Return The sheet exporter associated to template name.
      Parameters:
      templateName - The template name.
      Returns:
      The sheet exporter associated to templateName.
      Throws:
      cdc.util.lang.NotFoundException - When no sheet exporter is associated to templateName.
    • createWorkbookExporterFor

      public WorkbookExporter createWorkbookExporterFor(WorkbookExporter def, Collection<String> templateNames)
      Creates a delegating sheet exporter for a collection of template names.
      Parameters:
      def - The default sheet exporter.
      templateNames - The template names.
      Returns:
      A newly created sheet exporter.
    • createWorkbookExporterFor

      public WorkbookExporter createWorkbookExporterFor(Collection<String> templateNames)
    • createWorkbookExporterFor

      public WorkbookExporter createWorkbookExporterFor(WorkbookExporter def, String... templateNames)
      Creates a delegating sheet exporter for an array of template names.
      Parameters:
      def - The default sheet exporter.
      templateNames - The template names.
      Returns:
      A newly created sheet exporter.
    • createWorkbookExporterFor

      public WorkbookExporter createWorkbookExporterFor(String... templateNames)