Package cdc.impex.api

Class ImpExCatalog

    • Constructor Detail

      • ImpExCatalog

        public ImpExCatalog()
    • Method Detail

      • 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,
                                     ImportHandler importHandler)
        Registers an ImportHandler and associate it to a template name.
        Parameters:
        templateName - The template name.
        importHandler - The import handler.
        Returns:
        This catalog.
        Throws:
        IllegalArgumentException - When templateName or importHandler is null,
        or that would create a duplicate or no corresponding template is found.
      • register

        public ImpExCatalog register​(SheetTemplate template,
                                     ImportHandler importHandler)
        Registers a SheetTemplate (if not already done) and associate it to an ImportHandler.
        Parameters:
        template - The sheet template.
        importHandler - The import handler.
        Returns:
        This catalog.
        Throws:
        IllegalArgumentException - When template or importHandler is null,
        or that would create a duplicate.
      • 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.
      • getTemplates

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

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

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

        public ImportHandler getImportHandlerOrNull​(String templateName)
        Returns import handler associated to a template name or null.
        Parameters:
        templateName - The template name.
        Returns:
        The import handler associated to templateName or null.
      • getImportHandler

        public ImportHandler getImportHandler​(String templateName)
        Return The import handler associated to template name.
        Parameters:
        templateName - The template name.
        Returns:
        The import handler associated to templateName.
        Throws:
        cdc.util.lang.NotFoundException - When no import handler is associated to templateName.
      • createImportHandlerFor

        public ImportHandler createImportHandlerFor​(ImportHandler def,
                                                    Collection<String> templateNames)
        Creates a delegating import handler for a collection of template names.
        Parameters:
        def - The default import handler.
        templateNames - The template names.
        Returns:
        A new created import handler.
      • createImportHandlerFor

        public ImportHandler createImportHandlerFor​(ImportHandler def,
                                                    String... templateNames)
        Creates a delegating import handler for an array of template names.
        Parameters:
        def - The default import handler.
        templateNames - The template names.
        Returns:
        A new created import handler.