Around an hour of manual javadoc documentation (why don't I just use chatGPT for that?)

This commit is contained in:
Jochen Stärk
2026-05-21 09:55:06 +02:00
parent a9b72da265
commit 7a28c24c91
14 changed files with 153 additions and 6 deletions

View File

@@ -14,12 +14,33 @@ import java.math.BigDecimal;
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_EMPTY) @JsonInclude(JsonInclude.Include.NON_EMPTY)
/***
* This is the invoice but with redundant information, i.e. total amount etc.
* It has a calculate function which overwrites this total amount but fundamentally
* it's useful e.g. for imported invoices, because they may have diverging
* amounts, and some users are interested in retrieving the original ones
*/
public class CalculatedInvoice extends Invoice implements Serializable { public class CalculatedInvoice extends Invoice implements Serializable {
/***
* de factor the total net amount
*/
protected BigDecimal lineTotalAmount=null; protected BigDecimal lineTotalAmount=null;
/**
* still to be paid
*/
protected BigDecimal duePayable=null; protected BigDecimal duePayable=null;
/**
* originally to be paid (without prepayments)
*/
protected BigDecimal grandTotal=null; protected BigDecimal grandTotal=null;
/**
* the net amount upon which value added taxes are applied
*/
protected BigDecimal taxBasis=null; protected BigDecimal taxBasis=null;
/**
* the total sum of value added taxes
*/
protected BigDecimal VATtotal=null; protected BigDecimal VATtotal=null;
protected TransactionCalculator tc=null; protected TransactionCalculator tc=null;

View File

@@ -23,6 +23,9 @@ public class CashDiscount implements IZUGFeRDCashDiscount {
*/ */
protected Integer days; protected Integer days;
/**
* The original payment amount
*/
protected BigDecimal basisAmount; protected BigDecimal basisAmount;
/*** /***
@@ -45,6 +48,10 @@ public class CashDiscount implements IZUGFeRDCashDiscount {
} }
/***
* how much this discount removed from the original dept
* @return the percent
*/
public BigDecimal getPercent() { public BigDecimal getPercent() {
return percent; return percent;
} }
@@ -54,6 +61,10 @@ public class CashDiscount implements IZUGFeRDCashDiscount {
return this; return this;
} }
/***
* get the number of calendar days this cash discount is valid
* @return the number (integer) of days
*/
public Integer getDays() { public Integer getDays() {
return days; return days;
} }

View File

@@ -67,6 +67,11 @@ public class DirectDebit implements IZUGFeRDTradeSettlementDebit {
return this.IBAN; return this.IBAN;
} }
/***
* sets the IBAN id (not neccessarily the IBAN, can be anonymized) of the
* @param iBAN the IBAN id (not neccessarily the IBAN, can be anonymized) where the money is deducated
* @return fluent setter
*/
public DirectDebit setIBAN(String iBAN) { public DirectDebit setIBAN(String iBAN) {
this.IBAN = iBAN; this.IBAN = iBAN;
return this; return this;

View File

@@ -1,6 +1,35 @@
package org.mustangproject; package org.mustangproject;
public enum EStandard { public enum EStandard {
facturx, orderx, despatchadvice, ubldespatchadvice, zugferd, cii, ubl, ubl_creditnote /**factur-x/zugferd 2*/
facturx,
/***
* order-x
*/
orderx,
/***
* deliver-x
*/
despatchadvice,
/***
* 1lieferschein
*/
ubldespatchadvice,
/***
* ZUGFeRD 1
*/
zugferd,
/***
* imported from cross industry invoice
*/
cii,
/***
* imported from an UBL invoice
*/
ubl,
/***
* imported from an UBL credit note
*/
ubl_creditnote
} }

View File

@@ -3,14 +3,20 @@ package org.mustangproject.Exceptions;
import java.text.ParseException; import java.text.ParseException;
/*** /***
* will be thrown if an invoice cant be reproduced numerically
* ArithmetricException for backwards compatibility, was a spelling error * ArithmetricException for backwards compatibility, was a spelling error
*/ */
public class ArithmeticException extends ArithmetricException { public class ArithmeticException extends ArithmetricException {
/***
* will be thrown if an invoice cant be reproduced numerically
*/
public ArithmeticException() { public ArithmeticException() {
super(); super();
} }
/***
* Exceptions usually are raised with details
* @param details the text
*/
public ArithmeticException(String details) { public ArithmeticException(String details) {
super(details); super(details);
} }

View File

@@ -3,14 +3,21 @@ package org.mustangproject.Exceptions;
import java.text.ParseException; import java.text.ParseException;
/*** /***
* will be thrown if an invoice cant be reproduced numerically *
* (deprecated, because of typo) * (deprecated, because of typo)
*/ */
public class ArithmetricException extends ParseException { public class ArithmetricException extends ParseException {
/***
* will be thrown if an invoice cant be reproduced numerically
*/
public ArithmetricException() { public ArithmetricException() {
this(""); this("");
} }
/***
* Telling the issue...
* @param details explanation details
*/
public ArithmetricException(String details) { public ArithmetricException(String details) {
super("Could not reproduce the invoice. " + details, 0); super("Could not reproduce the invoice. " + details, 0);
} }

View File

@@ -173,15 +173,20 @@ public class Invoice implements IExportableTransaction {
/*** /***
* BT-17 * BT-17
* @param dr * @param dr the Referenced Document (may contain ID, typecode, date...)
* @return * @return fluent setter
*/ */
public Invoice setTenderReferencedDocument(ReferencedDocument dr) { public Invoice setTenderReferencedDocument(ReferencedDocument dr) {
dr.setTypeCode("50");//50 is fixed for tender documents dr.setTypeCode("50");//50 is fixed for tender documents
tenderReference=dr; tenderReference=dr;
return this; return this;
} }
/***
* Sets a reference to a tender
* @param ID the key ID of the tender
* @return fluent setter
*/
public Invoice setTenderReferencedDocument(String ID) { public Invoice setTenderReferencedDocument(String ID) {
ReferencedDocument dr=new ReferencedDocument(ID); ReferencedDocument dr=new ReferencedDocument(ID);
setTenderReferencedDocument(dr); setTenderReferencedDocument(dr);
@@ -192,6 +197,9 @@ public class Invoice implements IExportableTransaction {
/** BT-18 */ /** BT-18 */
@Override @Override
/***
*
*/
public IReferencedDocument getObjectIdentifierReferencedDocument() { public IReferencedDocument getObjectIdentifierReferencedDocument() {
return objectIdentifierReference; return objectIdentifierReference;
} }

View File

@@ -23,6 +23,9 @@ import java.nio.charset.StandardCharsets;
public class CustomXMLProvider implements IXMLProvider { public class CustomXMLProvider implements IXMLProvider {
protected byte[] zugferdData; protected byte[] zugferdData;
/***
* the scope=profile this XML data is provided in
*/
protected Profile profile=Profiles.getByName("EN16931"); protected Profile profile=Profiles.getByName("EN16931");
@Override @Override

View File

@@ -32,6 +32,9 @@ import org.mustangproject.FileAttachment;
import org.mustangproject.Invoice; import org.mustangproject.Invoice;
import org.mustangproject.XMLTools; import org.mustangproject.XMLTools;
/***
*
*/
public class DAPullProvider extends ZUGFeRD2PullProvider { public class DAPullProvider extends ZUGFeRD2PullProvider {
protected IExportableTransaction trans; protected IExportableTransaction trans;

View File

@@ -66,7 +66,24 @@ public interface IZUGFeRDExporter extends Closeable, IExporter {
public String getNamespaceForVersion(int ver); public String getNamespaceForVersion(int ver);
public String getPrefixForVersion(int ver) ; public String getPrefixForVersion(int ver) ;
public IZUGFeRDExporter disableAutoClose(boolean disableAutoClose); public IZUGFeRDExporter disableAutoClose(boolean disableAutoClose);
/***
* attach an additional PDF file attachment for Factur-X attachments
* (for attached files embedded into XML, within Germany domestically preferred,
* please refer to @see Invoice.embedFileInXML)
* @param file mime type and data
*/
public void attachFile(FileAttachment file); public void attachFile(FileAttachment file);
/***
* attach an additional PDF file attachment for Factur-X attachments
* (for attached files embedded into XML, within Germany domestically preferred,
* please refer to @see Invoice.embedFileInXML
*
* @param filename the filename to be suggested
* @param data the binary data
* @param mimetype the mime type, from the list of allowed mime types
* @param relation the PDF relation
*/
public void attachFile(String filename, byte[] data, String mimetype, String relation); public void attachFile(String filename, byte[] data, String mimetype, String relation);
public IXMLProvider getProvider(); public IXMLProvider getProvider();

View File

@@ -19,6 +19,9 @@
package org.mustangproject.ZUGFeRD.model; package org.mustangproject.ZUGFeRD.model;
public class DateTimeTypeConstants { public class DateTimeTypeConstants {
/***
* the id of the yyyymmdd - Date format
*/
public static final String DATE = "102"; public static final String DATE = "102";
public static final String MONTH = "610"; public static final String MONTH = "610";
public static final String WEEK = "616"; public static final String WEEK = "616";

View File

@@ -19,9 +19,19 @@
package org.mustangproject.ZUGFeRD.model; package org.mustangproject.ZUGFeRD.model;
public class DocumentCodeTypeConstants { public class DocumentCodeTypeConstants {
/***
* default invoice typecode
*/
public static final String INVOICE = "380"; public static final String INVOICE = "380";
/***
* typecode of a credit note, with reference to an invoice.
* Used in all(?) non-german legislations like france to correct a invoice
*/
public static final String CREDITNOTE = "381"; public static final String CREDITNOTE = "381";
public static final String DEBITNOTE = "84"; public static final String DEBITNOTE = "84";
/***
* typecode for a german corrective invoice (negative qtys)
*/
public static final String CORRECTEDINVOICE = "384"; public static final String CORRECTEDINVOICE = "384";
public static final String SELFBILLING = "389"; public static final String SELFBILLING = "389";
public static final String PARTIAL_BILLING = "326"; public static final String PARTIAL_BILLING = "326";

View File

@@ -19,7 +19,16 @@
package org.mustangproject.ZUGFeRD.model; package org.mustangproject.ZUGFeRD.model;
public class DocumentContextParameterTypeConstants { public class DocumentContextParameterTypeConstants {
/***
* the URN of the guideline ID of a ZUGFeRD 1 basic profile
*/
public static final String BASIC = "urn:ferd:CrossIndustryDocument:invoice:1p0:basic"; public static final String BASIC = "urn:ferd:CrossIndustryDocument:invoice:1p0:basic";
/***
* the URN of the guideline ID of a ZUGFeRD 1 comfort profile
*/
public static final String COMFORT = "urn:ferd:CrossIndustryDocument:invoice:1p0:comfort"; public static final String COMFORT = "urn:ferd:CrossIndustryDocument:invoice:1p0:comfort";
/***
* the URN of the guideline ID of a ZUGFeRD 1 extended profile
*/
public static final String EXTENDED = "urn:ferd:CrossIndustryDocument:invoice:1p0:extended"; public static final String EXTENDED = "urn:ferd:CrossIndustryDocument:invoice:1p0:extended";
} }

View File

@@ -1,5 +1,8 @@
package org.mustangproject.util; package org.mustangproject.util;
/**
* Find string in large files, text, binary or binary (PDF)
*/
public final class ByteArraySearcher { public final class ByteArraySearcher {
private ByteArraySearcher() { private ByteArraySearcher() {
@@ -31,10 +34,22 @@ public final class ByteArraySearcher {
return -1; return -1;
} }
/***
* check if a string or any substring of haystack matches (case sensitive) needle
* @param haystack
* @param needle
* @return true, if haystack contains needle
*/
public static boolean contains(byte[] haystack, byte[] needle) { public static boolean contains(byte[] haystack, byte[] needle) {
return indexOf(haystack, needle) >= 0; return indexOf(haystack, needle) >= 0;
} }
/***
* check if haystack starts with (case sensitive) needle
* @param haystack
* @param needle
* @return true, if haystack immediately starts with needle
*/
public static boolean startsWith(byte[] haystack, byte[] needle) { public static boolean startsWith(byte[] haystack, byte[] needle) {
if (needle.length > haystack.length) { if (needle.length > haystack.length) {
return false; return false;