Squashed commit of the following:
commit f0a44d757de2693e5baa89ac68192ee92632e0a2 Author: langfr <frank.langelage@outlook.de> Date: Sat Sep 6 12:00:42 2025 +0100 Enable option setting Additional Document Description 2. commit 15524a2ed661fb44f782863da5d7e9fcf4f68e78 Author: langfr <frank.langelage@outlook.de> Date: Tue Sep 2 21:30:30 2025 +0100 Enable option setting Additional Document Description. Enable setting and reading Additional Document Description.
This commit is contained in:
@@ -10,7 +10,7 @@ public class FileAttachment {
|
||||
protected String filename;
|
||||
protected String mimetype;
|
||||
protected String relation = "Unspecified";
|
||||
protected String description;
|
||||
protected String description = "Additional file attachment";
|
||||
protected byte[] data;
|
||||
|
||||
|
||||
@@ -21,19 +21,25 @@ public class FileAttachment {
|
||||
|
||||
}
|
||||
|
||||
public FileAttachment(String filename, String mimetype, String relation, byte[] data, String description) {
|
||||
this.filename = filename;
|
||||
this.mimetype = mimetype;
|
||||
this.relation = relation;
|
||||
this.data = data;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public FileAttachment(String filename, String mimetype, String relation, byte[] data) {
|
||||
this.filename = filename;
|
||||
this.mimetype = mimetype;
|
||||
this.relation = relation;
|
||||
this.data = data;
|
||||
this.description = "Additional file attachment";
|
||||
}
|
||||
|
||||
public FileAttachment(String filename, String mimetype, byte[] data) {
|
||||
this.filename = filename;
|
||||
this.mimetype = mimetype;
|
||||
this.data = data;
|
||||
this.description = "Additional file attachment";
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
|
||||
@@ -994,6 +994,12 @@ public class ZUGFeRDInvoiceImporter {
|
||||
NodeList attachmentNodes = (NodeList) xpr.evaluate(getDocument(), XPathConstants.NODESET);
|
||||
for (int i = 0; i < attachmentNodes.getLength(); i++) {
|
||||
FileAttachment fa = new FileAttachment(attachmentNodes.item(i).getAttributes().getNamedItem("filename").getNodeValue(), attachmentNodes.item(i).getAttributes().getNamedItem("mimeCode").getNodeValue(), "Data", Base64.getMimeDecoder().decode(XMLTools.trimOrNull(attachmentNodes.item(i))));
|
||||
NodeList nl = attachmentNodes.item(i).getParentNode().getChildNodes();
|
||||
for (int j = 0; j < nl.getLength(); j++) {
|
||||
if (nl.item(j).getLocalName() != null && nl.item(j).getLocalName().equals("Name")) {
|
||||
fa.setDescription(nl.item(j).getTextContent());
|
||||
}
|
||||
}
|
||||
zpp.embedFileInXML(fa);
|
||||
// filename = "Aufmass.png" mimeCode = "image/png"
|
||||
//EmbeddedDocumentBinaryObject cbc:EmbeddedDocumentBinaryObject mimeCode="image/png" filename="Aufmass.png"
|
||||
|
||||
Reference in New Issue
Block a user