Package org.imixs.archive.importer.ftp
Class CSVImportService
- java.lang.Object
-
- org.imixs.archive.importer.ftp.CSVImportService
-
@Named public class CSVImportService extends Object
The CSVImportService reacts on DocumentImportEvent and importes 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 Modifier and Type Field Description static StringDATA_ERRORstatic StringIMPORT_ERROR
-
Constructor Summary
Constructors Constructor Description CSVImportService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.imixs.workflow.ItemCollectionfindEntityByName(String key, String type)This method finds a entity by the attribute 'Name'StringimportData(InputStream imputStream, 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 Detail
-
DATA_ERROR
public static final String DATA_ERROR
- See Also:
- Constant Field Values
-
IMPORT_ERROR
public static final String IMPORT_ERROR
- See Also:
- Constant Field Values
-
-
Method Detail
-
onEvent
public void onEvent(@Observes DocumentImportEvent event)This method reacts on a CDI ImportEvent and imports the data of a CSV file form a ftp server.
-
importData
public String importData(InputStream imputStream, 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
-
-