jacksonability
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package org.mustangproject;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import org.mustangproject.ZUGFeRD.IZUGFeRDExportableContact;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
@@ -9,6 +10,7 @@ import org.w3c.dom.NodeList;
|
||||
* for the organisation/company itsel please
|
||||
* @see TradeParty
|
||||
*/
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class Contact implements IZUGFeRDExportableContact {
|
||||
|
||||
protected String name, phone, email, zip, street, location, country;
|
||||
@@ -27,6 +29,13 @@ public class Contact implements IZUGFeRDExportableContact {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
/***
|
||||
* empty constructor.
|
||||
* as always, not recommended, for jackson...
|
||||
*/
|
||||
public Contact() {
|
||||
}
|
||||
|
||||
/***
|
||||
* complete specification of a named contact with a different address
|
||||
* @param name full name
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
*/
|
||||
package org.mustangproject;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import org.mustangproject.ZUGFeRD.*;
|
||||
import org.mustangproject.ZUGFeRD.model.DocumentCodeTypeConstants;
|
||||
|
||||
@@ -31,15 +33,17 @@ import java.util.Date;
|
||||
* An invoice, with fluent setters
|
||||
* @see IExportableTransaction if you want to implement an interface instead
|
||||
*/
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class Invoice implements IExportableTransaction {
|
||||
|
||||
protected String documentName = null, documentCode = null, number = null, ownOrganisationFullPlaintextInfo = null, referenceNumber = null, shipToOrganisationID = null, shipToOrganisationName = null, shipToStreet = null, shipToZIP = null, shipToLocation = null, shipToCountry = null, buyerOrderReferencedDocumentID = null, invoiceReferencedDocumentID = null, buyerOrderReferencedDocumentIssueDateTime = null, ownForeignOrganisationID = null, ownOrganisationName = null, currency = null, paymentTermDescription = null;
|
||||
protected Date issueDate = null, dueDate = null, deliveryDate = null;
|
||||
protected BigDecimal totalPrepaidAmount = null;
|
||||
protected TradeParty sender = null, recipient = null, deliveryAddress = null;
|
||||
@JsonDeserialize(contentAs=Item.class)
|
||||
protected ArrayList<IZUGFeRDExportableItem> ZFItems = null;
|
||||
protected ArrayList<String> notes = null;
|
||||
private String sellerOrderReferencedDocumentID;
|
||||
protected String sellerOrderReferencedDocumentID;
|
||||
protected String contractReferencedDocument = null;
|
||||
protected ArrayList<FileAttachment> xmlEmbeddedFiles=null;
|
||||
|
||||
@@ -49,12 +53,9 @@ public class Invoice implements IExportableTransaction {
|
||||
protected ArrayList<IZUGFeRDAllowanceCharge> Allowances = new ArrayList<>(),
|
||||
Charges = new ArrayList<>(), LogisticsServiceCharges = new ArrayList<>();
|
||||
protected IZUGFeRDPaymentTerms paymentTerms = null;
|
||||
private Date invoiceReferencedIssueDate;
|
||||
private String specifiedProcuringProjectID = null;
|
||||
|
||||
|
||||
|
||||
private String specifiedProcuringProjectName = null;
|
||||
protected Date invoiceReferencedIssueDate;
|
||||
protected String specifiedProcuringProjectID = null;
|
||||
protected String specifiedProcuringProjectName = null;
|
||||
|
||||
public Invoice() {
|
||||
ZFItems = new ArrayList<>();
|
||||
@@ -551,6 +552,10 @@ public class Invoice implements IExportableTransaction {
|
||||
return ZFItems.toArray(new IZUGFeRDExportableItem[0]);
|
||||
}
|
||||
|
||||
public void setZFItems(ArrayList<IZUGFeRDExportableItem> ims) {
|
||||
ZFItems=ims;
|
||||
}
|
||||
|
||||
/**
|
||||
* required
|
||||
* adds invoice "lines" :-)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.mustangproject;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import org.mustangproject.ZUGFeRD.IReferencedDocument;
|
||||
import org.mustangproject.ZUGFeRD.IZUGFeRDAllowanceCharge;
|
||||
import org.mustangproject.ZUGFeRD.IZUGFeRDExportableItem;
|
||||
@@ -11,6 +12,8 @@ import java.util.Date;
|
||||
/***
|
||||
* describes any invoice line
|
||||
*/
|
||||
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class Item implements IZUGFeRDExportableItem {
|
||||
protected BigDecimal price, quantity, tax, grossPrice, lineTotalAmount;
|
||||
protected Date detailedDeliveryPeriodFrom=null, detailedDeliveryPeriodTo=null;
|
||||
@@ -35,6 +38,13 @@ public class Item implements IZUGFeRDExportableItem {
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* empty constructor
|
||||
* do not use, but might be used e.g. by jackson
|
||||
* */
|
||||
public Item() {
|
||||
}
|
||||
|
||||
public Item addReferencedLineID(String s) {
|
||||
referencedLineID=s;
|
||||
return this;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.mustangproject;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import org.mustangproject.ZUGFeRD.IZUGFeRDExportableProduct;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -7,6 +8,7 @@ import java.math.BigDecimal;
|
||||
/***
|
||||
* describes a product, good or service used in an invoice item line
|
||||
*/
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class Product implements IZUGFeRDExportableProduct {
|
||||
protected String unit, name, description, sellerAssignedID, buyerAssignedID;
|
||||
protected BigDecimal VATPercent;
|
||||
@@ -28,6 +30,15 @@ public class Product implements IZUGFeRDExportableProduct {
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* empty constructor
|
||||
* just for jackson etc
|
||||
*/
|
||||
public Product() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public String getSellerAssignedID() {
|
||||
return sellerAssignedID;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import org.mustangproject.ZUGFeRD.IZUGFeRDExportableContact;
|
||||
import org.mustangproject.ZUGFeRD.IZUGFeRDExportableTradeParty;
|
||||
import org.mustangproject.ZUGFeRD.IZUGFeRDTradeSettlement;
|
||||
@@ -15,6 +16,7 @@ import org.w3c.dom.NodeList;
|
||||
/***
|
||||
* A organisation, i.e. usually a company
|
||||
*/
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class TradeParty implements IZUGFeRDExportableTradeParty {
|
||||
|
||||
protected String name, zip, street, location, country;
|
||||
@@ -25,6 +27,15 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
|
||||
protected List<IZUGFeRDTradeSettlementDebit> debitDetails = new ArrayList<>();
|
||||
protected Contact contact = null;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
* Probably a bad idea but might be needed by jackson or similar
|
||||
*/
|
||||
public TradeParty() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*
|
||||
* @param name of the company
|
||||
@@ -118,13 +129,11 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
|
||||
for (int taxChildIndex = 0; taxChildIndex < taxChilds.getLength(); taxChildIndex++) {
|
||||
if (taxChilds.item(taxChildIndex).getLocalName() != null) {
|
||||
if ((taxChilds.item(taxChildIndex).getLocalName().equals("ID"))) {
|
||||
if (taxChilds.item(taxChildIndex).getAttributes().getNamedItem("schemeID")!=null) {
|
||||
if (taxChilds.item(taxChildIndex).getAttributes().getNamedItem("schemeID").getNodeValue().equals("VA"))
|
||||
{
|
||||
if (taxChilds.item(taxChildIndex).getAttributes().getNamedItem("schemeID") != null) {
|
||||
if (taxChilds.item(taxChildIndex).getAttributes().getNamedItem("schemeID").getNodeValue().equals("VA")) {
|
||||
setVATID(taxChilds.item(taxChildIndex).getFirstChild().getNodeValue());
|
||||
}
|
||||
if (taxChilds.item(taxChildIndex).getAttributes().getNamedItem("schemeID").getNodeValue().equals("FC"))
|
||||
{
|
||||
if (taxChilds.item(taxChildIndex).getAttributes().getNamedItem("schemeID").getNodeValue().equals("FC")) {
|
||||
setTaxID(taxChilds.item(taxChildIndex).getFirstChild().getNodeValue());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,11 +26,14 @@ package org.mustangproject.ZUGFeRD;
|
||||
* @author jstaerk
|
||||
* */
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import org.mustangproject.Item;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@JsonDeserialize(as = Item.class)
|
||||
public interface IZUGFeRDExportableItem extends IAbsoluteValueProvider{
|
||||
|
||||
IZUGFeRDExportableProduct getProduct();
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user