Package org.mustangproject
Class Product
- java.lang.Object
-
- org.mustangproject.Product
-
- All Implemented Interfaces:
IZUGFeRDExportableProduct
public class Product extends java.lang.Object implements IZUGFeRDExportableProduct
describes a product, good or service used in an invoice item line
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.ArrayList<Allowance>allowancesprotected java.util.HashMap<java.lang.String,java.lang.String>attributesprotected java.lang.StringbuyerAssignedIDprotected java.util.ArrayList<Charge>chargesprotected java.util.List<IDesignatedProductClassification>classificationsprotected java.lang.StringcountryOfOriginprotected java.lang.Stringdescriptionprotected SchemedIDglobalIdprotected booleanisIntraCommunitySupplyprotected booleanisReverseChargeprotected java.lang.Stringnameprotected java.lang.StringsellerAssignedIDprotected java.lang.StringtaxCategoryCodeprotected java.lang.StringtaxExemptionReasonprotected java.lang.Stringunitprotected java.math.BigDecimalVATPercent
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ProductaddAllowance(Allowance a)ProductaddAttribute(java.lang.String name, java.lang.String value)ProductaddCharge(Charge e)ProductaddClassification(IDesignatedProductClassification classification)Add aIDesignatedProductClassificationclassificationProductaddGlobalID(SchemedID schemedID)Allowance[]getAllowances()product level discounts (AppliedTradeAllowanceCharge, will change net price)java.util.HashMap<java.lang.String,java.lang.String>getAttributes()java.lang.StringgetBuyerAssignedID()Get the ID that had been assigned by the buyer to identify the productCharge[]getCharges()returns the AppliedTradeAllowanceCharges of this product which are actually ChargesIDesignatedProductClassification[]getClassifications()Detailed information about the productjava.lang.StringgetCountryOfOrigin()java.lang.StringgetDescription()long description of the productjava.lang.StringgetGlobalID()customer global identification assigned by the sellerjava.lang.StringgetGlobalIDScheme()customer global identification schemejava.lang.StringgetName()Short name of the productjava.lang.StringgetSellerAssignedID()Get the ID that had been assigned by the seller to identify the productjava.lang.StringgetTaxCategoryCode()java.lang.StringgetTaxExemptionReason()java.lang.StringgetUnit()Unit code of the product Most common ones are C62 one (piece) DAY day HAR hectare HUR hour KGM kilogram KTM kilometre KWH kilowatt hour LS lump sum LTR litre MIN minute MMK square millimetre MMT millimetre MTK square metre MTQ cubic metre MTR metre NAR number of articles NPR number of pairs P1 percent SET set TNE tonne (metric ton) WEE weekjava.math.BigDecimalgetVATPercent()VAT percent of the product (e.g. 19, or 5.1 if you like)booleanisIntraCommunitySupply()booleanisReverseCharge()ProductsetAllowances(java.util.ArrayList<Allowance> allowances)Jackson courtesy function, please use addAllowance if you have the choiceProductsetAttributes(java.util.Map<java.lang.String,java.lang.String> attributes)ProductsetBuyerAssignedID(java.lang.String buyerAssignedID)if the buyer provided an ID how he refers to this productProductsetCharges(java.util.ArrayList<Charge> charges)Jackson courtesy function, please use addCharge if you have the choiceProductsetClassifications(IDesignatedProductClassification[] classifications)Replace the current set ofIDesignatedProductClassifications with a new setProductsetClassificationsClass(DesignatedProductClassification[] classifications)Provide Jackson a hint as to use DesignatedProductClassification for the IDesignatedProductClassification product classificationsProductsetCountryOfOrigin(java.lang.String countryOfOrigin)ProductsetDescription(java.lang.String description)description of the product (required)ProductsetIntraCommunitySupply()sets intra community supply(=delivery outside the country inside the EU)ProductsetName(java.lang.String name)name of the productProductsetReverseCharge()sets reverse charge(=delivery to outside EU)ProductsetSellerAssignedID(java.lang.String sellerAssignedID)how the seller identifies this type of productProductsetTaxCategoryCode(java.lang.String code)ProductsetTaxExemptionReason(java.lang.String taxExemptionReasonText)ProductsetUnit(java.lang.String unit)sets a UN/ECE rec 20 or 21 code which unit the product ships in, e.g.ProductsetVATPercent(java.math.BigDecimal VATPercent)VAT rate of the product
-
-
-
Field Detail
-
unit
protected java.lang.String unit
-
name
protected java.lang.String name
-
sellerAssignedID
protected java.lang.String sellerAssignedID
-
buyerAssignedID
protected java.lang.String buyerAssignedID
-
description
protected java.lang.String description
-
taxExemptionReason
protected java.lang.String taxExemptionReason
-
taxCategoryCode
protected java.lang.String taxCategoryCode
-
VATPercent
protected java.math.BigDecimal VATPercent
-
isReverseCharge
protected boolean isReverseCharge
-
isIntraCommunitySupply
protected boolean isIntraCommunitySupply
-
globalId
protected SchemedID globalId
-
countryOfOrigin
protected java.lang.String countryOfOrigin
-
charges
protected java.util.ArrayList<Charge> charges
-
allowances
protected java.util.ArrayList<Allowance> allowances
-
attributes
protected java.util.HashMap<java.lang.String,java.lang.String> attributes
-
classifications
protected java.util.List<IDesignatedProductClassification> classifications
-
-
Constructor Detail
-
Product
public Product(java.lang.String name, java.lang.String description, java.lang.String unit, java.math.BigDecimal VATPercent)default constructor- Parameters:
name- product short namedescription- product long nameunit- a two/three letter UN/ECE rec 20 unit code, e.g. "C62" for pieceVATPercent- product vat rate
-
Product
public Product(org.w3c.dom.Node node)
-
Product
public Product()
empty constructor just for jackson etc
-
-
Method Detail
-
getGlobalID
public java.lang.String getGlobalID()
Description copied from interface:IZUGFeRDExportableProductcustomer global identification assigned by the seller- Specified by:
getGlobalIDin interfaceIZUGFeRDExportableProduct- Returns:
- customer identification
-
getGlobalIDScheme
public java.lang.String getGlobalIDScheme()
Description copied from interface:IZUGFeRDExportableProductcustomer global identification scheme- Specified by:
getGlobalIDSchemein interfaceIZUGFeRDExportableProduct- Returns:
- customer identification
-
getTaxExemptionReason
public java.lang.String getTaxExemptionReason()
- Specified by:
getTaxExemptionReasonin interfaceIZUGFeRDExportableProduct- Returns:
- e.g. intra-commnunity supply or small business
-
setTaxExemptionReason
public Product setTaxExemptionReason(java.lang.String taxExemptionReasonText)
- Parameters:
taxExemptionReasonText- String e.g. Kleinunternehmer gemäß §19 UStG https://github.com/ZUGFeRD/mustangproject/issues/463- Returns:
- fluent setter
-
getTaxCategoryCode
public java.lang.String getTaxCategoryCode()
- Specified by:
getTaxCategoryCodein interfaceIZUGFeRDExportableProduct- Returns:
- e.g. S (normal tax), Z=zero rated, E (e.g. small business) or K (intrra community supply)
-
setTaxCategoryCode
public Product setTaxCategoryCode(java.lang.String code)
- Parameters:
code- e.g. S (normal tax), Z=zero rated, E (e.g. small business) or K (intrra community supply) see also https://github.com/ZUGFeRD/mustangproject/issues/463- Returns:
- fluent setter
-
getSellerAssignedID
public java.lang.String getSellerAssignedID()
Description copied from interface:IZUGFeRDExportableProductGet the ID that had been assigned by the seller to identify the product- Specified by:
getSellerAssignedIDin interfaceIZUGFeRDExportableProduct- Returns:
- seller assigned product ID
-
setSellerAssignedID
public Product setSellerAssignedID(java.lang.String sellerAssignedID)
how the seller identifies this type of product- Parameters:
sellerAssignedID- a unique String- Returns:
- fluent setter
-
getBuyerAssignedID
public java.lang.String getBuyerAssignedID()
Description copied from interface:IZUGFeRDExportableProductGet the ID that had been assigned by the buyer to identify the product- Specified by:
getBuyerAssignedIDin interfaceIZUGFeRDExportableProduct- Returns:
- buyer assigned product ID
-
setBuyerAssignedID
public Product setBuyerAssignedID(java.lang.String buyerAssignedID)
if the buyer provided an ID how he refers to this product- Parameters:
buyerAssignedID- a string the buyer provided- Returns:
- fluent setter
-
isReverseCharge
public boolean isReverseCharge()
- Specified by:
isReverseChargein interfaceIZUGFeRDExportableProduct
-
isIntraCommunitySupply
public boolean isIntraCommunitySupply()
- Specified by:
isIntraCommunitySupplyin interfaceIZUGFeRDExportableProduct
-
setReverseCharge
public Product setReverseCharge()
sets reverse charge(=delivery to outside EU)- Returns:
- fluent setter
-
setIntraCommunitySupply
public Product setIntraCommunitySupply()
sets intra community supply(=delivery outside the country inside the EU)- Returns:
- fluent setter
-
getUnit
public java.lang.String getUnit()
Description copied from interface:IZUGFeRDExportableProductUnit code of the product Most common ones are C62 one (piece) DAY day HAR hectare HUR hour KGM kilogram KTM kilometre KWH kilowatt hour LS lump sum LTR litre MIN minute MMK square millimetre MMT millimetre MTK square metre MTQ cubic metre MTR metre NAR number of articles NPR number of pairs P1 percent SET set TNE tonne (metric ton) WEE week- Specified by:
getUnitin interfaceIZUGFeRDExportableProduct- Returns:
- a UN/ECE rec 20 unit code see https://www.unece.org/fileadmin/DAM/cefact/recommendations/rec20/rec20_rev3_Annex2e.pdf
-
setUnit
public Product setUnit(java.lang.String unit)
sets a UN/ECE rec 20 or 21 code which unit the product ships in, e.g. C62=piece- Parameters:
unit- 2-3 letter UN/ECE rec 20 or 21- Returns:
- fluent setter
-
getName
public java.lang.String getName()
Description copied from interface:IZUGFeRDExportableProductShort name of the product- Specified by:
getNamein interfaceIZUGFeRDExportableProduct- Returns:
- Short name of the product
-
setName
public Product setName(java.lang.String name)
name of the product- Parameters:
name- short name- Returns:
- fluent setter
-
getDescription
public java.lang.String getDescription()
Description copied from interface:IZUGFeRDExportableProductlong description of the product- Specified by:
getDescriptionin interfaceIZUGFeRDExportableProduct- Returns:
- long description of the product
-
setDescription
public Product setDescription(java.lang.String description)
description of the product (required)- Parameters:
description- long name- Returns:
- fluent setter
-
getVATPercent
public java.math.BigDecimal getVATPercent()
Description copied from interface:IZUGFeRDExportableProductVAT percent of the product (e.g. 19, or 5.1 if you like)- Specified by:
getVATPercentin interfaceIZUGFeRDExportableProduct- Returns:
- VAT percent of the product
-
setVATPercent
public Product setVATPercent(java.math.BigDecimal VATPercent)
VAT rate of the product- Parameters:
VATPercent- vat rate of the product- Returns:
- fluent setter
-
getCountryOfOrigin
public java.lang.String getCountryOfOrigin()
- Specified by:
getCountryOfOriginin interfaceIZUGFeRDExportableProduct
-
setCountryOfOrigin
public Product setCountryOfOrigin(java.lang.String countryOfOrigin)
-
getAttributes
public java.util.HashMap<java.lang.String,java.lang.String> getAttributes()
- Specified by:
getAttributesin interfaceIZUGFeRDExportableProduct
-
setAttributes
public Product setAttributes(java.util.Map<java.lang.String,java.lang.String> attributes)
-
addAttribute
public Product addAttribute(java.lang.String name, java.lang.String value)
-
getClassifications
public IDesignatedProductClassification[] getClassifications()
Description copied from interface:IZUGFeRDExportableProductDetailed information about the product- Specified by:
getClassificationsin interfaceIZUGFeRDExportableProduct- Returns:
- an array containing the product classifications or
nullif not set
-
setClassifications
public Product setClassifications(IDesignatedProductClassification[] classifications)
Replace the current set ofIDesignatedProductClassifications with a new set- Parameters:
classifications- the new set of classifications- Returns:
- the modified object
-
setClassificationsClass
public Product setClassificationsClass(DesignatedProductClassification[] classifications)
Provide Jackson a hint as to use DesignatedProductClassification for the IDesignatedProductClassification product classifications- Parameters:
classifications- the new set of classifications- Returns:
- fluent setter
-
addClassification
public Product addClassification(IDesignatedProductClassification classification)
Add aIDesignatedProductClassificationclassification- Parameters:
classification- the classification- Returns:
- the modified object
-
setCharges
public Product setCharges(java.util.ArrayList<Charge> charges)
Jackson courtesy function, please use addCharge if you have the choice- Returns:
- array of or null, if none
-
getCharges
public Charge[] getCharges()
returns the AppliedTradeAllowanceCharges of this product which are actually Charges- Specified by:
getChargesin interfaceIZUGFeRDExportableProduct- Returns:
- array of or null, if none
-
getAllowances
public Allowance[] getAllowances()
Description copied from interface:IZUGFeRDExportableProductproduct level discounts (AppliedTradeAllowanceCharge, will change net price)- Specified by:
getAllowancesin interfaceIZUGFeRDExportableProduct- Returns:
- array of the discounts on a single product
-
-