]> git.mxchange.org Git - jphone-core.git/commitdiff
Continued a bit:
authorRoland Häder <roland@mxchange.org>
Mon, 8 Aug 2016 14:00:36 +0000 (16:00 +0200)
committerRoland Häder <roland@mxchange.org>
Mon, 8 Aug 2016 14:00:36 +0000 (16:00 +0200)
- added named queries for all cellphone, land-line and fax numbers separately
- added annotation for ignoring not fixable warnings
- sorted members

src/org/mxchange/jphone/phonenumbers/cellphone/CellphoneNumber.java
src/org/mxchange/jphone/phonenumbers/fax/FaxNumber.java
src/org/mxchange/jphone/phonenumbers/landline/LandLineNumber.java

index 8868c242121a92b5a863bc36a93a2a6126924447..d2e835f2e54c9fc16c4f05b676370cc1becc4036 100644 (file)
@@ -45,7 +45,10 @@ import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider;
 @Entity (name = "cellphone_numbers")
 @Table (name = "cellphone_numbers")
 @NamedQueries (
-               @NamedQuery (name = "SearchCellphoneId", query = "SELECT c FROM cellphone_numbers AS c WHERE c.phoneId = :cellphoneId")
+               {
+                       @NamedQuery (name = "AllCellphoneNumbers", query = "SELECT c FROM cellphone_numbers AS c ORDER BY c.phoneId ASC"),
+                       @NamedQuery (name = "SearchCellphoneId", query = "SELECT c FROM cellphone_numbers AS c WHERE c.phoneId = :cellphoneId")
+               }
 )
 @SuppressWarnings ("PersistenceUnitPresent")
 public class CellphoneNumber implements DialableCellphoneNumber {
@@ -103,7 +106,7 @@ public class CellphoneNumber implements DialableCellphoneNumber {
         * Constructor with cellphone provider and number
         * <p>
         * @param cellphoneProvider Cellphone provider instance
-        * @param cellphoneNumber   Cellphone number
+        * @param cellphoneNumber Cellphone number
         */
        public CellphoneNumber (final MobileProvider cellphoneProvider, final Long cellphoneNumber) {
                // Call default constructor
@@ -142,14 +145,6 @@ public class CellphoneNumber implements DialableCellphoneNumber {
                return true;
        }
 
-       @Override
-       public int hashCode () {
-               int hash = 5;
-               hash = 97 * hash + Objects.hashCode(this.getCellphoneProvider());
-               hash = 97 * hash + Objects.hashCode(this.getPhoneNumber());
-               return hash;
-       }
-
        @Override
        public MobileProvider getCellphoneProvider () {
                return this.cellphoneProvider;
@@ -228,4 +223,14 @@ public class CellphoneNumber implements DialableCellphoneNumber {
                this.phoneNumber = phoneNumber;
        }
 
+       @Override
+       public int hashCode () {
+               int hash = 5;
+
+               hash = 97 * hash + Objects.hashCode(this.getCellphoneProvider());
+               hash = 97 * hash + Objects.hashCode(this.getPhoneNumber());
+
+               return hash;
+       }
+
 }
index eb639777c993cbb2f5c8dc004bd149a0edaec832..92dd5d9ac76e449a853b15e553f58fa51be3d439 100644 (file)
@@ -44,7 +44,10 @@ import org.mxchange.jcountry.data.CountryData;
 @Entity (name = "fax_numbers")
 @Table (name = "fax_numbers")
 @NamedQueries (
-               @NamedQuery (name = "SearchFaxId", query = "SELECT f FROM fax_numbers AS f WHERE f.phoneId = :faxId")
+               {
+                       @NamedQuery (name = "AllFaxNumbers", query = "SELECT f FROM fax_numbers AS f ORDER BY f.phoneId ASC"),
+                       @NamedQuery (name = "SearchFaxId", query = "SELECT f FROM fax_numbers AS f WHERE f.phoneId = :faxId")
+               }
 )
 @SuppressWarnings ("PersistenceUnitPresent")
 public class FaxNumber implements DialableFaxNumber {
@@ -108,9 +111,9 @@ public class FaxNumber implements DialableFaxNumber {
        /**
         * Constructor with country, area code and number
         * <p>
-        * @param faxCountry        Country instance
-        * @param faxAreaCode       Area code (without leading zeros)
-        * @param faxNumber         Fax number (without area code and leading zero)
+        * @param faxCountry Country instance
+        * @param faxAreaCode Area code (without leading zeros)
+        * @param faxNumber Fax number (without area code and leading zero)
         */
        public FaxNumber (final Country faxCountry, final Integer faxAreaCode, final Long faxNumber) {
                // Call default constructor
index 6d6dfdea884f546133ea2337e446870c6362f871..c567c4ca4a17708dad843bb0b8b9a09565739ed2 100644 (file)
@@ -44,7 +44,10 @@ import org.mxchange.jcountry.data.CountryData;
 @Entity (name = "phone_numbers")
 @Table (name = "phone_numbers")
 @NamedQueries (
-               @NamedQuery (name = "SearchLandLineId", query = "SELECT p FROM phone_numbers AS p WHERE p.phoneId = :phoneId")
+               {
+                       @NamedQuery (name = "AllLandLineNumbers", query = "SELECT p FROM phone_numbers AS p ORDER BY p.phoneId ASC"),
+                       @NamedQuery (name = "SearchLandLineId", query = "SELECT p FROM phone_numbers AS p WHERE p.phoneId = :phoneId")
+               }
 )
 @SuppressWarnings ("PersistenceUnitPresent")
 public class LandLineNumber implements DialableLandLineNumber {
@@ -108,9 +111,9 @@ public class LandLineNumber implements DialableLandLineNumber {
        /**
         * Constructor with country instance, area code and number
         * <p>
-        * @param phoneCountry      Country instance
-        * @param phoneAreaCode     Phone area code
-        * @param phoneNumber       Phone number
+        * @param phoneCountry Country instance
+        * @param phoneAreaCode Phone area code
+        * @param phoneNumber Phone number
         */
        public LandLineNumber (final Country phoneCountry, final Integer phoneAreaCode, final Long phoneNumber) {
                // Call default constructor
@@ -153,15 +156,6 @@ public class LandLineNumber implements DialableLandLineNumber {
                return true;
        }
 
-       @Override
-       public int hashCode () {
-               int hash = 7;
-               hash = 47 * hash + Objects.hashCode(this.getPhoneNumber());
-               hash = 47 * hash + Objects.hashCode(this.getPhoneAreaCode());
-               hash = 47 * hash + Objects.hashCode(this.getPhoneCountry());
-               return hash;
-       }
-
        @Override
        public Integer getPhoneAreaCode () {
                return this.phoneAreaCode;
@@ -189,6 +183,7 @@ public class LandLineNumber implements DialableLandLineNumber {
        }
 
        @Override
+       @SuppressWarnings ("AssignmentToDateFieldFromParameter")
        public void setPhoneEntryCreated (final Calendar phoneEntryCreated) {
                this.phoneEntryCreated = phoneEntryCreated;
        }
@@ -200,6 +195,7 @@ public class LandLineNumber implements DialableLandLineNumber {
        }
 
        @Override
+       @SuppressWarnings ("AssignmentToDateFieldFromParameter")
        public void setPhoneEntryUpdated (final Calendar phoneEntryUpdated) {
                this.phoneEntryUpdated = phoneEntryUpdated;
        }
@@ -224,4 +220,15 @@ public class LandLineNumber implements DialableLandLineNumber {
                this.phoneNumber = phoneNumber;
        }
 
+       @Override
+       public int hashCode () {
+               int hash = 7;
+
+               hash = 47 * hash + Objects.hashCode(this.getPhoneNumber());
+               hash = 47 * hash + Objects.hashCode(this.getPhoneAreaCode());
+               hash = 47 * hash + Objects.hashCode(this.getPhoneCountry());
+
+               return hash;
+       }
+
 }