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;
019
020import io.konik.zugferd.entity.CommonDelivery;
021import io.konik.zugferd.entity.Consignment;
022import io.konik.zugferd.entity.ReferencedDocument;
023import io.konik.zugferd.entity.TradeParty;
024import io.konik.zugferd.unqualified.ZfDate;
025
026import java.util.List;
027
028import javax.validation.Valid;
029import javax.xml.bind.annotation.XmlAccessType;
030import javax.xml.bind.annotation.XmlAccessorType;
031import javax.xml.bind.annotation.XmlElement;
032import javax.xml.bind.annotation.XmlType;
033
034/**
035 * = The trade delivery information.
036 */
037@XmlAccessorType(XmlAccessType.NONE)
038@XmlType(propOrder = { "relatedConsignment", "shipTo", "ultimateShipTo", "shipFrom", "actualDelivery",
039      "despatchAdvice", "deliveryNote" })
040public class Delivery extends CommonDelivery<ReferencedDocument> {
041
042   @Valid
043   @XmlElement(name = "RelatedSupplyChainConsignment")
044   private List<Consignment> relatedConsignment;
045
046   @Valid
047   @XmlElement(name = "ShipFromTradeParty")
048   private TradeParty shipFrom;
049
050   @Valid
051   @XmlElement(name = "DespatchAdviceReferencedDocument")
052   private ReferencedDocument despatchAdvice;
053
054   @Valid
055   @XmlElement(name = "DeliveryNoteReferencedDocument")
056   private ReferencedDocument deliveryNote;
057
058   Delivery() {
059      super();
060   }
061
062   /**
063    * The Constructor.
064    * 
065    * @param actualDelivery
066    */
067   public Delivery(ZfDate actualDelivery) {
068      super();
069      setActualDelivery(actualDelivery);
070   }
071
072   /**
073    * Gets the related consignment.
074    *
075    * @return the related consignment
076    */
077   public List<Consignment> getRelatedConsignment() {
078      return relatedConsignment;
079   }
080
081   /**
082    * Sets the related consignment.
083    *
084    * @param relatedConsignment the related consignment
085    * @return the trade delivery
086    */
087   public Delivery setRelatedConsignment(List<Consignment> relatedConsignment) {
088      this.relatedConsignment = relatedConsignment;
089      return this;
090   }
091
092   /**
093    * Gets the ship from.
094    *
095    * @return the ship from
096    */
097   public TradeParty getShipFrom() {
098      return shipFrom;
099   }
100
101   /**
102    * Sets the ship from.
103    *
104    * @param shipFrom the ship from
105    * @return the trade delivery
106    */
107   public Delivery setShipFrom(TradeParty shipFrom) {
108      this.shipFrom = shipFrom;
109      return this;
110   }
111
112   @Override
113   public ReferencedDocument getDespatchAdvice() {
114      return despatchAdvice;
115   }
116
117   @Override
118   public Delivery setDespatchAdvice(ReferencedDocument despatchAdvice) {
119      this.despatchAdvice = despatchAdvice;
120      return this;
121
122   }
123
124   @Override
125   public ReferencedDocument getDeliveryNote() {
126      return deliveryNote;
127   }
128
129   @Override
130   public Delivery setDeliveryNote(ReferencedDocument deliveryNote) {
131      this.deliveryNote = deliveryNote;
132      return this;
133   }
134
135}