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 javax.validation.Valid;
021import javax.validation.constraints.NotNull;
022import javax.xml.bind.annotation.XmlElement;
023import javax.xml.bind.annotation.XmlType;
024
025import io.konik.validator.annotation.Basic;
026import io.konik.validator.annotation.Extended;
027import io.konik.zugferd.entity.CommonDelivery;
028import io.konik.zugferd.entity.TradeParty;
029import io.konik.zugferd.unqualified.Quantity;
030import io.konik.zugferd.unqualified.ZfDate;
031
032/**
033 * = The Trade Delivery
034 * 
035 */
036@XmlType(propOrder = { "billed", "chargeFree", "packageQuantity", "shipTo", "ultimateShipTo", "actualDelivery",
037      "despatchAdvice", "receivingAdvice", "deliveryNote" })
038public class SpecifiedDelivery extends CommonDelivery<ReferencedDocumentItem> {
039
040   @XmlElement(name = "BilledQuantity")
041   private Quantity billed;
042
043   @XmlElement(name = "ChargeFreeQuantity")
044   private Quantity chargeFree;
045
046   @XmlElement(name = "PackageQuantity")
047   private Quantity packageQuantity;
048
049   @XmlElement(name = "DespatchAdviceReferencedDocument")
050   private ReferencedDocumentItem despatchAdvice;
051
052   @XmlElement(name = "ReceivingAdviceReferencedDocument")
053   private ReferencedDocumentItem receivingAdvice;
054
055   @XmlElement(name = "DeliveryNoteReferencedDocument")
056   private ReferencedDocumentItem deliveryNote;
057
058   /** Instantiates a new trade delivery. */
059   public SpecifiedDelivery() {
060   }
061
062   /**
063    * The Constructor.
064    *
065    * @param billed the billed
066    */
067   public SpecifiedDelivery(Quantity billed) {
068      super();
069      this.billed = billed;
070   }
071
072   /**
073    * The Constructor.
074    *
075    * @param billed the billed
076    * @param actualDelivery the actual delivery
077    */
078   public SpecifiedDelivery(Quantity billed, ZfDate actualDelivery) {
079      super();
080      this.billed = billed;
081      setActualDelivery(actualDelivery);
082   }
083
084   /**
085    * Gets the billed quantity.
086    * 
087    * @return the billed quantity
088    */
089   @Basic
090   @Valid
091   @NotNull
092   public Quantity getBilled() {
093      return billed;
094   }
095
096   /**
097    * Sets the billed quantity.
098    * 
099    * @param billedQuantity the new billed quantity
100    * @return the delivery
101    */
102   public SpecifiedDelivery setBilled(Quantity billedQuantity) {
103      this.billed = billedQuantity;
104      return this;
105   }
106
107   /**
108    * Gets the charge free.
109    *
110    * @return the charge free
111    */
112   @Extended
113   @Valid
114   public Quantity getChargeFree() {
115      return chargeFree;
116   }
117
118   /**
119    * Sets the charge free.
120    *
121    * @param chargeFree the charge free
122    * @return the item delivery
123    */
124   public SpecifiedDelivery setChargeFree(Quantity chargeFree) {
125      this.chargeFree = chargeFree;
126      return this;
127   }
128
129   /**
130    * Gets the package quantity.
131    *
132    * @return the package quantity
133    */
134   @Extended
135   @Valid
136   public Quantity getPackageQuantity() {
137      return packageQuantity;
138   }
139
140   /**
141    * Sets the package quantity.
142    *
143    * @param packageQuantity the package quantity
144    * @return the item delivery
145    */
146   public SpecifiedDelivery setPackageQuantity(Quantity packageQuantity) {
147      this.packageQuantity = packageQuantity;
148      return this;
149   }
150
151   @Extended
152   @Valid
153   @Override
154   public TradeParty getShipTo() {
155      return super.getShipTo();
156   }
157
158   @Extended
159   @Valid
160   @Override
161   public TradeParty getUltimateShipTo() {
162      return super.getUltimateShipTo();
163   }
164
165   @Extended
166   @Override
167   public ZfDate getActualDelivery() {
168      return super.getActualDelivery();
169   }
170
171   @Extended
172   @Valid
173   @Override
174   public ReferencedDocumentItem getDespatchAdvice() {
175      return despatchAdvice;
176   }
177
178   @Override
179   public SpecifiedDelivery setDespatchAdvice(ReferencedDocumentItem despatchAdvice) {
180      this.despatchAdvice = despatchAdvice;
181      return this;
182   }
183
184   /**
185    * Gets the receiving advice.
186    *
187    * @return the receiving advice
188    */
189   @Extended
190   @Valid
191   public ReferencedDocumentItem getReceivingAdvice() {
192      return receivingAdvice;
193   }
194
195   /**
196    * Sets the receiving advice.
197    *
198    * @param receivingAdvice the receiving advice
199    * @return the item delivery
200    */
201   public SpecifiedDelivery setReceivingAdvice(ReferencedDocumentItem receivingAdvice) {
202      this.receivingAdvice = receivingAdvice;
203      return this;
204   }
205
206   @Extended
207   @Valid
208   @Override
209   public ReferencedDocumentItem getDeliveryNote() {
210      return deliveryNote;
211   }
212
213   @Override
214   public SpecifiedDelivery setDeliveryNote(ReferencedDocumentItem deliveryNote) {
215      this.deliveryNote = deliveryNote;
216      return this;
217   }
218}