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; 020 021import io.konik.zugferd.entity.Context; 022import io.konik.zugferd.entity.Header; 023import io.konik.zugferd.entity.Trade; 024import io.konik.zugferd.profile.Profile; 025 026import javax.validation.constraints.NotNull; 027import javax.xml.bind.annotation.XmlAccessType; 028import javax.xml.bind.annotation.XmlAccessorType; 029import javax.xml.bind.annotation.XmlElement; 030import javax.xml.bind.annotation.XmlRootElement; 031import javax.xml.bind.annotation.XmlType; 032 033/** 034 * = ZUGFeRD Invoice Model. 035 */ 036@XmlRootElement(name = "Invoice") 037@XmlAccessorType(XmlAccessType.FIELD) 038@XmlType(propOrder = { "context", "header", "trade" }) 039public class Invoice { 040 041 /** The context. Groups properties of the xml message. */ 042 @NotNull 043 @XmlElement(name = "SpecifiedExchangedDocumentContext") 044 private Context context; 045 046 /** The document related header information. */ 047 @NotNull 048 @XmlElement(name = "HeaderExchangedDocument") 049 private Header header; 050 051 /** The trade transactions. */ 052 @NotNull 053 @XmlElement(name = "SpecifiedSupplyChainTradeTransaction") 054 private Trade trade; 055 056 /** 057 * Creates a new invoice. 058 */ 059 Invoice() { 060 this.context = new Context(); 061 this.header = new Header(); 062 } 063 064 /** 065 * Instantiates a new invoice with a invoice profile. 066 * 067 * @param profile the profile 068 */ 069 public Invoice(Profile profile) { 070 this.context = new Context(profile); 071 this.header = new Header(); 072 } 073 074 /** 075 * Gets the specified exchanged document context. 076 * 077 * @return the exchanged document context 078 */ 079 public Context getContext() { 080 return context; 081 } 082 083 /** 084 * Sets the exchanged document context. 085 * 086 * @param context the new exchanged document context 087 * @return the invoice 088 */ 089 public Invoice setContext(Context context) { 090 this.context = context; 091 return this; 092 } 093 094 /** 095 * Gets the document header 096 * 097 * @return the exchange document header 098 */ 099 public Header getHeader() { 100 return header; 101 } 102 103 /** 104 * Sets the header. 105 * 106 * @param header the new exchange document header 107 * @return the invoice 108 */ 109 public Invoice setHeader(Header header) { 110 this.header = header; 111 return this; 112 } 113 114 /** 115 * Gets the trade. 116 * 117 * @return the trade 118 */ 119 public Trade getTrade() { 120 return trade; 121 } 122 123 /** 124 * Sets the trade. 125 * 126 * @param trade the new trade 127 * @return the invoice 128 */ 129 public Invoice setTrade(Trade trade) { 130 this.trade = trade; 131 return this; 132 } 133 134 135 136}