Class DatevImportService
- java.lang.Object
-
- org.imixs.workflow.datev.imports.DatevImportService
-
@DeclareRoles({"org.imixs.ACCESSLEVEL.NOACCESS","org.imixs.ACCESSLEVEL.READERACCESS","org.imixs.ACCESSLEVEL.AUTHORACCESS","org.imixs.ACCESSLEVEL.EDITORACCESS","org.imixs.ACCESSLEVEL.MANAGERACCESS"}) @RolesAllowed({"org.imixs.ACCESSLEVEL.NOACCESS","org.imixs.ACCESSLEVEL.READERACCESS","org.imixs.ACCESSLEVEL.AUTHORACCESS","org.imixs.ACCESSLEVEL.EDITORACCESS","org.imixs.ACCESSLEVEL.MANAGERACCESS"}) public class DatevImportService extends ObjectThis Service provides methods to import data from a DATEV file.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:
to import datev data and assign the data to a workflow model.
-
-
Field Summary
Fields Modifier and Type Field Description static StringDATEN_FEHLERstatic StringIMPORT_ERRORstatic StringISO8601_FORMAT_DATEstatic StringISO8601_FORMAT_DATETIMEstatic intMAX_SEARCH_RESULT
-
Constructor Summary
Constructors Constructor Description DatevImportService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.imixs.workflow.ItemCollectionfindEntityByName(String key, String type, String clientID)This method finds a datev entity by the attribute 'txtName'StringimportData(InputStream imputStream, String encoding)This method imports all entities from a csv file.String[]normalizeValueList(String[] data)This method removes the " from a value listList<String>parseFieldList(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 Detail
-
DATEN_FEHLER
public static final String DATEN_FEHLER
- See Also:
- Constant Field Values
-
IMPORT_ERROR
public static final String IMPORT_ERROR
- See Also:
- Constant Field Values
-
MAX_SEARCH_RESULT
public static final int MAX_SEARCH_RESULT
- See Also:
- Constant Field Values
-
ISO8601_FORMAT_DATETIME
public static final String ISO8601_FORMAT_DATETIME
- See Also:
- Constant Field Values
-
ISO8601_FORMAT_DATE
public static final String ISO8601_FORMAT_DATE
- See Also:
- Constant Field Values
-
-
Method Detail
-
findEntityByName
public org.imixs.workflow.ItemCollection findEntityByName(String key, String type, String clientID)
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
public String[] normalizeValueList(String[] data)
This method removes the " from a value list- Parameters:
data-- Returns:
-
parseFieldList
public List<String> parseFieldList(String data)
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.ModelExceptionThis 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
-
-