corrected possibility to switch to ZF2

This commit is contained in:
Jochen Stärk
2017-11-29 12:14:59 +01:00
parent c72e843e2e
commit 3b63223f9d
5 changed files with 17 additions and 11 deletions

View File

@@ -1,5 +1,6 @@
1.4.1 1.5.0
===== =====
<date>
Now using factory. Export now also possible on OutputStream. Now using factory. Export now also possible on OutputStream.
Further dev improvements: no more need to call PDFattachZugferdFile(null); Further dev improvements: no more need to call PDFattachZugferdFile(null);
toecount now has options to combine documents and upgrade xml file from ZF1 to ZF2 toecount now has options to combine documents and upgrade xml file from ZF1 to ZF2

View File

@@ -31,6 +31,7 @@ public interface IExporterFactory {
public IExporterFactory setCreator(String creator); public IExporterFactory setCreator(String creator);
public IExporterFactory setConformanceLevel(PDFAConformanceLevel newLevel); public IExporterFactory setConformanceLevel(PDFAConformanceLevel newLevel);
public IExporterFactory setProducer(String producer) ; public IExporterFactory setProducer(String producer) ;
public IExporterFactory setZUGFeRDVersion(int version);
public IExporterFactory ignorePDFAErrors(); public IExporterFactory ignorePDFAErrors();
public IExporterFactory setZUGFeRDConformanceLevel(ZUGFeRDConformanceLevel zugferdConformanceLevel); public IExporterFactory setZUGFeRDConformanceLevel(ZUGFeRDConformanceLevel zugferdConformanceLevel);
public IExporterFactory setAttachZUGFeRDHeaders(final boolean attachZugferdHeaders); public IExporterFactory setAttachZUGFeRDHeaders(final boolean attachZugferdHeaders);

View File

@@ -62,10 +62,6 @@ public class ZUGFeRDExporterFromA3Factory implements IExporterFactory {
} }
public void setZUGFeRDversion(int version) {
ZFVersion=version;
}
public void prepareDocument(PDDocument doc) throws IOException { public void prepareDocument(PDDocument doc) throws IOException {
String fullProducer = producer + " (via mustangproject.org " + org.mustangproject.ZUGFeRD.Version.VERSION + ")"; String fullProducer = producer + " (via mustangproject.org " + org.mustangproject.ZUGFeRD.Version.VERSION + ")";
@@ -264,4 +260,11 @@ public class ZUGFeRDExporterFromA3Factory implements IExporterFactory {
this.producer = producer; this.producer = producer;
return this; return this;
} }
@Override
public IExporterFactory setZUGFeRDVersion(int version) {
this.ZFVersion=version;
return this;
}
} }

View File

@@ -192,6 +192,8 @@ public class MustangReaderWriterCustomXMLTest extends TestCase {
zea1.close(); zea1.close();
String pdfContent=baos.toString("UTF-8"); String pdfContent=baos.toString("UTF-8");
assertFalse(pdfContent.indexOf("(via mustangproject.org")==-1); assertFalse(pdfContent.indexOf("(via mustangproject.org")==-1);
assertFalse(pdfContent.indexOf("<zf:ConformanceLevel>BASIC</zf:ConformanceLevel>") == -1);
} catch (IOException e) { } catch (IOException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();

View File

@@ -341,7 +341,7 @@ public class MustangReaderWriterTest extends TestCase implements IZUGFeRDExporta
holder = zi.getHolder(); holder = zi.getHolder();
ref = zi.getForeignReference(); ref = zi.getForeignReference();
} }
// this resembles the data written in MustangReaderWriterCustomXMLTest // this resembles the data written in MustangReaderWriterCustomXMLTest
assertEquals(amount, "571.04"); assertEquals(amount, "571.04");
assertEquals(bic, "COBADEFFXXX"); assertEquals(bic, "COBADEFFXXX");
assertEquals(iban, "DE88 2008 0000 0970 3757 00"); assertEquals(iban, "DE88 2008 0000 0970 3757 00");
@@ -366,8 +366,7 @@ public class MustangReaderWriterTest extends TestCase implements IZUGFeRDExporta
try (InputStream SOURCE_PDF = this.getClass() try (InputStream SOURCE_PDF = this.getClass()
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20171118_506blanko.pdf"); .getResourceAsStream("/MustangGnuaccountingBeispielRE-20171118_506blanko.pdf");
ZUGFeRDExporter ze = new ZUGFeRDExporterFromA1Factory().load(SOURCE_PDF)) { ZUGFeRDExporter ze = new ZUGFeRDExporterFromA1Factory().setZUGFeRDVersion(2).load(SOURCE_PDF)) {
ze.setZUGFeRDVersion(2);
ze.PDFattachZugferdFile(this); ze.PDFattachZugferdFile(this);
ze.disableAutoClose(true); ze.disableAutoClose(true);
@@ -379,8 +378,8 @@ public class MustangReaderWriterTest extends TestCase implements IZUGFeRDExporta
String pdfContent = baos.toString("UTF-8"); String pdfContent = baos.toString("UTF-8");
assertFalse(pdfContent.indexOf("(via mustangproject.org") == -1); assertFalse(pdfContent.indexOf("(via mustangproject.org") == -1);
// check for pdf-a schema extension // check for pdf-a schema extension
assertFalse(pdfContent.indexOf("<fx:DocumentFileName>factur-x.xml</fx:DocumentFileName>")==-1); assertFalse(pdfContent.indexOf("<fx:ConformanceLevel>EXTENDED</fx:ConformanceLevel>") == -1);
assertFalse(pdfContent.indexOf("urn:cen.eu:en16931:2017:compliant:factur-x.eu:1p0:extended")==-1); assertFalse(pdfContent.indexOf("urn:cen.eu:en16931:2017:compliant:factur-x.eu:1p0:extended") == -1);
} }
// now check the contents (like MustangReaderTest) // now check the contents (like MustangReaderTest)