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