Class TopiaCsvImports
java.lang.Object
org.nuiton.topia.persistence.csv.in.TopiaCsvImports
Helper for csv imports.
- Since:
- 2.6.12
- Author:
- tchemit <chemit@codelutin.com>
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends TopiaEntityEnum,M extends MetaFilenameAware<T>>
Map<M,File> discoverEntries(Iterable<M> possibleMetas, File directory, List<String> missingEntries) Discover all files that can be imported (as a table or an association) from a directory.static <T extends TopiaEntityEnum,M extends MetaFilenameAware<T>>
Map<M,ZipEntry> discoverEntries(String entryPrefix, Iterable<M> possibleMetas, ZipFile zipFile, List<String> missingEntries) Discover all files that can be imported (as a table or an association) from a zipfile.static <T extends TopiaEntityEnum,E extends TopiaEntity>
voidimportAllEntities(TopiaDAO<E> dao, TableMeta<T> meta, org.nuiton.csv.Import<E> importer, CsvImportResult<T> csvResult) static <T extends TopiaEntityEnum,E extends TopiaEntity>
voidimportAllEntities(TopiaDAO<E> dao, TableMeta<T> meta, org.nuiton.csv.Import<E> importer, CsvImportResult<T> csvResult, int nbRowBuffer) static <T extends TopiaEntityEnum,E extends TopiaEntity>
Iterable<E>importAllEntitiesAndReturnThem(TopiaDAO<E> dao, TableMeta<T> meta, org.nuiton.csv.Import<E> importer, CsvImportResult<T> csvResult) static <T extends TopiaEntityEnum>
voidimportAssociation(Reader reader, ImportStrategy<T> importStrategy, AssociationMeta<T> meta, CsvImportResult<T> csvResult) To import a association (given by hismeta) from a reader and a strategy.static <T extends TopiaEntityEnum>
voidimportAssociation(TopiaContext tx, AssociationMeta<T> meta, Map<String, TopiaEntity> universe, org.nuiton.csv.ImportToMap importer, CsvImportResult<T> csvResult, int nbRowBuffer) static <T extends TopiaEntityEnum>
voidimportAssociation(TopiaContext tx, AssociationMeta<T> meta, org.nuiton.csv.ImportToMap importer, CsvImportResult<T> csvResult, int nbRowBuffer) static <T extends TopiaEntityEnum>
voidimportNMAssociation(TopiaContext tx, AssociationMeta<T> meta, Map<String, TopiaEntity> universe, org.nuiton.csv.ImportToMap importer, CsvImportResult<T> csvResult, int nbRowBuffer) static <T extends TopiaEntityEnum>
voidimportNMAssociation(TopiaContext tx, AssociationMeta<T> meta, org.nuiton.csv.ImportToMap importer, CsvImportResult<T> csvResult, int nbRowBuffer) static <T extends TopiaEntityEnum,E extends TopiaEntity>
voidimportNotExistingEntities(TopiaDAO<E> dao, TableMeta<T> meta, Map<String, TopiaEntity> universe, org.nuiton.csv.Import<E> importer, CsvImportResult<T> csvResult) static <T extends TopiaEntityEnum,E extends TopiaEntity>
voidimportTable(Reader reader, ImportStrategy<T> importStrategy, TableMeta<T> meta, CsvImportResult<T> csvResult) To import a table (given by hismeta) from a reader and a strategy.static <T extends TopiaEntityEnum,E extends TopiaEntity>
Iterable<E>importTableAndReturn(Reader reader, ImportStrategy<T> importStrategy, TableMeta<T> meta, CsvImportResult<T> csvResult) To import a table (given by hismeta) from a reader and a strategy.
-
Field Details
-
UPDATE_ASSOCIATION
- See Also:
-
INSERT_ASSOCIATION
- See Also:
-
-
Constructor Details
-
TopiaCsvImports
protected TopiaCsvImports()
-
-
Method Details
-
discoverEntries
public static <T extends TopiaEntityEnum,M extends MetaFilenameAware<T>> Map<M,ZipEntry> discoverEntries(String entryPrefix, Iterable<M> possibleMetas, ZipFile zipFile, List<String> missingEntries) Discover all files that can be imported (as a table or an association) from a zipfile.- Type Parameters:
T- type of topia entity enumM- type of data to import (table or association)- Parameters:
entryPrefix- prefix where to find files in the zippossibleMetas- list of possible meta to be importedzipFile- zip file where to seek for csv files to importmissingEntries- to fill missing files- Returns:
- the map of found files indexed by his meta
-
discoverEntries
public static <T extends TopiaEntityEnum,M extends MetaFilenameAware<T>> Map<M,File> discoverEntries(Iterable<M> possibleMetas, File directory, List<String> missingEntries) Discover all files that can be imported (as a table or an association) from a directory.- Type Parameters:
T- type of topia entity enumM- type of data to import (table or association)- Parameters:
possibleMetas- list of possible meta to be importeddirectory- directory where to seek for csv files to importmissingEntries- to fill missing files- Returns:
- the map of found files indexed by his meta
-
importTable
public static <T extends TopiaEntityEnum,E extends TopiaEntity> void importTable(Reader reader, ImportStrategy<T> importStrategy, TableMeta<T> meta, CsvImportResult<T> csvResult) throws TopiaException, IOException To import a table (given by hismeta) from a reader and a strategy. Result of import can be stored in an optional csv result.- Type Parameters:
T- type of entity enumE- type of data- Parameters:
reader- where to read csv dataimportStrategy- import strategy used to store csv datameta- meta of the datacsvResult- optional csv result- Throws:
TopiaException- if any db problem while storing datasIOException- if any pb while reading csv data- See Also:
-
importTableAndReturn
public static <T extends TopiaEntityEnum,E extends TopiaEntity> Iterable<E> importTableAndReturn(Reader reader, ImportStrategy<T> importStrategy, TableMeta<T> meta, CsvImportResult<T> csvResult) throws TopiaException, IOException To import a table (given by hismeta) from a reader and a strategy. Result of import can be stored in an optional csv result.- Type Parameters:
T- type of entity enumE- type of data- Parameters:
reader- where to read csv dataimportStrategy- import strategy used to store csv datameta- meta of the datacsvResult- optional csv result- Throws:
TopiaException- if any db problem while storing datasIOException- if any pb while reading csv data- See Also:
-
importAssociation
public static <T extends TopiaEntityEnum> void importAssociation(Reader reader, ImportStrategy<T> importStrategy, AssociationMeta<T> meta, CsvImportResult<T> csvResult) throws IOException, TopiaException To import a association (given by hismeta) from a reader and a strategy. Result of import can be stored in an optional csv result.- Type Parameters:
T- type of entity enum- Parameters:
reader- where to read csv dataimportStrategy- import strategy used to store csv datameta- meta of the datacsvResult- optional csv result- Throws:
TopiaException- if any db problem while storing datasIOException- if any pb while reading csv data- See Also:
-
importAllEntities
public static <T extends TopiaEntityEnum,E extends TopiaEntity> void importAllEntities(TopiaDAO<E> dao, TableMeta<T> meta, org.nuiton.csv.Import<E> importer, CsvImportResult<T> csvResult) throws TopiaException - Throws:
TopiaException
-
importAllEntities
public static <T extends TopiaEntityEnum,E extends TopiaEntity> void importAllEntities(TopiaDAO<E> dao, TableMeta<T> meta, org.nuiton.csv.Import<E> importer, CsvImportResult<T> csvResult, int nbRowBuffer) throws TopiaException - Throws:
TopiaException
-
importAllEntitiesAndReturnThem
public static <T extends TopiaEntityEnum,E extends TopiaEntity> Iterable<E> importAllEntitiesAndReturnThem(TopiaDAO<E> dao, TableMeta<T> meta, org.nuiton.csv.Import<E> importer, CsvImportResult<T> csvResult) throws TopiaException - Throws:
TopiaException
-
importNotExistingEntities
public static <T extends TopiaEntityEnum,E extends TopiaEntity> void importNotExistingEntities(TopiaDAO<E> dao, TableMeta<T> meta, Map<String, TopiaEntity> universe, org.nuiton.csv.Import<E> importer, CsvImportResult<T> csvResult) throws TopiaException- Throws:
TopiaException
-
importAssociation
public static <T extends TopiaEntityEnum> void importAssociation(TopiaContext tx, AssociationMeta<T> meta, org.nuiton.csv.ImportToMap importer, CsvImportResult<T> csvResult, int nbRowBuffer) throws TopiaException - Throws:
TopiaException
-
importNMAssociation
public static <T extends TopiaEntityEnum> void importNMAssociation(TopiaContext tx, AssociationMeta<T> meta, org.nuiton.csv.ImportToMap importer, CsvImportResult<T> csvResult, int nbRowBuffer) throws TopiaException - Throws:
TopiaException
-
importNMAssociation
public static <T extends TopiaEntityEnum> void importNMAssociation(TopiaContext tx, AssociationMeta<T> meta, Map<String, TopiaEntity> universe, org.nuiton.csv.ImportToMap importer, CsvImportResult<T> csvResult, int nbRowBuffer) throws TopiaException- Throws:
TopiaException
-
importAssociation
public static <T extends TopiaEntityEnum> void importAssociation(TopiaContext tx, AssociationMeta<T> meta, Map<String, TopiaEntity> universe, org.nuiton.csv.ImportToMap importer, CsvImportResult<T> csvResult, int nbRowBuffer) throws TopiaException- Throws:
TopiaException
-