use .editorconfig for java
This commit is contained in:
23
.editorconfig
Normal file
23
.editorconfig
Normal file
@@ -0,0 +1,23 @@
|
||||
# EditorConfig is awesome: https://EditorConfig.org
|
||||
|
||||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
# Unix-style newlines with a newline ending every file
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
|
||||
# Tab indentation (no size specified)
|
||||
[*.java]
|
||||
indent_style = tab
|
||||
|
||||
# 2 space indentation
|
||||
[*.xsd,*.xsl,*.xml]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
# all x** Files
|
||||
[{package.json,.travis.yml}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
@@ -23,29 +23,34 @@ import java.io.InputStream;
|
||||
|
||||
public interface IExporterFactory {
|
||||
public ZUGFeRDExporter load(String pdfFilename) throws IOException;
|
||||
|
||||
/**
|
||||
* Makes A PDF/A3a-compliant document from a PDF-A1 compliant document (on the
|
||||
* metadata level, this will not e.g. convert graphics to JPG-2000)
|
||||
*
|
||||
* @param pdfBinary
|
||||
* binary of a PDF/A1 compliant document
|
||||
* @param pdfBinary binary of a PDF/A1 compliant document
|
||||
*/
|
||||
public ZUGFeRDExporter load(byte[] pdfBinary) throws IOException;
|
||||
|
||||
/**
|
||||
* Makes A PDF/A3a-compliant document from a PDF-A1 compliant document (on the
|
||||
* metadata level, this will not e.g. convert graphics to JPG-2000)
|
||||
*
|
||||
* @param pdfSource
|
||||
* source to read a PDF/A1 compliant document from
|
||||
* @param pdfSource source to read a PDF/A1 compliant document from
|
||||
* @throws IOException
|
||||
*/
|
||||
public ZUGFeRDExporter load(InputStream pdfSource) throws IOException;
|
||||
|
||||
public IExporterFactory setCreator(String creator);
|
||||
|
||||
public IExporterFactory setConformanceLevel(PDFAConformanceLevel newLevel);
|
||||
|
||||
public IExporterFactory setProducer(String producer);
|
||||
|
||||
public IExporterFactory setZUGFeRDVersion(int version);
|
||||
|
||||
public IExporterFactory ignorePDFAErrors();
|
||||
|
||||
public IExporterFactory setZUGFeRDConformanceLevel(ZUGFeRDConformanceLevel zugferdConformanceLevel);
|
||||
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ package org.mustangproject.ZUGFeRD;
|
||||
public interface IXMLProvider {
|
||||
|
||||
public byte[] getXML();
|
||||
|
||||
public void setTest();
|
||||
|
||||
public void generateXML(IZUGFeRDExportableTransaction trans);
|
||||
|
||||
@@ -18,7 +18,6 @@ package org.mustangproject.ZUGFeRD;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author AlexanderSchmidt
|
||||
*/
|
||||
public interface IZUGFeRDAllowanceCharge {
|
||||
|
||||
@@ -17,50 +17,58 @@
|
||||
*
|
||||
*********************************************************************** */
|
||||
package org.mustangproject.ZUGFeRD;
|
||||
|
||||
/**
|
||||
* Mustangproject's ZUGFeRD implementation
|
||||
* Neccessary interface for ZUGFeRD exporter
|
||||
* Licensed under the APLv2
|
||||
* @date 2014-05-10
|
||||
* @version 1.2.0
|
||||
*
|
||||
* @author jstaerk
|
||||
* */
|
||||
* @version 1.2.0
|
||||
* @date 2014-05-10
|
||||
*/
|
||||
|
||||
|
||||
public interface IZUGFeRDExportableContact {
|
||||
|
||||
/**
|
||||
* First and last name of the recipient
|
||||
*
|
||||
* @return First and last name of the recipient
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Postal code of the recipient
|
||||
*
|
||||
* @return Postal code of the recipient
|
||||
*/
|
||||
String getZIP();
|
||||
|
||||
/**
|
||||
* VAT ID (Umsatzsteueridentifikationsnummer) of the contact
|
||||
*
|
||||
* @return VAT ID (Umsatzsteueridentifikationsnummer) of the contact
|
||||
*/
|
||||
String getVATID();
|
||||
|
||||
/**
|
||||
* two-letter country code of the contact
|
||||
*
|
||||
* @return two-letter iso country code of the contact
|
||||
*/
|
||||
String getCountry();
|
||||
|
||||
/***
|
||||
/**
|
||||
* Returns the city of the contact
|
||||
*
|
||||
* @return Returns the city of the recipient
|
||||
*/
|
||||
String getLocation();
|
||||
|
||||
/***
|
||||
/**
|
||||
* Returns the street address (street+number) of the contact
|
||||
*
|
||||
* @return street address (street+number) of the contact
|
||||
*/
|
||||
String getStreet();
|
||||
|
||||
@@ -31,22 +31,25 @@ import java.math.BigDecimal;
|
||||
public interface IZUGFeRDExportableItem {
|
||||
|
||||
IZUGFeRDExportableProduct getProduct();
|
||||
|
||||
IZUGFeRDAllowanceCharge[] getItemAllowances();
|
||||
|
||||
IZUGFeRDAllowanceCharge[] getItemCharges();
|
||||
|
||||
|
||||
/**
|
||||
* The price of one item excl. taxes
|
||||
*
|
||||
* @return The price of one item excl. taxes
|
||||
*/
|
||||
BigDecimal getPrice();
|
||||
|
||||
/***
|
||||
/**
|
||||
* how many
|
||||
*
|
||||
* @return the quantity of the item
|
||||
*/
|
||||
BigDecimal getQuantity();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -17,61 +17,67 @@
|
||||
*
|
||||
*********************************************************************** */
|
||||
package org.mustangproject.ZUGFeRD;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* Mustangproject's ZUGFeRD implementation
|
||||
* Necessary interface for ZUGFeRD exporter
|
||||
* Licensed under the APLv2
|
||||
* @date 2014-05-10
|
||||
* @version 1.2.0
|
||||
*
|
||||
* @author jstaerk
|
||||
* */
|
||||
* @version 1.2.0
|
||||
* @date 2014-05-10
|
||||
*/
|
||||
|
||||
public interface IZUGFeRDExportableProduct {
|
||||
|
||||
/**
|
||||
* Unit code of the product
|
||||
* Most common ones are
|
||||
C62 one (piece)
|
||||
DAY day
|
||||
HAR hectare
|
||||
HUR hour
|
||||
KGM kilogram
|
||||
KTM kilometre
|
||||
KWH kilowatt hour
|
||||
LS lump sum
|
||||
LTR litre
|
||||
MIN minute
|
||||
MMK square millimetre
|
||||
MMT millimetre
|
||||
MTK square metre
|
||||
MTQ cubic metre
|
||||
MTR metre
|
||||
NAR number of articles
|
||||
NPR number of pairs
|
||||
P1 percent
|
||||
SET set
|
||||
TNE tonne (metric ton)
|
||||
WEE week
|
||||
|
||||
* C62 one (piece)
|
||||
* DAY day
|
||||
* HAR hectare
|
||||
* HUR hour
|
||||
* KGM kilogram
|
||||
* KTM kilometre
|
||||
* KWH kilowatt hour
|
||||
* LS lump sum
|
||||
* LTR litre
|
||||
* MIN minute
|
||||
* MMK square millimetre
|
||||
* MMT millimetre
|
||||
* MTK square metre
|
||||
* MTQ cubic metre
|
||||
* MTR metre
|
||||
* NAR number of articles
|
||||
* NPR number of pairs
|
||||
* P1 percent
|
||||
* SET set
|
||||
* TNE tonne (metric ton)
|
||||
* WEE week
|
||||
*
|
||||
* @return a UN/ECE rec 20 unit code see https://www.unece.org/fileadmin/DAM/cefact/recommendations/rec20/rec20_rev3_Annex2e.pdf
|
||||
*/
|
||||
String getUnit();
|
||||
|
||||
/**
|
||||
* Short name of the product
|
||||
*
|
||||
* @return Short name of the product
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* long description of the product
|
||||
*
|
||||
* @return long description of the product
|
||||
*/
|
||||
String getDescription();
|
||||
|
||||
/**
|
||||
* VAT percent of the product (e.g. 19, or 5.1 if you like)
|
||||
*
|
||||
* @return VAT percent of the product
|
||||
*/
|
||||
BigDecimal getVATPercent();
|
||||
|
||||
@@ -27,19 +27,20 @@ package org.mustangproject.ZUGFeRD;
|
||||
* */
|
||||
|
||||
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public interface IZUGFeRDExportableTransaction {
|
||||
|
||||
/**
|
||||
* Number, typically invoice number of the invoice
|
||||
*
|
||||
* @return invoice number
|
||||
*/
|
||||
String getNumber();
|
||||
|
||||
/**
|
||||
* the date when the invoice was created
|
||||
*
|
||||
* @return when the invoice was created
|
||||
*/
|
||||
Date getIssueDate();
|
||||
@@ -48,121 +49,141 @@ public interface IZUGFeRDExportableTransaction {
|
||||
* this should be the full sender institution name, details, manager and tax registration.
|
||||
* It is one of the few functions which may return null.
|
||||
* e.g.
|
||||
* <p/>
|
||||
* Lieferant GmbH
|
||||
* Lieferantenstraße 20
|
||||
* 80333 München
|
||||
* Deutschland
|
||||
* Geschäftsführer: Hans Muster
|
||||
* Handelsregisternummer: H A 123
|
||||
*
|
||||
Lieferant GmbH
|
||||
Lieferantenstraße 20
|
||||
80333 München
|
||||
Deutschland
|
||||
Geschäftsführer: Hans Muster
|
||||
Handelsregisternummer: H A 123
|
||||
* @return null or full sender institution name, details, manager and tax registration
|
||||
*/
|
||||
String getOwnOrganisationFullPlaintextInfo();
|
||||
|
||||
/**
|
||||
* when the invoice is to be paid
|
||||
*
|
||||
* @return when the invoice is to be paid
|
||||
*/
|
||||
Date getDueDate();
|
||||
|
||||
IZUGFeRDAllowanceCharge[] getZFAllowances();
|
||||
|
||||
IZUGFeRDAllowanceCharge[] getZFCharges();
|
||||
|
||||
IZUGFeRDAllowanceCharge[] getZFLogisticsServiceCharges();
|
||||
|
||||
IZUGFeRDExportableItem[] getZFItems();
|
||||
|
||||
/***
|
||||
/**
|
||||
* the recipient
|
||||
*
|
||||
* @return the recipient of the invoice
|
||||
*/
|
||||
IZUGFeRDExportableContact getRecipient();
|
||||
|
||||
/***
|
||||
/**
|
||||
* BIC of the sender
|
||||
*
|
||||
* @return the BIC code of the recipient sender's bank
|
||||
*/
|
||||
String getOwnBIC();
|
||||
|
||||
/***
|
||||
/**
|
||||
* BLZ of the sender
|
||||
*
|
||||
* @return the BLZ code of the recipient sender's bank
|
||||
*/
|
||||
String getOwnBLZ();
|
||||
|
||||
/***
|
||||
/**
|
||||
* Bank name of the sender
|
||||
*
|
||||
* @return the name of the sender's bank
|
||||
*/
|
||||
String getOwnBankName();
|
||||
|
||||
/**
|
||||
* IBAN of the sender
|
||||
*
|
||||
* @return the IBAN of the invoice sender's bank account
|
||||
*/
|
||||
String getOwnIBAN();
|
||||
|
||||
/**
|
||||
* IBAN of the sender
|
||||
*
|
||||
* @return the Account Number of the invoice sender's bank account
|
||||
*/
|
||||
String getOwnKto();
|
||||
|
||||
/**
|
||||
* Tax ID (not VAT ID) of the sender
|
||||
*
|
||||
* @return Tax ID (not VAT ID) of the sender
|
||||
*/
|
||||
String getOwnTaxID();
|
||||
|
||||
/**
|
||||
* VAT ID (Umsatzsteueridentifikationsnummer) of the sender
|
||||
*
|
||||
* @return VAT ID (Umsatzsteueridentifikationsnummer) of the sender
|
||||
*/
|
||||
String getOwnVATID();
|
||||
|
||||
/**
|
||||
* own name
|
||||
*
|
||||
* @return the sender's organisation name
|
||||
*/
|
||||
String getOwnOrganisationName();
|
||||
|
||||
/**
|
||||
* own street address
|
||||
*
|
||||
* @return sender street address
|
||||
*/
|
||||
String getOwnStreet();
|
||||
|
||||
/**
|
||||
* own street postal code
|
||||
*
|
||||
* @return sender postal code
|
||||
*/
|
||||
String getOwnZIP();
|
||||
|
||||
/**
|
||||
* own city
|
||||
*
|
||||
* @return the invoice sender's city
|
||||
*/
|
||||
String getOwnLocation();
|
||||
|
||||
/**
|
||||
* own two digit country code
|
||||
*
|
||||
* @return the invoice senders two character country iso code
|
||||
*/
|
||||
String getOwnCountry();
|
||||
|
||||
/**
|
||||
* get delivery date
|
||||
*
|
||||
* @return the day the goods have been delivered
|
||||
*/
|
||||
Date getDeliveryDate();
|
||||
|
||||
/**
|
||||
* get main invoice currency used on the invoice
|
||||
*
|
||||
* @return three character currency of this invoice
|
||||
*/
|
||||
String getCurrency();
|
||||
|
||||
/**
|
||||
* get payment information text. e.g. Bank transfer
|
||||
*
|
||||
* @return payment information text
|
||||
*/
|
||||
String getOwnPaymentInfoText();
|
||||
@@ -170,6 +191,7 @@ public interface IZUGFeRDExportableTransaction {
|
||||
/**
|
||||
* get payment term descriptional text
|
||||
* e.g. Bis zum 22.10.2015 ohne Abzug
|
||||
*
|
||||
* @return get payment terms
|
||||
*/
|
||||
String getPaymentTermDescription();
|
||||
@@ -178,6 +200,7 @@ public interface IZUGFeRDExportableTransaction {
|
||||
* get reference document number
|
||||
* typically used for Invoice Corrections
|
||||
* Will be added as IncludedNote in comfort profile
|
||||
*
|
||||
* @return the ID of the document this document refers to
|
||||
*/
|
||||
String getReferenceNumber();
|
||||
|
||||
@@ -19,14 +19,16 @@
|
||||
package org.mustangproject.ZUGFeRD;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* Mustangproject's ZUGFeRD implementation
|
||||
* ZUGFeRD exporter helper class
|
||||
* Licensed under the APLv2
|
||||
* @date 2015-10-29
|
||||
* @version 1.2.0
|
||||
*
|
||||
* @author jstaerk
|
||||
* */
|
||||
* @version 1.2.0
|
||||
* @date 2015-10-29
|
||||
*/
|
||||
public class VATAmount {
|
||||
|
||||
public VATAmount(BigDecimal basis, BigDecimal calculated) {
|
||||
|
||||
@@ -25,6 +25,7 @@ package org.mustangproject.ZUGFeRD;
|
||||
* @version 1.2.0s
|
||||
* @author jstaerk
|
||||
* */
|
||||
|
||||
import org.apache.xmpbox.XMPMetadata;
|
||||
import org.apache.xmpbox.schema.XMPSchema;
|
||||
|
||||
|
||||
@@ -36,14 +36,13 @@ public class ZUGFeRD1PullProvider implements IXMLProvider {
|
||||
private boolean isTest;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* enables the flag to indicate a test invoice in the XML structure
|
||||
*
|
||||
*/
|
||||
public void setTest() {
|
||||
isTest = true;
|
||||
}
|
||||
|
||||
public ZUGFeRD1PullProvider() {
|
||||
// TODO Auto-generated constructor stub
|
||||
try {
|
||||
@@ -102,5 +101,4 @@ public class ZUGFeRD1PullProvider implements IXMLProvider {
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -54,7 +54,6 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
}
|
||||
|
||||
|
||||
|
||||
//// MAIN CLASS
|
||||
|
||||
protected byte[] zugferdData;
|
||||
@@ -63,7 +62,6 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
|
||||
/**
|
||||
* enables the flag to indicate a test invoice in the XML structure
|
||||
*
|
||||
*/
|
||||
public void setTest() {
|
||||
isTest = true;
|
||||
@@ -118,6 +116,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
private String priceFormat(BigDecimal value) {
|
||||
return nDigitFormat(value, 4);
|
||||
}
|
||||
|
||||
private String quantityFormat(BigDecimal value) {
|
||||
return nDigitFormat(value, 4);
|
||||
}
|
||||
@@ -154,8 +153,8 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
* empty for no taxes, or e.g. 19=>190 and 7=>14 if 1000 Eur were applicable
|
||||
* to 19% VAT (=>190 EUR VAT) and 200 EUR were applicable to 7% (=>14 EUR VAT)
|
||||
* 190 Eur
|
||||
* @return which taxes have been used with which amounts in this invoice
|
||||
*
|
||||
* @return which taxes have been used with which amounts in this invoice
|
||||
*/
|
||||
private HashMap<BigDecimal, VATAmount> getVATPercentAmountMap() {
|
||||
HashMap<BigDecimal, VATAmount> hm = new HashMap<BigDecimal, VATAmount>();
|
||||
@@ -201,7 +200,6 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
}
|
||||
|
||||
|
||||
|
||||
String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" //$NON-NLS-1$
|
||||
|
||||
+ "<rsm:CrossIndustryInvoice xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:rsm=\"urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100\""
|
||||
@@ -283,7 +281,6 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
+ " </ram:IncludedSupplyChainTradeLineItem>\n"; //$NON-NLS-1$
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
xml = xml + " <ram:ApplicableHeaderTradeAgreement>\n" //$NON-NLS-1$
|
||||
@@ -354,7 +351,6 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
+ " </ram:SpecifiedTradeSettlementPaymentMeans>\n"; //$NON-NLS-1$
|
||||
|
||||
|
||||
|
||||
HashMap<BigDecimal, VATAmount> VATPercentAmountMap = getVATPercentAmountMap();
|
||||
for (BigDecimal currentTaxPercent : VATPercentAmountMap.keySet()) {
|
||||
VATAmount amount = VATPercentAmountMap.get(currentTaxPercent);
|
||||
@@ -368,7 +364,6 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
+ " </ram:ApplicableTradeTax>\n"; //$NON-NLS-1$
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
/* xml+= "
|
||||
@@ -430,8 +425,6 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
// + " </IncludedSupplyChainTradeLineItem>\n";
|
||||
|
||||
|
||||
|
||||
|
||||
xml = xml + " </rsm:SupplyChainTradeTransaction>\n" //$NON-NLS-1$
|
||||
+ "</rsm:CrossIndustryInvoice>"; //$NON-NLS-1$
|
||||
|
||||
|
||||
@@ -19,6 +19,5 @@
|
||||
package org.mustangproject.ZUGFeRD;
|
||||
|
||||
public enum ZUGFeRDConformanceLevel {
|
||||
BASIC, COMFORT, EXTENDED, EN16931/*=Comfort*/, MINIMUM, BASICWL /*basic without lines, less than basic*/, CIUS
|
||||
;
|
||||
BASIC, COMFORT, EXTENDED, EN16931/*=Comfort*/, MINIMUM, BASICWL /*basic without lines, less than basic*/, CIUS;
|
||||
}
|
||||
|
||||
@@ -65,14 +65,13 @@ public class ZUGFeRDExporter implements Closeable {
|
||||
* ze.PDFmakeA3compliant(doc, "Your application name",
|
||||
* System.getProperty("user.name"), true); ze.PDFattachZugferdFile(doc,
|
||||
* yourTransaction);
|
||||
*
|
||||
* <p/>
|
||||
* doc.save(PDFfilename);
|
||||
*
|
||||
* @author jstaerk
|
||||
* @deprecated Use the factory methods {@link #createFromPDFA3(String)},
|
||||
* {@link #createFromPDFA3(InputStream)} or the
|
||||
* {@link ZUGFeRDExporterFromA1Factory} instead
|
||||
*
|
||||
*/
|
||||
// // MAIN CLASS
|
||||
@Deprecated
|
||||
@@ -92,11 +91,17 @@ public class ZUGFeRDExporter implements Closeable {
|
||||
protected PDMetadata metadata = null;
|
||||
protected PDFAIdentificationSchema pdfaid = null;
|
||||
protected XMPMetadata xmp = null;
|
||||
/** Producer attribute for PDF */
|
||||
/**
|
||||
* Producer attribute for PDF
|
||||
*/
|
||||
protected String producer = "mustangproject";
|
||||
/** Author/Creator attribute for PDF for PDF */
|
||||
/**
|
||||
* Author/Creator attribute for PDF for PDF
|
||||
*/
|
||||
protected String creator = "mustangproject";
|
||||
/** CreatorTool */
|
||||
/**
|
||||
* CreatorTool
|
||||
*/
|
||||
protected String creatorTool = "mustangproject";
|
||||
|
||||
@Deprecated
|
||||
@@ -187,14 +192,14 @@ public class ZUGFeRDExporter implements Closeable {
|
||||
|
||||
/**
|
||||
* All files are PDF/A-3, setConformance refers to the level conformance.
|
||||
*
|
||||
* <p/>
|
||||
* PDF/A-3 has three conformance levels, called "A", "U" and "B".
|
||||
*
|
||||
* <p/>
|
||||
* PDF/A-3-B where B means only visually preservable, U -standard for Mustang-
|
||||
* means visually and unicode preservable and A means full compliance, i.e.
|
||||
* visually, unicode and structurally preservable and tagged PDF, i.e. useful
|
||||
* metainformation for blind people.
|
||||
*
|
||||
* <p/>
|
||||
* Feel free to pass "A" as new level if you know what you are doing :-)
|
||||
*
|
||||
* @deprecated Use {@link ZUGFeRDExporterFromA1Factory} instead
|
||||
@@ -209,14 +214,14 @@ public class ZUGFeRDExporter implements Closeable {
|
||||
|
||||
/**
|
||||
* All files are PDF/A-3, setConformance refers to the level conformance.
|
||||
*
|
||||
* <p/>
|
||||
* PDF/A-3 has three conformance levels, called "A", "U" and "B".
|
||||
*
|
||||
* <p/>
|
||||
* PDF/A-3-B where B means only visually preservable, U -standard for Mustang-
|
||||
* means visually and unicode preservable and A means full compliance, i.e.
|
||||
* visually, unicode and structurally preservable and tagged PDF, i.e. useful
|
||||
* metainformation for blind people.
|
||||
*
|
||||
* <p/>
|
||||
* Feel free to pass "A" as new level if you know what you are doing :-)
|
||||
*
|
||||
* @deprecated Use
|
||||
@@ -230,7 +235,6 @@ public class ZUGFeRDExporter implements Closeable {
|
||||
|
||||
/**
|
||||
* enables the flag to indicate a test invoice in the XML structure
|
||||
*
|
||||
*/
|
||||
public void setTest() {
|
||||
xmlProvider.setTest();
|
||||
@@ -274,7 +278,6 @@ public class ZUGFeRDExporter implements Closeable {
|
||||
* metadata level, this will not e.g. convert graphics to JPG-2000)
|
||||
*
|
||||
* @deprecated use the {@link ZUGFeRDExporterFromA1Factory} instead
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
public PDDocumentCatalog PDFmakeA3compliant(String filename, String producer, String creator,
|
||||
@@ -315,8 +318,7 @@ public class ZUGFeRDExporter implements Closeable {
|
||||
/**
|
||||
* Embeds the Zugferd XML structure in a file named ZUGFeRD-invoice.xml.
|
||||
*
|
||||
* @param trans
|
||||
* a IZUGFeRDExportableTransaction that provides the data-model to
|
||||
* @param trans a IZUGFeRDExportableTransaction that provides the data-model to
|
||||
* populate the XML. This parameter may be null, if so the XML data
|
||||
* should hav ebeen set via
|
||||
* <code>setZUGFeRDXMLData(byte[] zugferdData)</code>
|
||||
@@ -362,18 +364,12 @@ public class ZUGFeRDExporter implements Closeable {
|
||||
/**
|
||||
* Embeds an external file (generic - any type allowed) in the PDF.
|
||||
*
|
||||
* @param doc
|
||||
* PDDocument to attach the file to.
|
||||
* @param filename
|
||||
* name of the file that will become attachment name in the PDF
|
||||
* @param relationship
|
||||
* how the file relates to the content, e.g. "Alternative"
|
||||
* @param description
|
||||
* Human-readable description of the file content
|
||||
* @param subType
|
||||
* type of the data e.g. could be "text/xml" - mime like
|
||||
* @param data
|
||||
* the binary data of the file/attachment
|
||||
* @param doc PDDocument to attach the file to.
|
||||
* @param filename name of the file that will become attachment name in the PDF
|
||||
* @param relationship how the file relates to the content, e.g. "Alternative"
|
||||
* @param description Human-readable description of the file content
|
||||
* @param subType type of the data e.g. could be "text/xml" - mime like
|
||||
* @param data the binary data of the file/attachment
|
||||
* @throws java.io.IOException
|
||||
*/
|
||||
public void PDFAttachGenericFile(PDDocument doc, String filename, String relationship, String description,
|
||||
@@ -443,8 +439,7 @@ public class ZUGFeRDExporter implements Closeable {
|
||||
* useful for use-cases where the XML has already been produced by some external
|
||||
* API or component.
|
||||
*
|
||||
* @param zugferdData
|
||||
* XML data to be set as a byte array (XML file in raw form).
|
||||
* @param zugferdData XML data to be set as a byte array (XML file in raw form).
|
||||
*/
|
||||
public void setZUGFeRDXMLData(byte[] zugferdData) throws IOException {
|
||||
CustomXMLProvider cus = new CustomXMLProvider();
|
||||
@@ -457,9 +452,7 @@ public class ZUGFeRDExporter implements Closeable {
|
||||
/**
|
||||
* Sets the ZUGFeRD conformance level (override).
|
||||
*
|
||||
* @param zUGFeRDConformanceLevel
|
||||
* the new conformance level
|
||||
*
|
||||
* @param zUGFeRDConformanceLevel the new conformance level
|
||||
* @deprecated Use {@link ZUGFeRDExporterFromA1Factory} instead
|
||||
*/
|
||||
@Deprecated
|
||||
@@ -473,9 +466,7 @@ public class ZUGFeRDExporter implements Closeable {
|
||||
/**
|
||||
* Sets the ZUGFeRD conformance level (override).
|
||||
*
|
||||
* @param zUGFeRDConformanceLevel
|
||||
* the new conformance level
|
||||
*
|
||||
* @param zUGFeRDConformanceLevel the new conformance level
|
||||
* @deprecated Use {@link #setConformanceLevel(PDFAConformanceLevel)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
@@ -483,7 +474,8 @@ public class ZUGFeRDExporter implements Closeable {
|
||||
this.profile = ZUGFeRDConformanceLevel.valueOf(zUGFeRDConformanceLevel);
|
||||
}
|
||||
|
||||
/****
|
||||
/**
|
||||
* *
|
||||
* Returns the PDFBox PDF Document
|
||||
*
|
||||
* @return PDDocument the PDFBox PDF
|
||||
@@ -593,7 +585,6 @@ public class ZUGFeRDExporter implements Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return if pdf file will be automatically closed after adding ZF
|
||||
*/
|
||||
public boolean isAutoCloseDisabled() {
|
||||
@@ -601,7 +592,6 @@ public class ZUGFeRDExporter implements Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param disableAutoClose prevent PDF file from being closed after adding ZF
|
||||
*/
|
||||
public void disableAutoClose(boolean disableAutoClose) {
|
||||
@@ -610,14 +600,17 @@ public class ZUGFeRDExporter implements Closeable {
|
||||
|
||||
/**
|
||||
* the human author (use factory method instead)
|
||||
*
|
||||
* @param creator
|
||||
*/
|
||||
@Deprecated
|
||||
public void setCreator(String creator) {
|
||||
this.creator = creator;
|
||||
}
|
||||
|
||||
/**
|
||||
* the CreatorTool attribute for the PDF
|
||||
*
|
||||
* @param creator
|
||||
*/
|
||||
protected void setCreatorTool(String creatorTool) {
|
||||
@@ -626,6 +619,7 @@ public class ZUGFeRDExporter implements Closeable {
|
||||
|
||||
/**
|
||||
* the authoring software (use factory method instead)
|
||||
*
|
||||
* @param producer
|
||||
*/
|
||||
@Deprecated
|
||||
@@ -634,7 +628,6 @@ public class ZUGFeRDExporter implements Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param ensurePDFisUpgraded if not set the PDF/A won't be relabelled A/3, e.g. if it already is one
|
||||
*/
|
||||
public void setPDFA3(boolean ensurePDFisUpgraded) {
|
||||
@@ -642,7 +635,6 @@ public class ZUGFeRDExporter implements Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param attachZUGFeRDHeaders if false the ZUGFeRD XMP metadata won't be added, e.g. if it's not the first file
|
||||
*/
|
||||
public void setAttachZUGFeRDHeaders(boolean attachZUGFeRDHeaders) {
|
||||
|
||||
@@ -34,11 +34,17 @@ public class ZUGFeRDExporterFromA3Factory implements IExporterFactory {
|
||||
protected boolean ignorePDFAErrors = false;
|
||||
protected ZUGFeRDConformanceLevel zugferdConformanceLevel = ZUGFeRDConformanceLevel.EXTENDED;
|
||||
protected PDFAConformanceLevel conformanceLevel = PDFAConformanceLevel.UNICODE;
|
||||
/** Producer (attribute for PDF */
|
||||
/**
|
||||
* Producer (attribute for PDF
|
||||
*/
|
||||
protected String producer = "mustangproject";
|
||||
/** Human creator (attribute for PDF) */
|
||||
/**
|
||||
* Human creator (attribute for PDF)
|
||||
*/
|
||||
protected String creator = "mustangproject";
|
||||
/** Creator tool (attribute for PDF) */
|
||||
/**
|
||||
* Creator tool (attribute for PDF)
|
||||
*/
|
||||
protected String creatorTool = null;
|
||||
|
||||
private HashMap<String, byte[]> additionalXMLs = new HashMap<String, byte[]>();
|
||||
@@ -47,12 +53,12 @@ public class ZUGFeRDExporterFromA3Factory implements IExporterFactory {
|
||||
protected int ZFVersion = ZUGFeRDExporter.DefaultZUGFeRDVersion;
|
||||
protected boolean ensurePDFisUpgraded = false;
|
||||
private boolean attachZUGFeRDHeaders = true;
|
||||
|
||||
/**
|
||||
* Makes A PDF/A3a-compliant document from a PDF-A1 compliant document (on the
|
||||
* metadata level, this will not e.g. convert graphics to JPG-2000)
|
||||
*
|
||||
* @param pdfFilename
|
||||
* filename of an PDF/A1 compliant document
|
||||
* @param pdfFilename filename of an PDF/A1 compliant document
|
||||
*/
|
||||
public ZUGFeRDExporter load(String pdfFilename) throws IOException {
|
||||
|
||||
@@ -74,13 +80,11 @@ public class ZUGFeRDExporterFromA3Factory implements IExporterFactory {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Makes A PDF/A3a-compliant document from a PDF-A1 compliant document (on the
|
||||
* metadata level, this will not e.g. convert graphics to JPG-2000)
|
||||
*
|
||||
* @param pdfBinary
|
||||
* binary of a PDF/A1 compliant document
|
||||
* @param pdfBinary binary of a PDF/A1 compliant document
|
||||
*/
|
||||
public ZUGFeRDExporter load(byte[] pdfBinary) throws IOException {
|
||||
ensurePDFIsValidPDFA(new ByteArrayDataSource(new ByteArrayInputStream(pdfBinary)));
|
||||
@@ -106,8 +110,7 @@ public class ZUGFeRDExporterFromA3Factory implements IExporterFactory {
|
||||
* Makes A PDF/A3a-compliant document from a PDF-A1 compliant document (on the
|
||||
* metadata level, this will not e.g. convert graphics to JPG-2000)
|
||||
*
|
||||
* @param pdfSource
|
||||
* source to read a PDF/A1 compliant document from
|
||||
* @param pdfSource source to read a PDF/A1 compliant document from
|
||||
*/
|
||||
public ZUGFeRDExporter load(InputStream pdfSource) throws IOException {
|
||||
return load(readAllBytes(pdfSource));
|
||||
@@ -124,6 +127,7 @@ public class ZUGFeRDExporterFromA3Factory implements IExporterFactory {
|
||||
IOUtils.copy(in, buffer);
|
||||
return buffer.toByteArray();
|
||||
}
|
||||
|
||||
private static boolean isValidA1(DataSource dataSource) throws IOException {
|
||||
return getPDFAParserValidationResult(new PreflightParser(dataSource));
|
||||
}
|
||||
@@ -131,8 +135,7 @@ public class ZUGFeRDExporterFromA3Factory implements IExporterFactory {
|
||||
/**
|
||||
* Sets the ZUGFeRD conformance level (override).
|
||||
*
|
||||
* @param zugferdConformanceLevel
|
||||
* the new conformance level
|
||||
* @param zugferdConformanceLevel the new conformance level
|
||||
*/
|
||||
public IExporterFactory setZUGFeRDConformanceLevel(ZUGFeRDConformanceLevel zugferdConformanceLevel) {
|
||||
this.zugferdConformanceLevel = zugferdConformanceLevel;
|
||||
@@ -170,17 +173,15 @@ public class ZUGFeRDExporterFromA3Factory implements IExporterFactory {
|
||||
|
||||
/**
|
||||
* All files are PDF/A-3, setConformance refers to the level conformance.
|
||||
*
|
||||
* <p/>
|
||||
* PDF/A-3 has three coformance levels, called "A", "U" and "B".
|
||||
*
|
||||
* <p/>
|
||||
* PDF/A-3-B where B means only visually preservable, U -standard for Mustang-
|
||||
* means visually and unicode preservable and A means full compliance, i.e.
|
||||
* visually, unicode and structurally preservable and tagged PDF, i.e. useful
|
||||
* metainformation for blind people.
|
||||
*
|
||||
* <p/>
|
||||
* Feel free to pass "A" as new level if you know what you are doing :-)
|
||||
*
|
||||
*
|
||||
*/
|
||||
public IExporterFactory setConformanceLevel(PDFAConformanceLevel newLevel) {
|
||||
conformanceLevel = newLevel;
|
||||
@@ -207,6 +208,7 @@ public class ZUGFeRDExporterFromA3Factory implements IExporterFactory {
|
||||
this.producer = producer;
|
||||
return this;
|
||||
}
|
||||
|
||||
public IExporterFactory setAttachZUGFeRDHeaders(boolean attachHeaders) {
|
||||
this.attachZUGFeRDHeaders = attachHeaders;
|
||||
return this;
|
||||
|
||||
@@ -55,9 +55,13 @@ public class ZUGFeRDImporter {
|
||||
*
|
||||
*/
|
||||
|
||||
/** @var if metadata has been found */
|
||||
/**
|
||||
* @var if metadata has been found
|
||||
*/
|
||||
private boolean containsMeta = false;
|
||||
/** @var the reference (i.e. invoice number) of the sender */
|
||||
/**
|
||||
* @var the reference (i.e. invoice number) of the sender
|
||||
*/
|
||||
private String foreignReference;
|
||||
private String BLZ;
|
||||
private String BIC;
|
||||
@@ -67,7 +71,9 @@ public class ZUGFeRDImporter {
|
||||
private String amount;
|
||||
private String dueDate;
|
||||
private HashMap<String, byte[]> additionalXMLs = new HashMap<String, byte[]>();
|
||||
/** Raw XML form of the extracted data - may be directly obtained. */
|
||||
/**
|
||||
* Raw XML form of the extracted data - may be directly obtained.
|
||||
*/
|
||||
private byte[] rawXML = null;
|
||||
private String bankName;
|
||||
private boolean amountFound;
|
||||
@@ -80,8 +86,7 @@ public class ZUGFeRDImporter {
|
||||
* Extracts a ZUGFeRD invoice from a PDF document represented by a file name.
|
||||
* Errors are just logged to STDOUT.
|
||||
*
|
||||
* @param pdfFilename
|
||||
* the filename of the pdf
|
||||
* @param pdfFilename the filename of the pdf
|
||||
*/
|
||||
public void extract(String pdfFilename) {
|
||||
try {
|
||||
@@ -101,8 +106,9 @@ public class ZUGFeRDImporter {
|
||||
return s.hasNext() ? s.next() : "";
|
||||
}
|
||||
|
||||
/***
|
||||
/**
|
||||
* get xmp metadata of the PDF, null if not available
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public String getXMP() {
|
||||
@@ -113,8 +119,7 @@ public class ZUGFeRDImporter {
|
||||
* Extracts a ZUGFeRD invoice from a PDF document represented by an input
|
||||
* stream. Errors are reported via exception handling.
|
||||
*
|
||||
* @param pdfStream
|
||||
* a inputstream of a pdf file
|
||||
* @param pdfStream a inputstream of a pdf file
|
||||
*/
|
||||
public void extractLowLevel(InputStream pdfStream) throws IOException {
|
||||
PDEmbeddedFilesNameTreeNode etn;
|
||||
@@ -372,7 +377,6 @@ public class ZUGFeRDImporter {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return if export found parseable ZUGFeRD data
|
||||
*/
|
||||
public boolean containsMeta() {
|
||||
@@ -380,7 +384,6 @@ public class ZUGFeRDImporter {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the reference (purpose) the sender specified for this invoice
|
||||
*/
|
||||
public String getForeignReference() {
|
||||
@@ -398,7 +401,6 @@ public class ZUGFeRDImporter {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the sender's bank's BLZ code
|
||||
*/
|
||||
public String getBLZ() {
|
||||
@@ -416,7 +418,6 @@ public class ZUGFeRDImporter {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the sender's bank's BIC code
|
||||
*/
|
||||
public String getBIC() {
|
||||
@@ -442,7 +443,6 @@ public class ZUGFeRDImporter {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the sender's IBAN
|
||||
*/
|
||||
public String getIBAN() {
|
||||
@@ -456,7 +456,6 @@ public class ZUGFeRDImporter {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the sender's KTO
|
||||
*/
|
||||
public String getKTO() {
|
||||
@@ -470,7 +469,6 @@ public class ZUGFeRDImporter {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the sender's bank name
|
||||
*/
|
||||
public String getBankName() {
|
||||
@@ -492,7 +490,6 @@ public class ZUGFeRDImporter {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the name of the owner of the sender's bank account
|
||||
*/
|
||||
public String getHolder() {
|
||||
@@ -510,7 +507,6 @@ public class ZUGFeRDImporter {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the total payable amount
|
||||
*/
|
||||
public String getAmount() {
|
||||
@@ -524,7 +520,6 @@ public class ZUGFeRDImporter {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return when the payment is due
|
||||
*/
|
||||
public String getDueDate() {
|
||||
@@ -542,16 +537,13 @@ public class ZUGFeRDImporter {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param meta
|
||||
* raw XML to be set
|
||||
* @param meta raw XML to be set
|
||||
*/
|
||||
public void setMeta(String meta) {
|
||||
this.rawXML = meta.getBytes();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return raw XML of the invoice
|
||||
*/
|
||||
public String getMeta() {
|
||||
@@ -564,7 +556,6 @@ public class ZUGFeRDImporter {
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @return return UTF8 XML (without BOM) of the invoice
|
||||
*/
|
||||
public String getUTF8() {
|
||||
|
||||
@@ -844,7 +844,6 @@ class ZUGFeRDTransactionModelConverter {
|
||||
* 190 Eur
|
||||
*
|
||||
* @return HashMap<BigDecimal, VATAmount> which taxes have been used with which amounts
|
||||
*
|
||||
*/
|
||||
private HashMap<BigDecimal, VATAmount> getVATPercentAmountMap() {
|
||||
return getVATPercentAmountMap(false);
|
||||
|
||||
@@ -30,11 +30,12 @@ public class FileTraverser extends SimpleFileVisitor<Path> {
|
||||
|
||||
|
||||
private StatRun thisRun;
|
||||
|
||||
public FileTraverser(StatRun statistics) {
|
||||
this.thisRun = statistics;
|
||||
}
|
||||
|
||||
/***
|
||||
/**
|
||||
* check each file
|
||||
*/
|
||||
@Override
|
||||
@@ -51,7 +52,7 @@ public class FileTraverser extends SimpleFileVisitor<Path> {
|
||||
return CONTINUE;
|
||||
}
|
||||
|
||||
/***
|
||||
/**
|
||||
* for each directory
|
||||
*/
|
||||
@Override
|
||||
@@ -62,7 +63,7 @@ public class FileTraverser extends SimpleFileVisitor<Path> {
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
/**
|
||||
* show errors like file permission stacktraces
|
||||
*/
|
||||
@Override
|
||||
|
||||
@@ -32,6 +32,7 @@ public class StatRun {
|
||||
public boolean shallIgnoreFileExt() {
|
||||
return !checkFileExt;
|
||||
}
|
||||
|
||||
public void incFileCount() {
|
||||
fileCount++;
|
||||
}
|
||||
@@ -64,8 +65,9 @@ public class StatRun {
|
||||
return dirCount;
|
||||
}
|
||||
|
||||
/***
|
||||
/**
|
||||
* returns final statistics
|
||||
*
|
||||
* @return english string with linefeeds detailling number of files, directories, number of pdfs and of zugferd files
|
||||
*/
|
||||
public String getSummaryLine() {
|
||||
@@ -75,8 +77,10 @@ public class StatRun {
|
||||
getFileCount(), getDirCount(), getPDFCount(), getZUGFeRDCount());
|
||||
|
||||
}
|
||||
/***
|
||||
|
||||
/**
|
||||
* show that something is happening
|
||||
*
|
||||
* @return String, usually a dot
|
||||
*/
|
||||
public String getOutputLine() {
|
||||
|
||||
@@ -108,19 +108,15 @@ public class Toecount {
|
||||
+ "\t\t\tFor ZUGFeRD v2: <M>INIMUM, BASIC <W>L, <B>ASIC, <C>IUS, <E>N16931, E<X>TENDED\r\n");
|
||||
}
|
||||
|
||||
/***
|
||||
/**
|
||||
* Asks the user (repeatedly, if neccessary) on the command line for a String
|
||||
* (offering a defaultValue) conforming to a Regex pattern
|
||||
*
|
||||
* @param prompt
|
||||
* the question to be asked to the user
|
||||
* @param defaultValue
|
||||
* the default return value if user hits enter
|
||||
* @param pattern
|
||||
* a regex of acceptable values
|
||||
* @param prompt the question to be asked to the user
|
||||
* @param defaultValue the default return value if user hits enter
|
||||
* @param pattern a regex of acceptable values
|
||||
* @return the user answer conforming to pattern
|
||||
* @throws Exception
|
||||
* if pattern not compielable or IOexception on input
|
||||
* @throws Exception if pattern not compielable or IOexception on input
|
||||
*/
|
||||
protected static String getStringFromUser(String prompt, String defaultValue, String pattern) throws Exception {
|
||||
String input = "";
|
||||
@@ -156,20 +152,14 @@ public class Toecount {
|
||||
return input;
|
||||
}
|
||||
|
||||
/***
|
||||
/**
|
||||
* Prompts the user for a input or output filename
|
||||
*
|
||||
* @param the
|
||||
* text the user is asked
|
||||
* @param a
|
||||
* default Filename
|
||||
* @param expectedExtension
|
||||
* will warn if filename does not match expected file extension
|
||||
* @param ensureFileExists
|
||||
* will warn if file does NOT exist (for input files)
|
||||
* @param ensureFileNotExists
|
||||
* will warn if file DOES exist (for output files)
|
||||
*
|
||||
* @param the text the user is asked
|
||||
* @param a default Filename
|
||||
* @param expectedExtension will warn if filename does not match expected file extension
|
||||
* @param ensureFileExists will warn if file does NOT exist (for input files)
|
||||
* @param ensureFileNotExists will warn if file DOES exist (for output files)
|
||||
* @return String
|
||||
*/
|
||||
protected static String getFilenameFromUser(String prompt, String defaultFilename, String expectedExtension,
|
||||
@@ -316,9 +306,7 @@ public class Toecount {
|
||||
|
||||
if (helpRequested) {
|
||||
printHelp();
|
||||
}
|
||||
|
||||
else if (((directoryName != null) && (directoryName.length() > 0)) || filesFromStdIn.booleanValue()) {
|
||||
} else if (((directoryName != null) && (directoryName.length() > 0)) || filesFromStdIn.booleanValue()) {
|
||||
performMetrics(directoryName, filesFromStdIn, ignoreFileExt);
|
||||
} else if (combineRequested) {
|
||||
performCombine(sourceName, sourceXMLName, outName, zugferdVersion, zugferdProfile);
|
||||
|
||||
@@ -34,8 +34,7 @@ public class MustangReaderWriterCustomXMLTest extends TestCase {
|
||||
/**
|
||||
* Create the test case
|
||||
*
|
||||
* @param testName
|
||||
* name of the test case
|
||||
* @param testName name of the test case
|
||||
*/
|
||||
public MustangReaderWriterCustomXMLTest(String testName) {
|
||||
super(testName);
|
||||
@@ -304,6 +303,7 @@ public class MustangReaderWriterCustomXMLTest extends TestCase {
|
||||
assertEquals(holder, "Bei Spiel GmbH");
|
||||
assertEquals(ref, "RE-20171118/506");
|
||||
}
|
||||
|
||||
/**
|
||||
* The exporter test bases on @{code
|
||||
* ./src/test/MustangGnuaccountingBeispielRE-20140703_502blanko.pdf}, adds
|
||||
|
||||
@@ -33,127 +33,106 @@ import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
public class MustangReaderWriterEdgeTest extends TestCase implements IZUGFeRDExportableTransaction
|
||||
{
|
||||
public class MustangReaderWriterEdgeTest extends TestCase implements IZUGFeRDExportableTransaction {
|
||||
|
||||
@Override
|
||||
public Date getDeliveryDate()
|
||||
{
|
||||
public Date getDeliveryDate() {
|
||||
return new GregorianCalendar(2017, Calendar.MAY, 7).getTime();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getDueDate()
|
||||
{
|
||||
public Date getDueDate() {
|
||||
return new GregorianCalendar(2017, Calendar.MAY, 30).getTime();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getIssueDate()
|
||||
{
|
||||
public Date getIssueDate() {
|
||||
return new GregorianCalendar(2017, Calendar.MAY, 9).getTime();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNumber()
|
||||
{
|
||||
public String getNumber() {
|
||||
return "RE-20170509/505";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOwnKto()
|
||||
{
|
||||
public String getOwnKto() {
|
||||
return "44421800";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOwnBLZ()
|
||||
{
|
||||
public String getOwnBLZ() {
|
||||
return "41441604";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOwnBIC()
|
||||
{
|
||||
public String getOwnBIC() {
|
||||
return "COBADEFFXXX";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOwnBankName()
|
||||
{
|
||||
public String getOwnBankName() {
|
||||
return "Commerzbank";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOwnCountry()
|
||||
{
|
||||
public String getOwnCountry() {
|
||||
return "DE";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOwnIBAN()
|
||||
{
|
||||
public String getOwnIBAN() {
|
||||
return "DE88 2008 0000 0970 3757 00";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOwnLocation()
|
||||
{
|
||||
public String getOwnLocation() {
|
||||
return "Stadthausen";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOwnOrganisationName()
|
||||
{
|
||||
public String getOwnOrganisationName() {
|
||||
return "Bei Spiel GmbH";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOwnStreet()
|
||||
{
|
||||
public String getOwnStreet() {
|
||||
return "Ecke 12";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOwnTaxID()
|
||||
{
|
||||
public String getOwnTaxID() {
|
||||
return "22/815/0815/4";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOwnVATID()
|
||||
{
|
||||
public String getOwnVATID() {
|
||||
return "DE136695976";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOwnZIP()
|
||||
{
|
||||
public String getOwnZIP() {
|
||||
return "12345";
|
||||
}
|
||||
|
||||
@Override
|
||||
public IZUGFeRDExportableContact getRecipient()
|
||||
{
|
||||
public IZUGFeRDExportableContact getRecipient() {
|
||||
return new Contact();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getOwnOrganisationFullPlaintextInfo()
|
||||
{
|
||||
public String getOwnOrganisationFullPlaintextInfo() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCurrency()
|
||||
{
|
||||
public String getCurrency() {
|
||||
return "EUR";
|
||||
}
|
||||
|
||||
@Override
|
||||
public IZUGFeRDExportableItem[] getZFItems()
|
||||
{
|
||||
public IZUGFeRDExportableItem[] getZFItems() {
|
||||
Item[] allItems = new Item[3];
|
||||
Product designProduct = new Product("", "Künstlerische Gestaltung (Stunde): Einer Beispielrechnung", "HUR", new BigDecimal("7.000000"));
|
||||
Product balloonProduct = new Product("", "Luftballon: Bunt, ca. 500ml", "C62", new BigDecimal("19.000000"));
|
||||
@@ -196,51 +175,42 @@ public class MustangReaderWriterEdgeTest extends TestCase implements IZUGFeRDExp
|
||||
return null;
|
||||
}
|
||||
|
||||
class Contact implements IZUGFeRDExportableContact
|
||||
{
|
||||
class Contact implements IZUGFeRDExportableContact {
|
||||
|
||||
@Override
|
||||
public String getCountry()
|
||||
{
|
||||
public String getCountry() {
|
||||
return "DE";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocation()
|
||||
{
|
||||
public String getLocation() {
|
||||
return "Spielkreis";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
public String getName() {
|
||||
return "Theodor Est";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStreet()
|
||||
{
|
||||
public String getStreet() {
|
||||
return "Bahnstr. 42";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVATID()
|
||||
{
|
||||
public String getVATID() {
|
||||
return "DE999999999";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getZIP()
|
||||
{
|
||||
public String getZIP() {
|
||||
return "88802";
|
||||
}
|
||||
}
|
||||
|
||||
class Item implements IZUGFeRDExportableItem
|
||||
{
|
||||
class Item implements IZUGFeRDExportableItem {
|
||||
|
||||
public Item(BigDecimal price, BigDecimal quantity, Product product)
|
||||
{
|
||||
public Item(BigDecimal price, BigDecimal quantity, Product product) {
|
||||
super();
|
||||
this.price = price;
|
||||
this.quantity = quantity;
|
||||
@@ -251,35 +221,29 @@ public class MustangReaderWriterEdgeTest extends TestCase implements IZUGFeRDExp
|
||||
private Product product;
|
||||
|
||||
@Override
|
||||
public BigDecimal getPrice()
|
||||
{
|
||||
public BigDecimal getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(BigDecimal price)
|
||||
{
|
||||
public void setPrice(BigDecimal price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal getQuantity()
|
||||
{
|
||||
public BigDecimal getQuantity() {
|
||||
return quantity;
|
||||
}
|
||||
|
||||
public void setQuantity(BigDecimal quantity)
|
||||
{
|
||||
public void setQuantity(BigDecimal quantity) {
|
||||
this.quantity = quantity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Product getProduct()
|
||||
{
|
||||
public Product getProduct() {
|
||||
return product;
|
||||
}
|
||||
|
||||
public void setProduct(Product product)
|
||||
{
|
||||
public void setProduct(Product product) {
|
||||
this.product = product;
|
||||
}
|
||||
|
||||
@@ -295,13 +259,11 @@ public class MustangReaderWriterEdgeTest extends TestCase implements IZUGFeRDExp
|
||||
|
||||
}
|
||||
|
||||
class Product implements IZUGFeRDExportableProduct
|
||||
{
|
||||
class Product implements IZUGFeRDExportableProduct {
|
||||
private String description, name, unit;
|
||||
private BigDecimal VATPercent;
|
||||
|
||||
public Product(String description, String name, String unit, BigDecimal VATPercent)
|
||||
{
|
||||
public Product(String description, String name, String unit, BigDecimal VATPercent) {
|
||||
super();
|
||||
this.description = description;
|
||||
this.name = name;
|
||||
@@ -310,46 +272,38 @@ public class MustangReaderWriterEdgeTest extends TestCase implements IZUGFeRDExp
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription()
|
||||
{
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description)
|
||||
{
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name)
|
||||
{
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnit()
|
||||
{
|
||||
public String getUnit() {
|
||||
return unit;
|
||||
}
|
||||
|
||||
public void setUnit(String unit)
|
||||
{
|
||||
public void setUnit(String unit) {
|
||||
this.unit = unit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal getVATPercent()
|
||||
{
|
||||
public BigDecimal getVATPercent() {
|
||||
return VATPercent;
|
||||
}
|
||||
|
||||
public void setVATPercent(BigDecimal vATPercent)
|
||||
{
|
||||
public void setVATPercent(BigDecimal vATPercent) {
|
||||
VATPercent = vATPercent;
|
||||
}
|
||||
|
||||
@@ -358,19 +312,16 @@ public class MustangReaderWriterEdgeTest extends TestCase implements IZUGFeRDExp
|
||||
/**
|
||||
* Create the test case
|
||||
*
|
||||
* @param testName
|
||||
* name of the test case
|
||||
* @param testName name of the test case
|
||||
*/
|
||||
public MustangReaderWriterEdgeTest(String testName)
|
||||
{
|
||||
public MustangReaderWriterEdgeTest(String testName) {
|
||||
super(testName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the suite of tests being tested
|
||||
*/
|
||||
public static Test suite()
|
||||
{
|
||||
public static Test suite() {
|
||||
return new TestSuite(MustangReaderWriterEdgeTest.class);
|
||||
}
|
||||
|
||||
@@ -384,8 +335,7 @@ public class MustangReaderWriterEdgeTest extends TestCase implements IZUGFeRDExp
|
||||
* @throws IOException
|
||||
*/
|
||||
|
||||
public void testAImport() throws IOException
|
||||
{
|
||||
public void testAImport() throws IOException {
|
||||
ZUGFeRDImporter zi = new ZUGFeRDImporter();
|
||||
zi.extractLowLevel(this.getClass().getResourceAsStream("/MustangGnuaccountingBeispielRE-20170509_505.pdf"));
|
||||
// Reading ZUGFeRD
|
||||
@@ -399,8 +349,7 @@ public class MustangReaderWriterEdgeTest extends TestCase implements IZUGFeRDExp
|
||||
String ref = null;
|
||||
String dueDate = null;
|
||||
|
||||
if (zi.canParse())
|
||||
{
|
||||
if (zi.canParse()) {
|
||||
zi.parse();
|
||||
amount = zi.getAmount();
|
||||
bic = zi.getBIC();
|
||||
@@ -464,8 +413,7 @@ public class MustangReaderWriterEdgeTest extends TestCase implements IZUGFeRDExp
|
||||
String holder = null;
|
||||
String ref = null;
|
||||
|
||||
if (zi.canParse())
|
||||
{
|
||||
if (zi.canParse()) {
|
||||
zi.parse();
|
||||
amount = zi.getAmount();
|
||||
bic = zi.getBIC();
|
||||
|
||||
@@ -320,8 +320,7 @@ public class MustangReaderWriterTest extends TestCase implements IZUGFeRDExporta
|
||||
/**
|
||||
* Create the test case
|
||||
*
|
||||
* @param testName
|
||||
* name of the test case
|
||||
* @param testName name of the test case
|
||||
*/
|
||||
public MustangReaderWriterTest(String testName) {
|
||||
super(testName);
|
||||
@@ -476,7 +475,6 @@ public class MustangReaderWriterTest extends TestCase implements IZUGFeRDExporta
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void testMigratePDFA1ToA3() throws IOException {
|
||||
// just make sure there is no Exception
|
||||
InputStream SOURCE_PDF = this.getClass()
|
||||
@@ -554,8 +552,8 @@ public class MustangReaderWriterTest extends TestCase implements IZUGFeRDExporta
|
||||
}
|
||||
|
||||
/**
|
||||
* @Test(expected = IndexOutOfBoundsException.class)
|
||||
* @throws Exception
|
||||
* @Test(expected = IndexOutOfBoundsException.class)
|
||||
*/
|
||||
public void testExceptionOnPDF14() throws Exception {
|
||||
|
||||
|
||||
@@ -26,18 +26,23 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
|
||||
|
||||
/** This test utility class is providing usability functions for test file resources */
|
||||
/**
|
||||
* This test utility class is providing usability functions for test file resources
|
||||
*/
|
||||
public class ResourceUtilities {
|
||||
private static final Logger LOG = Logger.getLogger(ResourceUtilities.class.getName());
|
||||
|
||||
/** Loading a File into a String using a certain encoding and file path */
|
||||
/**
|
||||
* Loading a File into a String using a certain encoding and file path
|
||||
*/
|
||||
public static String readFile(Charset encoding, String path) throws IOException {
|
||||
byte[] content = Files.readAllBytes(Paths.get(path));
|
||||
return new String(content, encoding);
|
||||
}
|
||||
|
||||
/** Saving a String as a file to a certain file path */
|
||||
/**
|
||||
* Saving a String as a file to a certain file path
|
||||
*/
|
||||
public static void saveFile(Charset encoding, String path, String content) throws FileNotFoundException {
|
||||
|
||||
// resources will be released automatically
|
||||
@@ -47,7 +52,9 @@ public class ResourceUtilities {
|
||||
}
|
||||
|
||||
|
||||
/** The relative path of the test file will be resolved and the absolute will be returned
|
||||
/**
|
||||
* The relative path of the test file will be resolved and the absolute will be returned
|
||||
*
|
||||
* @param relativeFilePath Path of the test resource relative to <code>src/test/resource/</code>.
|
||||
* @return the absolute path of the test file
|
||||
* @throws FileNotFoundException If the file could not be found
|
||||
@@ -66,7 +73,9 @@ public class ResourceUtilities {
|
||||
return uri.getPath();
|
||||
}
|
||||
|
||||
/** The relative path of the test file will be resolved and the absolute will be returned
|
||||
/**
|
||||
* The relative path of the test file will be resolved and the absolute will be returned
|
||||
*
|
||||
* @param relativeFilePath Path of the test resource relative to <code>src/test/resource/</code>.
|
||||
* @return the URI created based on the relativeFilePath
|
||||
* @throws URISyntaxException if no URI could be created from the given relative path
|
||||
@@ -77,8 +86,10 @@ public class ResourceUtilities {
|
||||
return new URI(filePath);
|
||||
}
|
||||
|
||||
/** The relative path of the test file will be used to determine an absolute
|
||||
/**
|
||||
* The relative path of the test file will be used to determine an absolute
|
||||
* path to a temporary directory in the output directory.
|
||||
*
|
||||
* @param relativeFilePath Path of the test resource relative to <code>src/test/resource/</code>.
|
||||
* @return absolute path to a test output
|
||||
* @throws IOException if no absolute Path could be created.
|
||||
@@ -89,7 +100,9 @@ public class ResourceUtilities {
|
||||
return tempFile.getAbsolutePath();
|
||||
}
|
||||
|
||||
/** The Input of the test file will be resolved and the absolute will be returned
|
||||
/**
|
||||
* The Input of the test file will be resolved and the absolute will be returned
|
||||
*
|
||||
* @param relativeFilePath Path of the test resource relative to <code>src/test/resource/</code>.
|
||||
* @return the absolute path of the test file
|
||||
*/
|
||||
@@ -97,7 +110,9 @@ public class ResourceUtilities {
|
||||
return ResourceUtilities.class.getClassLoader().getResourceAsStream(relativeFilePath);
|
||||
}
|
||||
|
||||
/** Relative to the test output directory a test file will be returned dependent on the relativeFilePath provided.
|
||||
/**
|
||||
* Relative to the test output directory a test file will be returned dependent on the relativeFilePath provided.
|
||||
*
|
||||
* @param relativeFilePath Path of the test output resource relative to <code>target/test-classes/</code>.
|
||||
* @return the empty <code>File</code> of the test output (to be filled)
|
||||
*/
|
||||
@@ -187,6 +202,7 @@ public class ResourceUtilities {
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
private ResourceUtilities() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ import java.util.logging.Logger;
|
||||
* will be migrated to <code>src/test/resources/migration/output</code>.
|
||||
* If there is a similar named file as test reference <code>src/test/resources/migration/reference</code> a test
|
||||
* will be triggered for every single file.
|
||||
*
|
||||
* <p/>
|
||||
* Note: Any 'ZUGFeRD1' will be exchanged to 'ZUGFeRD2' during migration and adequate reference will be searched for.
|
||||
*/
|
||||
@RunWith(Parameterized.class)
|
||||
@@ -124,7 +124,6 @@ public class VersionMigrationTest {
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static void findLineDiffs(String outXML, String refXML) {
|
||||
Scanner outScanner = new Scanner(outXML);
|
||||
Scanner refScanner = new Scanner(refXML);
|
||||
|
||||
Reference in New Issue
Block a user