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.validator.annotation.Comfort; 021import io.konik.validator.annotation.Extended; 022import io.konik.zugferd.entity.CommonDelivery; 023import io.konik.zugferd.entity.Consignment; 024import io.konik.zugferd.entity.ReferencedDocument; 025import io.konik.zugferd.entity.TradeParty; 026import io.konik.zugferd.unqualified.ZfDate; 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 @XmlElement(name = "RelatedSupplyChainConsignment") 043 private Consignment relatedConsignment; 044 045 @XmlElement(name = "ShipFromTradeParty") 046 private TradeParty shipFrom; 047 048 @XmlElement(name = "DespatchAdviceReferencedDocument") 049 private ReferencedDocument despatchAdvice; 050 051 @XmlElement(name = "DeliveryNoteReferencedDocument") 052 private ReferencedDocument deliveryNote; 053 054 Delivery() { 055 super(); 056 } 057 058 /** 059 * The Constructor. 060 * 061 * @param actualDelivery 062 */ 063 public Delivery(ZfDate actualDelivery) { 064 super(); 065 setActualDelivery(actualDelivery); 066 } 067 068 /** 069 * Gets the related consignment. 070 * 071 * @return the related consignment 072 */ 073 @Valid 074 @Extended 075 public Consignment getRelatedConsignment() { 076 return relatedConsignment; 077 } 078 079 /** 080 * Sets the related consignment. 081 * 082 * @param relatedConsignment the related consignment 083 * @return the trade delivery 084 */ 085 public Delivery setRelatedConsignment(Consignment relatedConsignment) { 086 this.relatedConsignment = relatedConsignment; 087 return this; 088 } 089 090 @Valid 091 @Extended 092 @Override 093 public TradeParty getShipTo() { 094 return super.getShipTo(); 095 } 096 097 @Valid 098 @Extended 099 @Override 100 public TradeParty getUltimateShipTo() { 101 return super.getUltimateShipTo(); 102 } 103 /** 104 * Gets the ship from. 105 * 106 * @return the ship from 107 */ 108 @Valid 109 @Extended 110 public TradeParty getShipFrom() { 111 return shipFrom; 112 } 113 114 /** 115 * Sets the ship from. 116 * 117 * @param shipFrom the ship from 118 * @return the trade delivery 119 */ 120 public Delivery setShipFrom(TradeParty shipFrom) { 121 this.shipFrom = shipFrom; 122 return this; 123 } 124 125 @Valid 126 @Extended 127 @Override 128 public ReferencedDocument getDespatchAdvice() { 129 return despatchAdvice; 130 } 131 132 @Override 133 public Delivery setDespatchAdvice(ReferencedDocument despatchAdvice) { 134 this.despatchAdvice = despatchAdvice; 135 return this; 136 } 137 138 @Valid 139 @Comfort 140 @Override 141 public ReferencedDocument getDeliveryNote() { 142 return deliveryNote; 143 } 144 145 @Override 146 public Delivery setDeliveryNote(ReferencedDocument deliveryNote) { 147 this.deliveryNote = deliveryNote; 148 return this; 149 } 150 151}