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