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.jaxb.bindable.entity.AccountingAccountAdapter; 021import io.konik.validator.annotation.Comfort; 022import io.konik.validator.annotation.Extended; 023import io.konik.zugferd.entity.CommonSettlement; 024import io.konik.zugferd.entity.Period; 025 026import javax.validation.Valid; 027import javax.xml.bind.annotation.XmlElement; 028import javax.xml.bind.annotation.XmlType; 029import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; 030import java.util.ArrayList; 031import java.util.List; 032 033/** 034 * = The Trade Item Settlement 035 * 036 * Contains payment related information on an Item basis. 037 */ 038@XmlType(propOrder = { "tradeTax", "billingPeriod", "bookingReference", "monetarySummation" }) 039public class SpecifiedSettlement implements CommonSettlement<ItemTax, SpecifiedMonetarySummation> { 040 041 @XmlElement(name = "ApplicableTradeTax") 042 private List<ItemTax> tradeTax; 043 044 @XmlElement(name = "BillingSpecifiedPeriod") 045 private Period billingPeriod; 046 047 @XmlElement(name = "SpecifiedTradeAccountingAccount") 048 @XmlJavaTypeAdapter(AccountingAccountAdapter.class) 049 private String bookingReference; 050 051 052 @XmlElement(name = "SpecifiedTradeSettlementMonetarySummation") 053 private SpecifiedMonetarySummation monetarySummation; 054 055 @Valid 056 @Override 057 public List<ItemTax> getTradeTax() { 058 if (tradeTax == null) { 059 tradeTax = new ArrayList<ItemTax>(); 060 } 061 return this.tradeTax; 062 } 063 064 @Override 065 public SpecifiedSettlement addTradeTax(ItemTax additionalTradeTax) { 066 getTradeTax().add(additionalTradeTax); 067 return this; 068 } 069 070 @Extended 071 @Valid 072 @Override 073 public Period getBillingPeriod() { 074 return billingPeriod; 075 } 076 077 @Override 078 public SpecifiedSettlement setBillingPeriod(Period billingPeriod) { 079 this.billingPeriod = billingPeriod; 080 return this; 081 } 082 083 /** 084 * Gets the specified booking reference. 085 * 086 * @return the specified booking reference 087 */ 088 @Extended 089 public String getBookingReference() { 090 return bookingReference; 091 } 092 093 /** 094 * Sets the specified booking reference. 095 * 096 * @param specifiedBookingReference the specified booking reference 097 * @return the specified settlement 098 */ 099 public SpecifiedSettlement setBookingReference(String specifiedBookingReference) { 100 this.bookingReference = specifiedBookingReference; 101 return this; 102 } 103 104 @Override 105 @Comfort 106 public SpecifiedMonetarySummation getMonetarySummation() { 107 return monetarySummation; 108 } 109 110 @Override 111 public SpecifiedSettlement setMonetarySummation(SpecifiedMonetarySummation monetarySummation) { 112 this.monetarySummation = monetarySummation; 113 return this; 114 } 115}