public class InvoiceDOM extends Object
IBasicProfile
implementation. This class is also responsible to transform this dom structure into an XML.| Modifier and Type | Field and Description |
|---|---|
static CountryCode |
COUNTRY_CODE
The Constant COUNTRY_CODE.
|
static CurrencyCode |
CURR_CODE
The Constant CURR_CODE.
|
static NumberChecker |
DEC2
The Constant DEC2.
|
static NumberChecker |
DEC4
The Constant DEC4.
|
static DateFormatCode |
DF_CODE
The Constant DF_CODE.
|
protected Document |
doc
The DOM document.
|
static GlobalIdentifierCode |
GI_CODE
The Constant GI_CODE.
|
static MeasurementUnitCode |
M_UNIT_CODE
The Constant M_UNIT_CODE.
|
static PaymentMeansCode |
PM_CODE
The Constant PM_CODE.
|
static TaxCategoryCode |
TC_CODE
The Constant TC_CODE.
|
static TaxIDTypeCode |
TIDT_CODE
The Constant TIDT_CODE.
|
static TaxTypeCode |
TT_CODE
The Constant TT_CODE.
|
| Constructor and Description |
|---|
InvoiceDOM(IBasicProfile data)
Creates an object that will import data into an XML template.
|
InvoiceDOM(IBasicProfile data,
InvoiceProperties properties)
Creates an object that will import data into an XML template.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
check(String s,
String message)
Checks if a string is empty and throws a DataIncompleteException if so.
|
protected void |
importAppliedTradeAllowanceCharge(Element parent,
boolean indicator,
String actualAmount,
String currencyID,
String reason)
Imports applied trade allowance charge data (line items).
|
protected void |
importBuyerTradeParty(Element parent,
IBasicProfile data)
Gets the buyer trade party data to import this data.
|
protected void |
importContent(Element parent,
String tag,
String content,
String... attributes)
Helper method to set the content of a tag.
|
protected void |
importDateTime(Element parent,
String tag,
String dateTimeFormat,
Date dateTime)
Set the content of a date tag along with the attribute that defines the format.
|
protected void |
importHeaderExchangedDocument(Element element,
IBasicProfile data)
Imports the data for the following tag: rsm:HeaderExchangedDocument.
|
protected void |
importIncludedNotes(Element parent,
int level,
String[][] notes,
String[] notesCodes)
Includes notes and (in case of the COMFORT profile) the subject codes
for those notes.
|
protected void |
importInvoiceeTradeParty(Element parent,
IComfortProfile data)
Gets the invoicee party data to import this data.
|
protected void |
importLineItemBasic(Element parent,
String quantity,
String code,
String name)
Imports the data for a line item (basic profile).
|
protected void |
importLineItemComfort(Element parent,
String lineID,
String[][] note,
String grossPriceChargeAmount,
String grossPriceChargeAmountCurrencyID,
String grossPriceBasisQuantity,
String grossPriceBasisQuantityCode,
boolean[] grossPriceTradeAllowanceChargeIndicator,
String[] grossPriceTradeAllowanceChargeActualAmount,
String[] grossPriceTradeAllowanceChargeActualAmountCurrencyID,
String[] grossPriceTradeAllowanceChargeReason,
String netPriceChargeAmount,
String netPriceChargeAmountCurrencyID,
String netPriceBasisQuantity,
String netPriceBasisQuantityCode,
String billedQuantity,
String billedQuantityCode,
String[] settlementTaxTypeCode,
String[] settlementTaxExemptionReason,
String[] settlementTaxCategoryCode,
String[] settlementTaxApplicablePercent,
String totalAmount,
String totalAmountCurrencyID,
String specifiedTradeProductGlobalID,
String specifiedTradeProductSchemeID,
String specifiedTradeProductSellerAssignedID,
String specifiedTradeProductBuyerAssignedID,
String specifiedTradeProductName,
String specifiedTradeProductDescription)
Imports line item data (comfort profile).
|
protected void |
importLineItemsBasic(Element parent,
IBasicProfile data)
Gets line data to import the this data (basic profile).
|
protected void |
importLineItemsComfort(Element parent,
IComfortProfile data)
Gets line item data to import the this data (comfort profile).
|
protected void |
importPaymentMeans(Element parent,
IBasicProfile data)
Gets the payment means data to imports this data.
|
protected void |
importPaymentMeans(Element parent,
String typeCode,
String[] information,
String id,
String scheme,
String payerIban,
String payerProprietaryID,
String iban,
String accName,
String accID,
String payerBic,
String payerBank,
String payerInst,
String bic,
String bank,
String inst)
Imports payment means data.
|
protected void |
importSellerTradeParty(Element parent,
IBasicProfile data)
Gets the seller trade party data to import this data.
|
protected void |
importSpecifiedExchangedDocumentContext(Element element,
IBasicProfile data)
Imports the data for the following tag: rsm:SpecifiedExchangedDocumentContext.
|
protected void |
importSpecifiedLogisticsServiceCharge(Element parent,
IComfortProfile data)
Gets specified logistics service charge data to import the this data.
|
protected void |
importSpecifiedLogisticsServiceCharge(Element parent,
String[] description,
String appliedAmount,
String currencyID,
String[] typeCode,
String[] categoryCode,
String[] percent)
Imports specified logistics service charge data.
|
protected void |
importSpecifiedSupplyChainTradeTransaction(Element element,
IBasicProfile data)
Imports the data for the following tag: rsm:SpecifiedSupplyChainTradeTransaction.
|
protected void |
importSpecifiedTradeAllowanceCharge(Element parent,
boolean indicator,
String actualAmount,
String actualAmountCurrency,
String reason,
String[] typeCode,
String[] categoryCode,
String[] percent)
Imports specified trade allowance charge.
|
protected void |
importSpecifiedTradeAllowanceCharge(Element parent,
IComfortProfile data)
Gets specified trade allowance charge data to import the this data.
|
protected void |
importSpecifiedTradePaymentTerms(Element parent,
IComfortProfile data)
Gets specified trade payment terms data to import the this data.
|
protected void |
importSpecifiedTradePaymentTerms(Element parent,
String[] description,
Date dateTime,
String dateTimeFormat)
Imports specified trade payment terms.
|
protected void |
importTax(Element parent,
IBasicProfile data)
Gets tax data to import the this data.
|
protected void |
importTax(Element parent,
String typeCode,
String exemptionReason,
String category,
String percent)
Imports tax data.
|
protected void |
importTax(Element parent,
String calculatedAmount,
String currencyID,
String typeCode,
String exemptionReason,
String basisAmount,
String basisAmountCurr,
String category,
String percent)
Imports tax data.
|
protected void |
importTradeParty(Element parent,
String id,
String[] globalID,
String[] globalIDScheme,
String name,
String postcode,
String lineOne,
String lineTwo,
String cityName,
String countryID,
String[] taxRegistrationID,
String[] taxRegistrationSchemeID)
Imports trade party information (could be seller, buyer or invoicee).
|
protected static void |
removeEmptyNodes(Node node)
It is forbidden for a ZUGFeRD XML to contain empty tags, hence
we use this method recursively to remove empty nodes.
|
byte[] |
toXML()
Exports the Document as an XML file.
|
public static final CountryCode COUNTRY_CODE
public static final CurrencyCode CURR_CODE
public static final DateFormatCode DF_CODE
public static final GlobalIdentifierCode GI_CODE
public static final MeasurementUnitCode M_UNIT_CODE
public static final NumberChecker DEC2
public static final NumberChecker DEC4
public static final PaymentMeansCode PM_CODE
public static final TaxCategoryCode TC_CODE
public static final TaxIDTypeCode TIDT_CODE
public static final TaxTypeCode TT_CODE
protected final Document doc
public InvoiceDOM(IBasicProfile data) throws ParserConfigurationException, SAXException, IOException, DataIncompleteException, InvalidCodeException
data - If this is an instance of BASICInvoice, the BASIC profile will be used;
If this is an instance of COMFORTInvoice, the COMFORT profile will be used.ParserConfigurationException - the parser configuration exceptionSAXException - the SAX exceptionIOException - Signals that an I/O exception has occurred.DataIncompleteException - the data incomplete exceptionInvalidCodeException - the invalid code exceptionpublic InvoiceDOM(IBasicProfile data, InvoiceProperties properties) throws ParserConfigurationException, SAXException, IOException, DataIncompleteException, InvalidCodeException
data - If this is an instance of BASICInvoice, the BASIC profile will be used;
If this is an instance of COMFORTInvoice, the COMFORT profile will be used.properties - Invoice properties.ParserConfigurationException - the parser configuration exceptionSAXException - the SAX exceptionIOException - Signals that an I/O exception has occurred.DataIncompleteException - the data incomplete exceptionInvalidCodeException - the invalid code exceptionprotected void importSpecifiedExchangedDocumentContext(Element element, IBasicProfile data)
element - the rsm:SpecifiedExchangedDocumentContext elementdata - the invoice dataprotected void importHeaderExchangedDocument(Element element, IBasicProfile data) throws DataIncompleteException, InvalidCodeException
element - the rsm:HeaderExchangedDocument elementdata - the invoice dataDataIncompleteException - the data incomplete exceptionInvalidCodeException - the invalid code exceptionprotected void importContent(Element parent, String tag, String content, String... attributes)
parent - the parent element of the tagtag - the tag for which we want to set the contentcontent - the new content for the tagattributes - a sequence of attributes of which
the odd elements are keys, the even elements the
corresponding value.protected void importDateTime(Element parent, String tag, String dateTimeFormat, Date dateTime) throws InvalidCodeException
parent - the parent element that holds the date tagtag - the date tag we want to changedateTimeFormat - the format that will be used as an attributedateTime - the actual dateInvalidCodeException - the invalid code exceptionprotected void importIncludedNotes(Element parent, int level, String[][] notes, String[] notesCodes) throws DataIncompleteException, InvalidCodeException
parent - the parent element of the tag we want to changelevel - the level where the notices are added (header or line)notes - array of notesnotesCodes - array of codes for the notes.
If not null, notes and notesCodes need to have an equal number of elements.DataIncompleteException - the data incomplete exceptionInvalidCodeException - the invalid code exceptionprotected void importSpecifiedSupplyChainTradeTransaction(Element element, IBasicProfile data) throws DataIncompleteException, InvalidCodeException
element - the elementdata - the invoice dataDataIncompleteException - the data incomplete exceptionInvalidCodeException - the invalid code exceptionprotected void importSellerTradeParty(Element parent, IBasicProfile data) throws DataIncompleteException, InvalidCodeException
parent - the parent elementdata - the dataDataIncompleteException - the data incomplete exceptionInvalidCodeException - the invalid code exceptionprotected void importBuyerTradeParty(Element parent, IBasicProfile data) throws DataIncompleteException, InvalidCodeException
parent - the parent elementdata - the dataDataIncompleteException - the data incomplete exceptionInvalidCodeException - the invalid code exceptionprotected void importInvoiceeTradeParty(Element parent, IComfortProfile data) throws DataIncompleteException, InvalidCodeException
parent - the parent elementdata - the dataDataIncompleteException - the data incomplete exceptionInvalidCodeException - the invalid code exceptionprotected void importTradeParty(Element parent, String id, String[] globalID, String[] globalIDScheme, String name, String postcode, String lineOne, String lineTwo, String cityName, String countryID, String[] taxRegistrationID, String[] taxRegistrationSchemeID) throws DataIncompleteException, InvalidCodeException
parent - the parent elementid - the idglobalID - the global IDglobalIDScheme - the global ID schemename - the namepostcode - the postcodelineOne - the line onelineTwo - the line twocityName - the city namecountryID - the country IDtaxRegistrationID - the tax registration IDtaxRegistrationSchemeID - the tax registration scheme IDDataIncompleteException - the data incomplete exceptionInvalidCodeException - the invalid code exceptionprotected void importPaymentMeans(Element parent, IBasicProfile data) throws InvalidCodeException
parent - the parent elementdata - the dataInvalidCodeException - the invalid code exceptionprotected void importPaymentMeans(Element parent, String typeCode, String[] information, String id, String scheme, String payerIban, String payerProprietaryID, String iban, String accName, String accID, String payerBic, String payerBank, String payerInst, String bic, String bank, String inst) throws InvalidCodeException
parent - the parent elementtypeCode - the type codeinformation - the informationid - the idscheme - the schemepayerIban - the payer ibanpayerProprietaryID - the payer proprietary IDiban - the ibanaccName - the acc nameaccID - the acc IDpayerBic - the payer bicpayerBank - the payer bankpayerInst - the payer instbic - the bicbank - the bankinst - the instInvalidCodeException - the invalid code exceptionprotected void importTax(Element parent, IBasicProfile data) throws InvalidCodeException, DataIncompleteException
parent - the parent elementdata - the dataInvalidCodeException - the invalid code exceptionDataIncompleteException - the data incomplete exceptionprotected void importTax(Element parent, String calculatedAmount, String currencyID, String typeCode, String exemptionReason, String basisAmount, String basisAmountCurr, String category, String percent) throws InvalidCodeException, DataIncompleteException
parent - the parentcalculatedAmount - the calculated amountcurrencyID - the currency IDtypeCode - the type codeexemptionReason - the exemption reasonbasisAmount - the basis amountbasisAmountCurr - the basis amount currcategory - the categorypercent - the percentInvalidCodeException - the invalid code exceptionDataIncompleteException - the data incomplete exceptionprotected void importSpecifiedTradeAllowanceCharge(Element parent, IComfortProfile data) throws InvalidCodeException
parent - the parent elementdata - the dataInvalidCodeException - the invalid code exceptionprotected void importSpecifiedTradeAllowanceCharge(Element parent, boolean indicator, String actualAmount, String actualAmountCurrency, String reason, String[] typeCode, String[] categoryCode, String[] percent) throws InvalidCodeException
parent - the parentindicator - the indicatoractualAmount - the actual amountactualAmountCurrency - the actual amount currencyreason - the reasontypeCode - the type codecategoryCode - the category codepercent - the percentInvalidCodeException - the invalid code exceptionprotected void importSpecifiedLogisticsServiceCharge(Element parent, IComfortProfile data) throws InvalidCodeException
parent - the parent elementdata - the dataInvalidCodeException - the invalid code exceptionprotected void importSpecifiedLogisticsServiceCharge(Element parent, String[] description, String appliedAmount, String currencyID, String[] typeCode, String[] categoryCode, String[] percent) throws InvalidCodeException
parent - the parent elementdescription - the descriptionappliedAmount - the applied amountcurrencyID - the currency IDtypeCode - the type codecategoryCode - the category codepercent - the percentInvalidCodeException - the invalid code exceptionprotected void importSpecifiedTradePaymentTerms(Element parent, IComfortProfile data) throws InvalidCodeException
parent - the parent elementdata - the dataInvalidCodeException - the invalid code exceptionprotected void importSpecifiedTradePaymentTerms(Element parent, String[] description, Date dateTime, String dateTimeFormat) throws InvalidCodeException
parent - the parent elementdescription - the descriptiondateTime - the date timedateTimeFormat - the date time formatInvalidCodeException - the invalid code exceptionprotected void importLineItemsComfort(Element parent, IComfortProfile data) throws DataIncompleteException, InvalidCodeException
parent - the parent elementdata - the dataDataIncompleteException - the data incomplete exceptionInvalidCodeException - the invalid code exceptionprotected void importLineItemComfort(Element parent, String lineID, String[][] note, String grossPriceChargeAmount, String grossPriceChargeAmountCurrencyID, String grossPriceBasisQuantity, String grossPriceBasisQuantityCode, boolean[] grossPriceTradeAllowanceChargeIndicator, String[] grossPriceTradeAllowanceChargeActualAmount, String[] grossPriceTradeAllowanceChargeActualAmountCurrencyID, String[] grossPriceTradeAllowanceChargeReason, String netPriceChargeAmount, String netPriceChargeAmountCurrencyID, String netPriceBasisQuantity, String netPriceBasisQuantityCode, String billedQuantity, String billedQuantityCode, String[] settlementTaxTypeCode, String[] settlementTaxExemptionReason, String[] settlementTaxCategoryCode, String[] settlementTaxApplicablePercent, String totalAmount, String totalAmountCurrencyID, String specifiedTradeProductGlobalID, String specifiedTradeProductSchemeID, String specifiedTradeProductSellerAssignedID, String specifiedTradeProductBuyerAssignedID, String specifiedTradeProductName, String specifiedTradeProductDescription) throws DataIncompleteException, InvalidCodeException
parent - the parent elementlineID - the line IDnote - the notegrossPriceChargeAmount - the gross price charge amountgrossPriceChargeAmountCurrencyID - the gross price charge amount currency IDgrossPriceBasisQuantity - the gross price basis quantitygrossPriceBasisQuantityCode - the gross price basis quantity codegrossPriceTradeAllowanceChargeIndicator - the gross price trade allowance charge indicatorgrossPriceTradeAllowanceChargeActualAmount - the gross price trade allowance charge actual amountgrossPriceTradeAllowanceChargeActualAmountCurrencyID - the gross price trade allowance charge actual amount currency IDgrossPriceTradeAllowanceChargeReason - the gross price trade allowance charge reasonnetPriceChargeAmount - the net price charge amountnetPriceChargeAmountCurrencyID - the net price charge amount currency IDnetPriceBasisQuantity - the net price basis quantitynetPriceBasisQuantityCode - the net price basis quantity codebilledQuantity - the billed quantitybilledQuantityCode - the billed quantity codesettlementTaxTypeCode - the settlement tax type codesettlementTaxExemptionReason - the settlement tax exemption reasonsettlementTaxCategoryCode - the settlement tax category codesettlementTaxApplicablePercent - the settlement tax applicable percenttotalAmount - the total amounttotalAmountCurrencyID - the total amount currency IDspecifiedTradeProductGlobalID - the specified trade product global IDspecifiedTradeProductSchemeID - the specified trade product scheme IDspecifiedTradeProductSellerAssignedID - the specified trade product seller assigned IDspecifiedTradeProductBuyerAssignedID - the specified trade product buyer assigned IDspecifiedTradeProductName - the specified trade product namespecifiedTradeProductDescription - the specified trade product descriptionDataIncompleteException - the data incomplete exceptionInvalidCodeException - the invalid code exceptionprotected void importAppliedTradeAllowanceCharge(Element parent, boolean indicator, String actualAmount, String currencyID, String reason) throws DataIncompleteException, InvalidCodeException
parent - the parent elementindicator - the indicatoractualAmount - the actual amountcurrencyID - the currency IDreason - the reasonDataIncompleteException - the data incomplete exceptionInvalidCodeException - the invalid code exceptionprotected void importTax(Element parent, String typeCode, String exemptionReason, String category, String percent) throws InvalidCodeException, DataIncompleteException
parent - the parent elementtypeCode - the type codeexemptionReason - the exemption reasoncategory - the categorypercent - the percentInvalidCodeException - the invalid code exceptionDataIncompleteException - the data incomplete exceptionprotected void importLineItemsBasic(Element parent, IBasicProfile data) throws DataIncompleteException, InvalidCodeException
parent - the parentdata - the dataDataIncompleteException - the data incomplete exceptionInvalidCodeException - the invalid code exceptionprotected void importLineItemBasic(Element parent, String quantity, String code, String name) throws InvalidCodeException
parent - the parent elementquantity - the quantitycode - the codename - the nameInvalidCodeException - the invalid code exceptionpublic byte[] toXML()
throws TransformerException
TransformerException - the transformer exceptionprotected static void removeEmptyNodes(Node node)
node - the node from which we want to remove the empty nodesprotected void check(String s, String message) throws DataIncompleteException
s - the String to checkmessage - the message if an exception is thrownDataIncompleteException - the data incomplete exceptionCopyright © 1998–2018 iText Group NV. All rights reserved.