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;
019
020import io.konik.jaxb.bindable.entity.SupplyChainEventAdapter;
021import io.konik.validator.annotation.Basic;
022import io.konik.zugferd.entity.trade.item.ReferencedDocumentItem;
023import io.konik.zugferd.unqualified.ZfDate;
024
025import javax.xml.bind.annotation.XmlElement;
026import javax.xml.bind.annotation.XmlTransient;
027import javax.xml.bind.annotation.XmlType;
028import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
029
030/**
031 * = The Common Delivery class.
032 * 
033 * @param <R> The {@link ReferencedDocument} or the {@link ReferencedDocumentItem} that each Delivery might contain.
034 */
035@XmlTransient
036@XmlType(name = "SupplyChainTradeDeliveryType")
037public abstract class CommonDelivery<R extends ReferencedDocument> {
038
039   @XmlElement(name = "ShipToTradeParty")
040   private TradeParty shipTo;
041
042   @XmlElement(name = "UltimateShipToTradeParty")
043   private TradeParty ultimateShipTo;
044
045   @XmlElement(name = "ActualDeliverySupplyChainEvent")
046   @XmlJavaTypeAdapter(value = SupplyChainEventAdapter.class)
047   private ZfDate actualDelivery;
048
049   protected CommonDelivery() {
050      super();
051   }
052
053   /**
054    * Gets the ship to.
055    *
056    * @return the ship to
057    */
058   public TradeParty getShipTo() {
059      return shipTo;
060   }
061
062   /**
063    * Sets the ship to.
064    *
065    * @param shipTo the ship to
066    * @return the delivery
067    */
068   public CommonDelivery<R> setShipTo(TradeParty shipTo) {
069      this.shipTo = shipTo;
070      return this;
071   }
072
073   /**
074    * Gets the ultimate ship to.
075    *
076    * @return the ultimate ship to
077    */
078
079   public TradeParty getUltimateShipTo() {
080      return ultimateShipTo;
081   }
082
083   /**
084    * Sets the ultimate ship to.
085    *
086    * @param ultimateShipTo the ultimate ship to
087    * @return the delivery
088    */
089   public CommonDelivery<R> setUltimateShipTo(TradeParty ultimateShipTo) {
090      this.ultimateShipTo = ultimateShipTo;
091      return this;
092   }
093
094   /**
095    * Gets the actual delivery event.
096    * 
097    * Delivery and performance date in sales tax purposes
098    *
099    * @return the actual event
100    */
101   @Basic
102   public ZfDate getActualDelivery() {
103      return actualDelivery;
104   }
105
106   /**
107    * Sets the actual delivery event.
108    * 
109    * Delivery and performance date in sales tax purposes
110    *
111    * @param actualDelivery the actual delivery
112    * @return the delivery
113    */
114   public CommonDelivery<R> setActualDelivery(ZfDate actualDelivery) {
115      this.actualDelivery = actualDelivery;
116      return this;
117   }
118
119   /**
120    * Gets the despatch advice.
121    *
122    * @return the despatch advice
123    */
124   public abstract R getDespatchAdvice();
125
126   /**
127    * Sets the despatch advice.
128    *
129    * @param despatchAdvice the despatch advice
130    * @return the common delivery
131    */
132   public abstract CommonDelivery<R> setDespatchAdvice(R despatchAdvice);
133
134   /**
135    * Gets the delivery note.
136    *
137    * @return the note
138    */
139   public abstract R getDeliveryNote();
140
141   /**
142    * Sets the delivery note.
143    *
144    * @param deliveryNote the delivery note
145    * @return the delivery
146    */
147   public abstract CommonDelivery<R> setDeliveryNote(R deliveryNote);
148
149}