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.jphone.phonenumbers.fax;
19 import javax.persistence.Basic;
20 import javax.persistence.CascadeType;
21 import javax.persistence.Column;
22 import javax.persistence.Entity;
23 import javax.persistence.GeneratedValue;
24 import javax.persistence.GenerationType;
25 import javax.persistence.Id;
26 import javax.persistence.JoinColumn;
27 import javax.persistence.OneToOne;
28 import javax.persistence.Table;
29 import org.mxchange.jcountry.data.Country;
30 import org.mxchange.jcountry.data.CountryData;
33 * A POJO for dialable fax numbers
35 * @author Roland Haeder
37 @Entity (name = "fax_numbers")
38 @Table (name = "fax_numbers")
39 public class FaxNumber implements DialableFaxNumber, Comparable<DialableFaxNumber> {
44 private static final long serialVersionUID = 17_687_687_191_375L;
50 @GeneratedValue (strategy = GenerationType.IDENTITY)
51 @Column (name = "fax_id", length = 20, nullable = false, updatable = false)
55 * Fax number without prefix
57 @Basic (optional = false)
58 @Column (name = "fax_number", length = 20, nullable = false)
59 private Long phoneNumber;
62 * Area code (example: 2151 for Krefeld)
64 @Basic (optional = false)
65 @Column (name = "fax_area_code", length = 10, nullable = false)
66 private Integer phoneAreaCode;
69 * Country instance ('s dial data)
71 @JoinColumn (name = "fax_country_id", nullable = false)
72 @OneToOne (targetEntity = CountryData.class, optional = false, cascade = CascadeType.ALL)
73 private Country country;
76 public Long getPhoneId () {
81 public void setPhoneId (final Long phoneId) {
82 this.phoneId = phoneId;
86 public Long getPhoneNumber () {
87 return this.phoneNumber;
91 public void setPhoneNumber (final Long phoneNumber) {
92 this.phoneNumber = phoneNumber;
96 public int compareTo (final DialableFaxNumber dialableFaxNumber) {
97 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
101 public Integer getPhoneAreaCode () {
102 return this.phoneAreaCode;
106 public void setPhoneAreaCode (final Integer phoneAreaCode) {
107 this.phoneAreaCode = phoneAreaCode;
111 public Country getCountry () {
116 public void setCountry (final Country country) {
117 this.country = country;