]> git.mxchange.org Git - jphone-core.git/commitdiff
added country instance to all number types and cell phone provider
authorRoland Haeder <roland@mxchange.org>
Sat, 10 Oct 2015 20:51:23 +0000 (22:51 +0200)
committerRoland Haeder <roland@mxchange.org>
Sat, 10 Oct 2015 20:51:23 +0000 (22:51 +0200)
src/org/mxchange/jphone/phonenumbers/DialableNumber.java
src/org/mxchange/jphone/phonenumbers/cellphone/CellphoneNumber.java
src/org/mxchange/jphone/phonenumbers/fax/FaxNumber.java
src/org/mxchange/jphone/phonenumbers/landline/LandLineNumber.java
src/org/mxchange/jphone/phonenumbers/smsprovider/CellphoneProvider.java
src/org/mxchange/jphone/phonenumbers/smsprovider/SmsProvider.java

index e7393cdcf3efac0f19e9bcfe48c90635c3c7d3dd..2c157f6faaba4d2f7cba88a6c3e54ac54d3a3a7b 100644 (file)
@@ -17,6 +17,7 @@
 package org.mxchange.jphone.phonenumbers;
 
 import java.io.Serializable;
+import org.mxchange.jcountry.data.Country;
 
 /**
  * A POJO for dialable numbers
@@ -25,6 +26,20 @@ import java.io.Serializable;
  */
 public interface DialableNumber extends Serializable {
 
+       /**
+        * Getter for country instance ('s dial data)
+        * <p>
+        * @return Country instance
+        */
+       public Country getCountry ();
+
+       /**
+        * Setter for country instance ('s dial data)
+        * <p>
+        * @param country Country instance
+        */
+       public void setCountry (final Country country);
+
        /**
         * Getter for id number
         * <p>
index 691b4b38d7b3e11012ec9972233bb75cd462e01e..d06a3bb2b6af7a21876a5498d25ae1263e9df436 100644 (file)
@@ -26,6 +26,8 @@ import javax.persistence.Id;
 import javax.persistence.JoinColumn;
 import javax.persistence.OneToOne;
 import javax.persistence.Table;
+import org.mxchange.jcountry.data.Country;
+import org.mxchange.jcountry.data.CountryData;
 import org.mxchange.jphone.phonenumbers.smsprovider.CellphoneProvider;
 import org.mxchange.jphone.phonenumbers.smsprovider.SmsProvider;
 
@@ -65,6 +67,13 @@ public class CellphoneNumber implements DialableCellphoneNumber, Comparable<Dial
        @Column (name = "cellphone_number", length = 20, nullable = false)
        private Long phoneNumber;
 
+       /**
+        * Country instance ('s dial data)
+        */
+       @JoinColumn (name = "cellphone_country_id", nullable = false)
+       @OneToOne (targetEntity = CountryData.class, optional = false, cascade = CascadeType.ALL)
+       private Country country;
+
        @Override
        public Long getPhoneId () {
                return this.phoneId;
@@ -109,4 +118,14 @@ public class CellphoneNumber implements DialableCellphoneNumber, Comparable<Dial
        public int compareTo (final DialableCellphoneNumber dialableCellphoneNumber) {
                throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }
+
+       @Override
+       public Country getCountry () {
+               return this.country;
+       }
+
+       @Override
+       public void setCountry (final Country country) {
+               this.country = country;
+       }
 }
index 7aecf88b47976e848166a66ae2fa8d01c0d8d2cd..16cdec03dd7a91bc065dfa1a1f6ef2d49a573d75 100644 (file)
 package org.mxchange.jphone.phonenumbers.fax;
 
 import javax.persistence.Basic;
+import javax.persistence.CascadeType;
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToOne;
 import javax.persistence.Table;
+import org.mxchange.jcountry.data.Country;
+import org.mxchange.jcountry.data.CountryData;
 
 /**
  * A POJO for dialable fax numbers
@@ -42,7 +47,7 @@ public class FaxNumber implements DialableFaxNumber, Comparable<DialableFaxNumbe
         * Id number
         */
        @Id
-       @GeneratedValue(strategy = GenerationType.IDENTITY)
+       @GeneratedValue (strategy = GenerationType.IDENTITY)
        @Column (name = "fax_id", length = 20, nullable = false, updatable = false)
        private Long phoneId;
 
@@ -60,6 +65,13 @@ public class FaxNumber implements DialableFaxNumber, Comparable<DialableFaxNumbe
        @Column (name = "fax_area_code", length = 10, nullable = false)
        private Integer phoneAreaCode;
 
+       /**
+        * Country instance ('s dial data)
+        */
+       @JoinColumn (name = "fax_country_id", nullable = false)
+       @OneToOne (targetEntity = CountryData.class, optional = false, cascade = CascadeType.ALL)
+       private Country country;
+
        @Override
        public Long getPhoneId () {
                return this.phoneId;
@@ -95,4 +107,14 @@ public class FaxNumber implements DialableFaxNumber, Comparable<DialableFaxNumbe
                this.phoneAreaCode = phoneAreaCode;
        }
 
+       @Override
+       public Country getCountry () {
+               return this.country;
+       }
+
+       @Override
+       public void setCountry (final Country country) {
+               this.country = country;
+       }
+
 }
