]> git.mxchange.org Git - jphone-core.git/commitdiff
Continued:
authorRoland Haeder <roland@mxchange.org>
Thu, 22 Oct 2015 08:25:28 +0000 (10:25 +0200)
committerRoland Haeder <roland@mxchange.org>
Thu, 22 Oct 2015 08:25:28 +0000 (10:25 +0200)
- added timestamps for administrative purposes
- added it to existing constructors
- added constructor for cellphone provider + protected default
- updated jar(s)
Signed-off-by:Roland Häder <roland@mxchange.org>

lib/jcountry-core.jar
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 234d3fbe4b8bfd5ad614a4b2509deb29ba454fef..28024eeb45e65d2334a4e91585545cbe4004aa66 100644 (file)
Binary files a/lib/jcountry-core.jar and b/lib/jcountry-core.jar differ
index ca10dc743464bbfeedfd4e996b14f69d2f012a6b..9bbf1e185dfff9ec29c90ee072f0d1432fc7d3f4 100644 (file)
@@ -17,6 +17,7 @@
 package org.mxchange.jphone.phonenumbers;
 
 import java.io.Serializable;
+import java.util.Calendar;
 import org.mxchange.jcountry.data.Country;
 
 /**
@@ -81,4 +82,18 @@ public interface DialableNumber extends Serializable {
         * @param phoneAreaCode Area code without dial prefix
         */
        void setPhoneAreaCode (final Integer phoneAreaCode);
+
+       /**
+        * Getter for timestamp when this entry has been created
+        * <p>
+        * @return Timestamp when this entry has been created
+        */
+       Calendar getPhoneEntryCreated ();
+
+       /**
+        * Setter for timestamp when this entry has been created
+        * <p>
+        * @param phoneEntryCreated Timestamp when this entry has been created
+        */
+       void setPhoneEntryCreated (final Calendar phoneEntryCreated);
 }
index c3e10b5072b1d0668a2095337aef099f210aee4b..681d0c750388f932ab3ac3bcbcd92e18f3299060 100644 (file)
@@ -16,6 +16,7 @@
  */
 package org.mxchange.jphone.phonenumbers.cellphone;
 
+import java.util.Calendar;
 import java.util.Objects;
 import javax.persistence.Basic;
 import javax.persistence.CascadeType;
@@ -28,6 +29,8 @@ import javax.persistence.Id;
 import javax.persistence.JoinColumn;
 import javax.persistence.OneToOne;
 import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
 import org.mxchange.jcountry.data.Country;
 import org.mxchange.jphone.phonenumbers.smsprovider.CellphoneProvider;
 import org.mxchange.jphone.phonenumbers.smsprovider.SmsProvider;
@@ -58,7 +61,7 @@ public class CellphoneNumber implements DialableCellphoneNumber, Comparable<Dial
         * Connection to table "cellphone_provider" (for dial prefix and more data)
         */
        @JoinColumn (name = "cellphone_provider_id", nullable = false)
-       @OneToOne (targetEntity = CellphoneProvider.class, cascade = CascadeType.ALL, optional = false, fetch = FetchType.EAGER)
+       @OneToOne (targetEntity = CellphoneProvider.class, cascade = CascadeType.MERGE, optional = false, fetch = FetchType.EAGER)
        private SmsProvider cellphoneProvider;
 
        /**
@@ -68,15 +71,25 @@ public class CellphoneNumber implements DialableCellphoneNumber, Comparable<Dial
        @Column (name = "cellphone_number", length = 20, nullable = false)
        private Long phoneNumber;
 
+       /**
+        * Timestamp when this entry has been created
+        */
+       @Basic (optional = false)
+       @Temporal (TemporalType.TIMESTAMP)
+       @Column (name = "cellphone_entry_created", nullable = false, updatable = false)
+       private Calendar phoneEntryCreated;
+
        /**
         * Contructor with cellphone carrier and number
         * <p>
         * @param cellphoneCarrier Cellphone carrier instance
         * @param cellphoneNumber Cellphone number
+        * @param phoneEntryCreated When this entry has been created
         */
