public class CSVImportService extends Object
The implementation is based on org.apache.commons.net.ftp
The CSV import can be customized by various options
| Modifier and Type | Field and Description |
|---|---|
static String |
DATA_ERROR |
static String |
IMPORT_ERROR |
| Constructor and Description |
|---|
CSVImportService() |
| Modifier and Type | Method and Description |
|---|---|
org.imixs.workflow.ItemCollection |
createWorkitem(org.imixs.workflow.ItemCollection source,
String fileName,
byte[] rawData)
Creates and processes a new workitem with a given filedata
|
org.imixs.workflow.ItemCollection |
findEntityByName(String key,
String type)
This method finds a entity by the attribute 'Name'
|
String |
importData(InputStream imputStream,
String encoding,
String type,
String keyField,
DocumentImportEvent event)
This method imports all entities from a csv file.
|
void |
onEvent(DocumentImportEvent event)
This method reacts on a CDI ImportEvent and imports the data of a CSV file
form a ftp server.
|
void |
saveEntry(org.imixs.workflow.ItemCollection aWorkitem,
String type)
This method process a single workIten in a new transaction.
|
public static final String DATA_ERROR
public static final String IMPORT_ERROR
public void onEvent(@Observes
DocumentImportEvent event)
public org.imixs.workflow.ItemCollection createWorkitem(org.imixs.workflow.ItemCollection source,
String fileName,
byte[] rawData)
throws org.imixs.workflow.exceptions.AccessDeniedException,
org.imixs.workflow.exceptions.ProcessingErrorException,
org.imixs.workflow.exceptions.PluginException,
org.imixs.workflow.exceptions.ModelException
org.imixs.workflow.exceptions.ModelExceptionorg.imixs.workflow.exceptions.PluginExceptionorg.imixs.workflow.exceptions.ProcessingErrorExceptionorg.imixs.workflow.exceptions.AccessDeniedExceptionpublic String importData(InputStream imputStream, String encoding, String type, String keyField, DocumentImportEvent event) throws org.imixs.workflow.exceptions.PluginException
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
org.imixs.workflow.exceptions.PluginExceptionpublic void saveEntry(org.imixs.workflow.ItemCollection aWorkitem,
String type)
throws org.imixs.workflow.exceptions.AccessDeniedException,
org.imixs.workflow.exceptions.ProcessingErrorException,
org.imixs.workflow.exceptions.PluginException,
org.imixs.workflow.exceptions.ModelException
aWorkitem - org.imixs.workflow.exceptions.PluginExceptionorg.imixs.workflow.exceptions.ProcessingErrorExceptionorg.imixs.workflow.exceptions.AccessDeniedExceptionorg.imixs.workflow.exceptions.ModelExceptionCopyright © 2016–2021 Imixs Software Solutions GmbH. All rights reserved.