index d1b265e170158183d38bf8719bcef9e5a676e737..73d4145e937272904e6bc8395bcba9193bb2fce9 100644 (file)
@@ -68,9 +68,9 @@ public class LandLineNumber implements DialableLandLineNumber, Comparable<Dialab
        /**
         * Connection to table "country_data"
         */
-       @JoinColumn(name = "phone_country_id", nullable = false, updatable = false)
-       @OneToOne(targetEntity = CountryData.class, cascade = CascadeType.ALL, optional = false)
-       private Country phoneCountry;
+       @JoinColumn (name = "phone_country_id", nullable = false, updatable = false)
+       @OneToOne (targetEntity = CountryData.class, cascade = CascadeType.ALL, optional = false)
+       private Country country;
 
        @Override
        public Long getPhoneId () {
@@ -106,4 +106,14 @@ public class LandLineNumber implements DialableLandLineNumber, Comparable<Dialab
        public int compareTo (final DialableLandLineNumber dialableNumber) {
                throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }
+
+       @Override
+       public Country getCountry () {
+               return this.country;
+       }
+
+       @Override
+       public void setCountry (final Country country) {
+               this.country = country;
+       }
 }
index f879aeeb92b3b1276b7b21bbbd7a5d4c832e4e67..d1f7fcd15d0c83625564d9baac138789a0c0e71c 100644 (file)
  */
 package org.mxchange.jphone.phonenumbers.smsprovider;
 
+import javax.persistence.CascadeType;
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToOne;
 import javax.persistence.Table;
+import org.mxchange.jcountry.data.Country;
+import org.mxchange.jcountry.data.CountryData;
 
 /**
  * A POJO for cellphone providers
@@ -55,6 +60,13 @@ public class CellphoneProvider implements SmsProvider {
         */
        private String providerName;
 
+       /**
+        * Country instance ('s dial data)
+        */
+       @JoinColumn (name = "provider_country_id", nullable = false)
+       @OneToOne (targetEntity = CountryData.class, optional = false, cascade = CascadeType.ALL)
+       private Country country;
+
        @Override
        public Long getProviderId () {
                return providerId;
@@ -85,4 +97,14 @@ public class CellphoneProvider implements SmsProvider {
                this.providerName = providerName;
        }
 
+       @Override
+       public Country getCountry () {
+               return this.country;
+       }
+
+       @Override
+       public void setCountry (final Country country) {
+               this.country = country;
+       }
+
 }
index 557057d15a4a06b9c982ce49f3c35b353ed71912..fc096c1735ee8b1499937fc28c69ebc358bfdd86 100644 (file)
@@ -17,6 +17,7 @@
 package org.mxchange.jphone.phonenumbers.smsprovider;
 
 import java.io.Serializable;
+import org.mxchange.jcountry.data.Country;
 
 /**
  * A POJO for SMS provider
@@ -66,4 +67,18 @@ public interface SmsProvider extends Serializable {
         * @param providerName Provider name
         */
        public void setProviderName (final String providerName);
+
+       /**
+        * Getter for country instance ('s dial data)
+        * <p>
+        * @return Country instance
+        */
+       public Country getCountry ();
+
+       /**
+        * Setter for country instance ('s dial data)
+        * <p>
+        * @param country Country instance
+        */
+       public void setCountry (final Country country);
 }