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.zugferd.entity.trade.item.ReferencedDocumentItem;
022import io.konik.zugferd.unqualified.ZfDate;
023
024import javax.validation.Valid;
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   @Valid
040   @XmlElement(name = "ShipToTradeParty")
041   private TradeParty shipTo;
042
043   @Valid
044   @XmlElement(name = "UltimateShipToTradeParty")
045   private TradeParty ultimateShipTo;
046
047   @Valid
048   @XmlElement(name = "ActualDeliverySupplyChainEvent")
049   @XmlJavaTypeAdapter(value = SupplyChainEventAdapter.class)
050   private ZfDate actualDelivery;
051
052   protected CommonDelivery() {
053      super();
054   }
055
056   /**
057    * Gets the ship to.
058    *
059    * @return the ship to
060    */
061
062   public TradeParty getShipTo() {
063      return shipTo;
064   }
065
066   /**
067    * Sets the ship to.
068    *
069    * @param shipTo the ship to
070    * @return the delivery
071    */
072   public CommonDelivery<R> setShipTo(TradeParty shipTo) {
073      this.shipTo = shipTo;
074      return this;
075   }
076
077   /**
078    * Gets the ultimate ship to.
079    *
080    * @return the ultimate ship to
081    */
082
083   public TradeParty getUltimateShipTo() {
084      return ultimateShipTo;
085   }
086
087   /**
088    * Sets the ultimate ship to.
089    *
090    * @param ultimateShipTo the ultimate ship to
091    * @return the delivery
092    */
093   public CommonDelivery<R> setUltimateShipTo(TradeParty ultimateShipTo) {
094      this.ultimateShipTo = ultimateShipTo;
095      return this;
096   }
097
098   /**
099    * Gets the actual delivery event.
100    *
101    * @return the actual event
102    */
103   public ZfDate getActualDelivery() {
104      return actualDelivery;
105   }
106
107   /**
108    * Sets the actual delivery event.
109    *
110    * @param actualDelivery the actual delivery
111    * @return the delivery
112    */
113   public CommonDelivery<R> setActualDelivery(ZfDate actualDelivery) {
114      this.actualDelivery = actualDelivery;
115      return this;
116   }
117
118   /**
119    * Gets the despatch advice.
120    *
121    * @return the despatch advice
122    */
123   public abstract R getDespatchAdvice();
124
125   /**
126    * Sets the despatch advice.
127    *
128    * @param despatchAdvice the despatch advice
129    * @return
130    */
131   public abstract CommonDelivery<R> setDespatchAdvice(R despatchAdvice);
132
133   /**
134    * Gets the delivery note.
135    *
136    * @return the note
137    */
138   public abstract R getDeliveryNote();
139
140   /**
141    * Sets the delivery note.
142    *
143    * @param deliveryNote the delivery note
144    * @return the delivery
145    */
146   public abstract CommonDelivery<R> setDeliveryNote(R deliveryNote);
147
148}