]> git.mxchange.org Git - jcontacts-business-core.git/blob - src/org/mxchange/jcontactsbusiness/branch/CompanyBranchOffice.java
Rewrite:
[jcontacts-business-core.git] / src / org / mxchange / jcontactsbusiness / branch / CompanyBranchOffice.java
1 /*
2  * Copyright (C) 2015 Roland Haeder
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  */
17 package org.mxchange.jcontactsbusiness.branch;
18
19 import javax.persistence.Basic;
20 import javax.persistence.CascadeType;
21 import javax.persistence.Column;
22 import javax.persistence.Entity;
23 import javax.persistence.FetchType;
24 import javax.persistence.GeneratedValue;
25 import javax.persistence.GenerationType;
26 import javax.persistence.Id;
27 import javax.persistence.JoinColumn;
28 import javax.persistence.OneToOne;
29 import javax.persistence.Table;
30 import org.mxchange.jcountry.data.Country;
31 import org.mxchange.jcountry.data.CountryData;
32 import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
33 import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
34 import org.mxchange.jphone.phonenumbers.landline.LandLineNumber;
35
36 /**
37  * A POJO for company branch offices
38  * <p>
39  * @author Roland Haeder
40  */
41 @Entity (name = "company_branches")
42 @Table (name = "company_branches")
43 public class CompanyBranchOffice implements BranchOffice, Comparable<BranchOffice> {
44
45         /**
46          * Serial number
47          */
48         private static final long serialVersionUID = 47_957_817_276_871_852L;
49
50         /**
51          * Branch office's city name
52          */
53         @Basic (optional = false)
54         @Column (name = "branch_city", length = 100, nullable = false)
55         private String branchCity;
56
57         /**
58          * Branch office's country code
59          */
60         @JoinColumn (name = "branch_country_id", nullable = false)
61         @OneToOne (targetEntity = CountryData.class, cascade = CascadeType.ALL, optional = false, fetch = FetchType.EAGER)
62         private transient Country branchCountry;
63
64         /**
65          * Branch office's main email address (example: branch-name@company.com)
66          */
67         @Column (name = "branch_email_address", length = 100)
68         private String branchEmailAddress;
69
70         /**
71          * Branch office's main fax number: +ccxxxxxxxxxx
72          */
73         @JoinColumn (name = "branch_fax_number_id")
74         @OneToOne (targetEntity = LandLineNumber.class, cascade = CascadeType.ALL)
75         private DialableFaxNumber branchFaxNumber;
76
77         /**
78          * Branch office's house number
79          */
80         @Basic (optional = false)
81         @Column (name = "branch_house_number", length = 3, nullable = false)
82         private Short branchHouseNumber;
83
84         /**
85          * Id number
86          */
87         @Id
88         @GeneratedValue (strategy = GenerationType.IDENTITY)
89         @Column (name = "branch_id", length = 20, nullable = false, updatable = false)
90         private Long branchId;
91
92         /**
93          * Branch office's main phone number: +ccxxxxxxxxxx
94          */
95         @JoinColumn (name = "branch_phone_number_id")
96         @OneToOne (targetEntity = LandLineNumber.class, cascade = CascadeType.ALL)
97         private DialableLandLineNumber branchPhoneNumber;
98
99         /**
100          * Branch office's store (if multiple-store building)
101          */
102         @Column (name = "branch_store", length = 3)
103         private Short branchStore;
104
105         /**
106          * Branch office's street name
107          */
108         @Basic (optional = false)
109         @Column (name = "branch_street", length = 100, nullable = false)
110         private String branchStreet;
111
112         /**
113          * Branch office's suite number (if applyable)
114          */
115         @Column (name = "branch_suite_number", length = 4)
116         private Short branchSuiteNumber;
117
118         /**
119          * Branch office's ZIP code
120          */
121         @Basic (optional = false)
122         @Column (name = "branch_zip_code", length = 6, nullable = false)
123         private Integer branchZipCode;
124
125         @Override
126         public int compareTo (final BranchOffice branchOffice) {
127                 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
128         }
129
130         @Override
131         public String getBranchCity () {
132                 return this.branchCity;
133         }
134
135         @Override
136         public void setBranchCity (final String branchCity) {
137                 this.branchCity = branchCity;
138         }
139
140         @Override
141         public Country getBranchCountry () {
142                 return this.branchCountry;
143         }
144
145         @Override
146         public void setBranchCountry (final Country branchCountry) {
147                 this.branchCountry = branchCountry;
148         }
149
150         @Override
151         public String getBranchEmailAddress () {
152                 return this.branchEmailAddress;
153         }
154
155         @Override
156         public void setBranchEmailAddress (final String branchEmailAddress) {
157                 this.branchEmailAddress = branchEmailAddress;
158         }
159
160         @Override
161         public DialableFaxNumber getBranchFaxNumber () {
162                 return this.branchFaxNumber;
163         }
164
165         @Override
166         public void setBranchFaxNumber (final DialableFaxNumber branchFaxNumber) {
167                 this.branchFaxNumber = branchFaxNumber;
168         }
169
170         @Override
171         public Short getBranchHouseNumber () {
172                 return this.branchHouseNumber;
173         }
174
175         @Override
176         public void setBranchHouseNumber (final Short branchHouseNumber) {
177                 this.branchHouseNumber = branchHouseNumber;
178         }
179
180         @Override
181         public Long getBranchId () {
182                 return this.branchId;
183         }
184
185         @Override
186         public void setBranchId (final Long branchId) {
187                 this.branchId = branchId;
188         }
189
190         @Override
191         public DialableLandLineNumber getBranchPhoneNumber () {
192                 return this.branchPhoneNumber;
193         }
194
195         @Override
196         public void setBranchPhoneNumber (final DialableLandLineNumber branchPhoneNumber) {
197                 this.branchPhoneNumber = branchPhoneNumber;
198         }
199
200         @Override
201         public Short getBranchStore () {
202                 return this.branchStore;
203         }
204
205         @Override
206         public void setBranchStore (final Short branchStore) {
207                 this.branchStore = branchStore;
208         }
209
210         @Override
211         public String getBranchStreet () {
212                 return this.branchStreet;
213         }
214
215         @Override
216         public void setBranchStreet (final String branchStreet) {
217                 this.branchStreet = branchStreet;
218         }
219
220         @Override
221         public Short getBranchSuiteNumber () {
222                 return this.branchSuiteNumber;
223         }
224
225         @Override
226         public void setBranchSuiteNumber (final Short branchSuiteNumber) {
227                 this.branchSuiteNumber = branchSuiteNumber;
228         }
229
230         @Override
231         public Integer getBranchZipCode () {
232                 return this.branchZipCode;
233         }
234
235         @Override
236         public void setBranchZipCode (final Integer branchZipCode) {
237                 this.branchZipCode = branchZipCode;
238         }
239 }