001/* Copyright (C) 2014 konik.io
002 *
003 * This file is part of the Konik library.
004 *
005 * The Konik library is free software: you can redistribute it and/or modify
006 * it under the terms of the GNU Affero General Public License as
007 * published by the Free Software Foundation, either version 3 of the
008 * License, or (at your option) any later version.
009 *
010 * The Konik library is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
013 * GNU Affero General Public License for more details.
014 *
015 * You should have received a copy of the GNU Affero General Public License
016 * along with the Konik library. If not, see <http://www.gnu.org/licenses/>.
017 */
018package io.konik.zugferd.entity.trade.item;
019
020import io.konik.zugferd.entity.CommonAgreement;
021import io.konik.zugferd.entity.GrossPrice;
022import io.konik.zugferd.entity.Price;
023
024import java.util.ArrayList;
025import java.util.List;
026
027import javax.validation.Valid;
028import javax.xml.bind.annotation.XmlElement;
029import javax.xml.bind.annotation.XmlType;
030
031/**
032 * = The Agreement on trade item level.
033 */
034@XmlType(propOrder = { "buyerOrder", "contract", "additional", "grossPrice", "netPrice", "customerOrder" })
035public class SpecifiedAgreement implements CommonAgreement<ReferencedDocumentItem, ReferencedDocumentItemAdditional> {
036   @Valid
037   private ReferencedDocumentItem buyerOrder;
038   @Valid
039   private ReferencedDocumentItem contract;
040   @Valid
041   private List<ReferencedDocumentItemAdditional> additional;
042   @Valid
043   private GrossPrice grossPrice;
044   @Valid
045   private Price netPrice;
046   @Valid
047   private ReferencedDocumentItem customerOrder;
048
049   /**
050    * Gets the buyer order referenced document.
051    *
052    * @return the buyer order referenced document
053    */
054   @Override
055   @XmlElement(name = "BuyerOrderReferencedDocument")
056   public ReferencedDocumentItem getBuyerOrder() {
057      return buyerOrder;
058   }
059
060   /**
061    * Sets the buyer order referenced document.
062    *
063    * @param buyerOrder the new buyer order referenced document
064    * @return the supply chain trade agreement
065    */
066   @Override
067   public SpecifiedAgreement setBuyerOrder(ReferencedDocumentItem buyerOrder) {
068      this.buyerOrder = buyerOrder;
069      return this;
070   }
071
072   /**
073    * Gets the contract referenced document.
074    * 
075    * Profile:: COMFORT
076    *
077    * @return the contract referenced document
078    */
079   @Override
080   @XmlElement(name = "ContractReferencedDocument")
081   public ReferencedDocumentItem getContract() {
082      return contract;
083   }
084
085   /**
086    * Sets the contract referenced document.
087    * 
088    * Profile:: COMFORT
089    *
090    * @param contract the new contract referenced document
091    * @return the supply chain trade agreement
092    */
093   @Override
094   public SpecifiedAgreement setContract(ReferencedDocumentItem contract) {
095      this.contract = contract;
096      return this;
097   }
098
099   @Override
100   @XmlElement(name = "AdditionalReferencedDocument")
101   public List<ReferencedDocumentItemAdditional> getAdditional() {
102      if (additional == null) {
103         additional = new ArrayList<ReferencedDocumentItemAdditional>();
104      }
105      return additional;
106   }
107
108   @Override
109   public SpecifiedAgreement addAdditional(ReferencedDocumentItemAdditional additionalReference) {
110      getAdditional().add(additionalReference);
111      return this;
112   }
113
114   /**
115    * Gets the gross price product trade price.
116    *
117    * @return the gross price product trade price
118    */
119   @XmlElement(name = "GrossPriceProductTradePrice")
120   public GrossPrice getGrossPrice() {
121      return grossPrice;
122   }
123
124   /**
125    * Sets the gross price product trade price.
126    *
127    * @param grossPrice the new gross price product trade price
128    * @return the supply chain trade agreement
129    */
130   public SpecifiedAgreement setGrossPrice(GrossPrice grossPrice) {
131      this.grossPrice = grossPrice;
132      return this;
133   }
134
135   /**
136    * Gets the net price product trade price.
137    *
138    * @return the net price product trade price
139    */
140   @XmlElement(name = "NetPriceProductTradePrice")
141   public Price getNetPrice() {
142      return netPrice;
143   }
144
145   /**
146    * Sets the net price product trade price.
147    *
148    * @param netPrice the new net price product trade price
149    * @return the supply chain trade agreement
150    */
151   public SpecifiedAgreement setNetPrice(Price netPrice) {
152      this.netPrice = netPrice;
153      return this;
154   }
155
156   /**
157    * Gets the customer order referenced document.
158    * 
159    * Profile:: COMFORT
160    *
161    * @return the customer order referenced document
162    */
163   @Override
164   @XmlElement(name = "CustomerOrderReferencedDocument")
165   public ReferencedDocumentItem getCustomerOrder() {
166      return customerOrder;
167   }
168
169   /**
170    * Sets the customer order referenced document.
171    * 
172    * Profile:: COMFORT
173    *
174    * @param customerOrder the new customer order referenced document
175    * @return the supply chain trade agreement
176    */
177   @Override
178   public SpecifiedAgreement setCustomerOrder(ReferencedDocumentItem customerOrder) {
179      this.customerOrder = customerOrder;
180      return this;
181   }
182
183}