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