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; 019 020import io.konik.jaxb.bindable.entity.UniversalCommunicationAdapter; 021import io.konik.validator.annotation.Email; 022import io.konik.validator.annotation.Extended; 023import io.konik.validator.annotation.ValidContact; 024 025import javax.xml.bind.annotation.XmlElement; 026import javax.xml.bind.annotation.XmlType; 027import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; 028import java.io.Serializable; 029 030/** 031 * = The Trade Contact 032 * 033 * An individual with contact information. 034 */ 035@XmlType(name = "TradeContactType", propOrder = { "name", "department", "telephone", "fax", "email" }) 036@ValidContact 037public class Contact implements Serializable { 038 039 @XmlElement(name = "PersonName") 040 private String name; 041 042 @XmlElement(name = "DepartmentName") 043 private String department; 044 045 @XmlElement(name = "TelephoneUniversalCommunication") 046 @XmlJavaTypeAdapter(value = UniversalCommunicationAdapter.class) 047 private String telephone; 048 049 @XmlElement(name = "FaxUniversalCommunication") 050 @XmlJavaTypeAdapter(value = UniversalCommunicationAdapter.class) 051 private String fax; 052 053 @XmlElement(name = "EmailURIUniversalCommunication") 054 @XmlJavaTypeAdapter(value = UniversalCommunicationAdapter.class) 055 private String email; 056 057 /** 058 * Instantiates a new contact. 059 */ 060 public Contact() { 061 } 062 063 /** 064 * Instantiates a new trade contact. 065 * 066 * @param contactName the person first and last name 067 * @param departmentName the department name 068 * @param telephone the telephone number 069 * @param fax the fax number 070 * @param email the email 071 */ 072 public Contact(String contactName, String departmentName, String telephone, String fax, String email) { 073 this.name = contactName; 074 this.department = departmentName; 075 this.telephone = telephone; 076 this.fax = fax; 077 this.email = email; 078 } 079 080 /** 081 * Gets the contact person name. 082 * 083 * @return the person name 084 */ 085 @Extended 086 public String getName() { 087 return name; 088 } 089 090 /** 091 * Sets the contact person name. 092 * 093 * @param name the new person name 094 * @return the contact 095 */ 096 public Contact setName(String name) { 097 this.name = name; 098 return this; 099 } 100 101 /** 102 * Gets the department name. 103 * 104 * @return the department name 105 */ 106 @Extended 107 public String getDepartment() { 108 return department; 109 } 110 111 /** 112 * Sets the department name. 113 * 114 * @param department the new department name 115 * @return the contact 116 */ 117 public Contact setDepartment(String department) { 118 this.department = department; 119 return this; 120 } 121 122 /** 123 * Gets the telephone number. 124 * 125 * Example:: +{plus}49 (123) 456789-999+ 126 * 127 * @return the telephone universal communication 128 */ 129 @Extended 130 public String getTelephone() { 131 return telephone; 132 } 133 134 /** 135 * Sets the telephone number providing the string only. 136 * 137 * Example:: +{plus}49 (123) 456789-999+ 138 * 139 * @param telephone the new telephone universal communication 140 * @return the contact 141 */ 142 public Contact setTelephone(String telephone) { 143 this.telephone = telephone; 144 return this; 145 } 146 147 /** 148 * Gets the Fax number. 149 * 150 * Example:: +{plus}49 (123) 456789-999+ 151 * 152 * @return the Fax number 153 */ 154 @Extended 155 public String getFax() { 156 return fax; 157 } 158 159 /** 160 * Sets the telephone number providing the string only. 161 * 162 * Example:: +{plus}49 (123) 456789-999+ 163 * 164 * @param faxNumber the new fax number 165 * @return the contact 166 */ 167 public Contact setFax(String faxNumber) { 168 this.fax = faxNumber; 169 return this; 170 } 171 172 /** 173 * Gets the email contacts E-mail address. 174 * 175 * Example:: +example@konik.io+ 176 * 177 * @return the email address 178 */ 179 @Email 180 @Extended 181 public String getEmail() { 182 return email; 183 } 184 185 /** 186 * Sets the email contacts E-mail address. 187 * 188 * Example:: +example@konik.io+ 189 * 190 * @param email the new email 191 * @return the contact 192 */ 193 public Contact setEmail(String email) { 194 this.email = email; 195 return this; 196 } 197}