Package org.imixs.archive.documents
Class EInvoiceAdapter
java.lang.Object
org.imixs.archive.documents.EInvoiceAdapter
- All Implemented Interfaces:
org.imixs.workflow.Adapter,org.imixs.workflow.SignalAdapter
- Direct Known Subclasses:
EInvoiceAutoAdapter,EInvoiceMetaAdapter
The EInvoiceAdapter can detect and extract content from e-invoice documents
in different formats.
The detection outcome of the adapter is a new item named 'einvoice.type' with the detected type of the e-invoice format. E.g: - Factur-X/ZUGFeRD 2.0 The Adapter can be configured by the BPMN event to extract e-invoice data fields
Example e-invoice configuration:
<e-invoice name="ENTITY">
<name>invoice.date</name>
<type>date</type>
<xpath>//rsm:CrossInvoice/ram:ID</xpath>
</e-invoice>
If the type is not set the item value will be treated as a String. Possible
types are 'double' and 'date'
If the document is not a e-invoice no items and also the einvoice.type field will be set.
- Version:
- 2.0
- Author:
- rsoika
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcreateXMLDoc(byte[] xmlData) Creates the XML document instance based on a XML contentorg.imixs.workflow.FileDatadetectEInvoice(org.imixs.workflow.ItemCollection workitem) Detects the first e-invoice from the attached files in the workitem.static StringdetectEInvoiceType(org.imixs.workflow.FileData fileData) This method detects the einvoice.type of a given FileDataorg.imixs.workflow.ItemCollectionexecute(org.imixs.workflow.ItemCollection workitem, org.imixs.workflow.ItemCollection event) Executes the e-invoice detection process on the given workitem.voidreadItem(org.imixs.workflow.ItemCollection workitem, String xPathExpr, String itemType, String itemName) Reads a single item from an e-invoice document based on a xPathExpbyte[]readXMLContent(org.imixs.workflow.FileData fileData) Reads the XML Content from the FileData attribute 'xml'
-
Field Details
-
E_INVOICE_ENTITY
- See Also:
-
FILE_ATTRIBUTE_XML
- See Also:
-
FILE_ATTRIBUTE_EINVOICE_TYPE
- See Also:
-
PARSING_EXCEPTION
- See Also:
-
PLUGIN_ERROR
- See Also:
-
REPORT_ERROR
- See Also:
-
NAMESPACES
-
PROCESSING_ERROR
-
CONFIG_ERROR
- See Also:
-
-
Constructor Details
-
EInvoiceAdapter
public EInvoiceAdapter()
-
-
Method Details
-
execute
public org.imixs.workflow.ItemCollection execute(org.imixs.workflow.ItemCollection workitem, org.imixs.workflow.ItemCollection event) throws org.imixs.workflow.exceptions.AdapterException, org.imixs.workflow.exceptions.PluginException Executes the e-invoice detection process on the given workitem. It attempts to detect the e-invoice format from attached files and updates the workitem with the result.- Specified by:
executein interfaceorg.imixs.workflow.Adapter- Parameters:
workitem- The workitem to processevent- The event triggering this execution- Returns:
- The updated workitem
- Throws:
org.imixs.workflow.exceptions.AdapterException- If there's an error in the adapter executionorg.imixs.workflow.exceptions.PluginException- If there's an error in plugin processing
-
detectEInvoice
public org.imixs.workflow.FileData detectEInvoice(org.imixs.workflow.ItemCollection workitem) throws org.imixs.workflow.exceptions.PluginException Detects the first e-invoice from the attached files in the workitem. It first checks for PDF files with embedded XML, then standalone XML files. The method returns the FileData Object with the new attributes 'einvoice.type' and 'xml'- Parameters:
workitem- The workitem containing the attachments to analyze- Returns:
- The detected e-invoice type, or null if not detected
- Throws:
org.imixs.workflow.exceptions.PluginException- If there's an error in processing the attachments
-
detectEInvoiceType
public static String detectEInvoiceType(org.imixs.workflow.FileData fileData) throws org.imixs.workflow.exceptions.PluginException This method detects the einvoice.type of a given FileData- Parameters:
workitem-- Returns:
- Throws:
org.imixs.workflow.exceptions.PluginException
-
readXMLContent
public byte[] readXMLContent(org.imixs.workflow.FileData fileData) Reads the XML Content from the FileData attribute 'xml'- Parameters:
fileData-xmlData-
-
createXMLDoc
public void createXMLDoc(byte[] xmlData) throws org.imixs.workflow.exceptions.PluginException Creates the XML document instance based on a XML content- Parameters:
xmlData-- Throws:
org.imixs.workflow.exceptions.PluginException
-
readItem
public void readItem(org.imixs.workflow.ItemCollection workitem, String xPathExpr, String itemType, String itemName) throws org.imixs.workflow.exceptions.PluginException Reads a single item from an e-invoice document based on a xPathExp- Parameters:
workitem-xPathExpr-itemType-itemName-- Throws:
org.imixs.workflow.exceptions.PluginException
-