Implement Invoice#getNotesWithSubjectCode and convenient setter methods.

This commit is contained in:
Sebastian Sieber
2023-07-13 10:58:37 +02:00
parent 83f51ecda9
commit afffa93d89

View File

@@ -23,6 +23,7 @@ package org.mustangproject;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.mustangproject.ZUGFeRD.IExportableTransaction;
import org.mustangproject.ZUGFeRD.IZUGFeRDAllowanceCharge;
@@ -48,6 +49,7 @@ public class Invoice implements IExportableTransaction {
@JsonDeserialize(contentAs=Item.class)
protected ArrayList<IZUGFeRDExportableItem> ZFItems = null;
protected ArrayList<String> notes = null;
private List<IncludedNote> includedNotes = null;
protected String sellerOrderReferencedDocumentID;
protected String contractReferencedDocument = null;
protected ArrayList<FileAttachment> xmlEmbeddedFiles=null;
@@ -396,6 +398,11 @@ public class Invoice implements IExportableTransaction {
return notes.toArray(new String[0]);
}
@Override
public List<IncludedNote> getNotesWithSubjectCode() {
return includedNotes;
}
@Override
public String getCurrency() {
return currency;
@@ -659,8 +666,8 @@ public class Invoice implements IExportableTransaction {
}
/***
* adds a free text paragraph, which will become a includedNote element
/**
* adds a free text paragraph, which will become an includedNote element
* @param text freeform UTF8 plain text
* @return fluent setter
*/
@@ -672,6 +679,90 @@ public class Invoice implements IExportableTransaction {
return this;
}
/**
* adds a free text paragraph, which will become an includedNote element with explicit
* subjectCode {@link SubjectCode#AAI}
* @param content freeform UTF8 plain text
* @return fluent setter
*/
public Invoice addGeneralNote(String content) {
if (includedNotes == null) {
includedNotes = new ArrayList<>();
}
includedNotes.add(IncludedNote.generalNote(content));
return this;
}
/**
* adds a free text paragraph, which will become an includedNote element with explicit
* subjectCode {@link SubjectCode#REG}
* @param content freeform UTF8 plain text
* @return fluent setter
*/
public Invoice regulatoryNote(String content) {
if (includedNotes == null) {
includedNotes = new ArrayList<>();
}
includedNotes.add(IncludedNote.regulatoryNote(content));
return this;
}
/**
* adds a free text paragraph, which will become an includedNote element with explicit
* subjectCode {@link SubjectCode#ABL}
* @param content freeform UTF8 plain text
* @return fluent setter
*/
public Invoice legalNote(String content) {
if (includedNotes == null) {
includedNotes = new ArrayList<>();
}
includedNotes.add(IncludedNote.legalNote(content));
return this;
}
/**
* adds a free text paragraph, which will become an includedNote element with explicit
* subjectCode {@link SubjectCode#CUS}
* @param content freeform UTF8 plain text
* @return fluent setter
*/
public Invoice customsNote(String content) {
if (includedNotes == null) {
includedNotes = new ArrayList<>();
}
includedNotes.add(IncludedNote.customsNote(content));
return this;
}
/**
* adds a free text paragraph, which will become an includedNote element with explicit
* subjectCode {@link SubjectCode#SUR}
* @param content freeform UTF8 plain text
* @return fluent setter
*/
public Invoice sellerNote(String content) {
if (includedNotes == null) {
includedNotes = new ArrayList<>();
}
includedNotes.add(IncludedNote.sellerNote(content));
return this;
}
/**
* adds a free text paragraph, which will become an includedNote element with explicit
* subjectCode {@link SubjectCode#TXD}
* @param content freeform UTF8 plain text
* @return fluent setter
*/
public Invoice taxNote(String content) {
if (includedNotes == null) {
includedNotes = new ArrayList<>();
}
includedNotes.add(IncludedNote.taxNote(content));
return this;
}
@Override
public String getSpecifiedProcuringProjectID() {
return specifiedProcuringProjectID;