001/* 002 * Copyright (C) 2014 konik.io 003 * 004 * This file is part of Konik library. 005 * 006 * Konik library is free software: you can redistribute it and/or modify 007 * it under the terms of the GNU Affero General Public License as published by 008 * the Free Software Foundation, either version 3 of the License, or 009 * (at your option) any later version. 010 * 011 * Konik library is distributed in the hope that it will be useful, 012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 014 * GNU Affero General Public License for more details. 015 * 016 * You should have received a copy of the GNU Affero General Public License 017 * along with Konik library. If not, see <http://www.gnu.org/licenses/>. 018 */ 019package io.konik.zugferd.entity; 020 021import javax.validation.Valid; 022import javax.validation.constraints.NotNull; 023import javax.xml.bind.annotation.XmlAccessType; 024import javax.xml.bind.annotation.XmlAccessorType; 025import javax.xml.bind.annotation.XmlElement; 026import javax.xml.bind.annotation.XmlType; 027 028/** 029 * = The Trade Agreement 030 */ 031@XmlAccessorType(XmlAccessType.FIELD) 032@XmlType(name = "SupplyChainTradeAgreementType", propOrder = { "buyerReference", "seller", "buyer", 033 "buyerOrder", "contract", "grossPrice", "netPrice", "customerOrder" }) 034public class Agreement { 035 036 @XmlElement(name = "BuyerReference") 037 private String buyerReference; 038 039 @NotNull@Valid 040 @XmlElement(name = "SellerTradeParty") 041 private TradeParty seller; 042 043 @Valid 044 @XmlElement(name = "BuyerTradeParty") 045 private TradeParty buyer; 046 047 @Valid 048 @XmlElement(name = "BuyerOrderReferencedDocument") 049 private ReferencedDocument buyerOrder; 050 051 @Valid 052 @XmlElement(name = "ContractReferencedDocument") 053 private ReferencedDocument contract; 054 055 @Valid 056 @XmlElement(name = "GrossPriceProductTradePrice") 057 private Price grossPrice; 058 059 @Valid 060 @XmlElement(name = "NetPriceProductTradePrice") 061 private Price netPrice; 062 063 @Valid 064 @XmlElement(name = "CustomerOrderReferencedDocument") 065 private ReferencedDocument customerOrder; 066 067 /** 068 * Instantiates a new supply chain trade agreement with basic parameters. 069 * 070 * @param sellerTradeParty the seller trade party 071 * @param buyerTradeParty the buyer trade party 072 * @param buyerOrderReferencedDocument the buyer order referenced document 073 */ 074 public Agreement(TradeParty sellerTradeParty, TradeParty buyerTradeParty, 075 ReferencedDocument buyerOrderReferencedDocument) { 076 super(); 077 this.seller = sellerTradeParty; 078 this.buyer = buyerTradeParty; 079 this.buyerOrder = buyerOrderReferencedDocument; 080 } 081 082 /** Instantiates a new supply chain trade agreement. */ 083 public Agreement() { 084 } 085 086 /** 087 * Gets the buyer reference. 088 * 089 * The reference to ease the attribution for the buyer 090 * 091 * Profile:: COMFORT when part of {@link Trade} 092 * 093 * 094 * @return the buyer reference 095 */ 096 public String getBuyerReference() { 097 return buyerReference; 098 } 099 100 /** 101 * Sets the buyer reference. 102 * 103 * The reference to ease the attribution for the buyer 104 * 105 * Profile:: COMFORT when part of {@link Trade} 106 * 107 * @param buyerReference the new buyer reference 108 * @return the trade agreement 109 */ 110 public Agreement setBuyerReference(String buyerReference) { 111 this.buyerReference = buyerReference; 112 return this; 113 } 114 115 /** 116 * Gets the seller trade party. 117 * 118 * @return the seller trade party 119 */ 120 public TradeParty getSellerTradeParty() { 121 return seller; 122 } 123 124 /** 125 * Sets the seller trade party. 126 * 127 * @param seller the new seller trade party 128 * @return the trade agreement 129 */ 130 public Agreement setSellerTradeParty(TradeParty seller) { 131 this.seller = seller; 132 return this; 133 } 134 135 /** 136 * Gets the buyer trade party. 137 * 138 * @return the buyer trade party 139 */ 140 public TradeParty getBuyerTradeParty() { 141 return buyer; 142 } 143 144 /** 145 * Sets the buyer trade party. 146 * 147 * @param buyer the new buyer trade party 148 * @return the supply chain trade agreement 149 */ 150 public Agreement setBuyerTradeParty(TradeParty buyer) { 151 this.buyer = buyer; 152 return this; 153 } 154 155 /** 156 * Gets the buyer order referenced document. 157 * 158 * @return the buyer order referenced document 159 */ 160 public ReferencedDocument getBuyerOrder() { 161 return buyerOrder; 162 } 163 164 /** 165 * Sets the buyer order referenced document. 166 * 167 * @param buyerOrder the new buyer order referenced document 168 * @return the supply chain trade agreement 169 */ 170 public Agreement setBuyerOrder(ReferencedDocument buyerOrder) { 171 this.buyerOrder = buyerOrder; 172 return this; 173 } 174 175 /** 176 * Gets the contract referenced document. 177 * 178 * Profile:: COMFORT 179 * 180 * @return the contract referenced document 181 */ 182 public ReferencedDocument getContract() { 183 return contract; 184 } 185 186 /** 187 * Sets the contract referenced document. 188 * 189 * Profile:: COMFORT 190 * 191 * @param contract the new contract referenced document 192 * @return the supply chain trade agreement 193 */ 194 public Agreement setContract(ReferencedDocument contract) { 195 this.contract = contract; 196 return this; 197 } 198 199 /** 200 * Gets the gross price product trade price. 201 * 202 * @return the gross price product trade price 203 */ 204 public Price getGrossPriceProduct() { 205 return grossPrice; 206 } 207 208 /** 209 * Sets the gross price product trade price. 210 * 211 * @param grossPrice the new gross price product trade price 212 * @return the supply chain trade agreement 213 */ 214 public Agreement setGrossPriceProduct(Price grossPrice) { 215 this.grossPrice = grossPrice; 216 return this; 217 } 218 219 /** 220 * Gets the net price product trade price. 221 * 222 * @return the net price product trade price 223 */ 224 public Price getNetPriceProduct() { 225 return netPrice; 226 } 227 228 /** 229 * Sets the net price product trade price. 230 * 231 * @param netPrice the new net price product trade price 232 * @return the supply chain trade agreement 233 */ 234 public Agreement setNetPriceProduct(Price netPrice) { 235 this.netPrice = netPrice; 236 return this; 237 } 238 239 /** 240 * Gets the customer order referenced document. 241 * 242 * Profile:: COMFORT 243 * 244 * @return the customer order referenced document 245 */ 246 public ReferencedDocument getCustomerOrder() { 247 return customerOrder; 248 } 249 250 /** 251 * Sets the customer order referenced document. 252 * 253 * Profile:: COMFORT 254 * 255 * @param customerOrder the new customer order referenced document 256 * @return the supply chain trade agreement 257 */ 258 public Agreement setCustomerOrder(ReferencedDocument customerOrder) { 259 this.customerOrder = customerOrder; 260 return this; 261 } 262 263}