Package cdc.impex
Class ImpExCatalog
- java.lang.Object
-
- cdc.impex.ImpExCatalog
-
public class ImpExCatalog extends Object
Catalog ofSheetTemplates andSheetImporters.- Author:
- Damien Carbonne
-
-
Constructor Summary
Constructors Constructor Description ImpExCatalog()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description WorkbookExportercreateWorkbookExporterFor(WorkbookExporter def, String... templateNames)Creates a delegating sheet exporter for an array of template names.WorkbookExportercreateWorkbookExporterFor(WorkbookExporter def, Collection<String> templateNames)Creates a delegating sheet exporter for a collection of template names.WorkbookExportercreateWorkbookExporterFor(String... templateNames)WorkbookExportercreateWorkbookExporterFor(Collection<String> templateNames)WorkbookImportercreateWorkbookImporterFor(WorkbookImporter def, String... templateNames)Creates a delegating sheet importer for an array of template names.WorkbookImportercreateWorkbookImporterFor(WorkbookImporter def, Collection<String> templateNames)Creates a delegating sheet importer for a collection of template names.WorkbookImportercreateWorkbookImporterFor(String... templateNames)WorkbookImportercreateWorkbookImporterFor(Collection<String> templateNames)Set<String>getDomainNames()List<SheetTemplate>getDomainTemplatesAsList(String domain)Returns a list of sheet templates associated to a domain.Set<SheetTemplate>getDomainTemplatesAsSet(String domain)Returns a set of sheet templates associated to a domain.Set<String>getExtractableTemplateNames()Set<String>getImportableTemplateNames()SheetExportergetSheetExporter(String templateName)Return The sheet exporter associated to template name.SheetExportergetSheetExporterOrNull(String templateName)Returns sheet exporter associated to a template name ornull.SheetImportergetSheetImporter(String templateName)Return The sheet importer associated to template name.SheetImportergetSheetImporterOrNull(String templateName)Returns sheet importer associated to a template name ornull.SheetTemplategetTemplate(String templateName)Set<String>getTemplateNames()SheetTemplategetTemplateOrNull(String templateName)Set<SheetTemplate>getTemplates()List<SheetTemplate>getTemplatesAsList(String... templateNames)List<SheetTemplate>getTemplatesAsList(Collection<String> templateNames)Set<SheetTemplate>getTemplatesAsSet(String... templateNames)Set<SheetTemplate>getTemplatesAsSet(Collection<String> templateNames)ImpExCatalogregister(SheetTemplate template)Registers a SheetTemplate.ImpExCatalogregister(SheetTemplate... templates)Registers an array of SheetTemplates.ImpExCatalogregister(SheetTemplate template, SheetExporter sheetExporter)Registers a SheetTemplate (if not already done) and associate it to a SheetExporter.ImpExCatalogregister(SheetTemplate template, SheetImporter sheetImporter)Registers a SheetTemplate (if not already done) and associate it to a SheetImporter.ImpExCatalogregister(String templateName, SheetExporter sheetExporter)Registers a SheetExporter and associate it to a template name.ImpExCatalogregister(String templateName, SheetImporter sheetImporter)Registers a SheetImporter and associate it to a template name.ImpExCatalogregister(Collection<SheetTemplate> templates)Registers a collection of SheetTemplates.
-
-
-
Method Detail
-
register
public ImpExCatalog register(SheetTemplate template)
Registers a SheetTemplate.- Parameters:
template- The sheet template.- Returns:
- This catalog.
- Throws:
IllegalArgumentException- Whentemplateisnull, 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- Whentemplatesisnull, 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- Whentemplatesisnull, 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- WhentemplateNameorsheetImporterisnull,
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- WhentemplateorsheetImporterisnull,
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- WhentemplateNameorsheetExporterisnull,
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- WhentemplateorsheetExporterisnull,
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
nameornull.
-
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 namedtemplateNameis registered.
-
getTemplatesAsSet
public Set<SheetTemplate> getTemplatesAsSet(Collection<String> templateNames)
- Parameters:
templateNames- The template names.- Returns:
- A set if templates from
templateNames. - Throws:
IllegalArgumentException- WhentemplateNamesisnull.
-
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- WhentemplateNamesisnull.
-
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 ornull.- Parameters:
templateName- The template name.- Returns:
- The sheet importer associated to
templateNameornull.
-
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 totemplateName.
-
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 ornull.- Parameters:
templateName- The template name.- Returns:
- The sheet exporter associated to
templateNameornull.
-
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 totemplateName.
-
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)
-
-