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.xml.bind.annotation.XmlAccessType; 022import javax.xml.bind.annotation.XmlAccessorType; 023import javax.xml.bind.annotation.XmlElement; 024import javax.xml.bind.annotation.XmlType; 025import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; 026import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; 027 028/** 029 * = The Address 030 * 031 * The postal address of an entity. 032 */ 033@XmlAccessorType(XmlAccessType.FIELD) 034@XmlType(name = "TradeAddressType", propOrder = { "postcode", "lineOne", "lineTwo", "city", "countryCode" }) 035public class Address { 036 037 @XmlElement(name = "PostcodeCode") 038 @XmlJavaTypeAdapter(CollapsedStringAdapter.class) 039 private String postcode; 040 041 @XmlElement(name = "LineOne") 042 private String lineOne; 043 044 @XmlElement(name = "LineTwo") 045 private String lineTwo; 046 047 @XmlElement(name = "CityName") 048 private String city; 049 050 @XmlElement(name = "CountryID") 051 @XmlJavaTypeAdapter(CollapsedStringAdapter.class) 052 private String countryCode; 053 054 /** Instantiates a new trade address. */ 055 public Address() { 056 } 057 058 /** 059 * Instantiates a new trade address. 060 * 061 * @param postcode the postcode 062 * @param lineOne the line one 063 * @param lineTwo the line two 064 * @param cityName the city name 065 * @param countryCode the ISO 3166-2A country code 066 */ 067 public Address(String postcode, String lineOne, String lineTwo, String cityName, String countryCode) { 068 super(); 069 this.postcode = postcode; 070 this.lineOne = lineOne; 071 this.lineTwo = lineTwo; 072 this.city = cityName; 073 this.countryCode = countryCode; 074 } 075 076 /** 077 * Instantiates a new trade address. 078 * 079 * @param postcode the postal code 080 * @param lineOne the line one 081 * @param cityName the city name 082 * @param countryCode the ISO 3166-2A country code 083 */ 084 public Address(String postcode, String lineOne, String cityName, String countryCode) { 085 super(); 086 this.postcode = postcode; 087 this.lineOne = lineOne; 088 this.city = cityName; 089 this.countryCode = countryCode; 090 } 091 092 /** 093 * Gets the postcode. 094 * 095 * Profile:: BASIC when part of Trade.agreements.seller. 096 * 097 * Example:: {@code DE-123456} 098 * 099 * @return the postcode 100 */ 101 public String getPostcode() { 102 return postcode; 103 } 104 105 /** 106 * Sets the postcode code. 107 * 108 * Profile:: BASIC when part of Trade.agreements.seller. 109 * 110 * Example:: {@code DE-123456} 111 * @param postcode the postcode 112 * @return the trade address 113 */ 114 public Address setPostcode(String postcode) { 115 this.postcode = postcode; 116 return this; 117 } 118 119 /** 120 * Gets the line one. Usually the Street name. 121 * 122 * Profile:: BASIC when part of Trade.agreements.seller. 123 * 124 * Example:: {@code Elm Street 13} 125 * 126 * @return the line one 127 */ 128 public String getLineOne() { 129 return lineOne; 130 } 131 132 /** 133 * Sets the line one. Usually the Street name. 134 * 135 * Profile:: BASIC when part of Trade.agreements.seller. 136 * 137 * Example:: {@code Elm Street 13} 138 * 139 * @param lineOne the new line one 140 * @return the trade address 141 */ 142 public Address setLineOne(String lineOne) { 143 this.lineOne = lineOne; 144 return this; 145 } 146 147 /** 148 * Gets the line two. Location like Building name or department. 149 * 150 * Profile:: BASIC when part of Trade.agreements.seller. 151 * 152 * Example:: {@code Department of broken dreams} 153 * 154 * @return the line two 155 */ 156 public String getLineTwo() { 157 return lineTwo; 158 } 159 160 /** 161 * Sets the line two.. Location like Building name or department. 162 * 163 * Profile:: BASIC when part of Trade.agreements.seller. 164 * 165 * Example:: {@code Department of broken dreams} 166 * 167 * @param lineTwo the new line two 168 * @return the trade address 169 */ 170 public Address setLineTwo(String lineTwo) { 171 this.lineTwo = lineTwo; 172 return this; 173 } 174 175 /** 176 * Gets the city name. 177 * 178 * Profile:: BASIC when part of Trade.agreements.seller. 179 * 180 * Example:: {@code Zürich} 181 * 182 * @return the city name 183 */ 184 public String getCity() { 185 return city; 186 } 187 188 /** 189 * Sets the city name. 190 * 191 * Profile:: BASIC when part of Trade.agreements.seller. 192 * 193 * Example:: {@code Zürich} 194 * 195 * @param cityName the new city name 196 * @return the trade address 197 */ 198 public Address setCity(String cityName) { 199 this.city = cityName; 200 return this; 201 } 202 203 /** 204 * Gets the country id. 205 206 * Two-letter country codes defined in ISO 3166-1, 207 208 * Profile:: BASIC when part of Trade.agreements.seller. 209 210 * Example:: {@code CH} 211 * 212 * @return the ISO 3166-2A country code 213 * @see <a href="http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2">ISO 3166-2A Country Codes</a> 214 */ 215 public String getCountryId() { 216 return countryCode; 217 } 218 219 /** 220 * Sets the country code. 221 * 222 * Two-letter country codes defined in ISO 3166-1, 223 * 224 * Profile:: BASIC when part of Trade.agreements.seller. 225 * 226 * Example:: {@code CH} 227 * 228 * @param countryCode the country code 229 * @return the trade address 230 * @see <a href="http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2">ISO 3166-2A Country Codes</a> 231 */ 232 public Address setCountryId(String countryCode) { 233 this.countryCode = countryCode; 234 return this; 235 } 236}