Package org.imixs.archive.importer.ftp
Class CSVImportService
java.lang.Object
org.imixs.archive.importer.ftp.CSVImportService
The CSVImportService reacts on DocumentImportEvent and imports a CSV file
form a FTP data source.
The implementation is based on org.apache.commons.net.ftp
The CSV import can be customized by various options
- Author:
- rsoika
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.imixs.workflow.ItemCollectionfindEntityByName(String key, String type) This method finds a entity by the attribute 'Name'importData(InputStream inputStream, String encoding, String type, String keyField, DocumentImportEvent event) This method imports all entities from a csv file.voidonEvent(DocumentImportEvent event) This method reacts on a CDI ImportEvent and imports the data of a CSV file form a ftp server.
-
Field Details
-
DATA_ERROR
- See Also:
-
IMPORT_ERROR
- See Also:
-
-
Constructor Details
-
CSVImportService
public CSVImportService()
-
-
Method Details
-
onEvent
This method reacts on a CDI ImportEvent and imports the data of a CSV file form a ftp server. -
importData
public String importData(InputStream inputStream, String encoding, String type, String keyField, DocumentImportEvent event) throws org.imixs.workflow.exceptions.PluginException This method imports all entities from a csv file. The file must have one header line.The method runs in a new transaction so processing exceptions can be caught.
All existing entries not listed in the current file will be removed.
Each imported document will have a unique key in the item 'name' to be used to verify if the entry already exists.
The method returns a log . If an error occurs a plugin exception is thrown
- Returns:
- ErrorMessage or empty String
- Throws:
org.imixs.workflow.exceptions.PluginException
-
findEntityByName
This method finds a entity by the attribute 'Name'- Parameters:
key- - name of the object (name)type- - type of the object- Returns:
- entity or null if no entity with the given name exists
-