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    * @return the actual event
098    */
099   @Basic
100   public ZfDate getActualDelivery() {
101      return actualDelivery;
102   }
103
104   /**
105    * Sets the actual delivery event.
106    *
107    * @param actualDelivery the actual delivery
108    * @return the delivery
109    */
110   public CommonDelivery<R> setActualDelivery(ZfDate actualDelivery) {
111      this.actualDelivery = actualDelivery;
112      return this;
113   }
114
115   /**
116    * Gets the despatch advice.
117    *
118    * @return the despatch advice
119    */
120   public abstract R getDespatchAdvice();
121
122   /**
123    * Sets the despatch advice.
124    *
125    * @param despatchAdvice the despatch advice
126    * @return the common delivery
127    */
128   public abstract CommonDelivery<R> setDespatchAdvice(R despatchAdvice);
129
130   /**
131    * Gets the delivery note.
132    *
133    * @return the note
134    */
135   public abstract R getDeliveryNote();
136
137   /**
138    * Sets the delivery note.
139    *
140    * @param deliveryNote the delivery note
141    * @return the delivery
142    */
143   public abstract CommonDelivery<R> setDeliveryNote(R deliveryNote);
144
145}