Merge pull request #204 from tweimer/patch-1

Update sample MustangWriter for Mustangproject 2.0.2
This commit is contained in:
Jochen Staerk
2020-11-30 15:20:13 +01:00
committed by GitHub

View File

@@ -6,15 +6,15 @@ import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.GregorianCalendar; import java.util.GregorianCalendar;
import org.mustangproject.ZUGFeRD.IExportableTransaction;
import org.mustangproject.ZUGFeRD.IZUGFeRDAllowanceCharge; import org.mustangproject.ZUGFeRD.IZUGFeRDAllowanceCharge;
import org.mustangproject.ZUGFeRD.IZUGFeRDExportableContact;
import org.mustangproject.ZUGFeRD.IZUGFeRDExportableItem; import org.mustangproject.ZUGFeRD.IZUGFeRDExportableItem;
import org.mustangproject.ZUGFeRD.IZUGFeRDExportableProduct; import org.mustangproject.ZUGFeRD.IZUGFeRDExportableProduct;
import org.mustangproject.ZUGFeRD.IZUGFeRDExportableTransaction; import org.mustangproject.ZUGFeRD.IZUGFeRDExportableTradeParty;
import org.mustangproject.ZUGFeRD.ZUGFeRDExporter; import org.mustangproject.ZUGFeRD.IZUGFeRDExporter;
import org.mustangproject.ZUGFeRD.ZUGFeRDExporterFromA1Factory; import org.mustangproject.ZUGFeRD.ZUGFeRDExporterFromA1;
class Contact implements IZUGFeRDExportableContact { class Contact implements IZUGFeRDExportableTradeParty {
public String getCountry() { public String getCountry() {
return "DE"; return "DE";
@@ -132,16 +132,16 @@ class Product implements IZUGFeRDExportableProduct {
} }
} }
public class MustangWriter implements IZUGFeRDExportableTransaction { public class MustangWriter implements IExportableTransaction {
private void apply() { private void apply() {
try { try {
System.out.println("Reading Blanko-PDF"); System.out.println("Reading Blanko-PDF");
ZUGFeRDExporter ze = new ZUGFeRDExporterFromA1Factory().setProducer("My Application") IZUGFeRDExporter ze = new ZUGFeRDExporterFromA1().setProducer("My Application")
.setCreator(System.getProperty("user.name")) .setCreator(System.getProperty("user.name"))
.load("./MustangGnuaccountingBeispielRE-20170509_505blanko.pdf"); .load("./MustangGnuaccountingBeispielRE-20170509_505blanko.pdf");
System.out.println("Generating and attaching ZUGFeRD-Data"); System.out.println("Generating and attaching ZUGFeRD-Data");
ze.PDFattachZugferdFile(this); ze.setTransaction(this);
System.out.println("Writing ZUGFeRD-PDF"); System.out.println("Writing ZUGFeRD-PDF");
ze.export("./MustangGnuaccountingBeispielRE-20170509_505new.pdf"); ze.export("./MustangGnuaccountingBeispielRE-20170509_505new.pdf");
System.out.println("Done."); System.out.println("Done.");
@@ -238,7 +238,7 @@ public class MustangWriter implements IZUGFeRDExportableTransaction {
return null; return null;
} }
public IZUGFeRDExportableContact getRecipient() { public IZUGFeRDExportableTradeParty getRecipient() {
return new Contact(); return new Contact();
} }