001/*
002 * Copyright (C) 2014 konik.io
003 *
004 * This file is part of Konik library.
005 *
006 * Konik library is free software: you can redistribute it and/or modify
007 * it under the terms of the GNU Affero General Public License as published by
008 * the Free Software Foundation, either version 3 of the License, or
009 * (at your option) any later version.
010 *
011 * Konik library is distributed in the hope that it will be useful,
012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014 * GNU Affero General Public License for more details.
015 *
016 * You should have received a copy of the GNU Affero General Public License
017 * along with Konik library.  If not, see <http://www.gnu.org/licenses/>.
018 */
019package io.konik.zugferd.entity;
020
021import io.konik.zugferd.unqualified.Amount;
022import io.konik.zugferd.unqualified.Quantity;
023
024import java.util.ArrayList;
025import java.util.List;
026
027import javax.validation.Valid;
028import javax.xml.bind.annotation.XmlAccessType;
029import javax.xml.bind.annotation.XmlAccessorType;
030import javax.xml.bind.annotation.XmlElement;
031import javax.xml.bind.annotation.XmlType;
032
033
034/**
035 * = The Price
036 * 
037 * 
038 */
039@XmlAccessorType(XmlAccessType.FIELD)
040@XmlType(name = "TradePriceType", propOrder = { "chargeAmount", "basisQuantity", "allowanceCharge" })
041public class Price {
042
043   @Valid
044        @XmlElement(name = "ChargeAmount")
045        private Amount chargeAmount;
046
047   @Valid
048        @XmlElement(name = "BasisQuantity")
049        private Quantity basisQuantity;
050
051   @Valid
052        @XmlElement(name = "AppliedTradeAllowanceCharge")
053        private List<AllowanceCharge> allowanceCharge;
054
055        /**
056         * Gets the charge amount.
057         * 
058         * @return the charge amount
059         */
060        public Amount getChargeAmount() {
061                return chargeAmount;
062        }
063
064        /**
065    * Sets the charge amount.
066    *
067    * @param chargeAmount the new charge amount
068    * @return the price
069    */
070        public Price setChargeAmount(Amount chargeAmount) {
071                this.chargeAmount = chargeAmount;
072                return this;
073        }
074
075        /**
076         * Gets the basis quantity.
077         * 
078         * @return the basis quantity
079         */
080        public Quantity getBasisQuantity() {
081                return basisQuantity;
082        }
083
084        /**
085    * Sets the basis quantity.
086    *
087    * @param quantity the new basis quantity
088    * @return the price
089    */
090        public Price setBasisQuantity(Quantity quantity) {
091                this.basisQuantity = quantity;
092                return this;
093        }
094
095        /**
096         * Gets the applied trade allowance charge.
097         * 
098         * @return the applied trade allowance charge
099         */
100        public List<AllowanceCharge> getAllowanceCharge() {
101                if (allowanceCharge == null) {
102                        allowanceCharge = new ArrayList<AllowanceCharge>();
103                }
104                return this.allowanceCharge;
105        }
106
107}