Class DatevImportService
The import file must contain 2 header rows. The 1st row contains the object type, the 2nd row contains the filed names.
Example 1st line:
"DTVF";700;20;"Kontenbeschriftungen";2;20180917165240335;;"RE";"Farida.Weikard";"";217386;21010;20180101;6;;;"";"";;0;;"";;"";;141987;"04";;;"";""Example 2nd line:
Konto;Kontobeschriftung;SprachId
The service provides methods to search for DATEV objects by key or search phrase. A search result can be optional restricted to a specific DATEV client. NOTE: the item _datev_client_id must be part of the property lucence.indexFieldListNoAnalyze to use this feature.
- Author:
- rsoika
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.imixs.workflow.ItemCollectionfindEntityByName(String key, String type, String clientID) This method finds a datev entity by the attribute 'txtName'importData(InputStream imputStream, String encoding) This method imports all entities from a csv file.String[]normalizeValueList(String[] data) This method removes the " from a value listparseFieldList(String data) This method parses a DATEV field description (first line of the csv file)org.imixs.workflow.ItemCollectionreadEntity(String data, List<String> fieldnames) This method creates a ItemCollection from a csv file data line The method also creates a txtworkflowabstract to support fulltext searchvoidsaveEntry(org.imixs.workflow.ItemCollection aWorkitem, String type, String clientID, String consultenID) This method process a single workIten in a new transaction.List<org.imixs.workflow.ItemCollection>searchEntity(String phrase, String type, String clientID) This method returns a list of ItemCollections matching the search phrase and type.
-
Field Details
-
DATA_ERROR
- See Also:
-
IMPORT_ERROR
- See Also:
-
MAX_SEARCH_RESULT
public static final int MAX_SEARCH_RESULT- See Also:
-
ISO8601_FORMAT_DATETIME
- See Also:
-
ISO8601_FORMAT_DATE
- See Also:
-
-
Constructor Details
-
DatevImportService
public DatevImportService()
-
-
Method Details
-
findEntityByName
This method finds a datev entity by the attribute 'txtName'The param clientID is optional and restricts the result to a specific DATEV client. NOTE: the item _datev_client_id must be part of the property lucence.indexFieldListNoAnalyze.
- Parameters:
key- - name of the object (txtname)type- - DATEV type of the objectclientID- - optional restriction to a specific client id (_datev_client_id)- Returns:
- DATEV entity or null if no entity with the given name exits
-
searchEntity
public List<org.imixs.workflow.ItemCollection> searchEntity(String phrase, String type, String clientID) This method returns a list of ItemCollections matching the search phrase and type. The type depends on the datev import fileThe param clientID is optional and restricts the result to a specific DATEV client. NOTE: the item _datev_client_id must be part of the property lucence.indexFieldListNoAnalyze.
- Parameters:
phrase- - search phrasetype- - DATEV type of the objectclientID- - optional restriction to a specific client id (_datev_client_id)- Returns:
- - list of matching profiles
-
importData
public String importData(InputStream imputStream, String encoding) throws org.imixs.workflow.exceptions.PluginException This method imports all entities from a csv file. The file must have two header lines. 1st Line=object type, 2nd line = fieldnames.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 the item '_datev_client_id' and '_datev_consultant_id'. These item are mapped to the "Mandant id" and "Berater id" from Datev. These categories allow the import of data from different clients and consults. It is important that the fields '_datev_client_id' and '_datev_consultant_id' are added to the lucene index so that a search for data of a specific client is possible.
lucence.indexFieldListNoAnalyze=....,_datev_client_id,_datev_consultant_idThe method returns a log . If an error occurs a plugin exception is thrown
- Returns:
- ErrorMessage or empty String
- Throws:
org.imixs.workflow.exceptions.PluginException
-
normalizeValueList
This method removes the " from a value list- Parameters:
data-- Returns:
-
parseFieldList
This method parses a DATEV field description (first line of the csv file)- Returns:
- list of fieldnames
-
saveEntry
public void saveEntry(org.imixs.workflow.ItemCollection aWorkitem, String type, String clientID, String consultenID) throws org.imixs.workflow.exceptions.AccessDeniedException, org.imixs.workflow.exceptions.ProcessingErrorException, org.imixs.workflow.exceptions.PluginException, org.imixs.workflow.exceptions.ModelException This method process a single workIten in a new transaction. The method adds the type 'kreditor' to the entity.- Parameters:
aWorkitem-- Throws:
org.imixs.workflow.exceptions.PluginExceptionorg.imixs.workflow.exceptions.ProcessingErrorExceptionorg.imixs.workflow.exceptions.AccessDeniedExceptionorg.imixs.workflow.exceptions.ModelException
-
readEntity
This method creates a ItemCollection from a csv file data line The method also creates a txtworkflowabstract to support fulltext search- Parameters:
data-fieldnames-- Returns:
-