Added the possibility to set ZUGFeRD conformance level
This commit is contained in:
committed by
Thomas Chojecki
parent
1a16ac296a
commit
28d6d3ca31
@@ -12,15 +12,24 @@ import org.apache.jempbox.xmp.XMPSchemaBasic;
|
|||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
|
||||||
|
|
||||||
public class XMPSchemaZugferd extends XMPSchemaBasic {
|
public class XMPSchemaZugferd extends XMPSchemaBasic
|
||||||
|
{
|
||||||
|
|
||||||
|
private String conformanceLevel = "COMFORT";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is what needs to be added to the RDF metadata - basically the name of the embedded
|
* This is what needs to be added to the RDF metadata - basically the name of the embedded
|
||||||
* Zugferd file
|
* Zugferd file
|
||||||
* */
|
* */
|
||||||
public XMPSchemaZugferd(org.apache.jempbox.xmp.XMPMetadata parent) {
|
public XMPSchemaZugferd(org.apache.jempbox.xmp.XMPMetadata parent, String conformanceLevel)
|
||||||
|
{
|
||||||
super(parent);
|
super(parent);
|
||||||
|
|
||||||
|
if (conformanceLevel != null)
|
||||||
|
{
|
||||||
|
this.conformanceLevel = conformanceLevel;
|
||||||
|
}
|
||||||
|
|
||||||
schema.setAttributeNS(NS_NAMESPACE, "xmlns:zf", //$NON-NLS-1$
|
schema.setAttributeNS(NS_NAMESPACE, "xmlns:zf", //$NON-NLS-1$
|
||||||
"urn:ferd:pdfa:CrossIndustryDocument:invoice:1p0#"); //$NON-NLS-1$
|
"urn:ferd:pdfa:CrossIndustryDocument:invoice:1p0#"); //$NON-NLS-1$
|
||||||
// the superclass includes this two namespaces we don't need
|
// the superclass includes this two namespaces we don't need
|
||||||
@@ -42,7 +51,7 @@ public class XMPSchemaZugferd extends XMPSchemaBasic {
|
|||||||
|
|
||||||
textNode = schema.getOwnerDocument().createElement(
|
textNode = schema.getOwnerDocument().createElement(
|
||||||
"zf:ConformanceLevel"); //$NON-NLS-1$
|
"zf:ConformanceLevel"); //$NON-NLS-1$
|
||||||
XMLUtil.setStringValue(textNode, "COMFORT"); //$NON-NLS-1$
|
XMLUtil.setStringValue(textNode, this.conformanceLevel); //$NON-NLS-1$
|
||||||
schema.appendChild(textNode);
|
schema.appendChild(textNode);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,6 +64,10 @@ public class ZUGFeRDExporter {
|
|||||||
private String conformanceLevel="U";
|
private String conformanceLevel="U";
|
||||||
private String versionStr="1.0";
|
private String versionStr="1.0";
|
||||||
|
|
||||||
|
// BASIC, COMFORT etc - may be set from outside.
|
||||||
|
private String ZUGFeRDConformanceLevel = null;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Data (XML invoice) to be added to the ZUGFeRD PDF. It may be externally set, in which case passing a
|
* Data (XML invoice) to be added to the ZUGFeRD PDF. It may be externally set, in which case passing a
|
||||||
* IZUGFeRDExportableTransaction is not necessary. By default it is null meaning the caller needs to
|
* IZUGFeRDExportableTransaction is not necessary. By default it is null meaning the caller needs to
|
||||||
@@ -502,6 +506,17 @@ public class ZUGFeRDExporter {
|
|||||||
this.zugferdData = zugferdData;
|
this.zugferdData = zugferdData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the ZUGFeRD conformance level (override).
|
||||||
|
*
|
||||||
|
* @param ZUGFeRDConformanceLevel the new conformance level
|
||||||
|
*/
|
||||||
|
public void setZUGFeRDConformanceLevel(String ZUGFeRDConformanceLevel)
|
||||||
|
{
|
||||||
|
this.ZUGFeRDConformanceLevel = ZUGFeRDConformanceLevel;
|
||||||
|
}
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* This will add both the RDF-indication which embedded file is Zugferd and the
|
* This will add both the RDF-indication which embedded file is Zugferd and the
|
||||||
* neccessary PDF/A schema extension description to be able to add this information to RDF
|
* neccessary PDF/A schema extension description to be able to add this information to RDF
|
||||||
@@ -509,7 +524,7 @@ public class ZUGFeRDExporter {
|
|||||||
*/
|
*/
|
||||||
private void addZugferdXMP(XMPMetadata metadata) {
|
private void addZugferdXMP(XMPMetadata metadata) {
|
||||||
|
|
||||||
XMPSchemaZugferd zf = new XMPSchemaZugferd(metadata);
|
XMPSchemaZugferd zf = new XMPSchemaZugferd(metadata, this.ZUGFeRDConformanceLevel);
|
||||||
zf.setAbout(""); //$NON-NLS-1$
|
zf.setAbout(""); //$NON-NLS-1$
|
||||||
metadata.addSchema(zf);
|
metadata.addSchema(zf);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user