jstaerk
2022-04-24 19:17:24 +02:00
parent 512e80c955
commit ef24a7f95d
6 changed files with 32 additions and 27 deletions

View File

@@ -601,8 +601,10 @@ public class Main {
if (zfProfile == null) { if (zfProfile == null) {
try { try {
if ((format.equals("zf") && (zfIntVersion == 1)) || (format.equals("ox") || (format.equals("dx")))) { if ((format.equals("zf") && (zfIntVersion == 1)) || (format.equals("ox") )) {
zfProfile = getStringFromUser("Profile (b)asic, (c)omfort or ex(t)ended", "t", "B|b|C|c|T|t"); zfProfile = getStringFromUser("Profile (b)asic, (c)omfort or ex(t)ended", "t", "B|b|C|c|T|t");
} else if ( (format.equals("dx"))) {
zfProfile = getStringFromUser("Profile (p)ilot", "p", "P|p");
} else { } else {
zfProfile = getStringFromUser( zfProfile = getStringFromUser(
"Profile [M]INIMUM, BASIC [W]L, [B]ASIC,\n" + "[C]IUS, [E]N16931, EX[T]ENDED or [X]RECHNUNG", "E", "Profile [M]INIMUM, BASIC [W]L, [B]ASIC,\n" + "[C]IUS, [E]N16931, EX[T]ENDED or [X]RECHNUNG", "E",
@@ -627,14 +629,17 @@ public class Main {
throw new Exception("Factur-X is only available in version 1 (roughly corresponding to ZF2)"); throw new Exception("Factur-X is only available in version 1 (roughly corresponding to ZF2)");
} }
if (((format.equals("zf")) && (zfIntVersion == 1))||(format.equals("ox")||(format.equals("dx")))) { EStandard standard=EStandard.facturx;
EStandard standard=EStandard.facturx; if (format.equals("dx")) {
standard=EStandard.deliverx;
zfConformanceLevelProfile = Profiles.getByName(standard, "PILOT", 1);
}
else if (((format.equals("zf")) && (zfIntVersion == 1))||(format.equals("ox"))) {
if (format.equals("ox")) { if (format.equals("ox")) {
standard=EStandard.orderx; standard=EStandard.orderx;
} }
if (format.equals("dx")) {
standard=EStandard.deliverx;
}
if (zfProfile.equals("b")) { if (zfProfile.equals("b")) {
zfConformanceLevelProfile = Profiles.getByName(standard, "BASIC", zfIntVersion); zfConformanceLevelProfile = Profiles.getByName(standard, "BASIC", zfIntVersion);
@@ -681,6 +686,7 @@ public class Main {
ze = new DXExporterFromA1().setProducer("Mustang-cli") ze = new DXExporterFromA1().setProducer("Mustang-cli")
.setZUGFeRDVersion(zfIntVersion) .setZUGFeRDVersion(zfIntVersion)
.setCreator(System.getProperty("user.name")).setProfile(zfConformanceLevelProfile); .setCreator(System.getProperty("user.name")).setProfile(zfConformanceLevelProfile);
if (ignoreInputErrors) { if (ignoreInputErrors) {
((DXExporterFromA1)ze).ignorePDFAErrors(); ((DXExporterFromA1)ze).ignorePDFAErrors();
} }
@@ -704,11 +710,13 @@ public class Main {
} }
ze.setXML(Files.readAllBytes(Paths.get(xmlName))); ze.setXML(Files.readAllBytes(Paths.get(xmlName)));
ze.export(outName); ze.export(outName);
System.out.println("Written to " + outName); System.out.println("Written to " + outName);
} catch (IOException e) { } catch (Exception e) {
LOGGER.error(e.getMessage(), e); LOGGER.error(e.getMessage(), e);
System.err.println(e.getMessage());
} }
} }

View File

@@ -33,10 +33,11 @@ public class CustomXMLProvider implements IXMLProvider {
public void setXML(byte[] newData) { public void setXML(byte[] newData) {
String zf = new String(newData, StandardCharsets.UTF_8); String zf = new String(newData, StandardCharsets.UTF_8);
/** /**
* rsm:CrossIndustry is ZF/FX/XR (CII 2016b) and rsm:SCRDMCCBDACIOMessageStructure is of course Order-X (CIO 2021) * rsm:CrossIndustry is ZF/FX/XR (CII 2016b),rsm:SCRDMCCBDACIOMessageStructure is Order-X (CIO 2021) and
* SCRDMCCBDACIDAMessageStructure is Despatch Advice
*/ */
if ((!zf.contains("rsm:CrossIndustry")) && (!zf.contains("rsm:SCRDMCCBDACIOMessageStructure"))) { if ((!zf.contains("rsm:CrossIndustry")) && (!zf.contains("rsm:SCRDMCCBDACIOMessageStructure")) && (!zf.contains("SCRDMCCBDACIDAMessageStructure"))) {
throw new RuntimeException("ZUGFeRD XML does not contain <rsm:CrossIndustry or <rsm:SCRDMCCBDACIOMessageStructure and can thus not be valid"); throw new RuntimeException("ZUGFeRD XML does not contain <rsm:CrossIndustry, <rsm:SCRDMCCBDACIOMessageStructure or SCRDMCCBDACIDAMessageStructure and can thus not be valid");
} }
zugferdData = newData; zugferdData = newData;

View File

@@ -44,7 +44,7 @@ public class DXExporterFromA1 extends DXExporterFromA3 implements IZUGFeRDExport
* @return the URN of the namespace * @return the URN of the namespace
*/ */
public String getNamespaceForVersion(int ver) { public String getNamespaceForVersion(int ver) {
return "urn:factur-x:pdfa:CrossIndustryDocument:1p0#"; return "urn:facturx:pdfa:CrossIndustryDocument:despatchadvice:1p0#";
} }
/*** /***
* internal helper: returns the namespace prefix for the given order-x version number * internal helper: returns the namespace prefix for the given order-x version number

View File

@@ -105,7 +105,7 @@ public class DXExporterFromA3 extends ZUGFeRDExporterFromA3 {
* OrderX document type. As of version 1.0 it may be * OrderX document type. As of version 1.0 it may be
* ORDER, ORDER_RESPONSE, or ORDER_CHANGE * ORDER, ORDER_RESPONSE, or ORDER_CHANGE
*/ */
protected String orderXDocumentType = "ORDER"; protected String deliverXDocumentType = "DESPATCHADVICE";
private HashMap<String, byte[]> additionalXMLs = new HashMap<String, byte[]>(); private HashMap<String, byte[]> additionalXMLs = new HashMap<String, byte[]>();
@@ -396,15 +396,15 @@ public class DXExporterFromA3 extends ZUGFeRDExporterFromA3 {
} }
/** /**
* Sets the property orderXDocumentType. * Sets the property for DocumentType.
* *
* @param orderXDocumentType new value. Expected: ORDER, ORDER_RESPONSE, or ORDER_CHANGE * @param
* *
* @return this exporter * @return this exporter
*/ */
public DXExporterFromA3 setOrderXDocumentType(String orderXDocumentType) public DXExporterFromA3 setDocumentType(String DocumentType)
{ {
this.orderXDocumentType = orderXDocumentType; this.deliverXDocumentType = DocumentType;
return this; return this;
} }
@@ -426,9 +426,9 @@ public class DXExporterFromA3 extends ZUGFeRDExporterFromA3 {
if (attachZUGFeRDHeaders) { if (attachZUGFeRDHeaders) {
XMPSchemaZugferd zf = new XMPSchemaZugferd(metadata, 1, true, xmlProvider.getProfile(), XMPSchemaZugferd zf = new XMPSchemaZugferd(metadata, 1, true, xmlProvider.getProfile(),
"urn:factur-x:pdfa:CrossIndustryDocument:1p0#", "fx", "urn:facturx:pdfa:CrossIndustryDocument:despatchadvice:1p0#", "fx",
"deliver-x.xml"); "cida.xml");
zf.setType(this.orderXDocumentType); zf.setType(this.deliverXDocumentType);
metadata.addSchema(zf); metadata.addSchema(zf);
// also add the schema extensions... // also add the schema extensions...
@@ -457,9 +457,9 @@ public class DXExporterFromA3 extends ZUGFeRDExporterFromA3 {
public IExporter prepare() throws IOException { public IExporter prepare() throws IOException {
prepareDocument(); prepareDocument();
xmlProvider.generateXML(trans); xmlProvider.generateXML(trans);
String filename = "deliver-x.xml"; String filename = "cida.xml";
PDFAttachGenericFile(doc, filename, "Alternative", PDFAttachGenericFile(doc, filename, "Alternative",
"Order metadata conforming to the Order-X standard (https://www.ferd-net.de/standards/order-x/index.html)", "Delivery metadata",
"text/xml", xmlProvider.getXML()); "text/xml", xmlProvider.getXML());
for (FileAttachment attachment : fileAttachments) { for (FileAttachment attachment : fileAttachments) {

View File

@@ -51,11 +51,7 @@ public class Profiles {
}).collect(Collectors.toMap(data -> (String) data[0], data -> (Profile) data[1])); }).collect(Collectors.toMap(data -> (String) data[0], data -> (Profile) data[1]));
static Map<String, Profile> dx1Map = Stream.of(new Object[][]{ static Map<String, Profile> dx1Map = Stream.of(new Object[][]{
{"BASIC", new Profile("BASIC", "urn:order-x.eu:1p0:basic")}, {"PILOT", new Profile("PILOT", "urn:facturx:pdfa:CrossIndustryDocument:despatchadvice:1p0#")}
{"COMFORT", new Profile("COMFORT", "urn:order-x.eu:1p0:comfort")},
{"EXTENDED", new Profile("EXTENDED", "urn:order-x.eu:1p0:extended")},
}).collect(Collectors.toMap(data -> (String) data[0], data -> (Profile) data[1])); }).collect(Collectors.toMap(data -> (String) data[0], data -> (Profile) data[1]));

View File

@@ -149,7 +149,7 @@ public class ZUGFeRDImporter {
/** /**
* filenames for invoice data (ZUGFeRD v1 and v2, Factur-X) * filenames for invoice data (ZUGFeRD v1 and v2, Factur-X)
*/ */
if ((filename.equals("ZUGFeRD-invoice.xml") || (filename.equals("zugferd-invoice.xml")) || filename.equals("factur-x.xml")) || filename.equals("xrechnung.xml") || filename.equals("order-x.xml") || filename.equals("deliver-x.xml")) { if ((filename.equals("ZUGFeRD-invoice.xml") || (filename.equals("zugferd-invoice.xml")) || filename.equals("factur-x.xml")) || filename.equals("xrechnung.xml") || filename.equals("order-x.xml") || filename.equals("cida.xml")) {
containsMeta = true; containsMeta = true;
final PDEmbeddedFile embeddedFile = fileSpec.getEmbeddedFile(); final PDEmbeddedFile embeddedFile = fileSpec.getEmbeddedFile();