-       public CellphoneNumber (final SmsProvider cellphoneCarrier, final Long cellphoneNumber) {
+       public CellphoneNumber (final SmsProvider cellphoneCarrier, final Long cellphoneNumber, final Calendar phoneEntryCreated) {
                this.cellphoneProvider = cellphoneCarrier;
                this.phoneNumber = cellphoneNumber;
+               this.phoneEntryCreated = phoneEntryCreated;
        }
 
        /**
@@ -116,6 +129,16 @@ public class CellphoneNumber implements DialableCellphoneNumber, Comparable<Dial
                throw new UnsupportedOperationException("The country code is provided by SmsProvider."); //To change body of generated methods, choose Tools | Templates.
        }
 
+       @Override
+       public Calendar getPhoneEntryCreated () {
+               return this.phoneEntryCreated;
+       }
+
+       @Override
+       public void setPhoneEntryCreated (final Calendar phoneEntryCreated) {
+               this.phoneEntryCreated = phoneEntryCreated;
+       }
+
        @Override
        public Long getPhoneId () {
                return this.phoneId;
index 81d873fd41e738cf276e4e237f580beb6865f3e8..0a89e5ec42224bd359c1ff3274d4ba550d836d2a 100644 (file)
@@ -16,6 +16,7 @@
  */
 package org.mxchange.jphone.phonenumbers.fax;
 
+import java.util.Calendar;
 import java.util.Objects;
 import javax.persistence.Basic;
 import javax.persistence.CascadeType;
@@ -28,6 +29,8 @@ import javax.persistence.Id;
 import javax.persistence.JoinColumn;
 import javax.persistence.OneToOne;
 import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
 import org.mxchange.jcountry.data.Country;
 import org.mxchange.jcountry.data.CountryData;
 
@@ -45,6 +48,14 @@ public class FaxNumber implements DialableFaxNumber, Comparable<DialableFaxNumbe
         */
        private static final long serialVersionUID = 17_687_687_191_375L;
 
+       /**
+        * Timestamp when this entry has been created
+        */
+       @Basic (optional = false)
+       @Temporal (TemporalType.TIMESTAMP)
+       @Column (name = "fax_entry_created", nullable = false, updatable = false)
+       private Calendar phoneEntryCreated;
+
        /**
         * Id number
         */
@@ -80,11 +91,13 @@ public class FaxNumber implements DialableFaxNumber, Comparable<DialableFaxNumbe
         * @param faxCountry Country instance
         * @param faxAreaCode Area code (without leading zeros)
         * @param faxNumber Fax number (without area code and leading zero)
+        * @param phoneEntryCreated When this entry has been created
         */
-       public FaxNumber (final Country faxCountry, final Integer faxAreaCode, final Long faxNumber) {
+       public FaxNumber (final Country faxCountry, final Integer faxAreaCode, final Long faxNumber, final Calendar phoneEntryCreated) {
                this.faxCountry = faxCountry;
                this.faxAreaCode = faxAreaCode;
                this.phoneNumber = faxNumber;
+               this.phoneEntryCreated = phoneEntryCreated;
        }
 
        /**
@@ -93,27 +106,6 @@ public class FaxNumber implements DialableFaxNumber, Comparable<DialableFaxNumbe
        protected FaxNumber () {
        }
 
-       @Override
-       public boolean equals (final Object object) {
-               if (object == null) {
-                       return false;
-               } else if (getClass() != object.getClass()) {
-                       return false;
-               }
-
-               final DialableFaxNumber other = (DialableFaxNumber) object;
-
-               if (!Objects.equals(this.getPhoneNumber(), other.getPhoneNumber())) {
-                       return false;
-               } else if (!Objects.equals(this.getPhoneAreaCode(), other.getPhoneAreaCode())) {
-                       return false;
-               } else if (!Objects.equals(this.getPhoneCountry(), other.getPhoneCountry())) {
-                       return false;
-               }
-
-               return true;
-       }
-
        @Override
        public Long getPhoneId () {
                return this.phoneId;
@@ -134,11 +126,6 @@ public class FaxNumber implements DialableFaxNumber, Comparable<DialableFaxNumbe
                this.phoneNumber = phoneNumber;
        }
 
-       @Override
-       public int compareTo (final DialableFaxNumber dialableFaxNumber) {
-               throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
-       }
-
        @Override
        public Integer getPhoneAreaCode () {
                return this.faxAreaCode;
@@ -159,6 +146,42 @@ public class FaxNumber implements DialableFaxNumber, Comparable<DialableFaxNumbe
                this.faxCountry = faxCountry;
        }
 
+       @Override
+       public Calendar getPhoneEntryCreated () {
+               return this.phoneEntryCreated;
+       }
+
+       @Override
+       public void setPhoneEntryCreated (final Calendar phoneEntryCreated) {
+               this.phoneEntryCreated = phoneEntryCreated;
+       }
+
+       @Override
+       public int compareTo (final DialableFaxNumber dialableFaxNumber) {
+               throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+       }
+
+       @Override
+       public boolean equals (final Object object) {
+               if (object == null) {
+                       return false;
+               } else if (getClass() != object.getClass()) {
+                       return false;
+               }
+
+               final DialableFaxNumber other = (DialableFaxNumber) object;
+
+               if (!Objects.equals(this.getPhoneNumber(), other.getPhoneNumber())) {
+                       return false;
+               } else if (!Objects.equals(this.getPhoneAreaCode(), other.getPhoneAreaCode())) {
+                       return false;
+               } else if (!Objects.equals(this.getPhoneCountry(), other.getPhoneCountry())) {
+                       return false;
+               }
+
+               return true;
+       }
+
        @Override
        public int hashCode () {
                int hash = 3;
index 57af41c37988bef47ff85cb82aa20a5d03191972..158c39f255b27f9afa5835d878642e2c7b3dd3a5 100644 (file)
@@ -16,6 +16,7 @@
  */
 package org.mxchange.jphone.phonenumbers.landline;
 
+import java.util.Calendar;
 import java.util.Objects;
 import javax.persistence.Basic;
 import javax.persistence.CascadeType;
@@ -28,6 +29,8 @@ import javax.persistence.Id;
 import javax.persistence.JoinColumn;
 import javax.persistence.OneToOne;
 import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
 import org.mxchange.jcountry.data.Country;
 import org.mxchange.jcountry.data.CountryData;
 
@@ -45,6 +48,14 @@ public class LandLineNumber implements DialableLandLineNumber, Comparable<Dialab
         */
        private static final long serialVersionUID = 18_563_748_781_956L;
 
+       /**
+        * Timestamp when this entry has been created
+        */
+       @Basic (optional = false)
+       @Temporal (TemporalType.TIMESTAMP)
+       @Column (name = "phone_entry_created", nullable = false, updatable = false)
+       private Calendar phoneEntryCreated;
+
        /**
         * Id number
         */
@@ -80,11 +91,13 @@ public class LandLineNumber implements DialableLandLineNumber, Comparable<Dialab
         * @param phoneCountry Country instance
         * @param phoneAreaCode Phone area code
         * @param phoneNumber Phone number
+        * @param phoneEntryCreated When this entry has been created
         */
-       public LandLineNumber (final Country phoneCountry, final Integer phoneAreaCode, final Long phoneNumber) {
+       public LandLineNumber (final Country phoneCountry, final Integer phoneAreaCode, final Long phoneNumber, final Calendar phoneEntryCreated) {
                this.phoneCountry = phoneCountry;
                this.phoneAreaCode = phoneAreaCode;
                this.phoneNumber = phoneNumber;
+               this.phoneEntryCreated = phoneEntryCreated;
        }
 
        /**
@@ -93,27 +106,6 @@ public class LandLineNumber implements DialableLandLineNumber, Comparable<Dialab
        protected LandLineNumber () {
        }
 
-       @Override
-       public boolean equals (Object object) {
-               if (object == null) {
-                       return false;
-               } else if (getClass() != object.getClass()) {
-                       return false;
-               }
-
-               final DialableLandLineNumber other = (DialableLandLineNumber) object;
-
-               if (!Objects.equals(this.getPhoneNumber(), other.getPhoneNumber())) {
-                       return false;
-               } else if (!Objects.equals(this.getPhoneAreaCode(), other.getPhoneAreaCode())) {
-                       return false;
-               } else if (!Objects.equals(this.getPhoneCountry(), other.getPhoneCountry())) {
-                       return false;
-               }
-
-               return true;
-       }
-
        @Override
        public Long getPhoneId () {
                return this.phoneId;
@@ -144,11 +136,6 @@ public class LandLineNumber implements DialableLandLineNumber, Comparable<Dialab
                this.phoneAreaCode = phoneAreaCode;
        }
 
-       @Override
-       public int compareTo (final DialableLandLineNumber dialableNumber) {
-               throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
-       }
-
        @Override
        public Country getPhoneCountry () {
                return this.phoneCountry;
@@ -159,6 +146,42 @@ public class LandLineNumber implements DialableLandLineNumber, Comparable<Dialab
                this.phoneCountry = phoneCountry;
        }
 
+       @Override
+       public Calendar getPhoneEntryCreated () {
+               return this.phoneEntryCreated;
+       }
+
+       @Override
+       public void setPhoneEntryCreated (final Calendar phoneEntryCreated) {
+               this.phoneEntryCreated = phoneEntryCreated;
+       }
+
+       @Override
+       public int compareTo (final DialableLandLineNumber dialableNumber) {
+               throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+       }
+
+       @Override
+       public boolean equals (Object object) {
+               if (object == null) {
+                       return false;
+               } else if (getClass() != object.getClass()) {
+                       return false;
+               }
+
+               final DialableLandLineNumber other = (DialableLandLineNumber) object;
+
+               if (!Objects.equals(this.getPhoneNumber(), other.getPhoneNumber())) {
+                       return false;
+               } else if (!Objects.equals(this.getPhoneAreaCode(), other.getPhoneAreaCode())) {
+                       return false;
+               } else if (!Objects.equals(this.getPhoneCountry(), other.getPhoneCountry())) {
+                       return false;
+               }
+
+               return true;
+       }
+
        @Override
        public int hashCode () {
                int hash = 7;
index 7620f200b268177bbd9f043202e2e1b83d2ce2be..4724ceda1f7d6af9cde92002dab11b37e2edc001 100644 (file)
@@ -16,6 +16,7 @@
  */
 package org.mxchange.jphone.phonenumbers.smsprovider;
 
+import java.util.Calendar;
 import java.util.Objects;
 import javax.persistence.Basic;
 import javax.persistence.CascadeType;
@@ -30,6 +31,8 @@ import javax.persistence.NamedQueries;
 import javax.persistence.NamedQuery;
 import javax.persistence.OneToOne;
 import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
 import org.mxchange.jcountry.data.Country;
 import org.mxchange.jcountry.data.CountryData;
 
@@ -79,35 +82,38 @@ public class CellphoneProvider implements SmsProvider, Comparable<SmsProvider> {
        @OneToOne (targetEntity = CountryData.class, cascade = CascadeType.ALL, optional = false, fetch = FetchType.EAGER)
        private Country providerCountry;
 
-       @Override
-       public int compareTo (final SmsProvider provider) {
-               throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
-       }
-
-       @Override
-       public boolean equals (final Object object) {
-               if (object == null) {
-                       return false;
-               } else if (getClass() != object.getClass()) {
-                       return false;
-               }
-
-               final SmsProvider other = (SmsProvider) object;
+       /**
+        * Timestamp when this entry has been created
+        */
+       @Basic (optional = false)
+       @Temporal (TemporalType.TIMESTAMP)
+       @Column (name = "provider_entry_created", nullable = false, updatable = false)
+       private Calendar providerEntryCreated;
 
-               if (!Objects.equals(this.getProviderDialPrefix(), other.getProviderDialPrefix())) {
-                       return false;
-               } else if (!Objects.equals(this.getProviderName(), other.getProviderName())) {
-                       return false;
-               } else if (!Objects.equals(this.getProviderCountry(), other.getProviderCountry())) {
-                       return false;
-               }
+       /**
+        * Protected constructor for JPA
+        */
+       protected CellphoneProvider () {
+       }
 
-               return true;
+       /**
+        * Constructor with all required data
+        * <p>
+        * @param providerDialPrefix Dial prefix
+        * @param providerName Name
+        * @param providerCountry Country
+        * @param providerEntryCreated When this entry has been created
+        */
+       public CellphoneProvider (final Long providerDialPrefix, final String providerName, final Country providerCountry, final Calendar providerEntryCreated) {
+               this.providerDialPrefix = providerDialPrefix;
+               this.providerName = providerName;
+               this.providerCountry = providerCountry;
+               this.providerEntryCreated = providerEntryCreated;
        }
 
        @Override
        public Long getProviderId () {
-               return providerId;
+               return this.providerId;
        }
 
        @Override
@@ -117,7 +123,7 @@ public class CellphoneProvider implements SmsProvider, Comparable<SmsProvider> {
 
        @Override
        public Long getProviderDialPrefix () {
-               return providerDialPrefix;
+               return this.providerDialPrefix;
        }
 
        @Override
@@ -127,7 +133,7 @@ public class CellphoneProvider implements SmsProvider, Comparable<SmsProvider> {
 
        @Override
        public String getProviderName () {
-               return providerName;
+               return this.providerName;
        }
 
        @Override
@@ -145,6 +151,42 @@ public class CellphoneProvider implements SmsProvider, Comparable<SmsProvider> {
                this.providerCountry = providerCountry;
        }
 
+       @Override
+       public Calendar getProviderEntryCreated () {
+               return this.providerEntryCreated;
+       }
+
+       @Override
+       public void setProviderEntryCreated (final Calendar providerEntryCreated) {
+               this.providerEntryCreated = providerEntryCreated;
+       }
+
+       @Override
+       public int compareTo (final SmsProvider provider) {
+               throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+       }
+
+       @Override
+       public boolean equals (final Object object) {
+               if (object == null) {
+                       return false;
+               } else if (getClass() != object.getClass()) {
+                       return false;
+               }
+
+               final SmsProvider other = (SmsProvider) object;
+
+               if (!Objects.equals(this.getProviderDialPrefix(), other.getProviderDialPrefix())) {
+                       return false;
+               } else if (!Objects.equals(this.getProviderName(), other.getProviderName())) {
+                       return false;
+               } else if (!Objects.equals(this.getProviderCountry(), other.getProviderCountry())) {
+                       return false;
+               }
+
+               return true;
+       }
+
        @Override
        public int hashCode () {
                int hash = 7;
index 7d13a26b426dc02224582a1baad04e6f0847c4e3..a9e1e041c656a355e13216992b3351142996a358 100644 (file)
@@ -17,6 +17,7 @@
 package org.mxchange.jphone.phonenumbers.smsprovider;
 
 import java.io.Serializable;
+import java.util.Calendar;
 import org.mxchange.jcountry.data.Country;
 
 /**
@@ -82,6 +83,20 @@ public interface SmsProvider extends Serializable {
         */
        void setProviderCountry (final Country country);
 
+       /**
+        * Getter for timestamp when this entry has been created
+        * <p>
+        * @return Timestamp when this entry has been created
+        */
+       Calendar getProviderEntryCreated ();
+
+       /**
+        * Setter for timestamp when this entry has been created
+        * <p>
+        * @param providerEntryCreated Timestamp when this entry has been created
+        */
+       void setProviderEntryCreated (final Calendar providerEntryCreated);
+
        @Override
         boolean equals (final Object object);