2 * Copyright (C) 2015 Roland Haeder
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.
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.
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/>.
17 package org.mxchange.jcontactsbusiness.branch;
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;
37 * A POJO for company branch offices
39 * @author Roland Haeder
41 @Entity (name = "company_branches")
42 @Table (name = "company_branches")
43 public class CompanyBranchOffice implements BranchOffice, Comparable<BranchOffice> {
48 private static final long serialVersionUID = 47_957_817_276_871_852L;
51 * Branch office's city name
53 @Basic (optional = false)
54 @Column (name = "branch_city", length = 100, nullable = false)
55 private String branchCity;
58 * Branch office's country code
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;
65 * Branch office's main email address (example: branch-name@company.com)
67 @Column (name = "branch_email_address", length = 100)
68 private String branchEmailAddress;
71 * Branch office's main fax number: +ccxxxxxxxxxx
73 @JoinColumn (name = "branch_fax_number_id")
74 @OneToOne (targetEntity = LandLineNumber.class, cascade = CascadeType.ALL)
75 private DialableFaxNumber branchFaxNumber;
78 * Branch office's house number
80 @Basic (optional = false)
81 @Column (name = "branch_house_number", length = 3, nullable = false)
82 private Short branchHouseNumber;
88 @GeneratedValue (strategy = GenerationType.IDENTITY)
89 @Column (name = "branch_id", length = 20, nullable = false, updatable = false)
90 private Long branchId;
93 * Branch office's main phone number: +ccxxxxxxxxxx
95 @JoinColumn (name = "branch_phone_number_id")
96 @OneToOne (targetEntity = LandLineNumber.class, cascade = CascadeType.ALL)
97 private DialableLandLineNumber branchPhoneNumber;
100 * Branch office's store (if multiple-store building)
102 @Column (name = "branch_store", length = 3)
103 private Short branchStore;
106 * Branch office's street name
108 @Basic (optional = false)
109 @Column (name = "branch_street", length = 100, nullable = false)
110 private String branchStreet;
113 * Branch office's suite number (if applyable)
115 @Column (name = "branch_suite_number", length = 4)
116 private Short branchSuiteNumber;
119 * Branch office's ZIP code
121 @Basic (optional = false)
122 @Column (name = "branch_zip_code", length = 6, nullable = false)
123 private Integer branchZipCode;
126 public int compareTo (final BranchOffice branchOffice) {
127 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
131 public String getBranchCity () {
132 return this.branchCity;
136 public void setBranchCity (final String branchCity) {
137 this.branchCity = branchCity;
141 public Country getBranchCountry () {
142 return this.branchCountry;
146 public void setBranchCountry (final Country branchCountry) {
147 this.branchCountry = branchCountry;
151 public String getBranchEmailAddress () {
152 return this.branchEmailAddress;
156 public void setBranchEmailAddress (final String branchEmailAddress) {
157 this.branchEmailAddress = branchEmailAddress;
161 public DialableFaxNumber getBranchFaxNumber () {
162 return this.branchFaxNumber;
166 public void setBranchFaxNumber (final DialableFaxNumber branchFaxNumber) {
167 this.branchFaxNumber = branchFaxNumber;
171 public Short getBranchHouseNumber () {
172 return this.branchHouseNumber;
176 public void setBranchHouseNumber (final Short branchHouseNumber) {
177 this.branchHouseNumber = branchHouseNumber;
181 public Long getBranchId () {
182 return this.branchId;
186 public void setBranchId (final Long branchId) {
187 this.branchId = branchId;
191 public DialableLandLineNumber getBranchPhoneNumber () {
192 return this.branchPhoneNumber;
196 public void setBranchPhoneNumber (final DialableLandLineNumber branchPhoneNumber) {
197 this.branchPhoneNumber = branchPhoneNumber;
201 public Short getBranchStore () {
202 return this.branchStore;
206 public void setBranchStore (final Short branchStore) {
207 this.branchStore = branchStore;
211 public String getBranchStreet () {
212 return this.branchStreet;
216 public void setBranchStreet (final String branchStreet) {
217 this.branchStreet = branchStreet;
221 public Short getBranchSuiteNumber () {
222 return this.branchSuiteNumber;
226 public void setBranchSuiteNumber (final Short branchSuiteNumber) {
227 this.branchSuiteNumber = branchSuiteNumber;
231 public Integer getBranchZipCode () {
232 return this.branchZipCode;
236 public void setBranchZipCode (final Integer branchZipCode) {
237 this.branchZipCode = branchZipCode;