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.item; 019 020import io.konik.validator.annotation.Extended; 021import io.konik.zugferd.entity.CommonAgreement; 022import io.konik.zugferd.entity.GrossPrice; 023import io.konik.zugferd.entity.Price; 024 025import java.util.ArrayList; 026import java.util.List; 027 028import javax.validation.Valid; 029import javax.xml.bind.annotation.XmlElement; 030import javax.xml.bind.annotation.XmlType; 031 032/** 033 * = The Agreement used on the trade item level. 034 */ 035@XmlType(propOrder = { "buyerOrder", "contract", "additional", "grossPrice", "netPrice", "customerOrder" }) 036public class SpecifiedAgreement implements CommonAgreement<ReferencedDocumentItem, ReferencedDocumentItemAdditional> { 037 038 private ReferencedDocumentItem buyerOrder; 039 private ReferencedDocumentItem contract; 040 private List<ReferencedDocumentItemAdditional> additional; 041 private GrossPrice grossPrice; 042 private Price netPrice; 043 private ReferencedDocumentItem customerOrder; 044 045 046 @Valid 047 @Extended 048 @Override 049 @XmlElement(name = "BuyerOrderReferencedDocument") 050 public ReferencedDocumentItem getBuyerOrder() { 051 return buyerOrder; 052 } 053 054 @Override 055 public SpecifiedAgreement setBuyerOrder(ReferencedDocumentItem buyerOrder) { 056 this.buyerOrder = buyerOrder; 057 return this; 058 } 059 060 @Valid 061 @Extended 062 @Override 063 @XmlElement(name = "ContractReferencedDocument") 064 public ReferencedDocumentItem getContract() { 065 return contract; 066 } 067 068 @Valid 069 @Extended 070 @Override 071 public SpecifiedAgreement setContract(ReferencedDocumentItem contract) { 072 this.contract = contract; 073 return this; 074 } 075 076 @Valid 077 @Extended 078 @Override 079 @XmlElement(name = "AdditionalReferencedDocument") 080 public List<ReferencedDocumentItemAdditional> getAdditional() { 081 if (additional == null) { 082 additional = new ArrayList<ReferencedDocumentItemAdditional>(); 083 } 084 return additional; 085 } 086 087 @Override 088 public SpecifiedAgreement addAdditional(ReferencedDocumentItemAdditional additionalReference) { 089 getAdditional().add(additionalReference); 090 return this; 091 } 092 093 /** 094 * Gets item gross price. 095 * 096 * @return the item gross price 097 */ 098 @Valid 099 @XmlElement(name = "GrossPriceProductTradePrice") 100 public GrossPrice getGrossPrice() { 101 return grossPrice; 102 } 103 104 /** 105 * Sets item gross price. 106 * 107 * @param grossPrice the new the item gross price 108 * @return the specified agreement 109 */ 110 public SpecifiedAgreement setGrossPrice(GrossPrice grossPrice) { 111 this.grossPrice = grossPrice; 112 return this; 113 } 114 115 /** 116 * Gets the net price item price. 117 * 118 * @return the net price product trade price 119 */ 120 @Valid 121 @XmlElement(name = "NetPriceProductTradePrice") 122 public Price getNetPrice() { 123 return netPrice; 124 } 125 126 /** 127 * Sets the net price product trade price. 128 * 129 * @param netPrice the new net price product trade price 130 * @return the supply chain trade agreement 131 */ 132 public SpecifiedAgreement setNetPrice(Price netPrice) { 133 this.netPrice = netPrice; 134 return this; 135 } 136 137 /** 138 * Gets the customer order referenced document. 139 * 140 * @return the customer order referenced document 141 */ 142 @Valid 143 @Extended 144 @Override 145 @XmlElement(name = "CustomerOrderReferencedDocument") 146 public ReferencedDocumentItem getCustomerOrder() { 147 return customerOrder; 148 } 149 150 /** 151 * Sets the customer order referenced document. 152 * 153 * @param customerOrder the new customer order referenced document 154 * @return the supply chain trade agreement 155 */ 156 @Override 157 public SpecifiedAgreement setCustomerOrder(ReferencedDocumentItem customerOrder) { 158 this.customerOrder = customerOrder; 159 return this; 160 } 161 162}